@rings-webgpu/core 1.0.41 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rings.es.js +51 -23
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +118 -37
- package/dist/rings.umd.js +50 -22
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +118 -37
- package/dist/types/gfx/renderJob/GPUContext.d.ts +2 -0
- package/dist/types/loader/parser/tileRenderer/TilesRenderer.d.ts +1 -0
- package/package.json +1 -1
package/dist/rings.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class J{static COLOR_RED=new J(1,0,0,1);static COLOR_GREEN=new J(0,1,0,1);static COLOR_BLUE=new J(0,0,1,1);static COLOR_WHITE=new J(1,1,1,1);static COLOR_0=new J;static COLOR_1=new J;static COLOR_2=new J;static HEX_CHARACTERS="a-f\\d";static MATCH_3OR4_HEX=`#?[${J.HEX_CHARACTERS}]{3}[${J.HEX_CHARACTERS}]?`;static MATCH_6OR8_HEX=`#?[${J.HEX_CHARACTERS}]{6}([${J.HEX_CHARACTERS}]{2})?`;static NON_HEX_CHARS=new RegExp(`[^#${J.HEX_CHARACTERS}]`,"gi");static VALID_HEX_SIZE=new RegExp(`^${J.MATCH_3OR4_HEX}$|^${J.MATCH_6OR8_HEX}$`,"i");r=0;g=0;b=0;a=0;constructor(e=1,t=1,a=1,r=1){this.setTo(e,t,a,r)}convertToHDRRGB(){return this.r=this.r*Math.pow(2.4,this.a),this.g=this.g*Math.pow(2.4,this.a),this.b=this.b*Math.pow(2.4,this.a),this}unSerialized(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}hexToRGB(e){return this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}hexToRGBA(e){return this.a=(e>>24&255)/255,this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}static random(e=1){let t=new J;return t.a=e,t.r=e*Math.random(),t.g=e*Math.random(),t.b=e*Math.random(),t}static randomRGB(e=.5,t=.5,a=.5,r=.5,i=.5,n=.5){let o=new J;return o.a=1,o.r=r+e*Math.random(),o.g=i+t*Math.random(),o.b=n+a*Math.random(),o}static randomGray(e=.5,t=.5){let a=Math.random()*t+e,r=new J;return r.a=1,r.r=a,r.g=a,r.b=a,r}setTo(e,t,a,r){this.r=Math.max(e,0),this.g=Math.max(t,0),this.b=Math.max(a,0),this.a=Math.max(r,0)}setHex(e){if(typeof e!="string"||J.NON_HEX_CHARS.test(e)||!J.VALID_HEX_SIZE.test(e))throw new TypeError("Expected a valid hex string");e=e.replace(/^#/,"");let t=1;e.length===8&&(t=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(t=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const a=Number.parseInt(e,16),r=a>>16,i=a>>8&255,n=a&255,o=t;this.a=o,this.r=r/255,this.g=i/255,this.b=n/255}getHex(){let e=a=>{a*=255;let r=a.toString(16);return r.length===1&&(r="0"+r),r};return e(this.r)+e(this.g)+e(this.b)+e(this.a)}get rgb(){return[this.r*255>>>0,this.g*255>>>0,this.b*255>>>0]}set rgb(e){this.setTo(e[0]/255,e[1]/255,e[2]/255,this.a)}get rgba(){return[this.r*255>>>0,this.g*255>>>0,this.b*255>>>0,this.a*255>>>0]}set rgba(e){this.setTo(e[0]/255,e[1]/255,e[2]/255,e[3]/255)}clone(){return new J().copyFrom(this)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}copyFromArray(e,t=255){return this.r=e[0]/t,this.g=e[1]/t,this.b=e[2]/t,this.a=e[3]/t,this}copyFromVector(e){return this.r=e.x,this.g=e.y,this.b=e.z,this.a=e.w||1,this}static hexRGBColor(e,t=null){return t=t||new J,t.hexToRGB(e),t}static lerp(e,t,a,r){let i=r||new J;return i.r=(a.r-t.r)*e+t.r,i.g=(a.g-t.g)*e+t.g,i.b=(a.b-t.b)*e+t.b,i.a=(a.a-t.a)*e+t.a,i}static PRIMARY=4149685;static PRIMARYDARK=3162015;static ACCENT=16728193;static WHITE=16777215;static IVORY=16777200;static LIGHTYELLOW=16777184;static YELLOW=16776960;static SNOW=16775930;static FLORALWHITE=16775920;static LEMONCHIFFON=16775885;static CORNSILK=16775388;static SEASHELL=16774638;static LAVENDERBLUSH=16773365;static PAPAYAWHIP=16773077;static BLANCHEDALMOND=16772045;static MISTYROSE=16770273;static BISQUE=16770244;static MOCCASIN=16770229;static NAVAJOWHITE=16768685;static PEACHPUFF=16767673;static GOLD=16766720;static PINK=16761035;static LIGHTPINK=16758465;static ORANGE=16753920;static LIGHTSALMON=16752762;static DARKORANGE=16747520;static CORAL=16744272;static HOTPINK=16738740;static TOMATO=16737095;static ORANGERED=16729344;static DEEPPINK=16716947;static FUCHSIA=16711935;static MAGENTA=16711935;static RED=16711680;static OLDLACE=16643558;static LIGHTGOLDENRODYELLOW=16448210;static LINEN=16445670;static ANTIQUEWHITE=16444375;static SALMON=16416882;static GHOSTWHITE=16316671;static MINTCREAM=16121850;static WHITESMOKE=16119285;static BEIGE=16119260;static WHEAT=16113331;static SANDYBROWN=16032864;static AZURE=15794175;static HONEYDEW=15794160;static ALICEBLUE=15792383;static KHAKI=15787660;static LIGHTCORAL=15761536;static PALEGOLDENROD=15657130;static VIOLET=15631086;static DARKSALMON=15308410;static LAVENDER=15132410;static LIGHTCYAN=14745599;static BURLYWOOD=14596231;static PLUM=14524637;static GAINSBORO=14474460;static CRIMSON=14423100;static PALEVIOLETRED=14381203;static GOLDENROD=14329120;static ORCHID=14315734;static THISTLE=14204888;static LIGHTGREY=13882323;static TAN=13808780;static CHOCOLATE=13789470;static PERU=13468991;static INDIANRED=13458524;static MEDIUMVIOLETRED=13047173;static SILVER=12632256;static DARKKHAKI=12433259;static ROSYBROWN=12357519;static MEDIUMORCHID=12211667;static DARKGOLDENROD=12092939;static FIREBRICK=11674146;static POWDERBLUE=11591910;static LIGHTSTEELBLUE=11584734;static PALETURQUOISE=11529966;static GREENYELLOW=11403055;static LIGHTBLUE=11393254;static DARKGRAY=11119017;static BROWN=10824234;static SIENNA=10506797;static DARKORCHID=10040012;static PALEGREEN=10025880;static DARKVIOLET=9699539;static MEDIUMPURPLE=9662683;static LIGHTGREEN=9498256;static DARKSEAGREEN=9419919;static SADDLEBROWN=9127187;static DARKMAGENTA=9109643;static DARKRED=9109504;static BLUEVIOLET=9055202;static LIGHTSKYBLUE=8900346;static SKYBLUE=8900331;static GRAY=8421504;static OLIVE=8421376;static PURPLE=8388736;static MAROON=8388608;static AQUAMARINE=8388564;static CHARTREUSE=8388352;static LAWNGREEN=8190976;static MEDIUMSLATEBLUE=8087790;static LIGHTSLATEGRAY=7833753;static SLATEGRAY=7372944;static OLIVEDRAB=7048739;static SLATEBLUE=6970061;static DIMGRAY=6908265;static MEDIUMAQUAMARINE=6737322;static CORNFLOWERBLUE=6591981;static CADETBLUE=6266528;static DARKOLIVEGREEN=5597999;static INDIGO=4915330;static MEDIUMTURQUOISE=4772300;static DARKSLATEBLUE=4734347;static STEELBLUE=4620980;static ROYALBLUE=4286945;static TURQUOISE=4251856;static MEDIUMSEAGREEN=3978097;static LIMEGREEN=3329330;static DARKSLATEGRAY=3100495;static SEAGREEN=3050327;static FORESTGREEN=2263842;static LIGHTSEAGREEN=2142890;static DODGERBLUE=2003199;static MIDNIGHTBLUE=1644912;static AQUA=65535;static CYAN=65535;static SPRINGGREEN=65407;static LIME=65280;static MEDIUMSPRINGGREEN=64154;static DARKTURQUOISE=52945;static DEEPSKYBLUE=49151;static DARKCYAN=35723;static TEAL=32896;static GREEN=32768;static DARKGREEN=25600;static BLUE=255;static MEDIUMBLUE=205;static DARKBLUE=139;static NAVY=128;static BLACK=0}class We{static time=0;static frame=0;static delta=0;static _startTime=0;static _timeLabel="";static start(e){this._startTime=performance.now(),this._timeLabel=e}static end(){console.log(this._timeLabel,performance.now()-this._startTime)}}class pt{target;currentTarget;type;data;param;time=0;delay=0;mouseCode=0;ctrlKey;metaKey;altKey;shiftKey;targetTouches;changedTouches;touches;_stopImmediatePropagation=!1;view;constructor(e=null,t=null){this.type=e,this.data=t}stopImmediatePropagation(){this._stopImmediatePropagation=!0}reset(){this._stopImmediatePropagation=!1}get isStopImmediatePropagation(){return this._stopImmediatePropagation}}class ys{constructor(e=null,t=null,a=null,r=null,i=0){this.type=e,this.thisObject=t,this.handler=a,this.param=r,this.priority=i}static event_id_count=0;id=0;current;equalCurrentListener(e,t,a,r){return this.type==e&&this.thisObject==a&&this.handler==t&&this.param==r}dispose(){this.handler=null,this.thisObject=null,this.param=null,this.priority=0}}class Za{listeners={};data;dispatchEvent(e){let t=this.listeners[e.type];if(t!=null){t=t.slice();for(let a=0;a<t.length;a++){let r=t[a];if(r.handler){try{e.param=r.param,e.currentTarget=r,r.thisObject,r.handler.call(r.thisObject,e)}catch{}if(e.isStopImmediatePropagation)break}}}}destroy(){for(let e in this.listeners){let t=this.listeners[e];for(;t.length>0;){let a=t[0];a.handler=null,a.thisObject=null,t.splice(0,1)}}}addEventListener(e,t,a,r=null,i=0){if(this.listeners[e]==null&&(this.listeners[e]=[]),!this.hasEventListener(e,t,a)){let n=new ys(e,a,t,r,i);return n.id=++ys.event_id_count,n.current=this,this.listeners[e].push(n),this.listeners[e].sort(function(o,l){return l.priority-o.priority}),n.id}for(let n=0;n<this.listeners[e].length;n++){let o=this.listeners[e][n];if(o.equalCurrentListener(e,t,a,r))return o.id}return 0}removeEventListener(e,t,a){if(this.hasEventListener(e,t,a))for(let r=0;r<this.listeners[e].length;r++){let i=this.listeners[e][r];if(i.equalCurrentListener(e,t,a,i.param)){i.handler=null,i.thisObject=null,this.listeners[e].splice(r,1);return}}}removeEventListenerAt(e){for(let t in this.listeners)for(let a=0;a<this.listeners[t].length;a++){let r=this.listeners[t][a];if(r.id==e)return r.handler=null,r.thisObject=null,this.listeners[t].splice(a,1),!0}return!1}removeAllEventListener(e=null){let t;if(e){if(this.listeners[e]){for(let a=0;a<this.listeners[e].length;a++)t=this.listeners[e][a],t.dispose(),this.listeners[e].splice(a,1);delete this.listeners[e]}}else for(let a in this.listeners){for(let r=0;r<this.listeners[a].length;r++)t=this.listeners[a][r],t.dispose(),this.listeners[a].splice(r,1);delete this.listeners[a]}}containEventListener(e){return this.listeners[e]==null?!1:this.listeners[e].length>0}hasEventListener(e,t=null,a=null){if(this.listeners[e]==null)return!1;if(a&&t)for(let r=0;r<this.listeners[e].length;r++){let i=this.listeners[e][r];if(i.equalCurrentListener(e,t,a,i.param))return!0}return!1}}class Ma extends pt{static KEY_DOWN="onKeyDown";static KEY_UP="onKeyUp";keyCode=0}class Z extends pt{static PICK_OVER="onPickOver";static PICK_CLICK="onPickClick";static PICK_OUT="onPickOut";static PICK_MOVE="onPickMove";static PICK_UP="onPickUp";static PICK_DOWN="onPickDown";static POINTER_RIGHT_CLICK="onPointerRightClick";static POINTER_MID_UP="onPointerMidUp";static POINTER_MID_DOWN="onPointerMidDown";static POINTER_CLICK="onPointerClick";static POINTER_MOVE="onPointerMove";static POINTER_DOWN="onPointerDown";static POINTER_UP="onPointerUp";static POINTER_OUT="onPointerOut";static POINTER_OVER="onPointerOver";static POINTER_WHEEL="onPointerWheel";pointerId;pointerType="onPointer";isPrimary;pressure;mouseX;mouseY;movementX;movementY;deltaX;deltaY;deltaZ;reset(){super.reset(),this.mouseX=0,this.mouseY=0,this.movementX=0,this.movementY=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0}}class yt extends pt{static PICK_OVER_GUI="onPickOverGUI";static PICK_CLICK_GUI="onPickClickGUI";static PICK_OUT_GUI="onPickOutGUI";static PICK_UP_GUI="onPickUpGUI";static PICK_DOWN_GUI="onPickDownGUI";pointerId;pointerType="onPickGUI";isPrimary;pressure;mouseX;mouseY;movementX;movementY;deltaX;deltaY;deltaZ;reset(){super.reset(),this.mouseX=0,this.mouseY=0,this.movementX=0,this.movementY=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0}}class b{static MAX=new b(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);static MIN=new b(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE);static SAFE_MAX=new b(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new b(Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);static X_AXIS=new b(1,0,0);static neg_X_AXIS=new b(-1,0,0);static Y_AXIS=new b(0,1,0);static Z_AXIS=new b(0,0,1);static HELP_0=new b;static HELP_1=new b;static HELP_2=new b;static EPSILON=1e-5;static HELP_3=new b;static HELP_4=new b;static HELP_5=new b;static HELP_6=new b;static get ZERO(){return new b(0,0,0)}static get ONE(){return new b(1,1,1)}static get LEFT(){return new b(-1,0,0)}static get RIGHT(){return new b(1,0,0)}static get UP(){return new b(0,1,0)}static get DOWN(){return new b(0,-1,0)}static get BACK(){return new b(0,0,-1)}static get FORWARD(){return new b(0,0,1)}x=0;y=0;z=0;w=1;index=0;static _index=0;constructor(e=0,t=0,a=0,r=0){this.set(e,t,a,r),this.index=b._index++}set a(e){this.w=e}set r(e){this.x=e}set g(e){this.y=e}set b(e){this.z=e}get a(){return this.w}get r(){return this.x}get g(){return this.y}get b(){return this.z}get length(){return Math.sqrt(this.lengthSquared)}get lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}get position(){return this}static getTowPointbyDir(e,t,a,r,i){i==b.Z_AXIS?(t.x=e.y,t.y=-e.x,a.x=-e.y,a.y=e.x,t.scaleBy(r*.5),a.scaleBy(r*.5)):i==b.Y_AXIS&&(t.x=e.z,t.z=-e.x,a.x=-e.z,a.z=e.x,t.scaleBy(r*.5),a.scaleBy(r*.5))}static pointToLine(e,t,a){let r=0,i,n,o;if(i=b.distance(e,t),n=b.distance(e,a),o=b.distance(t,a),o<=1e-6||n<=1e-6)return r=0,r;if(i<=1e-6||o*o>=i*i+n*n)return r=n,r;if(n*n>=i*i+o*o)return r=o,r;let l=(i+n+o)/2;return r=2*Math.sqrt(l*(l-i)*(l-n)*(l-o))/i,r}static dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}static getPoints(e,t){let a=[];for(let r=0;r<e;r++){const i=new b(Math.random()*t-t*.5,Math.random()*t-t*.5,Math.random()*t-t*.5);a.push(i)}return a}static getPointNumbers(e,t){let a=[];for(let r=0;r<e;r++)a.push(Math.random()*t-t*.5,Math.random()*t-t*.5,Math.random()*t-t*.5);return a}static getAngle(e,t){let a=e.dotProduct(t)/(e.length*t.length);return Math.acos(a)*180/Math.PI}static sqrMagnitude(e){return e.x*e.x+e.y*e.y+e.z*e.z}static getZYAngle(e,t){return this.calAngle(e.y,e.z,t.y,t.z)}static sub(e,t,a=null){return a=a||new b,a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}static add(e,t,a=null){return a=a||new b,a.x=e.x+t.x,a.y=e.y+t.y,a.z=e.z+t.z,a}static smoothDamp(e,t,a,r,i,n){return null}static distance(e,t){let a=e.x-t.x,r=e.y-t.y,i=e.z-t.z;return Math.sqrt(a*a+r*r+i*i)}static squareDistance(e,t){let a=e.x-t.x,r=e.y-t.y,i=e.z-t.z;return a*a+r*r+i*i}static distanceXZ(e,t){let a=e.x-t.x,r=0,i=e.z-t.z;return Math.sqrt(a*a+r*r+i*i)}set(e,t,a,r=1){return this.x=e,this.y=t,this.z=a,this.w=r,this}add(e,t=null){t||=new b;let a=this.x,r=this.y,i=this.z,n=this.w,o=e.x,l=e.y,c=e.z,f=e.w;return t.setTo(a+o,r+l,i+c,n+f),t}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}min(e,t=this){return t.x=Math.min(this.x,e.x),t.y=Math.min(this.y,e.y),t.z=Math.min(this.z,e.z),t}max(e,t=this){return t.x=Math.max(this.x,e.x),t.y=Math.max(this.y,e.y),t.z=Math.max(this.z,e.z),t}distanceToSquared(e){let t=this.x-e.x,a=this.y-e.y,r=this.z-e.z;return t*t+a*a+r*r}addXYZW(e,t,a,r,i=null){i||=new b;let n=this.x,o=this.y,l=this.z,c=this.w,f=e,d=t,h=a,u=r;return i.setTo(n+f,o+d,l+h,c+u),i}clone(){return new b(this.x,this.y,this.z,this.w)}copyFrom(e){let t=this;return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}decrementBy(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}dotProduct(e){return this.x*e.x+this.y*e.y+this.z*e.z}equals(e,t=!1){return this.x==e.x&&this.y==e.y&&this.z==e.z&&(!t||this.w==e.w)}incrementBy(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}divide(e){return e instanceof b?new b(this.x/e.x,this.y/e.y,this.z/e.z):(this.x=this.x/e,this.y=this.y/e,this.z=this.z/e,this)}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}normalize(e=1){let t=this;if(this.length!=0){let a=e/this.length;return this.x*=a,this.y*=a,this.z*=a,t}return t}applyQuaternion(e){const t=this.x,a=this.y,r=this.z,i=e.x,n=e.y,o=e.z,l=e.w,c=l*t+n*r-o*a,f=l*a+o*t-i*r,d=l*r+i*a-n*t,h=-i*t-n*a-o*r;return this.x=c*l+h*-i+f*-o-d*-n,this.y=f*l+h*-n+d*-i-c*-o,this.z=d*l+h*-o+c*-n-f*-i,this}applyMatrix4(e){return e.transformPoint(this,this)}scaleBy(e){return this.x*=e,this.y*=e,this.z*=e,this}mul(e){let t=new b;return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t}scale(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}scaleToRef(e,t){return t||(t=new b),t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t}setTo(e,t,a,r=1){this.x=e,this.y=t,this.z=a,this.w=r}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}subtract(e,t=null){return t||(t=new b),t.setTo(this.x-e.x,this.y-e.y,this.z-e.z),t}multiply(e,t=null){t||(t=new b);let a=this.x,r=this.y,i=this.z,n=e.x,o=e.y,l=e.z;return t.setTo(a*n,r*o,i*l),t}divided(e,t=null){t||(t=new b);let a=this.x,r=this.y,i=this.z,n=e.x,o=e.y,l=e.z;return t.setTo(a/n,r/o,i/l),t}div(e,t){t||(t=new b);let a=this.x,r=this.y,i=this.z,n=this.w;return t.setTo(a/e,r/e,i/e,n/e),t}lerp(e,t,a){let r=e.x,i=e.y,n=e.z,o=e.w,l=t.x,c=t.y,f=t.z,d=t.w;this.x=(l-r)*a+r,this.y=(c-i)*a+i,this.z=(f-n)*a+n,this.w=(d-o)*a+o}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}toString(){return"<"+this.x+", "+this.y+", "+this.z+">"}normalizeToWay2D_XY(){let e=Math.abs(this.x),t=Math.abs(this.y);e>t?this.x>0?this.copyFrom(b.RIGHT):this.copyFrom(b.LEFT):this.y>0?this.copyFrom(b.DOWN):this.copyFrom(b.UP)}toArray(){return[this.x,this.y,this.z]}copyToBytes(e){e.setFloat32(0*Float32Array.BYTES_PER_ELEMENT,this.x,!0),e.setFloat32(1*Float32Array.BYTES_PER_ELEMENT,this.y,!0),e.setFloat32(2*Float32Array.BYTES_PER_ELEMENT,this.z,!0)}crossProduct(e,t=null){return t=t||new b,t.x=this.y*e.z-this.z*e.y,t.y=this.z*e.x-this.x*e.z,t.z=this.x*e.y-this.y*e.x,t.w=1,t}crossVectors(e,t){return e.crossProduct(t,this),this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}setFromArray(e,t=0){this.x=e[t],this.y=e[t+1],this.z=e[t+2]}divideScalar(e){return this.multiplyScalar(1/e)}clampLength(e,t){let a=this.length;return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(t,a)))}setScalar(e){return this.x=e,this.y=e,this.z=e,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}static calAngle(e,t,a,r){const i=o(a,r,e,t);let n=Math.acos(i)*180/Math.PI;return a<e&&(n=-n),n;function o(c,f,d,h){let u=[c-d,f-h];return l(u,[0,-1])}function l(c,f){let d=c[0]*f[0]+c[1]*f[1],h=Math.sqrt(c[0]*c[0]+c[1]*c[1])*Math.sqrt(f[0]*f[0]+f[1]*f[1]);return d/h}}static pointInsideTriangle(e,t,a,r){return b.HELP_0.setTo(e.x,e.z,0),b.HELP_1.setTo(t.x,t.z,0),b.HELP_2.setTo(a.x,a.z,0),b.HELP_3.setTo(r.x,r.z,0),b.pointInsideTriangle2d()}static pointInsideTriangle2d(){return b.productXY(b.HELP_1,b.HELP_2,b.HELP_3)>=0?b.productXY(b.HELP_1,b.HELP_2,b.HELP_0)>=0&&b.productXY(b.HELP_2,b.HELP_3,b.HELP_0)>=0&&b.productXY(b.HELP_3,b.HELP_1,b.HELP_0)>=0:b.productXY(b.HELP_1,b.HELP_2,b.HELP_0)<=0&&b.productXY(b.HELP_2,b.HELP_3,b.HELP_0)<=0&&b.productXY(b.HELP_3,b.HELP_1,b.HELP_0)<=0}static productXY(e,t,a){var r=(e.x-a.x)*(t.y-a.y)-(e.y-a.y)*(t.x-a.x);return r>-1e-5&&r<1e-5&&(r=0),r}static serialize(e){return new b(e.x,e.y,e.z,e.w)}}class Cl{constructor(e){this.canvasX=e.clientX,this.canvasY=e.clientY,this.identifier=e.identifier,this.clientX=e.clientX,this.clientY=e.clientY,this.pageX=e.pageX,this.pageY=e.pageY,this.screenX=e.screenX,this.screenY=e.screenY}canvasX;canvasY;identifier;clientX;clientY;pageX;pageY;screenX;screenY}class Sl extends Za{canvasX=0;canvasY=0;isMouseDown=!1;isRightMouseDown=!1;canvas;mouseX=0;mouseY=0;wheelDelta=0;mouseOffsetX=0;mouseOffsetY=0;mouseLastX=0;mouseLastY=0;_time=0;_keyStatus;_mouseStatus;_isTouchStart;_keyEvent3d;_pointerEvent3D;_windowsEvent3d;mouseLock=!1;initCanvas(e){this.canvas=e;let t=0,a=0,r=0,i=0;e.onpointerdown=o=>{t=performance.now(),a=o.clientX,r=o.clientY,i=o.button,o.button==0?this.mouseStart(o):o.button==1?this.middleDown(o):o.button==2&&(this.isRightMouseDown=!0,this.mouseStart(o)),e.setPointerCapture(o.pointerId)},e.onpointerup=o=>{o.button==0?this.mouseEnd(o):o.button==1?this.middleUp(o):o.button==2&&(this.isRightMouseDown=!1,this.mouseEnd(o)),o.button===i&&performance.now()-t<300&&Math.abs(a-o.clientX)<20&&Math.abs(r-o.clientY)<20&&(o.button===0?this.mouseClick(o):this.rightClick(o)),e.releasePointerCapture(o.pointerId)},e.onpointerenter=o=>{this.mouseOver(o)},e.onpointermove=o=>{this.mouseMove(o)},e.onpointercancel=o=>{e.releasePointerCapture(o.pointerId),o.button==1?this.middleUp(o):this.mouseEnd(o)},e.addEventListener("wheel",o=>this.mouseWheel(o),{passive:!1}),window.addEventListener("keydown",o=>this.keyDown(o),!0),window.addEventListener("keyup",o=>this.keyUp(o),!0),e.oncontextmenu=function(){return!1};let n=this.canvas.getBoundingClientRect();this.canvasX=n.left,this.canvasY=n.top,this._keyStatus={},this._mouseStatus={},this._isTouchStart=!1,this._keyEvent3d=new Ma,this._pointerEvent3D=new Z,this._windowsEvent3d=new pt}useMouseLock(){this.mouseLock||(this.canvas.requestPointerLock(),this.mouseLock=!0,document.addEventListener("mousemove",e=>this.onMouseLockMove(e),!1))}releaseMouseLock(){this.mouseLock=!1,document.exitPointerLock(),document.removeEventListener("mousemove",e=>this.onMouseLockMove(e),!1)}onMouseLockMove(e){this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=e.movementX,this.mouseOffsetY=e.movementY,this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_MOVE,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.movementX=e.movementX,this._pointerEvent3D.movementY=e.movementY,this.dispatchEvent(this._pointerEvent3D)}onPinch(e,t,a,r){this._oldPosition1=new b(e,t),this._oldPosition2=new b(a,r)}onSwipe(e,t){this.mouseX=e,this.mouseY=t,this._oldPosition1=null,this._oldPosition2=null,this._time=new Date().getTime()}_oldPosition1=null;_oldPosition2=null;GetTargetTouches(e){for(var t=new Array,a=0;a<e.length;a++){var r=new Cl(e[a]);t.push(r)}return t}rightClick(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_RIGHT_CLICK,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this.dispatchEvent(this._pointerEvent3D)}middleDown(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_MID_DOWN,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId?e.pointerId:0,this._pointerEvent3D.pointerType=e.pointerType?e.pointerType:0,this._pointerEvent3D.isPrimary=e.isPrimary?e.isPrimary:0,this._pointerEvent3D.pressure=e.pressure?e.pressure:0,this.dispatchEvent(this._pointerEvent3D)}middleUp(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_MID_UP,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this.dispatchEvent(this._pointerEvent3D)}mouseClick(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_CLICK,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this.dispatchEvent(this._pointerEvent3D)}_downTime=0;mouseEnd(e){this.isMouseDown=!1,this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._mouseStatus[this._pointerEvent3D.mouseCode]=!1,this._pointerEvent3D.type=Z.POINTER_UP,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this.dispatchEvent(this._pointerEvent3D)}mouseStart(e){this.isMouseDown=!0,this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId?e.pointerId:0,this._pointerEvent3D.pointerType=e.pointerType?e.pointerType:0,this._pointerEvent3D.isPrimary=e.isPrimary?e.isPrimary:0,this._pointerEvent3D.pressure=e.pressure?e.pressure:0,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.type=Z.POINTER_DOWN,this.dispatchEvent(this._pointerEvent3D)}mouseMove(e){this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_MOVE,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.movementX=e.movementX,this._pointerEvent3D.movementY=e.movementY,this.dispatchEvent(this._pointerEvent3D)}mouseOver(e){this.isMouseDown=!1,this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_OVER,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this.dispatchEvent(this._pointerEvent3D)}mouseWheel(e){e.preventDefault(),this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,"wheelDelta"in e?(this._pointerEvent3D.delay=e.wheelDelta,this.wheelDelta=e.wheelDelta):"delta"in e&&(this.wheelDelta=e.delta),this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_WHEEL,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.deltaX=e.deltaX,this._pointerEvent3D.deltaY=e.deltaY,this._pointerEvent3D.deltaZ=e.deltaZ,this.dispatchEvent(this._pointerEvent3D)}keyDown(e){this._keyEvent3d.reset(),this._keyEvent3d.keyCode=e.keyCode,this._keyEvent3d.ctrlKey=e.ctrlKey,this._keyEvent3d.altKey=e.altKey,this._keyEvent3d.shiftKey=e.shiftKey,this._keyStatus[e.keyCode]||(this._keyStatus[e.keyCode]=!0,this._keyEvent3d.type=Ma.KEY_DOWN,this.dispatchEvent(this._keyEvent3d))}keyUp(e){this._keyEvent3d.reset(),this._keyEvent3d.keyCode=e.keyCode,this._keyStatus[e.keyCode]=!1,this._keyEvent3d.type=Ma.KEY_UP,this.dispatchEvent(this._keyEvent3d)}GetSlideAngle(e,t){return Math.atan2(t,e)*180/Math.PI}GetSlideDirection(e,t,a,r){var i=t-r,n=a-e,o=0;if(Math.abs(n)<2&&Math.abs(i)<2)return o;var l=this.GetSlideAngle(n,i);return l>=-45&&l<45?o=4:l>=45&&l<135?o=1:l>=-135&&l<-45?o=2:(l>=135&&l<=180||l>=-180&&l<-135)&&(o=3),o}}class lr extends pt{static RESIZE="resize"}class Fl extends Za{adapter;device;context;aspect;presentationSize=[0,0];presentationFormat;canvas;windowWidth;windowHeight;canvasConfig;_pixelRatio=1;_resizeEvent;get pixelRatio(){return this._pixelRatio}async init(e){if(this.canvasConfig=e,e&&e.canvas){if(this.canvas=e.canvas,this.canvas===null)throw new Error("no Canvas");this.canvas.style.width||(this.canvas.style.width=this.canvas.width+"px"),this.canvas.style.height||(this.canvas.style.height=this.canvas.height+"px")}else this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top="0px",this.canvas.style.left="0px",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.zIndex=e?.zIndex?e.zIndex.toString():"0",document.body.appendChild(this.canvas);if(e&&e.backgroundImage?(this.canvas.style.background=`url(${e.backgroundImage})`,this.canvas.style["background-size"]="cover",this.canvas.style["background-position"]="center"):this.canvas.style.background="transparent",this.canvas.style["touch-action"]="none",this.canvas.style["object-fit"]="cover",navigator.gpu===void 0)throw new Error("Your browser does not support WebGPU!");if(this.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),this.adapter==null)throw new Error("Your browser does not support WebGPU!");if(this.device=await this.adapter.requestDevice({requiredFeatures:["bgra8unorm-storage","depth-clip-control","depth32float-stencil8","indirect-first-instance","rg11b10ufloat-renderable"],requiredLimits:{minUniformBufferOffsetAlignment:256,maxStorageBufferBindingSize:this.adapter.limits.maxStorageBufferBindingSize}}),this.device==null)throw new Error("Your browser does not support WebGPU!");return this._pixelRatio=this.canvasConfig?.devicePixelRatio||window.devicePixelRatio||1,this._pixelRatio=Math.min(this._pixelRatio,2),this.device.label="device",this.presentationFormat=navigator.gpu.getPreferredCanvasFormat(),this.context=this.canvas.getContext("webgpu"),this.context.configure({device:this.device,format:this.presentationFormat,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT,alphaMode:"premultiplied",colorSpace:"srgb"}),this._resizeEvent=new lr(lr.RESIZE,{width:this.windowWidth,height:this.windowHeight}),new ResizeObserver(()=>{this.updateSize(),ut.destroyTexture()}).observe(this.canvas),this.updateSize(),!0}updateSize(){let e=Math.floor(this.canvas.clientWidth*this.pixelRatio),t=Math.floor(this.canvas.clientHeight*this.pixelRatio);(e!=this.windowWidth||t!=this.windowHeight)&&(this.canvas.width=this.windowWidth=e,this.canvas.height=this.windowHeight=t,this.presentationSize[0]=this.windowWidth,this.presentationSize[1]=this.windowHeight,this.aspect=this.windowWidth/this.windowHeight,this._resizeEvent.data.width=this.windowWidth,this._resizeEvent.data.height=this.windowHeight,this.dispatchEvent(this._resizeEvent))}}let I=new Fl;var Ne=(s=>(s[s.Default=1]="Default",s[s.IgnoreDepthPass=2]="IgnoreDepthPass",s[s.Sky=6]="Sky",s[s.Particle=10]="Particle",s[s.SkinnedMesh=16]="SkinnedMesh",s[s.MorphTarget=32]="MorphTarget",s[s.Terrain=64]="Terrain",s[s.UI=128]="UI",s[s.Reflection=256]="Reflection",s[s.ReflectionDebug=512]="ReflectionDebug",s[s.Graphic3D=1024]="Graphic3D",s))(Ne||{});class ia{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)==t}}class de{static HELP_0=new de;static HELP_1=new de;static HELP_2=new de;static ZERO=new de(0,0);static SAFE_MAX=new de(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new de(Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);x=0;y=0;constructor(e=0,t=0){this.x=e,this.y=t}static getAngle(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}static slerp(e,t,a){let r=new de,i=e.dot(t);if(i<0&&(t.x=-t.x,t.y=-t.y,i=-i),i>.9995)return r.x=e.x+a*(t.x-e.x),r.y=e.y+a*(t.y-e.y),r;let n=Math.acos(i),o=Math.sin(n),l=Math.sin((1-a)*n)/o,c=Math.sin(a*n)/o;return r.x=l*e.x+c*t.x,r.y=l*e.y+c*t.y,r}static lerp(e,t,a){return de.HELP_0.copyFrom(e),de.HELP_1.copyFrom(t),de.HELP_0.scale(a),de.HELP_1.scale(1-a),new de(de.HELP_0.x+de.HELP_1.x,de.HELP_0.y+de.HELP_1.y)}set(e=0,t=0){return this.x=e,this.y=t,this}distance(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}add(e,t){return t=t||new de,t.x=this.x+e.x,t.y=this.y+e.y,t}sub(e,t){return t=t||new de,t.x=this.x-e.x,t.y=this.y-e.y,t}scale(e){return this.x=this.x*e,this.y=this.y*e,this}multiply(e,t){return t=t||new de,t.x=this.x*e,t.y=this.y*e,t}multiplyScaler(e){return this.x*=e,this.y*=e,this}divide(e,t){return t=t||new de,t.x=this.x/e,t.y=this.y/e,t}neg(e){return e||(e=new de),e.x=-e.x,e.y=-e.y,e}abs(){return Math.sqrt(this.x*this.x+this.y*this.y)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}getAngle(e){return Math.atan2(e.y-this.y,e.x-this.x)}unt(e){e=e||new de;let t=this.abs();return e.x=this.x/t,e.y=this.y/t,e}angleTo(e){let t=e.x-this.x,a=e.y-this.y;return Math.atan2(a,t)}equals(e){return Math.abs(this.x-e.x)<1e-6&&Math.abs(this.y-e.y)<1e-6}pal(e){let t=this.unt(),a=e.unt();return t.equals(a)?1:t.equals(a.neg())?-1:0}clone(){return new de(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}dot(e){return this.x*e.x+this.y*e.y}normalize(){let e=this.abs();return this.x=this.x/e,this.y=this.y/e,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}}class be{static X_AXIS=new be(1,0,0);static Y_AXIS=new be(0,1,0);static Z_AXIS=new be(0,0,1);static HELP_0=new be;static HELP_1=new be;static HELP_2=new be;static EPSILON=1e-5;static HELP_3=new be;static HELP_4=new be;static HELP_5=new be;static HELP_6=new be;static ZERO=new be;static ONE=new be(1,1,1,1);static LEFT=new be(-1,0,0);static RIGHT=new be(1,0,0);static UP=new be(0,-1,0);static DOWN=new be(0,1,0);static BACK=new be(0,0,-1);static FORWARD=new be(0,0,1);x=0;y=0;z=0;w=1;constructor(e=0,t=0,a=0,r=0){this.x=e,this.y=t,this.z=a,this.w=r}get width(){return this.z}get height(){return this.w}static crossVectors(e,t,a){a=a||new be;var r=e.x,i=e.y,n=e.z,o=t.x,l=t.y,c=t.z;return a.x=i*c-n*l,a.y=n*o-r*c,a.z=r*l-i*o,a}static distance(e,t){let a=e.x-t.x,r=e.y-t.y,i=e.z-t.z,n=e.w-t.w;return Math.sqrt(a*a+r*r+i*i+n*n)}set(e,t,a,r){return this.x=e,this.y=t,this.z=a,this.w=r,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}clone(){return new be(this.x,this.y,this.z,this.w)}}function vn(s,e){let t=s.__NonSerialize__;t||(t=s.__NonSerialize__={},t.__NonSerialize__=!0),t[e]=!0}function xn(s,e){let t;for(;s&&(s=s.__proto__,s&&(t=s.__NonSerialize__),!t););return t&&t[e]}function Kr(s,e,t,a,r){let i=s.__EditorInspector__;i||(i=s.__EditorInspector__=new Map);let n=i.get(s.constructor.name);n||(n=new Map,i.set(s.constructor.name,n)),n.set(e,{p1:t,p2:a,p3:r})}function zu(s){let e,t=s,a=[];for(;t;){if(a.indexOf(t.constructor.name)!=-1){t=t.__proto__;continue}a.push(t.constructor.name),t=t.__proto__}for(a=a.reverse(),t=s;t&&(t=t.__proto__,t&&(e=t.__EditorInspector__),!e););let r=new Map;if(e)for(let i=0;i<a.length;i++){const n=a[i];let o=e.get(n);o&&o.forEach((l,c)=>{r.set(c,l)})}return r}function Ot(s,e,t,a,r){let i=window.__Component__;i||(i=window.__Component__={}),i[e]=s}function kl(s){let e=window.__Component__;return e[s]?e[s]:null}function Na(s,e,t,a,r){let i=window.__shader__;i||(i=window.__shader__={}),i[e]=s}function El(s){let e=window.__shader__;return e[s]?e[s]:null}var Wu=Object.defineProperty,wl=(s,e,t,a)=>{for(var r=void 0,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(e,t,r)||r);return r&&Wu(e,t,r),r};const Un=class ss{__refection;__size=0;getValueType(){if(!this.__refection){let e=this;this.__refection=[];for(const t in e)if(!xn(this,t)){const a=e[t];let r={name:t,type:a.constructor.name};this.__refection.push(r)}}return this.__refection}static getValueSize(e){switch(e.constructor.name){case"Boolean":return 4;case"Number":return 4;case"f32":return 4;case"i32":return 4;case"u32":return 4;case"Float32Array":return e.byteLength;case"Vector2":return 8;case"Vector3":return 12;case"Vector4":return 16;case"Color":return 16;case"Array":let a=0;for(let r=0,i=e.length;r<i;r++)a+=ss.getValueSize(e[r]);return a}return 0}static __cacheStruct=new Map;static Ref(e){return this.Get(e).getValueType()}static Get(e){let t=ss.__cacheStruct.get(e.prototype);return t||(t=new e,ss.__cacheStruct.set(e.prototype,t)),t}static GetSize(e){let t=this.Get(e);if(t.__size==0){for(const a in t)if(!xn(t,a)){const r=t[a];t.__size+=ss.getValueSize(r)}t.__size>4&&(t.__size=Math.ceil(t.__size/4)*4)}return t.__size}};wl([vn],Un.prototype,"__refection"),wl([vn],Un.prototype,"__size");let vi=Un;class Il{byteOffset;byteSize;offset=0;dataBytes;get x(){return this.dataBytes.getFloat32(0*Float32Array.BYTES_PER_ELEMENT,!0)}set x(e){this.dataBytes.setFloat32(0*Float32Array.BYTES_PER_ELEMENT,e,!0)}get y(){return this.dataBytes.getFloat32(1*Float32Array.BYTES_PER_ELEMENT,!0)}set y(e){this.dataBytes.setFloat32(1*Float32Array.BYTES_PER_ELEMENT,e,!0)}get z(){return this.dataBytes.getFloat32(2*Float32Array.BYTES_PER_ELEMENT,!0)}set z(e){this.dataBytes.setFloat32(2*Float32Array.BYTES_PER_ELEMENT,e,!0)}get w(){return this.dataBytes.getFloat32(3*Float32Array.BYTES_PER_ELEMENT,!0)}set w(e){this.dataBytes.setFloat32(3*Float32Array.BYTES_PER_ELEMENT,e,!0)}setX(e){this.x=e}setXY(e,t){this.x=e,this.y=t}setXYZ(e,t,a){this.x=e,this.y=t,this.z=a}setXYZW(e,t,a,r){this.x=e,this.y=t,this.z=a,this.w=r}setVector2Array(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*2+0)*Float32Array.BYTES_PER_ELEMENT,a.x,!0),this.dataBytes.setFloat32((t*2+1)*Float32Array.BYTES_PER_ELEMENT,a.y,!0)}}setVector3Array(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*3+0)*Float32Array.BYTES_PER_ELEMENT,a.x,!0),this.dataBytes.setFloat32((t*3+1)*Float32Array.BYTES_PER_ELEMENT,a.y,!0),this.dataBytes.setFloat32((t*3+2)*Float32Array.BYTES_PER_ELEMENT,a.z,!0)}}setVector4Array(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*4+0)*Float32Array.BYTES_PER_ELEMENT,a.x,!0),this.dataBytes.setFloat32((t*4+1)*Float32Array.BYTES_PER_ELEMENT,a.y,!0),this.dataBytes.setFloat32((t*4+2)*Float32Array.BYTES_PER_ELEMENT,a.z,!0),this.dataBytes.setFloat32((t*4+3)*Float32Array.BYTES_PER_ELEMENT,a.w,!0)}}setColorArray(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*4+0)*Float32Array.BYTES_PER_ELEMENT,a.r,!0),this.dataBytes.setFloat32((t*4+1)*Float32Array.BYTES_PER_ELEMENT,a.g,!0),this.dataBytes.setFloat32((t*4+2)*Float32Array.BYTES_PER_ELEMENT,a.b,!0),this.dataBytes.setFloat32((t*4+3)*Float32Array.BYTES_PER_ELEMENT,a.a,!0)}}setInt8(e,t=0){this.dataBytes.setInt8(t*Int8Array.BYTES_PER_ELEMENT,e)}getInt8(e=0){return this.dataBytes.getInt8(e*Int8Array.BYTES_PER_ELEMENT)}setInt16(e,t=0){this.dataBytes.setInt16(t*Int16Array.BYTES_PER_ELEMENT,e,!0)}getInt16(e=0){return this.dataBytes.getInt16(e*Int16Array.BYTES_PER_ELEMENT,!0)}setInt32(e,t=0){this.dataBytes.setInt32(t*Int32Array.BYTES_PER_ELEMENT,e,!0)}getInt32(e=0){return this.dataBytes.getInt32(e*Int32Array.BYTES_PER_ELEMENT,!0)}setFloat(e,t=0){this.dataBytes.setFloat32(t*Float32Array.BYTES_PER_ELEMENT,e,!0)}getFloat(e=0){return this.dataBytes.getFloat32(e*Float32Array.BYTES_PER_ELEMENT,!0)}setUint8(e,t=0){this.dataBytes.setUint8(t*Uint8Array.BYTES_PER_ELEMENT,e)}getUint8(e=0){return this.dataBytes.getUint8(e*Uint8Array.BYTES_PER_ELEMENT)}setUint16(e,t=0){this.dataBytes.setUint16(t*Uint16Array.BYTES_PER_ELEMENT,e,!0)}getUint16(e=0){return this.dataBytes.getUint16(e*Uint16Array.BYTES_PER_ELEMENT,!0)}setUint32(e,t=0){this.dataBytes.setUint32(t*Uint32Array.BYTES_PER_ELEMENT,e,!0)}getUint32(e=0){return this.dataBytes.getUint32(e*Uint32Array.BYTES_PER_ELEMENT,!0)}setArray(e,t){for(let a=0;a<t.length;a++){const r=t[a];this.dataBytes.setFloat32((e+a)*Float32Array.BYTES_PER_ELEMENT,r,!0)}}setFloat32Array(e,t){new Float32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Float32Array.BYTES_PER_ELEMENT,t.length).set(t)}setFloatArray(e,t){let a;t instanceof Float32Array?a=t:a=new Float32Array(t),new Float32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Float32Array.BYTES_PER_ELEMENT,a.length).set(a)}setArrayBuffer(e,t){t instanceof Uint8Array?this.setUint8Array(e,t):t instanceof Uint16Array?this.setUint16Array(e,t):t instanceof Uint32Array?this.setUint32Array(e,t):t instanceof Int8Array?this.setInt8Array(e,t):t instanceof Int16Array?this.setInt16Array(e,t):t instanceof Int32Array?this.setInt32Array(e,t):t instanceof Float32Array&&this.setFloat32Array(e,t)}setInt8Array(e,t){new Int8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Int8Array.BYTES_PER_ELEMENT).set(t)}setInt16Array(e,t){new Int16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Int16Array.BYTES_PER_ELEMENT).set(t)}setInt32Array(e,t){new Int32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Int32Array.BYTES_PER_ELEMENT).set(t)}setUint8Array(e,t){new Uint8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Uint8Array.BYTES_PER_ELEMENT).set(t)}setUint16Array(e,t){new Uint16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Uint16Array.BYTES_PER_ELEMENT).set(t)}setUint32Array(e,t){new Uint32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Uint32Array.BYTES_PER_ELEMENT).set(t)}setData(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t,!0)}setVector2(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.x,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.y,!0)}setVector3(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.x,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.y,!0),this.dataBytes.setFloat32((e+2)*Float32Array.BYTES_PER_ELEMENT,t.z,!0)}setVector4(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.x,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.y,!0),this.dataBytes.setFloat32((e+2)*Float32Array.BYTES_PER_ELEMENT,t.z,!0),this.dataBytes.setFloat32((e+3)*Float32Array.BYTES_PER_ELEMENT,t.w,!0)}setColor(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.r,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.g,!0),this.dataBytes.setFloat32((e+2)*Float32Array.BYTES_PER_ELEMENT,t.b,!0),this.dataBytes.setFloat32((e+3)*Float32Array.BYTES_PER_ELEMENT,t.a,!0)}getData(e){return this.dataBytes.getFloat32(e*Float32Array.BYTES_PER_ELEMENT,!0)}writeFloat(e){this.dataBytes.setFloat32(this.offset,e,!0),this.offset+=Float32Array.BYTES_PER_ELEMENT}writeInt8(e){this.dataBytes.setInt8(this.offset,e),this.offset+=Int8Array.BYTES_PER_ELEMENT}writeInt16(e){this.dataBytes.setInt16(this.offset,e,!0),this.offset+=Int16Array.BYTES_PER_ELEMENT}writeInt32(e){this.dataBytes.setInt32(this.offset,e,!0),this.offset+=Int32Array.BYTES_PER_ELEMENT}writeUint8(e){this.dataBytes.setUint8(this.offset,e),this.offset+=Uint8Array.BYTES_PER_ELEMENT}writeUint16(e){this.dataBytes.setUint16(this.offset,e,!0),this.offset+=Uint16Array.BYTES_PER_ELEMENT}writeUint32(e){this.dataBytes.setUint32(this.offset,e,!0),this.offset+=Uint32Array.BYTES_PER_ELEMENT}writeVector2(e){this.writeFloat(e.x),this.writeFloat(e.y)}writeVector3(e){this.writeFloat(e.x),this.writeFloat(e.y),this.writeFloat(e.z)}writeVector4(e){this.writeFloat(e.x),this.writeFloat(e.y),this.writeFloat(e.z),this.writeFloat(e.w)}writeRGBColor(e){this.writeFloat(e.r),this.writeFloat(e.g),this.writeFloat(e.b)}writeArray(e){for(let t=0;t<e.length;t++){const a=e[t];this.writeFloat(a)}}writeFloat32Array(e){new Float32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeInt8Array(e){new Int8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeInt16Array(e){new Int16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeInt32Array(e){new Int32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeUint8Array(e){new Uint8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeUint16Array(e){new Uint16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeUint32Array(e){new Uint32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}reset(){this.offset=0}destroy(){this.byteOffset=null,this.byteSize=null,this.offset=null,this.dataBytes=null}}class cr{shareDataBuffer;_byteOffset=0;allocation(e){this.shareDataBuffer&&this.shareDataBuffer.byteLength<e?this._byteOffset=0:this.shareDataBuffer=new ArrayBuffer(e)}allocation_node(e){if(this._byteOffset+e>this.shareDataBuffer.byteLength)return console.error("memory not enough!",this._byteOffset,e,this.shareDataBuffer.byteLength),null;let t=new Il;return t.byteOffset=this._byteOffset,t.byteSize=e,t.dataBytes=new DataView(this.shareDataBuffer,this._byteOffset,t.byteSize),this._byteOffset+=t.byteSize,t}allocation_memory(e){return this._byteOffset+e.byteSize>this.shareDataBuffer.byteLength?(console.error("memory not enough!",this._byteOffset,e.byteSize,this.shareDataBuffer.byteLength),null):(e.byteOffset=this._byteOffset,e.dataBytes=new DataView(this.shareDataBuffer,this._byteOffset,e.byteSize),this._byteOffset+=e.byteSize,e)}reset(){this._byteOffset=0}destroy(e){this.shareDataBuffer=null,this._byteOffset=0}}class Ya{bufferType;buffer;memory;memoryNodes;seek;outFloat32Array;byteSize;usage;visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE;mapAsyncBuffersOutstanding=0;mapAsyncReady;_readBuffer;_dataView;constructor(){this.mapAsyncReady=[]}debug(){}reset(e=!1,t=0,a){this.seek=0,this.memory.reset(),e&&this.createBuffer(this.usage,t,a)}setBoolean(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setX(t?1:0)}readBoole(e){let t=this.memoryNodes.get(e);return t?t.getFloat()!=0:null}setFloat(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setX(t)}getFloat(e){let t=this.memoryNodes.get(e);return t?t.getFloat():null}setInt8(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(1),this.memoryNodes.set(e,a)),a.setInt8(t)}getInt8(e){let t=this.memoryNodes.get(e);return t?t.getInt8():null}setInt16(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(2),this.memoryNodes.set(e,a)),a.setInt16(t)}getInt16(e){let t=this.memoryNodes.get(e);return t?t.getInt16():null}setInt32(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setInt32(t)}getInt32(e){let t=this.memoryNodes.get(e);return t?t.getInt32():null}setUint8(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(1),this.memoryNodes.set(e,a)),a.setUint8(t)}getUint8(e){let t=this.memoryNodes.get(e);return t?t.getUint8():null}setUint16(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(2),this.memoryNodes.set(e,a)),a.setUint16(t)}getUint16(e){let t=this.memoryNodes.get(e);return t?t.getUint16():null}setUint32(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setUint32(t)}getUint32(e){let t=this.memoryNodes.get(e);return t?t.getUint32():null}setVector2(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(8),this.memoryNodes.set(e,a)),a.setXY(t.x,t.y)}getVector2(e){let t=this.memoryNodes.get(e);return t?new de(t.x,t.y):null}setVector3(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(12),this.memoryNodes.set(e,a)),a.setXYZ(t.x,t.y,t.z)}getVector3(e){let t=this.memoryNodes.get(e);return t?new b(t.x,t.y,t.z):null}setVector4(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16),this.memoryNodes.set(e,a)),a.setXYZW(t.x,t.y,t.z,t.w)}getVector4(e){let t=this.memoryNodes.get(e);return t?new be(t.x,t.y,t.z,t.w):null}setVector4Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16*t.length),this.memoryNodes.set(e,a)),a.setVector4Array(t)}setColor(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16),this.memoryNodes.set(e,a)),a.setXYZW(t.r,t.g,t.b,t.a)}getColor(e){let t=this.memoryNodes.get(e);return t?new J(t.x,t.y,t.z,t.w):null}setColorArray(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16*t.length),this.memoryNodes.set(e,a)),a.setColorArray(t)}setMatrix(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(64),this.memoryNodes.set(e,a)),a.setFloatArray(0,t.rawData)}setMatrixArray(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(64*t.length),this.memoryNodes.set(e,a));for(let r=0;r<t.length;r++){const i=t[r];a.setFloatArray(r*16,i.rawData)}}setArray(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setArray(0,t)}setFloat32Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setFloat32Array(0,t)}setInt32Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setInt32Array(0,t)}setUint32Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setUint32Array(0,t)}setStruct(e,t,a,r){let i=vi.Ref(e);vi.GetSize(e);let n=t,o=this.memoryNodes.get(n);o.reset();let l=a;r&&(l=l[r]);for(let c=0;c<i.length;c++){const f=i[c];let d=l[f.name];this.writeValue(o,f,d)}}writeValue(e,t,a){switch(t.type){case"Boolean":e.writeFloat(a);break;case"Number":e.writeFloat(a);break;case"Float32Array":e.writeFloat32Array(a);break;case"Float64Array":e.writeFloat32Array(new Float32Array(a));break;case"Vector2":e.writeVector2(a);break;case"Vector3":e.writeVector3(a);break;case"Vector4":e.writeVector4(a);break;case"Color":e.writeRGBColor(a);break;case"Array":e.writeArray(a);break}}setStructArray(e,t,a){let r=t.length;for(let i=0;i<r;i++){const n=t[i];this.setStruct(e,i,n,a)}}clean(){this._dataView.fill(0,0,this._dataView.length)}apply(){I.device.queue.writeBuffer(this.buffer,0,this.memory.shareDataBuffer)}mapAsyncWrite(e,t){let a;e instanceof Float64Array?a=new Float32Array(e):a=e;let r=I.device;if(a.length>0){let i=null;for(;this.mapAsyncReady.length&&(i=this.mapAsyncReady.shift(),i.usedSize!=a.byteLength);)i.destroy(),this.mapAsyncBuffersOutstanding--,i=null;i||(i=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,mappedAtCreation:!0}),i.usedSize=a.byteLength,this.mapAsyncBuffersOutstanding++,this.mapAsyncBuffersOutstanding>20&&console.warn(` Warning: mapAsync requests from ${this.mapAsyncBuffersOutstanding} frames ago have not resolved yet. MB of staging buffers allocated.`));let n=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(n),i.unmap();const l=r.createCommandEncoder();l.copyBufferToBuffer(i,0,this.buffer,0,t*4),r.queue.submit([l.finish()]),i.mapAsync(GPUMapMode.WRITE).then(()=>this.mapAsyncReady.push(i))}}destroy(e){this.memoryNodes&&this.memoryNodes.forEach(t=>{t.destroy()}),this.bufferType=null,this.seek=null,this.byteSize=null,this.usage=null,this.visibility=null,this.outFloat32Array=null,this.buffer&&this.buffer.destroy(),this.buffer=null,this.memory&&this.memory.destroy(),this.memory=null,this._readBuffer&&this._readBuffer.destroy()}createBuffer(e,t,a,r){let i=I.device;if(this.buffer&&this.destroy(),this.byteSize=t*4,this.usage=e,this.buffer=i.createBuffer({label:r,size:this.byteSize,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this._dataView=new Float32Array(this.memory.shareDataBuffer),this.memory.allocation(this.byteSize),a){let n=this.memory.allocation_node(a.length*4);const o=a.buffer instanceof ArrayBuffer?a.buffer:new Uint8Array(a.buffer).buffer;n.setArrayBuffer(0,o),this.apply()}}resizeBuffer(e,t){this.createBuffer(this.usage,e,t)}createNewBuffer(e,t){let a=I.device,r=t*4,i=e;return this.buffer&&this.destroy(),a.createBuffer({size:r,usage:i,mappedAtCreation:!1})}createBufferByStruct(e,t,a){let r=vi.GetSize(t),i=r*a,n=I.device;this.buffer=n.createBuffer({label:"StructStorageGPUBuffer",size:i,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this._dataView=new Float32Array(this.memory.shareDataBuffer),this.memory.allocation(i);for(let o=0;o<a;o++){let l=o,c=this.memoryNodes.get(l);c||(c=this.memory.allocation_node(r),this.memoryNodes.set(l,c))}}readBuffer(e=!1){this.outFloat32Array||=new Float32Array(this.memory.shareDataBuffer.byteLength/4),this._readBuffer||(this._readBuffer=I.device.createBuffer({size:this.memory.shareDataBuffer.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}));let t=this.read();return e?t:this.outFloat32Array}_readFlag=!1;async read(){if(!this._readFlag){this._readFlag=!0;let e=I.device.createCommandEncoder();e.copyBufferToBuffer(this.buffer,0,this._readBuffer,0,this.memory.shareDataBuffer.byteLength),I.device.queue.submit([e.finish()]),await this._readBuffer.mapAsync(GPUMapMode.READ);const t=this._readBuffer.getMappedRange();this.outFloat32Array.set(new Float32Array(t),0),this._readBuffer.unmap(),this._readFlag=!1}return this.outFloat32Array}}var Aa=(s=>(s[s.IndicesGPUBuffer=0]="IndicesGPUBuffer",s[s.VertexGPUBuffer=1]="VertexGPUBuffer",s[s.UniformGPUBuffer=2]="UniformGPUBuffer",s[s.StorageGPUBuffer=3]="StorageGPUBuffer",s[s.ComputeGPUBuffer=4]="ComputeGPUBuffer",s[s.MaterialDataUniformGPUBuffer=5]="MaterialDataUniformGPUBuffer",s[s.StructStorageGPUBuffer=6]="StructStorageGPUBuffer",s))(Aa||{});class Pe extends Ya{constructor(e,t=0,a){super(),this.bufferType=Aa.StorageGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"StorageGPUBuffer")}}class Ct extends Ya{constructor(e,t){super(),this.bufferType=Aa.UniformGPUBuffer,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,e,t,"UniformGPUBuffer")}genUniformNodes(){}}class Ht{static getMorphTargetShaderBinding(e,t){return`
|
|
1
|
+
class J{static COLOR_RED=new J(1,0,0,1);static COLOR_GREEN=new J(0,1,0,1);static COLOR_BLUE=new J(0,0,1,1);static COLOR_WHITE=new J(1,1,1,1);static COLOR_0=new J;static COLOR_1=new J;static COLOR_2=new J;static HEX_CHARACTERS="a-f\\d";static MATCH_3OR4_HEX=`#?[${J.HEX_CHARACTERS}]{3}[${J.HEX_CHARACTERS}]?`;static MATCH_6OR8_HEX=`#?[${J.HEX_CHARACTERS}]{6}([${J.HEX_CHARACTERS}]{2})?`;static NON_HEX_CHARS=new RegExp(`[^#${J.HEX_CHARACTERS}]`,"gi");static VALID_HEX_SIZE=new RegExp(`^${J.MATCH_3OR4_HEX}$|^${J.MATCH_6OR8_HEX}$`,"i");r=0;g=0;b=0;a=0;constructor(e=1,t=1,a=1,r=1){this.setTo(e,t,a,r)}convertToHDRRGB(){return this.r=this.r*Math.pow(2.4,this.a),this.g=this.g*Math.pow(2.4,this.a),this.b=this.b*Math.pow(2.4,this.a),this}unSerialized(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}hexToRGB(e){return this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}hexToRGBA(e){return this.a=(e>>24&255)/255,this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}static random(e=1){let t=new J;return t.a=e,t.r=e*Math.random(),t.g=e*Math.random(),t.b=e*Math.random(),t}static randomRGB(e=.5,t=.5,a=.5,r=.5,i=.5,n=.5){let o=new J;return o.a=1,o.r=r+e*Math.random(),o.g=i+t*Math.random(),o.b=n+a*Math.random(),o}static randomGray(e=.5,t=.5){let a=Math.random()*t+e,r=new J;return r.a=1,r.r=a,r.g=a,r.b=a,r}setTo(e,t,a,r){this.r=Math.max(e,0),this.g=Math.max(t,0),this.b=Math.max(a,0),this.a=Math.max(r,0)}setHex(e){if(typeof e!="string"||J.NON_HEX_CHARS.test(e)||!J.VALID_HEX_SIZE.test(e))throw new TypeError("Expected a valid hex string");e=e.replace(/^#/,"");let t=1;e.length===8&&(t=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(t=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const a=Number.parseInt(e,16),r=a>>16,i=a>>8&255,n=a&255,o=t;this.a=o,this.r=r/255,this.g=i/255,this.b=n/255}getHex(){let e=a=>{a*=255;let r=a.toString(16);return r.length===1&&(r="0"+r),r};return e(this.r)+e(this.g)+e(this.b)+e(this.a)}get rgb(){return[this.r*255>>>0,this.g*255>>>0,this.b*255>>>0]}set rgb(e){this.setTo(e[0]/255,e[1]/255,e[2]/255,this.a)}get rgba(){return[this.r*255>>>0,this.g*255>>>0,this.b*255>>>0,this.a*255>>>0]}set rgba(e){this.setTo(e[0]/255,e[1]/255,e[2]/255,e[3]/255)}clone(){return new J().copyFrom(this)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}copyFromArray(e,t=255){return this.r=e[0]/t,this.g=e[1]/t,this.b=e[2]/t,this.a=e[3]/t,this}copyFromVector(e){return this.r=e.x,this.g=e.y,this.b=e.z,this.a=e.w||1,this}static hexRGBColor(e,t=null){return t=t||new J,t.hexToRGB(e),t}static lerp(e,t,a,r){let i=r||new J;return i.r=(a.r-t.r)*e+t.r,i.g=(a.g-t.g)*e+t.g,i.b=(a.b-t.b)*e+t.b,i.a=(a.a-t.a)*e+t.a,i}static PRIMARY=4149685;static PRIMARYDARK=3162015;static ACCENT=16728193;static WHITE=16777215;static IVORY=16777200;static LIGHTYELLOW=16777184;static YELLOW=16776960;static SNOW=16775930;static FLORALWHITE=16775920;static LEMONCHIFFON=16775885;static CORNSILK=16775388;static SEASHELL=16774638;static LAVENDERBLUSH=16773365;static PAPAYAWHIP=16773077;static BLANCHEDALMOND=16772045;static MISTYROSE=16770273;static BISQUE=16770244;static MOCCASIN=16770229;static NAVAJOWHITE=16768685;static PEACHPUFF=16767673;static GOLD=16766720;static PINK=16761035;static LIGHTPINK=16758465;static ORANGE=16753920;static LIGHTSALMON=16752762;static DARKORANGE=16747520;static CORAL=16744272;static HOTPINK=16738740;static TOMATO=16737095;static ORANGERED=16729344;static DEEPPINK=16716947;static FUCHSIA=16711935;static MAGENTA=16711935;static RED=16711680;static OLDLACE=16643558;static LIGHTGOLDENRODYELLOW=16448210;static LINEN=16445670;static ANTIQUEWHITE=16444375;static SALMON=16416882;static GHOSTWHITE=16316671;static MINTCREAM=16121850;static WHITESMOKE=16119285;static BEIGE=16119260;static WHEAT=16113331;static SANDYBROWN=16032864;static AZURE=15794175;static HONEYDEW=15794160;static ALICEBLUE=15792383;static KHAKI=15787660;static LIGHTCORAL=15761536;static PALEGOLDENROD=15657130;static VIOLET=15631086;static DARKSALMON=15308410;static LAVENDER=15132410;static LIGHTCYAN=14745599;static BURLYWOOD=14596231;static PLUM=14524637;static GAINSBORO=14474460;static CRIMSON=14423100;static PALEVIOLETRED=14381203;static GOLDENROD=14329120;static ORCHID=14315734;static THISTLE=14204888;static LIGHTGREY=13882323;static TAN=13808780;static CHOCOLATE=13789470;static PERU=13468991;static INDIANRED=13458524;static MEDIUMVIOLETRED=13047173;static SILVER=12632256;static DARKKHAKI=12433259;static ROSYBROWN=12357519;static MEDIUMORCHID=12211667;static DARKGOLDENROD=12092939;static FIREBRICK=11674146;static POWDERBLUE=11591910;static LIGHTSTEELBLUE=11584734;static PALETURQUOISE=11529966;static GREENYELLOW=11403055;static LIGHTBLUE=11393254;static DARKGRAY=11119017;static BROWN=10824234;static SIENNA=10506797;static DARKORCHID=10040012;static PALEGREEN=10025880;static DARKVIOLET=9699539;static MEDIUMPURPLE=9662683;static LIGHTGREEN=9498256;static DARKSEAGREEN=9419919;static SADDLEBROWN=9127187;static DARKMAGENTA=9109643;static DARKRED=9109504;static BLUEVIOLET=9055202;static LIGHTSKYBLUE=8900346;static SKYBLUE=8900331;static GRAY=8421504;static OLIVE=8421376;static PURPLE=8388736;static MAROON=8388608;static AQUAMARINE=8388564;static CHARTREUSE=8388352;static LAWNGREEN=8190976;static MEDIUMSLATEBLUE=8087790;static LIGHTSLATEGRAY=7833753;static SLATEGRAY=7372944;static OLIVEDRAB=7048739;static SLATEBLUE=6970061;static DIMGRAY=6908265;static MEDIUMAQUAMARINE=6737322;static CORNFLOWERBLUE=6591981;static CADETBLUE=6266528;static DARKOLIVEGREEN=5597999;static INDIGO=4915330;static MEDIUMTURQUOISE=4772300;static DARKSLATEBLUE=4734347;static STEELBLUE=4620980;static ROYALBLUE=4286945;static TURQUOISE=4251856;static MEDIUMSEAGREEN=3978097;static LIMEGREEN=3329330;static DARKSLATEGRAY=3100495;static SEAGREEN=3050327;static FORESTGREEN=2263842;static LIGHTSEAGREEN=2142890;static DODGERBLUE=2003199;static MIDNIGHTBLUE=1644912;static AQUA=65535;static CYAN=65535;static SPRINGGREEN=65407;static LIME=65280;static MEDIUMSPRINGGREEN=64154;static DARKTURQUOISE=52945;static DEEPSKYBLUE=49151;static DARKCYAN=35723;static TEAL=32896;static GREEN=32768;static DARKGREEN=25600;static BLUE=255;static MEDIUMBLUE=205;static DARKBLUE=139;static NAVY=128;static BLACK=0}class We{static time=0;static frame=0;static delta=0;static _startTime=0;static _timeLabel="";static start(e){this._startTime=performance.now(),this._timeLabel=e}static end(){console.log(this._timeLabel,performance.now()-this._startTime)}}class pt{target;currentTarget;type;data;param;time=0;delay=0;mouseCode=0;ctrlKey;metaKey;altKey;shiftKey;targetTouches;changedTouches;touches;_stopImmediatePropagation=!1;view;constructor(e=null,t=null){this.type=e,this.data=t}stopImmediatePropagation(){this._stopImmediatePropagation=!0}reset(){this._stopImmediatePropagation=!1}get isStopImmediatePropagation(){return this._stopImmediatePropagation}}class ys{constructor(e=null,t=null,a=null,r=null,i=0){this.type=e,this.thisObject=t,this.handler=a,this.param=r,this.priority=i}static event_id_count=0;id=0;current;equalCurrentListener(e,t,a,r){return this.type==e&&this.thisObject==a&&this.handler==t&&this.param==r}dispose(){this.handler=null,this.thisObject=null,this.param=null,this.priority=0}}class Za{listeners={};data;dispatchEvent(e){let t=this.listeners[e.type];if(t!=null){t=t.slice();for(let a=0;a<t.length;a++){let r=t[a];if(r.handler){try{e.param=r.param,e.currentTarget=r,r.thisObject,r.handler.call(r.thisObject,e)}catch{}if(e.isStopImmediatePropagation)break}}}}destroy(){for(let e in this.listeners){let t=this.listeners[e];for(;t.length>0;){let a=t[0];a.handler=null,a.thisObject=null,t.splice(0,1)}}}addEventListener(e,t,a,r=null,i=0){if(this.listeners[e]==null&&(this.listeners[e]=[]),!this.hasEventListener(e,t,a)){let n=new ys(e,a,t,r,i);return n.id=++ys.event_id_count,n.current=this,this.listeners[e].push(n),this.listeners[e].sort(function(o,l){return l.priority-o.priority}),n.id}for(let n=0;n<this.listeners[e].length;n++){let o=this.listeners[e][n];if(o.equalCurrentListener(e,t,a,r))return o.id}return 0}removeEventListener(e,t,a){if(this.hasEventListener(e,t,a))for(let r=0;r<this.listeners[e].length;r++){let i=this.listeners[e][r];if(i.equalCurrentListener(e,t,a,i.param)){i.handler=null,i.thisObject=null,this.listeners[e].splice(r,1);return}}}removeEventListenerAt(e){for(let t in this.listeners)for(let a=0;a<this.listeners[t].length;a++){let r=this.listeners[t][a];if(r.id==e)return r.handler=null,r.thisObject=null,this.listeners[t].splice(a,1),!0}return!1}removeAllEventListener(e=null){let t;if(e){if(this.listeners[e]){for(let a=0;a<this.listeners[e].length;a++)t=this.listeners[e][a],t.dispose(),this.listeners[e].splice(a,1);delete this.listeners[e]}}else for(let a in this.listeners){for(let r=0;r<this.listeners[a].length;r++)t=this.listeners[a][r],t.dispose(),this.listeners[a].splice(r,1);delete this.listeners[a]}}containEventListener(e){return this.listeners[e]==null?!1:this.listeners[e].length>0}hasEventListener(e,t=null,a=null){if(this.listeners[e]==null)return!1;if(a&&t)for(let r=0;r<this.listeners[e].length;r++){let i=this.listeners[e][r];if(i.equalCurrentListener(e,t,a,i.param))return!0}return!1}}class Ma extends pt{static KEY_DOWN="onKeyDown";static KEY_UP="onKeyUp";keyCode=0}class Z extends pt{static PICK_OVER="onPickOver";static PICK_CLICK="onPickClick";static PICK_OUT="onPickOut";static PICK_MOVE="onPickMove";static PICK_UP="onPickUp";static PICK_DOWN="onPickDown";static POINTER_RIGHT_CLICK="onPointerRightClick";static POINTER_MID_UP="onPointerMidUp";static POINTER_MID_DOWN="onPointerMidDown";static POINTER_CLICK="onPointerClick";static POINTER_MOVE="onPointerMove";static POINTER_DOWN="onPointerDown";static POINTER_UP="onPointerUp";static POINTER_OUT="onPointerOut";static POINTER_OVER="onPointerOver";static POINTER_WHEEL="onPointerWheel";pointerId;pointerType="onPointer";isPrimary;pressure;mouseX;mouseY;movementX;movementY;deltaX;deltaY;deltaZ;reset(){super.reset(),this.mouseX=0,this.mouseY=0,this.movementX=0,this.movementY=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0}}class yt extends pt{static PICK_OVER_GUI="onPickOverGUI";static PICK_CLICK_GUI="onPickClickGUI";static PICK_OUT_GUI="onPickOutGUI";static PICK_UP_GUI="onPickUpGUI";static PICK_DOWN_GUI="onPickDownGUI";pointerId;pointerType="onPickGUI";isPrimary;pressure;mouseX;mouseY;movementX;movementY;deltaX;deltaY;deltaZ;reset(){super.reset(),this.mouseX=0,this.mouseY=0,this.movementX=0,this.movementY=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0}}class b{static MAX=new b(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);static MIN=new b(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE);static SAFE_MAX=new b(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new b(Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);static X_AXIS=new b(1,0,0);static neg_X_AXIS=new b(-1,0,0);static Y_AXIS=new b(0,1,0);static Z_AXIS=new b(0,0,1);static HELP_0=new b;static HELP_1=new b;static HELP_2=new b;static EPSILON=1e-5;static HELP_3=new b;static HELP_4=new b;static HELP_5=new b;static HELP_6=new b;static get ZERO(){return new b(0,0,0)}static get ONE(){return new b(1,1,1)}static get LEFT(){return new b(-1,0,0)}static get RIGHT(){return new b(1,0,0)}static get UP(){return new b(0,1,0)}static get DOWN(){return new b(0,-1,0)}static get BACK(){return new b(0,0,-1)}static get FORWARD(){return new b(0,0,1)}x=0;y=0;z=0;w=1;index=0;static _index=0;constructor(e=0,t=0,a=0,r=0){this.set(e,t,a,r),this.index=b._index++}set a(e){this.w=e}set r(e){this.x=e}set g(e){this.y=e}set b(e){this.z=e}get a(){return this.w}get r(){return this.x}get g(){return this.y}get b(){return this.z}get length(){return Math.sqrt(this.lengthSquared)}get lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}get position(){return this}static getTowPointbyDir(e,t,a,r,i){i==b.Z_AXIS?(t.x=e.y,t.y=-e.x,a.x=-e.y,a.y=e.x,t.scaleBy(r*.5),a.scaleBy(r*.5)):i==b.Y_AXIS&&(t.x=e.z,t.z=-e.x,a.x=-e.z,a.z=e.x,t.scaleBy(r*.5),a.scaleBy(r*.5))}static pointToLine(e,t,a){let r=0,i,n,o;if(i=b.distance(e,t),n=b.distance(e,a),o=b.distance(t,a),o<=1e-6||n<=1e-6)return r=0,r;if(i<=1e-6||o*o>=i*i+n*n)return r=n,r;if(n*n>=i*i+o*o)return r=o,r;let l=(i+n+o)/2;return r=2*Math.sqrt(l*(l-i)*(l-n)*(l-o))/i,r}static dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}static getPoints(e,t){let a=[];for(let r=0;r<e;r++){const i=new b(Math.random()*t-t*.5,Math.random()*t-t*.5,Math.random()*t-t*.5);a.push(i)}return a}static getPointNumbers(e,t){let a=[];for(let r=0;r<e;r++)a.push(Math.random()*t-t*.5,Math.random()*t-t*.5,Math.random()*t-t*.5);return a}static getAngle(e,t){let a=e.dotProduct(t)/(e.length*t.length);return Math.acos(a)*180/Math.PI}static sqrMagnitude(e){return e.x*e.x+e.y*e.y+e.z*e.z}static getZYAngle(e,t){return this.calAngle(e.y,e.z,t.y,t.z)}static sub(e,t,a=null){return a=a||new b,a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}static add(e,t,a=null){return a=a||new b,a.x=e.x+t.x,a.y=e.y+t.y,a.z=e.z+t.z,a}static smoothDamp(e,t,a,r,i,n){return null}static distance(e,t){let a=e.x-t.x,r=e.y-t.y,i=e.z-t.z;return Math.sqrt(a*a+r*r+i*i)}static squareDistance(e,t){let a=e.x-t.x,r=e.y-t.y,i=e.z-t.z;return a*a+r*r+i*i}static distanceXZ(e,t){let a=e.x-t.x,r=0,i=e.z-t.z;return Math.sqrt(a*a+r*r+i*i)}set(e,t,a,r=1){return this.x=e,this.y=t,this.z=a,this.w=r,this}add(e,t=null){t||=new b;let a=this.x,r=this.y,i=this.z,n=this.w,o=e.x,l=e.y,c=e.z,f=e.w;return t.setTo(a+o,r+l,i+c,n+f),t}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}min(e,t=this){return t.x=Math.min(this.x,e.x),t.y=Math.min(this.y,e.y),t.z=Math.min(this.z,e.z),t}max(e,t=this){return t.x=Math.max(this.x,e.x),t.y=Math.max(this.y,e.y),t.z=Math.max(this.z,e.z),t}distanceToSquared(e){let t=this.x-e.x,a=this.y-e.y,r=this.z-e.z;return t*t+a*a+r*r}addXYZW(e,t,a,r,i=null){i||=new b;let n=this.x,o=this.y,l=this.z,c=this.w,f=e,d=t,h=a,u=r;return i.setTo(n+f,o+d,l+h,c+u),i}clone(){return new b(this.x,this.y,this.z,this.w)}copyFrom(e){let t=this;return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}decrementBy(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}dotProduct(e){return this.x*e.x+this.y*e.y+this.z*e.z}equals(e,t=!1){return this.x==e.x&&this.y==e.y&&this.z==e.z&&(!t||this.w==e.w)}incrementBy(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}divide(e){return e instanceof b?new b(this.x/e.x,this.y/e.y,this.z/e.z):(this.x=this.x/e,this.y=this.y/e,this.z=this.z/e,this)}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}normalize(e=1){let t=this;if(this.length!=0){let a=e/this.length;return this.x*=a,this.y*=a,this.z*=a,t}return t}applyQuaternion(e){const t=this.x,a=this.y,r=this.z,i=e.x,n=e.y,o=e.z,l=e.w,c=l*t+n*r-o*a,f=l*a+o*t-i*r,d=l*r+i*a-n*t,h=-i*t-n*a-o*r;return this.x=c*l+h*-i+f*-o-d*-n,this.y=f*l+h*-n+d*-i-c*-o,this.z=d*l+h*-o+c*-n-f*-i,this}applyMatrix4(e){return e.transformPoint(this,this)}scaleBy(e){return this.x*=e,this.y*=e,this.z*=e,this}mul(e){let t=new b;return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t}scale(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}scaleToRef(e,t){return t||(t=new b),t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t}setTo(e,t,a,r=1){this.x=e,this.y=t,this.z=a,this.w=r}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}subtract(e,t=null){return t||(t=new b),t.setTo(this.x-e.x,this.y-e.y,this.z-e.z),t}multiply(e,t=null){t||(t=new b);let a=this.x,r=this.y,i=this.z,n=e.x,o=e.y,l=e.z;return t.setTo(a*n,r*o,i*l),t}divided(e,t=null){t||(t=new b);let a=this.x,r=this.y,i=this.z,n=e.x,o=e.y,l=e.z;return t.setTo(a/n,r/o,i/l),t}div(e,t){t||(t=new b);let a=this.x,r=this.y,i=this.z,n=this.w;return t.setTo(a/e,r/e,i/e,n/e),t}lerp(e,t,a){let r=e.x,i=e.y,n=e.z,o=e.w,l=t.x,c=t.y,f=t.z,d=t.w;this.x=(l-r)*a+r,this.y=(c-i)*a+i,this.z=(f-n)*a+n,this.w=(d-o)*a+o}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}toString(){return"<"+this.x+", "+this.y+", "+this.z+">"}normalizeToWay2D_XY(){let e=Math.abs(this.x),t=Math.abs(this.y);e>t?this.x>0?this.copyFrom(b.RIGHT):this.copyFrom(b.LEFT):this.y>0?this.copyFrom(b.DOWN):this.copyFrom(b.UP)}toArray(){return[this.x,this.y,this.z]}copyToBytes(e){e.setFloat32(0*Float32Array.BYTES_PER_ELEMENT,this.x,!0),e.setFloat32(1*Float32Array.BYTES_PER_ELEMENT,this.y,!0),e.setFloat32(2*Float32Array.BYTES_PER_ELEMENT,this.z,!0)}crossProduct(e,t=null){return t=t||new b,t.x=this.y*e.z-this.z*e.y,t.y=this.z*e.x-this.x*e.z,t.z=this.x*e.y-this.y*e.x,t.w=1,t}crossVectors(e,t){return e.crossProduct(t,this),this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}setFromArray(e,t=0){this.x=e[t],this.y=e[t+1],this.z=e[t+2]}divideScalar(e){return this.multiplyScalar(1/e)}clampLength(e,t){let a=this.length;return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(t,a)))}setScalar(e){return this.x=e,this.y=e,this.z=e,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}static calAngle(e,t,a,r){const i=o(a,r,e,t);let n=Math.acos(i)*180/Math.PI;return a<e&&(n=-n),n;function o(c,f,d,h){let u=[c-d,f-h];return l(u,[0,-1])}function l(c,f){let d=c[0]*f[0]+c[1]*f[1],h=Math.sqrt(c[0]*c[0]+c[1]*c[1])*Math.sqrt(f[0]*f[0]+f[1]*f[1]);return d/h}}static pointInsideTriangle(e,t,a,r){return b.HELP_0.setTo(e.x,e.z,0),b.HELP_1.setTo(t.x,t.z,0),b.HELP_2.setTo(a.x,a.z,0),b.HELP_3.setTo(r.x,r.z,0),b.pointInsideTriangle2d()}static pointInsideTriangle2d(){return b.productXY(b.HELP_1,b.HELP_2,b.HELP_3)>=0?b.productXY(b.HELP_1,b.HELP_2,b.HELP_0)>=0&&b.productXY(b.HELP_2,b.HELP_3,b.HELP_0)>=0&&b.productXY(b.HELP_3,b.HELP_1,b.HELP_0)>=0:b.productXY(b.HELP_1,b.HELP_2,b.HELP_0)<=0&&b.productXY(b.HELP_2,b.HELP_3,b.HELP_0)<=0&&b.productXY(b.HELP_3,b.HELP_1,b.HELP_0)<=0}static productXY(e,t,a){var r=(e.x-a.x)*(t.y-a.y)-(e.y-a.y)*(t.x-a.x);return r>-1e-5&&r<1e-5&&(r=0),r}static serialize(e){return new b(e.x,e.y,e.z,e.w)}}class Cl{constructor(e){this.canvasX=e.clientX,this.canvasY=e.clientY,this.identifier=e.identifier,this.clientX=e.clientX,this.clientY=e.clientY,this.pageX=e.pageX,this.pageY=e.pageY,this.screenX=e.screenX,this.screenY=e.screenY}canvasX;canvasY;identifier;clientX;clientY;pageX;pageY;screenX;screenY}class Sl extends Za{canvasX=0;canvasY=0;isMouseDown=!1;isRightMouseDown=!1;canvas;mouseX=0;mouseY=0;wheelDelta=0;mouseOffsetX=0;mouseOffsetY=0;mouseLastX=0;mouseLastY=0;_time=0;_keyStatus;_mouseStatus;_isTouchStart;_keyEvent3d;_pointerEvent3D;_windowsEvent3d;mouseLock=!1;initCanvas(e){this.canvas=e;let t=0,a=0,r=0,i=0;e.onpointerdown=o=>{t=performance.now(),a=o.clientX,r=o.clientY,i=o.button,o.button==0?this.mouseStart(o):o.button==1?this.middleDown(o):o.button==2&&(this.isRightMouseDown=!0,this.mouseStart(o)),e.setPointerCapture(o.pointerId)},e.onpointerup=o=>{o.button==0?this.mouseEnd(o):o.button==1?this.middleUp(o):o.button==2&&(this.isRightMouseDown=!1,this.mouseEnd(o)),o.button===i&&performance.now()-t<300&&Math.abs(a-o.clientX)<20&&Math.abs(r-o.clientY)<20&&(o.button===0?this.mouseClick(o):this.rightClick(o)),e.releasePointerCapture(o.pointerId)},e.onpointerenter=o=>{this.mouseOver(o)},e.onpointermove=o=>{this.mouseMove(o)},e.onpointercancel=o=>{e.releasePointerCapture(o.pointerId),o.button==1?this.middleUp(o):this.mouseEnd(o)},e.addEventListener("wheel",o=>this.mouseWheel(o),{passive:!1}),window.addEventListener("keydown",o=>this.keyDown(o),!0),window.addEventListener("keyup",o=>this.keyUp(o),!0),e.oncontextmenu=function(){return!1};let n=this.canvas.getBoundingClientRect();this.canvasX=n.left,this.canvasY=n.top,this._keyStatus={},this._mouseStatus={},this._isTouchStart=!1,this._keyEvent3d=new Ma,this._pointerEvent3D=new Z,this._windowsEvent3d=new pt}useMouseLock(){this.mouseLock||(this.canvas.requestPointerLock(),this.mouseLock=!0,document.addEventListener("mousemove",e=>this.onMouseLockMove(e),!1))}releaseMouseLock(){this.mouseLock=!1,document.exitPointerLock(),document.removeEventListener("mousemove",e=>this.onMouseLockMove(e),!1)}onMouseLockMove(e){this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=e.movementX,this.mouseOffsetY=e.movementY,this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_MOVE,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.movementX=e.movementX,this._pointerEvent3D.movementY=e.movementY,this.dispatchEvent(this._pointerEvent3D)}onPinch(e,t,a,r){this._oldPosition1=new b(e,t),this._oldPosition2=new b(a,r)}onSwipe(e,t){this.mouseX=e,this.mouseY=t,this._oldPosition1=null,this._oldPosition2=null,this._time=new Date().getTime()}_oldPosition1=null;_oldPosition2=null;GetTargetTouches(e){for(var t=new Array,a=0;a<e.length;a++){var r=new Cl(e[a]);t.push(r)}return t}rightClick(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_RIGHT_CLICK,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this.dispatchEvent(this._pointerEvent3D)}middleDown(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_MID_DOWN,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId?e.pointerId:0,this._pointerEvent3D.pointerType=e.pointerType?e.pointerType:0,this._pointerEvent3D.isPrimary=e.isPrimary?e.isPrimary:0,this._pointerEvent3D.pressure=e.pressure?e.pressure:0,this.dispatchEvent(this._pointerEvent3D)}middleUp(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_MID_UP,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this.dispatchEvent(this._pointerEvent3D)}mouseClick(e){this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.mouseX=e.clientX-this.canvasX,this._pointerEvent3D.mouseY=e.clientY-this.canvasY,this._pointerEvent3D.type=Z.POINTER_CLICK,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this.dispatchEvent(this._pointerEvent3D)}_downTime=0;mouseEnd(e){this.isMouseDown=!1,this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._mouseStatus[this._pointerEvent3D.mouseCode]=!1,this._pointerEvent3D.type=Z.POINTER_UP,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this.dispatchEvent(this._pointerEvent3D)}mouseStart(e){this.isMouseDown=!0,this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.mouseCode=e.button,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId?e.pointerId:0,this._pointerEvent3D.pointerType=e.pointerType?e.pointerType:0,this._pointerEvent3D.isPrimary=e.isPrimary?e.isPrimary:0,this._pointerEvent3D.pressure=e.pressure?e.pressure:0,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.type=Z.POINTER_DOWN,this.dispatchEvent(this._pointerEvent3D)}mouseMove(e){this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_MOVE,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.movementX=e.movementX,this._pointerEvent3D.movementY=e.movementY,this.dispatchEvent(this._pointerEvent3D)}mouseOver(e){this.isMouseDown=!1,this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_OVER,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.pointerId=e.pointerId,this._pointerEvent3D.pointerType=e.pointerType,this._pointerEvent3D.isPrimary=e.isPrimary,this._pointerEvent3D.pressure=e.pressure,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this.dispatchEvent(this._pointerEvent3D)}mouseWheel(e){e.preventDefault(),this.mouseLastX=this.mouseX,this.mouseLastY=this.mouseY,this.mouseX=e.clientX-this.canvasX,this.mouseY=e.clientY-this.canvasY,this.mouseOffsetX=this.mouseX-this.mouseLastX,this.mouseOffsetY=this.mouseY-this.mouseLastY,"wheelDelta"in e?(this._pointerEvent3D.delay=e.wheelDelta,this.wheelDelta=e.wheelDelta):"delta"in e&&(this.wheelDelta=e.delta),this._pointerEvent3D.reset(),this._pointerEvent3D.type=Z.POINTER_WHEEL,this._pointerEvent3D.ctrlKey=e.ctrlKey,this._pointerEvent3D.metaKey=e.metaKey,this._pointerEvent3D.altKey=e.altKey,this._pointerEvent3D.shiftKey=e.shiftKey,this._pointerEvent3D.mouseX=this.mouseX,this._pointerEvent3D.mouseY=this.mouseY,this._pointerEvent3D.deltaX=e.deltaX,this._pointerEvent3D.deltaY=e.deltaY,this._pointerEvent3D.deltaZ=e.deltaZ,this.dispatchEvent(this._pointerEvent3D)}keyDown(e){this._keyEvent3d.reset(),this._keyEvent3d.keyCode=e.keyCode,this._keyEvent3d.ctrlKey=e.ctrlKey,this._keyEvent3d.altKey=e.altKey,this._keyEvent3d.shiftKey=e.shiftKey,this._keyStatus[e.keyCode]||(this._keyStatus[e.keyCode]=!0,this._keyEvent3d.type=Ma.KEY_DOWN,this.dispatchEvent(this._keyEvent3d))}keyUp(e){this._keyEvent3d.reset(),this._keyEvent3d.keyCode=e.keyCode,this._keyStatus[e.keyCode]=!1,this._keyEvent3d.type=Ma.KEY_UP,this.dispatchEvent(this._keyEvent3d)}GetSlideAngle(e,t){return Math.atan2(t,e)*180/Math.PI}GetSlideDirection(e,t,a,r){var i=t-r,n=a-e,o=0;if(Math.abs(n)<2&&Math.abs(i)<2)return o;var l=this.GetSlideAngle(n,i);return l>=-45&&l<45?o=4:l>=45&&l<135?o=1:l>=-135&&l<-45?o=2:(l>=135&&l<=180||l>=-180&&l<-135)&&(o=3),o}}class lr extends pt{static RESIZE="resize"}class Fl extends Za{adapter;device;context;aspect;presentationSize=[0,0];presentationFormat;canvas;windowWidth;windowHeight;canvasConfig;_pixelRatio=1;_resizeEvent;get pixelRatio(){return this._pixelRatio}async init(e){if(this.canvasConfig=e,e&&e.canvas){if(this.canvas=e.canvas,this.canvas===null)throw new Error("no Canvas");this.canvas.style.width||(this.canvas.style.width=this.canvas.width+"px"),this.canvas.style.height||(this.canvas.style.height=this.canvas.height+"px")}else this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top="0px",this.canvas.style.left="0px",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.zIndex=e?.zIndex?e.zIndex.toString():"0",document.body.appendChild(this.canvas);if(e&&e.backgroundImage?(this.canvas.style.background=`url(${e.backgroundImage})`,this.canvas.style["background-size"]="cover",this.canvas.style["background-position"]="center"):this.canvas.style.background="transparent",this.canvas.style["touch-action"]="none",this.canvas.style["object-fit"]="cover",navigator.gpu===void 0)throw new Error("Your browser does not support WebGPU!");if(this.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),this.adapter==null)throw new Error("Your browser does not support WebGPU!");const t=[],a=o=>{const l=this.adapter.features.has(o);return l&&t.push(o),l};a("bgra8unorm-storage"),a("depth-clip-control"),a("depth32float-stencil8"),a("indirect-first-instance"),a("rg11b10ufloat-renderable"),a("float32-filterable"),a("float32-blendable"),a("timestamp-query"),a("shader-f16"),a("clip-distances"),a("texture-compression-bc"),a("texture-compression-etc2"),a("texture-compression-astc");const r=this.adapter?.limits,i={};if(r)for(const o in r)o==="minSubgroupSize"||o==="maxSubgroupSize"||(i[o]=r[o]);if(this.device=await this.adapter.requestDevice({requiredFeatures:t,requiredLimits:i,defaultQueue:{label:"RingsDefaultQueue"}}),this.device==null)throw new Error("Your browser does not support WebGPU!");return this._pixelRatio=this.canvasConfig?.devicePixelRatio||window.devicePixelRatio||1,this._pixelRatio=Math.min(this._pixelRatio,2),this.device.label="RingsWebGPUDevice",this.presentationFormat=navigator.gpu.getPreferredCanvasFormat(),this.context=this.canvas.getContext("webgpu"),this.context.configure({device:this.device,format:this.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,alphaMode:"premultiplied",colorSpace:"srgb"}),this._resizeEvent=new lr(lr.RESIZE,{width:this.windowWidth,height:this.windowHeight}),new ResizeObserver(()=>{this.updateSize(),ut.destroyTexture()}).observe(this.canvas),this.updateSize(),!0}updateSize(){let e=Math.floor(this.canvas.clientWidth*this.pixelRatio),t=Math.floor(this.canvas.clientHeight*this.pixelRatio);(e!=this.windowWidth||t!=this.windowHeight)&&(this.canvas.width=this.windowWidth=e,this.canvas.height=this.windowHeight=t,this.presentationSize[0]=this.windowWidth,this.presentationSize[1]=this.windowHeight,this.aspect=this.windowWidth/this.windowHeight,this._resizeEvent.data.width=this.windowWidth,this._resizeEvent.data.height=this.windowHeight,this.dispatchEvent(this._resizeEvent))}}let I=new Fl;var Ne=(s=>(s[s.Default=1]="Default",s[s.IgnoreDepthPass=2]="IgnoreDepthPass",s[s.Sky=6]="Sky",s[s.Particle=10]="Particle",s[s.SkinnedMesh=16]="SkinnedMesh",s[s.MorphTarget=32]="MorphTarget",s[s.Terrain=64]="Terrain",s[s.UI=128]="UI",s[s.Reflection=256]="Reflection",s[s.ReflectionDebug=512]="ReflectionDebug",s[s.Graphic3D=1024]="Graphic3D",s))(Ne||{});class ia{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)==t}}class de{static HELP_0=new de;static HELP_1=new de;static HELP_2=new de;static ZERO=new de(0,0);static SAFE_MAX=new de(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new de(Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);x=0;y=0;constructor(e=0,t=0){this.x=e,this.y=t}static getAngle(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}static slerp(e,t,a){let r=new de,i=e.dot(t);if(i<0&&(t.x=-t.x,t.y=-t.y,i=-i),i>.9995)return r.x=e.x+a*(t.x-e.x),r.y=e.y+a*(t.y-e.y),r;let n=Math.acos(i),o=Math.sin(n),l=Math.sin((1-a)*n)/o,c=Math.sin(a*n)/o;return r.x=l*e.x+c*t.x,r.y=l*e.y+c*t.y,r}static lerp(e,t,a){return de.HELP_0.copyFrom(e),de.HELP_1.copyFrom(t),de.HELP_0.scale(a),de.HELP_1.scale(1-a),new de(de.HELP_0.x+de.HELP_1.x,de.HELP_0.y+de.HELP_1.y)}set(e=0,t=0){return this.x=e,this.y=t,this}distance(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}add(e,t){return t=t||new de,t.x=this.x+e.x,t.y=this.y+e.y,t}sub(e,t){return t=t||new de,t.x=this.x-e.x,t.y=this.y-e.y,t}scale(e){return this.x=this.x*e,this.y=this.y*e,this}multiply(e,t){return t=t||new de,t.x=this.x*e,t.y=this.y*e,t}multiplyScaler(e){return this.x*=e,this.y*=e,this}divide(e,t){return t=t||new de,t.x=this.x/e,t.y=this.y/e,t}neg(e){return e||(e=new de),e.x=-e.x,e.y=-e.y,e}abs(){return Math.sqrt(this.x*this.x+this.y*this.y)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}getAngle(e){return Math.atan2(e.y-this.y,e.x-this.x)}unt(e){e=e||new de;let t=this.abs();return e.x=this.x/t,e.y=this.y/t,e}angleTo(e){let t=e.x-this.x,a=e.y-this.y;return Math.atan2(a,t)}equals(e){return Math.abs(this.x-e.x)<1e-6&&Math.abs(this.y-e.y)<1e-6}pal(e){let t=this.unt(),a=e.unt();return t.equals(a)?1:t.equals(a.neg())?-1:0}clone(){return new de(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}dot(e){return this.x*e.x+this.y*e.y}normalize(){let e=this.abs();return this.x=this.x/e,this.y=this.y/e,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}}class be{static X_AXIS=new be(1,0,0);static Y_AXIS=new be(0,1,0);static Z_AXIS=new be(0,0,1);static HELP_0=new be;static HELP_1=new be;static HELP_2=new be;static EPSILON=1e-5;static HELP_3=new be;static HELP_4=new be;static HELP_5=new be;static HELP_6=new be;static ZERO=new be;static ONE=new be(1,1,1,1);static LEFT=new be(-1,0,0);static RIGHT=new be(1,0,0);static UP=new be(0,-1,0);static DOWN=new be(0,1,0);static BACK=new be(0,0,-1);static FORWARD=new be(0,0,1);x=0;y=0;z=0;w=1;constructor(e=0,t=0,a=0,r=0){this.x=e,this.y=t,this.z=a,this.w=r}get width(){return this.z}get height(){return this.w}static crossVectors(e,t,a){a=a||new be;var r=e.x,i=e.y,n=e.z,o=t.x,l=t.y,c=t.z;return a.x=i*c-n*l,a.y=n*o-r*c,a.z=r*l-i*o,a}static distance(e,t){let a=e.x-t.x,r=e.y-t.y,i=e.z-t.z,n=e.w-t.w;return Math.sqrt(a*a+r*r+i*i+n*n)}set(e,t,a,r){return this.x=e,this.y=t,this.z=a,this.w=r,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}clone(){return new be(this.x,this.y,this.z,this.w)}}function vn(s,e){let t=s.__NonSerialize__;t||(t=s.__NonSerialize__={},t.__NonSerialize__=!0),t[e]=!0}function xn(s,e){let t;for(;s&&(s=s.__proto__,s&&(t=s.__NonSerialize__),!t););return t&&t[e]}function Kr(s,e,t,a,r){let i=s.__EditorInspector__;i||(i=s.__EditorInspector__=new Map);let n=i.get(s.constructor.name);n||(n=new Map,i.set(s.constructor.name,n)),n.set(e,{p1:t,p2:a,p3:r})}function zu(s){let e,t=s,a=[];for(;t;){if(a.indexOf(t.constructor.name)!=-1){t=t.__proto__;continue}a.push(t.constructor.name),t=t.__proto__}for(a=a.reverse(),t=s;t&&(t=t.__proto__,t&&(e=t.__EditorInspector__),!e););let r=new Map;if(e)for(let i=0;i<a.length;i++){const n=a[i];let o=e.get(n);o&&o.forEach((l,c)=>{r.set(c,l)})}return r}function Ot(s,e,t,a,r){let i=window.__Component__;i||(i=window.__Component__={}),i[e]=s}function kl(s){let e=window.__Component__;return e[s]?e[s]:null}function Na(s,e,t,a,r){let i=window.__shader__;i||(i=window.__shader__={}),i[e]=s}function El(s){let e=window.__shader__;return e[s]?e[s]:null}var Wu=Object.defineProperty,wl=(s,e,t,a)=>{for(var r=void 0,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(e,t,r)||r);return r&&Wu(e,t,r),r};const Un=class ss{__refection;__size=0;getValueType(){if(!this.__refection){let e=this;this.__refection=[];for(const t in e)if(!xn(this,t)){const a=e[t];let r={name:t,type:a.constructor.name};this.__refection.push(r)}}return this.__refection}static getValueSize(e){switch(e.constructor.name){case"Boolean":return 4;case"Number":return 4;case"f32":return 4;case"i32":return 4;case"u32":return 4;case"Float32Array":return e.byteLength;case"Vector2":return 8;case"Vector3":return 12;case"Vector4":return 16;case"Color":return 16;case"Array":let a=0;for(let r=0,i=e.length;r<i;r++)a+=ss.getValueSize(e[r]);return a}return 0}static __cacheStruct=new Map;static Ref(e){return this.Get(e).getValueType()}static Get(e){let t=ss.__cacheStruct.get(e.prototype);return t||(t=new e,ss.__cacheStruct.set(e.prototype,t)),t}static GetSize(e){let t=this.Get(e);if(t.__size==0){for(const a in t)if(!xn(t,a)){const r=t[a];t.__size+=ss.getValueSize(r)}t.__size>4&&(t.__size=Math.ceil(t.__size/4)*4)}return t.__size}};wl([vn],Un.prototype,"__refection"),wl([vn],Un.prototype,"__size");let vi=Un;class Il{byteOffset;byteSize;offset=0;dataBytes;get x(){return this.dataBytes.getFloat32(0*Float32Array.BYTES_PER_ELEMENT,!0)}set x(e){this.dataBytes.setFloat32(0*Float32Array.BYTES_PER_ELEMENT,e,!0)}get y(){return this.dataBytes.getFloat32(1*Float32Array.BYTES_PER_ELEMENT,!0)}set y(e){this.dataBytes.setFloat32(1*Float32Array.BYTES_PER_ELEMENT,e,!0)}get z(){return this.dataBytes.getFloat32(2*Float32Array.BYTES_PER_ELEMENT,!0)}set z(e){this.dataBytes.setFloat32(2*Float32Array.BYTES_PER_ELEMENT,e,!0)}get w(){return this.dataBytes.getFloat32(3*Float32Array.BYTES_PER_ELEMENT,!0)}set w(e){this.dataBytes.setFloat32(3*Float32Array.BYTES_PER_ELEMENT,e,!0)}setX(e){this.x=e}setXY(e,t){this.x=e,this.y=t}setXYZ(e,t,a){this.x=e,this.y=t,this.z=a}setXYZW(e,t,a,r){this.x=e,this.y=t,this.z=a,this.w=r}setVector2Array(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*2+0)*Float32Array.BYTES_PER_ELEMENT,a.x,!0),this.dataBytes.setFloat32((t*2+1)*Float32Array.BYTES_PER_ELEMENT,a.y,!0)}}setVector3Array(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*3+0)*Float32Array.BYTES_PER_ELEMENT,a.x,!0),this.dataBytes.setFloat32((t*3+1)*Float32Array.BYTES_PER_ELEMENT,a.y,!0),this.dataBytes.setFloat32((t*3+2)*Float32Array.BYTES_PER_ELEMENT,a.z,!0)}}setVector4Array(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*4+0)*Float32Array.BYTES_PER_ELEMENT,a.x,!0),this.dataBytes.setFloat32((t*4+1)*Float32Array.BYTES_PER_ELEMENT,a.y,!0),this.dataBytes.setFloat32((t*4+2)*Float32Array.BYTES_PER_ELEMENT,a.z,!0),this.dataBytes.setFloat32((t*4+3)*Float32Array.BYTES_PER_ELEMENT,a.w,!0)}}setColorArray(e){for(let t=0;t<e.length;t++){const a=e[t];this.dataBytes.setFloat32((t*4+0)*Float32Array.BYTES_PER_ELEMENT,a.r,!0),this.dataBytes.setFloat32((t*4+1)*Float32Array.BYTES_PER_ELEMENT,a.g,!0),this.dataBytes.setFloat32((t*4+2)*Float32Array.BYTES_PER_ELEMENT,a.b,!0),this.dataBytes.setFloat32((t*4+3)*Float32Array.BYTES_PER_ELEMENT,a.a,!0)}}setInt8(e,t=0){this.dataBytes.setInt8(t*Int8Array.BYTES_PER_ELEMENT,e)}getInt8(e=0){return this.dataBytes.getInt8(e*Int8Array.BYTES_PER_ELEMENT)}setInt16(e,t=0){this.dataBytes.setInt16(t*Int16Array.BYTES_PER_ELEMENT,e,!0)}getInt16(e=0){return this.dataBytes.getInt16(e*Int16Array.BYTES_PER_ELEMENT,!0)}setInt32(e,t=0){this.dataBytes.setInt32(t*Int32Array.BYTES_PER_ELEMENT,e,!0)}getInt32(e=0){return this.dataBytes.getInt32(e*Int32Array.BYTES_PER_ELEMENT,!0)}setFloat(e,t=0){this.dataBytes.setFloat32(t*Float32Array.BYTES_PER_ELEMENT,e,!0)}getFloat(e=0){return this.dataBytes.getFloat32(e*Float32Array.BYTES_PER_ELEMENT,!0)}setUint8(e,t=0){this.dataBytes.setUint8(t*Uint8Array.BYTES_PER_ELEMENT,e)}getUint8(e=0){return this.dataBytes.getUint8(e*Uint8Array.BYTES_PER_ELEMENT)}setUint16(e,t=0){this.dataBytes.setUint16(t*Uint16Array.BYTES_PER_ELEMENT,e,!0)}getUint16(e=0){return this.dataBytes.getUint16(e*Uint16Array.BYTES_PER_ELEMENT,!0)}setUint32(e,t=0){this.dataBytes.setUint32(t*Uint32Array.BYTES_PER_ELEMENT,e,!0)}getUint32(e=0){return this.dataBytes.getUint32(e*Uint32Array.BYTES_PER_ELEMENT,!0)}setArray(e,t){for(let a=0;a<t.length;a++){const r=t[a];this.dataBytes.setFloat32((e+a)*Float32Array.BYTES_PER_ELEMENT,r,!0)}}setFloat32Array(e,t){new Float32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Float32Array.BYTES_PER_ELEMENT,t.length).set(t)}setFloatArray(e,t){let a;t instanceof Float32Array?a=t:a=new Float32Array(t),new Float32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Float32Array.BYTES_PER_ELEMENT,a.length).set(a)}setArrayBuffer(e,t){t instanceof Uint8Array?this.setUint8Array(e,t):t instanceof Uint16Array?this.setUint16Array(e,t):t instanceof Uint32Array?this.setUint32Array(e,t):t instanceof Int8Array?this.setInt8Array(e,t):t instanceof Int16Array?this.setInt16Array(e,t):t instanceof Int32Array?this.setInt32Array(e,t):t instanceof Float32Array&&this.setFloat32Array(e,t)}setInt8Array(e,t){new Int8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Int8Array.BYTES_PER_ELEMENT).set(t)}setInt16Array(e,t){new Int16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Int16Array.BYTES_PER_ELEMENT).set(t)}setInt32Array(e,t){new Int32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Int32Array.BYTES_PER_ELEMENT).set(t)}setUint8Array(e,t){new Uint8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Uint8Array.BYTES_PER_ELEMENT).set(t)}setUint16Array(e,t){new Uint16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Uint16Array.BYTES_PER_ELEMENT).set(t)}setUint32Array(e,t){new Uint32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+e*Uint32Array.BYTES_PER_ELEMENT).set(t)}setData(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t,!0)}setVector2(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.x,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.y,!0)}setVector3(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.x,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.y,!0),this.dataBytes.setFloat32((e+2)*Float32Array.BYTES_PER_ELEMENT,t.z,!0)}setVector4(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.x,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.y,!0),this.dataBytes.setFloat32((e+2)*Float32Array.BYTES_PER_ELEMENT,t.z,!0),this.dataBytes.setFloat32((e+3)*Float32Array.BYTES_PER_ELEMENT,t.w,!0)}setColor(e,t){this.dataBytes.setFloat32(e*Float32Array.BYTES_PER_ELEMENT,t.r,!0),this.dataBytes.setFloat32((e+1)*Float32Array.BYTES_PER_ELEMENT,t.g,!0),this.dataBytes.setFloat32((e+2)*Float32Array.BYTES_PER_ELEMENT,t.b,!0),this.dataBytes.setFloat32((e+3)*Float32Array.BYTES_PER_ELEMENT,t.a,!0)}getData(e){return this.dataBytes.getFloat32(e*Float32Array.BYTES_PER_ELEMENT,!0)}writeFloat(e){this.dataBytes.setFloat32(this.offset,e,!0),this.offset+=Float32Array.BYTES_PER_ELEMENT}writeInt8(e){this.dataBytes.setInt8(this.offset,e),this.offset+=Int8Array.BYTES_PER_ELEMENT}writeInt16(e){this.dataBytes.setInt16(this.offset,e,!0),this.offset+=Int16Array.BYTES_PER_ELEMENT}writeInt32(e){this.dataBytes.setInt32(this.offset,e,!0),this.offset+=Int32Array.BYTES_PER_ELEMENT}writeUint8(e){this.dataBytes.setUint8(this.offset,e),this.offset+=Uint8Array.BYTES_PER_ELEMENT}writeUint16(e){this.dataBytes.setUint16(this.offset,e,!0),this.offset+=Uint16Array.BYTES_PER_ELEMENT}writeUint32(e){this.dataBytes.setUint32(this.offset,e,!0),this.offset+=Uint32Array.BYTES_PER_ELEMENT}writeVector2(e){this.writeFloat(e.x),this.writeFloat(e.y)}writeVector3(e){this.writeFloat(e.x),this.writeFloat(e.y),this.writeFloat(e.z)}writeVector4(e){this.writeFloat(e.x),this.writeFloat(e.y),this.writeFloat(e.z),this.writeFloat(e.w)}writeRGBColor(e){this.writeFloat(e.r),this.writeFloat(e.g),this.writeFloat(e.b)}writeArray(e){for(let t=0;t<e.length;t++){const a=e[t];this.writeFloat(a)}}writeFloat32Array(e){new Float32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeInt8Array(e){new Int8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeInt16Array(e){new Int16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeInt32Array(e){new Int32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeUint8Array(e){new Uint8Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeUint16Array(e){new Uint16Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}writeUint32Array(e){new Uint32Array(this.dataBytes.buffer,this.dataBytes.byteOffset+this.offset).set(e),this.offset+=e.byteLength}reset(){this.offset=0}destroy(){this.byteOffset=null,this.byteSize=null,this.offset=null,this.dataBytes=null}}class cr{shareDataBuffer;_byteOffset=0;allocation(e){this.shareDataBuffer&&this.shareDataBuffer.byteLength<e?this._byteOffset=0:this.shareDataBuffer=new ArrayBuffer(e)}allocation_node(e){if(this._byteOffset+e>this.shareDataBuffer.byteLength)return console.error("memory not enough!",this._byteOffset,e,this.shareDataBuffer.byteLength),null;let t=new Il;return t.byteOffset=this._byteOffset,t.byteSize=e,t.dataBytes=new DataView(this.shareDataBuffer,this._byteOffset,t.byteSize),this._byteOffset+=t.byteSize,t}allocation_memory(e){return this._byteOffset+e.byteSize>this.shareDataBuffer.byteLength?(console.error("memory not enough!",this._byteOffset,e.byteSize,this.shareDataBuffer.byteLength),null):(e.byteOffset=this._byteOffset,e.dataBytes=new DataView(this.shareDataBuffer,this._byteOffset,e.byteSize),this._byteOffset+=e.byteSize,e)}reset(){this._byteOffset=0}destroy(e){this.shareDataBuffer=null,this._byteOffset=0}}class Ya{bufferType;buffer;memory;memoryNodes;seek;outFloat32Array;byteSize;usage;visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE;mapAsyncBuffersOutstanding=0;mapAsyncReady;_readBuffer;_dataView;constructor(){this.mapAsyncReady=[]}debug(){}reset(e=!1,t=0,a){this.seek=0,this.memory.reset(),e&&this.createBuffer(this.usage,t,a)}setBoolean(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setX(t?1:0)}readBoole(e){let t=this.memoryNodes.get(e);return t?t.getFloat()!=0:null}setFloat(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setX(t)}getFloat(e){let t=this.memoryNodes.get(e);return t?t.getFloat():null}setInt8(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(1),this.memoryNodes.set(e,a)),a.setInt8(t)}getInt8(e){let t=this.memoryNodes.get(e);return t?t.getInt8():null}setInt16(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(2),this.memoryNodes.set(e,a)),a.setInt16(t)}getInt16(e){let t=this.memoryNodes.get(e);return t?t.getInt16():null}setInt32(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setInt32(t)}getInt32(e){let t=this.memoryNodes.get(e);return t?t.getInt32():null}setUint8(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(1),this.memoryNodes.set(e,a)),a.setUint8(t)}getUint8(e){let t=this.memoryNodes.get(e);return t?t.getUint8():null}setUint16(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(2),this.memoryNodes.set(e,a)),a.setUint16(t)}getUint16(e){let t=this.memoryNodes.get(e);return t?t.getUint16():null}setUint32(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(4),this.memoryNodes.set(e,a)),a.setUint32(t)}getUint32(e){let t=this.memoryNodes.get(e);return t?t.getUint32():null}setVector2(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(8),this.memoryNodes.set(e,a)),a.setXY(t.x,t.y)}getVector2(e){let t=this.memoryNodes.get(e);return t?new de(t.x,t.y):null}setVector3(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(12),this.memoryNodes.set(e,a)),a.setXYZ(t.x,t.y,t.z)}getVector3(e){let t=this.memoryNodes.get(e);return t?new b(t.x,t.y,t.z):null}setVector4(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16),this.memoryNodes.set(e,a)),a.setXYZW(t.x,t.y,t.z,t.w)}getVector4(e){let t=this.memoryNodes.get(e);return t?new be(t.x,t.y,t.z,t.w):null}setVector4Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16*t.length),this.memoryNodes.set(e,a)),a.setVector4Array(t)}setColor(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16),this.memoryNodes.set(e,a)),a.setXYZW(t.r,t.g,t.b,t.a)}getColor(e){let t=this.memoryNodes.get(e);return t?new J(t.x,t.y,t.z,t.w):null}setColorArray(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(16*t.length),this.memoryNodes.set(e,a)),a.setColorArray(t)}setMatrix(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(64),this.memoryNodes.set(e,a)),a.setFloatArray(0,t.rawData)}setMatrixArray(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(64*t.length),this.memoryNodes.set(e,a));for(let r=0;r<t.length;r++){const i=t[r];a.setFloatArray(r*16,i.rawData)}}setArray(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setArray(0,t)}setFloat32Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setFloat32Array(0,t)}setInt32Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setInt32Array(0,t)}setUint32Array(e,t){let a=this.memoryNodes.get(e);a||(a=this.memory.allocation_node(t.length*4),this.memoryNodes.set(e,a)),a.setUint32Array(0,t)}setStruct(e,t,a,r){let i=vi.Ref(e);vi.GetSize(e);let n=t,o=this.memoryNodes.get(n);o.reset();let l=a;r&&(l=l[r]);for(let c=0;c<i.length;c++){const f=i[c];let d=l[f.name];this.writeValue(o,f,d)}}writeValue(e,t,a){switch(t.type){case"Boolean":e.writeFloat(a);break;case"Number":e.writeFloat(a);break;case"Float32Array":e.writeFloat32Array(a);break;case"Float64Array":e.writeFloat32Array(new Float32Array(a));break;case"Vector2":e.writeVector2(a);break;case"Vector3":e.writeVector3(a);break;case"Vector4":e.writeVector4(a);break;case"Color":e.writeRGBColor(a);break;case"Array":e.writeArray(a);break}}setStructArray(e,t,a){let r=t.length;for(let i=0;i<r;i++){const n=t[i];this.setStruct(e,i,n,a)}}clean(){this._dataView.fill(0,0,this._dataView.length)}apply(){I.device.queue.writeBuffer(this.buffer,0,this.memory.shareDataBuffer)}mapAsyncWrite(e,t){let a;e instanceof Float64Array?a=new Float32Array(e):a=e;let r=I.device;if(a.length>0){let i=null;for(;this.mapAsyncReady.length&&(i=this.mapAsyncReady.shift(),i.usedSize!=a.byteLength);)i.destroy(),this.mapAsyncBuffersOutstanding--,i=null;i||(i=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,mappedAtCreation:!0}),i.usedSize=a.byteLength,this.mapAsyncBuffersOutstanding++,this.mapAsyncBuffersOutstanding>20&&console.warn(` Warning: mapAsync requests from ${this.mapAsyncBuffersOutstanding} frames ago have not resolved yet. MB of staging buffers allocated.`));let n=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(n),i.unmap();const l=r.createCommandEncoder();l.copyBufferToBuffer(i,0,this.buffer,0,t*4),r.queue.submit([l.finish()]),i.mapAsync(GPUMapMode.WRITE).then(()=>this.mapAsyncReady.push(i))}}destroy(e){this.memoryNodes&&this.memoryNodes.forEach(t=>{t.destroy()}),this.bufferType=null,this.seek=null,this.byteSize=null,this.usage=null,this.visibility=null,this.outFloat32Array=null,this.buffer&&this.buffer.destroy(),this.buffer=null,this.memory&&this.memory.destroy(),this.memory=null,this._readBuffer&&this._readBuffer.destroy()}createBuffer(e,t,a,r){let i=I.device;if(this.buffer&&this.destroy(),this.byteSize=t*4,this.usage=e,this.buffer=i.createBuffer({label:r,size:this.byteSize,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this._dataView=new Float32Array(this.memory.shareDataBuffer),this.memory.allocation(this.byteSize),a){let n=this.memory.allocation_node(a.length*4);const o=a.buffer instanceof ArrayBuffer?a.buffer:new Uint8Array(a.buffer).buffer;n.setArrayBuffer(0,o),this.apply()}}resizeBuffer(e,t){this.createBuffer(this.usage,e,t)}createNewBuffer(e,t){let a=I.device,r=t*4,i=e;return this.buffer&&this.destroy(),a.createBuffer({size:r,usage:i,mappedAtCreation:!1})}createBufferByStruct(e,t,a){let r=vi.GetSize(t),i=r*a,n=I.device;this.buffer=n.createBuffer({label:"StructStorageGPUBuffer",size:i,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this._dataView=new Float32Array(this.memory.shareDataBuffer),this.memory.allocation(i);for(let o=0;o<a;o++){let l=o,c=this.memoryNodes.get(l);c||(c=this.memory.allocation_node(r),this.memoryNodes.set(l,c))}}readBuffer(e=!1){this.outFloat32Array||=new Float32Array(this.memory.shareDataBuffer.byteLength/4),this._readBuffer||(this._readBuffer=I.device.createBuffer({size:this.memory.shareDataBuffer.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}));let t=this.read();return e?t:this.outFloat32Array}_readFlag=!1;async read(){if(!this._readFlag){this._readFlag=!0;let e=I.device.createCommandEncoder();e.copyBufferToBuffer(this.buffer,0,this._readBuffer,0,this.memory.shareDataBuffer.byteLength),I.device.queue.submit([e.finish()]),await this._readBuffer.mapAsync(GPUMapMode.READ);const t=this._readBuffer.getMappedRange();this.outFloat32Array.set(new Float32Array(t),0),this._readBuffer.unmap(),this._readFlag=!1}return this.outFloat32Array}}var Aa=(s=>(s[s.IndicesGPUBuffer=0]="IndicesGPUBuffer",s[s.VertexGPUBuffer=1]="VertexGPUBuffer",s[s.UniformGPUBuffer=2]="UniformGPUBuffer",s[s.StorageGPUBuffer=3]="StorageGPUBuffer",s[s.ComputeGPUBuffer=4]="ComputeGPUBuffer",s[s.MaterialDataUniformGPUBuffer=5]="MaterialDataUniformGPUBuffer",s[s.StructStorageGPUBuffer=6]="StructStorageGPUBuffer",s))(Aa||{});class Pe extends Ya{constructor(e,t=0,a){super(),this.bufferType=Aa.StorageGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"StorageGPUBuffer")}}class Ct extends Ya{constructor(e,t){super(),this.bufferType=Aa.UniformGPUBuffer,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,e,t,"UniformGPUBuffer")}genUniformNodes(){}}class Ht{static getMorphTargetShaderBinding(e,t){return`
|
|
2
2
|
fn blendMorphTargetPosition(vertexID:i32, posIn:vec3<f32>) -> vec3<f32>{
|
|
3
3
|
let offset:i32 = vertexID * 3;
|
|
4
4
|
var pos = posIn * morphTargetConfig:morphBaseInfluence;
|
|
@@ -87,7 +87,7 @@ class J{static COLOR_RED=new J(1,0,0,1);static COLOR_GREEN=new J(0,1,0,1);static
|
|
|
87
87
|
#endif
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`}let zt=function(s=16,e=16){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[],r;if(e=e||t.length,s)for(r=0;r<s;r++)a[r]=t[0|Math.random()*e];else{var i;for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",r=0;r<36;r++)a[r]||(i=0|Math.random()*16,a[r]=t[r==19?i&3|8:i])}return a.join("")},Rl=1e6,yn=function(){return Rl++,Rl},Ju=function(s,e){let t=0,a=s.length;for(t=0;t<a;t++)if(s[t]==e)return!0;return!1},ju=function(s,e){let t=0,a=s.length;for(t=0;t<a;t++)if(s[t]==e)return t;return-1},Cs=(...s)=>function(...e){s.forEach(t=>t.apply(this,e))};var St=(s=>(s[s.Number=0]="Number",s[s.Vector2=1]="Vector2",s[s.Vector3=2]="Vector3",s[s.Vector4=3]="Vector4",s[s.Color=4]="Color",s[s.Float32Array=5]="Float32Array",s))(St||{});class fr{size;memoryInfo;bindOnChange;_data;_type=St.Number;_x=0;_y=0;_z=0;_w=0;constructor(e){this.data=e}get data(){return this._data}set data(e){this._data=e,this._type=St.Number,e instanceof de?(this.size=2,this._x=e.x,this._y=e.y,this._type=St.Vector2):e instanceof b?(this.size=3,this._x=e.x,this._y=e.y,this._z=e.z,this._type=St.Vector3):e instanceof be?(this.size=4,this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._type=St.Vector4):e instanceof J?(this.size=4,this._x=e.r,this._y=e.g,this._z=e.b,this._w=e.a,this._type=St.Color):e instanceof Float32Array?(this.size=e.length,this._type=St.Float32Array):(this.size=1,this._x=e,this._data=e,this._type=St.Number)}getColor(e){return e?e.copyFrom(this._data):e=this._data,e}get color(){return new J(this._data.r,this._data.g,this._data.b,this._data.a)}set color(e){(this._x!=e.r||this._y!=e.g||this._z!=e.b||this._w!=e.a)&&(this._data.r=e.r,this._data.g=e.g,this._data.b=e.b,this._data.a=e.a,this._x=e.r,this._y=e.g,this._z=e.b,this._w=e.a,this.onChange())}get value(){return this._x}set value(e){this._x!=e&&(this._data=e,this._x=e,this.onChange())}get vector2(){return this._data}set vector2(e){(this._x!=e.x||this._y!=e.y)&&(this._data.x=e.x,this._data.y=e.y,this._x=e.x,this._y=e.y,this.onChange())}get vector3(){return this._data}set vector3(e){(this._x!=e.x||this._y!=e.y||this._z!=e.z)&&(this._data.x=e.x,this._data.y=e.y,this._data.z=e.z,this._x=e.x,this._y=e.y,this._z=e.z,this.onChange())}get vector4(){return this._data}set vector4(e){(this._x!=e.x||this._y!=e.y||this._z!=e.z||this._w!=e.w)&&(this._data.x=e.x,this._data.y=e.y,this._data.z=e.z,this._data.w=e.w,this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChange())}onChange(){this.bindOnChange&&this.bindOnChange()}float32Array(e){this._data.set(e),this.onChange()}update(){switch(this._type){case St.Number:this.memoryInfo.dataBytes.setFloat32(0*Float32Array.BYTES_PER_ELEMENT,this._data,!0);break;case St.Vector2:this.memoryInfo.setVector2(0,this._data);break;case St.Vector3:this.memoryInfo.setVector3(0,this._data);break;case St.Vector4:this.memoryInfo.setVector4(0,this._data);break;case St.Color:this.memoryInfo.setColor(0,this._data);break;case St.Float32Array:this.memoryInfo.setFloat32Array(0,this._data);break}}}class Cn{instanceID;shaderVariant;vsEntryPoint="main";fsEntryPoint="main";bindGroups;shaderReflection;defineValue;constValues;uniforms;materialDataUniformBuffer;_bufferDic;_shaderChange=!0;_valueChange=!1;constructor(){this.instanceID=zt(),this.defineValue={},this.constValues={},this.uniforms={},this._bufferDic=new Map}noticeShaderChange(){this._shaderChange=!0}noticeValueChange(){this._valueChange=!0}setStorageBuffer(e,t){this._bufferDic.has(e)?this._bufferDic.set(e,t):(this._bufferDic.set(e,t),this.noticeBufferChange(e))}setStructStorageBuffer(e,t){this._bufferDic.has(e)?(this._bufferDic.set(e,t),this.noticeBufferChange(e)):this._bufferDic.set(e,t)}setUniformBuffer(e,t){this._bufferDic.has(e)?(this._bufferDic.set(e,t),this.noticeBufferChange(e)):this._bufferDic.set(e,t)}setDefine(e,t){(this.defineValue[e]==null||this.defineValue[e]!=t)&&(this.defineValue[e]=t,this.noticeValueChange(),this.noticeShaderChange()),this.defineValue[e]=t}hasDefine(e){return this.defineValue[e]!=null}deleteDefine(e){delete this.defineValue[e],this.noticeShaderChange()}setUniformFloat(e,t){this.uniforms[e]?this.uniforms[e].value=t:(this.uniforms[e]=new fr(t),this.noticeValueChange())}setUniformVector2(e,t){this.uniforms[e]?this.uniforms[e].vector2=t:(this.uniforms[e]=new fr(t),this.noticeValueChange())}setUniformVector3(e,t){this.uniforms[e]?this.uniforms[e].vector3=t:this.uniforms[e]=new fr(t)}setUniformVector4(e,t){this.uniforms[e]?this.uniforms[e].vector4=t:this.uniforms[e]=new fr(t)}setUniformColor(e,t){this.uniforms[e]?this.uniforms[e].color=t:this.uniforms[e]=new fr(t)}setUniformArray(e,t){this.uniforms[e]?this.uniforms[e].float32Array(t):this.uniforms[e]=new fr(t)}setUniform(e,t){this.uniforms[e]?this.uniforms[e].data=t:this.uniforms[e]=new fr(t)}getUniform(e){return this.uniforms[e].data}getUniformFloat(e){return this.uniforms[e].data}getUniformVector2(e){return this.uniforms[e].data}getUniformVector3(e){return this.uniforms[e].data}getUniformVector4(e){return this.uniforms[e].data}getUniformColor(e){return this.uniforms[e].color}getBuffer(e){return this._bufferDic[e].data}noticeBufferChange(e){}applyUniform(){this.materialDataUniformBuffer&&this._valueChange&&this.materialDataUniformBuffer.apply()}destroy(e){}}var dr=(s=>(s[s.u32=1]="u32",s[s.f32=1]="f32",s[s["vec2<f32>"]=2]="vec2<f32>",s[s["vec3<f32>"]=3]="vec3<f32>",s[s["vec4<f32>"]=4]="vec4<f32>",s[s.float32=1]="float32",s[s.float32x2=2]="float32x2",s[s.float32x3=3]="float32x3",s[s.float32x4=4]="float32x4",s))(dr||{});let Kt={clamp_to_edge:"clamp-to-edge",repeat:"repeat",mirror_repeat:"mirror-repeat"},Zu={zero:"zero",one:"one",src:"src",one_minus_src:"one-minus-src",src_alpha:"src-alpha",one_minus_src_alpha:"one-minus-src-alpha",dst:"dst",one_minus_dst:"one-minus-dst",dst_alpha:"dst-alpha",one_minus_dst_alpha:"one-minus-dst-alpha",src_alpha_saturated:"src-alpha-saturated",constant:"constant",one_minus_constant:"one-minus-constant"};const Yu={srcFactor:"one",dstFactor:"zero",operation:"add"},Xu={compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"};let
|
|
90
|
+
`}let zt=function(s=16,e=16){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[],r;if(e=e||t.length,s)for(r=0;r<s;r++)a[r]=t[0|Math.random()*e];else{var i;for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",r=0;r<36;r++)a[r]||(i=0|Math.random()*16,a[r]=t[r==19?i&3|8:i])}return a.join("")},Rl=1e6,yn=function(){return Rl++,Rl},Ju=function(s,e){let t=0,a=s.length;for(t=0;t<a;t++)if(s[t]==e)return!0;return!1},ju=function(s,e){let t=0,a=s.length;for(t=0;t<a;t++)if(s[t]==e)return t;return-1},Cs=(...s)=>function(...e){s.forEach(t=>t.apply(this,e))};var St=(s=>(s[s.Number=0]="Number",s[s.Vector2=1]="Vector2",s[s.Vector3=2]="Vector3",s[s.Vector4=3]="Vector4",s[s.Color=4]="Color",s[s.Float32Array=5]="Float32Array",s))(St||{});class fr{size;memoryInfo;bindOnChange;_data;_type=St.Number;_x=0;_y=0;_z=0;_w=0;constructor(e){this.data=e}get data(){return this._data}set data(e){this._data=e,this._type=St.Number,e instanceof de?(this.size=2,this._x=e.x,this._y=e.y,this._type=St.Vector2):e instanceof b?(this.size=3,this._x=e.x,this._y=e.y,this._z=e.z,this._type=St.Vector3):e instanceof be?(this.size=4,this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._type=St.Vector4):e instanceof J?(this.size=4,this._x=e.r,this._y=e.g,this._z=e.b,this._w=e.a,this._type=St.Color):e instanceof Float32Array?(this.size=e.length,this._type=St.Float32Array):(this.size=1,this._x=e,this._data=e,this._type=St.Number)}getColor(e){return e?e.copyFrom(this._data):e=this._data,e}get color(){return new J(this._data.r,this._data.g,this._data.b,this._data.a)}set color(e){(this._x!=e.r||this._y!=e.g||this._z!=e.b||this._w!=e.a)&&(this._data.r=e.r,this._data.g=e.g,this._data.b=e.b,this._data.a=e.a,this._x=e.r,this._y=e.g,this._z=e.b,this._w=e.a,this.onChange())}get value(){return this._x}set value(e){this._x!=e&&(this._data=e,this._x=e,this.onChange())}get vector2(){return this._data}set vector2(e){(this._x!=e.x||this._y!=e.y)&&(this._data.x=e.x,this._data.y=e.y,this._x=e.x,this._y=e.y,this.onChange())}get vector3(){return this._data}set vector3(e){(this._x!=e.x||this._y!=e.y||this._z!=e.z)&&(this._data.x=e.x,this._data.y=e.y,this._data.z=e.z,this._x=e.x,this._y=e.y,this._z=e.z,this.onChange())}get vector4(){return this._data}set vector4(e){(this._x!=e.x||this._y!=e.y||this._z!=e.z||this._w!=e.w)&&(this._data.x=e.x,this._data.y=e.y,this._data.z=e.z,this._data.w=e.w,this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChange())}onChange(){this.bindOnChange&&this.bindOnChange()}float32Array(e){this._data.set(e),this.onChange()}update(){switch(this._type){case St.Number:this.memoryInfo.dataBytes.setFloat32(0*Float32Array.BYTES_PER_ELEMENT,this._data,!0);break;case St.Vector2:this.memoryInfo.setVector2(0,this._data);break;case St.Vector3:this.memoryInfo.setVector3(0,this._data);break;case St.Vector4:this.memoryInfo.setVector4(0,this._data);break;case St.Color:this.memoryInfo.setColor(0,this._data);break;case St.Float32Array:this.memoryInfo.setFloat32Array(0,this._data);break}}}class Cn{instanceID;shaderVariant;vsEntryPoint="main";fsEntryPoint="main";bindGroups;shaderReflection;defineValue;constValues;uniforms;materialDataUniformBuffer;_bufferDic;_shaderChange=!0;_valueChange=!1;constructor(){this.instanceID=zt(),this.defineValue={},this.constValues={},this.uniforms={},this._bufferDic=new Map}noticeShaderChange(){this._shaderChange=!0}noticeValueChange(){this._valueChange=!0}setStorageBuffer(e,t){this._bufferDic.has(e)?this._bufferDic.set(e,t):(this._bufferDic.set(e,t),this.noticeBufferChange(e))}setStructStorageBuffer(e,t){this._bufferDic.has(e)?(this._bufferDic.set(e,t),this.noticeBufferChange(e)):this._bufferDic.set(e,t)}setUniformBuffer(e,t){this._bufferDic.has(e)?(this._bufferDic.set(e,t),this.noticeBufferChange(e)):this._bufferDic.set(e,t)}setDefine(e,t){(this.defineValue[e]==null||this.defineValue[e]!=t)&&(this.defineValue[e]=t,this.noticeValueChange(),this.noticeShaderChange()),this.defineValue[e]=t}hasDefine(e){return this.defineValue[e]!=null}deleteDefine(e){delete this.defineValue[e],this.noticeShaderChange()}setUniformFloat(e,t){this.uniforms[e]?this.uniforms[e].value=t:(this.uniforms[e]=new fr(t),this.noticeValueChange())}setUniformVector2(e,t){this.uniforms[e]?this.uniforms[e].vector2=t:(this.uniforms[e]=new fr(t),this.noticeValueChange())}setUniformVector3(e,t){this.uniforms[e]?this.uniforms[e].vector3=t:this.uniforms[e]=new fr(t)}setUniformVector4(e,t){this.uniforms[e]?this.uniforms[e].vector4=t:this.uniforms[e]=new fr(t)}setUniformColor(e,t){this.uniforms[e]?this.uniforms[e].color=t:this.uniforms[e]=new fr(t)}setUniformArray(e,t){this.uniforms[e]?this.uniforms[e].float32Array(t):this.uniforms[e]=new fr(t)}setUniform(e,t){this.uniforms[e]?this.uniforms[e].data=t:this.uniforms[e]=new fr(t)}getUniform(e){return this.uniforms[e].data}getUniformFloat(e){return this.uniforms[e].data}getUniformVector2(e){return this.uniforms[e].data}getUniformVector3(e){return this.uniforms[e].data}getUniformVector4(e){return this.uniforms[e].data}getUniformColor(e){return this.uniforms[e].color}getBuffer(e){return this._bufferDic[e].data}noticeBufferChange(e){}applyUniform(){this.materialDataUniformBuffer&&this._valueChange&&this.materialDataUniformBuffer.apply()}destroy(e){}}var dr=(s=>(s[s.u32=1]="u32",s[s.f32=1]="f32",s[s["vec2<f32>"]=2]="vec2<f32>",s[s["vec3<f32>"]=3]="vec3<f32>",s[s["vec4<f32>"]=4]="vec4<f32>",s[s.float32=1]="float32",s[s.float32x2=2]="float32x2",s[s.float32x3=3]="float32x3",s[s.float32x4=4]="float32x4",s))(dr||{});let Kt={clamp_to_edge:"clamp-to-edge",repeat:"repeat",mirror_repeat:"mirror-repeat"},Zu={zero:"zero",one:"one",src:"src",one_minus_src:"one-minus-src",src_alpha:"src-alpha",one_minus_src_alpha:"one-minus-src-alpha",dst:"dst",one_minus_dst:"one-minus-dst",dst_alpha:"dst-alpha",one_minus_dst_alpha:"one-minus-dst-alpha",src_alpha_saturated:"src-alpha-saturated",constant:"constant",one_minus_constant:"one-minus-constant"};const Yu={srcFactor:"one",dstFactor:"zero",operation:"add"},Xu={compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"};let nt={never:"never",less:"less",equal:"equal",less_equal:"less-equal",greater:"greater",not_equal:"not-equal",greater_equal:"greater-equal",always:"always"},Lt={none:"none",front:"front",back:"back"},hr={nearest:"nearest",linear:"linear"},Ss={point_list:"point-list",line_list:"line-list",line_strip:"line-strip",triangle_list:"triangle-list",triangle_strip:"triangle-strip"},oe={r8unorm:"r8unorm",r8snorm:"r8snorm",r8uint:"r8uint",r8sint:"r8sint",r16uint:"r16uint",r16sint:"r16sint",r16float:"r16float",rg8unorm:"rg8unorm",rg8snorm:"rg8snorm",rg8uint:"rg8uint",rg8sint:"rg8sint",r32uint:"r32uint",r32sint:"r32sint",r32float:"r32float",rg16uint:"rg16uint",rg16sint:"rg16sint",rg16float:"rg16float",rgba8unorm:"rgba8unorm",rgba8unorm_srgb:"rgba8unorm-srgb",rgba8snorm:"rgba8snorm",rgba8uint:"rgba8uint",rgba8sint:"rgba8sint",bgra8unorm:"bgra8unorm",bgra8unorm_srgb:"bgra8unorm-srgb",rgb9e5ufloat:"rgb9e5ufloat",rgb10a2unorm:"rgb10a2unorm",rg11b10ufloat:"rg11b10ufloat",rg32uint:"rg32uint",rg32sint:"rg32sint",rg32float:"rg32float",rgba16uint:"rgba16uint",rgba16sint:"rgba16sint",rgba16float:"rgba16float",rgba32uint:"rgba32uint",rgba32sint:"rgba32sint",rgba32float:"rgba32float",stencil8:"stencil8",depth16unorm:"depth16unorm",depth24plus:"depth24plus",depth24plus_stencil8:"depth24plus-stencil8",depth32float:"depth32float",bc1_rgba_unorm:"bc1-rgba-unorm",bc1_rgba_unorm_srgb:"bc1-rgba-unorm-srgb",bc2_rgba_unorm:"bc2-rgba-unorm",bc2_rgba_unorm_srgb:"bc2-rgba-unorm-srgb",bc3_rgba_unorm:"bc3-rgba-unorm",bc3_rgba_unorm_srgb:"bc3-rgba-unorm-srgb",bc4_r_unorm:"bc4-r-unorm",bc4_r_snorm:"bc4-r-snorm",bc5_rg_unorm:"bc5-rg-unorm",bc5_rg_snorm:"bc5-rg-snorm",bc6h_rgb_ufloat:"bc6h-rgb-ufloat",bc6h_rgb_float:"bc6h-rgb-float",bc7_rgba_unorm:"bc7-rgba-unorm",bc7_rgba_unorm_srgb:"bc7-rgba-unorm-srgb",depth24unorm_stencil8:"depth24unorm-stencil8",depth32float_stencil8:"depth32float-stencil8"},xi={uint8x2:"uint8x2",uint8x4:"uint8x4",sint8x2:"sint8x2",sint8x4:"sint8x4",unorm8x2:"unorm8x2",unorm8x4:"unorm8x4",snorm8x2:"snorm8x2",snorm8x4:"snorm8x4",uint16x2:"uint16x2",uint16x4:"uint16x4",sint16x2:"sint16x2",sint16x4:"sint16x4",unorm16x2:"unorm16x2",unorm16x4:"unorm16x4",snorm16x2:"snorm16x2",snorm16x4:"snorm16x4",float16x2:"float16x2",float16x4:"float16x4",float32:"float32",float32x2:"float32x2",float32x3:"float32x3",float32x4:"float32x4",uint32:"uint32",uint32x2:"uint32x2",uint32x3:"uint32x3",uint32x4:"uint32x4",sint32:"sint32",sint32x2:"sint32x2",sint32x3:"sint32x3",sint32x4:"sint32x4"},Hu={vertex:"vertex",instance:"instance"},Ql=[null,xi.float32,xi.float32x2,xi.float32x3,xi.float32x4],Tl=`
|
|
91
91
|
var<private> colorSet: array<vec3<f32>, 9> = array<vec3<f32>, 9>(
|
|
92
92
|
vec3<f32>(1.0, 0.0, 0.0),
|
|
93
93
|
vec3<f32>(1.0, 0.5, 0.0),
|
|
@@ -5666,7 +5666,7 @@ struct InstanceData {
|
|
|
5666
5666
|
`,""),c=c.replaceAll(" "," "),this.parserAttribute(c,t)}else{var n=r.split(":")[1];n=n.replaceAll(" ",""),n=n.replaceAll(" ",""),n=n.replaceAll(")",""),n=e.split(`struct ${n}`)[1];let l=n.indexOf("{"),c=n.indexOf("}");n=n.slice(l,c),i=n.split("@");for(let f=1;f<i.length;f++){let h=i[f].replace(/\s*$/g,"");h=h.replaceAll(`
|
|
5667
5667
|
`,""),h=h.split(",")[0],h=h.replaceAll(" "," "),this.parserAttribute(h,t)}}return t}static parserVertex(e,t){let a=[],i=t.split(`fn ${e}(`)[1].split("->")[0],n=i.split("@");if(n&&n.length>1)for(let l=1;l<n.length;l++){let f=n[l].replace(/\s*$/g,"");f=f.replaceAll(",",""),f=f.replaceAll(`
|
|
5668
5668
|
`,""),f=f.replaceAll(" "," "),this.parserAttribute(f,a)}else{var o=i.split(":")[1];o=o.replaceAll(" ",""),o=o.replaceAll(" ",""),o=o.replaceAll(")",""),o=t.split(`struct ${o}`)[1];let c=o.indexOf("{"),f=o.indexOf("}");o=o.slice(c,f),n=o.split("@");for(let d=1;d<n.length;d++){let u=n[d].replace(/\s*$/g,"");u=u.replaceAll(`
|
|
5669
|
-
`,""),u=u.split(",")[0],u=u.replaceAll(" "," "),this.parserAttribute(u,a)}}return a}static parserAttribute(e,t){let a={name:"",group:0,location:0,type:"",valueType:"",value:0,size:0,format:"float32"};if(e.indexOf("builtin")!=-1){a.type="builtin";var r=e.match(/\((.+?)\)/g)[0];r=e.match(/\((.+?)\)/g)[0],r=r.replace("(",""),r=r.replaceAll(")",""),a.location=parseInt(r);let i=e.split(":");a.name=i[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=i[1],a.valueType=a.valueType.replaceAll(" "," "),a.valueType=a.valueType.replaceAll(" ",""),a.valueType=a.valueType.replaceAll("\r",""),a.valueType=a.valueType.replaceAll(")",""),a.valueType=a.valueType.replaceAll(")",""),a.size=dr[a.valueType],t.push(a)}else if(e.indexOf("location")!=-1){a.type="location";var r=e.match(/\((.+?)\)/g)[0];r=e.match(/\((.+?)\)/g)[0],r=r.replace("(",""),r=r.replaceAll(")",""),a.location=parseInt(r);let n=e.split(":");a.name=n[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=n[1],a.valueType=a.valueType.replaceAll(" "," "),a.valueType=a.valueType.replaceAll(" ",""),a.valueType=a.valueType.replaceAll("\r",""),a.valueType=a.valueType.replaceAll(")",""),a.valueType=a.valueType.replaceAll(")",""),a.size=dr[a.valueType],t.push(a)}a.format=Ql[dr[a.valueType]]}}class Fe extends Cn{entryPoint="CsMain";workerSizeX=1;workerSizeY=0;workerSizeZ=0;_computePipeline;_csShaderModule;_destCS;_sourceCS;_storageTextureDic;_sampleTextureDic;_groupsShaderReflectionVarInfos;_groupCache={};constructor(e){super(),this._sourceCS=e,Tt.getShaderReflection2(e,this),this._storageTextureDic=new Map,this._sampleTextureDic=new Map}setStorageTexture(e,t){this._storageTextureDic.has(e)||this._storageTextureDic.set(e,t)}setSamplerTexture(e,t){this._sampleTextureDic.set(e,t)}compute(e){this._computePipeline||this.genComputePipeline(),e.setPipeline(this._computePipeline);for(let t=0;t<this.bindGroups.length;++t)e.setBindGroup(t,this.bindGroups[t]);this.workerSizeX&&this.workerSizeY&&this.workerSizeZ?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY,this.workerSizeZ):this.workerSizeX&&this.workerSizeY?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY):e.dispatchWorkgroups(this.workerSizeX)}createBufferBindGroup(e,t,a,r){let i=this._bufferDic.get(t);if(i){let n={binding:a,resource:{buffer:i.buffer,offset:0,size:i.memory.shareDataBuffer.byteLength}};r.push(n)}else console.error(`ComputeShader(${this.instanceID})`,`buffer ${t} is missing!`)}noticeBufferChange(e){let t=this._groupCache[e];t&&this.genGroups(t.groupIndex,t.infos,!0)}genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;++o){const l=r[o];if(l)switch(l.varType){case"uniform":case"storage-read":case"storage-read_write":this.createBufferBindGroup(e,l.varName,l.binding,i),this._groupCache[l.varName]={groupIndex:e,infos:t};break;case"var":if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType.indexOf("texture_storage")!=-1){let c=this._storageTextureDic.get(l.varName);if(c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f),ke.getInstance().attached(c,this)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType.indexOf("texture")!=-1){let c=this._sampleTextureDic.get(l.varName);if(c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f),ke.getInstance().attached(c,this)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}break;default:console.error("unprocessed type:",l.varType);break}}let n=I.device.createBindGroup({layout:this._computePipeline.getBindGroupLayout(e),entries:i});this.bindGroups[e]=n}}genComputePipeline(){this.preCompileShader(this._sourceCS),this.genReflection(),this._computePipeline=I.device.createComputePipeline({layout:"auto",compute:{module:this.compileShader(),entryPoint:this.entryPoint}}),this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroups=[];for(let t=0;t<e.groups.length;++t){let a=e.groups[t];this._groupsShaderReflectionVarInfos[t]=a,this.genGroups(t,this._groupsShaderReflectionVarInfos)}I.addEventListener(lr.RESIZE,t=>{for(let a=0;a<e.groups.length;++a){let r=e.groups[a];this._groupsShaderReflectionVarInfos[a]=r,this.genGroups(a,this._groupsShaderReflectionVarInfos,!0)}},this)}preCompileShader(e){for(const t in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,t)){const a=this.constValues[t];e=e.replaceAll(`&${t}`,a.toString())}this._destCS=Da.parseComputeShader(e,this.defineValue)}compileShader(){let e=I.device.createShaderModule({label:`ComputeShader(${this.instanceID})`,code:this._destCS});return e.getCompilationInfo().then(t=>{t.messages.length>0&&console.warn("[shader error]",t,this._destCS)}),this._csShaderModule=e,e}genReflection(){this.shaderVariant+=Tt.genComputeShaderVariant(this);let e=Tt.poolGetReflection(this.shaderVariant);e?this.shaderReflection=e:(Tt.getShaderReflection2(this._destCS,this),Tt.combineShaderReflectionVarInfo(this.shaderReflection,this.shaderReflection.cs_variables))}}var fe=(s=>(s[s.COLOR=1]="COLOR",s[s.REFLECTION=2]="REFLECTION",s[s.POSITION=4]="POSITION",s[s.GRAPHIC=8]="GRAPHIC",s[s.GI=16]="GI",s[s.Cluster=32]="Cluster",s[s.SHADOW=64]="SHADOW",s[s.POINT_SHADOW=128]="POINT_SHADOW",s[s.POST=256]="POST",s[s.DEPTH=512]="DEPTH",s[s.UI=1024]="UI",s))(fe||{});class dt{static profilerLabelMap=new Map;static viewMap=new Map;static testObj={testValue1:0,testValue2:0,testValue3:0,testValue4:0};static startView(e){let t=this.viewMap.get(e);if(!t){t={};for(const a in fe)parseInt(a)>=0||(t[a]={vertexCount:0,indicesCount:0,instanceCount:0,triCount:0,drawCount:0,pipelineCount:0});this.viewMap.set(e,t)}for(const a in fe)parseInt(a)>=0||(t[a].vertexCount=0,t[a].indicesCount=0,t[a].triCount=0,t[a].instanceCount=0,t[a].drawCount=0,t[a].pipelineCount=0)}static viewCount(e){return this.startView(e),this.viewMap.get(e)}static viewCount_vertex(e,t,a){this.viewMap.get(e)[t].vertexCount+=a}static viewCount_indices(e,t,a){this.viewMap.get(e)[t].indicesCount+=a}static viewCount_tri(e,t,a){this.viewMap.get(e)[t].triCount+=a}static viewCount_instance(e,t,a){this.viewMap.get(e)[t].instanceCount+=a}static viewCount_draw(e,t){this.viewMap.get(e)[t].drawCount++}static viewCount_pipeline(e,t){this.viewMap.get(e)[t].pipelineCount++}static start(e){let t=this.profilerLabelMap.get(e);t||(t={lable:e,start:0,end:0,total:0,count:0,child:new Map},this.profilerLabelMap.set(e,t)),t.start=performance.now(),t.end=performance.now(),t.count=0,t.child.clear()}static end(e){let t=this.profilerLabelMap.get(e);t&&(t.end=performance.now(),t.total=t.end-t.start)}static countStart(e,t=""){let a=this.profilerLabelMap.get(e);if(a&&(a.count++,t!="")){let r=a.child.get(t);r||(r={lable:t,start:0,end:0,total:0,count:0}),r.start=performance.now(),r.end=performance.now(),r.count=0,a.child.set(t,r)}}static countEnd(e,t){let a=this.profilerLabelMap.get(e);if(a&&t!=""){let r=a.child.get(t);r||(r={lable:t,start:0,end:0,total:0,count:0}),r.end=performance.now(),r.total=r.end-r.start,r.count++}}static print(e){let t=this.profilerLabelMap.get(e);t&&console.log("performance",e,t.total+" ms")}}var qu=(()=>{var s=import.meta.url;return(async function(e={}){var t=e,a,r;t.ready=new Promise((V,L)=>{a=V,r=L});var i=Object.assign({},t),n=[],o="./this.program",l=(V,L)=>{throw L},c=typeof window=="object",f=typeof importScripts=="function",d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function u(V){return t.locateFile?t.locateFile(V,h):h+V}var m,g;if(d){const{createRequire:V}=await Promise.resolve().then(()=>Hm);var p=V(import.meta.url),D=p("fs"),A=p("path");f?h=A.dirname(h)+"/":h=p("url").fileURLToPath(new URL("data:text/javascript;base64,DQp2YXIgTW9kdWxlID0gKCgpID0+IHsNCiAgdmFyIF9zY3JpcHREaXIgPSBpbXBvcnQubWV0YS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uO2NhbGxlZFJ1bj10cnVlO01vZHVsZVsiY2FsbGVkUnVuIl09dHJ1ZTtpZihBQk9SVClyZXR1cm47aW5pdFJ1bnRpbWUoKTtwcmVNYWluKCk7cmVhZHlQcm9taXNlUmVzb2x2ZShNb2R1bGUpO2lmKE1vZHVsZVsib25SdW50aW1lSW5pdGlhbGl6ZWQiXSlNb2R1bGVbIm9uUnVudGltZUluaXRpYWxpemVkIl0oKTtpZihzaG91bGRSdW5Ob3cpY2FsbE1haW4oYXJncyk7cG9zdFJ1bigpfWlmKE1vZHVsZVsic2V0U3RhdHVzIl0pe01vZHVsZVsic2V0U3RhdHVzIl0oIlJ1bm5pbmcuLi4iKTtzZXRUaW1lb3V0KGZ1bmN0aW9uKCl7c2V0VGltZW91dChmdW5jdGlvbigpe01vZHVsZVsic2V0U3RhdHVzIl0oIiIpfSwxKTtkb1J1bigpfSwxKX1lbHNle2RvUnVuKCl9fWlmKE1vZHVsZVsicHJlSW5pdCJdKXtpZih0eXBlb2YgTW9kdWxlWyJwcmVJbml0Il09PSJmdW5jdGlvbiIpTW9kdWxlWyJwcmVJbml0Il09W01vZHVsZVsicHJlSW5pdCJdXTt3aGlsZShNb2R1bGVbInByZUluaXQiXS5sZW5ndGg+MCl7TW9kdWxlWyJwcmVJbml0Il0ucG9wKCkoKX19dmFyIHNob3VsZFJ1bk5vdz10cnVlO2lmKE1vZHVsZVsibm9Jbml0aWFsUnVuIl0pc2hvdWxkUnVuTm93PWZhbHNlO3J1bigpOw0KDQoNCiAgcmV0dXJuIG1vZHVsZUFyZy5yZWFkeQ0KfQ0KKTsNCn0pKCk7DQpleHBvcnQgZGVmYXVsdCBNb2R1bGU7",import.meta.url)),m=(L,te)=>(L=ge(L)?new URL(L):A.normalize(L),D.readFileSync(L,te?void 0:"utf8")),g=L=>{var te=m(L,!0);return te.buffer||(te=new Uint8Array(te)),te},!t.thisProgram&&process.argv.length>1&&(o=process.argv[1].replace(/\\/g,"/")),n=process.argv.slice(2),l=(L,te)=>{throw process.exitCode=L,te}}else(c||f)&&(f?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),s&&(h=s),h.startsWith("blob:")?h="":h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1),m=V=>{var L=new XMLHttpRequest;return L.open("GET",V,!1),L.send(null),L.responseText},f&&(g=V=>{var L=new XMLHttpRequest;return L.open("GET",V,!1),L.responseType="arraybuffer",L.send(null),new Uint8Array(L.response)}));var B=t.print||console.log.bind(console),v=t.printErr||console.error.bind(console);Object.assign(t,i),i=null,t.arguments&&(n=t.arguments),t.thisProgram&&(o=t.thisProgram),t.quit&&(l=t.quit);var U;t.wasmBinary&&(U=t.wasmBinary);function y(V){if(typeof d<"u"&&d){var L=Buffer.from(V,"base64");return new Uint8Array(L.buffer,L.byteOffset,L.length)}for(var te=atob(V),Ee=new Uint8Array(te.length),Ye=0;Ye<te.length;++Ye)Ee[Ye]=te.charCodeAt(Ye);return Ee}function S(V){if(le(V))return y(V.slice(ie.length))}var F,C=!1,w,E,Q,T;function j(){var V=F.buffer;t.HEAP8=E=new Int8Array(V),t.HEAP16=new Int16Array(V),t.HEAPU8=Q=new Uint8Array(V),t.HEAPU16=new Uint16Array(V),t.HEAP32=new Int32Array(V),t.HEAPU32=T=new Uint32Array(V),t.HEAPF32=new Float32Array(V),t.HEAPF64=new Float64Array(V)}var ue=[],ee=[],N=[],M=[];function O(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)K(t.preRun.shift());ct(ue)}function W(){ct(ee)}function ae(){ct(N)}function z(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)re(t.postRun.shift());ct(M)}function K(V){ue.unshift(V)}function $(V){ee.unshift(V)}function re(V){M.unshift(V)}var ce=0,Ae=null;function Qe(V){ce++,t.monitorRunDependencies?.(ce)}function Ve(V){if(ce--,t.monitorRunDependencies?.(ce),ce==0&&Ae){var L=Ae;Ae=null,L()}}function H(V){t.onAbort?.(V),V="Aborted("+V+")",v(V),C=!0,w=1,V+=". Build with -sASSERTIONS for more info.";var L=new WebAssembly.RuntimeError(V);throw r(L),L}var ie="data:application/octet-stream;base64,",le=V=>V.startsWith(ie),ge=V=>V.startsWith("file://"),Ie;Ie="data:application/octet-stream;base64,AGFzbQEAAAABpAEaYAF/AX9gAn9/AGADf39/AX9gA39/fwBgAX8AYAAAYAV/f39/fwBgBH9/f38AYAJ/fwF/YAZ/f39/f38AYAABf2AEf39/fQBgBH9/f38Bf2ABfAF9YAJ8fwF8YAF9AX1gAXwBfGACfn8Bf2ADfHx/AXxgAnx8AXxgBn98f39/fwF/YAJ9fwF/YAJ8fwF/YAV/f39/fwF/YAN/fn8BfmADf399AAIfBQFhAWEADAFhAWIAAwFhAWMABQFhAWQAAAFhAWUAAwNYVwMGAg0NAgAEABEEEhMFBQ4CBA8QAgAPEAUEAAcDCAAAAAgUAwAMDgAEBBUWFwEIAQgBAAAAAAEBBAAAAAAACgAJCQYGBwcKAgoKGAACBAsBAwsBAwgZAwQFAXABLCwFBwEBggKAgAIGCAF/AUHwuAQLBzkOAWYCAAFnAB0BaABbAWkAUgFqAE4BawBNAWwASwFtAEMBbgA9AW8AWgFwAFkBcQEAAXIAPgFzAEQJMQEAQQELKyMfWDY6OTg3V1ZVMjo5ODdUU1BRTycjDy0tTEVHSg9GSEkPQQ9AD0IePx4KivsBVxcAIAAtAABBIHFFBEAgASACIAAQGRoLC2sBAX8jAEGAAmsiBSQAAkAgAiADTA0AIARBgMAEcQ0AIAUgASACIANrIgNBgAIgA0GAAkkiARsQBxogAUUEQANAIAAgBUGAAhAFIANBgAJrIgNB/wFLDQALCyAAIAUgAxAFCyAFQYACaiQAC/ICAgJ/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQ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2iIAsgE6IgDCAIoiAPIAaioKCgOQNoIAMgISANoiAiIBOiICMgCKIgJCAGoqCgoDkDYCADIBQgHaIgDiAeoiAKIB+iIAcgIKKgoKA5A1ggAyAQIB2iIAkgHqIgESAfoiASICCioKCgOQNQIAMgJSAdoiALIB6iIAwgH6IgDyAgoqCgoDkDSCADICEgHaIgIiAeoiAjIB+iICQgIKKgoKA5A0AgAyAUIBmiIA4gGqIgCiAboiAHIByioKCgOQM4IAMgECAZoiAJIBqiIBEgG6IgEiAcoqCgoDkDMCADICUgGaIgCyAaoiAMIBuiIA8gHKKgoKA5AyggAyAhIBmiICIgGqIgIyAboiAkIByioKCgOQMgIAMgFCAVoiAOIBaiIAogF6IgGCAHoqCgoDkDGCADIBAgFaIgCSAWoiARIBeiIBggEqKgoKA5AxAgAyAlIBWiIAsgFqIgDCAXoiAYIA+ioKCgOQMIIAMgISAVoiAiIBaiICMgF6IgJCAYoqCgoDkDACACIANBgAEQFRoLIAVBADYCAAsgA0GAAWokACACC4gLAQd/AkAgASAAKAIMIgQgACgCCCIDa0EHdSICRg0AAkAgASACSwRAIAEgAmsiBiAAKAIQIgUgBCIDa0EHdU0EQAJAIAZFDQAgAyECIAZBA3EiBQRAQQAhBANAIAJBCGpBAEHwABAHGiACQoCAgICAgID4PzcDeCACQoCAgICAgID4PzcDUCACQoCAgICAgID4PzcDKCACQoCAgICAgID4PzcDACACQYABaiECIARBAWoiBCAFRw0ACwsgBkEHdCADaiEDIAZBAWtB////D3FBA0kNAANAIAJBCGpBAEHwABAHGiACQoCAgICAgID4PzcDeCACQoCAgICAgID4PzcDUCACQoCAgICAgID4PzcDKCACQoCAgICAgID4PzcDACACQYgBakEAQfAAEAcaIAJCgICAgICAgPg/NwP4ASACQoCAgICAgID4PzcD0AEgAkKAgICAgICA+D83A6gBIAJCgICAgICAgPg/NwOAASACQYgCakEAQfAAEAcaIAJCgICAgICAgPg/NwP4AiACQoCAgICAgID4PzcD0AIgAkKAgICAgICA+D83A6gCIAJCgICAgICAgPg/NwOAAiACQYgDakEAQfAAEAcaIAJCgICAgICAgPg/NwP4AyACQoCAgICAgID4PzcD0AMgAkKAgICAgICA+D83A6gDIAJCgICAgICAgPg/NwOAAyACQYAEaiICIANHDQALCyAAIAM2AgwMAgsCQCADIAAoAggiAmtBB3UiBCAGaiIHQYCAgBBJBEBBACEDQf///w8gBSACayIFQQZ1IgIgByACIAdLGyAFQYD///8HTxsiBwRAIAdBgICAEE8NAiAHQQd0EAshCAsgCCAEQQd0aiIEIQIgBkEDcSIFBEADQCACQQhqQQBB8AAQBxogAkKAgICAgICA+D83A3ggAkKAgICAgICA+D83A1AgAkKAgICAgICA+D83AyggAkKAgICAgICA+D83AwAgAkGAAWohAiADQQFqIgMgBUcNAAsLIAZBB3QgBGohBSAGQQFrQf///w9xQQNPBEADQCACQQhqQQBB8AAQBxogAkKAgICAgICA+D83A3ggAkKAgICAgICA+D83A1AgAkKAgICAgICA+D83AyggAkKAgICAgICA+D83AwAgAkGIAWpBAEHwABAHGiACQoCAgICAgID4PzcD+AEgAkKAgICAgICA+D83A9ABIAJCgICAgICAgPg/NwOoASACQoCAgICAgID4PzcDgAEgAkGIAmpBAEHwABAHGiACQoCAgICAgID4PzcD+AIgAkKAgICAgICA+D83A9ACIAJCgICAgICAgPg/NwOoAiACQoCAgICAgID4PzcDgAIgAkGIA2pBAEHwABAHGiACQoCAgICAgID4PzcD+AMgAkKAgICAgICA+D83A9ADIAJCgICAgICAgPg/NwOoAyACQoCAgICAgID4PzcDgAMgAkGABGoiAiAFRw0ACwsgACgCDCICIAAoAggiA0cEQANAIARBgAFrIgQgAkGAAWsiAkGAARAVGiACIANHDQALIAAoAgghAgsgACAIIAdBB3RqNgIQIAAgBTYCDCAAIAQ2AgggAgRAIAIQFgsMAwsQEwALEBIACyABIAJPDQAgACADIAFBB3RqNgIMCwJAIAAoAhggACgCFCIDa0HIAG0iAiABSQRAIABBFGogASACaxA8DAELIAEgAk8NACAAIAMgAUHIAGxqNgIYCwJAIAAoAiQgACgCICIDa0EEdSICIAFJBEAgAEEgaiABIAJrEDsMAQsgASACTw0AIAAgAyABQQR0ajYCJAsgACgCMCAAKAIsIgNrQcgAbSICIAFJBEAgAEEsaiABIAJrEDwPCyABIAJPDQAgACADIAFByABsajYCMAsLBwAgACgCLAsHACAAKAIgCwcAIAAoAhQLBwAgACgCCAvUBQEHfyABIAAoAggiByAAKAIEIgNrQQR1TQRAAkAgAUUNACADIQIgAUEHcSIFBEADQCACQv////8PNwIIIAJCADcCACACQRBqIQIgBEEBaiIEIAVHDQALCyABQQR0IANqIQMgAUEBa0H/////AHFBB0kNAANAIAJC/////w83AnggAkIANwJwIAJC/////w83AmggAkIANwJgIAJC/////w83AlggAkIANwJQIAJC/////w83AkggAkIANwJAIAJC/////w83AjggAkIANwIwIAJC/////w83AiggAkIANwIgIAJC/////w83AhggAkIANwIQIAJC/////w83AgggAkIANwIAIAJBgAFqIgIgA0cNAAsLIAAgAzYCBA8LAkAgAyAAKAIAIgJrQQR1IgQgAWoiBkGAgICAAUkEQEH/////ACAHIAJrIgdBA3UiAiAGIAIgBksbIAdB8P///wdPGyIGBEAgBkGAgICAAU8NAiAGQQR0EAshCAsgCCAEQQR0aiIEIQIgAUEHcSIHBEADQCACQv////8PNwIIIAJCADcCACACQRBqIQIgBUEBaiIFIAdHDQALCyABQQR0IARqIQUgAUEBa0H/////AHFBB08EQANAIAJC/////w83AnggAkIANwJwIAJC/////w83AmggAkIANwJgIAJC/////w83AlggAkIANwJQIAJC/////w83AkggAkIANwJAIAJC/////w83AjggAkIANwIwIAJC/////w83AiggAkIANwIgIAJC/////w83AhggAkIANwIQIAJC/////w83AgggAkIANwIAIAJBgAFqIgIgBUcNAAsLIAAoAgAiASADRwRAA0AgBEEQayIEIANBEGsiA/0AAgD9CwIAIAEgA0cNAAsgACgCACEDCyAAIAggBkEEdGo2AgggACAFNgIEIAAgBDYCACADBEAgAxAMCw8LEBMACxASAAuLAwEHfyABIAAoAggiAiAAKAI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mb0UAAACgEwAAEBMAANQSAABOMTBfX2N4eGFiaXYxMTlfX3BvaW50ZXJfdHlwZV9pbmZvRQCgEwAAQBMAADQTAAAAAAAABBMAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAAAAAAOgTAAAXAAAAHwAAABkAAAAaAAAAGwAAACAAAAAhAAAAIgAAAE4xMF9fY3h4YWJpdjEyMF9fc2lfY2xhc3NfdHlwZV9pbmZvRQAAAACgEwAAwBMAAAQTAAAAAAAAWBQAAAEAAAAjAAAAJAAAAAAAAACAFAAAAQAAACUAAAAmAAAAAAAAAEAUAAABAAAAJwAAACgAAABTdDlleGNlcHRpb24AAAAAeBMAADAUAABTdDliYWRfYWxsb2MAAAAAoBMAAEgUAABAFAAAU3QyMGJhZF9hcnJheV9uZXdfbGVuZ3RoAAAAAKATAABkFAAAWBQAAAAAAACwFAAAAgAAACkAAAAqAAAAU3QxMWxvZ2ljX2Vycm9yAKATAACgFAAAQBQAAAAAAADkFAAAAgAAACsAAAAqAAAAU3QxMmxlbmd0aF9lcnJvcgAAAACgEwAA0BQAALAUAABTdDl0eXBlX2luZm8AAAAAeBMAAPAUAEGIKgsBBQBBlCoLARMAQawqCw4UAAAAFQAAALgVAAAABABBxCoLAQEAQdQqCwX/////CgBBmCsLA3AcAQ==",le(Ie)||(Ie=u(Ie));function me(V){if(V==Ie&&U)return new Uint8Array(U);var L=S(V);if(L)return L;if(g)return g(V);throw"both async and sync fetching of the wasm failed"}function ye(V){return Promise.resolve().then(()=>me(V))}function Se(V,L,te){return ye(V).then(Ee=>WebAssembly.instantiate(Ee,L)).then(te,Ee=>{v(`failed to asynchronously prepare wasm: ${Ee}`),H(Ee)})}function Me(V,L,te,Ee){return Se(L,te,Ee)}function Ze(){var V={a:Lu};function L(Ee,Ye){return Vt=Ee.exports,F=Vt.f,j(),$(Vt.g),Ve(),Vt}Qe();function te(Ee){L(Ee.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(V,L)}catch(Ee){v(`Module.instantiateWasm callback failed with error: ${Ee}`),r(Ee)}return Me(U,Ie,V,te).catch(r),{}}function $e(V){this.name="ExitStatus",this.message=`Program terminated with exit(${V})`,this.status=V}var ct=V=>{for(;V.length>0;)V.shift()(t)};t.noExitRuntime;class ja{constructor(L){this.excPtr=L,this.ptr=L-24}set_type(L){T[this.ptr+4>>2]=L}get_type(){return T[this.ptr+4>>2]}set_destructor(L){T[this.ptr+8>>2]=L}get_destructor(){return T[this.ptr+8>>2]}set_caught(L){L=L?1:0,E[this.ptr+12]=L}get_caught(){return E[this.ptr+12]!=0}set_rethrown(L){L=L?1:0,E[this.ptr+13]=L}get_rethrown(){return E[this.ptr+13]!=0}init(L,te){this.set_adjusted_ptr(0),this.set_type(L),this.set_destructor(te)}set_adjusted_ptr(L){T[this.ptr+16>>2]=L}get_adjusted_ptr(){return T[this.ptr+16>>2]}get_exception_ptr(){var L=xl(this.get_type());if(L)return T[this.excPtr>>2];var te=this.get_adjusted_ptr();return te!==0?te:this.excPtr}}var ba=0,Ra=(V,L,te)=>{var Ee=new ja(V);throw Ee.init(L,te),ba=V,ba},Xt=()=>{H("")},Qa=(V,L,te)=>Q.copyWithin(V,L,L+te),Ta=()=>2147483648,Pt=V=>{var L=F.buffer,te=(V-L.byteLength+65535)/65536;try{return F.grow(te),j(),1}catch{}},ga=V=>{var L=Q.length;V>>>=0;var te=Ta();if(V>te)return!1;for(var Ee=(ma,Hr)=>ma+(Hr-ma%Hr)%Hr,Ye=1;Ye<=4;Ye*=2){var st=L*(1+.2/Ye);st=Math.min(st,V+100663296);var Xe=Math.min(te,Ee(Math.max(V,st),65536)),ze=Pt(Xe);if(ze)return!0}return!1},pa=[null,[],[]],ra=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,wr=(V,L,te)=>{for(var Ee=L+te,Ye=L;V[Ye]&&!(Ye>=Ee);)++Ye;if(Ye-L>16&&V.buffer&&ra)return ra.decode(V.subarray(L,Ye));for(var st="";L<Ye;){var Xe=V[L++];if(!(Xe&128)){st+=String.fromCharCode(Xe);continue}var ze=V[L++]&63;if((Xe&224)==192){st+=String.fromCharCode((Xe&31)<<6|ze);continue}var ma=V[L++]&63;if((Xe&240)==224?Xe=(Xe&15)<<12|ze<<6|ma:Xe=(Xe&7)<<18|ze<<12|ma<<6|V[L++]&63,Xe<65536)st+=String.fromCharCode(Xe);else{var Hr=Xe-65536;st+=String.fromCharCode(55296|Hr>>10,56320|Hr&1023)}}return st},Ir=(V,L)=>{var te=pa[V];L===0||L===10?((V===1?B:v)(wr(te,0)),te.length=0):te.push(L)},Rr=(V,L,te,Ee)=>{for(var Ye=0,st=0;st<te;st++){var Xe=T[L>>2],ze=T[L+4>>2];L+=8;for(var ma=0;ma<ze;ma++)Ir(V,Q[Xe+ma]);Ye+=ze}return T[Ee>>2]=Ye,0},Qr=V=>{w=V,l(V,new $e(V))},Tr=(V,L)=>{w=V,Qr(V)},Mu=V=>{if(V instanceof $e||V=="unwind")return w;l(1,V)},Nu=V=>{for(var L=0,te=0;te<V.length;++te){var Ee=V.charCodeAt(te);Ee<=127?L++:Ee<=2047?L+=2:Ee>=55296&&Ee<=57343?(L+=4,++te):L+=3}return L},Pu=(V,L,te,Ee)=>{if(!(Ee>0))return 0;for(var Ye=te,st=te+Ee-1,Xe=0;Xe<V.length;++Xe){var ze=V.charCodeAt(Xe);if(ze>=55296&&ze<=57343){var ma=V.charCodeAt(++Xe);ze=65536+((ze&1023)<<10)|ma&1023}if(ze<=127){if(te>=st)break;L[te++]=ze}else if(ze<=2047){if(te+1>=st)break;L[te++]=192|ze>>6,L[te++]=128|ze&63}else if(ze<=65535){if(te+2>=st)break;L[te++]=224|ze>>12,L[te++]=128|ze>>6&63,L[te++]=128|ze&63}else{if(te+3>=st)break;L[te++]=240|ze>>18,L[te++]=128|ze>>12&63,L[te++]=128|ze>>6&63,L[te++]=128|ze&63}}return L[te]=0,te-Ye},Vu=(V,L,te)=>Pu(V,Q,L,te),Ou=V=>{var L=Nu(V)+1,te=Bn(L);return Vu(V,te,L),te},Lu={b:Ra,c:Xt,e:Qa,d:ga,a:Rr},Vt=Ze();t._initialize=(V,L,te)=>(t._initialize=Vt.h)(V,L,te),t._allocMatrix=V=>(t._allocMatrix=Vt.i)(V),t._getMatrixBufferPtr=()=>(t._getMatrixBufferPtr=Vt.j)(),t._getSRTPtr=()=>(t._getSRTPtr=Vt.k)(),t._getInfoPtr=()=>(t._getInfoPtr=Vt.l)(),t._getContinuedSRTPtr=()=>(t._getContinuedSRTPtr=Vt.m)(),t._printMatrix=V=>(t._printMatrix=Vt.n)(V),t._updateAllMatrixContinueTransform=(V,L,te)=>(t._updateAllMatrixContinueTransform=Vt.o)(V,L,te);var vl=t._main=(V,L)=>(vl=t._main=Vt.p)(V,L),Bn=V=>(Bn=Vt.r)(V),xl=V=>(xl=Vt.s)(V),Us;Ae=function V(){Us||Ul(),Us||(Ae=V)};function Gu(V=[]){var L=vl;V.unshift(o);var te=V.length,Ee=Bn((te+1)*4),Ye=Ee;V.forEach(Xe=>{T[Ye>>2]=Ou(Xe),Ye+=4}),T[Ye>>2]=0;try{var st=L(te,Ee);return Tr(st,!0),st}catch(Xe){return Mu(Xe)}}function Ul(V=n){if(ce>0||(O(),ce>0))return;function L(){Us||(Us=!0,t.calledRun=!0,!C&&(W(),ae(),a(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),yl&&Gu(V),z()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),L()},1)):L()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();var yl=!0;return t.noInitialRun&&(yl=!1),Ul(),e.ready})})();function ur(s,e,t){return _.setting.doublePrecision?new Float64Array(s,e,t):new Float32Array(s,e,t)}class Re{static matrixBuffer;static matrixSRTBuffer;static matrixContinuedSRTBuffer;static matrixStateBuffer;static matrixBufferPtr;static matrixSRTBufferPtr;static matrixContinuedSRTBufferPtr;static matrixStateBufferPtr;static wasm;static stateStruct=4;static useDoublePrecision=!1;static async init(e,t=!1){this.wasm=await qu(),this.useDoublePrecision=t,this.wasm._initialize(e,t,0),this.allocMatrix(e)}static allocMatrix(e){e>R.maxCount&&console.error(`The maximum allocation size is exceeded! current:${e}, limit:${R.maxCount}`),this.wasm._allocMatrix(e),this.matrixBufferPtr=this.wasm._getMatrixBufferPtr(),this.matrixSRTBufferPtr=this.wasm._getSRTPtr(),this.matrixStateBufferPtr=this.wasm._getInfoPtr(),this.matrixContinuedSRTBufferPtr=this.wasm._getContinuedSRTPtr(),this.useDoublePrecision?(this.matrixBuffer=ur(this.wasm.HEAPF64.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=ur(this.wasm.HEAPF64.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=ur(this.wasm.HEAPF64.buffer,this.matrixContinuedSRTBufferPtr,9*e),R.blockBytes=R.block*8):(this.matrixBuffer=ur(this.wasm.HEAPF32.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=ur(this.wasm.HEAPF32.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=ur(this.wasm.HEAPF32.buffer,this.matrixContinuedSRTBufferPtr,9*e),R.blockBytes=R.block*4),this.matrixStateBuffer=new Int32Array(this.wasm.HEAP32.buffer,this.matrixStateBufferPtr,Re.stateStruct*e),R.allocMatrix(e)}static updateAllContinueTransform(e,t,a){this.wasm._updateAllMatrixContinueTransform(e,t,a)}static setParent(e,t,a){this.matrixStateBuffer[e*Re.stateStruct+2]=t>=0?t:-1,this.matrixStateBuffer[e*Re.stateStruct+3]=a}static setTranslate(e,t,a,r){this.matrixSRTBuffer[e*9+6]=t,this.matrixSRTBuffer[e*9+7]=a,this.matrixSRTBuffer[e*9+8]=r}static setRotation(e,t,a,r){this.matrixSRTBuffer[e*9+3]=t%360,this.matrixSRTBuffer[e*9+4]=a%360,this.matrixSRTBuffer[e*9+5]=r%360}static setScale(e,t,a,r){this.matrixSRTBuffer[e*9+0]=t,this.matrixSRTBuffer[e*9+1]=a,this.matrixSRTBuffer[e*9+2]=r}static setContinueTranslate(e,t,a,r){(t!=0||a!=0||r!=0)&&(this.matrixContinuedSRTBuffer[e*9+6]=t,this.matrixContinuedSRTBuffer[e*9+7]=a,this.matrixContinuedSRTBuffer[e*9+8]=r,this.matrixStateBuffer[e*Re.stateStruct+1]=1)}static setContinueRotation(e,t,a,r){(t!=0||a!=0||r!=0)&&(this.matrixContinuedSRTBuffer[e*9+3]=t,this.matrixContinuedSRTBuffer[e*9+4]=a,this.matrixContinuedSRTBuffer[e*9+5]=r,this.matrixStateBuffer[e*Re.stateStruct+1]=1)}static setContinueScale(e,t,a,r){(t!=0||a!=0||r!=0)&&(this.matrixContinuedSRTBuffer[e*9+0]=t,this.matrixContinuedSRTBuffer[e*9+1]=a,this.matrixContinuedSRTBuffer[e*9+2]=r,this.matrixStateBuffer[e*Re.stateStruct+1]=1)}}class na{static AXIS_ANGLE="axisAngle";static EULER_ANGLES="eulerAngles";static QUATERNION="quaternion"}class se{static HELP_0=new se(0,0,0,1);static HELP_1=new se(0,0,0,1);static HELP_2=new se(0,0,0,1);static _zero=new se(0,0,0,1);static CALCULATION_QUATERNION=new se;x=0;y=0;z=0;w=1;constructor(e=0,t=0,a=0,r=1){this.x=e,this.y=t,this.z=a,this.w=r}static identity(){return se._zero}static quaternionToMatrix(e,t){let a=e.x*2,r=e.y*2,i=e.z*2,n=e.x*a,o=e.y*r,l=e.z*i,c=e.x*r,f=e.x*i,d=e.y*i,h=e.w*a,u=e.w*r,m=e.w*i;t.rawData[0]=1-(o+l),t.rawData[1]=c+m,t.rawData[2]=f-u,t.rawData[3]=0,t.rawData[4]=c-m,t.rawData[5]=1-(n+l),t.rawData[6]=d+h,t.rawData[7]=0,t.rawData[8]=f+u,t.rawData[9]=d-h,t.rawData[10]=1-(n+o),t.rawData[11]=0,t.rawData[12]=0,t.rawData[13]=0,t.rawData[14]=0,t.rawData[15]=1}get magnitude(){return Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z)}set(e=0,t=0,a=0,r=1){return this.x=e,this.y=t,this.z=a,this.w=r,this}divide(e){return e instanceof se?new se(this.x/e.x,this.y/e.y,this.z/e.z):(this.x=this.x/e,this.y=this.y/e,this.z=this.z/e,this)}setFromArray(e){return this.x=e[0],this.y=e[1],this.z=e[2],this.w=e[3],this}multiply(e,t){var a=e.w,r=e.x,i=e.y,n=e.z,o=t.w,l=t.x,c=t.y,f=t.z;this.w=a*o-r*l-i*c-n*f,this.x=a*l+r*o+i*f-n*c,this.y=a*c-r*f+i*o+n*l,this.z=a*f+r*c-i*l+n*o}multiplyVector(e,t=null){t||=new se;var a=e.x,r=e.y,i=e.z;return t.w=-this.x*a-this.y*r-this.z*i,t.x=this.w*a+this.y*i-this.z*r,t.y=this.w*r-this.x*i+this.z*a,t.z=this.w*i+this.x*r-this.y*a,t}fromAxisAngle(e,t){t*=Math.PI/180;var a=t*.5,r=Math.sin(a);this.w=Math.cos(a),this.x=e.x*r,this.y=e.y*r,this.z=e.z*r,this.normalize()}toAxisAngle(e){var t=this.x*this.x+this.y*this.y+this.z*this.z,a=0;return t>0?(a=2*Math.acos(this.w),t=1/Math.sqrt(t),e.x=this.x*t,e.y=this.y*t,e.z=this.z*t):(a=0,e.x=1,e.y=0,e.z=0),a}slerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h=r*l+i*c+n*f+o*d;if(h<0&&(h=-h,l=-l,c=-c,f=-f,d=-d),h<.95){var u=Math.acos(h),m=1/Math.sin(u),g=Math.sin(u*(1-a))*m,p=Math.sin(u*a)*m;this.w=r*g+l*p,this.x=i*g+c*p,this.y=n*g+f*p,this.z=o*g+d*p}else{this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o);var D=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z);this.w*=D,this.x*=D,this.y*=D,this.z*=D}}lerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h;r*l+i*c+n*f+o*d<0&&(l=-l,c=-c,f=-f,d=-d),this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o),h=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=h,this.x*=h,this.y*=h,this.z*=h}fromEulerAngles(e,t,a){e*=Dt,t*=Dt,a*=Dt;var r=e*.5,i=t*.5,n=a*.5,o=Math.cos(r),l=Math.sin(r),c=Math.cos(i),f=Math.sin(i),d=Math.cos(n),h=Math.sin(n);return this.w=o*c*d+l*f*h,this.x=l*c*d-o*f*h,this.y=o*f*d+l*c*h,this.z=o*c*h-l*f*d,this}setFromRotationMatrix(e){const t=e.rawData,a=t[0],r=t[4],i=t[8],n=t[1],o=t[5],l=t[9],c=t[2],f=t[6],d=t[10],h=a+o+d;if(h>0){const u=.5/Math.sqrt(h+1);this.w=.25/u,this.x=(f-l)*u,this.y=(i-c)*u,this.z=(n-r)*u}else if(a>o&&a>d){const u=2*Math.sqrt(1+a-o-d);this.w=(f-l)/u,this.x=.25*u,this.y=(r+n)/u,this.z=(i+c)/u}else if(o>d){const u=2*Math.sqrt(1+o-a-d);this.w=(i-c)/u,this.x=(r+n)/u,this.y=.25*u,this.z=(l+f)/u}else{const u=2*Math.sqrt(1+d-a-o);this.w=(n-r)/u,this.x=(i+c)/u,this.y=(l+f)/u,this.z=.25*u}return this}getEulerAngles(e){var t,a,r,i,n,o,l,c;return e||=new b,i=this.x,n=this.y,o=this.z,l=this.w,c=2*(l*n-i*o),c<=-.99999?(t=2*Math.atan2(i,l),a=-Math.PI/2,r=0):c>=.99999?(t=2*Math.atan2(i,l),a=Math.PI/2,r=0):(t=Math.atan2(2*(l*i+n*o),1-2*(i*i+n*n)),a=Math.asin(c),r=Math.atan2(2*(l*o+i*n),1-2*(n*n+o*o))),e.set(t,a,r).scaleBy($r)}normalize(e=1){var t=e/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);this.x*=t,this.y*=t,this.z*=t,this.w*=t}toString(){return"{x:"+this.x+" y:"+this.y+" z:"+this.z+" w:"+this.w+"}"}fromMatrix(e){var t=e.decompose(na.QUATERNION)[1];this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}inverse(e=null){e||=new se;var t=this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z;if(t>0){var a=1/t;e.w=this.w*a,e.x=-this.x*a,e.y=-this.y*a,e.z=-this.z*a}return e}clone(){return new se(this.x,this.y,this.z,this.w)}transformVector(e,t=null){var a,r,i,n,o=e.x,l=e.y,c=e.z;return t||=new b,n=-this.x*o-this.y*l-this.z*c,a=this.w*o+this.y*c-this.z*l,r=this.w*l-this.x*c+this.z*o,i=this.w*c+this.x*l-this.y*o,t.x=-n*this.x+a*this.w-r*this.z+i*this.y,t.y=-n*this.y+a*this.z+r*this.w-i*this.x,t.z=-n*this.z-a*this.y+r*this.x+i*this.w,t}copyFrom(e){var t=this;return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,this}mul(e,t,a){let r=a||new se;return r.x=e.w*t.x+e.x*t.w+e.y*t.z-e.z*t.y,r.y=e.w*t.y+e.y*t.w+e.z*t.x-e.x*t.z,r.z=e.w*t.z+e.z*t.w+e.x*t.y-e.y*t.x,r.w=e.w*t.w-e.x*t.x-e.y*t.y-e.z*t.z,r}clampf(e,t,a){if(t>a){var r=t;t=a,a=r}return e<t?t:e<a?e:a}static serialize(e){return new se(e.x,e.y,e.z,e.w)}}function $u(s,e,t){let a=s.x*2,r=s.y*2,i=s.z*2,n=s.x*a,o=s.y*r,l=s.z*i,c=s.x*r,f=s.x*i,d=s.y*i,h=s.w*a,u=s.w*r,m=s.w*i,g=t||new b;return g.x=(1-(o+l))*e.x+(c-m)*e.y+(f+u)*e.z,g.y=(c+m)*e.x+(1-(n+l))*e.y+(d-h)*e.z,g.z=(f-u)*e.x+(d+h)*e.y+(1-(n+o))*e.z,g}class ns{_x=0;_y=0;_z=0;_w=0;constructor(e=0){this.seed=e}get seed(){return this._x}set seed(e){this._x=e,this._y=this._x*1812433253+1,this._z=this._y*1812433253+1,this._w=this._z*1812433253+1}static getFloatFromInt(e){return Math.floor((e&8388607)*(1/8388607))}static getByteFromInt(e){return e>>15}clone(){let e=new ns;return e._x=this._x,e._y=this._y,e._z=this._z,e._w=this._w,e}get(){let e=this._x^this._x<<11;return this._x=this._y,this._y=this._z,this._z=this._w,this._w=this._w^this._w>>19^(e^e>>8)}getFloat(){return Oc(this.get())}getSignedFloat(){return this.getFloat()*2-1}}let $r=180/Math.PI,Dt=Math.PI/180,e2=2147483647,t2=-2147483647;function Be(s,e,t){return Math.max(e,Math.min(t,s))}class Gt{static gaussFunction(e,t,a,r){let i=Math.pow(e-a,2),n=2*Math.pow(r,2),o=-1*(i/n),l=Math.pow(Math.E,o);return Math.round(l*t)}static computeGaussian(e,t){return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(e*e)/(2*t*t))}static gaussCoef(e){e<.5&&(e=.5);let t=Math.exp(.726*.726)/e,a=Math.exp(-t),r=Math.exp(-2*t),i=(1-a)*(1-a)/(1+2*t*a-r),n=i,o=i*(t-1)*a,l=i*(t+1)*a,c=-i*r,f=2*a,d=-r,h=(n+o)/(1-f-d),u=(l+c)/(1-f-d);return new Float32Array([n,o,l,c,f,d,h,u])}static clampf(e,t,a){if(t>a){let r=t;t=a,a=r}return e<t?t:e<a?e:a}static normalizeAngle(e){for(;e>180;)e-=360;for(;e<-180;)e+=360;return e}static fract(e){return e-Math.floor(e)}static getRandDirXZ(e){let t=e*Math.random(),a=360*Math.random()*Dt,r=Math.cos(a)*t,i=Math.sin(a)*t;return{x:r,z:i}}static getRandDirXYZ(e){let t=e*Math.random(),a=360*Math.random()*Dt,r=Math.cos(a)*t,i=Math.tan(a)*t,n=Math.sin(a)*t;return new b(r,i,n)}static getCycleXYZ(e){let t=e*Math.random(),a=360*Math.random()*Dt,r=Math.cos(a)*t,i=e*Math.random()-e*.5,n=Math.sin(a)*t;return new b(r,i,n)}static angle(e,t){let a=de.HELP_0,r=de.HELP_1;return a.set(e.x,e.z),r.set(t.x,t.z),Math.acos((a.x*r.x+a.y*r.y)/(a.abs()*r.abs()))}static angle_360(e,t){let a=b.HELP_0;return e.crossProduct(t,a),a.z>0?Gt.angle(e,t):360-Gt.angle(e,t)}getRotationY(e){return Gt.normalizeAngle(Math.atan2(e.z,e.x)*$r)}static fromToRotation(e,t,a=null){a||=new se;let r=R.help_matrix_2;return R.fromToRotation(e,t,r),a.fromMatrix(r),a}static getEularDir_yUp(e){let t=se.HELP_0;return t.fromEulerAngles(0,e,0),t.transformVector(b.Z_AXIS,b.HELP_5),b.HELP_5}static transformVector(e,t,a=null){a||=new b;let r=e.rawData,i=r[0],n=r[1],o=r[2],l=r[3],c=r[4],f=r[5],d=r[6],h=r[7],u=r[8],m=r[9],g=r[10],p=r[11],D=r[12],A=r[13],B=r[14],v=r[15],U=t.x,y=t.y,S=t.z;return a.x=i*U+c*y+u*S+D,a.y=n*U+f*y+m*S+A,a.z=o*U+d*y+g*S+B,a.w=l*U+h*y+p*S+v,a}}let Mr=function(s,e,t){return s*(1-t)+e*t};function a2(s,e,t){let a=new b,r=s.x,i=s.y,n=s.z,o=s.w,l=e.x,c=e.y,f=e.z,d=e.w;return a.x=(l-r)*t+r,a.y=(c-i)*t+i,a.z=(f-n)*t+n,a.w=(d-o)*t+o,a}function r2(s,e,t){let a=new J;return a.r=(1-t)*s.r+t*e.r,a.g=(1-t)*s.g+t*e.g,a.b=(1-t)*s.b+t*e.b,a.a=(1-t)*s.a+t*e.a,a}function i2(s,e,t){return s+((e-s)*t>>8)&255}let In=function(s,e,t){let a=t-e;return Math.floor(s/a)%2==0?s%a+e:t-s%a+e},Rn=function(s,e,t){let a=t-e;return s%a+e},s2=function(s,e){let t=0;for(let a in s)a==e&&t++;return t};class n2{x=0;y=0;z=0;w=0;randSeedList;constructor(){this.randSeedList=[]}reset(){this.x=Math.random()*1,this.y=Math.random()*1,this.z=Math.random()*1,this.w=Math.random()*1,this.randSeedList.length=0;for(let e=0;e<20;e++)this.randSeedList.push(Math.random()*1)}}function Ft(s,e){return s instanceof b&&e instanceof b||s instanceof se&&e instanceof se?s.x*e.x+s.y*e.y+s.z*e.z:s.x*e.x+s.y*e.y}function Qn(s,e){return new b(s.x*e.x,s.y*e.y,s.z*e.z)}function Pc(s){return Math.sqrt(s)}function Tn(s){return Pc(Ft(s,s))}function Vc(s,e){if(Tn(s)>b.EPSILON)return s.divide(Tn(s));if(s instanceof de)return new de;if(s instanceof b)return new b;if(s instanceof se)return new se}function Oc(s){return(s&8388607)*(1/8388607)}function ei(s){return s.getFloat()}function _t(s,e,t){let a=s.getFloat();return a=e*a+(1-a)*t,a}function o2(s,e,t){let a;if(e<t){a=t-e;let r=s.get()%a;return r+=e,r}else if(e>t){a=e-t;let r=s.get()%a;return r=e-r,r}else return e}function ks(s){let e=_t(s,-1,1),t=_t(s,0,2*Math.PI),a=Math.sqrt(1-e*e),r=a*Math.cos(t),i=a*Math.sin(t);return new b(r,i,e)}function Lc(s){let e=_t(s,0,2*Math.PI),t=Math.cos(e),a=Math.sin(e);return new de(t,a)}function l2(s){let e=new se;return e.x=_t(s,-1,1),e.y=_t(s,-1,1),e.z=_t(s,-1,1),e.w=_t(s,-1,1),e=Vc(e),Ft(e,se.identity())<0?-e:e}function c2(s){const e=2*Math.PI;let t=_t(s,0,1),a=_t(s,0,e),r=_t(s,0,e),i=Math.sqrt(1-t),n=Math.sqrt(t),o=new se(i*Math.sin(a),i*Math.cos(a),n*Math.sin(r),n*Math.cos(r));return Ft(o,se.identity())<0?-o:o}function f2(s,e){return new b(_t(s,-e.x,e.x),_t(s,-e.y,e.y),_t(s,-e.z,e.z))}function Gc(s){let e=ks(s);return e.scaleBy(Math.pow(ei(s),1/3)),e}function d2(s,e){return Qn(Gc(s),e)}function h2(s,e,t){let a=ks(s),r=Math.pow(_t(s,0,1),1/3);return a.scaleBy(e+(t-e)*r),a}function u2(s){let e=Lc(s);return e.multiply(Math.pow(_t(s,0,1),1/2),e),e}function b2(s,e,t){let a=Qn(ks(s),e),r=Math.pow(_t(s,t,1),1/3);return a.scaleBy(r),a}function g2(s){let e=s.getFloat(),t=s.getFloat();e+t>1&&(e=1-e,t=1-t);let a=1-e-t;return new b(e,t,a)}function p2(s){return s/360*2*Math.PI}function m2(s){return 180*s/Math.PI}function A2(s){return Math.sin(s)}function D2(s){return Math.cos(s)}let zc=4919;function _2(){return++zc}function B2(s,e,t){let a=s[e],r=s[t];s[e]=r,s[t]=a}function Wc(s){return Math.floor(s)}function Mn(s){return Wc(s+.5)}function v2(s){return s=Math.max(s,0),s=Math.min(s,1),Mn(s*65535)}function x2(s){return s=Math.max(s,0),s=Math.min(s,1),Mn(s*255)}function Jc(s){return Math.abs(s)==0?s:1/Math.sqrt(s)}function U2(s){let e=Nn(s);return s.scaleBy(Jc(e))}function y2(s,e){return s.crossProduct(e)}function Nn(s){return Ft(s,s)}function C2(s){let e=new ns(s);return ei(e)}function S2(s,e){let t=new ns(e);s.x=ei(t),s.y=ei(t),s.z=ei(t)}function F2(s,e,t){return s<e?t:s>t?e:s}function Pn(s,e){return s-Math.floor(s/e)*e}const k2=1e-6;class R{static blockBytes=64;static block=16;static allocCount=1e3;static allocOnceCount=1e3;static maxCount=50*1e4;static useCount=0;static buffer;static wasmMatrixPtr=0;static dynamicMatrixBytes;static dynamicGlobalMatrixRef;static wasm;static help_matrix_0;static help_matrix_1;static help_matrix_2;static helpMatrix;static helpMatrix2;static _getEulerMatrix;static _zero=new b(0,0,0);static _one=new b(1,1,1);static _prs=[new b,new b,new b];index=0;offset=0;rawData;_position;static allocMatrix(e){this.allocCount=e,R.dynamicMatrixBytes=Re.matrixBuffer,R.buffer=R.dynamicMatrixBytes.buffer,R.wasmMatrixPtr=Re.matrixBufferPtr,this.dynamicGlobalMatrixRef||=[],this.dynamicGlobalMatrixRef.forEach(t=>{t.offset=R.wasmMatrixPtr+t.index*R.blockBytes,t.rawData=ur(R.dynamicMatrixBytes.buffer,t.offset,16)}),R.help_matrix_0||=new R,R.help_matrix_1||=new R,R.help_matrix_2||=new R,R.helpMatrix||=new R,R.helpMatrix2||=new R,R._getEulerMatrix||=new R,R._getEulerMatrix.identity()}static fromToRotation(e,t,a){return a||=new R,a.transformDir(e,t),a}static fromArray(e){if(e.length!==16)throw new Error("Array must contain exactly 16 elements");const t=new R;for(let a=0;a<16;a++)t.rawData[a]=e[a];return t}static getAxisRotation(e,t,a,r){let i=new R,n=r*(Math.PI/180),o=Math.cos(n),l=Math.sin(n),c=1-o,f,d;return i.rawData[0]=o+e*e*c,i.rawData[5]=o+t*t*c,i.rawData[10]=o+a*a*c,f=e*t*c,d=a*l,i.rawData[1]=f+d,i.rawData[4]=f-d,f=e*a*c,d=t*l,i.rawData[8]=f+d,i.rawData[2]=f-d,f=t*a*c,d=e*l,i.rawData[9]=f-d,i.rawData[6]=f+d,i}static sanitizeEuler(e){R.makePositive(e)}static makePositive(e){let t=-1e-4,a=Math.PI*2-1e-4;e.x<t?e.x+=2*Math.PI:e.x>a&&(e.x-=2*Math.PI),e.y<t?e.y+=2*Math.PI:e.y>a&&(e.y-=2*Math.PI),e.z<t?e.z+=2*Math.PI:e.z>a&&(e.z-=2*Math.PI)}static matrixToEuler(e,t){return e.get(1,2)<.999?e.get(1,2)>-.999?(t.x=Math.asin(-e.get(1,2)),t.y=Math.atan2(e.get(0,2),e.get(2,2)),t.z=Math.atan2(e.get(1,0),e.get(1,1)),R.sanitizeEuler(t),!0):(t.x=Math.PI*.5,t.y=Math.atan2(e.get(0,1),e.get(0,0)),t.z=0,R.sanitizeEuler(t),!1):(t.x=-Math.PI*.5,t.y=Math.atan2(-e.get(0,1),e.get(0,0)),t.z=0,R.sanitizeEuler(t),!1)}static matrixMultiply(e,t,a){R.wasm.Matrix_Multiply(e.index,t.index,a.index)}static matrixAppend(e,t,a){R.wasm.Matrix_Append(e.index,t.index,a.index)}static matrixRotateY(e,t){R.wasm.Matrix_Append(e,t.index)}static matrixRotate(e,t,a){R.wasm.Matrix_Rotate(e,t,a.index)}constructor(e=!1){if(R.useCount>=R.allocCount){let t=R.allocCount+R.allocOnceCount;Re.allocMatrix(t)}this.index=R.useCount,this.offset=R.wasmMatrixPtr+this.index*R.blockBytes,R.dynamicGlobalMatrixRef[this.index]=this,R.useCount++,this.rawData=ur(R.dynamicMatrixBytes.buffer,this.offset,16),this._position=new b,this.identity()}lookAt(e,t,a=b.Y_AXIS){let r=this.rawData,i=t.subtract(e,b.HELP_0);i.length===0&&(i.z=1),i.normalize();let n=a.crossProduct(i,b.HELP_1);n.length===0&&(Math.abs(a.z)===1?i.x+=1e-4:i.z-=1e-4,i.normalize(),n=a.crossProduct(i,b.HELP_1)),n.normalize();let o=i.crossProduct(n,b.HELP_2);r[0]=n.x,r[1]=o.x,r[2]=i.x,r[3]=0,r[4]=n.y,r[5]=o.y,r[6]=i.y,r[7]=0,r[8]=n.z,r[9]=o.z,r[10]=i.z,r[11]=0,r[12]=-n.dotProduct(e),r[13]=-o.dotProduct(e),r[14]=-i.dotProduct(e),r[15]=1}static floatArray=new Float64Array(16).fill(0);multiply(e){let t=this.rawData,a=e.rawData,r=R.floatArray;r[0]=t[0]*a[0]+t[1]*a[4]+t[2]*a[8]+t[3]*a[12],r[1]=t[0]*a[1]+t[1]*a[5]+t[2]*a[9]+t[3]*a[13],r[2]=t[0]*a[2]+t[1]*a[6]+t[2]*a[10]+t[3]*a[14],r[3]=t[0]*a[3]+t[1]*a[7]+t[2]*a[11]+t[3]*a[15],r[4]=t[4]*a[0]+t[5]*a[4]+t[6]*a[8]+t[7]*a[12],r[5]=t[4]*a[1]+t[5]*a[5]+t[6]*a[9]+t[7]*a[13],r[6]=t[4]*a[2]+t[5]*a[6]+t[6]*a[10]+t[7]*a[14],r[7]=t[4]*a[3]+t[5]*a[7]+t[6]*a[11]+t[7]*a[15],r[8]=t[8]*a[0]+t[9]*a[4]+t[10]*a[8]+t[11]*a[12],r[9]=t[8]*a[1]+t[9]*a[5]+t[10]*a[9]+t[11]*a[13],r[10]=t[8]*a[2]+t[9]*a[6]+t[10]*a[10]+t[11]*a[14],r[11]=t[8]*a[3]+t[9]*a[7]+t[10]*a[11]+t[11]*a[15],r[12]=t[12]*a[0]+t[13]*a[4]+t[14]*a[8]+t[15]*a[12],r[13]=t[12]*a[1]+t[13]*a[5]+t[14]*a[9]+t[15]*a[13],r[14]=t[12]*a[2]+t[13]*a[6]+t[14]*a[10]+t[15]*a[14],r[15]=t[12]*a[3]+t[13]*a[7]+t[14]*a[11]+t[15]*a[15],t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]}multiplyMatrices(e,t){const a=e.rawData,r=t.rawData,i=this.rawData,n=a[0],o=a[4],l=a[8],c=a[12],f=a[1],d=a[5],h=a[9],u=a[13],m=a[2],g=a[6],p=a[10],D=a[14],A=a[3],B=a[7],v=a[11],U=a[15],y=r[0],S=r[4],F=r[8],C=r[12],w=r[1],E=r[5],Q=r[9],T=r[13],j=r[2],ue=r[6],ee=r[10],N=r[14],M=r[3],O=r[7],W=r[11],ae=r[15];return i[0]=n*y+o*w+l*j+c*M,i[4]=n*S+o*E+l*ue+c*O,i[8]=n*F+o*Q+l*ee+c*W,i[12]=n*C+o*T+l*N+c*ae,i[1]=f*y+d*w+h*j+u*M,i[5]=f*S+d*E+h*ue+u*O,i[9]=f*F+d*Q+h*ee+u*W,i[13]=f*C+d*T+h*N+u*ae,i[2]=m*y+g*w+p*j+D*M,i[6]=m*S+g*E+p*ue+D*O,i[10]=m*F+g*Q+p*ee+D*W,i[14]=m*C+g*T+p*N+D*ae,i[3]=A*y+B*w+v*j+U*M,i[7]=A*S+B*E+v*ue+U*O,i[11]=A*F+B*Q+v*ee+U*W,i[15]=A*C+B*T+v*N+U*ae,this}multiplyPoint3(e,t){t||=new b;let a=this.rawData;return t.x=a[0]*e.x+a[4]*e.y+a[8]*e.z+a[12],t.y=a[1]*e.x+a[5]*e.y+a[9]*e.z+a[13],t.z=a[2]*e.x+a[6]*e.y+a[10]*e.z+a[14],t}multiplyVector4(e,t){t||=new b;let a=this.rawData,r=e.x,i=e.y,n=e.z,o=a[3]*r+a[7]*i+a[11]*n+a[15];return o=o||1,t.x=(a[0]*r+a[4]*i+a[8]*n+a[12])/o,t.y=(a[1]*r+a[5]*i+a[9]*n+a[13])/o,t.z=(a[2]*r+a[6]*i+a[10]*n+a[14])/o,t.w=1,t}transformVector4(e,t){let a=this.rawData;t||=new b;let r=e.x,i=e.y,n=e.z,o=e.w;return t.x=r*a[0]+i*a[4]+n*a[8]+o*a[12],t.y=r*a[1]+i*a[5]+n*a[9]+o*a[13],t.z=r*a[2]+i*a[6]+n*a[10]+o*a[14],t.w=r*a[3]+i*a[7]+n*a[11]+o*a[15],t}perspectiveMultiplyPoint3(e,t){let a=b.HELP_2,r,i=this.rawData;if(a.x=i[0]*e.x+i[4]*e.y+i[8]*e.z+i[12],a.y=i[1]*e.x+i[5]*e.y+i[9]*e.z+i[13],a.z=i[2]*e.x+i[6]*e.y+i[10]*e.z+i[14],r=i[3]*e.x+i[7]*e.y+i[11]*e.z+i[15],Math.abs(r)>1e-7){let n=1/r;return t.x=a.x*n,t.y=a.y*n,t.z=a.z*n,!0}else return t.x=0,t.y=0,t.z=0,!1}perspective(e,t,a,r){let i=this.rawData,n=e*Dt/2,o=Math.cos(n)/Math.sin(n);i[0]=-o/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r/(r-a),i[11]=1,i[12]=0,i[13]=0,i[14]=-a*r/(r-a),i[15]=0}perspective3(e,t,a,r){let i=Math.tan(e*Math.PI/360)*a,n=i*t;this.frustum(-n,n,-i,i,a,r)}frustum(e,t,a,r,i,n){let o=this.rawData;o[0]=-2*i/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*i/(r-a),o[6]=0,o[7]=0,o[8]=(t+e)/(t-e),o[9]=(r+a)/(r-a),o[10]=n/(n-i),o[11]=1,o[12]=0,o[13]=0,o[14]=-n*i/(n-i),o[15]=0}ortho(e,t,a,r){let i=this.rawData;return i[0]=2/e,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/t,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1/(r-a),i[11]=0,i[12]=0,i[13]=0,i[14]=a/(a-r),i[15]=1,this}orthoZO(e,t,a,r,i,n){let o=this.rawData,l=1/(e-t),c=1/(a-r),f=1/(i-n);return o[0]=-2*l,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*c,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=f,o[11]=0,o[12]=(e+t)*l,o[13]=(r+a)*c,o[14]=i*f,o[15]=1,this}orthoOffCenter(e,t,a,r,i,n){let o=this.rawData;o[0]=2/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2/(r-a),o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1/(n-i),o[11]=0,o[12]=(e+t)/(e-t),o[13]=(r+a)/(a-r),o[14]=i/(i-n),o[15]=1}transformDir(e,t){let a=this.rawData,r=1e-6,i=b.ZERO;t.crossProduct(e,i);let n=t.dotProduct(e);if(n>1-r)this.identity();else if(n<-1+r){let o=b.HELP_1,l=b.HELP_2,c=0,f,d,h,u,m,g,p,D,A,B,v,U,y,S,F,C,w,E;l.x=0,l.y=e.z,l.z=-e.y,l.dotProduct(l)<r&&(l.x=-e.z,l.y=0,l.z=e.x),c=1/Math.sqrt(l.dotProduct(l)),l.x*=c,l.y*=c,l.z*=c,l.crossProduct(e,o),f=-e.x*e.x,d=-e.y*e.y,h=-e.z*e.z,u=-e.x*e.y,m=-e.x*e.z,g=-e.y*e.z,p=o.x*o.x,D=o.y*o.y,A=o.z*o.z,B=o.x*o.y,v=o.x*o.z,U=o.y*o.z,y=-l.x*l.x,S=-l.y*l.y,F=-l.z*l.z,C=-l.x*l.y,w=-l.x*l.z,E=-l.y*l.z,a[0]=f+p+y,a[1]=u+B+C,a[2]=m+v+w,a[4]=a[1],a[5]=d+D+S,a[6]=g+U+E,a[8]=a[2],a[9]=a[6],a[10]=h+A+F,a[3]=0,a[7]=0,a[11]=0,a[15]=1}else{let o,l,c,f,d,h=i.dotProduct(i),u=(1-n)/h;o=u*i.x,l=u*i.z,c=o*i.y,f=o*i.z,d=l*i.y,a[0]=n+o*i.x,a[1]=c-i.z,a[2]=f+i.y,a[4]=c+i.z,a[5]=n+u*i.y*i.y,a[6]=d-i.x,a[8]=f-i.y,a[9]=d+i.x,a[10]=n+l*i.z,a[3]=0,a[7]=0,a[11]=0,a[15]=1}return this}append(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],u=t[10],m=t[14],g=t[3],p=t[7],D=t[11],A=t[15];t[0]=a*e.rawData[0]+o*e.rawData[4]+d*e.rawData[8]+g*e.rawData[12],t[1]=a*e.rawData[1]+o*e.rawData[5]+d*e.rawData[9]+g*e.rawData[13],t[2]=a*e.rawData[2]+o*e.rawData[6]+d*e.rawData[10]+g*e.rawData[14],t[3]=a*e.rawData[3]+o*e.rawData[7]+d*e.rawData[11]+g*e.rawData[15],t[4]=r*e.rawData[0]+l*e.rawData[4]+h*e.rawData[8]+p*e.rawData[12],t[5]=r*e.rawData[1]+l*e.rawData[5]+h*e.rawData[9]+p*e.rawData[13],t[6]=r*e.rawData[2]+l*e.rawData[6]+h*e.rawData[10]+p*e.rawData[14],t[7]=r*e.rawData[3]+l*e.rawData[7]+h*e.rawData[11]+p*e.rawData[15],t[8]=i*e.rawData[0]+c*e.rawData[4]+u*e.rawData[8]+D*e.rawData[12],t[9]=i*e.rawData[1]+c*e.rawData[5]+u*e.rawData[9]+D*e.rawData[13],t[10]=i*e.rawData[2]+c*e.rawData[6]+u*e.rawData[10]+D*e.rawData[14],t[11]=i*e.rawData[3]+c*e.rawData[7]+u*e.rawData[11]+D*e.rawData[15],t[12]=n*e.rawData[0]+f*e.rawData[4]+m*e.rawData[8]+A*e.rawData[12],t[13]=n*e.rawData[1]+f*e.rawData[5]+m*e.rawData[9]+A*e.rawData[13],t[14]=n*e.rawData[2]+f*e.rawData[6]+m*e.rawData[10]+A*e.rawData[14],t[15]=n*e.rawData[3]+f*e.rawData[7]+m*e.rawData[11]+A*e.rawData[15]}add(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],u=t[10],m=t[14],g=t[3],p=t[7],D=t[11],A=t[15],B=e.rawData[0],v=e.rawData[4],U=e.rawData[8],y=e.rawData[12],S=e.rawData[1],F=e.rawData[5],C=e.rawData[9],w=e.rawData[13],E=e.rawData[2],Q=e.rawData[6],T=e.rawData[10],j=e.rawData[14],ue=e.rawData[3],ee=e.rawData[7],N=e.rawData[11],M=e.rawData[15];return t[0]=a+B,t[1]=o+S,t[2]=d+E,t[3]=g+ue,t[4]=r+v,t[5]=l+F,t[6]=h+Q,t[7]=p+ee,t[8]=i+U,t[9]=c+C,t[10]=u+T,t[11]=D+N,t[12]=n+y,t[13]=f+w,t[14]=m+j,t[15]=A+M,this}sub(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],u=t[10],m=t[14],g=t[3],p=t[7],D=t[11],A=t[15],B=e.rawData[0],v=e.rawData[4],U=e.rawData[8],y=e.rawData[12],S=e.rawData[1],F=e.rawData[5],C=e.rawData[9],w=e.rawData[13],E=e.rawData[2],Q=e.rawData[6],T=e.rawData[10],j=e.rawData[14],ue=e.rawData[3],ee=e.rawData[7],N=e.rawData[11],M=e.rawData[15];return t[0]=a-B,t[1]=o-S,t[2]=d-E,t[3]=g-ue,t[4]=r-v,t[5]=l-F,t[6]=h-Q,t[7]=p-ee,t[8]=i-U,t[9]=c-C,t[10]=u-T,t[11]=D-N,t[12]=n-y,t[13]=f-w,t[14]=m-j,t[15]=A-M,this}mult(e){let t=this.rawData;return t[0]*=e,t[1]*=e,t[2]*=e,t[3]*=e,t[4]*=e,t[5]*=e,t[6]*=e,t[7]*=e,t[8]*=e,t[9]*=e,t[10]*=e,t[11]*=e,t[12]*=e,t[13]*=e,t[14]*=e,t[15]*=e,this}appendRotation(e,t){let a=R.getAxisRotation(t.x,t.y,t.z,e);this.append(a)}createByRotation(e,t){let a=R.helpMatrix,r,i,n=e*Dt;return r=Math.sin(n),i=Math.cos(n),t.x==1&&(a.rawData[0]=1,a.rawData[1]=0,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=i,a.rawData[6]=r,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=-r,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.y==1&&(a.rawData[0]=i,a.rawData[1]=0,a.rawData[2]=-r,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=1,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=r,a.rawData[9]=0,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.z==1&&(a.rawData[0]=i,a.rawData[1]=r,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=-r,a.rawData[5]=i,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=0,a.rawData[10]=1,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),this.append(a),this}appendScale(e,t,a){R.helpMatrix.createByScale(e,t,a),this.append(R.helpMatrix)}createByScale(e,t,a){let r=this.rawData;r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1}appendTranslation(e,t,a){let r=this.rawData;r[12]+=e,r[13]+=t,r[14]+=a}clone(){let e=new R;return e.copyFrom(this),e}copyRowFrom(e,t){let a=this.rawData;switch(e){case 0:a[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=t.w;break;case 1:a[4]=t.x,a[5]=t.y,a[6]=t.z,a[7]=t.w;break;case 2:a[8]=t.x,a[9]=t.y,a[10]=t.z,a[11]=t.w;break;case 3:a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=t.w;break}}copyRowTo(e,t){let a=this.rawData;switch(e){case 0:t.x=a[0],t.y=a[1],t.z=a[2],t.w=a[3];break;case 1:t.x=a[4],t.y=a[5],t.z=a[6],t.w=a[7];break;case 2:t.x=a[8],t.y=a[9],t.z=a[10],t.w=a[11];break;case 3:t.x=a[12],t.y=a[13],t.z=a[14],t.w=a[15];break}}copyFrom(e){let t=this.rawData;return t[0]=e.rawData[0],t[1]=e.rawData[1],t[2]=e.rawData[2],t[3]=e.rawData[3],t[4]=e.rawData[4],t[5]=e.rawData[5],t[6]=e.rawData[6],t[7]=e.rawData[7],t[8]=e.rawData[8],t[9]=e.rawData[9],t[10]=e.rawData[10],t[11]=e.rawData[11],t[12]=e.rawData[12],t[13]=e.rawData[13],t[14]=e.rawData[14],t[15]=e.rawData[15],this}copyRawDataTo(e,t=0,a=!1){let r=this.rawData;e[0+t]=r[0],e[1+t]=r[1],e[2+t]=r[2],e[3+t]=r[3],e[4+t]=r[4],e[5+t]=r[5],e[6+t]=r[6],e[7+t]=r[7],e[8+t]=r[8],e[9+t]=r[9],e[10+t]=r[10],e[11+t]=r[11],e[12+t]=r[12],e[13+t]=r[13],e[14+t]=r[14],e[15+t]=r[15]}copyColFrom(e,t){let a=this.rawData;switch(e){case 0:a[0]=t.x,a[4]=t.y,a[8]=t.z,a[12]=t.w;break;case 1:a[1]=t.x,a[5]=t.y,a[9]=t.z,a[13]=t.w;break;case 2:a[2]=t.x,a[6]=t.y,a[10]=t.z,a[14]=t.w;break;case 3:a[3]=t.x,a[7]=t.y,a[11]=t.z,a[15]=t.w;break}}copyColTo(e,t){let a=this.rawData;switch(e){case 0:t.x=a[0],t.y=a[4],t.z=a[8],t.w=a[12];break;case 1:t.x=a[1],t.y=a[5],t.z=a[9],t.w=a[13];break;case 2:t.x=a[2],t.y=a[6],t.z=a[10],t.w=a[14];break;case 3:t.x=a[3],t.y=a[7],t.z=a[11],t.w=a[15];break}}copyToMatrix3D(e){e.rawData=this.rawData.slice(0)}makeRotationFromQuaternion(e){return this.compose(R._zero,e,R._one),this}static decomposeRawData=new Float64Array(16).fill(0);decompose(e="eulerAngles",t){let a=se.CALCULATION_QUATERNION,r=t||R._prs;this.copyRawDataTo(R.decomposeRawData);let i=R.decomposeRawData,n=r[0];n.x=i[12],n.y=i[13],n.z=i[14],i[12]=0,i[13]=0,i[14]=0;let o=r[2];o.x=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]),o.y=Math.sqrt(i[4]*i[4]+i[5]*i[5]+i[6]*i[6]),o.z=Math.sqrt(i[8]*i[8]+i[9]*i[9]+i[10]*i[10]),i[0]*(i[5]*i[10]-i[6]*i[9])-i[1]*(i[4]*i[10]-i[6]*i[8])+i[2]*(i[4]*i[9]-i[5]*i[8])<0&&(o.z=-o.z),i[0]/=o.x,i[1]/=o.x,i[2]/=o.x,i[4]/=o.y,i[5]/=o.y,i[6]/=o.y,i[8]/=o.z,i[9]/=o.z,i[10]/=o.z;let l=r[1],c;switch(e){case na.AXIS_ANGLE:l.w=Math.acos((i[0]+i[5]+i[10]-1)/2);let f=Math.sqrt((i[6]-i[9])*(i[6]-i[9])+(i[8]-i[2])*(i[8]-i[2])+(i[1]-i[4])*(i[1]-i[4]));l.x=(i[6]-i[9])/f,l.y=(i[8]-i[2])/f,l.z=(i[1]-i[4])/f;break;case na.QUATERNION:c=i[0]+i[5]+i[10],c>0?(l.w=Math.sqrt(1+c)/2,l.x=(i[6]-i[9])/(4*l.w),l.y=(i[8]-i[2])/(4*l.w),l.z=(i[1]-i[4])/(4*l.w)):i[0]>i[5]&&i[0]>i[10]?(l.x=Math.sqrt(1+i[0]-i[5]-i[10])/2,l.w=(i[6]-i[9])/(4*l.x),l.y=(i[1]+i[4])/(4*l.x),l.z=(i[8]+i[2])/(4*l.x)):i[5]>i[10]?(l.y=Math.sqrt(1+i[5]-i[0]-i[10])/2,l.x=(i[1]+i[4])/(4*l.y),l.w=(i[8]-i[2])/(4*l.y),l.z=(i[6]+i[9])/(4*l.y)):(l.z=Math.sqrt(1+i[10]-i[0]-i[5])/2,l.x=(i[8]+i[2])/(4*l.z),l.y=(i[6]+i[9])/(4*l.z),l.w=(i[1]-i[4])/(4*l.z));break;case na.EULER_ANGLES:c=i[0]+i[5]+i[10],c>0?(a.w=Math.sqrt(1+c)/2,a.x=(i[6]-i[9])/(4*a.w),a.y=(i[8]-i[2])/(4*a.w),a.z=(i[1]-i[4])/(4*a.w)):i[0]>i[5]&&i[0]>i[10]?(a.x=Math.sqrt(1+i[0]-i[5]-i[10])/2,a.w=(i[6]-i[9])/(4*a.x),a.y=(i[1]+i[4])/(4*a.x),a.z=(i[8]+i[2])/(4*a.x)):i[5]>i[10]?(l.y=Math.sqrt(1+i[5]-i[0]-i[10])/2,a.x=(i[1]+i[4])/(4*a.y),a.w=(i[8]-i[2])/(4*a.y),a.z=(i[6]+i[9])/(4*a.y)):(a.z=Math.sqrt(1+i[10]-i[0]-i[5])/2,a.x=(i[8]+i[2])/(4*a.z),a.y=(i[6]+i[9])/(4*a.z),a.w=(i[1]-i[4])/(4*a.z)),a.getEulerAngles(l);break}return r[0]=n,r[1]=l,r[2]=o,r}static getEuler(e,t,a=!0,r){return e||=new b,R._getEulerMatrix.makeRotationFromQuaternion(t).makeEuler(e,a,r),e}compose(e,t,a){const r=this.rawData,i=t.x,n=t.y,o=t.z,l=t.w,c=i+i,f=n+n,d=o+o,h=i*c,u=i*f,m=i*d,g=n*f,p=n*d,D=o*d,A=l*c,B=l*f,v=l*d,U=a.x,y=a.y,S=a.z;return r[0]=(1-(g+D))*U,r[1]=(u+v)*U,r[2]=(m-B)*U,r[3]=0,r[4]=(u-v)*y,r[5]=(1-(h+D))*y,r[6]=(p+A)*y,r[7]=0,r[8]=(m+B)*S,r[9]=(p-A)*S,r[10]=(1-(h+g))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}deltaTransformVector(e,t){t||=new b;let a=this.rawData,r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t.w=r*a[3]+i*a[7]+n*a[11],t}identity(){let e=this.rawData;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}fill(e){let t=this.rawData;t[1]=e,t[2]=e,t[3]=e,t[4]=e,t[6]=e,t[7]=e,t[8]=e,t[9]=e,t[11]=e,t[12]=e,t[13]=e,t[14]=e,t[0]=e,t[5]=e,t[10]=e,t[15]=e}invers33(){let e=this.rawData,t=e[5]*e[10]-e[9]*e[6],a=e[8]*e[6]-e[4]*e[10],r=e[4]*e[9]-e[8]*e[5],i=e[9]*e[2]-e[1]*e[10],n=e[0]*e[10]-e[8]*e[2],o=e[8]*e[1]-e[0]*e[9],l=e[1]*e[6]-e[5]*e[2],c=e[4]*e[2]-e[0]*e[6],f=e[0]*e[5]-e[4]*e[1],d=e[0]*t+e[4]*i+e[8]*l;if(Math.abs(d)>1e-11){let h=1/d;e[0]=h*t,e[4]=h*a,e[8]=h*r,e[1]=h*i,e[5]=h*n,e[9]=h*o,e[2]=h*l,e[6]=h*c,e[10]=h*f}}invert(){let e=this.determinant,t=Math.abs(e)>1e-11,a=this.rawData;if(t){e=1/e;let r=a[0],i=a[4],n=a[8],o=a[12],l=a[1],c=a[5],f=a[9],d=a[13],h=a[2],u=a[6],m=a[10],g=a[14],p=a[3],D=a[7],A=a[11],B=a[15];a[0]=e*(c*(m*B-g*A)-f*(u*B-g*D)+d*(u*A-m*D)),a[1]=-e*(l*(m*B-g*A)-f*(h*B-g*p)+d*(h*A-m*p)),a[2]=e*(l*(u*B-g*D)-c*(h*B-g*p)+d*(h*D-u*p)),a[3]=-e*(l*(u*A-m*D)-c*(h*A-m*p)+f*(h*D-u*p)),a[4]=-e*(i*(m*B-g*A)-n*(u*B-g*D)+o*(u*A-m*D)),a[5]=e*(r*(m*B-g*A)-n*(h*B-g*p)+o*(h*A-m*p)),a[6]=-e*(r*(u*B-g*D)-i*(h*B-g*p)+o*(h*D-u*p)),a[7]=e*(r*(u*A-m*D)-i*(h*A-m*p)+n*(h*D-u*p)),a[8]=e*(i*(f*B-d*A)-n*(c*B-d*D)+o*(c*A-f*D)),a[9]=-e*(r*(f*B-d*A)-n*(l*B-d*p)+o*(l*A-f*p)),a[10]=e*(r*(c*B-d*D)-i*(l*B-d*p)+o*(l*D-c*p)),a[11]=-e*(r*(c*A-f*D)-i*(l*A-f*p)+n*(l*D-c*p)),a[12]=-e*(i*(f*g-d*m)-n*(c*g-d*u)+o*(c*m-f*u)),a[13]=e*(r*(f*g-d*m)-n*(l*g-d*h)+o*(l*m-f*h)),a[14]=-e*(r*(c*g-d*u)-i*(l*g-d*h)+o*(l*u-c*h)),a[15]=e*(r*(c*m-f*u)-i*(l*m-f*h)+n*(l*u-c*h))}return t}transformPoint(e,t){let a=this.rawData;t||=new b;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8]+a[12],t.y=r*a[1]+i*a[5]+n*a[9]+a[13],t.z=r*a[2]+i*a[6]+n*a[10]+a[14],t}transformVector(e,t){let a=this.rawData;t||=new b;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t}transpose(){let e=this.rawData;for(let t=0;t<R.helpMatrix.rawData.length;t++)R.helpMatrix.rawData[t]=e[t];e[1]=R.helpMatrix.rawData[4],e[2]=R.helpMatrix.rawData[8],e[3]=R.helpMatrix.rawData[12],e[4]=R.helpMatrix.rawData[1],e[6]=R.helpMatrix.rawData[9],e[7]=R.helpMatrix.rawData[13],e[8]=R.helpMatrix.rawData[2],e[9]=R.helpMatrix.rawData[6],e[11]=R.helpMatrix.rawData[14],e[12]=R.helpMatrix.rawData[3],e[13]=R.helpMatrix.rawData[7],e[14]=R.helpMatrix.rawData[11]}get determinant(){let e=this.rawData;return(e[0]*e[5]-e[4]*e[1])*(e[10]*e[15]-e[14]*e[11])-(e[0]*e[9]-e[8]*e[1])*(e[6]*e[15]-e[14]*e[7])+(e[0]*e[13]-e[12]*e[1])*(e[6]*e[11]-e[10]*e[7])+(e[4]*e[9]-e[8]*e[5])*(e[2]*e[15]-e[14]*e[3])-(e[4]*e[13]-e[12]*e[5])*(e[2]*e[11]-e[10]*e[3])+(e[8]*e[13]-e[12]*e[9])*(e[2]*e[7]-e[6]*e[3])}getPosition(e){e||=new b;let t=this.rawData;return e.x=t[12],e.y=t[13],e.z=t[14],e}get position(){return this._position.set(this.rawData[12],this.rawData[13],this.rawData[14]),this._position}set position(e){let t=this.rawData;t[12]=e.x,t[13]=e.y,t[14]=e.z}get scale(){let e=this.rawData;return new b(e[0],e[5],e[10])}set scale(e){let t=this.rawData;t[0]=e.x,t[5]=e.y,t[10]=e.z}toString(){let e=this.rawData;return"matrix3d("+Math.round(e[0]*1e3)/1e3+","+Math.round(e[1]*1e3)/1e3+","+Math.round(e[2]*1e3)/1e3+","+Math.round(e[3]*1e3)/1e3+","+Math.round(e[4]*1e3)/1e3+","+Math.round(e[5]*1e3)/1e3+","+Math.round(e[6]*1e3)/1e3+","+Math.round(e[7]*1e3)/1e3+","+Math.round(e[8]*1e3)/1e3+","+Math.round(e[9]*1e3)/1e3+","+Math.round(e[10]*1e3)/1e3+","+Math.round(e[11]*1e3)/1e3+","+Math.round(e[12]*1e3)/1e3+","+Math.round(e[13]*1e3)/1e3+","+Math.round(e[14]*1e3)/1e3+","+Math.round(e[15]*1e3)/1e3+")"}lerp(e,t,a){this.copyFrom(t).sub(e).mult(a).add(e)}get(e,t){return this.rawData[e+t*4]}set(e,t,a){this.rawData[e+t*4]=a}getMaxScaleOnAxis(){let e=this.rawData,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,a,r))}translate(e){let t=this.get(0,0)*e.x+this.get(0,1)*e.y+this.get(0,2)*e.z+this.get(0,3),a=this.get(1,0)*e.x+this.get(1,1)*e.y+this.get(1,2)*e.z+this.get(1,3),r=this.get(2,0)*e.x+this.get(2,1)*e.y+this.get(2,2)*e.z+this.get(2,3),i=this.get(3,0)*e.x+this.get(3,1)*e.y+this.get(3,2)*e.z+this.get(3,3);return this.set(0,3,t),this.set(1,3,a),this.set(2,3,r),this.set(3,3,i),this}setTRInverse(e,t){t=t.inverse(),se.quaternionToMatrix(t,this),this.translate(new b(-e.x,-e.y,-e.z))}setScale(e){return this.set(0,0,e.x),this.set(0,1,0),this.set(0,2,0),this.set(0,3,0),this.set(1,0,0),this.set(1,1,e.y),this.set(1,2,0),this.set(1,3,0),this.set(2,0,0),this.set(2,1,0),this.set(2,2,e.z),this.set(2,3,0),this.set(3,0,0),this.set(3,1,0),this.set(3,2,0),this.set(3,3,1),this}makeBasis(e,t,a){return this.setElements(e.x,t.x,a.x,0,e.y,t.y,a.y,0,e.z,t.z,a.z,0,0,0,0,1),this}makeRotationAxis(e,t){const a=Math.cos(t),r=Math.sin(t),i=1-a,n=e.x,o=e.y,l=e.z,c=i*n,f=i*o;return this.setElements(c*n+a,c*o-r*l,c*l+r*o,0,c*o+r*l,f*o+a,f*l-r*n,0,c*l-r*o,f*l+r*n,i*l*l+a,0,0,0,0,1),this}static transpose(e,t){t||=new R;let a=e.rawData,r=t.rawData;return r[0]=a[0],r[1]=a[4],r[2]=a[8],r[3]=a[12],r[4]=a[1],r[5]=a[5],r[6]=a[9],r[7]=a[13],r[8]=a[2],r[9]=a[6],r[10]=a[10],r[11]=a[14],r[12]=a[3],r[13]=a[7],r[14]=a[11],r[15]=a[15],t}static inverse(e,t){t||=new R;let a=e.rawData,r=t.rawData;r[0]=a[5]*a[10]*a[15]-a[5]*a[14]*a[11]-a[6]*a[9]*a[15]+a[6]*a[13]*a[11]+a[7]*a[9]*a[14]-a[7]*a[13]*a[10],r[1]=-a[1]*a[10]*a[15]+a[1]*a[14]*a[11]+a[2]*a[9]*a[15]-a[2]*a[13]*a[11]-a[3]*a[9]*a[14]+a[3]*a[13]*a[10],r[2]=a[1]*a[6]*a[15]-a[1]*a[14]*a[7]-a[2]*a[5]*a[15]+a[2]*a[13]*a[7]+a[3]*a[5]*a[14]-a[3]*a[13]*a[6],r[3]=-a[1]*a[6]*a[11]+a[1]*a[10]*a[7]+a[2]*a[5]*a[11]-a[2]*a[9]*a[7]-a[3]*a[5]*a[10]+a[3]*a[9]*a[6],r[4]=-a[4]*a[10]*a[15]+a[4]*a[14]*a[11]+a[6]*a[8]*a[15]-a[6]*a[12]*a[11]-a[7]*a[8]*a[14]+a[7]*a[12]*a[10],r[5]=a[0]*a[10]*a[15]-a[0]*a[14]*a[11]-a[2]*a[8]*a[15]+a[2]*a[12]*a[11]+a[3]*a[8]*a[14]-a[3]*a[12]*a[10],r[6]=-a[0]*a[6]*a[15]+a[0]*a[14]*a[7]+a[2]*a[4]*a[15]-a[2]*a[12]*a[7]-a[3]*a[4]*a[14]+a[3]*a[12]*a[6],r[7]=a[0]*a[6]*a[11]-a[0]*a[10]*a[7]-a[2]*a[4]*a[11]+a[2]*a[8]*a[7]+a[3]*a[4]*a[10]-a[3]*a[8]*a[6],r[8]=a[4]*a[9]*a[15]-a[4]*a[13]*a[11]-a[5]*a[8]*a[15]+a[5]*a[12]*a[11]+a[7]*a[8]*a[13]-a[7]*a[12]*a[9],r[9]=-a[0]*a[9]*a[15]+a[0]*a[13]*a[11]+a[1]*a[8]*a[15]-a[1]*a[12]*a[11]-a[3]*a[8]*a[13]+a[3]*a[12]*a[9],r[10]=a[0]*a[5]*a[15]-a[0]*a[13]*a[7]-a[1]*a[4]*a[15]+a[1]*a[12]*a[7]+a[3]*a[4]*a[13]-a[3]*a[12]*a[5],r[11]=-a[0]*a[5]*a[11]+a[0]*a[9]*a[7]+a[1]*a[4]*a[11]-a[1]*a[8]*a[7]-a[3]*a[4]*a[9]+a[3]*a[8]*a[5],r[12]=-a[4]*a[9]*a[14]+a[4]*a[13]*a[10]+a[5]*a[8]*a[14]-a[5]*a[12]*a[10]-a[6]*a[8]*a[13]+a[6]*a[12]*a[9],r[13]=a[0]*a[9]*a[14]-a[0]*a[13]*a[10]-a[1]*a[8]*a[14]+a[1]*a[12]*a[10]+a[2]*a[8]*a[13]-a[2]*a[12]*a[9],r[14]=-a[0]*a[5]*a[14]+a[0]*a[13]*a[6]+a[1]*a[4]*a[14]-a[1]*a[12]*a[6]-a[2]*a[4]*a[13]+a[2]*a[12]*a[5],r[15]=a[0]*a[5]*a[10]-a[0]*a[9]*a[6]-a[1]*a[4]*a[10]+a[1]*a[8]*a[6]+a[2]*a[4]*a[9]-a[2]*a[8]*a[5];let i=a[0]*r[0]+a[1]*r[4]+a[2]*r[8]+a[3]*r[12];for(let n=0;n<16;n++)r[n]/=i;return t}makeEuler(e,t,a="XYZ"){const r=this.rawData,i=r[0],n=r[4],o=r[8],l=r[1],c=r[5],f=r[9],d=r[2],h=r[6],u=r[10];switch(a){case"XYZ":e.y=Math.asin(Be(o,-1,1)),Math.abs(o)<.9999999?(e.x=Math.atan2(-f,u),e.z=Math.atan2(-n,i)):(e.x=Math.atan2(h,c),e.z=0);break;case"YXZ":e.x=Math.asin(-Be(f,-1,1)),Math.abs(f)<.9999999?(e.y=Math.atan2(o,u),e.z=Math.atan2(l,c)):(e.y=Math.atan2(-d,i),e.z=0);break;case"ZXY":e.x=Math.asin(Be(h,-1,1)),Math.abs(h)<.9999999?(e.y=Math.atan2(-d,u),e.z=Math.atan2(-n,c)):(e.y=0,e.z=Math.atan2(l,i));break;case"ZYX":e.y=Math.asin(-Be(d,-1,1)),Math.abs(d)<.9999999?(e.x=Math.atan2(h,u),e.z=Math.atan2(l,i)):(e.x=0,e.z=Math.atan2(-n,c));break;case"YZX":e.z=Math.asin(Be(l,-1,1)),Math.abs(l)<.9999999?(e.x=Math.atan2(-f,c),e.y=Math.atan2(-d,i)):(e.x=0,e.y=Math.atan2(o,u));break;case"XZY":e.z=Math.asin(-Be(n,-1,1)),Math.abs(n)<.9999999?(e.x=Math.atan2(h,c),e.y=Math.atan2(o,i)):(e.x=Math.atan2(-f,u),e.y=0);break}return t&&e.multiplyScalar($r),e}setElements(e,t,a,r,i,n,o,l,c,f,d,h,u,m,g,p){const D=this.rawData;return D[0]=e,D[4]=t,D[8]=a,D[12]=r,D[1]=i,D[5]=n,D[9]=o,D[13]=l,D[2]=c,D[6]=f,D[10]=d,D[14]=h,D[3]=u,D[7]=m,D[11]=g,D[15]=p,this}makeMatrix44ByQuaternion(e,t,a){this.identity(),se.quaternionToMatrix(a,this),this.appendTranslation(e.x,e.y,e.z),this.appendScale(t.x,t.y,t.z)}}function jc(s,e,t){for(let a=0;a<4;a++)t.rawData[a]=s.rawData[a]*e.rawData[0]+s.rawData[a+4]*e.rawData[1]+s.rawData[a+8]*e.rawData[2]+s.rawData[a+12]*e.rawData[3],t.rawData[a+4]=s.rawData[a]*e.rawData[4]+s.rawData[a+4]*e.rawData[5]+s.rawData[a+8]*e.rawData[6]+s.rawData[a+12]*e.rawData[7],t.rawData[a+8]=s.rawData[a]*e.rawData[8]+s.rawData[a+4]*e.rawData[9]+s.rawData[a+8]*e.rawData[10]+s.rawData[a+12]*e.rawData[11],t.rawData[a+12]=s.rawData[a]*e.rawData[12]+s.rawData[a+4]*e.rawData[13]+s.rawData[a+8]*e.rawData[14]+s.rawData[a+12]*e.rawData[15]}function Es(s,e,t,a){let r=a.rawData,i=s.x*Dt,n=s.y*Dt,o=s.z*Dt,l=0,c=i*.5,f=n*.5,d=o*.5,h=Math.cos(c),u=Math.sin(c),m=Math.cos(f),g=Math.sin(f),p=Math.cos(d),D=Math.sin(d);l=h*m*p+u*g*D,i=u*m*p-h*g*D,n=h*g*p+u*m*D,o=h*m*D-u*g*p;let A=i+i,B=n+n,v=o+o,U=i*A,y=i*B,S=i*v,F=n*B,C=n*v,w=o*v,E=l*A,Q=l*B,T=l*v,j=t.x,ue=t.y,ee=t.z;r[0]=(1-(F+w))*j,r[1]=(y+T)*j,r[2]=(S-Q)*j,r[3]=0,r[4]=(y-T)*ue,r[5]=(1-(U+w))*ue,r[6]=(C+E)*ue,r[7]=0,r[8]=(S+Q)*ee,r[9]=(C-E)*ee,r[10]=(1-(U+F))*ee,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1}function Zc(s,e,t){let a=s.rawData,r=t.rawData,i=a[0],n=a[4],o=a[8],l=a[12],c=a[1],f=a[5],d=a[9],h=a[13],u=a[2],m=a[6],g=a[10],p=a[14],D=a[3],A=a[7],B=a[11],v=a[15];r[0]=i*e.rawData[0]+c*e.rawData[4]+u*e.rawData[8]+D*e.rawData[12],r[1]=i*e.rawData[1]+c*e.rawData[5]+u*e.rawData[9]+D*e.rawData[13],r[2]=i*e.rawData[2]+c*e.rawData[6]+u*e.rawData[10]+D*e.rawData[14],r[3]=i*e.rawData[3]+c*e.rawData[7]+u*e.rawData[11]+D*e.rawData[15],r[4]=n*e.rawData[0]+f*e.rawData[4]+m*e.rawData[8]+A*e.rawData[12],r[5]=n*e.rawData[1]+f*e.rawData[5]+m*e.rawData[9]+A*e.rawData[13],r[6]=n*e.rawData[2]+f*e.rawData[6]+m*e.rawData[10]+A*e.rawData[14],r[7]=n*e.rawData[3]+f*e.rawData[7]+m*e.rawData[11]+A*e.rawData[15],r[8]=o*e.rawData[0]+d*e.rawData[4]+g*e.rawData[8]+B*e.rawData[12],r[9]=o*e.rawData[1]+d*e.rawData[5]+g*e.rawData[9]+B*e.rawData[13],r[10]=o*e.rawData[2]+d*e.rawData[6]+g*e.rawData[10]+B*e.rawData[14],r[11]=o*e.rawData[3]+d*e.rawData[7]+g*e.rawData[11]+B*e.rawData[15],r[12]=l*e.rawData[0]+h*e.rawData[4]+p*e.rawData[8]+v*e.rawData[12],r[13]=l*e.rawData[1]+h*e.rawData[5]+p*e.rawData[9]+v*e.rawData[13],r[14]=l*e.rawData[2]+h*e.rawData[6]+p*e.rawData[10]+v*e.rawData[14],r[15]=l*e.rawData[3]+h*e.rawData[7]+p*e.rawData[11]+v*e.rawData[15]}function E2(s,e){let t=e.x,a=e.y,r=e.z,i=e.w,n=s.rawData,o=2*t*a,l=2*t*r,c=2*t*i,f=2*a*r,d=2*a*i,h=2*r*i,u=t*t,m=a*a,g=r*r,p=i*i;return n[0]=u-m-g+p,n[4]=o-h,n[8]=l+d,n[12]=0,n[1]=o+h,n[5]=-u+m-g+p,n[9]=f-c,n[13]=0,n[2]=l-d,n[6]=f+c,n[10]=-u-m+g+p,n[14]=0,n[3]=0,n[7]=0,n[11]=0,n[15]=1,s}function w2(s,e){let t=e.rawData,a=Math.sin(s),r=Math.cos(s);return t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[8]=a,t[9]=0,t[10]=r,t[11]=0,t}function I2(s,e,t){let a=e.x,r=e.y,i=e.z,n=Math.hypot(a,r,i),o,l,c,f,d,h,u,m,g,p,D,A;if(n<k2)return null;n=1/n,a*=n,r*=n,i*=n,o=Math.sin(s),l=Math.cos(s),c=1-l,f=a*a*c+l,d=r*a*c+i*o,h=i*a*c-r*o,u=a*r*c-i*o,m=r*r*c+l,g=i*r*c+a*o,p=a*i*c+r*o,D=r*i*c-a*o,A=i*i*c+l;let B=t.rawData;return B[0]=f,B[1]=d,B[2]=h,B[3]=0,B[4]=u,B[5]=m,B[6]=g,B[7]=0,B[8]=p,B[9]=D,B[10]=A,B[11]=0,B[12]=0,B[13]=0,B[14]=0,B[15]=1,B}function Vn(s,e,t){let a=s.rawData,r=a[0],i=a[1],n=a[2],o=a[3],l=a[4],c=a[5],f=a[6],d=a[7],h=a[8],u=a[9],m=a[10],g=a[11],p=a[12],D=a[13],A=a[14],B=a[15],v=e.rawData,U=t.rawData,y=v[0],S=v[1],F=v[2],C=v[3];return U[0]=y*r+S*l+F*h+C*p,U[1]=y*i+S*c+F*u+C*D,U[2]=y*n+S*f+F*m+C*A,U[3]=y*o+S*d+F*g+C*B,y=v[4],S=v[5],F=v[6],C=v[7],U[4]=y*r+S*l+F*h+C*p,U[5]=y*i+S*c+F*u+C*D,U[6]=y*n+S*f+F*m+C*A,U[7]=y*o+S*d+F*g+C*B,y=v[8],S=v[9],F=v[10],C=v[11],U[8]=y*r+S*l+F*h+C*p,U[9]=y*i+S*c+F*u+C*D,U[10]=y*n+S*f+F*m+C*A,U[11]=y*o+S*d+F*g+C*B,y=v[12],S=v[13],F=v[14],C=v[15],U[12]=y*r+S*l+F*h+C*p,U[13]=y*i+S*c+F*u+C*D,U[14]=y*n+S*f+F*m+C*A,U[15]=y*o+S*d+F*g+C*B,U}var ht=(s=>(s[s.None=0]="None",s[s.PointLight=1]="PointLight",s[s.DirectionLight=2]="DirectionLight",s[s.SpotLight=3]="SpotLight",s[s.SkyLight=4]="SkyLight",s))(ht||{});class ws extends vi{static lightSize=24;index=-1;lightType=-1;radius=.001;linear=8;lightPosition=new b;lightMatrixIndex=-1;direction=new b;quadratic=.032;lightColor=new J(1,1,1,1);intensity=1;innerAngle=0;outerAngle=1;range=100;castShadowIndex=-1;lightTangent=b.FORWARD;iesIndex=-1}class Oe{static componentsUpdateList;static componentsLateUpdateList;static componentsBeforeUpdateList;static componentsComputeList;static componentsEnablePickerList;static graphicComponent;static waitStartComponent;static _init=!1;static init(){this._init||(this._init=!0,this.componentsUpdateList=new Map,this.componentsLateUpdateList=new Map,this.componentsBeforeUpdateList=new Map,this.componentsComputeList=new Map,this.componentsEnablePickerList=new Map,this.graphicComponent=new Map,this.waitStartComponent=new Map)}static bindUpdate(e,t,a){this.init();let r=this.componentsUpdateList.get(e);r||(r=new Map,this.componentsUpdateList.set(e,r)),r.set(t,a)}static unBindUpdate(e,t){this.init();let a=this.componentsUpdateList.get(e);a&&a.delete(t)}static bindLateUpdate(e,t,a){this.init();let r=this.componentsLateUpdateList.get(e);r||(r=new Map,this.componentsLateUpdateList.set(e,r)),r.set(t,a)}static unBindLateUpdate(e,t){this.init();let a=this.componentsLateUpdateList.get(e);a&&a.delete(t)}static bindBeforeUpdate(e,t,a){this.init();let r=this.componentsBeforeUpdateList.get(e);r||(r=new Map,this.componentsBeforeUpdateList.set(e,r)),r.set(t,a)}static unBindBeforeUpdate(e,t){this.init();let a=this.componentsBeforeUpdateList.get(e);a&&a.delete(t)}static bindCompute(e,t,a){this.init();let r=this.componentsComputeList.get(e);r||(r=new Map,this.componentsComputeList.set(e,r)),r.set(t,a)}static unBindCompute(e,t){this.init();let a=this.componentsComputeList.get(e);a&&a.delete(t)}static bindGraphic(e,t,a){this.init();let r=this.graphicComponent.get(e);r||(r=new Map,this.graphicComponent.set(e,r)),r.set(t,a)}static unBindGraphic(e,t){this.init();let a=this.graphicComponent.get(e);a&&a.delete(t)}static appendWaitStart(e){this.init();let t=this.waitStartComponent.get(e.object3D);t?t.indexOf(e)==-1&&t.push(e):this.waitStartComponent.set(e.object3D,[e])}static removeWaitStart(e,t){this.init();let a=Oe.waitStartComponent.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r)}}static bindEnablePick(e,t,a){this.init();let r=this.componentsEnablePickerList.get(e);r||(r=new Map,this.componentsEnablePickerList.set(e,r)),r.set(t,a)}static unBindEnablePick(e,t){this.init();let a=this.componentsEnablePickerList.get(e);a&&a.delete(t)}}class et{object3D=null;_eventDispatcher;get eventDispatcher(){return this._eventDispatcher||=new Za,this._eventDispatcher}set eventDispatcher(e){console.error("The eventDispatcher should not be set externally!")}_enable=!0;__isStart=!1;isDestroyed=!1;get isStart(){return this.__isStart}get transform(){return this.object3D.transform}set enable(e){this._enable!=e&&(this._enable=e,this._enable?this.onEnable?.(this.transform.view3D):this.onDisable?.(this.transform.view3D))}get enable(){return this._enable}__init(e){this.init(e)}__start(){this.transform&&this.transform.scene3D&&this._enable&&this.onEnable?.(this.transform.view3D),this.transform&&this.transform.scene3D&&this.__isStart==!1&&(this.start?.(),this.__isStart=!0),this.onUpdate&&this._onUpdate(this.onUpdate.bind(this)),this.onLateUpdate&&this._onLateUpdate(this.onLateUpdate.bind(this)),this.onBeforeUpdate&&this._onBeforeUpdate(this.onBeforeUpdate.bind(this)),this.onCompute&&this._onCompute(this.onCompute.bind(this)),this.onGraphic&&this._onGraphic(this.onGraphic.bind(this))}__stop(){this.transform&&this.transform.scene3D&&this.onDisable?.(this.transform.view3D),this._onUpdate(null),this._onLateUpdate(null),this._onBeforeUpdate(null),this._onCompute(null),this._onGraphic(null)}init(e){}start(){}stop(){}cloneTo(e){}copyComponent(e){return this}_onUpdate(e){e!=null?Oe.bindUpdate(this.transform.view3D,this,e):Oe.unBindUpdate(this.transform.view3D,this)}_onLateUpdate(e){e!=null?Oe.bindLateUpdate(this.transform.view3D,this,e):Oe.unBindLateUpdate(this.transform.view3D,this)}_onBeforeUpdate(e){e!=null?Oe.bindBeforeUpdate(this.transform.view3D,this,e):Oe.unBindBeforeUpdate(this.transform.view3D,this)}_onCompute(e){e!=null?Oe.bindCompute(this.transform.view3D,this,e):Oe.unBindCompute(this.transform.view3D,this)}_onGraphic(e){e!=null?Oe.bindGraphic(this.transform.view3D,this,e):Oe.unBindGraphic(this.transform.view3D,this)}beforeDestroy(e){Oe.removeWaitStart(this.object3D,this)}destroy(e){this.isDestroyed||(this.isDestroyed=!0,this.enable=!1,this.stop(),this._onBeforeUpdate(null),this._onUpdate(null),this._onLateUpdate(null),this.onEnable=null,this.onDisable=null,this.onUpdate=null,this.onLateUpdate=null,this.onBeforeUpdate=null,this.onCompute=null,this.onGraphic=null)}}class Is{value=0;inv_base=0;static get(e,t){let a=0,r=1/t;for(;e>0;)a+=e%t*r,e/=t,r/=t;return a}getBase(e,t){let a=this.inv_base=1/t;for(;e>0;)this.value+=a*(e%t),e/=t,a*=this.inv_base}next(){let e=1-this.value-1e-7;if(this.inv_base<e)this.value+=this.inv_base;else{let t=this.inv_base,a;do a=t,t*=this.inv_base;while(t>=e);this.value+=a+t-1}}get(){return this.value}}class ua{origin=new b;length=Number.MAX_VALUE;static _rayl=1e9;static _smallnum=1e-8;_vector=new b;_dir=new b;constructor(e,t){this.origin.copyFrom(e||new b),this._dir.copyFrom(t||new b),this._dir.normalize()}get direction(){return this._dir}set direction(e){this._dir.copyFrom(e),this._dir.normalize()}clone(){return new ua(this.origin,this.direction)}intersectBox(e,t){let a=this.direction,r=this.origin,i,n,o,l,c,f;const d=1/a.x,h=1/a.y,u=1/a.z,m=e.min,g=e.max;return i=((d>=0?m.x:g.x)-r.x)*d,n=((d>=0?g.x:m.x)-r.x)*d,o=((h>=0?m.y:g.y)-r.y)*h,l=((h>=0?g.y:m.y)-r.y)*h,i>l||o>n||(o>i&&(i=o),l<n&&(n=l),c=((u>=0?m.z:g.z)-r.z)*u,f=((u>=0?g.z:m.z)-r.z)*u,i>f||c>n)||(c>i&&(i=c),f<n&&(n=f),n<0)?null:(t||=new b,this.pointAt(i>=0?i:n,t))}pointAt(e,t){return t||=new b,t.copy(this.direction),t.multiplyScalar(e),t.add(this.origin,t),t}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this._dir.copy(e._dir),this.length=e.length,this}setApproxDirection(e){this._dir=e.normalize()}setOrigin(e){this.origin.copyFrom(e)}getOrigin(){return this.origin}getPoint(e){return this._dir.scaleBy(e),this.origin.add(this._dir)}sqrDistToPoint(e){let t=this._dir,a=e.subtract(this.origin),r=Ft(a,t),i=Ft(t,t),n=r/i,o=this.getPoint(n);return Nn(e.subtract(o))}applyMatrix(e){this.origin=e.transformPoint(this.origin),this._dir=e.transformVector(this._dir)}_v0=new b;_v1=new b;_v2=new b;pointInTriangle(e,t,a,r){let i=this._v0,n=this._v1,o=this._v2;r.subtract(t,i),a.subtract(t,n),e.subtract(t,o);let l=b.dot(i,i),c=b.dot(i,n),f=b.dot(i,o),d=b.dot(n,n),h=b.dot(n,o),u=1/(l*d-c*c),m=(d*f-c*h)*u,g=(l*h-c*f)*u;return m>=0&&g>=0&&m+g<1}_E1=new b;_E2=new b;_P=new b;_T=new b;_Q=new b;intersectTriangle(e,t,a){let r=a.v1,i=a.v2,n=a.v3;i.subtract(r,this._E1),n.subtract(r,this._E2),t.crossProduct(this._E2,this._P);let o=this._E1.dotProduct(this._P);if(o>0?e.subtract(r,this._T):(r.subtract(e,this._T),o=-o),o<1e-4||(a.u=this._T.dotProduct(this._P),a.u<0||a.u>o)||(this._T.crossProduct(this._E1,this._Q),a.v=t.dotProduct(this._Q),a.v<0||a.u+a.v>o))return null;let l=new b;a.t0=a.t=this._E2.dotProduct(this._Q);let c=1/o;return a.t*=c,a.u*=c,a.v*=c,l.x=e.x+a.t*t.x,l.y=e.y+a.t*t.y,l.z=e.z+a.t*t.z,l}intersectSphere(e,t,a,r){let i=e.subtract(a),n=b.dot(t,t),o=2*b.dot(i,t),l=b.dot(i,i)-r*r,c=o*o-4*n*l,f=b.HELP_3;if(c<0)return null;{let d=(-o-Math.sqrt(c))/(n*2);return d<0?null:(f.x=e.x+d*t.x,f.y=e.y+d*t.y,f.z=e.z+d*t.z,f)}}intersectionSegment(e,t,a){const r=this.origin,i=b.HELP_0,n=b.HELP_1,o=b.HELP_2,l=b.HELP_3;t.subtract(e,i),this._dir.scaleToRef(ua._rayl,o),r.add(o,n),e.subtract(r,l);var c=b.dot(i,i),f=b.dot(i,o),d=b.dot(o,o),h=b.dot(i,l),u=b.dot(o,l),m=c*d-f*f,g,p,D=m,A,B,v=m;m<ua._smallnum?(p=0,D=1,B=u,v=d):(p=f*u-d*h,B=c*u-f*h,p<0?(p=0,B=u,v=d):p>D&&(p=D,B=u+f,v=d)),B<0?(B=0,-h<0?p=0:-h>c?p=D:(p=-h,D=c)):B>v&&(B=v,-h+f<0?p=0:-h+f>c?p=D:(p=-h+f,D=c)),g=Math.abs(p)<ua._smallnum?0:p/D,A=Math.abs(B)<ua._smallnum?0:B/v;const U=b.HELP_4;o.scaleToRef(A,U);const y=b.HELP_5;i.scaleToRef(g,y),y.add(l,y);const S=b.HELP_6;y.subtract(U,S);var F=A>0&&A<=this._dir.length&&S.lengthSquared<a*a;if(F){let C=new b;return C.copyFrom(t.subtract(e)),C.scaleBy(g),C.add(e,C),{out:C,length:y.length}}return{out:null,length:-1}}get_vec(e,t){let a=b.HELP_1;return a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}}class ps{x;y;w;h;constructor(e=0,t=0,a=0,r=0){this.x=e,this.y=t,this.w=a,this.h=r}get width(){return this.w}set width(e){this.w=e}get height(){return this.h}set height(e){this.h=e}static pointInRect(e,t,a,r,i,n){return!(e<a||e>i||t<r||t>n)}clone(){return new ps(this.x,this.y,this.w,this.h)}copyFrom(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}copyTo(e){e.copyFrom(this)}inner(e,t){return!(e<this.x||e>this.x+this.width||t<this.y||t>this.y+this.height)}equal(e){return!(this.x!=e.x||this.y!=e.y||this.width!=e.width||this.height!=e.height)}equalArea(e,t,a,r){return!(this.x!=e||this.y!=t||this.width!=a||this.height!=r)}equalInnerArea(e){var t=this.x,a=this.y,r=this.x+this.width,i=this.y+this.height,n=e.x,o=e.y,l=e.x+e.width,c=e.y+e.height;return Math.max(t,n)<=Math.min(r,l)&&Math.max(a,o)<=Math.min(i,c)}innerArea(e,t){t=t||new ps;var a=this.x,r=this.y,i=this.x+this.width,n=this.y+this.height,o=e.x,l=e.y,c=e.x+e.width,f=e.y+e.height,d=Math.max(r,l),h=Math.min(n,f),u=Math.max(a,o),m=Math.min(c,i);return d>=0&&h>=0&&h-d>=0&&m-u>0?(t.x=u,t.y=d,t.width=m-u,t.height=h-d):(t.x=0,t.y=0,t.width=0,t.height=0),t}setTo(e,t,a,r){this.x=e,this.y=t,this.width=a,this.height=r}}class Ce{center;extents;max;min;size;static maxVector3=new b(1,1,1).multiplyScalar(Number.MAX_VALUE*.1);static minVector3=new b(1,1,1).multiplyScalar(-Number.MAX_VALUE*.1);constructor(e,t){e||=b.ZERO.clone(),t||=b.ZERO.clone(),this.setFromCenterAndSize(e,t)}makeEmpty(){return this.setFromMinMax(Ce.maxVector3,Ce.minVector3),this}setFromMinMax(e,t){return this.init(),this.min.copyFrom(e),this.max.copyFrom(t),this.max.subtract(this.min,this.size),this.extents.copyFrom(this.size).multiplyScalar(.5),this.min.add(this.max,this.center).multiplyScalar(.5),this}init(){return this.min||=new b,this.max||=new b,this.size||=new b,this.center||=new b,this.extents||=new b,this}setFromCenterAndSize(e,t){return this.init(),this.center.copyFrom(e),this.size.copyFrom(t),this.extents.copyFrom(this.size).multiplyScalar(.5),this.center.subtract(this.extents,this.min),this.center.add(this.extents,this.max),this}inFrustum(e,t){return t.containsBox(e.bound)}merge(e){e.min.x<this.min.x&&(this.min.x=e.min.x),e.min.y<this.min.y&&(this.min.y=e.min.y),e.min.z<this.min.z&&(this.min.z=e.min.z),e.max.x>this.max.x&&(this.max.x=e.max.x),e.max.y>this.max.y&&(this.max.y=e.max.y),e.max.z>this.max.z&&(this.max.z=e.max.z),this.size.x=this.max.x-this.min.x,this.size.y=this.max.y-this.min.y,this.size.z=this.max.z-this.min.z,this.extents.x=this.size.x*.5,this.extents.y=this.size.y*.5,this.extents.z=this.size.z*.5,this.center.x=this.min.x+this.extents.x,this.center.y=this.min.y+this.extents.y,this.center.z=this.min.z+this.extents.z}intersects(e){return this.min.x<=e.max.x&&this.max.x>=e.min.x&&this.min.y<=e.max.y&&this.max.y>=e.min.y&&this.min.z<=e.max.z&&this.max.z>=e.min.z}intersectsSphere(e){return this.min.x<=e.max.x&&this.max.x>=e.min.x&&this.min.y<=e.max.y&&this.max.y>=e.min.y&&this.min.z<=e.max.z&&this.max.z>=e.min.z}intersectsBox(e){return this.min.x<=e.max.x&&this.max.x>=e.min.x&&this.min.y<=e.max.y&&this.max.y>=e.min.y&&this.min.z<=e.max.z&&this.max.z>=e.min.z}equals(e){return this.center.equals(e.center)&&this.extents.equals(e.extents)}expandByPoint(e){e.x<this.min.x&&(this.min.x=e.x),e.x>this.max.x&&(this.max.x=e.x),e.y<this.min.y&&(this.min.y=e.y),e.y>this.max.y&&(this.max.y=e.y),e.z<this.min.z&&(this.min.z=e.z),e.z>this.max.z&&(this.max.z=e.z),this.size.x=this.max.x-this.min.x,this.size.y=this.max.y-this.min.y,this.size.z=this.max.z-this.min.z,this.extents.x=this.size.x*.5,this.extents.y=this.size.y*.5,this.extents.z=this.size.z*.5,this.center.x=this.min.x+this.extents.x,this.center.y=this.min.y+this.extents.y,this.center.z=this.min.z+this.extents.z}static fromPoints(e){for(var t=new Ce(new b,new b),a=0;a<e.length;a++)t.expandByPoint(e[a]);return t}calculateTransform(e){}clone(){var e=new Ce(this.center.clone(),this.size.clone());return e}intersectsRay(e,t){throw new Error("Method not implemented.")}containsPoint(e){return this.min.x<=e.x&&this.max.x>=e.x&&this.min.y<=e.y&&this.max.y>=e.y&&this.min.z<=e.z&&this.max.z>=e.z}containsBox(e){let t=this.min,a=this.max;return t.x<=e.min.x&&t.y<=e.min.y&&t.z<=e.min.z&&a.x>=e.max.x&&a.y>=e.max.y&&a.z>=e.max.z}updateBound(){}destroy(e){this.center=null,this.extents=null,this.min=null,this.max=null,this.size=null}}class On{planes;corners;boundingBox=new Ce;constructor(){this.planes=[],this.corners=[];for(var e=0;e<6;e++)this.planes[e]=new b;for(var e=0;e<8;e++)this.corners[e]=new b}updateBoundBox(e){this.boundingBox.makeEmpty();let t=this.boundingBox.min,a=this.boundingBox.max,r=0;for(let i=0;i<2;++i)for(let n=0;n<2;++n)for(let o=0;o<2;++o){let l=this.corners[r];r++,l.set(2*i-1,2*n-1,o,1),e.transformVector4(l,l),l.div(l.w,l),t.x=Math.min(l.x,t.x),t.y=Math.min(l.y,t.y),t.z=Math.min(l.z,t.z),a.x=Math.max(l.x,a.x),a.y=Math.max(l.y,a.y),a.z=Math.max(l.z,a.z)}return this.boundingBox.setFromMinMax(t,a),this}setFrustumCorners(e){let t=0;for(let a=0;a<2;++a)for(let r=0;r<2;++r)for(let i=0;i<2;++i){let n=this.corners[t];n.set(2*a-1,2*r-1,i,1),e.transformVector4(n,n),n.div(n.w,n),t++}}update(e){var t=e.rawData;this.planes[0].x=t[3]-t[0],this.planes[0].y=t[7]-t[4],this.planes[0].z=t[11]-t[8],this.planes[0].w=t[15]-t[12];var a=Math.sqrt(this.planes[0].x*this.planes[0].x+this.planes[0].y*this.planes[0].y+this.planes[0].z*this.planes[0].z);this.planes[0].x/=a,this.planes[0].y/=a,this.planes[0].z/=a,this.planes[0].w/=a,this.planes[1].x=t[3]+t[0],this.planes[1].y=t[7]+t[4],this.planes[1].z=t[11]+t[8],this.planes[1].w=t[15]+t[12],a=Math.sqrt(this.planes[1].x*this.planes[1].x+this.planes[1].y*this.planes[1].y+this.planes[1].z*this.planes[1].z),this.planes[1].x/=a,this.planes[1].y/=a,this.planes[1].z/=a,this.planes[1].w/=a,this.planes[2].x=t[3]+t[1],this.planes[2].y=t[7]+t[5],this.planes[2].z=t[11]+t[9],this.planes[2].w=t[15]+t[13],a=Math.sqrt(this.planes[2].x*this.planes[2].x+this.planes[2].y*this.planes[2].y+this.planes[2].z*this.planes[2].z),this.planes[2].x/=a,this.planes[2].y/=a,this.planes[2].z/=a,this.planes[2].w/=a,this.planes[3].x=t[3]-t[1],this.planes[3].y=t[7]-t[5],this.planes[3].z=t[11]-t[9],this.planes[3].w=t[15]-t[13],a=Math.sqrt(this.planes[3].x*this.planes[3].x+this.planes[3].y*this.planes[3].y+this.planes[3].z*this.planes[3].z),this.planes[3].x/=a,this.planes[3].y/=a,this.planes[3].z/=a,this.planes[3].w/=a,this.planes[4].x=t[3]-t[2],this.planes[4].y=t[7]-t[6],this.planes[4].z=t[11]-t[10],this.planes[4].w=t[15]-t[14],a=Math.sqrt(this.planes[4].x*this.planes[4].x+this.planes[4].y*this.planes[4].y+this.planes[4].z*this.planes[4].z),this.planes[4].x/=a,this.planes[4].y/=a,this.planes[4].z/=a,this.planes[4].w/=a,this.planes[5].x=t[3]+t[2],this.planes[5].y=t[7]+t[6],this.planes[5].z=t[11]+t[10],this.planes[5].w=t[15]+t[14],a=Math.sqrt(this.planes[5].x*this.planes[5].x+this.planes[5].y*this.planes[5].y+this.planes[5].z*this.planes[5].z),this.planes[5].x/=a,this.planes[5].y/=a,this.planes[5].z/=a,this.planes[5].w/=a}containsPoint(e){for(var t=0;t<6;t++)if(this.planes[t].x*e.x+this.planes[t].y*e.y+this.planes[t].z*e.z+this.planes[t].w<=0)return!1;return!0}containsSphere(e){let t=e.bound,a=0,r,i=e.transform.worldPosition,n=t.radius,o=t.center.x+i.x,l=t.center.y+i.y,c=t.center.z+i.z;for(let f of this.planes){if(r=f.x*o+f.y*l+f.z*c+f.w,r<=-n)return 0;r>n&&a++}return a===6?2:1}containsBox(e){let t=0,a,i=Math.max(e.size.x,e.size.y,e.size.z)*2,n=e.center.x,o=e.center.y,l=e.center.z;for(let c of this.planes){if(a=c.x*n+c.y*o+c.z*l+c.w,a<=-i)return 0;a>i&&t++}return t===6?2:1}containsBox2(e){let t=0,a,r=1.74*Math.max(e.extents.x,e.extents.y,e.extents.z);for(let i of this.planes){if(a=i.x*e.center.x+i.y*e.center.y+i.z*e.center.z+i.w,a<=-r)return 0;a>r&&t++}return t===6?2:1}containsBoxPrecise(e){const t=[new b(e.min.x,e.min.y,e.min.z),new b(e.max.x,e.min.y,e.min.z),new b(e.min.x,e.max.y,e.min.z),new b(e.max.x,e.max.y,e.min.z),new b(e.min.x,e.min.y,e.max.z),new b(e.max.x,e.min.y,e.max.z),new b(e.min.x,e.max.y,e.max.z),new b(e.max.x,e.max.y,e.max.z)];let a=0;for(let r=0;r<6;r++){const i=this.planes[r];let n=-1/0,o=1/0;for(let l=0;l<8;l++){const c=t[l],f=i.x*c.x+i.y*c.y+i.z*c.z+i.w;n=Math.max(n,f),o=Math.min(o,f)}if(n<0)return 0;o>0&&a++}return a===6?2:1}}var nt=(s=>(s[s.ortho=0]="ortho",s[s.perspective=1]="perspective",s[s.shadow=2]="shadow",s))(nt||{});class R2{corners;index;constructor(e){this.index=e,this.corners=[];for(let t=0;t<4;t++)this.corners.push(new b)}}class Q2{bound;twoSections;name;color;shadowCamera;index;constructor(e,t,a){this.bound=new Ce,this.shadowCamera=bt.createCamera3DObject(null,"csmShadowCamera_"+a),this.shadowCamera.isShadowCamera=!0,this.shadowCamera.orthoOffCenter(100,-100,100,-100,1,1e4),this.twoSections=[e,t],this.index=a,a==0?this.color=new J(1,0,0,1):a==1?this.color=new J(0,1,0,1):a==2?this.color=new J(0,0,1,1):a==3&&(this.color=new J(0,1,1,1)),this.name="child_"+a}updateBound(){this.bound.makeEmpty();let e=this.bound.min,t=this.bound.max;for(let a of this.twoSections)for(let r of a.corners)e.x=Math.min(r.x,e.x),e.y=Math.min(r.y,e.y),e.z=Math.min(r.z,e.z),t.x=Math.max(r.x,t.x),t.y=Math.max(r.y,t.y),t.z=Math.max(r.z,t.z);return this.bound.setFromMinMax(e,t),this}}class Yc{sections;children;name;constructor(e){this.sections=[];let t=e+1;for(let a=0;a<t;a++)this.sections.push(new R2(a));this.children=[];for(let a=0;a<e;a++)this.children.push(new Q2(this.sections[a],this.sections[a+1],a))}update(e,t,a,r,i){let n=this.sections.length-1;for(let o=0;o<=n;++o){let l=this.sections[o],c=0,f=this.logSplit(a,r,o,this.sections.length);{let h=(f-a)/r;h=h**i.csmScatteringExp,f=(r-a)*h+a}f*=i.csmAreaScale;let d=(e.rawData[10]*f+e.rawData[14])/f;for(let h=0;h<2;++h)for(let u=0;u<2;++u){let m=l.corners[c];c++,m.set(2*h-1,2*u-1,d,1),t.transformVector4(m,m),m.div(m.w,m)}}for(let o of this.children)o.updateBound();return this}squareSplit(e,t,a,r){return(a/(r-1))**4*(t-e)+e}uniformSplit(e,t,a,r){return a/(r-1)*(t-e)+e}logSplit(e,t,a,r){return e*(t/e)**(a/(r-1))}}class ti extends et{fov=60;name;aspect=1;near=1;far=5e3;left=-100;right=100;top=100;bottom=-100;frustumSize=100;viewPort=new ps;frustum;sh=new Float32Array(36);isShadowCamera=!1;_projectionMatrixInv=new R;_projectionMatrix=new R;_viewMatrix=new R;_viewMatrixInv=new R;_unprojection=new R;_pvMatrixInv=new R;_pvMatrix=new R;_halfw;_halfh;_ray;_enableCSM=!1;mainCamera;get projectionMatrix(){return this._projectionMatrix}lookTarget;type=nt.perspective;csm;cubeShadowCameras=[];get enableCSM(){return this._enableCSM}set enableCSM(e){e&&!this.csm&&(this.csm=new Yc(sa.Cascades)),this._enableCSM=e}constructor(){super()}init(){super.init(),this._ray=new ua,this.frustum=new On,this.lookTarget=new b(0,0,0),this.viewPort.x=0,this.viewPort.y=0,this.viewPort.w=I.presentationSize[0],this.viewPort.h=I.presentationSize[1],this.updateProjection(),I.addEventListener(lr.RESIZE,this.updateProjection,this)}updateProjection(){this.aspect=I.aspect,this.type==nt.perspective?this.perspective(this.fov,this.aspect,this.near,this.far):this.type==nt.ortho&&(this.frustumSize?this.ortho(this.frustumSize,this.near,this.far):this.orthoOffCenter(this.left,this.right,this.bottom,this.top,this.near,this.far))}getShadowBias(e){let t=2*this.getShadowWorldExtents()/e,a=this.far-this.near;return t/a-_.setting.shadow.shadowBias*.01}getShadowWorldExtents(){let e=_.setting.shadow.shadowBound;return e?e*=.5:e=Math.round(.05*this.frustum.boundingBox.extents.length),e}getCSMShadowBiasScale(e){if(e==this)return 1;let t=this.far-this.near,a=this.csm.children[0].shadowCamera;return(a.far-a.near)/t}getCSMShadowWorldExtents(e){return Math.round(this.csm.children[e].bound.extents.length)}perspective(e,t,a,r){this.fov=e,this.aspect=t,this.near=Math.max(.001,a),this.far=r,this._projectionMatrix.perspective(this.fov,this.aspect,this.near,this.far),this.type=nt.perspective}ortho(e,t,a){this.frustumSize=e;let r=e*.5*this.aspect,i=e*.5,n=-r/2,o=r/2,l=i/2,c=-i/2;this.orthoOffCenter(n,o,c,l,t,a)}orthoOffCenter(e,t,a,r,i,n){this.near=i,this.far=n,this.left=e,this.right=t,this.top=r,this.bottom=a,this.type=nt.ortho,this._projectionMatrix.orthoOffCenter(this.left,this.right,this.bottom,this.top,this.near,this.far)}get viewMatrix(){return this._viewMatrix.copyFrom(this.transform.worldMatrix),this._viewMatrix.invert(),this._viewMatrix}get shadowViewMatrix(){return this._viewMatrix.copyFrom(this.transform.worldMatrix),this._viewMatrix.appendScale(1,1,1),this._viewMatrix.invert(),this._viewMatrix}object3DToScreenRay(e,t=null){return t||(t=new b(0,0,0,1)),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5,Gt.transformVector(this.viewMatrix,e,t),this.project(t,t),t.x=this._halfw+t.x*this._halfw,t.y=this.viewPort.height-(this._halfh-t.y*this._halfh),t}screenRayToObject3D(e,t=null){t||(t=new b),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5;let a=e.x,r=e.y;return t.x=a/this.viewPort.width-.25,t.y=r/this.viewPort.height-.25,this.unProject(t.x,t.y,e.z,t),t}get pvMatrix(){return Vn(this._projectionMatrix,this.viewMatrix,this._pvMatrix),this._pvMatrix}get pvMatrix2(){Vn(this._projectionMatrix,this.transform.worldMatrix,this._pvMatrix);let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get pvMatrixInv(){let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get vMatrixInv(){let e=this._viewMatrixInv.copyFrom(this.viewMatrix);return e.invert(),e}get cameraToWorld(){let e=R.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e.multiply(this.vMatrixInv),e}get ndcToView(){let e=R.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e}get projectionMatrixInv(){return this._projectionMatrixInv.copyFrom(this._projectionMatrix),this._projectionMatrixInv.invert(),this._projectionMatrixInv}unProject(e,t,a,r){return r||(r=new b),r.x=e,r.y=-t,r.z=a,r.w=1,r.x*=a,r.y*=a,this._unprojection.copyFrom(this._projectionMatrix),this._unprojection.invert(),Gt.transformVector(this._unprojection,r,r),r.z=a,r}project(e,t){return this._projectionMatrix.perspectiveMultiplyPoint3(e,t),t.x=t.x/t.w,t.y=-t.y/t.w,t.z=e.z,t}screenPointToRay(e,t){let a=this._ray,r=bt.UnProjection(e,t,.01,this),i=bt.UnProjection(e,t,1,this);return i=i.subtract(r).normalize(),a.origin.copyFrom(r),a.direction=i,a}screenPointToWorld(e,t,a){return bt.UnProjection(e,t,a,this)}worldToScreenPoint(e,t){return bt.Projection(e,this,t)}lookAt(e,t,a=b.Y_AXIS){this.transform.lookAt(e,t,a),t&&this.lookTarget.copyFrom(t)}onUpdate(){this._useJitterProjection&&this.getJitteredProjectionMatrix(),this.frustum.update(this.pvMatrix),this.frustum.updateBoundBox(this.pvMatrixInv);let e=_.setting.shadow;this.enableCSM&&this.csm?.update(this._projectionMatrix,this._pvMatrixInv,this.near,this.far,e)}_haltonSeq;_jitterOffsetList;_useJitterProjection=!1;_jitterFrameIndex=0;_sampleIndex=0;_jitterX=0;_jitterY=0;get jitterFrameIndex(){return this._jitterFrameIndex}get jitterX(){return this._jitterX}get jitterY(){return this._jitterY}enableJitterProjection(e){this._jitterFrameIndex=0,this._useJitterProjection=e,this._haltonSeq||=new Is,this._jitterOffsetList=[];for(let t=0;t<32;t++){let a=this.generateRandomOffset();this._jitterOffsetList.push(a)}this._jitterOffsetList.reverse()}generateRandomOffset(){let e=new de(Is.get((this._sampleIndex&1023)+1,2)-.5,Is.get((this._sampleIndex&1023)+1,3)-.5);return++this._sampleIndex>=32&&(this._sampleIndex=0),e}getJitteredProjectionMatrix(){let e=_.setting.render.postProcessing.taa,t=this._projectionMatrix,a=e.temporalJitterScale,r=this._jitterFrameIndex%e.jitterSeedCount,i=this._jitterOffsetList[r].x*a,n=this._jitterOffsetList[r].y*a,o=t.get(0,2),l=t.get(1,2);this._jitterX=i/this.viewPort.width,this._jitterY=n/this.viewPort.height,o+=this._jitterX,l+=this._jitterY,t.set(0,2,o),t.set(1,2,l),this._jitterFrameIndex++}getWorldDirection(e){e||=new b;const t=this.transform._worldMatrix.rawData;return e.set(-t[8],-t[9],-t[10]).normalize()}}class Zt extends et{static LIMIT=1;static COMPONENT_NAME="UUTransform";static COMPONENT_TYPE="Transform";static POSITION_ONCHANGE="POSITION_ONCHANGE";static ROTATION_ONCHANGE="ROTATION_ONCHANGE";static SCALE_ONCHANGE="SCALE_ONCHANGE";static PARENT_ONCHANGE="PARENT_ONCHANGE";static CHILDREN_ONCHANGE="CHILDREN_ONCHANGE";static ADD_ONCHANGE="ADD_ONCHANGE";static LOCAL_ONCHANGE="LOCAL_ONCHANGE";eventPositionChange=new pt(Zt.POSITION_ONCHANGE);eventRotationChange=new pt(Zt.ROTATION_ONCHANGE);eventScaleChange=new pt(Zt.SCALE_ONCHANGE);eventLocalChange=new pt(Zt.LOCAL_ONCHANGE);onPositionChange;onRotationChange;onScaleChange;_scene3d;_parent;_localPos;_localRot;_localRotQuat;_localScale;_localDetailPos;_localDetailRot;_localDetailScale;index;index2;_forward=new b;_back=new b;_right=new b;_left=new b;_up=new b;_down=new b;_worldMatrix;_targetPos;static=!1;depthOrder=0;get localChange(){return Re.matrixStateBuffer[this.index2]!=0}set localChange(e){Re.matrixStateBuffer[this.index2]=e?1:0}get targetPos(){return this._targetPos}set targetPos(e){this._targetPos=e}get parent(){return this._parent}set parent(e){let t=this._parent?.object3D;if(this._parent=e,this.depthOrder=e?e.depthOrder+1:0,Re.setParent(this.index,e?e.worldMatrix.index:-1,this.depthOrder),this.localChange=!0,this.object3D){let a=e?e.scene3D:null;a?(this._scene3d=a,this.object3D.components.forEach(r=>{Oe.appendWaitStart(r)})):this.object3D.components.forEach(r=>{r.__stop()});for(let r of this.object3D.entityChildren)r.transform.parent=e?this:null;this.object3D.components.forEach(r=>{r.onParentChange?.(t,this._parent?.object3D)})}this.notifyLocalChange()}set enable(e){this.transform._scene3d&&e?super.enable=!0:super.enable=!1;for(let t of this.object3D.entityChildren)t.transform.enable=e}get enable(){return this._enable}get scene3D(){return this._scene3d}set scene3D(e){this._scene3d=e}get view3D(){return this._scene3d&&this._scene3d.view?this._scene3d.view:null}constructor(){super(),this._worldMatrix=new R(!0),this.index=this._worldMatrix.index,this.index2=this._worldMatrix.index*Re.stateStruct,this._localPos=new b,this._localRot=new b,this._localRotQuat=new se,this._localScale=new b(1,1,1),Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z)}awake(){}start(){}stop(){}notifyLocalChange(){if(this.localChange=!0,this.object3D){let e=this.object3D.entityChildren,t=0,a=e.length;for(t=0;t<a;t++)e[t].transform.notifyLocalChange()}this.eventDispatcher.dispatchEvent(this.eventLocalChange)}get up(){return this.worldMatrix.transformVector(b.UP,this._up),this._up}set up(e){this._up.copyFrom(e),Gt.fromToRotation(b.UP,this._up,se.HELP_0),this.transform.localRotQuat=se.HELP_0}get down(){return this.worldMatrix.transformVector(b.DOWN,this._down),this._down}set down(e){this._down.copyFrom(e),Gt.fromToRotation(b.DOWN,this._down,se.HELP_0),this.transform.localRotQuat=se.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get forward(){return this.worldMatrix.transformVector(b.FORWARD,this._forward),this._forward}set forward(e){this._forward.copyFrom(e),Gt.fromToRotation(b.FORWARD,this._forward,se.HELP_0),this.transform.localRotQuat=se.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get back(){return this.worldMatrix.transformVector(b.BACK,this._back),this._back}set back(e){this._back.copyFrom(e),Gt.fromToRotation(b.BACK,this._back,se.HELP_0),this.transform.localRotQuat=se.HELP_0}get left(){return this.worldMatrix.transformVector(b.neg_X_AXIS,this._left),this._left}set left(e){this._left.copyFrom(e),Gt.fromToRotation(b.LEFT,this._left,se.HELP_0),this.transform.localRotQuat=se.HELP_0}get right(){return this.worldMatrix.transformVector(b.X_AXIS,this._right),this._right}set right(e){this._right.copyFrom(e),Gt.fromToRotation(b.RIGHT,this._right,se.HELP_0),this.transform.localRotQuat=se.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get localRotQuat(){return this.localChange&&this.updateWorldMatrix(),this._localRotQuat}set localRotQuat(e){(e.x!=this._localRotQuat.x||e.y!=this._localRotQuat.y||e.z!=this._localRotQuat.z||e.w!=this._localRotQuat.w)&&(this._localRotQuat.copyFrom(e),this._localRotQuat.getEulerAngles(this._localRot),Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}notifyChange(){this.notifyLocalChange(),this.onRotationChange?.(),this.onScaleChange?.(),this.onPositionChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange)}get worldMatrix(){return this.updateWorldMatrix(),this._worldMatrix}updateWorldMatrix(e=!1){(this.localChange||e)&&(this.parent?(Es(this._localRot,this._localPos,this._localScale,this._worldMatrix),Zc(this._worldMatrix,this.parent.worldMatrix,this._worldMatrix)):Es(this._localRot,this._localPos,this._localScale,this._worldMatrix),this.localChange=!1)}updateChildTransform(){let e=this;if(e.localChange&&e.updateWorldMatrix(),e.object3D.numChildren>0)for(const t of e.object3D.entityChildren)t.transform.updateChildTransform()}lookTarget(e,t=b.UP){this.lookAt(this.transform.worldPosition,e,t)}lookAt(e,t,a=b.UP){this._targetPos||=new b,this._targetPos.copyFrom(t),this.localPosition=e,R.helpMatrix.lookAt(e,t,a),R.helpMatrix.invert();var r=R.helpMatrix.decompose(na.QUATERNION);this.localRotQuat=se.CALCULATION_QUATERNION.copyFrom(r[1])}decomposeFromMatrix(e,t="eulerAngles"){let a=e.decompose(t),r=this.transform;return r.localRotQuat.copyFrom(a[1]),r.localRotQuat=r.localRotQuat,r.localPosition.copyFrom(a[0]),r.localPosition=r.localPosition,r.localScale.copyFrom(a[2]),r.localScale=r.localScale,this}cloneTo(e){e.transform.localPosition=this.localPosition,e.transform.localRotation=this.localRotation,e.transform.localScale=this.localScale}set x(e){this._localPos.x!=e&&(this._localPos.x=e,Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z),this.notifyLocalChange(),this.onPositionChange?.(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange))}get x(){return this._localPos.x}set y(e){this._localPos.y!=e&&(this._localPos.y=e,Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z),this.notifyLocalChange(),this.onPositionChange?.(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange))}get y(){return this._localPos.y}set z(e){this._localPos.z!=e&&(this._localPos.z=e,Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z),this.notifyLocalChange(),this.onPositionChange?.(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange))}get z(){return this._localPos.z}set scaleX(e){this._localScale.x!=e&&(this._localScale.x=e,Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange))}get scaleX(){return this._localScale.x}set scaleY(e){this._localScale.y!=e&&(this._localScale.y=e,Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange))}get scaleY(){return this._localScale.y}set scaleZ(e){this._localScale.z!=e&&(this._localScale.z=e,Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange))}get scaleZ(){return this._localScale.z}set rotationX(e){this._localRot.x!=e&&(this._localRot.x=e,Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}get rotationX(){return this._localRot.x}set rotationY(e){this._localRot.y!=e&&(this._localRot.y=e,Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}get rotationY(){return this._localRot.y}set rotationZ(e){this._localRot.z!=e&&(this._localRot.z=e,Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}get rotationZ(){return this._localRot.z}get worldPosition(){return this.localChange&&this.updateWorldMatrix(),this._worldMatrix.position}set localPosition(e){this.onPositionChange&&(this._localPos.x!=e.x||this._localPos.y!=e.y||this._localPos.z!=e.z)&&this.onPositionChange(this._localPos,e),this._localPos.copyFrom(e),Re.setTranslate(this.index,e.x,e.y,e.z),this.notifyLocalChange(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange)}get localPosition(){return this._localPos}set localRotation(e){this.onRotationChange&&(this._localRot.x!=e.x||this._localRot.y!=e.y||this._localRot.z!=e.z)&&this.onRotationChange(this._localRot,e),Re.setRotation(this.index,e.x,e.y,e.z),this._localRot.copyFrom(e),this.notifyLocalChange(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get localRotation(){return this._localRot}set localScale(e){Re.setScale(this.index,e.x,e.y,e.z),this._localScale.copyFrom(e),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange)}get localScale(){return this._localScale}get localDetailScale(){return this._localDetailScale}set localDetailScale(e){this._localDetailScale=e,Re.setContinueScale(this.index,e.x,e.y,e.z)}get localDetailRot(){return this._localDetailRot}set localDetailRot(e){this._localDetailRot=e,Re.setContinueRotation(this.index,e.x,e.y,e.z)}get localDetailPos(){return this._localDetailPos}set localDetailPos(e){this._localDetailPos=e,Re.setContinueTranslate(this.index,e.x,e.y,e.z)}beforeDestroy(e){this.parent&&this.parent.object3D&&this.parent.object3D.removeChild(this.object3D),super.beforeDestroy(e)}destroy(){super.destroy(),this.scene3D=null,this.eventPositionChange=null,this.eventRotationChange=null,this.eventScaleChange=null,this.onPositionChange=null,this.onRotationChange=null,this.onScaleChange=null,this._scene3d=null,this._parent=null,this._localPos=null,this._localRot=null,this._localRotQuat=null,this._localScale=null,this._forward=null,this._back=null,this._right=null,this._left=null,this._up=null,this._down=null,this.localChange=null,this._targetPos=null}}class oa{static GLTF_NODE_INDEX_PROPERTY;static BASE_COLOR_UNIFORM="u_baseColorFactor";static BASE_COLOR_TEXTURE_UNIFORM="u_baseColorSampler";static METALROUGHNESS_UNIFORM="u_metallicRoughnessValues";static METALROUGHNESS_TEXTURE_UNIFORM="u_metallicRoughnessSampler";static NORMAL_TEXTURE_UNIFORM="u_normalSampler";static NORMAL_SCALE_UNIFORM="u_normalScale";static EMISSIVE_TEXTURE_UNIFORM="u_emissiveSampler";static EMISSIVE_FACTOR_UNIFORM="u_emissiveFactor";static OCCLUSION_TEXTURE_UNIFORM="u_occlusionSampler";static OCCLUSION_FACTOR_UNIFORM="u_occlusionFactor";static MAX_MORPH_TARGETS=8;static MORPH_POSITION_PREFIX="a_morphPositions_";static MORPH_NORMAL_PREFIX="a_morphNormals_";static MORPH_TANGENT_PREFIX="a_morphTangents_";static MORPH_WEIGHT_UNIFORM="u_morphWeights";static SCENE_ROOT_SKELETON="SCENE_ROOT";static IDENTITY_INVERSE_BIND_MATRICES="IDENTITY_IBM";static JOINT_MATRICES_UNIFORM="u_jointMatrix";static ALPHA_CUTOFF_UNIFORM="u_alphaCutoff"}var G=(s=>(s.position="position",s.normal="normal",s.uv="uv",s.TANGENT="TANGENT",s.TEXCOORD_1="TEXCOORD_1",s.TEXCOORD_2="TEXCOORD_2",s.TEXCOORD_3="TEXCOORD_3",s.TEXCOORD_4="TEXCOORD_4",s.TEXCOORD_5="TEXCOORD_5",s.TEXCOORD_6="TEXCOORD_6",s.TEXCOORD_7="TEXCOORD_7",s.color="color",s.joints0="joints0",s.joints1="joints1",s.weights0="weights0",s.weights1="weights1",s.weight="weight",s.indices="indices",s.vIndex="vIndex",s.a_morphPositions_0="a_morphPositions_0",s.all="all",s))(G||{}),De=(s=>(s[s.NONE=0]="NONE",s[s.ABOVE=1]="ABOVE",s[s.ALPHA=2]="ALPHA",s[s.NORMAL=3]="NORMAL",s[s.ADD=4]="ADD",s[s.BELOW=5]="BELOW",s[s.ERASE=6]="ERASE",s[s.MUL=7]="MUL",s[s.SCREEN=8]="SCREEN",s[s.DIVD=9]="DIVD",s[s.SOFT_ADD=10]="SOFT_ADD",s))(De||{}),Xc=(s=>(s[s.src_a=0]="src_a",s[s.dest_a=1]="dest_a",s))(Xc||{});class Hc{static getBlend(e){let t={color:{srcFactor:"src-alpha",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}};switch(e){case 0:t.color.srcFactor="one",t.color.dstFactor="zero",t.color.operation="add";break;case 1:t.color.srcFactor="one-minus-src-alpha",t.color.dstFactor="dst-alpha",t.color.operation="add";break;case 4:t.color.srcFactor="one",t.color.dstFactor="one",t.color.operation="add",t.alpha.srcFactor="one",t.alpha.dstFactor="one",t.alpha.operation="add";break;case 2:t.color.srcFactor="src-alpha",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 5:t.color.srcFactor="one-minus-src-alpha",t.color.dstFactor="one",t.color.operation="add";break;case 6:t.color.srcFactor="zero",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 7:t.color.srcFactor="dst",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 3:t.color.srcFactor="src-alpha",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 10:t.color.srcFactor="one",t.color.dstFactor="one",t.color.operation="max",t.alpha.srcFactor="one",t.alpha.dstFactor="one",t.alpha.operation="add";break;case 8:t.color.srcFactor="one",t.color.dstFactor="one-minus-src",t.color.operation="add";break}return t}}class wa{static mipmapShader=`
|
|
5669
|
+
`,""),u=u.split(",")[0],u=u.replaceAll(" "," "),this.parserAttribute(u,a)}}return a}static parserAttribute(e,t){let a={name:"",group:0,location:0,type:"",valueType:"",value:0,size:0,format:"float32"};if(e.indexOf("builtin")!=-1){a.type="builtin";var r=e.match(/\((.+?)\)/g)[0];r=e.match(/\((.+?)\)/g)[0],r=r.replace("(",""),r=r.replaceAll(")",""),a.location=parseInt(r);let i=e.split(":");a.name=i[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=i[1],a.valueType=a.valueType.replaceAll(" "," "),a.valueType=a.valueType.replaceAll(" ",""),a.valueType=a.valueType.replaceAll("\r",""),a.valueType=a.valueType.replaceAll(")",""),a.valueType=a.valueType.replaceAll(")",""),a.size=dr[a.valueType],t.push(a)}else if(e.indexOf("location")!=-1){a.type="location";var r=e.match(/\((.+?)\)/g)[0];r=e.match(/\((.+?)\)/g)[0],r=r.replace("(",""),r=r.replaceAll(")",""),a.location=parseInt(r);let n=e.split(":");a.name=n[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=n[1],a.valueType=a.valueType.replaceAll(" "," "),a.valueType=a.valueType.replaceAll(" ",""),a.valueType=a.valueType.replaceAll("\r",""),a.valueType=a.valueType.replaceAll(")",""),a.valueType=a.valueType.replaceAll(")",""),a.size=dr[a.valueType],t.push(a)}a.format=Ql[dr[a.valueType]]}}class Fe extends Cn{entryPoint="CsMain";workerSizeX=1;workerSizeY=0;workerSizeZ=0;_computePipeline;_csShaderModule;_destCS;_sourceCS;_storageTextureDic;_sampleTextureDic;_groupsShaderReflectionVarInfos;_groupCache={};constructor(e){super(),this._sourceCS=e,Tt.getShaderReflection2(e,this),this._storageTextureDic=new Map,this._sampleTextureDic=new Map}setStorageTexture(e,t){this._storageTextureDic.has(e)||this._storageTextureDic.set(e,t)}setSamplerTexture(e,t){this._sampleTextureDic.set(e,t)}compute(e){this._computePipeline||this.genComputePipeline(),e.setPipeline(this._computePipeline);for(let t=0;t<this.bindGroups.length;++t)e.setBindGroup(t,this.bindGroups[t]);this.workerSizeX&&this.workerSizeY&&this.workerSizeZ?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY,this.workerSizeZ):this.workerSizeX&&this.workerSizeY?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY):e.dispatchWorkgroups(this.workerSizeX)}createBufferBindGroup(e,t,a,r){let i=this._bufferDic.get(t);if(i){let n={binding:a,resource:{buffer:i.buffer,offset:0,size:i.memory.shareDataBuffer.byteLength}};r.push(n)}else console.error(`ComputeShader(${this.instanceID})`,`buffer ${t} is missing!`)}noticeBufferChange(e){let t=this._groupCache[e];t&&this.genGroups(t.groupIndex,t.infos,!0)}genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;++o){const l=r[o];if(l)switch(l.varType){case"uniform":case"storage-read":case"storage-read_write":this.createBufferBindGroup(e,l.varName,l.binding,i),this._groupCache[l.varName]={groupIndex:e,infos:t};break;case"var":if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType.indexOf("texture_storage")!=-1){let c=this._storageTextureDic.get(l.varName);if(c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f),ke.getInstance().attached(c,this)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType.indexOf("texture")!=-1){let c=this._sampleTextureDic.get(l.varName);if(c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f),ke.getInstance().attached(c,this)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}break;default:console.error("unprocessed type:",l.varType);break}}let n=I.device.createBindGroup({layout:this._computePipeline.getBindGroupLayout(e),entries:i});this.bindGroups[e]=n}}genComputePipeline(){this.preCompileShader(this._sourceCS),this.genReflection(),this._computePipeline=I.device.createComputePipeline({layout:"auto",compute:{module:this.compileShader(),entryPoint:this.entryPoint}}),this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroups=[];for(let t=0;t<e.groups.length;++t){let a=e.groups[t];this._groupsShaderReflectionVarInfos[t]=a,this.genGroups(t,this._groupsShaderReflectionVarInfos)}I.addEventListener(lr.RESIZE,t=>{for(let a=0;a<e.groups.length;++a){let r=e.groups[a];this._groupsShaderReflectionVarInfos[a]=r,this.genGroups(a,this._groupsShaderReflectionVarInfos,!0)}},this)}preCompileShader(e){for(const t in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,t)){const a=this.constValues[t];e=e.replaceAll(`&${t}`,a.toString())}this._destCS=Da.parseComputeShader(e,this.defineValue)}compileShader(){let e=I.device.createShaderModule({label:`ComputeShader(${this.instanceID})`,code:this._destCS});return e.getCompilationInfo().then(t=>{t.messages.length>0&&console.warn("[shader error]",t,this._destCS)}),this._csShaderModule=e,e}genReflection(){this.shaderVariant+=Tt.genComputeShaderVariant(this);let e=Tt.poolGetReflection(this.shaderVariant);e?this.shaderReflection=e:(Tt.getShaderReflection2(this._destCS,this),Tt.combineShaderReflectionVarInfo(this.shaderReflection,this.shaderReflection.cs_variables))}}var fe=(s=>(s[s.COLOR=1]="COLOR",s[s.REFLECTION=2]="REFLECTION",s[s.POSITION=4]="POSITION",s[s.GRAPHIC=8]="GRAPHIC",s[s.GI=16]="GI",s[s.Cluster=32]="Cluster",s[s.SHADOW=64]="SHADOW",s[s.POINT_SHADOW=128]="POINT_SHADOW",s[s.POST=256]="POST",s[s.DEPTH=512]="DEPTH",s[s.UI=1024]="UI",s))(fe||{});class dt{static profilerLabelMap=new Map;static viewMap=new Map;static testObj={testValue1:0,testValue2:0,testValue3:0,testValue4:0};static startView(e){let t=this.viewMap.get(e);if(!t){t={};for(const a in fe)parseInt(a)>=0||(t[a]={vertexCount:0,indicesCount:0,instanceCount:0,triCount:0,drawCount:0,pipelineCount:0});this.viewMap.set(e,t)}for(const a in fe)parseInt(a)>=0||(t[a].vertexCount=0,t[a].indicesCount=0,t[a].triCount=0,t[a].instanceCount=0,t[a].drawCount=0,t[a].pipelineCount=0)}static viewCount(e){return this.startView(e),this.viewMap.get(e)}static viewCount_vertex(e,t,a){this.viewMap.get(e)[t].vertexCount+=a}static viewCount_indices(e,t,a){this.viewMap.get(e)[t].indicesCount+=a}static viewCount_tri(e,t,a){this.viewMap.get(e)[t].triCount+=a}static viewCount_instance(e,t,a){this.viewMap.get(e)[t].instanceCount+=a}static viewCount_draw(e,t){this.viewMap.get(e)[t].drawCount++}static viewCount_pipeline(e,t){this.viewMap.get(e)[t].pipelineCount++}static start(e){let t=this.profilerLabelMap.get(e);t||(t={lable:e,start:0,end:0,total:0,count:0,child:new Map},this.profilerLabelMap.set(e,t)),t.start=performance.now(),t.end=performance.now(),t.count=0,t.child.clear()}static end(e){let t=this.profilerLabelMap.get(e);t&&(t.end=performance.now(),t.total=t.end-t.start)}static countStart(e,t=""){let a=this.profilerLabelMap.get(e);if(a&&(a.count++,t!="")){let r=a.child.get(t);r||(r={lable:t,start:0,end:0,total:0,count:0}),r.start=performance.now(),r.end=performance.now(),r.count=0,a.child.set(t,r)}}static countEnd(e,t){let a=this.profilerLabelMap.get(e);if(a&&t!=""){let r=a.child.get(t);r||(r={lable:t,start:0,end:0,total:0,count:0}),r.end=performance.now(),r.total=r.end-r.start,r.count++}}static print(e){let t=this.profilerLabelMap.get(e);t&&console.log("performance",e,t.total+" ms")}}var qu=(()=>{var s=import.meta.url;return(async function(e={}){var t=e,a,r;t.ready=new Promise((V,L)=>{a=V,r=L});var i=Object.assign({},t),n=[],o="./this.program",l=(V,L)=>{throw L},c=typeof window=="object",f=typeof importScripts=="function",d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function u(V){return t.locateFile?t.locateFile(V,h):h+V}var m,g;if(d){const{createRequire:V}=await Promise.resolve().then(()=>Hm);var p=V(import.meta.url),D=p("fs"),A=p("path");f?h=A.dirname(h)+"/":h=p("url").fileURLToPath(new URL("data:text/javascript;base64,DQp2YXIgTW9kdWxlID0gKCgpID0+IHsNCiAgdmFyIF9zY3JpcHREaXIgPSBpbXBvcnQubWV0YS51cmw7DQogIA0KICByZXR1cm4gKA0KYXN5bmMgZnVuY3Rpb24obW9kdWxlQXJnID0ge30pIHsNCg0KdmFyIE1vZHVsZT1tb2R1bGVBcmc7dmFyIHJlYWR5UHJvbWlzZVJlc29sdmUscmVhZHlQcm9taXNlUmVqZWN0O01vZHVsZVsicmVhZHkiXT1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hbGl6ZWQiXSlNb2R1bGVbIm9uUnVudGltZUluaXRpYWxpemVkIl0oKTtpZihzaG91bGRSdW5Ob3cpY2FsbE1haW4oYXJncyk7cG9zdFJ1bigpfWlmKE1vZHVsZVsic2V0U3RhdHVzIl0pe01vZHVsZVsic2V0U3RhdHVzIl0oIlJ1bm5pbmcuLi4iKTtzZXRUaW1lb3V0KGZ1bmN0aW9uKCl7c2V0VGltZW91dChmdW5jdGlvbigpe01vZHVsZVsic2V0U3RhdHVzIl0oIiIpfSwxKTtkb1J1bigpfSwxKX1lbHNle2RvUnVuKCl9fWlmKE1vZHVsZVsicHJlSW5pdCJdKXtpZih0eXBlb2YgTW9kdWxlWyJwcmVJbml0Il09PSJmdW5jdGlvbiIpTW9kdWxlWyJwcmVJbml0Il09W01vZHVsZVsicHJlSW5pdCJdXTt3aGlsZShNb2R1bGVbInByZUluaXQiXS5sZW5ndGg+MCl7TW9kdWxlWyJwcmVJbml0Il0ucG9wKCkoKX19dmFyIHNob3VsZFJ1bk5vdz10cnVlO2lmKE1vZHVsZVsibm9Jbml0aWFsUnVuIl0pc2hvdWxkUnVuTm93PWZhbHNlO3J1bigpOw0KDQoNCiAgcmV0dXJuIG1vZHVsZUFyZy5yZWFkeQ0KfQ0KKTsNCn0pKCk7DQpleHBvcnQgZGVmYXVsdCBNb2R1bGU7",import.meta.url)),m=(L,te)=>(L=ge(L)?new URL(L):A.normalize(L),D.readFileSync(L,te?void 0:"utf8")),g=L=>{var te=m(L,!0);return te.buffer||(te=new Uint8Array(te)),te},!t.thisProgram&&process.argv.length>1&&(o=process.argv[1].replace(/\\/g,"/")),n=process.argv.slice(2),l=(L,te)=>{throw process.exitCode=L,te}}else(c||f)&&(f?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),s&&(h=s),h.startsWith("blob:")?h="":h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1),m=V=>{var L=new XMLHttpRequest;return L.open("GET",V,!1),L.send(null),L.responseText},f&&(g=V=>{var L=new XMLHttpRequest;return L.open("GET",V,!1),L.responseType="arraybuffer",L.send(null),new Uint8Array(L.response)}));var B=t.print||console.log.bind(console),v=t.printErr||console.error.bind(console);Object.assign(t,i),i=null,t.arguments&&(n=t.arguments),t.thisProgram&&(o=t.thisProgram),t.quit&&(l=t.quit);var U;t.wasmBinary&&(U=t.wasmBinary);function y(V){if(typeof d<"u"&&d){var L=Buffer.from(V,"base64");return new Uint8Array(L.buffer,L.byteOffset,L.length)}for(var te=atob(V),Ee=new Uint8Array(te.length),Ye=0;Ye<te.length;++Ye)Ee[Ye]=te.charCodeAt(Ye);return Ee}function S(V){if(le(V))return y(V.slice(ie.length))}var F,C=!1,w,E,Q,T;function j(){var V=F.buffer;t.HEAP8=E=new Int8Array(V),t.HEAP16=new Int16Array(V),t.HEAPU8=Q=new Uint8Array(V),t.HEAPU16=new Uint16Array(V),t.HEAP32=new Int32Array(V),t.HEAPU32=T=new Uint32Array(V),t.HEAPF32=new Float32Array(V),t.HEAPF64=new Float64Array(V)}var ue=[],ee=[],N=[],M=[];function O(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)K(t.preRun.shift());ft(ue)}function W(){ft(ee)}function ae(){ft(N)}function z(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)re(t.postRun.shift());ft(M)}function K(V){ue.unshift(V)}function $(V){ee.unshift(V)}function re(V){M.unshift(V)}var ce=0,Ae=null;function Qe(V){ce++,t.monitorRunDependencies?.(ce)}function Ve(V){if(ce--,t.monitorRunDependencies?.(ce),ce==0&&Ae){var L=Ae;Ae=null,L()}}function H(V){t.onAbort?.(V),V="Aborted("+V+")",v(V),C=!0,w=1,V+=". Build with -sASSERTIONS for more info.";var L=new WebAssembly.RuntimeError(V);throw r(L),L}var ie="data:application/octet-stream;base64,",le=V=>V.startsWith(ie),ge=V=>V.startsWith("file://"),Ie;Ie="data:application/octet-stream;base64,AGFzbQE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gHaIgIiAeoiAjIB+iICQgIKKgoKA5A0AgAyAUIBmiIA4gGqIgCiAboiAHIByioKCgOQM4IAMgECAZoiAJIBqiIBEgG6IgEiAcoqCgoDkDMCADICUgGaIgCyAaoiAMIBuiIA8gHKKgoKA5AyggAyAhIBmiICIgGqIgIyAboiAkIByioKCgOQMgIAMgFCAVoiAOIBaiIAogF6IgGCAHoqCgoDkDGCADIBAgFaIgCSAWoiARIBeiIBggEqKgoKA5AxAgAyAlIBWiIAsgFqIgDCAXoiAYIA+ioKCgOQMIIAMgISAVoiAiIBaiICMgF6IgJCAYoqCgoDkDACACIANBgAEQFRoLIAVBADYCAAsgA0GAAWokACACC4gLAQd/AkAgASAAKAIMIgQgACgCCCIDa0EHdSICRg0AAkAgASACSwRAIAEgAmsiBiAAKAIQIgUgBCIDa0EHdU0EQAJAIAZFDQAgAyECIAZBA3EiBQRAQQAhBANAIAJBCGpBAEHwABAHGiACQoCAgICAgID4PzcDeCACQoCAgICAgID4PzcDUCACQoCAgICAgID4PzcDKCACQoCAgICAgID4PzcDACACQYABaiECIARBAWoiBCAFRw0ACwsgBkEHdCADaiEDIAZBAWtB////D3FBA0kNAANAIAJBCGpBAEHwABAHGiACQoCAgICAgID4PzcDeCACQoCAgICAgID4PzcDUCACQoCAgICAgID4PzcDKCACQoCAgICAgID4PzcDACACQYgBakEAQfAAEAcaIAJCgICAgICAgPg/NwP4ASACQoCAgICAgID4PzcD0AEgAkKAgICAgICA+D83A6gBIAJCgICAgICAgPg/NwOAASACQYgCakEAQfAAEAcaIAJCgICAgICAgPg/NwP4AiACQoCAgICAgID4PzcD0AIgAkKAgICAgICA+D83A6gCIAJCgICAgICAgPg/NwOAAiACQYgDakEAQfAAEAcaIAJCgICAgICAgPg/NwP4AyACQoCAgICAgID4PzcD0AMgAkKAgICAgICA+D83A6gDIAJCgICAgICAgPg/NwOAAyACQYAEaiICIANHDQALCyAAIAM2AgwMAgsCQCADIAAoAggiAmtBB3UiBCAGaiIHQYCAgBBJBEBBACEDQf///w8gBSACayIFQQZ1IgIgByACIAdLGyAFQYD///8HTxsiBwRAIAdBgICAEE8NAiAHQQd0EAshCAsgCCAEQQd0aiIEIQIgBkEDcSIFBEADQCACQQhqQQBB8AAQBxogAkKAgICAgICA+D83A3ggAkKAgICAgICA+D83A1AgAkKAgICAgICA+D83AyggAkKAgICAgICA+D83AwAgAkGAAWohAiADQQFqIgMgBUcNAAsLIAZBB3QgBGohBSAGQQFrQf///w9xQQNPBEADQCACQQhqQQBB8AAQBxogAkKAgICAgICA+D83A3ggAkKAgICAgICA+D83A1AgAkKAgICAgICA+D83AyggAkKAgICAgICA+D83AwAgAkGIAWpBAEHwABAHGiACQoCAgICAgID4PzcD+AEgAkKAgICAgICA+D83A9ABIAJCgICAgICAgPg/NwOoASACQoCAgICAgID4PzcDgAEgAkGIAmpBAEHwABAHGiACQoCAgICAgID4PzcD+AIgAkKAgICAgICA+D83A9ACIAJCgICAgICAgPg/NwOoAiACQoCAgICAgID4PzcDgAIgAkGIA2pBAEHwABAHGiACQoCAgICAgID4PzcD+AMgAkKAgICAgICA+D83A9ADIAJCgICAgICAgPg/NwOoAyACQoCAgICAgID4PzcDgAMgAkGABGoiAiAFRw0ACwsgACgCDCICIAAoAggiA0cEQANAIARBgAFrIgQgAkGAAWsiAkGAARAVGiACIANHDQALIAAoAgghAgsgACAIIAdBB3RqNgIQIAAgBTYCDCAAIAQ2AgggAgRAIAIQFgsMAwsQEwALEBIACyABIAJPDQAgACADIAFBB3RqNgIMCwJAIAAoAhggACgCFCIDa0HIAG0iAiABSQRAIABBFGogASACaxA8DAELIAEgAk8NACAAIAMgAUHIAGxqNgIYCwJAIAAoAiQgACgCICIDa0EEdSICIAFJBEAgAEEgaiABIAJrEDsMAQsgASACTw0AIAAgAyABQQR0ajYCJAsgACgCMCAAKAIsIgNrQcgAbSICIAFJBEAgAEEsaiABIAJrEDwPCyABIAJPDQAgACADIAFByABsajYCMAsLBwAgACgCLAsHACAAKAIgCwcAIAAoAhQLBwAgACgCCAvUBQEHfyABIAAoAggiByAAKAIEIgNrQQR1TQRAAkAgAUUNACADIQIgAUEHcSIFBEADQCACQv////8PNwIIIAJCADcCACACQRBqIQIgBEEBaiIEIAVHDQALCyABQQR0IANqIQMgAUEBa0H/////AHFBB0kNAANAIAJC/////w83AnggAkIANwJwIAJC/////w83AmggAkIANwJgIAJC/////w83AlggAkIANwJQIAJC/////w83AkggAkIANwJAIAJC/////w83AjggAkIANwIwIAJC/////w83AiggAkIANwIgIAJC/////w83AhggAkIANwIQIAJC/////w83AgggAkIANwIAIAJBgAFqIgIgA0cNAAsLIAAgAzYCBA8LAkAgAyAAKAIAIgJrQQR1IgQgAWoiBkGAgICAAUkEQEH/////ACAHIAJrIgdBA3UiAiAGIAIgBksbIAdB8P///wdPGyIGBEAgBkGAgICAAU8NAiAGQQR0EAshCAsgCCAEQQR0aiIEIQIgAUEHcSIHBEADQCACQv////8PNwIIIAJCADcCACACQRBqIQIgBUEBaiIFIAdHDQALCyABQQR0IARqIQUgAUEBa0H/////AHFBB08EQANAIAJC/////w83AnggAkIANwJwIAJC/////w83AmggAkIANwJgIAJC/////w83AlggAkIANwJQIAJC/////w83AkggAkIANwJAIAJC/////w83AjggAkIANwIwIAJC/////w83AiggAkIANwIgIAJC/////w83AhggAkIANwIQIAJC/////w83AgggAkIANwIAIAJBgAFqIgIgBUcNAAsLIAAoAgAiASADRwRAA0AgBEEQayIEIANBEGsiA/0AAgD9CwIAIAEgA0cNAAsgACgCACEDCyAAIAggBkEEdGo2AgggACAFNgIEIAAgBDYCACADBEAgAxAMCw8LEBMACxASAAuLAwEHfyABIAAoAggiAiAAKAIEIgNrQcgAbU0EQCAAIAEEfyADQQAgAUHIAGxByABrIgAgAEHIAHBrQcgAaiIAEAcgAGoFIAMLNgIEDwsCQCADIAAoAgAiBmtByABtIgggAWoiBEHk8bgcSQRAQePxuBwgAiAGa0HIAG0iB0EBdCICIAQgAiAESxsgB0HxuJwOTxsiBARAIARB5PG4HE8NAiAEQcgAbBALIQULIAUgCEHIAGxqIgJBACABQcgAbEHIAGsiASABQcgAcGtByABqIgcQByIBIAdqIQggBSAEQcgAbGohBwJAIAMgBkYEQCABIQUMAQsDQCACQcgAayIFIANByABrIgH9AAMA/QsDACACQThrIANBOGv9AAMA/QsDACACQShrIANBKGv9AAMA/QsDACACQRhrIANBGGv9AAMA/QsDACACQQhrIANBCGsrAwA5AwAgBSECIAEiAyAGRw0ACwsgACAHNgIIIAAgCDYCBCAAIAU2AgAgBgRAIAYQDAsPCxATAAsQEgALGQEBf0GgKygCACIBIAAgASgCACgCGBEBAAsQACMAIABrQXBxIgAkACAACwcAIAAoAgQLBQBBowkLBQBBzQkLBQBBkAkLFwEBf0GgKygCACIAIAAoAgAoAhQRAAALFQAgAEUEQEEADwsgAEHkJhAiQQBHCxoAIAAgASgCCCAFEAoEQCABIAIgAyAEECALCzcAIAAgASgCCCAFEAoEQCABIAIgAyAEECAPCyAAKAIIIgAgASACIAMgBCAFIAAoAgAoAhQRCQALpwEAIAAgASgCCCAEEAoEQAJAIAEoAgQgAkcNACABKAIcQQFGDQAgASADNgIcCw8LAkAgACABKAIAIAQQCkUNAAJAIAIgASgCEEcEQCABKAIUIAJHDQELIANBAUcNASABQQE2AiAPCyABIAI2AhQgASADNgIgIAEgASgCKEEBajYCKAJAIAEoAiRBAUcNACABKAIYQQJHDQAgAUEBOgA2CyABQQQ2AiwLC4gCACAAIAEoAgggBBAKBEACQCABKAIEIAJHDQAgASgCHEEBRg0AIAEgAzYCHAsPCwJAIAAgASgCACAEEAoEQAJAIAIgASgCEEcEQCABKAIUIAJHDQELIANBAUcNAiABQQE2AiAPCyABIAM2AiACQCABKAIsQQRGDQAgAUEAOwE0IAAoAggiACABIAIgAkEBIAQgACgCACgCFBEJACABLQA1BEAgAUEDNgIsIAEtADRFDQEMAwsgAUEENgIsCyABIAI2AhQgASABKAIoQQFqNgIoIAEoAiRBAUcNASABKAIYQQJHDQEgAUEBOgA2DwsgACgC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AAhAAAAIgAAAE4xMF9fY3h4YWJpdjEyMF9fc2lfY2xhc3NfdHlwZV9pbmZvRQAAAACgEwAAwBMAAAQTAAAAAAAAWBQAAAEAAAAjAAAAJAAAAAAAAACAFAAAAQAAACUAAAAmAAAAAAAAAEAUAAABAAAAJwAAACgAAABTdDlleGNlcHRpb24AAAAAeBMAADAUAABTdDliYWRfYWxsb2MAAAAAoBMAAEgUAABAFAAAU3QyMGJhZF9hcnJheV9uZXdfbGVuZ3RoAAAAAKATAABkFAAAWBQAAAAAAACwFAAAAgAAACkAAAAqAAAAU3QxMWxvZ2ljX2Vycm9yAKATAACgFAAAQBQAAAAAAADkFAAAAgAAACsAAAAqAAAAU3QxMmxlbmd0aF9lcnJvcgAAAACgEwAA0BQAALAUAABTdDl0eXBlX2luZm8AAAAAeBMAAPAUAEGIKgsBBQBBlCoLARMAQawqCw4UAAAAFQAAALgVAAAABABBxCoLAQEAQdQqCwX/////CgBBmCsLA3AcAQ==",le(Ie)||(Ie=u(Ie));function me(V){if(V==Ie&&U)return new Uint8Array(U);var L=S(V);if(L)return L;if(g)return g(V);throw"both async and sync fetching of the wasm failed"}function ye(V){return Promise.resolve().then(()=>me(V))}function Se(V,L,te){return ye(V).then(Ee=>WebAssembly.instantiate(Ee,L)).then(te,Ee=>{v(`failed to asynchronously prepare wasm: ${Ee}`),H(Ee)})}function Me(V,L,te,Ee){return Se(L,te,Ee)}function Ze(){var V={a:Lu};function L(Ee,Ye){return Vt=Ee.exports,F=Vt.f,j(),$(Vt.g),Ve(),Vt}Qe();function te(Ee){L(Ee.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(V,L)}catch(Ee){v(`Module.instantiateWasm callback failed with error: ${Ee}`),r(Ee)}return Me(U,Ie,V,te).catch(r),{}}function $e(V){this.name="ExitStatus",this.message=`Program terminated with exit(${V})`,this.status=V}var ft=V=>{for(;V.length>0;)V.shift()(t)};t.noExitRuntime;class ja{constructor(L){this.excPtr=L,this.ptr=L-24}set_type(L){T[this.ptr+4>>2]=L}get_type(){return T[this.ptr+4>>2]}set_destructor(L){T[this.ptr+8>>2]=L}get_destructor(){return T[this.ptr+8>>2]}set_caught(L){L=L?1:0,E[this.ptr+12]=L}get_caught(){return E[this.ptr+12]!=0}set_rethrown(L){L=L?1:0,E[this.ptr+13]=L}get_rethrown(){return E[this.ptr+13]!=0}init(L,te){this.set_adjusted_ptr(0),this.set_type(L),this.set_destructor(te)}set_adjusted_ptr(L){T[this.ptr+16>>2]=L}get_adjusted_ptr(){return T[this.ptr+16>>2]}get_exception_ptr(){var L=xl(this.get_type());if(L)return T[this.excPtr>>2];var te=this.get_adjusted_ptr();return te!==0?te:this.excPtr}}var ba=0,Ra=(V,L,te)=>{var Ee=new ja(V);throw Ee.init(L,te),ba=V,ba},Xt=()=>{H("")},Qa=(V,L,te)=>Q.copyWithin(V,L,L+te),Ta=()=>2147483648,Pt=V=>{var L=F.buffer,te=(V-L.byteLength+65535)/65536;try{return F.grow(te),j(),1}catch{}},ga=V=>{var L=Q.length;V>>>=0;var te=Ta();if(V>te)return!1;for(var Ee=(ma,Hr)=>ma+(Hr-ma%Hr)%Hr,Ye=1;Ye<=4;Ye*=2){var st=L*(1+.2/Ye);st=Math.min(st,V+100663296);var Xe=Math.min(te,Ee(Math.max(V,st),65536)),ze=Pt(Xe);if(ze)return!0}return!1},pa=[null,[],[]],ra=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,wr=(V,L,te)=>{for(var Ee=L+te,Ye=L;V[Ye]&&!(Ye>=Ee);)++Ye;if(Ye-L>16&&V.buffer&&ra)return ra.decode(V.subarray(L,Ye));for(var st="";L<Ye;){var Xe=V[L++];if(!(Xe&128)){st+=String.fromCharCode(Xe);continue}var ze=V[L++]&63;if((Xe&224)==192){st+=String.fromCharCode((Xe&31)<<6|ze);continue}var ma=V[L++]&63;if((Xe&240)==224?Xe=(Xe&15)<<12|ze<<6|ma:Xe=(Xe&7)<<18|ze<<12|ma<<6|V[L++]&63,Xe<65536)st+=String.fromCharCode(Xe);else{var Hr=Xe-65536;st+=String.fromCharCode(55296|Hr>>10,56320|Hr&1023)}}return st},Ir=(V,L)=>{var te=pa[V];L===0||L===10?((V===1?B:v)(wr(te,0)),te.length=0):te.push(L)},Rr=(V,L,te,Ee)=>{for(var Ye=0,st=0;st<te;st++){var Xe=T[L>>2],ze=T[L+4>>2];L+=8;for(var ma=0;ma<ze;ma++)Ir(V,Q[Xe+ma]);Ye+=ze}return T[Ee>>2]=Ye,0},Qr=V=>{w=V,l(V,new $e(V))},Tr=(V,L)=>{w=V,Qr(V)},Mu=V=>{if(V instanceof $e||V=="unwind")return w;l(1,V)},Nu=V=>{for(var L=0,te=0;te<V.length;++te){var Ee=V.charCodeAt(te);Ee<=127?L++:Ee<=2047?L+=2:Ee>=55296&&Ee<=57343?(L+=4,++te):L+=3}return L},Pu=(V,L,te,Ee)=>{if(!(Ee>0))return 0;for(var Ye=te,st=te+Ee-1,Xe=0;Xe<V.length;++Xe){var ze=V.charCodeAt(Xe);if(ze>=55296&&ze<=57343){var ma=V.charCodeAt(++Xe);ze=65536+((ze&1023)<<10)|ma&1023}if(ze<=127){if(te>=st)break;L[te++]=ze}else if(ze<=2047){if(te+1>=st)break;L[te++]=192|ze>>6,L[te++]=128|ze&63}else if(ze<=65535){if(te+2>=st)break;L[te++]=224|ze>>12,L[te++]=128|ze>>6&63,L[te++]=128|ze&63}else{if(te+3>=st)break;L[te++]=240|ze>>18,L[te++]=128|ze>>12&63,L[te++]=128|ze>>6&63,L[te++]=128|ze&63}}return L[te]=0,te-Ye},Vu=(V,L,te)=>Pu(V,Q,L,te),Ou=V=>{var L=Nu(V)+1,te=Bn(L);return Vu(V,te,L),te},Lu={b:Ra,c:Xt,e:Qa,d:ga,a:Rr},Vt=Ze();t._initialize=(V,L,te)=>(t._initialize=Vt.h)(V,L,te),t._allocMatrix=V=>(t._allocMatrix=Vt.i)(V),t._getMatrixBufferPtr=()=>(t._getMatrixBufferPtr=Vt.j)(),t._getSRTPtr=()=>(t._getSRTPtr=Vt.k)(),t._getInfoPtr=()=>(t._getInfoPtr=Vt.l)(),t._getContinuedSRTPtr=()=>(t._getContinuedSRTPtr=Vt.m)(),t._printMatrix=V=>(t._printMatrix=Vt.n)(V),t._updateAllMatrixContinueTransform=(V,L,te)=>(t._updateAllMatrixContinueTransform=Vt.o)(V,L,te);var vl=t._main=(V,L)=>(vl=t._main=Vt.p)(V,L),Bn=V=>(Bn=Vt.r)(V),xl=V=>(xl=Vt.s)(V),Us;Ae=function V(){Us||Ul(),Us||(Ae=V)};function Gu(V=[]){var L=vl;V.unshift(o);var te=V.length,Ee=Bn((te+1)*4),Ye=Ee;V.forEach(Xe=>{T[Ye>>2]=Ou(Xe),Ye+=4}),T[Ye>>2]=0;try{var st=L(te,Ee);return Tr(st,!0),st}catch(Xe){return Mu(Xe)}}function Ul(V=n){if(ce>0||(O(),ce>0))return;function L(){Us||(Us=!0,t.calledRun=!0,!C&&(W(),ae(),a(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),yl&&Gu(V),z()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),L()},1)):L()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();var yl=!0;return t.noInitialRun&&(yl=!1),Ul(),e.ready})})();function ur(s,e,t){return _.setting.doublePrecision?new Float64Array(s,e,t):new Float32Array(s,e,t)}class Re{static matrixBuffer;static matrixSRTBuffer;static matrixContinuedSRTBuffer;static matrixStateBuffer;static matrixBufferPtr;static matrixSRTBufferPtr;static matrixContinuedSRTBufferPtr;static matrixStateBufferPtr;static wasm;static stateStruct=4;static useDoublePrecision=!1;static async init(e,t=!1){this.wasm=await qu(),this.useDoublePrecision=t,this.wasm._initialize(e,t,0),this.allocMatrix(e)}static allocMatrix(e){e>R.maxCount&&console.error(`The maximum allocation size is exceeded! current:${e}, limit:${R.maxCount}`),this.wasm._allocMatrix(e),this.matrixBufferPtr=this.wasm._getMatrixBufferPtr(),this.matrixSRTBufferPtr=this.wasm._getSRTPtr(),this.matrixStateBufferPtr=this.wasm._getInfoPtr(),this.matrixContinuedSRTBufferPtr=this.wasm._getContinuedSRTPtr(),this.useDoublePrecision?(this.matrixBuffer=ur(this.wasm.HEAPF64.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=ur(this.wasm.HEAPF64.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=ur(this.wasm.HEAPF64.buffer,this.matrixContinuedSRTBufferPtr,9*e),R.blockBytes=R.block*8):(this.matrixBuffer=ur(this.wasm.HEAPF32.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=ur(this.wasm.HEAPF32.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=ur(this.wasm.HEAPF32.buffer,this.matrixContinuedSRTBufferPtr,9*e),R.blockBytes=R.block*4),this.matrixStateBuffer=new Int32Array(this.wasm.HEAP32.buffer,this.matrixStateBufferPtr,Re.stateStruct*e),R.allocMatrix(e)}static updateAllContinueTransform(e,t,a){this.wasm._updateAllMatrixContinueTransform(e,t,a)}static setParent(e,t,a){this.matrixStateBuffer[e*Re.stateStruct+2]=t>=0?t:-1,this.matrixStateBuffer[e*Re.stateStruct+3]=a}static setTranslate(e,t,a,r){this.matrixSRTBuffer[e*9+6]=t,this.matrixSRTBuffer[e*9+7]=a,this.matrixSRTBuffer[e*9+8]=r}static setRotation(e,t,a,r){this.matrixSRTBuffer[e*9+3]=t%360,this.matrixSRTBuffer[e*9+4]=a%360,this.matrixSRTBuffer[e*9+5]=r%360}static setScale(e,t,a,r){this.matrixSRTBuffer[e*9+0]=t,this.matrixSRTBuffer[e*9+1]=a,this.matrixSRTBuffer[e*9+2]=r}static setContinueTranslate(e,t,a,r){(t!=0||a!=0||r!=0)&&(this.matrixContinuedSRTBuffer[e*9+6]=t,this.matrixContinuedSRTBuffer[e*9+7]=a,this.matrixContinuedSRTBuffer[e*9+8]=r,this.matrixStateBuffer[e*Re.stateStruct+1]=1)}static setContinueRotation(e,t,a,r){(t!=0||a!=0||r!=0)&&(this.matrixContinuedSRTBuffer[e*9+3]=t,this.matrixContinuedSRTBuffer[e*9+4]=a,this.matrixContinuedSRTBuffer[e*9+5]=r,this.matrixStateBuffer[e*Re.stateStruct+1]=1)}static setContinueScale(e,t,a,r){(t!=0||a!=0||r!=0)&&(this.matrixContinuedSRTBuffer[e*9+0]=t,this.matrixContinuedSRTBuffer[e*9+1]=a,this.matrixContinuedSRTBuffer[e*9+2]=r,this.matrixStateBuffer[e*Re.stateStruct+1]=1)}}class na{static AXIS_ANGLE="axisAngle";static EULER_ANGLES="eulerAngles";static QUATERNION="quaternion"}class se{static HELP_0=new se(0,0,0,1);static HELP_1=new se(0,0,0,1);static HELP_2=new se(0,0,0,1);static _zero=new se(0,0,0,1);static CALCULATION_QUATERNION=new se;x=0;y=0;z=0;w=1;constructor(e=0,t=0,a=0,r=1){this.x=e,this.y=t,this.z=a,this.w=r}static identity(){return se._zero}static quaternionToMatrix(e,t){let a=e.x*2,r=e.y*2,i=e.z*2,n=e.x*a,o=e.y*r,l=e.z*i,c=e.x*r,f=e.x*i,d=e.y*i,h=e.w*a,u=e.w*r,m=e.w*i;t.rawData[0]=1-(o+l),t.rawData[1]=c+m,t.rawData[2]=f-u,t.rawData[3]=0,t.rawData[4]=c-m,t.rawData[5]=1-(n+l),t.rawData[6]=d+h,t.rawData[7]=0,t.rawData[8]=f+u,t.rawData[9]=d-h,t.rawData[10]=1-(n+o),t.rawData[11]=0,t.rawData[12]=0,t.rawData[13]=0,t.rawData[14]=0,t.rawData[15]=1}get magnitude(){return Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z)}set(e=0,t=0,a=0,r=1){return this.x=e,this.y=t,this.z=a,this.w=r,this}divide(e){return e instanceof se?new se(this.x/e.x,this.y/e.y,this.z/e.z):(this.x=this.x/e,this.y=this.y/e,this.z=this.z/e,this)}setFromArray(e){return this.x=e[0],this.y=e[1],this.z=e[2],this.w=e[3],this}multiply(e,t){var a=e.w,r=e.x,i=e.y,n=e.z,o=t.w,l=t.x,c=t.y,f=t.z;this.w=a*o-r*l-i*c-n*f,this.x=a*l+r*o+i*f-n*c,this.y=a*c-r*f+i*o+n*l,this.z=a*f+r*c-i*l+n*o}multiplyVector(e,t=null){t||=new se;var a=e.x,r=e.y,i=e.z;return t.w=-this.x*a-this.y*r-this.z*i,t.x=this.w*a+this.y*i-this.z*r,t.y=this.w*r-this.x*i+this.z*a,t.z=this.w*i+this.x*r-this.y*a,t}fromAxisAngle(e,t){t*=Math.PI/180;var a=t*.5,r=Math.sin(a);this.w=Math.cos(a),this.x=e.x*r,this.y=e.y*r,this.z=e.z*r,this.normalize()}toAxisAngle(e){var t=this.x*this.x+this.y*this.y+this.z*this.z,a=0;return t>0?(a=2*Math.acos(this.w),t=1/Math.sqrt(t),e.x=this.x*t,e.y=this.y*t,e.z=this.z*t):(a=0,e.x=1,e.y=0,e.z=0),a}slerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h=r*l+i*c+n*f+o*d;if(h<0&&(h=-h,l=-l,c=-c,f=-f,d=-d),h<.95){var u=Math.acos(h),m=1/Math.sin(u),g=Math.sin(u*(1-a))*m,p=Math.sin(u*a)*m;this.w=r*g+l*p,this.x=i*g+c*p,this.y=n*g+f*p,this.z=o*g+d*p}else{this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o);var D=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z);this.w*=D,this.x*=D,this.y*=D,this.z*=D}}lerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h;r*l+i*c+n*f+o*d<0&&(l=-l,c=-c,f=-f,d=-d),this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o),h=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=h,this.x*=h,this.y*=h,this.z*=h}fromEulerAngles(e,t,a){e*=Dt,t*=Dt,a*=Dt;var r=e*.5,i=t*.5,n=a*.5,o=Math.cos(r),l=Math.sin(r),c=Math.cos(i),f=Math.sin(i),d=Math.cos(n),h=Math.sin(n);return this.w=o*c*d+l*f*h,this.x=l*c*d-o*f*h,this.y=o*f*d+l*c*h,this.z=o*c*h-l*f*d,this}setFromRotationMatrix(e){const t=e.rawData,a=t[0],r=t[4],i=t[8],n=t[1],o=t[5],l=t[9],c=t[2],f=t[6],d=t[10],h=a+o+d;if(h>0){const u=.5/Math.sqrt(h+1);this.w=.25/u,this.x=(f-l)*u,this.y=(i-c)*u,this.z=(n-r)*u}else if(a>o&&a>d){const u=2*Math.sqrt(1+a-o-d);this.w=(f-l)/u,this.x=.25*u,this.y=(r+n)/u,this.z=(i+c)/u}else if(o>d){const u=2*Math.sqrt(1+o-a-d);this.w=(i-c)/u,this.x=(r+n)/u,this.y=.25*u,this.z=(l+f)/u}else{const u=2*Math.sqrt(1+d-a-o);this.w=(n-r)/u,this.x=(i+c)/u,this.y=(l+f)/u,this.z=.25*u}return this}getEulerAngles(e){var t,a,r,i,n,o,l,c;return e||=new b,i=this.x,n=this.y,o=this.z,l=this.w,c=2*(l*n-i*o),c<=-.99999?(t=2*Math.atan2(i,l),a=-Math.PI/2,r=0):c>=.99999?(t=2*Math.atan2(i,l),a=Math.PI/2,r=0):(t=Math.atan2(2*(l*i+n*o),1-2*(i*i+n*n)),a=Math.asin(c),r=Math.atan2(2*(l*o+i*n),1-2*(n*n+o*o))),e.set(t,a,r).scaleBy($r)}normalize(e=1){var t=e/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);this.x*=t,this.y*=t,this.z*=t,this.w*=t}toString(){return"{x:"+this.x+" y:"+this.y+" z:"+this.z+" w:"+this.w+"}"}fromMatrix(e){var t=e.decompose(na.QUATERNION)[1];this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}inverse(e=null){e||=new se;var t=this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z;if(t>0){var a=1/t;e.w=this.w*a,e.x=-this.x*a,e.y=-this.y*a,e.z=-this.z*a}return e}clone(){return new se(this.x,this.y,this.z,this.w)}transformVector(e,t=null){var a,r,i,n,o=e.x,l=e.y,c=e.z;return t||=new b,n=-this.x*o-this.y*l-this.z*c,a=this.w*o+this.y*c-this.z*l,r=this.w*l-this.x*c+this.z*o,i=this.w*c+this.x*l-this.y*o,t.x=-n*this.x+a*this.w-r*this.z+i*this.y,t.y=-n*this.y+a*this.z+r*this.w-i*this.x,t.z=-n*this.z-a*this.y+r*this.x+i*this.w,t}copyFrom(e){var t=this;return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,this}mul(e,t,a){let r=a||new se;return r.x=e.w*t.x+e.x*t.w+e.y*t.z-e.z*t.y,r.y=e.w*t.y+e.y*t.w+e.z*t.x-e.x*t.z,r.z=e.w*t.z+e.z*t.w+e.x*t.y-e.y*t.x,r.w=e.w*t.w-e.x*t.x-e.y*t.y-e.z*t.z,r}clampf(e,t,a){if(t>a){var r=t;t=a,a=r}return e<t?t:e<a?e:a}static serialize(e){return new se(e.x,e.y,e.z,e.w)}}function $u(s,e,t){let a=s.x*2,r=s.y*2,i=s.z*2,n=s.x*a,o=s.y*r,l=s.z*i,c=s.x*r,f=s.x*i,d=s.y*i,h=s.w*a,u=s.w*r,m=s.w*i,g=t||new b;return g.x=(1-(o+l))*e.x+(c-m)*e.y+(f+u)*e.z,g.y=(c+m)*e.x+(1-(n+l))*e.y+(d-h)*e.z,g.z=(f-u)*e.x+(d+h)*e.y+(1-(n+o))*e.z,g}class ns{_x=0;_y=0;_z=0;_w=0;constructor(e=0){this.seed=e}get seed(){return this._x}set seed(e){this._x=e,this._y=this._x*1812433253+1,this._z=this._y*1812433253+1,this._w=this._z*1812433253+1}static getFloatFromInt(e){return Math.floor((e&8388607)*(1/8388607))}static getByteFromInt(e){return e>>15}clone(){let e=new ns;return e._x=this._x,e._y=this._y,e._z=this._z,e._w=this._w,e}get(){let e=this._x^this._x<<11;return this._x=this._y,this._y=this._z,this._z=this._w,this._w=this._w^this._w>>19^(e^e>>8)}getFloat(){return Oc(this.get())}getSignedFloat(){return this.getFloat()*2-1}}let $r=180/Math.PI,Dt=Math.PI/180,e2=2147483647,t2=-2147483647;function Be(s,e,t){return Math.max(e,Math.min(t,s))}class Gt{static gaussFunction(e,t,a,r){let i=Math.pow(e-a,2),n=2*Math.pow(r,2),o=-1*(i/n),l=Math.pow(Math.E,o);return Math.round(l*t)}static computeGaussian(e,t){return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(e*e)/(2*t*t))}static gaussCoef(e){e<.5&&(e=.5);let t=Math.exp(.726*.726)/e,a=Math.exp(-t),r=Math.exp(-2*t),i=(1-a)*(1-a)/(1+2*t*a-r),n=i,o=i*(t-1)*a,l=i*(t+1)*a,c=-i*r,f=2*a,d=-r,h=(n+o)/(1-f-d),u=(l+c)/(1-f-d);return new Float32Array([n,o,l,c,f,d,h,u])}static clampf(e,t,a){if(t>a){let r=t;t=a,a=r}return e<t?t:e<a?e:a}static normalizeAngle(e){for(;e>180;)e-=360;for(;e<-180;)e+=360;return e}static fract(e){return e-Math.floor(e)}static getRandDirXZ(e){let t=e*Math.random(),a=360*Math.random()*Dt,r=Math.cos(a)*t,i=Math.sin(a)*t;return{x:r,z:i}}static getRandDirXYZ(e){let t=e*Math.random(),a=360*Math.random()*Dt,r=Math.cos(a)*t,i=Math.tan(a)*t,n=Math.sin(a)*t;return new b(r,i,n)}static getCycleXYZ(e){let t=e*Math.random(),a=360*Math.random()*Dt,r=Math.cos(a)*t,i=e*Math.random()-e*.5,n=Math.sin(a)*t;return new b(r,i,n)}static angle(e,t){let a=de.HELP_0,r=de.HELP_1;return a.set(e.x,e.z),r.set(t.x,t.z),Math.acos((a.x*r.x+a.y*r.y)/(a.abs()*r.abs()))}static angle_360(e,t){let a=b.HELP_0;return e.crossProduct(t,a),a.z>0?Gt.angle(e,t):360-Gt.angle(e,t)}getRotationY(e){return Gt.normalizeAngle(Math.atan2(e.z,e.x)*$r)}static fromToRotation(e,t,a=null){a||=new se;let r=R.help_matrix_2;return R.fromToRotation(e,t,r),a.fromMatrix(r),a}static getEularDir_yUp(e){let t=se.HELP_0;return t.fromEulerAngles(0,e,0),t.transformVector(b.Z_AXIS,b.HELP_5),b.HELP_5}static transformVector(e,t,a=null){a||=new b;let r=e.rawData,i=r[0],n=r[1],o=r[2],l=r[3],c=r[4],f=r[5],d=r[6],h=r[7],u=r[8],m=r[9],g=r[10],p=r[11],D=r[12],A=r[13],B=r[14],v=r[15],U=t.x,y=t.y,S=t.z;return a.x=i*U+c*y+u*S+D,a.y=n*U+f*y+m*S+A,a.z=o*U+d*y+g*S+B,a.w=l*U+h*y+p*S+v,a}}let Mr=function(s,e,t){return s*(1-t)+e*t};function a2(s,e,t){let a=new b,r=s.x,i=s.y,n=s.z,o=s.w,l=e.x,c=e.y,f=e.z,d=e.w;return a.x=(l-r)*t+r,a.y=(c-i)*t+i,a.z=(f-n)*t+n,a.w=(d-o)*t+o,a}function r2(s,e,t){let a=new J;return a.r=(1-t)*s.r+t*e.r,a.g=(1-t)*s.g+t*e.g,a.b=(1-t)*s.b+t*e.b,a.a=(1-t)*s.a+t*e.a,a}function i2(s,e,t){return s+((e-s)*t>>8)&255}let In=function(s,e,t){let a=t-e;return Math.floor(s/a)%2==0?s%a+e:t-s%a+e},Rn=function(s,e,t){let a=t-e;return s%a+e},s2=function(s,e){let t=0;for(let a in s)a==e&&t++;return t};class n2{x=0;y=0;z=0;w=0;randSeedList;constructor(){this.randSeedList=[]}reset(){this.x=Math.random()*1,this.y=Math.random()*1,this.z=Math.random()*1,this.w=Math.random()*1,this.randSeedList.length=0;for(let e=0;e<20;e++)this.randSeedList.push(Math.random()*1)}}function Ft(s,e){return s instanceof b&&e instanceof b||s instanceof se&&e instanceof se?s.x*e.x+s.y*e.y+s.z*e.z:s.x*e.x+s.y*e.y}function Qn(s,e){return new b(s.x*e.x,s.y*e.y,s.z*e.z)}function Pc(s){return Math.sqrt(s)}function Tn(s){return Pc(Ft(s,s))}function Vc(s,e){if(Tn(s)>b.EPSILON)return s.divide(Tn(s));if(s instanceof de)return new de;if(s instanceof b)return new b;if(s instanceof se)return new se}function Oc(s){return(s&8388607)*(1/8388607)}function ei(s){return s.getFloat()}function _t(s,e,t){let a=s.getFloat();return a=e*a+(1-a)*t,a}function o2(s,e,t){let a;if(e<t){a=t-e;let r=s.get()%a;return r+=e,r}else if(e>t){a=e-t;let r=s.get()%a;return r=e-r,r}else return e}function ks(s){let e=_t(s,-1,1),t=_t(s,0,2*Math.PI),a=Math.sqrt(1-e*e),r=a*Math.cos(t),i=a*Math.sin(t);return new b(r,i,e)}function Lc(s){let e=_t(s,0,2*Math.PI),t=Math.cos(e),a=Math.sin(e);return new de(t,a)}function l2(s){let e=new se;return e.x=_t(s,-1,1),e.y=_t(s,-1,1),e.z=_t(s,-1,1),e.w=_t(s,-1,1),e=Vc(e),Ft(e,se.identity())<0?-e:e}function c2(s){const e=2*Math.PI;let t=_t(s,0,1),a=_t(s,0,e),r=_t(s,0,e),i=Math.sqrt(1-t),n=Math.sqrt(t),o=new se(i*Math.sin(a),i*Math.cos(a),n*Math.sin(r),n*Math.cos(r));return Ft(o,se.identity())<0?-o:o}function f2(s,e){return new b(_t(s,-e.x,e.x),_t(s,-e.y,e.y),_t(s,-e.z,e.z))}function Gc(s){let e=ks(s);return e.scaleBy(Math.pow(ei(s),1/3)),e}function d2(s,e){return Qn(Gc(s),e)}function h2(s,e,t){let a=ks(s),r=Math.pow(_t(s,0,1),1/3);return a.scaleBy(e+(t-e)*r),a}function u2(s){let e=Lc(s);return e.multiply(Math.pow(_t(s,0,1),1/2),e),e}function b2(s,e,t){let a=Qn(ks(s),e),r=Math.pow(_t(s,t,1),1/3);return a.scaleBy(r),a}function g2(s){let e=s.getFloat(),t=s.getFloat();e+t>1&&(e=1-e,t=1-t);let a=1-e-t;return new b(e,t,a)}function p2(s){return s/360*2*Math.PI}function m2(s){return 180*s/Math.PI}function A2(s){return Math.sin(s)}function D2(s){return Math.cos(s)}let zc=4919;function _2(){return++zc}function B2(s,e,t){let a=s[e],r=s[t];s[e]=r,s[t]=a}function Wc(s){return Math.floor(s)}function Mn(s){return Wc(s+.5)}function v2(s){return s=Math.max(s,0),s=Math.min(s,1),Mn(s*65535)}function x2(s){return s=Math.max(s,0),s=Math.min(s,1),Mn(s*255)}function Jc(s){return Math.abs(s)==0?s:1/Math.sqrt(s)}function U2(s){let e=Nn(s);return s.scaleBy(Jc(e))}function y2(s,e){return s.crossProduct(e)}function Nn(s){return Ft(s,s)}function C2(s){let e=new ns(s);return ei(e)}function S2(s,e){let t=new ns(e);s.x=ei(t),s.y=ei(t),s.z=ei(t)}function F2(s,e,t){return s<e?t:s>t?e:s}function Pn(s,e){return s-Math.floor(s/e)*e}const k2=1e-6;class R{static blockBytes=64;static block=16;static allocCount=1e3;static allocOnceCount=1e3;static maxCount=50*1e4;static useCount=0;static buffer;static wasmMatrixPtr=0;static dynamicMatrixBytes;static dynamicGlobalMatrixRef;static wasm;static help_matrix_0;static help_matrix_1;static help_matrix_2;static helpMatrix;static helpMatrix2;static _getEulerMatrix;static _zero=new b(0,0,0);static _one=new b(1,1,1);static _prs=[new b,new b,new b];index=0;offset=0;rawData;_position;static allocMatrix(e){this.allocCount=e,R.dynamicMatrixBytes=Re.matrixBuffer,R.buffer=R.dynamicMatrixBytes.buffer,R.wasmMatrixPtr=Re.matrixBufferPtr,this.dynamicGlobalMatrixRef||=[],this.dynamicGlobalMatrixRef.forEach(t=>{t.offset=R.wasmMatrixPtr+t.index*R.blockBytes,t.rawData=ur(R.dynamicMatrixBytes.buffer,t.offset,16)}),R.help_matrix_0||=new R,R.help_matrix_1||=new R,R.help_matrix_2||=new R,R.helpMatrix||=new R,R.helpMatrix2||=new R,R._getEulerMatrix||=new R,R._getEulerMatrix.identity()}static fromToRotation(e,t,a){return a||=new R,a.transformDir(e,t),a}static fromArray(e){if(e.length!==16)throw new Error("Array must contain exactly 16 elements");const t=new R;for(let a=0;a<16;a++)t.rawData[a]=e[a];return t}static getAxisRotation(e,t,a,r){let i=new R,n=r*(Math.PI/180),o=Math.cos(n),l=Math.sin(n),c=1-o,f,d;return i.rawData[0]=o+e*e*c,i.rawData[5]=o+t*t*c,i.rawData[10]=o+a*a*c,f=e*t*c,d=a*l,i.rawData[1]=f+d,i.rawData[4]=f-d,f=e*a*c,d=t*l,i.rawData[8]=f+d,i.rawData[2]=f-d,f=t*a*c,d=e*l,i.rawData[9]=f-d,i.rawData[6]=f+d,i}static sanitizeEuler(e){R.makePositive(e)}static makePositive(e){let t=-1e-4,a=Math.PI*2-1e-4;e.x<t?e.x+=2*Math.PI:e.x>a&&(e.x-=2*Math.PI),e.y<t?e.y+=2*Math.PI:e.y>a&&(e.y-=2*Math.PI),e.z<t?e.z+=2*Math.PI:e.z>a&&(e.z-=2*Math.PI)}static matrixToEuler(e,t){return e.get(1,2)<.999?e.get(1,2)>-.999?(t.x=Math.asin(-e.get(1,2)),t.y=Math.atan2(e.get(0,2),e.get(2,2)),t.z=Math.atan2(e.get(1,0),e.get(1,1)),R.sanitizeEuler(t),!0):(t.x=Math.PI*.5,t.y=Math.atan2(e.get(0,1),e.get(0,0)),t.z=0,R.sanitizeEuler(t),!1):(t.x=-Math.PI*.5,t.y=Math.atan2(-e.get(0,1),e.get(0,0)),t.z=0,R.sanitizeEuler(t),!1)}static matrixMultiply(e,t,a){R.wasm.Matrix_Multiply(e.index,t.index,a.index)}static matrixAppend(e,t,a){R.wasm.Matrix_Append(e.index,t.index,a.index)}static matrixRotateY(e,t){R.wasm.Matrix_Append(e,t.index)}static matrixRotate(e,t,a){R.wasm.Matrix_Rotate(e,t,a.index)}constructor(e=!1){if(R.useCount>=R.allocCount){let t=R.allocCount+R.allocOnceCount;Re.allocMatrix(t)}this.index=R.useCount,this.offset=R.wasmMatrixPtr+this.index*R.blockBytes,R.dynamicGlobalMatrixRef[this.index]=this,R.useCount++,this.rawData=ur(R.dynamicMatrixBytes.buffer,this.offset,16),this._position=new b,this.identity()}lookAt(e,t,a=b.Y_AXIS){let r=this.rawData,i=t.subtract(e,b.HELP_0);i.length===0&&(i.z=1),i.normalize();let n=a.crossProduct(i,b.HELP_1);n.length===0&&(Math.abs(a.z)===1?i.x+=1e-4:i.z-=1e-4,i.normalize(),n=a.crossProduct(i,b.HELP_1)),n.normalize();let o=i.crossProduct(n,b.HELP_2);r[0]=n.x,r[1]=o.x,r[2]=i.x,r[3]=0,r[4]=n.y,r[5]=o.y,r[6]=i.y,r[7]=0,r[8]=n.z,r[9]=o.z,r[10]=i.z,r[11]=0,r[12]=-n.dotProduct(e),r[13]=-o.dotProduct(e),r[14]=-i.dotProduct(e),r[15]=1}static floatArray=new Float64Array(16).fill(0);multiply(e){let t=this.rawData,a=e.rawData,r=R.floatArray;r[0]=t[0]*a[0]+t[1]*a[4]+t[2]*a[8]+t[3]*a[12],r[1]=t[0]*a[1]+t[1]*a[5]+t[2]*a[9]+t[3]*a[13],r[2]=t[0]*a[2]+t[1]*a[6]+t[2]*a[10]+t[3]*a[14],r[3]=t[0]*a[3]+t[1]*a[7]+t[2]*a[11]+t[3]*a[15],r[4]=t[4]*a[0]+t[5]*a[4]+t[6]*a[8]+t[7]*a[12],r[5]=t[4]*a[1]+t[5]*a[5]+t[6]*a[9]+t[7]*a[13],r[6]=t[4]*a[2]+t[5]*a[6]+t[6]*a[10]+t[7]*a[14],r[7]=t[4]*a[3]+t[5]*a[7]+t[6]*a[11]+t[7]*a[15],r[8]=t[8]*a[0]+t[9]*a[4]+t[10]*a[8]+t[11]*a[12],r[9]=t[8]*a[1]+t[9]*a[5]+t[10]*a[9]+t[11]*a[13],r[10]=t[8]*a[2]+t[9]*a[6]+t[10]*a[10]+t[11]*a[14],r[11]=t[8]*a[3]+t[9]*a[7]+t[10]*a[11]+t[11]*a[15],r[12]=t[12]*a[0]+t[13]*a[4]+t[14]*a[8]+t[15]*a[12],r[13]=t[12]*a[1]+t[13]*a[5]+t[14]*a[9]+t[15]*a[13],r[14]=t[12]*a[2]+t[13]*a[6]+t[14]*a[10]+t[15]*a[14],r[15]=t[12]*a[3]+t[13]*a[7]+t[14]*a[11]+t[15]*a[15],t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]}multiplyMatrices(e,t){const a=e.rawData,r=t.rawData,i=this.rawData,n=a[0],o=a[4],l=a[8],c=a[12],f=a[1],d=a[5],h=a[9],u=a[13],m=a[2],g=a[6],p=a[10],D=a[14],A=a[3],B=a[7],v=a[11],U=a[15],y=r[0],S=r[4],F=r[8],C=r[12],w=r[1],E=r[5],Q=r[9],T=r[13],j=r[2],ue=r[6],ee=r[10],N=r[14],M=r[3],O=r[7],W=r[11],ae=r[15];return i[0]=n*y+o*w+l*j+c*M,i[4]=n*S+o*E+l*ue+c*O,i[8]=n*F+o*Q+l*ee+c*W,i[12]=n*C+o*T+l*N+c*ae,i[1]=f*y+d*w+h*j+u*M,i[5]=f*S+d*E+h*ue+u*O,i[9]=f*F+d*Q+h*ee+u*W,i[13]=f*C+d*T+h*N+u*ae,i[2]=m*y+g*w+p*j+D*M,i[6]=m*S+g*E+p*ue+D*O,i[10]=m*F+g*Q+p*ee+D*W,i[14]=m*C+g*T+p*N+D*ae,i[3]=A*y+B*w+v*j+U*M,i[7]=A*S+B*E+v*ue+U*O,i[11]=A*F+B*Q+v*ee+U*W,i[15]=A*C+B*T+v*N+U*ae,this}multiplyPoint3(e,t){t||=new b;let a=this.rawData;return t.x=a[0]*e.x+a[4]*e.y+a[8]*e.z+a[12],t.y=a[1]*e.x+a[5]*e.y+a[9]*e.z+a[13],t.z=a[2]*e.x+a[6]*e.y+a[10]*e.z+a[14],t}multiplyVector4(e,t){t||=new b;let a=this.rawData,r=e.x,i=e.y,n=e.z,o=a[3]*r+a[7]*i+a[11]*n+a[15];return o=o||1,t.x=(a[0]*r+a[4]*i+a[8]*n+a[12])/o,t.y=(a[1]*r+a[5]*i+a[9]*n+a[13])/o,t.z=(a[2]*r+a[6]*i+a[10]*n+a[14])/o,t.w=1,t}transformVector4(e,t){let a=this.rawData;t||=new b;let r=e.x,i=e.y,n=e.z,o=e.w;return t.x=r*a[0]+i*a[4]+n*a[8]+o*a[12],t.y=r*a[1]+i*a[5]+n*a[9]+o*a[13],t.z=r*a[2]+i*a[6]+n*a[10]+o*a[14],t.w=r*a[3]+i*a[7]+n*a[11]+o*a[15],t}perspectiveMultiplyPoint3(e,t){let a=b.HELP_2,r,i=this.rawData;if(a.x=i[0]*e.x+i[4]*e.y+i[8]*e.z+i[12],a.y=i[1]*e.x+i[5]*e.y+i[9]*e.z+i[13],a.z=i[2]*e.x+i[6]*e.y+i[10]*e.z+i[14],r=i[3]*e.x+i[7]*e.y+i[11]*e.z+i[15],Math.abs(r)>1e-7){let n=1/r;return t.x=a.x*n,t.y=a.y*n,t.z=a.z*n,!0}else return t.x=0,t.y=0,t.z=0,!1}perspective(e,t,a,r){let i=this.rawData,n=e*Dt/2,o=Math.cos(n)/Math.sin(n);i[0]=-o/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r/(r-a),i[11]=1,i[12]=0,i[13]=0,i[14]=-a*r/(r-a),i[15]=0}perspective3(e,t,a,r){let i=Math.tan(e*Math.PI/360)*a,n=i*t;this.frustum(-n,n,-i,i,a,r)}frustum(e,t,a,r,i,n){let o=this.rawData;o[0]=-2*i/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*i/(r-a),o[6]=0,o[7]=0,o[8]=(t+e)/(t-e),o[9]=(r+a)/(r-a),o[10]=n/(n-i),o[11]=1,o[12]=0,o[13]=0,o[14]=-n*i/(n-i),o[15]=0}ortho(e,t,a,r){let i=this.rawData;return i[0]=2/e,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/t,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1/(r-a),i[11]=0,i[12]=0,i[13]=0,i[14]=a/(a-r),i[15]=1,this}orthoZO(e,t,a,r,i,n){let o=this.rawData,l=1/(e-t),c=1/(a-r),f=1/(i-n);return o[0]=-2*l,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*c,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=f,o[11]=0,o[12]=(e+t)*l,o[13]=(r+a)*c,o[14]=i*f,o[15]=1,this}orthoOffCenter(e,t,a,r,i,n){let o=this.rawData;o[0]=2/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2/(r-a),o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1/(n-i),o[11]=0,o[12]=(e+t)/(e-t),o[13]=(r+a)/(a-r),o[14]=i/(i-n),o[15]=1}transformDir(e,t){let a=this.rawData,r=1e-6,i=b.ZERO;t.crossProduct(e,i);let n=t.dotProduct(e);if(n>1-r)this.identity();else if(n<-1+r){let o=b.HELP_1,l=b.HELP_2,c=0,f,d,h,u,m,g,p,D,A,B,v,U,y,S,F,C,w,E;l.x=0,l.y=e.z,l.z=-e.y,l.dotProduct(l)<r&&(l.x=-e.z,l.y=0,l.z=e.x),c=1/Math.sqrt(l.dotProduct(l)),l.x*=c,l.y*=c,l.z*=c,l.crossProduct(e,o),f=-e.x*e.x,d=-e.y*e.y,h=-e.z*e.z,u=-e.x*e.y,m=-e.x*e.z,g=-e.y*e.z,p=o.x*o.x,D=o.y*o.y,A=o.z*o.z,B=o.x*o.y,v=o.x*o.z,U=o.y*o.z,y=-l.x*l.x,S=-l.y*l.y,F=-l.z*l.z,C=-l.x*l.y,w=-l.x*l.z,E=-l.y*l.z,a[0]=f+p+y,a[1]=u+B+C,a[2]=m+v+w,a[4]=a[1],a[5]=d+D+S,a[6]=g+U+E,a[8]=a[2],a[9]=a[6],a[10]=h+A+F,a[3]=0,a[7]=0,a[11]=0,a[15]=1}else{let o,l,c,f,d,h=i.dotProduct(i),u=(1-n)/h;o=u*i.x,l=u*i.z,c=o*i.y,f=o*i.z,d=l*i.y,a[0]=n+o*i.x,a[1]=c-i.z,a[2]=f+i.y,a[4]=c+i.z,a[5]=n+u*i.y*i.y,a[6]=d-i.x,a[8]=f-i.y,a[9]=d+i.x,a[10]=n+l*i.z,a[3]=0,a[7]=0,a[11]=0,a[15]=1}return this}append(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],u=t[10],m=t[14],g=t[3],p=t[7],D=t[11],A=t[15];t[0]=a*e.rawData[0]+o*e.rawData[4]+d*e.rawData[8]+g*e.rawData[12],t[1]=a*e.rawData[1]+o*e.rawData[5]+d*e.rawData[9]+g*e.rawData[13],t[2]=a*e.rawData[2]+o*e.rawData[6]+d*e.rawData[10]+g*e.rawData[14],t[3]=a*e.rawData[3]+o*e.rawData[7]+d*e.rawData[11]+g*e.rawData[15],t[4]=r*e.rawData[0]+l*e.rawData[4]+h*e.rawData[8]+p*e.rawData[12],t[5]=r*e.rawData[1]+l*e.rawData[5]+h*e.rawData[9]+p*e.rawData[13],t[6]=r*e.rawData[2]+l*e.rawData[6]+h*e.rawData[10]+p*e.rawData[14],t[7]=r*e.rawData[3]+l*e.rawData[7]+h*e.rawData[11]+p*e.rawData[15],t[8]=i*e.rawData[0]+c*e.rawData[4]+u*e.rawData[8]+D*e.rawData[12],t[9]=i*e.rawData[1]+c*e.rawData[5]+u*e.rawData[9]+D*e.rawData[13],t[10]=i*e.rawData[2]+c*e.rawData[6]+u*e.rawData[10]+D*e.rawData[14],t[11]=i*e.rawData[3]+c*e.rawData[7]+u*e.rawData[11]+D*e.rawData[15],t[12]=n*e.rawData[0]+f*e.rawData[4]+m*e.rawData[8]+A*e.rawData[12],t[13]=n*e.rawData[1]+f*e.rawData[5]+m*e.rawData[9]+A*e.rawData[13],t[14]=n*e.rawData[2]+f*e.rawData[6]+m*e.rawData[10]+A*e.rawData[14],t[15]=n*e.rawData[3]+f*e.rawData[7]+m*e.rawData[11]+A*e.rawData[15]}add(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],u=t[10],m=t[14],g=t[3],p=t[7],D=t[11],A=t[15],B=e.rawData[0],v=e.rawData[4],U=e.rawData[8],y=e.rawData[12],S=e.rawData[1],F=e.rawData[5],C=e.rawData[9],w=e.rawData[13],E=e.rawData[2],Q=e.rawData[6],T=e.rawData[10],j=e.rawData[14],ue=e.rawData[3],ee=e.rawData[7],N=e.rawData[11],M=e.rawData[15];return t[0]=a+B,t[1]=o+S,t[2]=d+E,t[3]=g+ue,t[4]=r+v,t[5]=l+F,t[6]=h+Q,t[7]=p+ee,t[8]=i+U,t[9]=c+C,t[10]=u+T,t[11]=D+N,t[12]=n+y,t[13]=f+w,t[14]=m+j,t[15]=A+M,this}sub(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],u=t[10],m=t[14],g=t[3],p=t[7],D=t[11],A=t[15],B=e.rawData[0],v=e.rawData[4],U=e.rawData[8],y=e.rawData[12],S=e.rawData[1],F=e.rawData[5],C=e.rawData[9],w=e.rawData[13],E=e.rawData[2],Q=e.rawData[6],T=e.rawData[10],j=e.rawData[14],ue=e.rawData[3],ee=e.rawData[7],N=e.rawData[11],M=e.rawData[15];return t[0]=a-B,t[1]=o-S,t[2]=d-E,t[3]=g-ue,t[4]=r-v,t[5]=l-F,t[6]=h-Q,t[7]=p-ee,t[8]=i-U,t[9]=c-C,t[10]=u-T,t[11]=D-N,t[12]=n-y,t[13]=f-w,t[14]=m-j,t[15]=A-M,this}mult(e){let t=this.rawData;return t[0]*=e,t[1]*=e,t[2]*=e,t[3]*=e,t[4]*=e,t[5]*=e,t[6]*=e,t[7]*=e,t[8]*=e,t[9]*=e,t[10]*=e,t[11]*=e,t[12]*=e,t[13]*=e,t[14]*=e,t[15]*=e,this}appendRotation(e,t){let a=R.getAxisRotation(t.x,t.y,t.z,e);this.append(a)}createByRotation(e,t){let a=R.helpMatrix,r,i,n=e*Dt;return r=Math.sin(n),i=Math.cos(n),t.x==1&&(a.rawData[0]=1,a.rawData[1]=0,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=i,a.rawData[6]=r,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=-r,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.y==1&&(a.rawData[0]=i,a.rawData[1]=0,a.rawData[2]=-r,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=1,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=r,a.rawData[9]=0,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.z==1&&(a.rawData[0]=i,a.rawData[1]=r,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=-r,a.rawData[5]=i,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=0,a.rawData[10]=1,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),this.append(a),this}appendScale(e,t,a){R.helpMatrix.createByScale(e,t,a),this.append(R.helpMatrix)}createByScale(e,t,a){let r=this.rawData;r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1}appendTranslation(e,t,a){let r=this.rawData;r[12]+=e,r[13]+=t,r[14]+=a}clone(){let e=new R;return e.copyFrom(this),e}copyRowFrom(e,t){let a=this.rawData;switch(e){case 0:a[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=t.w;break;case 1:a[4]=t.x,a[5]=t.y,a[6]=t.z,a[7]=t.w;break;case 2:a[8]=t.x,a[9]=t.y,a[10]=t.z,a[11]=t.w;break;case 3:a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=t.w;break}}copyRowTo(e,t){let a=this.rawData;switch(e){case 0:t.x=a[0],t.y=a[1],t.z=a[2],t.w=a[3];break;case 1:t.x=a[4],t.y=a[5],t.z=a[6],t.w=a[7];break;case 2:t.x=a[8],t.y=a[9],t.z=a[10],t.w=a[11];break;case 3:t.x=a[12],t.y=a[13],t.z=a[14],t.w=a[15];break}}copyFrom(e){let t=this.rawData;return t[0]=e.rawData[0],t[1]=e.rawData[1],t[2]=e.rawData[2],t[3]=e.rawData[3],t[4]=e.rawData[4],t[5]=e.rawData[5],t[6]=e.rawData[6],t[7]=e.rawData[7],t[8]=e.rawData[8],t[9]=e.rawData[9],t[10]=e.rawData[10],t[11]=e.rawData[11],t[12]=e.rawData[12],t[13]=e.rawData[13],t[14]=e.rawData[14],t[15]=e.rawData[15],this}copyRawDataTo(e,t=0,a=!1){let r=this.rawData;e[0+t]=r[0],e[1+t]=r[1],e[2+t]=r[2],e[3+t]=r[3],e[4+t]=r[4],e[5+t]=r[5],e[6+t]=r[6],e[7+t]=r[7],e[8+t]=r[8],e[9+t]=r[9],e[10+t]=r[10],e[11+t]=r[11],e[12+t]=r[12],e[13+t]=r[13],e[14+t]=r[14],e[15+t]=r[15]}copyColFrom(e,t){let a=this.rawData;switch(e){case 0:a[0]=t.x,a[4]=t.y,a[8]=t.z,a[12]=t.w;break;case 1:a[1]=t.x,a[5]=t.y,a[9]=t.z,a[13]=t.w;break;case 2:a[2]=t.x,a[6]=t.y,a[10]=t.z,a[14]=t.w;break;case 3:a[3]=t.x,a[7]=t.y,a[11]=t.z,a[15]=t.w;break}}copyColTo(e,t){let a=this.rawData;switch(e){case 0:t.x=a[0],t.y=a[4],t.z=a[8],t.w=a[12];break;case 1:t.x=a[1],t.y=a[5],t.z=a[9],t.w=a[13];break;case 2:t.x=a[2],t.y=a[6],t.z=a[10],t.w=a[14];break;case 3:t.x=a[3],t.y=a[7],t.z=a[11],t.w=a[15];break}}copyToMatrix3D(e){e.rawData=this.rawData.slice(0)}makeRotationFromQuaternion(e){return this.compose(R._zero,e,R._one),this}static decomposeRawData=new Float64Array(16).fill(0);decompose(e="eulerAngles",t){let a=se.CALCULATION_QUATERNION,r=t||R._prs;this.copyRawDataTo(R.decomposeRawData);let i=R.decomposeRawData,n=r[0];n.x=i[12],n.y=i[13],n.z=i[14],i[12]=0,i[13]=0,i[14]=0;let o=r[2];o.x=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]),o.y=Math.sqrt(i[4]*i[4]+i[5]*i[5]+i[6]*i[6]),o.z=Math.sqrt(i[8]*i[8]+i[9]*i[9]+i[10]*i[10]),i[0]*(i[5]*i[10]-i[6]*i[9])-i[1]*(i[4]*i[10]-i[6]*i[8])+i[2]*(i[4]*i[9]-i[5]*i[8])<0&&(o.z=-o.z),i[0]/=o.x,i[1]/=o.x,i[2]/=o.x,i[4]/=o.y,i[5]/=o.y,i[6]/=o.y,i[8]/=o.z,i[9]/=o.z,i[10]/=o.z;let l=r[1],c;switch(e){case na.AXIS_ANGLE:l.w=Math.acos((i[0]+i[5]+i[10]-1)/2);let f=Math.sqrt((i[6]-i[9])*(i[6]-i[9])+(i[8]-i[2])*(i[8]-i[2])+(i[1]-i[4])*(i[1]-i[4]));l.x=(i[6]-i[9])/f,l.y=(i[8]-i[2])/f,l.z=(i[1]-i[4])/f;break;case na.QUATERNION:c=i[0]+i[5]+i[10],c>0?(l.w=Math.sqrt(1+c)/2,l.x=(i[6]-i[9])/(4*l.w),l.y=(i[8]-i[2])/(4*l.w),l.z=(i[1]-i[4])/(4*l.w)):i[0]>i[5]&&i[0]>i[10]?(l.x=Math.sqrt(1+i[0]-i[5]-i[10])/2,l.w=(i[6]-i[9])/(4*l.x),l.y=(i[1]+i[4])/(4*l.x),l.z=(i[8]+i[2])/(4*l.x)):i[5]>i[10]?(l.y=Math.sqrt(1+i[5]-i[0]-i[10])/2,l.x=(i[1]+i[4])/(4*l.y),l.w=(i[8]-i[2])/(4*l.y),l.z=(i[6]+i[9])/(4*l.y)):(l.z=Math.sqrt(1+i[10]-i[0]-i[5])/2,l.x=(i[8]+i[2])/(4*l.z),l.y=(i[6]+i[9])/(4*l.z),l.w=(i[1]-i[4])/(4*l.z));break;case na.EULER_ANGLES:c=i[0]+i[5]+i[10],c>0?(a.w=Math.sqrt(1+c)/2,a.x=(i[6]-i[9])/(4*a.w),a.y=(i[8]-i[2])/(4*a.w),a.z=(i[1]-i[4])/(4*a.w)):i[0]>i[5]&&i[0]>i[10]?(a.x=Math.sqrt(1+i[0]-i[5]-i[10])/2,a.w=(i[6]-i[9])/(4*a.x),a.y=(i[1]+i[4])/(4*a.x),a.z=(i[8]+i[2])/(4*a.x)):i[5]>i[10]?(l.y=Math.sqrt(1+i[5]-i[0]-i[10])/2,a.x=(i[1]+i[4])/(4*a.y),a.w=(i[8]-i[2])/(4*a.y),a.z=(i[6]+i[9])/(4*a.y)):(a.z=Math.sqrt(1+i[10]-i[0]-i[5])/2,a.x=(i[8]+i[2])/(4*a.z),a.y=(i[6]+i[9])/(4*a.z),a.w=(i[1]-i[4])/(4*a.z)),a.getEulerAngles(l);break}return r[0]=n,r[1]=l,r[2]=o,r}static getEuler(e,t,a=!0,r){return e||=new b,R._getEulerMatrix.makeRotationFromQuaternion(t).makeEuler(e,a,r),e}compose(e,t,a){const r=this.rawData,i=t.x,n=t.y,o=t.z,l=t.w,c=i+i,f=n+n,d=o+o,h=i*c,u=i*f,m=i*d,g=n*f,p=n*d,D=o*d,A=l*c,B=l*f,v=l*d,U=a.x,y=a.y,S=a.z;return r[0]=(1-(g+D))*U,r[1]=(u+v)*U,r[2]=(m-B)*U,r[3]=0,r[4]=(u-v)*y,r[5]=(1-(h+D))*y,r[6]=(p+A)*y,r[7]=0,r[8]=(m+B)*S,r[9]=(p-A)*S,r[10]=(1-(h+g))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}deltaTransformVector(e,t){t||=new b;let a=this.rawData,r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t.w=r*a[3]+i*a[7]+n*a[11],t}identity(){let e=this.rawData;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}fill(e){let t=this.rawData;t[1]=e,t[2]=e,t[3]=e,t[4]=e,t[6]=e,t[7]=e,t[8]=e,t[9]=e,t[11]=e,t[12]=e,t[13]=e,t[14]=e,t[0]=e,t[5]=e,t[10]=e,t[15]=e}invers33(){let e=this.rawData,t=e[5]*e[10]-e[9]*e[6],a=e[8]*e[6]-e[4]*e[10],r=e[4]*e[9]-e[8]*e[5],i=e[9]*e[2]-e[1]*e[10],n=e[0]*e[10]-e[8]*e[2],o=e[8]*e[1]-e[0]*e[9],l=e[1]*e[6]-e[5]*e[2],c=e[4]*e[2]-e[0]*e[6],f=e[0]*e[5]-e[4]*e[1],d=e[0]*t+e[4]*i+e[8]*l;if(Math.abs(d)>1e-11){let h=1/d;e[0]=h*t,e[4]=h*a,e[8]=h*r,e[1]=h*i,e[5]=h*n,e[9]=h*o,e[2]=h*l,e[6]=h*c,e[10]=h*f}}invert(){let e=this.determinant,t=Math.abs(e)>1e-11,a=this.rawData;if(t){e=1/e;let r=a[0],i=a[4],n=a[8],o=a[12],l=a[1],c=a[5],f=a[9],d=a[13],h=a[2],u=a[6],m=a[10],g=a[14],p=a[3],D=a[7],A=a[11],B=a[15];a[0]=e*(c*(m*B-g*A)-f*(u*B-g*D)+d*(u*A-m*D)),a[1]=-e*(l*(m*B-g*A)-f*(h*B-g*p)+d*(h*A-m*p)),a[2]=e*(l*(u*B-g*D)-c*(h*B-g*p)+d*(h*D-u*p)),a[3]=-e*(l*(u*A-m*D)-c*(h*A-m*p)+f*(h*D-u*p)),a[4]=-e*(i*(m*B-g*A)-n*(u*B-g*D)+o*(u*A-m*D)),a[5]=e*(r*(m*B-g*A)-n*(h*B-g*p)+o*(h*A-m*p)),a[6]=-e*(r*(u*B-g*D)-i*(h*B-g*p)+o*(h*D-u*p)),a[7]=e*(r*(u*A-m*D)-i*(h*A-m*p)+n*(h*D-u*p)),a[8]=e*(i*(f*B-d*A)-n*(c*B-d*D)+o*(c*A-f*D)),a[9]=-e*(r*(f*B-d*A)-n*(l*B-d*p)+o*(l*A-f*p)),a[10]=e*(r*(c*B-d*D)-i*(l*B-d*p)+o*(l*D-c*p)),a[11]=-e*(r*(c*A-f*D)-i*(l*A-f*p)+n*(l*D-c*p)),a[12]=-e*(i*(f*g-d*m)-n*(c*g-d*u)+o*(c*m-f*u)),a[13]=e*(r*(f*g-d*m)-n*(l*g-d*h)+o*(l*m-f*h)),a[14]=-e*(r*(c*g-d*u)-i*(l*g-d*h)+o*(l*u-c*h)),a[15]=e*(r*(c*m-f*u)-i*(l*m-f*h)+n*(l*u-c*h))}return t}transformPoint(e,t){let a=this.rawData;t||=new b;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8]+a[12],t.y=r*a[1]+i*a[5]+n*a[9]+a[13],t.z=r*a[2]+i*a[6]+n*a[10]+a[14],t}transformVector(e,t){let a=this.rawData;t||=new b;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t}transpose(){let e=this.rawData;for(let t=0;t<R.helpMatrix.rawData.length;t++)R.helpMatrix.rawData[t]=e[t];e[1]=R.helpMatrix.rawData[4],e[2]=R.helpMatrix.rawData[8],e[3]=R.helpMatrix.rawData[12],e[4]=R.helpMatrix.rawData[1],e[6]=R.helpMatrix.rawData[9],e[7]=R.helpMatrix.rawData[13],e[8]=R.helpMatrix.rawData[2],e[9]=R.helpMatrix.rawData[6],e[11]=R.helpMatrix.rawData[14],e[12]=R.helpMatrix.rawData[3],e[13]=R.helpMatrix.rawData[7],e[14]=R.helpMatrix.rawData[11]}get determinant(){let e=this.rawData;return(e[0]*e[5]-e[4]*e[1])*(e[10]*e[15]-e[14]*e[11])-(e[0]*e[9]-e[8]*e[1])*(e[6]*e[15]-e[14]*e[7])+(e[0]*e[13]-e[12]*e[1])*(e[6]*e[11]-e[10]*e[7])+(e[4]*e[9]-e[8]*e[5])*(e[2]*e[15]-e[14]*e[3])-(e[4]*e[13]-e[12]*e[5])*(e[2]*e[11]-e[10]*e[3])+(e[8]*e[13]-e[12]*e[9])*(e[2]*e[7]-e[6]*e[3])}getPosition(e){e||=new b;let t=this.rawData;return e.x=t[12],e.y=t[13],e.z=t[14],e}get position(){return this._position.set(this.rawData[12],this.rawData[13],this.rawData[14]),this._position}set position(e){let t=this.rawData;t[12]=e.x,t[13]=e.y,t[14]=e.z}get scale(){let e=this.rawData;return new b(e[0],e[5],e[10])}set scale(e){let t=this.rawData;t[0]=e.x,t[5]=e.y,t[10]=e.z}toString(){let e=this.rawData;return"matrix3d("+Math.round(e[0]*1e3)/1e3+","+Math.round(e[1]*1e3)/1e3+","+Math.round(e[2]*1e3)/1e3+","+Math.round(e[3]*1e3)/1e3+","+Math.round(e[4]*1e3)/1e3+","+Math.round(e[5]*1e3)/1e3+","+Math.round(e[6]*1e3)/1e3+","+Math.round(e[7]*1e3)/1e3+","+Math.round(e[8]*1e3)/1e3+","+Math.round(e[9]*1e3)/1e3+","+Math.round(e[10]*1e3)/1e3+","+Math.round(e[11]*1e3)/1e3+","+Math.round(e[12]*1e3)/1e3+","+Math.round(e[13]*1e3)/1e3+","+Math.round(e[14]*1e3)/1e3+","+Math.round(e[15]*1e3)/1e3+")"}lerp(e,t,a){this.copyFrom(t).sub(e).mult(a).add(e)}get(e,t){return this.rawData[e+t*4]}set(e,t,a){this.rawData[e+t*4]=a}getMaxScaleOnAxis(){let e=this.rawData,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,a,r))}translate(e){let t=this.get(0,0)*e.x+this.get(0,1)*e.y+this.get(0,2)*e.z+this.get(0,3),a=this.get(1,0)*e.x+this.get(1,1)*e.y+this.get(1,2)*e.z+this.get(1,3),r=this.get(2,0)*e.x+this.get(2,1)*e.y+this.get(2,2)*e.z+this.get(2,3),i=this.get(3,0)*e.x+this.get(3,1)*e.y+this.get(3,2)*e.z+this.get(3,3);return this.set(0,3,t),this.set(1,3,a),this.set(2,3,r),this.set(3,3,i),this}setTRInverse(e,t){t=t.inverse(),se.quaternionToMatrix(t,this),this.translate(new b(-e.x,-e.y,-e.z))}setScale(e){return this.set(0,0,e.x),this.set(0,1,0),this.set(0,2,0),this.set(0,3,0),this.set(1,0,0),this.set(1,1,e.y),this.set(1,2,0),this.set(1,3,0),this.set(2,0,0),this.set(2,1,0),this.set(2,2,e.z),this.set(2,3,0),this.set(3,0,0),this.set(3,1,0),this.set(3,2,0),this.set(3,3,1),this}makeBasis(e,t,a){return this.setElements(e.x,t.x,a.x,0,e.y,t.y,a.y,0,e.z,t.z,a.z,0,0,0,0,1),this}makeRotationAxis(e,t){const a=Math.cos(t),r=Math.sin(t),i=1-a,n=e.x,o=e.y,l=e.z,c=i*n,f=i*o;return this.setElements(c*n+a,c*o-r*l,c*l+r*o,0,c*o+r*l,f*o+a,f*l-r*n,0,c*l-r*o,f*l+r*n,i*l*l+a,0,0,0,0,1),this}static transpose(e,t){t||=new R;let a=e.rawData,r=t.rawData;return r[0]=a[0],r[1]=a[4],r[2]=a[8],r[3]=a[12],r[4]=a[1],r[5]=a[5],r[6]=a[9],r[7]=a[13],r[8]=a[2],r[9]=a[6],r[10]=a[10],r[11]=a[14],r[12]=a[3],r[13]=a[7],r[14]=a[11],r[15]=a[15],t}static inverse(e,t){t||=new R;let a=e.rawData,r=t.rawData;r[0]=a[5]*a[10]*a[15]-a[5]*a[14]*a[11]-a[6]*a[9]*a[15]+a[6]*a[13]*a[11]+a[7]*a[9]*a[14]-a[7]*a[13]*a[10],r[1]=-a[1]*a[10]*a[15]+a[1]*a[14]*a[11]+a[2]*a[9]*a[15]-a[2]*a[13]*a[11]-a[3]*a[9]*a[14]+a[3]*a[13]*a[10],r[2]=a[1]*a[6]*a[15]-a[1]*a[14]*a[7]-a[2]*a[5]*a[15]+a[2]*a[13]*a[7]+a[3]*a[5]*a[14]-a[3]*a[13]*a[6],r[3]=-a[1]*a[6]*a[11]+a[1]*a[10]*a[7]+a[2]*a[5]*a[11]-a[2]*a[9]*a[7]-a[3]*a[5]*a[10]+a[3]*a[9]*a[6],r[4]=-a[4]*a[10]*a[15]+a[4]*a[14]*a[11]+a[6]*a[8]*a[15]-a[6]*a[12]*a[11]-a[7]*a[8]*a[14]+a[7]*a[12]*a[10],r[5]=a[0]*a[10]*a[15]-a[0]*a[14]*a[11]-a[2]*a[8]*a[15]+a[2]*a[12]*a[11]+a[3]*a[8]*a[14]-a[3]*a[12]*a[10],r[6]=-a[0]*a[6]*a[15]+a[0]*a[14]*a[7]+a[2]*a[4]*a[15]-a[2]*a[12]*a[7]-a[3]*a[4]*a[14]+a[3]*a[12]*a[6],r[7]=a[0]*a[6]*a[11]-a[0]*a[10]*a[7]-a[2]*a[4]*a[11]+a[2]*a[8]*a[7]+a[3]*a[4]*a[10]-a[3]*a[8]*a[6],r[8]=a[4]*a[9]*a[15]-a[4]*a[13]*a[11]-a[5]*a[8]*a[15]+a[5]*a[12]*a[11]+a[7]*a[8]*a[13]-a[7]*a[12]*a[9],r[9]=-a[0]*a[9]*a[15]+a[0]*a[13]*a[11]+a[1]*a[8]*a[15]-a[1]*a[12]*a[11]-a[3]*a[8]*a[13]+a[3]*a[12]*a[9],r[10]=a[0]*a[5]*a[15]-a[0]*a[13]*a[7]-a[1]*a[4]*a[15]+a[1]*a[12]*a[7]+a[3]*a[4]*a[13]-a[3]*a[12]*a[5],r[11]=-a[0]*a[5]*a[11]+a[0]*a[9]*a[7]+a[1]*a[4]*a[11]-a[1]*a[8]*a[7]-a[3]*a[4]*a[9]+a[3]*a[8]*a[5],r[12]=-a[4]*a[9]*a[14]+a[4]*a[13]*a[10]+a[5]*a[8]*a[14]-a[5]*a[12]*a[10]-a[6]*a[8]*a[13]+a[6]*a[12]*a[9],r[13]=a[0]*a[9]*a[14]-a[0]*a[13]*a[10]-a[1]*a[8]*a[14]+a[1]*a[12]*a[10]+a[2]*a[8]*a[13]-a[2]*a[12]*a[9],r[14]=-a[0]*a[5]*a[14]+a[0]*a[13]*a[6]+a[1]*a[4]*a[14]-a[1]*a[12]*a[6]-a[2]*a[4]*a[13]+a[2]*a[12]*a[5],r[15]=a[0]*a[5]*a[10]-a[0]*a[9]*a[6]-a[1]*a[4]*a[10]+a[1]*a[8]*a[6]+a[2]*a[4]*a[9]-a[2]*a[8]*a[5];let i=a[0]*r[0]+a[1]*r[4]+a[2]*r[8]+a[3]*r[12];for(let n=0;n<16;n++)r[n]/=i;return t}makeEuler(e,t,a="XYZ"){const r=this.rawData,i=r[0],n=r[4],o=r[8],l=r[1],c=r[5],f=r[9],d=r[2],h=r[6],u=r[10];switch(a){case"XYZ":e.y=Math.asin(Be(o,-1,1)),Math.abs(o)<.9999999?(e.x=Math.atan2(-f,u),e.z=Math.atan2(-n,i)):(e.x=Math.atan2(h,c),e.z=0);break;case"YXZ":e.x=Math.asin(-Be(f,-1,1)),Math.abs(f)<.9999999?(e.y=Math.atan2(o,u),e.z=Math.atan2(l,c)):(e.y=Math.atan2(-d,i),e.z=0);break;case"ZXY":e.x=Math.asin(Be(h,-1,1)),Math.abs(h)<.9999999?(e.y=Math.atan2(-d,u),e.z=Math.atan2(-n,c)):(e.y=0,e.z=Math.atan2(l,i));break;case"ZYX":e.y=Math.asin(-Be(d,-1,1)),Math.abs(d)<.9999999?(e.x=Math.atan2(h,u),e.z=Math.atan2(l,i)):(e.x=0,e.z=Math.atan2(-n,c));break;case"YZX":e.z=Math.asin(Be(l,-1,1)),Math.abs(l)<.9999999?(e.x=Math.atan2(-f,c),e.y=Math.atan2(-d,i)):(e.x=0,e.y=Math.atan2(o,u));break;case"XZY":e.z=Math.asin(-Be(n,-1,1)),Math.abs(n)<.9999999?(e.x=Math.atan2(h,c),e.y=Math.atan2(o,i)):(e.x=Math.atan2(-f,u),e.y=0);break}return t&&e.multiplyScalar($r),e}setElements(e,t,a,r,i,n,o,l,c,f,d,h,u,m,g,p){const D=this.rawData;return D[0]=e,D[4]=t,D[8]=a,D[12]=r,D[1]=i,D[5]=n,D[9]=o,D[13]=l,D[2]=c,D[6]=f,D[10]=d,D[14]=h,D[3]=u,D[7]=m,D[11]=g,D[15]=p,this}makeMatrix44ByQuaternion(e,t,a){this.identity(),se.quaternionToMatrix(a,this),this.appendTranslation(e.x,e.y,e.z),this.appendScale(t.x,t.y,t.z)}}function jc(s,e,t){for(let a=0;a<4;a++)t.rawData[a]=s.rawData[a]*e.rawData[0]+s.rawData[a+4]*e.rawData[1]+s.rawData[a+8]*e.rawData[2]+s.rawData[a+12]*e.rawData[3],t.rawData[a+4]=s.rawData[a]*e.rawData[4]+s.rawData[a+4]*e.rawData[5]+s.rawData[a+8]*e.rawData[6]+s.rawData[a+12]*e.rawData[7],t.rawData[a+8]=s.rawData[a]*e.rawData[8]+s.rawData[a+4]*e.rawData[9]+s.rawData[a+8]*e.rawData[10]+s.rawData[a+12]*e.rawData[11],t.rawData[a+12]=s.rawData[a]*e.rawData[12]+s.rawData[a+4]*e.rawData[13]+s.rawData[a+8]*e.rawData[14]+s.rawData[a+12]*e.rawData[15]}function Es(s,e,t,a){let r=a.rawData,i=s.x*Dt,n=s.y*Dt,o=s.z*Dt,l=0,c=i*.5,f=n*.5,d=o*.5,h=Math.cos(c),u=Math.sin(c),m=Math.cos(f),g=Math.sin(f),p=Math.cos(d),D=Math.sin(d);l=h*m*p+u*g*D,i=u*m*p-h*g*D,n=h*g*p+u*m*D,o=h*m*D-u*g*p;let A=i+i,B=n+n,v=o+o,U=i*A,y=i*B,S=i*v,F=n*B,C=n*v,w=o*v,E=l*A,Q=l*B,T=l*v,j=t.x,ue=t.y,ee=t.z;r[0]=(1-(F+w))*j,r[1]=(y+T)*j,r[2]=(S-Q)*j,r[3]=0,r[4]=(y-T)*ue,r[5]=(1-(U+w))*ue,r[6]=(C+E)*ue,r[7]=0,r[8]=(S+Q)*ee,r[9]=(C-E)*ee,r[10]=(1-(U+F))*ee,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1}function Zc(s,e,t){let a=s.rawData,r=t.rawData,i=a[0],n=a[4],o=a[8],l=a[12],c=a[1],f=a[5],d=a[9],h=a[13],u=a[2],m=a[6],g=a[10],p=a[14],D=a[3],A=a[7],B=a[11],v=a[15];r[0]=i*e.rawData[0]+c*e.rawData[4]+u*e.rawData[8]+D*e.rawData[12],r[1]=i*e.rawData[1]+c*e.rawData[5]+u*e.rawData[9]+D*e.rawData[13],r[2]=i*e.rawData[2]+c*e.rawData[6]+u*e.rawData[10]+D*e.rawData[14],r[3]=i*e.rawData[3]+c*e.rawData[7]+u*e.rawData[11]+D*e.rawData[15],r[4]=n*e.rawData[0]+f*e.rawData[4]+m*e.rawData[8]+A*e.rawData[12],r[5]=n*e.rawData[1]+f*e.rawData[5]+m*e.rawData[9]+A*e.rawData[13],r[6]=n*e.rawData[2]+f*e.rawData[6]+m*e.rawData[10]+A*e.rawData[14],r[7]=n*e.rawData[3]+f*e.rawData[7]+m*e.rawData[11]+A*e.rawData[15],r[8]=o*e.rawData[0]+d*e.rawData[4]+g*e.rawData[8]+B*e.rawData[12],r[9]=o*e.rawData[1]+d*e.rawData[5]+g*e.rawData[9]+B*e.rawData[13],r[10]=o*e.rawData[2]+d*e.rawData[6]+g*e.rawData[10]+B*e.rawData[14],r[11]=o*e.rawData[3]+d*e.rawData[7]+g*e.rawData[11]+B*e.rawData[15],r[12]=l*e.rawData[0]+h*e.rawData[4]+p*e.rawData[8]+v*e.rawData[12],r[13]=l*e.rawData[1]+h*e.rawData[5]+p*e.rawData[9]+v*e.rawData[13],r[14]=l*e.rawData[2]+h*e.rawData[6]+p*e.rawData[10]+v*e.rawData[14],r[15]=l*e.rawData[3]+h*e.rawData[7]+p*e.rawData[11]+v*e.rawData[15]}function E2(s,e){let t=e.x,a=e.y,r=e.z,i=e.w,n=s.rawData,o=2*t*a,l=2*t*r,c=2*t*i,f=2*a*r,d=2*a*i,h=2*r*i,u=t*t,m=a*a,g=r*r,p=i*i;return n[0]=u-m-g+p,n[4]=o-h,n[8]=l+d,n[12]=0,n[1]=o+h,n[5]=-u+m-g+p,n[9]=f-c,n[13]=0,n[2]=l-d,n[6]=f+c,n[10]=-u-m+g+p,n[14]=0,n[3]=0,n[7]=0,n[11]=0,n[15]=1,s}function w2(s,e){let t=e.rawData,a=Math.sin(s),r=Math.cos(s);return t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[8]=a,t[9]=0,t[10]=r,t[11]=0,t}function I2(s,e,t){let a=e.x,r=e.y,i=e.z,n=Math.hypot(a,r,i),o,l,c,f,d,h,u,m,g,p,D,A;if(n<k2)return null;n=1/n,a*=n,r*=n,i*=n,o=Math.sin(s),l=Math.cos(s),c=1-l,f=a*a*c+l,d=r*a*c+i*o,h=i*a*c-r*o,u=a*r*c-i*o,m=r*r*c+l,g=i*r*c+a*o,p=a*i*c+r*o,D=r*i*c-a*o,A=i*i*c+l;let B=t.rawData;return B[0]=f,B[1]=d,B[2]=h,B[3]=0,B[4]=u,B[5]=m,B[6]=g,B[7]=0,B[8]=p,B[9]=D,B[10]=A,B[11]=0,B[12]=0,B[13]=0,B[14]=0,B[15]=1,B}function Vn(s,e,t){let a=s.rawData,r=a[0],i=a[1],n=a[2],o=a[3],l=a[4],c=a[5],f=a[6],d=a[7],h=a[8],u=a[9],m=a[10],g=a[11],p=a[12],D=a[13],A=a[14],B=a[15],v=e.rawData,U=t.rawData,y=v[0],S=v[1],F=v[2],C=v[3];return U[0]=y*r+S*l+F*h+C*p,U[1]=y*i+S*c+F*u+C*D,U[2]=y*n+S*f+F*m+C*A,U[3]=y*o+S*d+F*g+C*B,y=v[4],S=v[5],F=v[6],C=v[7],U[4]=y*r+S*l+F*h+C*p,U[5]=y*i+S*c+F*u+C*D,U[6]=y*n+S*f+F*m+C*A,U[7]=y*o+S*d+F*g+C*B,y=v[8],S=v[9],F=v[10],C=v[11],U[8]=y*r+S*l+F*h+C*p,U[9]=y*i+S*c+F*u+C*D,U[10]=y*n+S*f+F*m+C*A,U[11]=y*o+S*d+F*g+C*B,y=v[12],S=v[13],F=v[14],C=v[15],U[12]=y*r+S*l+F*h+C*p,U[13]=y*i+S*c+F*u+C*D,U[14]=y*n+S*f+F*m+C*A,U[15]=y*o+S*d+F*g+C*B,U}var ht=(s=>(s[s.None=0]="None",s[s.PointLight=1]="PointLight",s[s.DirectionLight=2]="DirectionLight",s[s.SpotLight=3]="SpotLight",s[s.SkyLight=4]="SkyLight",s))(ht||{});class ws extends vi{static lightSize=24;index=-1;lightType=-1;radius=.001;linear=8;lightPosition=new b;lightMatrixIndex=-1;direction=new b;quadratic=.032;lightColor=new J(1,1,1,1);intensity=1;innerAngle=0;outerAngle=1;range=100;castShadowIndex=-1;lightTangent=b.FORWARD;iesIndex=-1}class Oe{static componentsUpdateList;static componentsLateUpdateList;static componentsBeforeUpdateList;static componentsComputeList;static componentsEnablePickerList;static graphicComponent;static waitStartComponent;static _init=!1;static init(){this._init||(this._init=!0,this.componentsUpdateList=new Map,this.componentsLateUpdateList=new Map,this.componentsBeforeUpdateList=new Map,this.componentsComputeList=new Map,this.componentsEnablePickerList=new Map,this.graphicComponent=new Map,this.waitStartComponent=new Map)}static bindUpdate(e,t,a){this.init();let r=this.componentsUpdateList.get(e);r||(r=new Map,this.componentsUpdateList.set(e,r)),r.set(t,a)}static unBindUpdate(e,t){this.init();let a=this.componentsUpdateList.get(e);a&&a.delete(t)}static bindLateUpdate(e,t,a){this.init();let r=this.componentsLateUpdateList.get(e);r||(r=new Map,this.componentsLateUpdateList.set(e,r)),r.set(t,a)}static unBindLateUpdate(e,t){this.init();let a=this.componentsLateUpdateList.get(e);a&&a.delete(t)}static bindBeforeUpdate(e,t,a){this.init();let r=this.componentsBeforeUpdateList.get(e);r||(r=new Map,this.componentsBeforeUpdateList.set(e,r)),r.set(t,a)}static unBindBeforeUpdate(e,t){this.init();let a=this.componentsBeforeUpdateList.get(e);a&&a.delete(t)}static bindCompute(e,t,a){this.init();let r=this.componentsComputeList.get(e);r||(r=new Map,this.componentsComputeList.set(e,r)),r.set(t,a)}static unBindCompute(e,t){this.init();let a=this.componentsComputeList.get(e);a&&a.delete(t)}static bindGraphic(e,t,a){this.init();let r=this.graphicComponent.get(e);r||(r=new Map,this.graphicComponent.set(e,r)),r.set(t,a)}static unBindGraphic(e,t){this.init();let a=this.graphicComponent.get(e);a&&a.delete(t)}static appendWaitStart(e){this.init();let t=this.waitStartComponent.get(e.object3D);t?t.indexOf(e)==-1&&t.push(e):this.waitStartComponent.set(e.object3D,[e])}static removeWaitStart(e,t){this.init();let a=Oe.waitStartComponent.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r)}}static bindEnablePick(e,t,a){this.init();let r=this.componentsEnablePickerList.get(e);r||(r=new Map,this.componentsEnablePickerList.set(e,r)),r.set(t,a)}static unBindEnablePick(e,t){this.init();let a=this.componentsEnablePickerList.get(e);a&&a.delete(t)}}class et{object3D=null;_eventDispatcher;get eventDispatcher(){return this._eventDispatcher||=new Za,this._eventDispatcher}set eventDispatcher(e){console.error("The eventDispatcher should not be set externally!")}_enable=!0;__isStart=!1;isDestroyed=!1;get isStart(){return this.__isStart}get transform(){return this.object3D.transform}set enable(e){this._enable!=e&&(this._enable=e,this._enable?this.onEnable?.(this.transform.view3D):this.onDisable?.(this.transform.view3D))}get enable(){return this._enable}__init(e){this.init(e)}__start(){this.transform&&this.transform.scene3D&&this._enable&&this.onEnable?.(this.transform.view3D),this.transform&&this.transform.scene3D&&this.__isStart==!1&&(this.start?.(),this.__isStart=!0),this.onUpdate&&this._onUpdate(this.onUpdate.bind(this)),this.onLateUpdate&&this._onLateUpdate(this.onLateUpdate.bind(this)),this.onBeforeUpdate&&this._onBeforeUpdate(this.onBeforeUpdate.bind(this)),this.onCompute&&this._onCompute(this.onCompute.bind(this)),this.onGraphic&&this._onGraphic(this.onGraphic.bind(this))}__stop(){this.transform&&this.transform.scene3D&&this.onDisable?.(this.transform.view3D),this._onUpdate(null),this._onLateUpdate(null),this._onBeforeUpdate(null),this._onCompute(null),this._onGraphic(null)}init(e){}start(){}stop(){}cloneTo(e){}copyComponent(e){return this}_onUpdate(e){e!=null?Oe.bindUpdate(this.transform.view3D,this,e):Oe.unBindUpdate(this.transform.view3D,this)}_onLateUpdate(e){e!=null?Oe.bindLateUpdate(this.transform.view3D,this,e):Oe.unBindLateUpdate(this.transform.view3D,this)}_onBeforeUpdate(e){e!=null?Oe.bindBeforeUpdate(this.transform.view3D,this,e):Oe.unBindBeforeUpdate(this.transform.view3D,this)}_onCompute(e){e!=null?Oe.bindCompute(this.transform.view3D,this,e):Oe.unBindCompute(this.transform.view3D,this)}_onGraphic(e){e!=null?Oe.bindGraphic(this.transform.view3D,this,e):Oe.unBindGraphic(this.transform.view3D,this)}beforeDestroy(e){Oe.removeWaitStart(this.object3D,this)}destroy(e){this.isDestroyed||(this.isDestroyed=!0,this.enable=!1,this.stop(),this._onBeforeUpdate(null),this._onUpdate(null),this._onLateUpdate(null),this.onEnable=null,this.onDisable=null,this.onUpdate=null,this.onLateUpdate=null,this.onBeforeUpdate=null,this.onCompute=null,this.onGraphic=null)}}class Is{value=0;inv_base=0;static get(e,t){let a=0,r=1/t;for(;e>0;)a+=e%t*r,e/=t,r/=t;return a}getBase(e,t){let a=this.inv_base=1/t;for(;e>0;)this.value+=a*(e%t),e/=t,a*=this.inv_base}next(){let e=1-this.value-1e-7;if(this.inv_base<e)this.value+=this.inv_base;else{let t=this.inv_base,a;do a=t,t*=this.inv_base;while(t>=e);this.value+=a+t-1}}get(){return this.value}}class ua{origin=new b;length=Number.MAX_VALUE;static _rayl=1e9;static _smallnum=1e-8;_vector=new b;_dir=new b;constructor(e,t){this.origin.copyFrom(e||new b),this._dir.copyFrom(t||new b),this._dir.normalize()}get direction(){return this._dir}set direction(e){this._dir.copyFrom(e),this._dir.normalize()}clone(){return new ua(this.origin,this.direction)}intersectBox(e,t){let a=this.direction,r=this.origin,i,n,o,l,c,f;const d=1/a.x,h=1/a.y,u=1/a.z,m=e.min,g=e.max;return i=((d>=0?m.x:g.x)-r.x)*d,n=((d>=0?g.x:m.x)-r.x)*d,o=((h>=0?m.y:g.y)-r.y)*h,l=((h>=0?g.y:m.y)-r.y)*h,i>l||o>n||(o>i&&(i=o),l<n&&(n=l),c=((u>=0?m.z:g.z)-r.z)*u,f=((u>=0?g.z:m.z)-r.z)*u,i>f||c>n)||(c>i&&(i=c),f<n&&(n=f),n<0)?null:(t||=new b,this.pointAt(i>=0?i:n,t))}pointAt(e,t){return t||=new b,t.copy(this.direction),t.multiplyScalar(e),t.add(this.origin,t),t}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this._dir.copy(e._dir),this.length=e.length,this}setApproxDirection(e){this._dir=e.normalize()}setOrigin(e){this.origin.copyFrom(e)}getOrigin(){return this.origin}getPoint(e){return this._dir.scaleBy(e),this.origin.add(this._dir)}sqrDistToPoint(e){let t=this._dir,a=e.subtract(this.origin),r=Ft(a,t),i=Ft(t,t),n=r/i,o=this.getPoint(n);return Nn(e.subtract(o))}applyMatrix(e){this.origin=e.transformPoint(this.origin),this._dir=e.transformVector(this._dir)}_v0=new b;_v1=new b;_v2=new b;pointInTriangle(e,t,a,r){let i=this._v0,n=this._v1,o=this._v2;r.subtract(t,i),a.subtract(t,n),e.subtract(t,o);let l=b.dot(i,i),c=b.dot(i,n),f=b.dot(i,o),d=b.dot(n,n),h=b.dot(n,o),u=1/(l*d-c*c),m=(d*f-c*h)*u,g=(l*h-c*f)*u;return m>=0&&g>=0&&m+g<1}_E1=new b;_E2=new b;_P=new b;_T=new b;_Q=new b;intersectTriangle(e,t,a){let r=a.v1,i=a.v2,n=a.v3;i.subtract(r,this._E1),n.subtract(r,this._E2),t.crossProduct(this._E2,this._P);let o=this._E1.dotProduct(this._P);if(o>0?e.subtract(r,this._T):(r.subtract(e,this._T),o=-o),o<1e-4||(a.u=this._T.dotProduct(this._P),a.u<0||a.u>o)||(this._T.crossProduct(this._E1,this._Q),a.v=t.dotProduct(this._Q),a.v<0||a.u+a.v>o))return null;let l=new b;a.t0=a.t=this._E2.dotProduct(this._Q);let c=1/o;return a.t*=c,a.u*=c,a.v*=c,l.x=e.x+a.t*t.x,l.y=e.y+a.t*t.y,l.z=e.z+a.t*t.z,l}intersectSphere(e,t,a,r){let i=e.subtract(a),n=b.dot(t,t),o=2*b.dot(i,t),l=b.dot(i,i)-r*r,c=o*o-4*n*l,f=b.HELP_3;if(c<0)return null;{let d=(-o-Math.sqrt(c))/(n*2);return d<0?null:(f.x=e.x+d*t.x,f.y=e.y+d*t.y,f.z=e.z+d*t.z,f)}}intersectionSegment(e,t,a){const r=this.origin,i=b.HELP_0,n=b.HELP_1,o=b.HELP_2,l=b.HELP_3;t.subtract(e,i),this._dir.scaleToRef(ua._rayl,o),r.add(o,n),e.subtract(r,l);var c=b.dot(i,i),f=b.dot(i,o),d=b.dot(o,o),h=b.dot(i,l),u=b.dot(o,l),m=c*d-f*f,g,p,D=m,A,B,v=m;m<ua._smallnum?(p=0,D=1,B=u,v=d):(p=f*u-d*h,B=c*u-f*h,p<0?(p=0,B=u,v=d):p>D&&(p=D,B=u+f,v=d)),B<0?(B=0,-h<0?p=0:-h>c?p=D:(p=-h,D=c)):B>v&&(B=v,-h+f<0?p=0:-h+f>c?p=D:(p=-h+f,D=c)),g=Math.abs(p)<ua._smallnum?0:p/D,A=Math.abs(B)<ua._smallnum?0:B/v;const U=b.HELP_4;o.scaleToRef(A,U);const y=b.HELP_5;i.scaleToRef(g,y),y.add(l,y);const S=b.HELP_6;y.subtract(U,S);var F=A>0&&A<=this._dir.length&&S.lengthSquared<a*a;if(F){let C=new b;return C.copyFrom(t.subtract(e)),C.scaleBy(g),C.add(e,C),{out:C,length:y.length}}return{out:null,length:-1}}get_vec(e,t){let a=b.HELP_1;return a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}}class ps{x;y;w;h;constructor(e=0,t=0,a=0,r=0){this.x=e,this.y=t,this.w=a,this.h=r}get width(){return this.w}set width(e){this.w=e}get height(){return this.h}set height(e){this.h=e}static pointInRect(e,t,a,r,i,n){return!(e<a||e>i||t<r||t>n)}clone(){return new ps(this.x,this.y,this.w,this.h)}copyFrom(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}copyTo(e){e.copyFrom(this)}inner(e,t){return!(e<this.x||e>this.x+this.width||t<this.y||t>this.y+this.height)}equal(e){return!(this.x!=e.x||this.y!=e.y||this.width!=e.width||this.height!=e.height)}equalArea(e,t,a,r){return!(this.x!=e||this.y!=t||this.width!=a||this.height!=r)}equalInnerArea(e){var t=this.x,a=this.y,r=this.x+this.width,i=this.y+this.height,n=e.x,o=e.y,l=e.x+e.width,c=e.y+e.height;return Math.max(t,n)<=Math.min(r,l)&&Math.max(a,o)<=Math.min(i,c)}innerArea(e,t){t=t||new ps;var a=this.x,r=this.y,i=this.x+this.width,n=this.y+this.height,o=e.x,l=e.y,c=e.x+e.width,f=e.y+e.height,d=Math.max(r,l),h=Math.min(n,f),u=Math.max(a,o),m=Math.min(c,i);return d>=0&&h>=0&&h-d>=0&&m-u>0?(t.x=u,t.y=d,t.width=m-u,t.height=h-d):(t.x=0,t.y=0,t.width=0,t.height=0),t}setTo(e,t,a,r){this.x=e,this.y=t,this.width=a,this.height=r}}class Ce{center;extents;max;min;size;static maxVector3=new b(1,1,1).multiplyScalar(Number.MAX_VALUE*.1);static minVector3=new b(1,1,1).multiplyScalar(-Number.MAX_VALUE*.1);constructor(e,t){e||=b.ZERO.clone(),t||=b.ZERO.clone(),this.setFromCenterAndSize(e,t)}makeEmpty(){return this.setFromMinMax(Ce.maxVector3,Ce.minVector3),this}setFromMinMax(e,t){return this.init(),this.min.copyFrom(e),this.max.copyFrom(t),this.max.subtract(this.min,this.size),this.extents.copyFrom(this.size).multiplyScalar(.5),this.min.add(this.max,this.center).multiplyScalar(.5),this}init(){return this.min||=new b,this.max||=new b,this.size||=new b,this.center||=new b,this.extents||=new b,this}setFromCenterAndSize(e,t){return this.init(),this.center.copyFrom(e),this.size.copyFrom(t),this.extents.copyFrom(this.size).multiplyScalar(.5),this.center.subtract(this.extents,this.min),this.center.add(this.extents,this.max),this}inFrustum(e,t){return t.containsBox(e.bound)}merge(e){e.min.x<this.min.x&&(this.min.x=e.min.x),e.min.y<this.min.y&&(this.min.y=e.min.y),e.min.z<this.min.z&&(this.min.z=e.min.z),e.max.x>this.max.x&&(this.max.x=e.max.x),e.max.y>this.max.y&&(this.max.y=e.max.y),e.max.z>this.max.z&&(this.max.z=e.max.z),this.size.x=this.max.x-this.min.x,this.size.y=this.max.y-this.min.y,this.size.z=this.max.z-this.min.z,this.extents.x=this.size.x*.5,this.extents.y=this.size.y*.5,this.extents.z=this.size.z*.5,this.center.x=this.min.x+this.extents.x,this.center.y=this.min.y+this.extents.y,this.center.z=this.min.z+this.extents.z}intersects(e){return this.min.x<=e.max.x&&this.max.x>=e.min.x&&this.min.y<=e.max.y&&this.max.y>=e.min.y&&this.min.z<=e.max.z&&this.max.z>=e.min.z}intersectsSphere(e){return this.min.x<=e.max.x&&this.max.x>=e.min.x&&this.min.y<=e.max.y&&this.max.y>=e.min.y&&this.min.z<=e.max.z&&this.max.z>=e.min.z}intersectsBox(e){return this.min.x<=e.max.x&&this.max.x>=e.min.x&&this.min.y<=e.max.y&&this.max.y>=e.min.y&&this.min.z<=e.max.z&&this.max.z>=e.min.z}equals(e){return this.center.equals(e.center)&&this.extents.equals(e.extents)}expandByPoint(e){e.x<this.min.x&&(this.min.x=e.x),e.x>this.max.x&&(this.max.x=e.x),e.y<this.min.y&&(this.min.y=e.y),e.y>this.max.y&&(this.max.y=e.y),e.z<this.min.z&&(this.min.z=e.z),e.z>this.max.z&&(this.max.z=e.z),this.size.x=this.max.x-this.min.x,this.size.y=this.max.y-this.min.y,this.size.z=this.max.z-this.min.z,this.extents.x=this.size.x*.5,this.extents.y=this.size.y*.5,this.extents.z=this.size.z*.5,this.center.x=this.min.x+this.extents.x,this.center.y=this.min.y+this.extents.y,this.center.z=this.min.z+this.extents.z}static fromPoints(e){for(var t=new Ce(new b,new b),a=0;a<e.length;a++)t.expandByPoint(e[a]);return t}calculateTransform(e){}clone(){var e=new Ce(this.center.clone(),this.size.clone());return e}intersectsRay(e,t){throw new Error("Method not implemented.")}containsPoint(e){return this.min.x<=e.x&&this.max.x>=e.x&&this.min.y<=e.y&&this.max.y>=e.y&&this.min.z<=e.z&&this.max.z>=e.z}containsBox(e){let t=this.min,a=this.max;return t.x<=e.min.x&&t.y<=e.min.y&&t.z<=e.min.z&&a.x>=e.max.x&&a.y>=e.max.y&&a.z>=e.max.z}updateBound(){}destroy(e){this.center=null,this.extents=null,this.min=null,this.max=null,this.size=null}}class On{planes;corners;boundingBox=new Ce;constructor(){this.planes=[],this.corners=[];for(var e=0;e<6;e++)this.planes[e]=new b;for(var e=0;e<8;e++)this.corners[e]=new b}updateBoundBox(e){this.boundingBox.makeEmpty();let t=this.boundingBox.min,a=this.boundingBox.max,r=0;for(let i=0;i<2;++i)for(let n=0;n<2;++n)for(let o=0;o<2;++o){let l=this.corners[r];r++,l.set(2*i-1,2*n-1,o,1),e.transformVector4(l,l),l.div(l.w,l),t.x=Math.min(l.x,t.x),t.y=Math.min(l.y,t.y),t.z=Math.min(l.z,t.z),a.x=Math.max(l.x,a.x),a.y=Math.max(l.y,a.y),a.z=Math.max(l.z,a.z)}return this.boundingBox.setFromMinMax(t,a),this}setFrustumCorners(e){let t=0;for(let a=0;a<2;++a)for(let r=0;r<2;++r)for(let i=0;i<2;++i){let n=this.corners[t];n.set(2*a-1,2*r-1,i,1),e.transformVector4(n,n),n.div(n.w,n),t++}}update(e){var t=e.rawData;this.planes[0].x=t[3]-t[0],this.planes[0].y=t[7]-t[4],this.planes[0].z=t[11]-t[8],this.planes[0].w=t[15]-t[12];var a=Math.sqrt(this.planes[0].x*this.planes[0].x+this.planes[0].y*this.planes[0].y+this.planes[0].z*this.planes[0].z);this.planes[0].x/=a,this.planes[0].y/=a,this.planes[0].z/=a,this.planes[0].w/=a,this.planes[1].x=t[3]+t[0],this.planes[1].y=t[7]+t[4],this.planes[1].z=t[11]+t[8],this.planes[1].w=t[15]+t[12],a=Math.sqrt(this.planes[1].x*this.planes[1].x+this.planes[1].y*this.planes[1].y+this.planes[1].z*this.planes[1].z),this.planes[1].x/=a,this.planes[1].y/=a,this.planes[1].z/=a,this.planes[1].w/=a,this.planes[2].x=t[3]+t[1],this.planes[2].y=t[7]+t[5],this.planes[2].z=t[11]+t[9],this.planes[2].w=t[15]+t[13],a=Math.sqrt(this.planes[2].x*this.planes[2].x+this.planes[2].y*this.planes[2].y+this.planes[2].z*this.planes[2].z),this.planes[2].x/=a,this.planes[2].y/=a,this.planes[2].z/=a,this.planes[2].w/=a,this.planes[3].x=t[3]-t[1],this.planes[3].y=t[7]-t[5],this.planes[3].z=t[11]-t[9],this.planes[3].w=t[15]-t[13],a=Math.sqrt(this.planes[3].x*this.planes[3].x+this.planes[3].y*this.planes[3].y+this.planes[3].z*this.planes[3].z),this.planes[3].x/=a,this.planes[3].y/=a,this.planes[3].z/=a,this.planes[3].w/=a,this.planes[4].x=t[3]-t[2],this.planes[4].y=t[7]-t[6],this.planes[4].z=t[11]-t[10],this.planes[4].w=t[15]-t[14],a=Math.sqrt(this.planes[4].x*this.planes[4].x+this.planes[4].y*this.planes[4].y+this.planes[4].z*this.planes[4].z),this.planes[4].x/=a,this.planes[4].y/=a,this.planes[4].z/=a,this.planes[4].w/=a,this.planes[5].x=t[3]+t[2],this.planes[5].y=t[7]+t[6],this.planes[5].z=t[11]+t[10],this.planes[5].w=t[15]+t[14],a=Math.sqrt(this.planes[5].x*this.planes[5].x+this.planes[5].y*this.planes[5].y+this.planes[5].z*this.planes[5].z),this.planes[5].x/=a,this.planes[5].y/=a,this.planes[5].z/=a,this.planes[5].w/=a}containsPoint(e){for(var t=0;t<6;t++)if(this.planes[t].x*e.x+this.planes[t].y*e.y+this.planes[t].z*e.z+this.planes[t].w<=0)return!1;return!0}containsSphere(e){let t=e.bound,a=0,r,i=e.transform.worldPosition,n=t.radius,o=t.center.x+i.x,l=t.center.y+i.y,c=t.center.z+i.z;for(let f of this.planes){if(r=f.x*o+f.y*l+f.z*c+f.w,r<=-n)return 0;r>n&&a++}return a===6?2:1}containsBox(e){let t=0,a,i=Math.max(e.size.x,e.size.y,e.size.z)*2,n=e.center.x,o=e.center.y,l=e.center.z;for(let c of this.planes){if(a=c.x*n+c.y*o+c.z*l+c.w,a<=-i)return 0;a>i&&t++}return t===6?2:1}containsBox2(e){let t=0,a,r=1.74*Math.max(e.extents.x,e.extents.y,e.extents.z);for(let i of this.planes){if(a=i.x*e.center.x+i.y*e.center.y+i.z*e.center.z+i.w,a<=-r)return 0;a>r&&t++}return t===6?2:1}containsBoxPrecise(e){const t=[new b(e.min.x,e.min.y,e.min.z),new b(e.max.x,e.min.y,e.min.z),new b(e.min.x,e.max.y,e.min.z),new b(e.max.x,e.max.y,e.min.z),new b(e.min.x,e.min.y,e.max.z),new b(e.max.x,e.min.y,e.max.z),new b(e.min.x,e.max.y,e.max.z),new b(e.max.x,e.max.y,e.max.z)];let a=0;for(let r=0;r<6;r++){const i=this.planes[r];let n=-1/0,o=1/0;for(let l=0;l<8;l++){const c=t[l],f=i.x*c.x+i.y*c.y+i.z*c.z+i.w;n=Math.max(n,f),o=Math.min(o,f)}if(n<0)return 0;o>0&&a++}return a===6?2:1}}var ot=(s=>(s[s.ortho=0]="ortho",s[s.perspective=1]="perspective",s[s.shadow=2]="shadow",s))(ot||{});class R2{corners;index;constructor(e){this.index=e,this.corners=[];for(let t=0;t<4;t++)this.corners.push(new b)}}class Q2{bound;twoSections;name;color;shadowCamera;index;constructor(e,t,a){this.bound=new Ce,this.shadowCamera=bt.createCamera3DObject(null,"csmShadowCamera_"+a),this.shadowCamera.isShadowCamera=!0,this.shadowCamera.orthoOffCenter(100,-100,100,-100,1,1e4),this.twoSections=[e,t],this.index=a,a==0?this.color=new J(1,0,0,1):a==1?this.color=new J(0,1,0,1):a==2?this.color=new J(0,0,1,1):a==3&&(this.color=new J(0,1,1,1)),this.name="child_"+a}updateBound(){this.bound.makeEmpty();let e=this.bound.min,t=this.bound.max;for(let a of this.twoSections)for(let r of a.corners)e.x=Math.min(r.x,e.x),e.y=Math.min(r.y,e.y),e.z=Math.min(r.z,e.z),t.x=Math.max(r.x,t.x),t.y=Math.max(r.y,t.y),t.z=Math.max(r.z,t.z);return this.bound.setFromMinMax(e,t),this}}class Yc{sections;children;name;constructor(e){this.sections=[];let t=e+1;for(let a=0;a<t;a++)this.sections.push(new R2(a));this.children=[];for(let a=0;a<e;a++)this.children.push(new Q2(this.sections[a],this.sections[a+1],a))}update(e,t,a,r,i){let n=this.sections.length-1;for(let o=0;o<=n;++o){let l=this.sections[o],c=0,f=this.logSplit(a,r,o,this.sections.length);{let h=(f-a)/r;h=h**i.csmScatteringExp,f=(r-a)*h+a}f*=i.csmAreaScale;let d=(e.rawData[10]*f+e.rawData[14])/f;for(let h=0;h<2;++h)for(let u=0;u<2;++u){let m=l.corners[c];c++,m.set(2*h-1,2*u-1,d,1),t.transformVector4(m,m),m.div(m.w,m)}}for(let o of this.children)o.updateBound();return this}squareSplit(e,t,a,r){return(a/(r-1))**4*(t-e)+e}uniformSplit(e,t,a,r){return a/(r-1)*(t-e)+e}logSplit(e,t,a,r){return e*(t/e)**(a/(r-1))}}class ti extends et{fov=60;name;aspect=1;near=1;far=5e3;left=-100;right=100;top=100;bottom=-100;frustumSize=100;viewPort=new ps;frustum;sh=new Float32Array(36);isShadowCamera=!1;_projectionMatrixInv=new R;_projectionMatrix=new R;_viewMatrix=new R;_viewMatrixInv=new R;_unprojection=new R;_pvMatrixInv=new R;_pvMatrix=new R;_halfw;_halfh;_ray;_enableCSM=!1;mainCamera;get projectionMatrix(){return this._projectionMatrix}lookTarget;type=ot.perspective;csm;cubeShadowCameras=[];get enableCSM(){return this._enableCSM}set enableCSM(e){e&&!this.csm&&(this.csm=new Yc(sa.Cascades)),this._enableCSM=e}constructor(){super()}init(){super.init(),this._ray=new ua,this.frustum=new On,this.lookTarget=new b(0,0,0),this.viewPort.x=0,this.viewPort.y=0,this.viewPort.w=I.presentationSize[0],this.viewPort.h=I.presentationSize[1],this.updateProjection(),I.addEventListener(lr.RESIZE,this.updateProjection,this)}updateProjection(){this.aspect=I.aspect,this.type==ot.perspective?this.perspective(this.fov,this.aspect,this.near,this.far):this.type==ot.ortho&&(this.frustumSize?this.ortho(this.frustumSize,this.near,this.far):this.orthoOffCenter(this.left,this.right,this.bottom,this.top,this.near,this.far))}getShadowBias(e){let t=2*this.getShadowWorldExtents()/e,a=this.far-this.near;return t/a-_.setting.shadow.shadowBias*.01}getShadowWorldExtents(){let e=_.setting.shadow.shadowBound;return e?e*=.5:e=Math.round(.05*this.frustum.boundingBox.extents.length),e}getCSMShadowBiasScale(e){if(e==this)return 1;let t=this.far-this.near,a=this.csm.children[0].shadowCamera;return(a.far-a.near)/t}getCSMShadowWorldExtents(e){return Math.round(this.csm.children[e].bound.extents.length)}perspective(e,t,a,r){this.fov=e,this.aspect=t,this.near=Math.max(.001,a),this.far=r,this._projectionMatrix.perspective(this.fov,this.aspect,this.near,this.far),this.type=ot.perspective}ortho(e,t,a){this.frustumSize=e;let r=e*.5*this.aspect,i=e*.5,n=-r/2,o=r/2,l=i/2,c=-i/2;this.orthoOffCenter(n,o,c,l,t,a)}orthoOffCenter(e,t,a,r,i,n){this.near=i,this.far=n,this.left=e,this.right=t,this.top=r,this.bottom=a,this.type=ot.ortho,this._projectionMatrix.orthoOffCenter(this.left,this.right,this.bottom,this.top,this.near,this.far)}get viewMatrix(){return this._viewMatrix.copyFrom(this.transform.worldMatrix),this._viewMatrix.invert(),this._viewMatrix}get shadowViewMatrix(){return this._viewMatrix.copyFrom(this.transform.worldMatrix),this._viewMatrix.appendScale(1,1,1),this._viewMatrix.invert(),this._viewMatrix}object3DToScreenRay(e,t=null){return t||(t=new b(0,0,0,1)),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5,Gt.transformVector(this.viewMatrix,e,t),this.project(t,t),t.x=this._halfw+t.x*this._halfw,t.y=this.viewPort.height-(this._halfh-t.y*this._halfh),t}screenRayToObject3D(e,t=null){t||(t=new b),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5;let a=e.x,r=e.y;return t.x=a/this.viewPort.width-.25,t.y=r/this.viewPort.height-.25,this.unProject(t.x,t.y,e.z,t),t}get pvMatrix(){return Vn(this._projectionMatrix,this.viewMatrix,this._pvMatrix),this._pvMatrix}get pvMatrix2(){Vn(this._projectionMatrix,this.transform.worldMatrix,this._pvMatrix);let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get pvMatrixInv(){let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get vMatrixInv(){let e=this._viewMatrixInv.copyFrom(this.viewMatrix);return e.invert(),e}get cameraToWorld(){let e=R.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e.multiply(this.vMatrixInv),e}get ndcToView(){let e=R.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e}get projectionMatrixInv(){return this._projectionMatrixInv.copyFrom(this._projectionMatrix),this._projectionMatrixInv.invert(),this._projectionMatrixInv}unProject(e,t,a,r){return r||(r=new b),r.x=e,r.y=-t,r.z=a,r.w=1,r.x*=a,r.y*=a,this._unprojection.copyFrom(this._projectionMatrix),this._unprojection.invert(),Gt.transformVector(this._unprojection,r,r),r.z=a,r}project(e,t){return this._projectionMatrix.perspectiveMultiplyPoint3(e,t),t.x=t.x/t.w,t.y=-t.y/t.w,t.z=e.z,t}screenPointToRay(e,t){let a=this._ray,r=bt.UnProjection(e,t,.01,this),i=bt.UnProjection(e,t,1,this);return i=i.subtract(r).normalize(),a.origin.copyFrom(r),a.direction=i,a}screenPointToWorld(e,t,a){return bt.UnProjection(e,t,a,this)}worldToScreenPoint(e,t){return bt.Projection(e,this,t)}lookAt(e,t,a=b.Y_AXIS){this.transform.lookAt(e,t,a),t&&this.lookTarget.copyFrom(t)}onUpdate(){this._useJitterProjection&&this.getJitteredProjectionMatrix(),this.frustum.update(this.pvMatrix),this.frustum.updateBoundBox(this.pvMatrixInv);let e=_.setting.shadow;this.enableCSM&&this.csm?.update(this._projectionMatrix,this._pvMatrixInv,this.near,this.far,e)}_haltonSeq;_jitterOffsetList;_useJitterProjection=!1;_jitterFrameIndex=0;_sampleIndex=0;_jitterX=0;_jitterY=0;get jitterFrameIndex(){return this._jitterFrameIndex}get jitterX(){return this._jitterX}get jitterY(){return this._jitterY}enableJitterProjection(e){this._jitterFrameIndex=0,this._useJitterProjection=e,this._haltonSeq||=new Is,this._jitterOffsetList=[];for(let t=0;t<32;t++){let a=this.generateRandomOffset();this._jitterOffsetList.push(a)}this._jitterOffsetList.reverse()}generateRandomOffset(){let e=new de(Is.get((this._sampleIndex&1023)+1,2)-.5,Is.get((this._sampleIndex&1023)+1,3)-.5);return++this._sampleIndex>=32&&(this._sampleIndex=0),e}getJitteredProjectionMatrix(){let e=_.setting.render.postProcessing.taa,t=this._projectionMatrix,a=e.temporalJitterScale,r=this._jitterFrameIndex%e.jitterSeedCount,i=this._jitterOffsetList[r].x*a,n=this._jitterOffsetList[r].y*a,o=t.get(0,2),l=t.get(1,2);this._jitterX=i/this.viewPort.width,this._jitterY=n/this.viewPort.height,o+=this._jitterX,l+=this._jitterY,t.set(0,2,o),t.set(1,2,l),this._jitterFrameIndex++}getWorldDirection(e){e||=new b;const t=this.transform._worldMatrix.rawData;return e.set(-t[8],-t[9],-t[10]).normalize()}}class Zt extends et{static LIMIT=1;static COMPONENT_NAME="UUTransform";static COMPONENT_TYPE="Transform";static POSITION_ONCHANGE="POSITION_ONCHANGE";static ROTATION_ONCHANGE="ROTATION_ONCHANGE";static SCALE_ONCHANGE="SCALE_ONCHANGE";static PARENT_ONCHANGE="PARENT_ONCHANGE";static CHILDREN_ONCHANGE="CHILDREN_ONCHANGE";static ADD_ONCHANGE="ADD_ONCHANGE";static LOCAL_ONCHANGE="LOCAL_ONCHANGE";eventPositionChange=new pt(Zt.POSITION_ONCHANGE);eventRotationChange=new pt(Zt.ROTATION_ONCHANGE);eventScaleChange=new pt(Zt.SCALE_ONCHANGE);eventLocalChange=new pt(Zt.LOCAL_ONCHANGE);onPositionChange;onRotationChange;onScaleChange;_scene3d;_parent;_localPos;_localRot;_localRotQuat;_localScale;_localDetailPos;_localDetailRot;_localDetailScale;index;index2;_forward=new b;_back=new b;_right=new b;_left=new b;_up=new b;_down=new b;_worldMatrix;_targetPos;static=!1;depthOrder=0;get localChange(){return Re.matrixStateBuffer[this.index2]!=0}set localChange(e){Re.matrixStateBuffer[this.index2]=e?1:0}get targetPos(){return this._targetPos}set targetPos(e){this._targetPos=e}get parent(){return this._parent}set parent(e){let t=this._parent?.object3D;if(this._parent=e,this.depthOrder=e?e.depthOrder+1:0,Re.setParent(this.index,e?e.worldMatrix.index:-1,this.depthOrder),this.localChange=!0,this.object3D){let a=e?e.scene3D:null;a?(this._scene3d=a,this.object3D.components.forEach(r=>{Oe.appendWaitStart(r)})):this.object3D.components.forEach(r=>{r.__stop()});for(let r of this.object3D.entityChildren)r.transform.parent=e?this:null;this.object3D.components.forEach(r=>{r.onParentChange?.(t,this._parent?.object3D)})}this.notifyLocalChange()}set enable(e){this.transform._scene3d&&e?super.enable=!0:super.enable=!1;for(let t of this.object3D.entityChildren)t.transform.enable=e}get enable(){return this._enable}get scene3D(){return this._scene3d}set scene3D(e){this._scene3d=e}get view3D(){return this._scene3d&&this._scene3d.view?this._scene3d.view:null}constructor(){super(),this._worldMatrix=new R(!0),this.index=this._worldMatrix.index,this.index2=this._worldMatrix.index*Re.stateStruct,this._localPos=new b,this._localRot=new b,this._localRotQuat=new se,this._localScale=new b(1,1,1),Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z)}awake(){}start(){}stop(){}notifyLocalChange(){if(this.localChange=!0,this.object3D){let e=this.object3D.entityChildren,t=0,a=e.length;for(t=0;t<a;t++)e[t].transform.notifyLocalChange()}this.eventDispatcher.dispatchEvent(this.eventLocalChange)}get up(){return this.worldMatrix.transformVector(b.UP,this._up),this._up}set up(e){this._up.copyFrom(e),Gt.fromToRotation(b.UP,this._up,se.HELP_0),this.transform.localRotQuat=se.HELP_0}get down(){return this.worldMatrix.transformVector(b.DOWN,this._down),this._down}set down(e){this._down.copyFrom(e),Gt.fromToRotation(b.DOWN,this._down,se.HELP_0),this.transform.localRotQuat=se.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get forward(){return this.worldMatrix.transformVector(b.FORWARD,this._forward),this._forward}set forward(e){this._forward.copyFrom(e),Gt.fromToRotation(b.FORWARD,this._forward,se.HELP_0),this.transform.localRotQuat=se.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get back(){return this.worldMatrix.transformVector(b.BACK,this._back),this._back}set back(e){this._back.copyFrom(e),Gt.fromToRotation(b.BACK,this._back,se.HELP_0),this.transform.localRotQuat=se.HELP_0}get left(){return this.worldMatrix.transformVector(b.neg_X_AXIS,this._left),this._left}set left(e){this._left.copyFrom(e),Gt.fromToRotation(b.LEFT,this._left,se.HELP_0),this.transform.localRotQuat=se.HELP_0}get right(){return this.worldMatrix.transformVector(b.X_AXIS,this._right),this._right}set right(e){this._right.copyFrom(e),Gt.fromToRotation(b.RIGHT,this._right,se.HELP_0),this.transform.localRotQuat=se.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get localRotQuat(){return this.localChange&&this.updateWorldMatrix(),this._localRotQuat}set localRotQuat(e){(e.x!=this._localRotQuat.x||e.y!=this._localRotQuat.y||e.z!=this._localRotQuat.z||e.w!=this._localRotQuat.w)&&(this._localRotQuat.copyFrom(e),this._localRotQuat.getEulerAngles(this._localRot),Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}notifyChange(){this.notifyLocalChange(),this.onRotationChange?.(),this.onScaleChange?.(),this.onPositionChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange)}get worldMatrix(){return this.updateWorldMatrix(),this._worldMatrix}updateWorldMatrix(e=!1){(this.localChange||e)&&(this.parent?(Es(this._localRot,this._localPos,this._localScale,this._worldMatrix),Zc(this._worldMatrix,this.parent.worldMatrix,this._worldMatrix)):Es(this._localRot,this._localPos,this._localScale,this._worldMatrix),this.localChange=!1)}updateChildTransform(){let e=this;if(e.localChange&&e.updateWorldMatrix(),e.object3D.numChildren>0)for(const t of e.object3D.entityChildren)t.transform.updateChildTransform()}lookTarget(e,t=b.UP){this.lookAt(this.transform.worldPosition,e,t)}lookAt(e,t,a=b.UP){this._targetPos||=new b,this._targetPos.copyFrom(t),this.localPosition=e,R.helpMatrix.lookAt(e,t,a),R.helpMatrix.invert();var r=R.helpMatrix.decompose(na.QUATERNION);this.localRotQuat=se.CALCULATION_QUATERNION.copyFrom(r[1])}decomposeFromMatrix(e,t="eulerAngles"){let a=e.decompose(t),r=this.transform;return r.localRotQuat.copyFrom(a[1]),r.localRotQuat=r.localRotQuat,r.localPosition.copyFrom(a[0]),r.localPosition=r.localPosition,r.localScale.copyFrom(a[2]),r.localScale=r.localScale,this}cloneTo(e){e.transform.localPosition=this.localPosition,e.transform.localRotation=this.localRotation,e.transform.localScale=this.localScale}set x(e){this._localPos.x!=e&&(this._localPos.x=e,Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z),this.notifyLocalChange(),this.onPositionChange?.(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange))}get x(){return this._localPos.x}set y(e){this._localPos.y!=e&&(this._localPos.y=e,Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z),this.notifyLocalChange(),this.onPositionChange?.(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange))}get y(){return this._localPos.y}set z(e){this._localPos.z!=e&&(this._localPos.z=e,Re.setTranslate(this.index,this._localPos.x,this._localPos.y,this._localPos.z),this.notifyLocalChange(),this.onPositionChange?.(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange))}get z(){return this._localPos.z}set scaleX(e){this._localScale.x!=e&&(this._localScale.x=e,Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange))}get scaleX(){return this._localScale.x}set scaleY(e){this._localScale.y!=e&&(this._localScale.y=e,Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange))}get scaleY(){return this._localScale.y}set scaleZ(e){this._localScale.z!=e&&(this._localScale.z=e,Re.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange))}get scaleZ(){return this._localScale.z}set rotationX(e){this._localRot.x!=e&&(this._localRot.x=e,Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}get rotationX(){return this._localRot.x}set rotationY(e){this._localRot.y!=e&&(this._localRot.y=e,Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}get rotationY(){return this._localRot.y}set rotationZ(e){this._localRot.z!=e&&(this._localRot.z=e,Re.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange))}get rotationZ(){return this._localRot.z}get worldPosition(){return this.localChange&&this.updateWorldMatrix(),this._worldMatrix.position}set localPosition(e){this.onPositionChange&&(this._localPos.x!=e.x||this._localPos.y!=e.y||this._localPos.z!=e.z)&&this.onPositionChange(this._localPos,e),this._localPos.copyFrom(e),Re.setTranslate(this.index,e.x,e.y,e.z),this.notifyLocalChange(),this.eventPositionChange&&this.eventDispatcher.dispatchEvent(this.eventPositionChange)}get localPosition(){return this._localPos}set localRotation(e){this.onRotationChange&&(this._localRot.x!=e.x||this._localRot.y!=e.y||this._localRot.z!=e.z)&&this.onRotationChange(this._localRot,e),Re.setRotation(this.index,e.x,e.y,e.z),this._localRot.copyFrom(e),this.notifyLocalChange(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get localRotation(){return this._localRot}set localScale(e){Re.setScale(this.index,e.x,e.y,e.z),this._localScale.copyFrom(e),this.notifyLocalChange(),this.onScaleChange?.(),this.eventScaleChange&&this.eventDispatcher.dispatchEvent(this.eventScaleChange)}get localScale(){return this._localScale}get localDetailScale(){return this._localDetailScale}set localDetailScale(e){this._localDetailScale=e,Re.setContinueScale(this.index,e.x,e.y,e.z)}get localDetailRot(){return this._localDetailRot}set localDetailRot(e){this._localDetailRot=e,Re.setContinueRotation(this.index,e.x,e.y,e.z)}get localDetailPos(){return this._localDetailPos}set localDetailPos(e){this._localDetailPos=e,Re.setContinueTranslate(this.index,e.x,e.y,e.z)}beforeDestroy(e){this.parent&&this.parent.object3D&&this.parent.object3D.removeChild(this.object3D),super.beforeDestroy(e)}destroy(){super.destroy(),this.scene3D=null,this.eventPositionChange=null,this.eventRotationChange=null,this.eventScaleChange=null,this.onPositionChange=null,this.onRotationChange=null,this.onScaleChange=null,this._scene3d=null,this._parent=null,this._localPos=null,this._localRot=null,this._localRotQuat=null,this._localScale=null,this._forward=null,this._back=null,this._right=null,this._left=null,this._up=null,this._down=null,this.localChange=null,this._targetPos=null}}class oa{static GLTF_NODE_INDEX_PROPERTY;static BASE_COLOR_UNIFORM="u_baseColorFactor";static BASE_COLOR_TEXTURE_UNIFORM="u_baseColorSampler";static METALROUGHNESS_UNIFORM="u_metallicRoughnessValues";static METALROUGHNESS_TEXTURE_UNIFORM="u_metallicRoughnessSampler";static NORMAL_TEXTURE_UNIFORM="u_normalSampler";static NORMAL_SCALE_UNIFORM="u_normalScale";static EMISSIVE_TEXTURE_UNIFORM="u_emissiveSampler";static EMISSIVE_FACTOR_UNIFORM="u_emissiveFactor";static OCCLUSION_TEXTURE_UNIFORM="u_occlusionSampler";static OCCLUSION_FACTOR_UNIFORM="u_occlusionFactor";static MAX_MORPH_TARGETS=8;static MORPH_POSITION_PREFIX="a_morphPositions_";static MORPH_NORMAL_PREFIX="a_morphNormals_";static MORPH_TANGENT_PREFIX="a_morphTangents_";static MORPH_WEIGHT_UNIFORM="u_morphWeights";static SCENE_ROOT_SKELETON="SCENE_ROOT";static IDENTITY_INVERSE_BIND_MATRICES="IDENTITY_IBM";static JOINT_MATRICES_UNIFORM="u_jointMatrix";static ALPHA_CUTOFF_UNIFORM="u_alphaCutoff"}var G=(s=>(s.position="position",s.normal="normal",s.uv="uv",s.TANGENT="TANGENT",s.TEXCOORD_1="TEXCOORD_1",s.TEXCOORD_2="TEXCOORD_2",s.TEXCOORD_3="TEXCOORD_3",s.TEXCOORD_4="TEXCOORD_4",s.TEXCOORD_5="TEXCOORD_5",s.TEXCOORD_6="TEXCOORD_6",s.TEXCOORD_7="TEXCOORD_7",s.color="color",s.joints0="joints0",s.joints1="joints1",s.weights0="weights0",s.weights1="weights1",s.weight="weight",s.indices="indices",s.vIndex="vIndex",s.a_morphPositions_0="a_morphPositions_0",s.all="all",s))(G||{}),De=(s=>(s[s.NONE=0]="NONE",s[s.ABOVE=1]="ABOVE",s[s.ALPHA=2]="ALPHA",s[s.NORMAL=3]="NORMAL",s[s.ADD=4]="ADD",s[s.BELOW=5]="BELOW",s[s.ERASE=6]="ERASE",s[s.MUL=7]="MUL",s[s.SCREEN=8]="SCREEN",s[s.DIVD=9]="DIVD",s[s.SOFT_ADD=10]="SOFT_ADD",s))(De||{}),Xc=(s=>(s[s.src_a=0]="src_a",s[s.dest_a=1]="dest_a",s))(Xc||{});class Hc{static getBlend(e){let t={color:{srcFactor:"src-alpha",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}};switch(e){case 0:t.color.srcFactor="one",t.color.dstFactor="zero",t.color.operation="add";break;case 1:t.color.srcFactor="one-minus-src-alpha",t.color.dstFactor="dst-alpha",t.color.operation="add";break;case 4:t.color.srcFactor="one",t.color.dstFactor="one",t.color.operation="add",t.alpha.srcFactor="one",t.alpha.dstFactor="one",t.alpha.operation="add";break;case 2:t.color.srcFactor="src-alpha",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 5:t.color.srcFactor="one-minus-src-alpha",t.color.dstFactor="one",t.color.operation="add";break;case 6:t.color.srcFactor="zero",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 7:t.color.srcFactor="dst",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 3:t.color.srcFactor="src-alpha",t.color.dstFactor="one-minus-src-alpha",t.color.operation="add";break;case 10:t.color.srcFactor="one",t.color.dstFactor="one",t.color.operation="max",t.alpha.srcFactor="one",t.alpha.dstFactor="one",t.alpha.operation="add";break;case 8:t.color.srcFactor="one",t.color.dstFactor="one-minus-src",t.color.operation="add";break}return t}}class wa{static mipmapShader=`
|
|
5670
5670
|
var<private> pos : array<vec2<f32>, 4> = array<vec2<f32>, 4>(
|
|
5671
5671
|
vec2<f32>(-1.0, 1.0), vec2<f32>(1.0, 1.0),
|
|
5672
5672
|
vec2<f32>(-1.0, -1.0), vec2<f32>(1.0, -1.0));
|
|
@@ -5742,7 +5742,7 @@ struct InstanceData {
|
|
|
5742
5742
|
`,a}}class we extends Ge{constructor(){super()}static parse(e){let t=new Array,a=new Array,r=0;for(;e.peekToken(0).Type!=x.EOF;){let i=e.peekToken(0);if(i.Type==x.SEMICOLON||i.Type==x.RIGHTMEDI||i.Type==x.COMMA||i.Type==x.COLON||i.Type==x.RIGHTBIG)break;if(i.isOperation()){if(i.isOperation()){if(i.Type==x.INC||i.Type==x.DEC){let n=i;e.skipToken(1);let o=we.parse(e);a.push(new ri(n,void 0,o));continue}else if(t.length>0){if(t[t.length-1].nOperationPriorityLevel<=i.nOperationPriorityLevel)we.unionOperation(t,a);else if(t.length>0&&t[t.length-1].Literal=="-"){let o=t.pop(),l=a.pop();a.push(new ri(o,void 0,l))}}t.push(i),e.skipToken(1)}}else if(i.Type==x.LITERAL){a.push(new ar(i.Literal)),e.skipToken(1);continue}else if(i.Type==x.LEFTSAMLL){r++,t.push(i),e.skipToken(1);continue}else if(i.Type==x.RIGHTSAMLL){if(r<=0)break;for(r--;we.unionOperation(t,a););if(t[t.length-1].Type==x.LEFTSAMLL){t.pop();let n=new t0;n.addNode(a.pop()),a.push(n)}e.skipToken(1);continue}else if(i.Type==x.IDENT){if(e.peekToken(1).Type==x.INC||e.peekToken(1).Type==x.DEC){let n=e.peekToken(1),o=new Xa(i.Literal);a.push(new ri(n,o,void 0)),e.skipToken(2);continue}else if(e.peekToken(1).Type==x.LEFTSAMLL){a.push(Wr.parse(e));continue}else if(e.peekToken(1).Type==x.DOT){a.push(ls.parse(e));continue}else if(e.peekToken(1).Type==x.LEFTMEDI){a.push(Zr.parse(e));continue}a.push(new Xa(i.Literal)),e.skipToken(1);continue}else{if(i.isBuiltinType()&&e.peekToken(1).Type==x.LEFTSAMLL){a.push(Wr.parse(e));continue}if(i.isAssignOperation()){let n=i;e.skipToken(1);let o=a.pop(),l=we.parse(e);a.push(new br(n,o,l));continue}if(i.Type==x.LEFTBIG&&(e.peekToken(1).Type==x.LITERAL||e.peekToken(1).Type==x.SUB&&e.peekToken(2).Type==x.LITERAL)){a.push(ms.parse(e));continue}if(i.Type==x.QUEMARK){t.length>0&&t[t.length-1].nOperationPriorityLevel<=i.nOperationPriorityLevel&&we.unionOperation(t,a),e.skipToken(1);let n=a.pop(),o=we.parse(e);e.peekToken(0).Type==x.COLON&&e.skipToken(1);let l=we.parse(e);if(a.push(new a0(n,o,l)),e.peekToken(-1).Type==x.SEMICOLON)break;continue}if(i.Type==x.LEFTMEDI){e.skipToken(1);let n=we.parse(e);e.peekToken(0).Type==x.RIGHTMEDI&&e.skipToken(1);let o=a.pop();a.push(new Zr(o,n));continue}throw"An unexpected character"}}for(;t.length>0&&we.unionOperation(t,a););if(t.length<=0&&a.length==1){let i=new we;return i.addNode(a.pop()),i}throw"Error parsing expression: Unexpected character("+e.peekToken(0).Literal+")"}formatToWGSL(e,t){return this.nodes[0].formatToWGSL(e,t)}static unionOperation(e,t){if(e.length<0||t.length<2){if(e.length>0&&e[e.length-1].Literal=="-"){let a=e.pop(),r=t.pop();return t.push(new ri(a,void 0,r)),!0}return!1}if(e[e.length-1].isOperation()){let a=t.pop(),r=e.pop(),i=t.pop();return r.Type==x.DOT?t.push(new ls(i,a)):t.push(new br(r,i,a)),!0}return!1}}class t0 extends Ge{constructor(){super()}formatToWGSL(e,t){return(t<=0?"":" ".repeat(t))+"("+this.nodes[0].formatToWGSL(e,0)+")"}}class Xa extends Ge{name;constructor(e){super(),this.name=e}formatToWGSL(e,t){return(t<=0?"":" ".repeat(t))+e.findIdentifier(this.name)}}class ar extends Ge{value;constructor(e){super(),this.value=e}static parse(e){let t=e.peekToken(0);if(t.Type==x.SUB&&e.peekToken(1).Type==x.LITERAL){let a=new ar("-"+e.peekToken(1).Literal);return e.skipToken(2),a}else if(t.Type==x.LITERAL){let a=new ar(t.Literal);return e.skipToken(1),a}throw"Error parsing literal constants: Unexpected characters("+t.Literal+")"}formatToWGSL(e,t){return(t<=0?"":" ".repeat(t))+this.value}}class ms extends ar{arrayValue;constructor(e){super(""),this.arrayValue=e}static parse(e){if(e.peekToken(0).Type==x.LEFTBIG&&e.peekToken(1).Type==x.LITERAL||e.peekToken(0).Type==x.LEFTBIG&&e.peekToken(1).Type==x.SUB&&e.peekToken(2).Type==x.LITERAL){e.skipToken(1);let t=[];for(;e.peekToken(0).Type!=x.RIGHTBIG;){if(e.peekToken(0).Type==x.LEFTSAMLL){t.push(ms.parse(e));continue}if(t.push(ar.parse(e)),e.peekToken(0).Type==x.COMMA){e.skipToken(1);continue}else if(e.peekToken(0).Type==x.RIGHTBIG){e.skipToken(1);break}else throw"Error parsing array constants: Unexpected characters"}return new ms(t)}throw"Error parsing array constants: Unexpected characters"}formatToWGSL(e,t){let a="",r=t<=0?"":" ".repeat(t);this.arrayValue[0].value.includes(".")?a+=r+"array<f32, "+this.arrayValue.length.toString()+">(":a+=r+"array<i32, "+this.arrayValue.length.toString()+">(";for(let i=0;i<this.arrayValue.length;i++)i>0&&(a+=", "),a+=this.arrayValue[i].formatToWGSL(e,0);return a+=")",a}}class N2 extends Ge{constructor(){super()}}class P2 extends Ge{constructor(){super()}}class fn extends Ge{constructor(){super()}static parse(e){if(e.peekToken(0).Type==x.CONTINUE&&e.peekToken(1).Type==x.SEMICOLON)return e.skipToken(2),new fn;throw"Error parsing continue: Unexpected character"}formatToWGSL(e,t){let a="",r=t<=0?"":" ".repeat(t);return a+=r+"continue",a}}class os extends Ge{value;constructor(e){super(),this.value=e}static parse(e){if(e.peekToken(0).Type==x.RETURN){e.skipToken(1);let t=we.parse(e);return e.peekToken(0).Type==x.SEMICOLON&&e.skipToken(1),new os(t)}throw"Error parsing return expression: Unexpected character"}formatToWGSL(e,t){let a="",r=t<=0?"":" ".repeat(t);return a+=r+"return "+this.value.formatToWGSL(e,0),a}}class ri extends Ge{op;leftValue;rightValue;constructor(e,t,a){super(),this.op=e,this.leftValue=t,this.rightValue=a}formatToWGSL(e,t){let a="",r=t<=0?"":" ".repeat(t);if(this.op.Literal=="++"||this.op.Literal=="--")if(this.leftValue!=null){let i=this.leftValue.formatToWGSL(e,0);a+=r+i+" = "+i+" "+this.op.Literal[0]+" 1"}else{let i=this.rightValue.formatToWGSL(e,0);a+=r+i+" = "+i+" "+this.op.Literal[0]+" 1"}else this.leftValue!=null?a+=r+this.leftValue.formatToWGSL(e,0)+this.op.Literal:a+=r+this.op.Literal+this.rightValue.formatToWGSL(e,0);return a}}class br extends Ge{op;leftValue;rightValue;constructor(e,t,a){super(),this.op=e,this.leftValue=t,this.rightValue=a}formatToWGSL(e,t){let a="",r=t<=0?"":" ".repeat(t);return a+=r+this.leftValue.formatToWGSL(e,0)+" "+this.op.Literal+" "+this.rightValue.formatToWGSL(e,0),a}}class a0 extends Ge{condition;expression1;expression2;constructor(e,t,a){super(),this.condition=e,this.expression1=t,this.expression2=a}static parse(e){throw"Error parsing ternary operation expression: Unexpected character"}formatToWGSL(e,t){return""}}class ls extends Ge{leftValue;rightValue;constructor(e,t){super(),this.leftValue=e,this.rightValue=t}static parse(e){if(e.peekToken(0).Type==x.IDENT&&e.peekToken(1).Type==x.DOT&&e.peekToken(2).Type==x.IDENT){let t=new Xa(e.peekToken(0).Literal),a=new Xa(e.peekToken(2).Literal);return e.skipToken(3),new ls(t,a)}throw"Error parsing selection expression: Unexpected character"}formatToWGSL(e,t){return(t<=0?"":" ".repeat(t))+this.leftValue.formatToWGSL(e,0)+"."+this.rightValue.formatToWGSL(e,0)}}class Zr extends Ge{leftValue;indexValue;constructor(e,t){super(),this.leftValue=e,this.indexValue=t}static parse(e){if(e.peekToken(0).Type==x.IDENT&&e.peekToken(1).Type==x.LEFTMEDI){let t=new Xa(e.peekToken(0).Literal);e.skipToken(2);let a=we.parse(e);e.peekToken(0).Type==x.RIGHTMEDI&&e.skipToken(1);let r=new Zr(t,a);for(;e.peekToken(0).Type==x.LEFTMEDI;)e.skipToken(1),a=we.parse(e),e.peekToken(0).Type==x.RIGHTMEDI&&e.skipToken(1),r=new Zr(r,a);return r}throw"Error parsing index expression: Unexpected character"}formatToWGSL(e,t){return(t<=0?"":" ".repeat(t))+this.leftValue.formatToWGSL(e,0)+"["+this.indexValue.formatToWGSL(e,0)+"]"}}class Sa extends Ge{constructor(){super()}static parse(e){if(e.peekToken(0).Type==x.LEFTBIG){e.skipToken(1);let t=new Sa;for(let a=1;a>0&&e.peekToken(0).Type!=x.EOF;){let r=e.peekToken(0);if(r.Type==x.LEFTBIG){a++,e.skipToken(1);continue}if(r.Type==x.RIGHTBIG){a--,e.skipToken(1);continue}if(r.Type==x.SEMICOLON){e.skipToken(1);continue}if(r.isDataType()&&e.peekToken(1).Type==x.IDENT){t.addNode(rt.parse(e));continue}if(r.Type==x.CONST&&e.peekToken(1).isDataType()&&e.peekToken(2).Type==x.IDENT){t.addNode(rt.parse(e));continue}else if(r.Type==x.IDENT&&e.peekToken(1).Type==x.ASSIGN){t.addNode(we.parse(e)),e.peekToken(0).Type==x.SEMICOLON&&e.skipToken(1);continue}else if(r.Type==x.IDENT&&e.peekToken(1).Type==x.LEFTMEDI){let i=Zr.parse(e);if(e.peekToken(0).Type==x.ASSIGN){let n=e.peekToken(0);e.skipToken(1);let o=we.parse(e);e.peekToken(0).Type==x.RIGHTMEDI&&e.skipToken(1),t.addNode(new br(n,i,o));continue}t.addNode(i);continue}else if(r.Type==x.IDENT&&e.peekToken(1).Type==x.DOT){let i=we.parse(e);t.addNode(i);continue}else if(r.Type==x.IDENT&&e.peekToken(1).isAssignOperation()){let i=e.peekToken(1),n=new Xa(r.Literal);e.skipToken(2);let o=we.parse(e);e.peekToken(0).Type==x.SEMICOLON&&e.skipToken(1),t.addNode(new br(i,n,o));continue}else if(r.Type==x.IDENT&&(e.peekToken(1).Type==x.INC||e.peekToken(1).Type==x.DEC)&&e.peekToken(2).Type==x.SEMICOLON){let i=e.peekToken(1);t.addNode(new ri(i,new Xa(r.Literal),void 0)),e.skipToken(3);continue}else if(r.Type==x.RETURN){t.addNode(os.parse(e));continue}else if(r.Type==x.CONTINUE){t.addNode(fn.parse(e));continue}else if(r.Type==x.WHILE){t.addNode(jr.parse(e));continue}else if(r.Type==x.FOR){t.addNode(Jr.parse(e));continue}else if(r.Type==x.IF){t.addNode(Or.parse(e));continue}else if(r.Type==x.IDENT&&e.peekToken(1).Type==x.LEFTSAMLL){t.addNode(Wr.parse(e)),e.peekToken(0).Type==x.SEMICOLON&&e.skipToken(0);continue}throw"Error parsing block: Unexpected symbol("+r.Literal+")"}return t}throw"Error parsing block: Unexpected symbol"}}class dn extends Ge{type;qualifier;constructor(e,t){super(),this.type=t,this.qualifier=e}static parse(e){if(e.peekToken(0).Type==x.PRECISION&&e.peekToken(1).Type==x.IDENT&&e.peekToken(2).isBuiltinType()){let t=new dn(e.peekToken(1).Literal,e.peekToken(2).Literal);return e.skipToken(3),e.peekToken(0).Type==x.SEMICOLON&&e.skipToken(1),t}throw"Error parsing precision qualifier: Unexpected character"}formatToWGSL(e,t){return""}}class cs extends Ge{scope="";qualifier=new Map;constructor(){super()}addQualifier(e,t=""){this.qualifier.set(e,t)}static parse(e){if(e.peekToken(0).Type==x.LAYOUT&&e.peekToken(1).Type==x.LEFTSAMLL){let t=new cs;e.skipToken(2);do if(e.peekToken(0).Type==x.IDENT){if(e.peekToken(1).Type==x.ASSIGN&&e.peekToken(2).Type==x.LITERAL){let r=e.peekToken(0).Literal,i=e.peekToken(2).Literal;if(t.addQualifier(r,i),e.skipToken(3),e.peekToken(0).Type==x.COMMA){e.skipToken(1);continue}let n=e.peekToken(0);n.Line=0}else if(e.peekToken(1).Type==x.RIGHTSAMLL){let r=e.peekToken(0).Literal;t.addQualifier(r,""),e.skipToken(1);break}else if(e.peekToken(1).Type==x.COMMA){let r=e.peekToken(0).Literal;t.addQualifier(r,""),e.skipToken(2);continue}}while(e.peekToken(0).Type!=x.RIGHTSAMLL);if(e.peekToken(0).Type==x.RIGHTSAMLL&&e.skipToken(1),t.scope=e.peekToken(0).Literal,e.skipToken(1),e.peekToken(0).Type==x.SEMICOLON)return e.skipToken(1),t;if(e.peekToken(0).isBuiltinType()&&e.peekToken(1).Type==x.IDENT&&e.peekToken(2).Type==x.SEMICOLON){let a=new rt(e.peekToken(0).Literal,e.peekToken(1).Literal);return t.addNode(a),e.skipToken(3),t}else if(e.peekToken(0).Type==x.IDENT&&e.peekToken(1).Type==x.LEFTBIG){let a=tr.parse(e);return t.addNode(a),e.peekToken(0).Type==x.IDENT&&e.peekToken(1).Type==x.SEMICOLON&&(a.addNode(new rt(a.name,e.peekToken(0).Literal)),e.skipToken(2)),t}else throw"Error parsing layout qualifier type: Unexpected symbol("+e.peekToken(0).Literal+")"}throw"Error parsing layout qualifier: Unexpected symbol"}formatToWGSL(e,t){let a="";if(this.qualifier.size==1&&this.qualifier.has("location"))a+="@location("+this.qualifier.get("location")+") ";else if(this.qualifier.size==2&&this.qualifier.has("set")&&this.qualifier.has("binding"))a+="@group("+this.qualifier.get("set")+") @binding("+this.qualifier.get("binding")+") ";else if(this.qualifier.size>=1&&this.qualifier.has("binding"))a+="@group(0) @binding("+this.qualifier.get("binding")+") ";else if(this.qualifier.size==1&&this.qualifier.has("push_constant"))a+="@push_constant ";else if(this.qualifier.size>=1&&this.qualifier.has("local_size_x"))a+="@workgroup_size(",a+=this.qualifier.get("local_size_x")+", ",a+=this.qualifier.has("local_size_y")?this.qualifier.get("local_size_y")+", ":"1, ",a+=this.qualifier.has("local_size_z")?this.qualifier.get("local_size_z")+"":"1",a+=")";else if(this.nodes.length<=0)return"";let r=this.nodes[0];if(r instanceof rt){switch(r.type){case"sampler":case"texture2D":a+="var ";break;default:this.scope=="buffer"?e.stage=="compute"?a+="var<storage, read_write> ":a+="var<storage, read> ":a+="var<"+this.scope+"> ";break}e.addIdentifier(r.name,r.name),a+=r.name+": "+la(r.type)+`;\r
|
|
5743
5743
|
`}else if(r instanceof tr){if(this.scope=="buffer"?e.stage=="compute"?a+="var<storage, read_write> ":a+="var<storage, read> ":a+="var<"+this.scope+"> ",r.nodes.length<=0){let i="unif"+e.layoutUniformCount.toString();for(;e.hasIdentifier(i);)e.layoutUniformCount++,i="unif"+e.layoutUniformCount.toString();for(let n of r.fields)e.addIdentifier(n.name,i+"."+n.name);a+=i+": "+r.name+`;\r
|
|
5744
5744
|
`,e.layoutUniformCount++}else{let i=r.nodes[0];a+=i.name+": "+i.type+`;\r
|
|
5745
|
-
`}return a}return a}}function la(s){switch(s){case"int":return"i32";case"int[]":return"array<i32>";case"uint":return"u32";case"uint[]":return"array<u32>";case"float":return"f32";case"float[]":return"array<f32>";case"vec2":return"vec2<f32>";case"vec3":return"vec3<f32>";case"vec4":return"vec4<f32>";case"vec2[]":return"array<vec2<f32>>";case"vec3[]":return"array<vec3<f32>>";case"vec4[]":return"array<vec4<f32>>";case"ivec2":return"vec2<i32>";case"ivec3":return"vec3<i32>";case"ivec4":return"vec4<i32>";case"ivec2[]":return"array<vec2<i32>>";case"ivec3[]":return"array<vec3<i32>>";case"ivec4[]":return"array<vec4<i32>>";case"mat2":return"mat2x2<f32>";case"mat2x2":return"mat2x2<f32>";case"mat2x3":return"mat2x3<f32>";case"mat2x4":return"mat2x4<f32>";case"mat2[]":return"array<mat2x2<f32>>";case"mat2x2[]":return"array<mat2x2<f32>>";case"mat2x3[]":return"array<mat2x3<f32>>";case"mat2x4[]":return"array<mat2x4<f32>>";case"mat3":return"mat3x3<f32>";case"mat3x2":return"mat3x2<f32>";case"mat3x3":return"mat3x3<f32>";case"mat3x4":return"mat3x4<f32>";case"mat3[]":return"array<mat3x3<f32>>";case"mat3x2[]":return"array<mat3x2<f32>>";case"mat3x3[]":return"array<mat3x3<f32>>";case"mat3x4[]":return"array<mat3x4<f32>>";case"mat4":return"mat4x4<f32>";case"mat4x2":return"mat4x2<f32>";case"mat4x3":return"mat4x3<f32>";case"mat4x4":return"mat4x4<f32>";case"mat4[]":return"array<mat4x4<f32>>";case"mat4x2[]":return"array<mat4x2<f32>>";case"mat4x3[]":return"array<mat4x3<f32>>";case"mat4x4[]":return"array<mat4x4<f32>>";case"texture2D":return"texture_2d<f32>"}return s}class r0{_lexer;_rootNode;constructor(e){this._lexer=e,this._rootNode=new Ge,this.parse()}get lexer(){return this._lexer}parse(){for(;this.peekToken(0).Type!==x.EOF;){if(this.peekToken(0).Type==x.SEMICOLON){this.skipToken(1);continue}let e=this.parseStatement();e!==null&&this._rootNode.addNode(e)}}parseStatement(){let e=this.peekToken();if(e.Type==x.LAYOUT&&this.peekToken(1).Type==x.LEFTSAMLL)return cs.parse(this._lexer);if(e.Type==x.STRUCT)return this.skipToken(1),tr.parse(this._lexer);if((e.isBuiltinType()||e.Type==x.VOID)&&this.peekToken(1).Type==x.IDENT&&this.peekToken(2).Type==x.LEFTSAMLL)return ln.parse(this._lexer);if(e.Type==x.CONST&&this.peekToken(1).isDataType())return rt.parse(this._lexer);if(e.isDataType()&&this.peekToken(1).Type==x.IDENT)return rt.parse(this._lexer);if(e.Type==x.OUT&&this.peekToken(1).isDataType()&&this.peekToken(2).Type==x.IDENT)return rt.parse(this._lexer);if(e.Type==x.PRECISION)return dn.parse(this._lexer);throw"Error parsing statement: Unexpected character"}skipToken(e){this._lexer.skipToken(e)}peekToken(e=0){return this._lexer.peekToken(e)}getNextToken(){return this._lexer.GetNextToken()}get ASTRoot(){return this._rootNode}}class i0{static VertexShader="VertexShader";static FragmentShader="FragmentShader";static convertGLSL(e){var t=new $c(e),a=new qc(t),r=new r0(a),i=new e0(r);return i.generateWGSL()}}class zn{setID=0;bindingID=0;name="";type=""}class Wn{name="";type="";locationID=0;builtinName="";isBuiltinAttribute(){return this.builtinName!=""}}class s0{uniformInfo=[];inputAttribute=[];outputAttribute=[];sourceCode=""}var _a=(s=>(s[s.vertex=0]="vertex",s[s.fragment=1]="fragment",s[s.computer=2]="computer",s))(_a||{});class n0{blendMode=De.NONE;depthCompare=ft.less_equal;depthWriteEnabled=!0;frontFace="ccw";cullMode=Lt.back;topology=Ss.triangle_list;depthBias=10;useLight=!1;useProbe=!1;acceptGI=!1;acceptShadow=!1;castShadow=!1;castReflection=!0;receiveEnv=!1;renderLayer=1e3;renderOrder=2e3;unclippedDepth=!1;transparent=!1;multisample=0;label;useZ=!0;splitTexture=!1;alphaCutoff;useFragDepth=!1;writeMasks=[];setFromMapValues(e){e.has("blendMode")&&(this.blendMode=this.convertBlendMode(e.get("blendMode"))),e.has("depthCompare")&&(this.depthCompare=e.get("depthCompare")),e.has("depthWriteEnabled")&&(this.depthWriteEnabled=e.get("depthWriteEnabled")),e.has("frontFace")&&(this.frontFace=e.get("frontFace")),e.has("cullMode")&&(this.cullMode=e.get("cullMode")),e.has("topology")&&(this.topology=e.get("topology")),e.has("depthBias")&&(this.depthBias=e.get("depthBias")),e.has("useLight")&&(this.useLight=e.get("useLight")),e.has("useProbe")&&(this.useProbe=e.get("useProbe")),e.has("acceptGI")&&(this.acceptGI=e.get("acceptGI")),e.has("acceptShadow")&&(this.acceptShadow=e.get("acceptShadow")),e.has("castShadow")&&(this.castShadow=e.get("castShadow")),e.has("receiveEnv")&&(this.receiveEnv=e.get("receiveEnv")),e.has("renderLayer")&&(this.renderLayer=e.get("renderLayer")),e.has("renderOrder")&&(this.renderOrder=e.get("renderOrder")),e.has("unclippedDepth")&&(this.unclippedDepth=e.get("unclippedDepth")),e.has("multisample")&&(this.multisample=e.get("multisample")),e.has("label")&&(this.label=e.get("label")),e.has("useZ")&&(this.useZ=e.get("useZ"))}convertBlendMode(e){switch(e){case"ABOVE":return De.ABOVE;case"ALPHA":return De.ALPHA;case"NORMAL":return De.NORMAL;case"ADD":return De.ADD;case"BELOW":return De.BELOW;case"ERASE":return De.ERASE;case"MUL":return De.MUL;case"SCREEN":return De.SCREEN;case"DIVD":return De.DIVD;case"SOFT_ADD":return De.SOFT_ADD}return De.NONE}}class o0 extends Ya{uniformNodes=[];_onChange=!0;constructor(){super(),this.bufferType=Aa.MaterialDataUniformGPUBuffer}initDataUniform(e){this.uniformNodes=e;let t=0;for(const a in e){const r=e[a];r||console.error(a,"is empty"),t+=r.size*4}t=Math.floor(t/256+1)*256,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,t/4,null,"MaterialDataUniformGPUBuffer");for(const a in e){const r=e[a];r||console.error(a,"is empty");let i=this.memory.allocation_node(r.size*4);r.memoryInfo=i,r.bindOnChange=()=>this.onChange()}}onChange(){this._onChange=!0}apply(){if(this.uniformNodes.length!=0&&this._onChange){for(const e in this.uniformNodes)this.uniformNodes[e].update();super.apply(),this._onChange=!1}}}class Ha{static renderShaderModulePool;static renderShader;static init(){this.renderShaderModulePool=new Map,this.renderShader=new Map}}class ke{reference;static _ins;static getInstance(){return this._ins||=new ke,this._ins}attached(e,t){this.reference||=new Map;let a=this.reference.get(e);a||=new Map,a.set(t,e),this.reference.set(e,a)}detached(e,t){if(!this.reference)return;let a=this.reference.get(e);a&&(a.delete(t),a.size===0&&this.reference.delete(e))}hasReference(e){let t=this.reference.get(e);return t?t.size>0:!1}getReferenceCount(e){let t=this.reference.get(e);return t?t.size:0}getReference(e){let t=this.reference.get(e);return t||null}}class Jn{static pipelineMap=new Map;static getSharePipeline(e){let t=this.pipelineMap.get(e);return t||null}static setSharePipeline(e,t){this.pipelineMap.set(e,t)}}class qe extends Cn{passType=fe.COLOR;useRz=!1;vsName;fsName;shaderState;textures;pipeline;bindGroupLayouts;envMap;prefilterMap;reflectionMap;_sourceVS;_sourceFS;_destVS;_destFS;_vsShaderModule;_fsShaderModule;_textureGroup=-1;_textureChange=!1;_groupsShaderReflectionVarInfos;outBufferMask;constructor(e,t){super(),this.vsName=e.toLowerCase(),this.fsName=t.toLowerCase(),this.vsName in Y||console.error("Shader Not Register, Please Register Shader!",this.vsName),this.fsName in Y||console.error("Shader Not Register, Please Register Shader!",this.fsName),Y[this.vsName]&&(this._sourceVS=Y[this.vsName]),Y[this.fsName]&&(this._sourceFS=Y[this.fsName]),this.textures={},this.bindGroups=[],this.shaderState=new n0,this.materialDataUniformBuffer=new o0,this.materialDataUniformBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,this._bufferDic.set("global",this.materialDataUniformBuffer),this._bufferDic.set("materialUniform",this.materialDataUniformBuffer)}get renderOrder(){return this.shaderState.renderOrder}set renderOrder(e){this.shaderState.renderOrder!=e&&(this._valueChange=!0),this.shaderState.renderOrder=e}get doubleSide(){return this.shaderState.cullMode==Lt.none}set doubleSide(e){let t=e?Lt.none:this.cullMode;this.shaderState.cullMode!=t&&(this._valueChange=!0),this.shaderState.cullMode=t}get depthWriteEnabled(){return this.shaderState.depthWriteEnabled}set depthWriteEnabled(e){this.shaderState.depthWriteEnabled!=e&&(this._valueChange=!0),this.shaderState.depthWriteEnabled=e}get cullMode(){return this.shaderState.cullMode}set cullMode(e){this.shaderState.cullMode!=e&&(this._valueChange=!0),this.shaderState.cullMode=e}get frontFace(){return this.shaderState.frontFace}set frontFace(e){this.shaderState.frontFace!=e&&(this._valueChange=!0),this.shaderState.frontFace=e}get depthBias(){return this.shaderState.depthBias}set depthBias(e){this.shaderState.depthBias!=e&&(this._valueChange=!0),this.shaderState.depthBias=e}get topology(){return this.shaderState.topology}set topology(e){this.shaderState.topology!=e&&(this._valueChange=!0),this.shaderState.topology=e}get blendMode(){return this.shaderState.blendMode}set blendMode(e){this.shaderState.blendMode!=e&&(this._valueChange=!0,e!=De.NORMAL&&e!=De.NONE&&(this.renderOrder=3e3)),this.shaderState.blendMode=e}get depthCompare(){return this.shaderState.depthCompare}set depthCompare(e){this.shaderState.depthCompare!=e&&(this._valueChange=!0),this.shaderState.depthCompare=e}setShaderEntry(e="",t=""){this.vsEntryPoint=e,this.fsEntryPoint=t}setUniformArray(e,t){super.setUniformArray(e,t),this.materialDataUniformBuffer.onChange()}setUniform(e,t){super.setUniform(e,t),this.materialDataUniformBuffer.onChange()}setTexture(e,t){t&&this.textures[e]!=t&&(this.textures[e]&&this.textures[e].unBindStateChange(this),this._textureChange=!0,this.textures[e]=t,e=="envMap"?this.envMap=t:e=="prefilterMap"?this.prefilterMap=t:e=="reflectionMap"&&(this.reflectionMap=t),t.bindStateChange(()=>{this._textureChange=!0},this))}get baseColor(){return this.getUniform("baseColor")}set baseColor(e){this.setUniform("baseColor",e)}getTexture(e){return this.textures[e]}genRenderPipeline(e,t){let a=this.createGroupLayouts();this.createPipeline(e,t,a)}reBuild(e,t){this.compileShader(_a.vertex,this._destVS,t),this.compileShader(_a.fragment,this._destFS,t),this.genRenderPipeline(e,t)}apply(e,t,a){this.materialDataUniformBuffer.apply(),this._textureChange&&this._textureGroup!=-1&&(this._textureChange=!1,this.genGroups(this._textureGroup,this.shaderReflection.groups,!0)),this._valueChange&&(this._shaderChange&&(this.preCompile(e),this._shaderChange=!1),this.shaderVariant=Tt.genRenderShaderVariant(this),this.reBuild(e,t),this._valueChange=!1,a&&a())}preCompile(e){this.preDefine(e),this.preCompileShader(_a.vertex,this._sourceVS.concat()),this.preCompileShader(_a.fragment,this._sourceFS.concat()),this.genReflection()}applyPostDefine(e,t){return t.renderTargetTextures.length>1?(this.defineValue.USE_WORLDPOS=!0,this.defineValue.USEGBUFFER=!0):(this.defineValue.USE_WORLDPOS=!1,this.defineValue.USEGBUFFER=!1),_.setting.render.useCompressGBuffer?this.defineValue.USE_COMPRESSGBUFFER=!0:this.defineValue.USE_COMPRESSGBUFFER=!1,Da.parse(e,this.defineValue)}setBindGroup(e,t){this.bindGroups[e]=t}checkBuffer(e,t){}preCompileShader(e,t,a){let r=t;if(r.indexOf("version ")!=-1){var i=i0.convertGLSL(r);r=i.sourceCode}for(const n in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,n)){const o=this.constValues[n];r=r.replaceAll(`&${n}`,o.toString())}switch(e){case _a.vertex:this._destVS=r;break;case _a.fragment:this._destFS=r;break}}compileShader(e,t,a){let r=t;r=this.applyPostDefine(r,a);let i=t;for(let o in this.defineValue)i+=`${o}=${this.defineValue[o]},`;let n=Ha.renderShaderModulePool.get(i);switch(n||(r=this.applyPostDefine(r,a),n=I.device.createShaderModule({label:e==_a.vertex?this.vsName:this.fsName,code:r}),n.getCompilationInfo().then(o=>{o.messages.length>0&&(console.log(r),console.log(o))}),Ha.renderShaderModulePool.set(i,n)),e){case _a.vertex:this._vsShaderModule=n,this._destVS=r;break;case _a.fragment:this._fsShaderModule=n,this._destFS=r;break}}getGroupLayout(e,t){let a=[];for(let r=0;r<t.length;r++){const i=t[r];if(i)if(i.varType=="uniform"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"uniform"}};a.push(o)}else if(i.varType=="storage-read"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"read-only-storage"}};a.push(o)}else if(i.varType=="var")switch(i.dataType){case"sampler":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:_.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.samplerBindingLayout};a.push(l),this._textureGroup=e}break;case"sampler_comparison":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:_.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.sampler_comparisonBindingLayout};a.push(l),this._textureGroup=e}break;case"texture_2d<f32>":case"texture_2d_array<f32>":case"texture_cube<f32>":case"texture_depth_2d":case"texture_depth_2d_array":case"texture_depth_cube":case"texture_depth_cube_array":{let n=this.textures[i.varName]?this.textures[i.varName]:_.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,ke.getInstance().attached(n,this)}break;case"texture_external":{let n=this.textures[i.varName]?this.textures[i.varName]:_.res.redTexture,o={binding:i.binding,visibility:n.visibility,externalTexture:{}};a.push(o),this._textureGroup=e,ke.getInstance().attached(n,this)}break;default:{let n=this.textures[i.varName]?this.textures[i.varName]:_.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,ke.getInstance().attached(n,this)}break}else{debugger;console.error("bind group can't empty")}}return a}_cacheEntries;genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;o++){const l=r[o];if(l){if(l.varType=="uniform"){let c=this._bufferDic.get(l.varName);if(c){if(c.bufferType==Aa.MaterialDataUniformGPUBuffer){let d=[];if(l.dataFields)for(let h=0;h<l.dataFields.length;h++){const u=l.dataFields[h];this.uniforms[u.name]?d.push(this.uniforms[u.name]):console.error(`shader-${this.vsName}:${this.fsName} ${u.name}is empty`)}d.length>0&&this.materialDataUniformBuffer.initDataUniform(d)}let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`shader${this.vsName}-${this.fsName}`,`buffer ${l.varName} is missing!`)}else if(l.varType=="storage-read"){let c=this._bufferDic.get(l.varName);if(c){let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`buffer ${l.varName} is missing!`)}else if(l.varType=="var")if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f||(f=_.res.blackTexture,this.setTexture(c,f)),f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else{let c=this.textures[l.varName];if(c||(c=_.res.whiteTexture,this.setTexture(l.varName,c)),c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}}}let n=I.device.createBindGroup({layout:this.bindGroupLayouts[e],entries:i});this.bindGroups[e]=n}}createPipeline(e,t,a){let r=e,i=this.shaderState,n=[];for(const c of t.renderTargetTextures)n.push({format:c.format});for(let c=0;c<n.length;c++){const f=n[c];i.writeMasks&&i.writeMasks.length>0&&(f.writeMask=i.writeMasks[c])}if(t.outColor!=-1){let c=n[t.outColor];i.blendMode!=De.NONE?c.blend=Hc.getBlend(i.blendMode):delete c.blend}let o={label:this.vsName+"|"+this.fsName,layout:a,primitive:{topology:i.topology,cullMode:i.cullMode,frontFace:i.frontFace},vertex:void 0};this.vsEntryPoint!=""&&(o.vertex={module:this._vsShaderModule,entryPoint:this.vsEntryPoint,buffers:r.vertexBuffer.vertexBufferLayouts}),this.fsEntryPoint!=""&&(o.fragment={module:this._fsShaderModule,entryPoint:this.fsEntryPoint,targets:n}),i.multisample>0&&(o.multisample={count:i.multisample}),(t.zPreTexture||t.depthTexture)&&(i.blendMode!=De.NONE,_.setting.render.zPrePass&&t.zPreTexture&&i.useZ?o.depthStencil={depthWriteEnabled:!1,depthCompare:ft.less,format:t.zPreTexture.format}:o.depthStencil={depthWriteEnabled:i.depthWriteEnabled,depthCompare:i.depthCompare,format:t.depthTexture.format});let l=Jn.getSharePipeline(this.shaderVariant);l?this.pipeline=l:(this.pipeline=k.createPipeline(o),Jn.setSharePipeline(this.shaderVariant,this.pipeline))}createGroupLayouts(){this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroupLayouts=[Ln.getGlobalDataBindGroupLayout()];for(let a=1;a<e.groups.length;a++){let r=e.groups[a];if(r){let i=this.getGroupLayout(a,r);this._groupsShaderReflectionVarInfos[a]=r;let n=I.device.createBindGroupLayout({entries:i,label:`vs${this.vsName} fs${this.fsName} ${r.length}`});this.bindGroupLayouts[a]=n}else console.error("can't set empty group!",a)}let t=I.device.createPipelineLayout({bindGroupLayouts:this.bindGroupLayouts});return this._groupsShaderReflectionVarInfos[1]&&this.genGroups(1,this._groupsShaderReflectionVarInfos),this._groupsShaderReflectionVarInfos[2]&&this.genGroups(2,this._groupsShaderReflectionVarInfos),this._groupsShaderReflectionVarInfos[3]&&this.genGroups(3,this._groupsShaderReflectionVarInfos),t}preDefine(e){let t=e.hasAttribute(G.TEXCOORD_1),a=e.hasAttribute(G.joints0),r=e.hasAttribute(G.a_morphPositions_0),i=e.hasAttribute(G.TANGENT),n=e.hasAttribute(G.color),o=this.shaderState.acceptGI,l=this.shaderState.useLight;t&&(this.defineValue.USE_SECONDUV=!0),a&&r?this.defineValue.USE_METAHUMAN=!0:(this.defineValue.USE_SKELETON=a,this.defineValue.USE_MORPHTARGETS=r),"USE_TANGENT"in this.defineValue||(this.defineValue.USE_TANGENT=i),this.defineValue.USE_GI=o,this.defineValue.USE_SHADOWMAPING=this.shaderState.acceptShadow,this.defineValue.USE_LIGHT=l,this.defineValue.USE_VERTXCOLOR=n,_.setting.pick.mode=="pixel"&&(this.defineValue.USE_WORLDPOS=!0),_.setting.gi.enable?this.defineValue.USEGI=!0:this.defineValue.USEGI=!1,_.setting.render.debug&&(this.defineValue.USE_DEBUG=!0,this.defineValue.DEBUG_CLUSTER=!0),this.shaderState.useLight?this.defineValue.USE_LIGHT=!0:this.defineValue.USE_LIGHT=!1,_.setting.render.useLogDepth?(this.defineValue.USE_LOGDEPTH=!0,this.shaderState.useFragDepth=!0):this.defineValue.USE_LOGDEPTH=!1,this.shaderState.useFragDepth?this.defineValue.USE_OUTDEPTH=!0:this.defineValue.USE_OUTDEPTH=!1,this.defineValue.USE_PCF_SHADOW=_.setting.shadow.type=="PCF",this.defineValue.USE_HARD_SHADOW=_.setting.shadow.type=="HARD",this.defineValue.USE_SOFT_SHADOW=_.setting.shadow.type=="SOFT",this.defineValue.USE_CSM=sa.Cascades>1,this.defineValue.USE_IES_PROFILE=Ia.use}genReflection(){this.shaderVariant=Tt.genRenderShaderVariant(this);let e=Tt.poolGetReflection(this.shaderVariant);if(e)this.shaderReflection=e;else{let t=Da.parse(this._destVS,this.defineValue);t=Da.parse(t,this.defineValue),Tt.getShaderReflection2(t,this);let a=Da.parse(this._destFS,this.defineValue);a=Da.parse(a,this.defineValue),Tt.getShaderReflection2(a,this),Tt.final(this)}this.shaderState.splitTexture=this.shaderReflection.useSplit}destroy(e){for(const t in this.textures)if(Object.prototype.hasOwnProperty.call(this.textures,t)){const a=this.textures[t];if(ke.getInstance().detached(a,this),e&&!ke.getInstance().hasReference(a))a.destroy(e);else{a.destroy(!1);let r=ke.getInstance().getReference(a);if(r){let i=[];r.forEach((n,o)=>{"name"in n?i.push(n.name):i.push("NaN")})}}}this.bindGroups.length=0,this.shaderState=null,this.textures=null,this.pipeline=null,this.bindGroupLayouts=null,this._sourceVS=null,this._sourceFS=null,this._destVS=null,this._destFS=null,this._vsShaderModule=null,this._fsShaderModule=null,this.materialDataUniformBuffer.destroy(e),this.materialDataUniformBuffer=null}static destroyShader(e){Ha.renderShader.has(e)&&(Ha.renderShader.get(e).destroy(),Ha.renderShader.delete(e))}static getShader(e){return Ha.renderShader.get(e)}static createShader(e,t){let a=new qe(e,t);return Ha.renderShader.set(a.instanceID,a),a.instanceID}}class l0 extends qe{constructor(){super("sky_vs_frag_wgsl","SkyGBuffer_fs"),this.passType=fe.GI,this.setUniformVector3("eyesPos",new b),this.setUniformFloat("exposure",1),this.setUniformFloat("roughness",0);let e=this.shaderState;e.frontFace="ccw",e.cullMode=Lt.front,e.depthWriteEnabled=!1,e.depthCompare=ft.less}}class c0 extends qe{transparency;constructor(){super("gbuffer_vs","gbuffer_fs"),this.setShaderEntry("VertMain","FragMain"),this.passType=fe.GI,this.setUniformColor("baseColor",new J),this.setUniformColor("emissiveColor",new J),this.setUniformFloat("emissiveIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("alphaCutoff",1),this.blendMode=De.NONE,this.setTexture("normalMap",_.res.normalTexture)}}class f0 extends qe{constructor(){super("shadowCastMap_vert","directionShadowCastMap_frag"),this.passType=fe.SHADOW,this.setShaderEntry("main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",b.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class d0 extends qe{constructor(){super("castPointShadowMap_vert","shadowCastMap_frag"),this.passType=fe.POINT_SHADOW,this.setShaderEntry("main","main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",b.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class h0 extends qe{constructor(){super("ZPass_shader_vs","ZPass_shader_vs"),this.passType=fe.DEPTH,this.setShaderEntry("main"),this.useRz=!1;let e=this.shaderState;e.receiveEnv=!1}}class yi{static createGIPass(e,t){if(ia.hasMask(e.rendererMask,Ne.Sky)){if(!t.passShader.get(fe.GI)){let r=t.getSubShaders(fe.COLOR)[0],i=new l0;i.setTexture("baseMap",r.getTexture("baseMap")),i.cullMode=r.cullMode,i.frontFace=r.frontFace,t.addRenderPass(i,0),i.preCompile(e.geometry)}}else this.castGBufferPass(e,t)}static castGBufferPass(e,t){let a=t.getDefaultShaders();for(let r=0;r<a.length;r++){const i=a[r];let n=t.getSubShaders(fe.GI);if(!n||n.length==0||n.length<r){let o=new c0;o.setTexture("baseMap",i.getTexture("baseMap")),o.setTexture("normalMap",i.getTexture("normalMap")),o.setTexture("emissiveMap",i.getTexture("emissiveMap")),i.uniforms.baseColor&&o.setUniform("baseColor",i.getUniform("baseColor")),i.uniforms.envIntensity&&o.setUniform("envIntensity",i.getUniform("envIntensity")),i.uniforms.emissiveColor&&o.setUniform("emissiveColor",i.getUniform("emissiveColor")),i.uniforms.emissiveIntensity&&o.setUniform("emissiveIntensity",i.getUniform("emissiveIntensity")),i.uniforms.alphaCutoff&&o.setUniform("alphaCutoff",i.getUniform("alphaCutoff")),o.cullMode=i.cullMode,o.frontFace=i.frontFace,o.preCompile(e.geometry),t.addRenderPass(o)}}}static createShadowPass(e,t){let a=ia.hasMask(e.rendererMask,Ne.SkinnedMesh),r=e.geometry.hasAttribute(G.TANGENT),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=t.getSubShaders(fe.COLOR);for(let l=0;l<o.length;l++){const c=o[l];let f=t.getSubShaders(fe.SHADOW);if(!f||f.length<l+1){let h=new f0;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),c.cullMode=="none"?h.shaderState.cullMode="none":c.cullMode=="back"?h.shaderState.cullMode="front":c.cullMode=="front"&&(h.shaderState.cullMode="back"),h.preCompile(e.geometry),t.addRenderPass(h)}let d=t.getSubShaders(fe.POINT_SHADOW);if(!d||d.length<l+1){let h=new d0;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),h.setDefine("USE_ALPHACUT",1);for(let u=0;u<1;u++)r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),h.shaderState.cullMode="front",h.preCompile(e.geometry);t.addRenderPass(h)}}}static createDepthPass(e,t){let a=t.getSubShaders(fe.COLOR),r=e.geometry.hasAttribute("TANGENT"),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=ia.hasMask(e.rendererMask,Ne.SkinnedMesh);for(let l=0;l<a.length;l++){const c=a[l];let f=t.getSubShaders(fe.DEPTH);if(!f&&c.shaderState.useZ&&(!f||f.length<l)){let d=new h0;d.setTexture("baseMap",c.getTexture("baseMap")),r||d.setDefine("USE_TANGENT",r),o&&d.setDefine("USE_SKELETON",o),i&&d.setDefine("USE_MORPHTARGETS",i),n&&d.setDefine("USE_MORPHNORMALS",n),d.cullMode=c.cullMode,d.frontFace=c.frontFace,d.preCompile(e.geometry),t.addRenderPass(d)}}}static createReflectionPass(e,t){let a=t.getDefaultShaders();for(let o=0;o<a.length;o++){const l=a[o];let c=t.getSubShaders(fe.REFLECTION);if(!c||c.length==0||c.length<o){let f=new qe(l.vsName,l.fsName);f.vsEntryPoint=l.vsEntryPoint,f.fsEntryPoint=l.fsEntryPoint,f.passType=fe.REFLECTION;for(const d in l.shaderState){var r=l.shaderState[d];f.shaderState[d]=r}for(const d in l.textures){var i=l.getTexture(d);f.setTexture(d,i)}for(const d in l.uniforms){var n=l.getUniform(d);f.setUniform(d,n)}for(const d in l.defineValue){var n=l.defineValue[d];f.setDefine(d,n)}f.setDefine("USE_CASTREFLECTION",!0),f.preCompile(e.geometry),t.addRenderPass(f)}}}}class Cr{static _v1=new b;static _v2=new b;entities;box;subTrees=[];parent;level;static maxSplitLevel=6;static autoSplitLevel=3;index;uuid;constructor(e,t=0,a=null,r=0){this.parent=a,this.box=e.clone(),this.level=r,this.index=t,this.uuid=r+"_"+t,this.entities=new Map}tryInsertEntity(e){let t=e.renderer.object3D.bound;if(this.level==0||this.box.containsBox(t)){this.subTrees.length==0&&this.level<Cr.maxSplitLevel&&this.splitTree();let a;if(this.subTrees.length>0){for(let r of this.subTrees)if(r.tryInsertEntity(e)){a=!0;break}}return a||e.enterNode(this),!0}return!1}splitTree(){if(this.subTrees.length==0){const e=Cr._v1,t=this.box.extents.clone();let a=this.level+1,r=0;for(let i=0;i<2;i++)for(let n=0;n<2;n++)for(let o=0;o<2;o++){const l=new Ce;this.box.min.add(e.set(i,n,o).multiply(t),l.min),l.min.add(t,l.max),l.setFromMinMax(l.min,l.max);let c=new Cr(l,r++,this,a);this.subTrees.push(c)}}}__rayCastTempVector=new b;rayCasts(e,t){if(this.level==0||e.intersectBox(this.box,this.__rayCastTempVector)){this.entities.size>0&&t.push(...this.entities.values());for(let a of this.subTrees)a.rayCasts(e,t);return!0}return!1}frustumCasts(e,t){if(this.level==0||e.containsBox2(this.box)>0){if(this.entities.size>0)for(const a of this.entities.values())(this.level>Cr.autoSplitLevel||e.containsBox2(a.renderer.object3D.bound)>0)&&t.push(a);for(let a of this.subTrees)a.frustumCasts(e,t);return!0}return!1}getRenderNode(e,t){if(this.level==0||e.containsBox2(this.box)>0){if(this.entities.size>0)for(const a of this.entities.values())(this.level>Cr.autoSplitLevel||e.containsBox2(a.renderer.object3D.bound)>0)&&(a.renderer.renderOrder<3e3?t.opaqueList.push(a.renderer):a.renderer.renderOrder>=3e3&&t.transparentList.push(a.renderer));for(let a of this.subTrees)a.getRenderNode(e,t);return!0}return!1}boxCasts(e,t){if(e.intersectsBox(this.box)){this.entities.size>0&&t.push(...this.entities.values());for(let a of this.subTrees)a.boxCasts(e,t);return!0}return!1}clean(){for(let e of this.entities.values())e.leaveNode();return this.entities.clear(),this}}class u0{_pool=[];_worldPosition=new b;_viewPosition=new b;_zSortList=[];pop(){return this._pool.pop()||{}}recycle(){for(let e of this._zSortList)e.z=0,e.userData=null,e.obj3d=null,this._pool.push(e);this._zSortList.length=0}sort(e,t,a,r){this._zSortList=[];for(let i of t){let n=this.pop();n.userData=i,n.obj3d=a(i),n.z=this.worldToCameraDepth(n.obj3d,e),this._zSortList.push(n)}this._zSortList.sort((i,n)=>i.z-n.z>0?1:-1),r||=[];for(let i of this._zSortList)r.push(i.userData);return this.recycle(),r}worldToCameraDepth(e,t){t||=e.transform.view3D.camera;let a=0;return t&&(this._worldPosition.copyFrom(e.transform.worldPosition),t.worldToScreenPoint(this._worldPosition,this._viewPosition),a=this._viewPosition.z),a}}let b0=new u0;var Ci=(s=>(s[s.None=2]="None",s[s.StaticBatch=4]="StaticBatch",s[s.DynamicBatch=8]="DynamicBatch",s[s.Hiden=16]="Hiden",s))(Ci||{});class jn{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)!=0}}class g0{opaqueList=[];transparentList=[];sky;clean(){this.opaqueList.length=0,this.transparentList.length=0}}class p0{renderGroup;constructor(){this.renderGroup=new Map}collect_add(e){let t="",a="";t+=e.geometry.instanceID;for(let i=0;i<e.materials.length;i++){const n=e.materials[i];a+=n.shader.getDefaultColorShader().shaderVariant}let r=t+a;this.renderGroup.has(r)||this.renderGroup.set(r,{bundleMap:new Map,key:r,renderNodes:[]}),this.renderGroup.get(r).renderNodes.indexOf(e)==-1&&this.renderGroup.get(r).renderNodes.push(e)}}class m0{renderShaderUpdateList=new Map;renderNodeList=new Map;collect_add(e){let t=e.transform.view3D;t&&e.materials&&e.materials.forEach(a=>{let r=this.renderShaderUpdateList.get(t);r||(r=new Map,this.renderShaderUpdateList.set(t,r));let i=this.renderNodeList.get(t);i||(i=new Map,this.renderNodeList.set(t,i)),i.set(e.instanceID,e);let n=a.getAllPass();for(let o=0;o<n.length;o++){const l=n[o];let c=`${e.geometry.instanceID+l.instanceID}`,f=r.get(c);f||(f=new Map,r.set(c,f)),f.set(e.instanceID,e)}})}collect_remove(e){let t=e.transform.view3D;if(t&&e.materials){let a=this.renderShaderUpdateList.get(t);a&&e.materials.forEach(r=>{let i=r.getAllPass();for(let n=0;n<i.length;n++){const o=i[n];let l=`${e.geometry.instanceID+o.instanceID}`;a.delete(l)}})}}}class q{static _instance;_sceneLights;_sceneGIProbes;_op_RenderNodes;_tr_RenderNodes;_octreeRenderNodes;_reflections;_graphics;_op_renderGroup;_tr_renderGroup;_renderShaderCollect;state={giLightingChange:!0};sky;_collectInfo;rendererOctree;static get instance(){return this._instance||(this._instance=new q),this._instance}constructor(){this._sceneLights=new Map,this._sceneGIProbes=new Map,this._op_RenderNodes=new Map,this._tr_RenderNodes=new Map,this._reflections=new Map,this._graphics=[],this._op_renderGroup=new Map,this._tr_renderGroup=new Map,this._collectInfo=new g0,this._renderShaderCollect=new m0,this._octreeRenderNodes=new Map}getPashList(e,t){if(t.renderOrder<3e3)return this._op_RenderNodes.get(e);if(t.renderOrder>=3e3)return this._tr_RenderNodes.get(e)}sortRenderNode(e,t){for(let a=e.length-1;a>0;a--)if(e[a].renderOrder<t.renderOrder){e.push(t);return}e.push(t)}addRenderNode(e,t){if(!e)return;let a=t.renderOrder>=3e3;if(t.hasMask(Ne.Sky))this.sky=t;else if(t.hasMask(Ne.Reflection)){this.removeRenderNode(e,t);let r=this._reflections.get(e);r||(r=[],this._reflections.set(e,r),r.push(t)),r.includes(t)||r.push(t)}else if(t.hasMask(Ne.Graphic3D))this._graphics.indexOf(t)==-1&&this._graphics.push(t);else if(jn.hasMask(t.renderLayer,Ci.None)){this.removeRenderNode(e,t);let r=a?this._tr_RenderNodes:this._op_RenderNodes;r.has(e)||r.set(e,[]),r.get(e).push(t),_.setting.occlusionQuery.octree&&t.attachSceneOctree(this.getOctree(e));let i=this.getPashList(e,t);i.indexOf(t)==-1&&this.sortRenderNode(i,t)}else{this.removeRenderNode(e,t);let r=a?this._tr_renderGroup:this._op_renderGroup;r.has(e)||r.set(e,new p0),r.get(e).collect_add(t)}t.object3D.renderNode=t,this._renderShaderCollect.collect_add(t)}getOctree(e){let t,a=_.setting.occlusionQuery.octree;if(a&&(t=this._octreeRenderNodes.get(e),!t)){let r=new b(a.x,a.y,a.z),i=new b(a.width,a.height,a.depth),n=new Ce(r,i);t=new Cr(n),this._octreeRenderNodes.set(e,t)}return t}removeRenderNode(e,t){if(t.detachSceneOctree(),t.hasMask(Ne.Sky))this.sky=null;else if(t.hasMask(Ne.Reflection)){let a=this._reflections.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}else if(jn.hasMask(t.renderLayer,Ci.None)){let a=this.getPashList(e,t);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}this._renderShaderCollect.collect_remove(t)}addLight(e,t){if(!this._sceneLights.has(e))this._sceneLights.set(e,[t]);else{let a=this._sceneLights.get(e);if(a.length>=_.setting.light.maxLight){console.warn("Alreay meet maxmium light number:",_.setting.light.maxLight);return}a.indexOf(t)!=-1||a.push(t)}}removeLight(e,t){if(this._sceneLights.has(e)){let a=this._sceneLights.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getLights(e){let t=this._sceneLights.get(e);return t||[]}addGIProbe(e,t){this._sceneGIProbes.has(e)?this._sceneGIProbes.get(e).push(t):this._sceneGIProbes.set(e,[t])}removeGIProbe(e,t){if(this._sceneGIProbes.has(e)){let a=this._sceneGIProbes.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getProbes(e){let t=this._sceneGIProbes.get(e);return t||[]}getReflections(e){let t=this._reflections.get(e);return t||[]}autoSortRenderNodes(e){let t=this._tr_RenderNodes.get(e);if(!t)return;let a=!1;for(const r of t)if(r.isRenderOrderChange||r.needSortOnCameraZ){a=!0;break}if(a){for(const r of t){let i=r.renderOrder;if(r.needSortOnCameraZ){let n=b0.worldToCameraDepth(r.object3D);n=1-Math.max(0,Math.min(1,n)),i+=n}r.__renderOrder=i,r.isRenderOrderChange=!1}t.sort((r,i)=>r.__renderOrder>i.__renderOrder?1:-1)}return this}getRenderNodes(e,t){if(this.autoSortRenderNodes(e),this._collectInfo.clean(),this._collectInfo.sky=this.sky,_.setting.occlusionQuery.octree)this.rendererOctree=this.getOctree(e),this.rendererOctree.getRenderNode(t.frustum,this._collectInfo);else{let a=this._op_RenderNodes.get(e);a&&(this._collectInfo.opaqueList=a.concat());let r=this._tr_RenderNodes.get(e);r&&(this._collectInfo.transparentList=r.concat())}return this._collectInfo}getOpRenderGroup(e){return this._op_renderGroup.get(e)}getTrRenderGroup(e){return this._tr_renderGroup.get(e)}getGraphicList(){return this._graphics}getRenderShaderCollect(e){return this._renderShaderCollect.renderShaderUpdateList.get(e)}}class A0{renderer;owner;uuid;constructor(e){this.renderer=e,this.uuid=e.object3D.instanceID}leaveNode(){this.owner&&(this.owner.entities.delete(this.uuid),this.owner=null)}enterNode(e){this.owner&&this.leaveNode(),this.owner=e,e.entities.set(this.uuid,this)}update(e){return this.owner?.tryInsertEntity(this)||(this.leaveNode(),e.tryInsertEntity(this)),this.owner}}var V2=Object.defineProperty,O2=Object.getOwnPropertyDescriptor,Zn=(s,e,t,a)=>{for(var r=O2(e,t),i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(e,t,r)||r);return r&&V2(e,t,r),r};class Ba extends et{instanceCount=0;lodLevel=0;alwaysRender=!1;instanceID;drawType=0;_geometry;_materials=[];_castShadow=!0;_castReflection=!0;_castGI=!1;_rendererMask=Ne.Default;_inRenderer=!1;_readyPipeline=!1;_combineShaderRefection;_ignoreEnvMap;_ignorePrefilterMap;__renderOrder=0;_renderOrder=0;_passInit=new Map;isRenderOrderChange;needSortOnCameraZ;isRecievePostEffectUI;_octreeBinder;_renderLayer=Ci.None;_computes;init(e){this.renderOrder=0,this.rendererMask=Ne.Default,this.instanceID=yn().toString(),this._computes=[]}attachSceneOctree(e){this._octreeBinder={octree:e,entity:new A0(this)},this.transform.eventDispatcher.addEventListener(Zt.LOCAL_ONCHANGE,this.updateOctreeEntity,this)}detachSceneOctree(){this._octreeBinder&&(this._octreeBinder.entity?.leaveNode(),this.transform.eventDispatcher.removeEventListener(Zt.LOCAL_ONCHANGE,this.updateOctreeEntity,this),this._octreeBinder=null)}updateOctreeEntity(e){this._octreeBinder?.entity?.update(this._octreeBinder.octree)}copyComponent(e){return super.copyComponent(e),this.geometry=e._geometry,this.materials=e._materials.slice(),this.drawType=e.drawType,this.alwaysRender=e.alwaysRender,this.needSortOnCameraZ=e.needSortOnCameraZ,this.isRenderOrderChange=e.isRenderOrderChange,this.castShadow=e.castShadow,this.castGI=e.castGI,this.rendererMask=e.rendererMask,this.isRecievePostEffectUI=e.isRecievePostEffectUI,this}get renderLayer(){return this._renderLayer}set renderLayer(e){this._renderLayer=e}get geometry(){return this._geometry}set geometry(e){this._geometry!=e&&(this._readyPipeline=!1,this._geometry&&ke.getInstance().detached(this._geometry,this),e&&ke.getInstance().attached(e,this)),this._geometry=e}addMask(e){this._rendererMask=ia.addMask(this.rendererMask,e)}removeMask(e){this._rendererMask=ia.removeMask(this.rendererMask,e)}hasMask(e){return ia.hasMask(this.rendererMask,e)}get rendererMask(){return this._rendererMask}set rendererMask(e){this._rendererMask=e}get renderOrder(){return this._renderOrder}set renderOrder(e){e!=this._renderOrder&&(this.isRenderOrderChange=!0,this.__renderOrder=e),this._renderOrder=e}get materials(){return this._materials}set materials(e){this._readyPipeline=!1;for(let a=0;a<this._materials.length;a++){let r=this._materials[a];ke.getInstance().detached(r,this),r.shader&&r.shader.computes&&this.removeComputes(r.shader.computes)}for(let a=0;a<e.length;a++){let r=e[a];ke.getInstance().attached(r,this),r.shader&&r.shader.computes&&this.addComputes(r.shader.computes)}this._materials=e;let t=0;for(let a=0;a<e.length;a++){const n=e[a].getPass(fe.COLOR)[0];n.shaderState.transparent&&(t=t>n.renderOrder?t:n.renderOrder)}this.renderOrder=t,this._readyPipeline||this.initPipeline()}addComputes(e){this._computes.push(...e)}removeComputes(e){for(const t of e){let a=this._computes.indexOf(t);a!=-1&&this._computes.splice(a,1)}}addRendererMask(e){this._rendererMask=ia.addMask(this._rendererMask,e)}removeRendererMask(e){this._rendererMask=ia.removeMask(this._rendererMask,e)}onEnable(){this._readyPipeline||this.initPipeline(),q.instance.addRenderNode(this.transform.scene3D,this),this.updateOctreeEntity()}onDisable(){this._enable=!1,q.instance.removeRenderNode(this.transform.scene3D,this),super.onDisable?.()}selfCloneMaterials(e){let t=[];for(let a=0,r=this.materials.length;a<r;a++){const i=this.materials[a].clone();t.push(i)}return this.materials=t,this._readyPipeline=!1,this.initPipeline(),this}initPipeline(){if(this._geometry&&this._materials.length>0){for(let t=0;t<this._materials.length;t++){let r=this._materials[t].getPass(fe.COLOR);for(let i=0;i<r.length;i++){const n=r[i];n.shaderReflection||n.preCompile(this._geometry),this._geometry.generate(n.shaderReflection)}this.object3D.bound=this._geometry.bounds.clone()}this._readyPipeline=!0;let e=0;for(let t=0;t<this.materials.length;t++){const i=this.materials[t].getPass(fe.COLOR)[0];i.renderOrder>=3e3?e=e>i.renderOrder?e:i.renderOrder:e=Math.max(e-3e3,0),this.castNeedPass()}this.renderOrder=e,this.enable&&this.transform&&this.transform.scene3D&&q.instance.addRenderNode(this.transform.scene3D,this)}}castNeedPass(){if(this.castGI)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];yi.createGIPass(this,a.shader)}for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castShadow&&yi.createShadowPass(this,a.shader)}if(this.castReflection)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castReflection&&yi.createReflectionPass(this,a.shader)}if(!ia.hasMask(this.rendererMask,Ne.IgnoreDepthPass)&&_.setting.render.zPrePass)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];yi.createDepthPass(this,a.shader)}else for(let t=0;t<this.materials.length;t++)this.materials[t].shader.removeShaderByIndex(fe.DEPTH,0)}get castShadow(){return this._castShadow}set castShadow(e){this._castShadow=e}get castGI(){return this._castGI}set castGI(e){this._castGI=e}get castReflection(){return this._castReflection}set castReflection(e){this._castReflection=e}renderPass(e,t,a){if(!this._geometry)return;let r=this,i=r.transform._worldMatrix;const n=Math.max(r.materials.length,r._geometry.subGeometries.length);for(let o=0;o<n;o++){const l=o>=r.materials.length?r.materials[0]:r.materials[o];if(!l||!l.enable)continue;let c=l.getPass(t);if(!(!c||c.length==0)){k.bindGeometryBuffer(a.encoder,r._geometry),dt.viewCount_vertex(e,fe[t],r._geometry.vertexCount);for(let f=0;f<c.length;f++){if(!c||c.length==0)continue;const h=c[f];if(h.pipeline){h.shaderState.splitTexture&&(a.endRenderPass(),Mt.WriteSplitColorTexture(r.instanceID),a.beginOpaqueRenderPass(),k.bindCamera(a.encoder,e.camera),k.bindGeometryBuffer(a.encoder,r._geometry)),k.bindPipeline(a.encoder,h)&&dt.viewCount_pipeline(e,fe[t]);let p=(o>=r._geometry.subGeometries.length?r._geometry.subGeometries[0]:r._geometry.subGeometries[o]).lodLevels[r.lodLevel];r.instanceCount>0?(dt.viewCount_instance(e,fe[t],r.instanceCount),dt.viewCount_indices(e,fe[t],p.indexCount),dt.viewCount_tri(e,fe[t],p.indexCount/3*r.instanceCount),k.drawIndexed(a.encoder,p.indexCount,r.instanceCount,p.indexStart,0,0)):(dt.viewCount_indices(e,fe[t],p.indexCount),dt.viewCount_tri(e,fe[t],p.indexCount/3),k.drawIndexed(a.encoder,p.indexCount,1,p.indexStart,0,i.index)),dt.viewCount_draw(e,fe[t])}}}}}renderPass2(e,t,a,r,i,n=!1){if(!this.enable||!this._geometry)return;let o=this,l=o.object3D.transform._worldMatrix;for(let c=0;c<this.materials.length;c++){const f=this.materials[c];if(!f.castShadow&&t==fe.SHADOW)continue;let d=f.getPass(t);if(!d||d.length==0)return;if(this.drawType==2)for(let h of d)h.pipeline&&(k.bindPipeline(i,h),k.draw(i,6,1,0,l.index));else{k.bindGeometryBuffer(i,o._geometry);for(let h of d)if(h.pipeline){k.bindPipeline(i,h);let p=o._geometry.subGeometries[c].lodLevels[o.lodLevel];k.drawIndexed(i,p.indexCount,1,p.indexStart,0,l.index)}}}}recordRenderPass2(e,t,a,r,i,n=!1){if(!this.enable)return;let o=this;for(let l=0;l<this.materials.length;l++){let f=this.materials[l].getPass(t);if(!f||f.length==0)return;let d=o.object3D.transform._worldMatrix;for(let h=0;h<f.length;h++){const u=f[h];k.bindPipeline(i,u);let D=o._geometry.subGeometries[l].lodLevels[o.lodLevel];k.drawIndexed(i,D.indexCount,1,D.indexStart,0,d.index)}}}noticeShaderChange(){this.enable&&(this.onEnable(),this._passInit.forEach((e,t)=>{this._passInit.set(t,!1)}))}preInit(e){return this._passInit.get(e)}nodeUpdate(e,t,a,r){let i=this,n=e.scene.envMap;for(let o=0;o<i.materials.length;o++){let c=i.materials[o].getPass(t);if(c)for(let f=0;f<c.length;f++){const h=c[f];if(h.shaderState.splitTexture){let B=Mt.CreateSplitTexture(i.instanceID);h.setTexture("splitTexture_Map",B)}!i._ignoreEnvMap&&h.envMap!=n&&h.setTexture("envMap",n),h.prefilterMap||h.setTexture("prefilterMap",n);let u=xe.getReflectionEntries(e.scene);if(!h.reflectionMap&&u&&u.reflectionMap&&(h.setTexture("reflectionMap",u.reflectionMap),h.setStorageBuffer("reflectionBuffer",u.storageGPUBuffer)),h.pipeline){h.apply(i._geometry,a,()=>i.noticeShaderChange());continue}let m=_.res.getTexture("BRDFLUT");h.setTexture("brdflutMap",m);let g=_.getRenderJob(e).shadowMapPassRenderer;g&&g.depth2DArrayTexture&&h.setTexture("shadowMap",_.getRenderJob(e).shadowMapPassRenderer.depth2DArrayTexture);let p=_.getRenderJob(e).pointLightShadowRenderer;p&&p.cubeArrayTexture&&h.setTexture("pointShadowMap",p.cubeArrayTexture);let D=Ia.iesTexture;D&&h.setTexture("iesTextureArrayMap",D),a.irradianceBuffer&&a.irradianceBuffer.length>0&&(h.setTexture("irradianceMap",a.irradianceBuffer[0]),h.setTexture("irradianceDepthMap",a.irradianceBuffer[1]));let A=xe.getLightEntries(e.scene);A&&(h.setStorageBuffer("lightBuffer",A.storageGPUBuffer),A.irradianceVolume&&h.setUniformBuffer("irradianceData",A.irradianceVolume.irradianceVolumeBuffer)),r&&(h.setStorageBuffer("clustersUniform",r.clustersUniformBuffer),h.setStorageBuffer("lightAssignBuffer",r.lightAssignBuffer),h.setStorageBuffer("assignTable",r.assignTableBuffer),h.setStorageBuffer("clusterBuffer",r.clusterBuffer)),h.apply(i._geometry,a),this._passInit.set(t,!0)}}}beforeDestroy(e){this._geometry&&(ke.getInstance().detached(this._geometry,this),ke.getInstance().hasReference(this._geometry)||this._geometry.destroy(e));for(let t=0;t<this._materials.length;t++){const a=this._materials[t];a&&(ke.getInstance().detached(a,this),ke.getInstance().hasReference(a)||a.destroy(e))}this._computes&&(this._computes.length=0),this.detachSceneOctree(),super.beforeDestroy(e)}destroy(e){super.destroy(e),this._geometry=void 0,this._materials.length=0,this._computes=null,this._passInit&&(this._passInit.clear(),this._passInit=null),this._combineShaderRefection=void 0}}Zn([Kr],Ba.prototype,"materials"),Zn([Kr],Ba.prototype,"castShadow"),Zn([Kr],Ba.prototype,"castGI");class vt{instanceID;name;enable=!0;_defaultSubShader;_shader;_isDestroyed=!1;constructor(){this.instanceID=zt()}set shader(e){this._shader=e,this._defaultSubShader=e.getDefaultShaders()[0]}get shader(){return this._shader}get doubleSide(){return this._defaultSubShader.doubleSide}set doubleSide(e){this._defaultSubShader.doubleSide=e}get castShadow(){return this._defaultSubShader.shaderState.castShadow}set castShadow(e){let t=this._defaultSubShader.shaderState;e!=t.castShadow&&(t.castShadow=e)}get acceptShadow(){return this._defaultSubShader.shaderState.acceptShadow}set acceptShadow(e){let t=this._defaultSubShader.shaderState;t.acceptShadow!=e&&(t.acceptShadow=e,this._defaultSubShader.noticeShaderChange(),this._defaultSubShader.noticeValueChange())}get castReflection(){return this._defaultSubShader.shaderState.castReflection}set castReflection(e){this._defaultSubShader.shaderState.castReflection=e}get blendMode(){return this._defaultSubShader.blendMode}set blendMode(e){this._defaultSubShader.blendMode=e}get depthCompare(){return this._defaultSubShader.depthCompare}set depthCompare(e){this._defaultSubShader.depthCompare=e;for(let t of this._shader.passShader.values())for(let a of t)a.depthCompare=e}get transparent(){return this._defaultSubShader.shaderState.transparent}set transparent(e){this._defaultSubShader.shaderState.transparent=e,e&&(this._defaultSubShader.renderOrder=3e3)}get cullMode(){return this._defaultSubShader.cullMode}set cullMode(e){if(this._defaultSubShader.cullMode!=e){for(let t of this._shader.passShader.values())for(let a of t)a.cullMode=e;this._defaultSubShader.cullMode=e}}get depthWriteEnabled(){return this._defaultSubShader.depthWriteEnabled}set depthWriteEnabled(e){this._defaultSubShader.depthWriteEnabled=e}set useBillboard(e){this._defaultSubShader.setDefine("USE_BILLBOARD",e)}get topology(){return this._defaultSubShader.topology}set topology(e){this._defaultSubShader.topology=e}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}getPass(e){return this._shader.getSubShaders(e)}getAllPass(){return this._shader.getSubShaders(fe.COLOR)}clone(){let e=new vt;return e.shader=this.shader.clone(),e}destroy(e){this._isDestroyed||(this.name=null,this.instanceID=null,this._shader&&(this._shader.destroy(e),this._shader=null),this._defaultSubShader=null,this._isDestroyed=!0)}setDefine(e,t){this.shader.setDefine(e,t)}setTexture(e,t){this._shader.setTexture(e,t)}setStorageBuffer(e,t){this._shader.setStorageBuffer(e,t)}setUniformBuffer(e,t){this._shader.setStorageBuffer(e,t)}setUniformFloat(e,t){this._shader.setUniformFloat(e,t)}setUniformVector2(e,t){this._shader.setUniformVector2(e,t)}setUniformVector3(e,t){this._shader.setUniformVector3(e,t)}setUniformVector4(e,t){this._shader.setUniformVector4(e,t)}setUniformColor(e,t){this._shader.setUniformColor(e,t)}getUniformFloat(e){return this._shader.getUniform(e).data}getUniformV2(e){return this._shader.getUniformVector2(e)}getUniformV3(e){return this._shader.getUniformVector3(e)}getUniformV4(e){return this._shader.getUniformVector4(e)}getUniformColor(e){return this._shader.getUniformColor(e)}getTexture(e){return this._shader.getTexture(e)}getStorageBuffer(e){return this._shader.getStorageBuffer(e)}getStructStorageBuffer(e){return this._shader.getStructStorageBuffer(e)}getUniformBuffer(e){return this._shader.getUniformBuffer(e)}applyUniform(){this._shader.applyUniform()}}const D0=`
|
|
5745
|
+
`}return a}return a}}function la(s){switch(s){case"int":return"i32";case"int[]":return"array<i32>";case"uint":return"u32";case"uint[]":return"array<u32>";case"float":return"f32";case"float[]":return"array<f32>";case"vec2":return"vec2<f32>";case"vec3":return"vec3<f32>";case"vec4":return"vec4<f32>";case"vec2[]":return"array<vec2<f32>>";case"vec3[]":return"array<vec3<f32>>";case"vec4[]":return"array<vec4<f32>>";case"ivec2":return"vec2<i32>";case"ivec3":return"vec3<i32>";case"ivec4":return"vec4<i32>";case"ivec2[]":return"array<vec2<i32>>";case"ivec3[]":return"array<vec3<i32>>";case"ivec4[]":return"array<vec4<i32>>";case"mat2":return"mat2x2<f32>";case"mat2x2":return"mat2x2<f32>";case"mat2x3":return"mat2x3<f32>";case"mat2x4":return"mat2x4<f32>";case"mat2[]":return"array<mat2x2<f32>>";case"mat2x2[]":return"array<mat2x2<f32>>";case"mat2x3[]":return"array<mat2x3<f32>>";case"mat2x4[]":return"array<mat2x4<f32>>";case"mat3":return"mat3x3<f32>";case"mat3x2":return"mat3x2<f32>";case"mat3x3":return"mat3x3<f32>";case"mat3x4":return"mat3x4<f32>";case"mat3[]":return"array<mat3x3<f32>>";case"mat3x2[]":return"array<mat3x2<f32>>";case"mat3x3[]":return"array<mat3x3<f32>>";case"mat3x4[]":return"array<mat3x4<f32>>";case"mat4":return"mat4x4<f32>";case"mat4x2":return"mat4x2<f32>";case"mat4x3":return"mat4x3<f32>";case"mat4x4":return"mat4x4<f32>";case"mat4[]":return"array<mat4x4<f32>>";case"mat4x2[]":return"array<mat4x2<f32>>";case"mat4x3[]":return"array<mat4x3<f32>>";case"mat4x4[]":return"array<mat4x4<f32>>";case"texture2D":return"texture_2d<f32>"}return s}class r0{_lexer;_rootNode;constructor(e){this._lexer=e,this._rootNode=new Ge,this.parse()}get lexer(){return this._lexer}parse(){for(;this.peekToken(0).Type!==x.EOF;){if(this.peekToken(0).Type==x.SEMICOLON){this.skipToken(1);continue}let e=this.parseStatement();e!==null&&this._rootNode.addNode(e)}}parseStatement(){let e=this.peekToken();if(e.Type==x.LAYOUT&&this.peekToken(1).Type==x.LEFTSAMLL)return cs.parse(this._lexer);if(e.Type==x.STRUCT)return this.skipToken(1),tr.parse(this._lexer);if((e.isBuiltinType()||e.Type==x.VOID)&&this.peekToken(1).Type==x.IDENT&&this.peekToken(2).Type==x.LEFTSAMLL)return ln.parse(this._lexer);if(e.Type==x.CONST&&this.peekToken(1).isDataType())return rt.parse(this._lexer);if(e.isDataType()&&this.peekToken(1).Type==x.IDENT)return rt.parse(this._lexer);if(e.Type==x.OUT&&this.peekToken(1).isDataType()&&this.peekToken(2).Type==x.IDENT)return rt.parse(this._lexer);if(e.Type==x.PRECISION)return dn.parse(this._lexer);throw"Error parsing statement: Unexpected character"}skipToken(e){this._lexer.skipToken(e)}peekToken(e=0){return this._lexer.peekToken(e)}getNextToken(){return this._lexer.GetNextToken()}get ASTRoot(){return this._rootNode}}class i0{static VertexShader="VertexShader";static FragmentShader="FragmentShader";static convertGLSL(e){var t=new $c(e),a=new qc(t),r=new r0(a),i=new e0(r);return i.generateWGSL()}}class zn{setID=0;bindingID=0;name="";type=""}class Wn{name="";type="";locationID=0;builtinName="";isBuiltinAttribute(){return this.builtinName!=""}}class s0{uniformInfo=[];inputAttribute=[];outputAttribute=[];sourceCode=""}var _a=(s=>(s[s.vertex=0]="vertex",s[s.fragment=1]="fragment",s[s.computer=2]="computer",s))(_a||{});class n0{blendMode=De.NONE;depthCompare=nt.less_equal;depthWriteEnabled=!0;frontFace="ccw";cullMode=Lt.back;topology=Ss.triangle_list;depthBias=10;useLight=!1;useProbe=!1;acceptGI=!1;acceptShadow=!1;castShadow=!1;castReflection=!0;receiveEnv=!1;renderLayer=1e3;renderOrder=2e3;unclippedDepth=!1;transparent=!1;multisample=0;label;useZ=!0;splitTexture=!1;alphaCutoff;useFragDepth=!1;writeMasks=[];setFromMapValues(e){e.has("blendMode")&&(this.blendMode=this.convertBlendMode(e.get("blendMode"))),e.has("depthCompare")&&(this.depthCompare=e.get("depthCompare")),e.has("depthWriteEnabled")&&(this.depthWriteEnabled=e.get("depthWriteEnabled")),e.has("frontFace")&&(this.frontFace=e.get("frontFace")),e.has("cullMode")&&(this.cullMode=e.get("cullMode")),e.has("topology")&&(this.topology=e.get("topology")),e.has("depthBias")&&(this.depthBias=e.get("depthBias")),e.has("useLight")&&(this.useLight=e.get("useLight")),e.has("useProbe")&&(this.useProbe=e.get("useProbe")),e.has("acceptGI")&&(this.acceptGI=e.get("acceptGI")),e.has("acceptShadow")&&(this.acceptShadow=e.get("acceptShadow")),e.has("castShadow")&&(this.castShadow=e.get("castShadow")),e.has("receiveEnv")&&(this.receiveEnv=e.get("receiveEnv")),e.has("renderLayer")&&(this.renderLayer=e.get("renderLayer")),e.has("renderOrder")&&(this.renderOrder=e.get("renderOrder")),e.has("unclippedDepth")&&(this.unclippedDepth=e.get("unclippedDepth")),e.has("multisample")&&(this.multisample=e.get("multisample")),e.has("label")&&(this.label=e.get("label")),e.has("useZ")&&(this.useZ=e.get("useZ"))}convertBlendMode(e){switch(e){case"ABOVE":return De.ABOVE;case"ALPHA":return De.ALPHA;case"NORMAL":return De.NORMAL;case"ADD":return De.ADD;case"BELOW":return De.BELOW;case"ERASE":return De.ERASE;case"MUL":return De.MUL;case"SCREEN":return De.SCREEN;case"DIVD":return De.DIVD;case"SOFT_ADD":return De.SOFT_ADD}return De.NONE}}class o0 extends Ya{uniformNodes=[];_onChange=!0;constructor(){super(),this.bufferType=Aa.MaterialDataUniformGPUBuffer}initDataUniform(e){this.uniformNodes=e;let t=0;for(const a in e){const r=e[a];r||console.error(a,"is empty"),t+=r.size*4}t=Math.floor(t/256+1)*256,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,t/4,null,"MaterialDataUniformGPUBuffer");for(const a in e){const r=e[a];r||console.error(a,"is empty");let i=this.memory.allocation_node(r.size*4);r.memoryInfo=i,r.bindOnChange=()=>this.onChange()}}onChange(){this._onChange=!0}apply(){if(this.uniformNodes.length!=0&&this._onChange){for(const e in this.uniformNodes)this.uniformNodes[e].update();super.apply(),this._onChange=!1}}}class Ha{static renderShaderModulePool;static renderShader;static init(){this.renderShaderModulePool=new Map,this.renderShader=new Map}}class ke{reference;static _ins;static getInstance(){return this._ins||=new ke,this._ins}attached(e,t){this.reference||=new Map;let a=this.reference.get(e);a||=new Map,a.set(t,e),this.reference.set(e,a)}detached(e,t){if(!this.reference)return;let a=this.reference.get(e);a&&(a.delete(t),a.size===0&&this.reference.delete(e))}hasReference(e){let t=this.reference.get(e);return t?t.size>0:!1}getReferenceCount(e){let t=this.reference.get(e);return t?t.size:0}getReference(e){let t=this.reference.get(e);return t||null}}class Jn{static pipelineMap=new Map;static getSharePipeline(e){let t=this.pipelineMap.get(e);return t||null}static setSharePipeline(e,t){this.pipelineMap.set(e,t)}}class qe extends Cn{passType=fe.COLOR;useRz=!1;vsName;fsName;shaderState;textures;pipeline;bindGroupLayouts;envMap;prefilterMap;reflectionMap;_sourceVS;_sourceFS;_destVS;_destFS;_vsShaderModule;_fsShaderModule;_textureGroup=-1;_textureChange=!1;_groupsShaderReflectionVarInfos;outBufferMask;constructor(e,t){super(),this.vsName=e.toLowerCase(),this.fsName=t.toLowerCase(),this.vsName in Y||console.error("Shader Not Register, Please Register Shader!",this.vsName),this.fsName in Y||console.error("Shader Not Register, Please Register Shader!",this.fsName),Y[this.vsName]&&(this._sourceVS=Y[this.vsName]),Y[this.fsName]&&(this._sourceFS=Y[this.fsName]),this.textures={},this.bindGroups=[],this.shaderState=new n0,this.materialDataUniformBuffer=new o0,this.materialDataUniformBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,this._bufferDic.set("global",this.materialDataUniformBuffer),this._bufferDic.set("materialUniform",this.materialDataUniformBuffer)}get renderOrder(){return this.shaderState.renderOrder}set renderOrder(e){this.shaderState.renderOrder!=e&&(this._valueChange=!0),this.shaderState.renderOrder=e}get doubleSide(){return this.shaderState.cullMode==Lt.none}set doubleSide(e){let t=e?Lt.none:this.cullMode;this.shaderState.cullMode!=t&&(this._valueChange=!0),this.shaderState.cullMode=t}get depthWriteEnabled(){return this.shaderState.depthWriteEnabled}set depthWriteEnabled(e){this.shaderState.depthWriteEnabled!=e&&(this._valueChange=!0),this.shaderState.depthWriteEnabled=e}get cullMode(){return this.shaderState.cullMode}set cullMode(e){this.shaderState.cullMode!=e&&(this._valueChange=!0),this.shaderState.cullMode=e}get frontFace(){return this.shaderState.frontFace}set frontFace(e){this.shaderState.frontFace!=e&&(this._valueChange=!0),this.shaderState.frontFace=e}get depthBias(){return this.shaderState.depthBias}set depthBias(e){this.shaderState.depthBias!=e&&(this._valueChange=!0),this.shaderState.depthBias=e}get topology(){return this.shaderState.topology}set topology(e){this.shaderState.topology!=e&&(this._valueChange=!0),this.shaderState.topology=e}get blendMode(){return this.shaderState.blendMode}set blendMode(e){this.shaderState.blendMode!=e&&(this._valueChange=!0,e!=De.NORMAL&&e!=De.NONE&&(this.renderOrder=3e3)),this.shaderState.blendMode=e}get depthCompare(){return this.shaderState.depthCompare}set depthCompare(e){this.shaderState.depthCompare!=e&&(this._valueChange=!0),this.shaderState.depthCompare=e}setShaderEntry(e="",t=""){this.vsEntryPoint=e,this.fsEntryPoint=t}setUniformArray(e,t){super.setUniformArray(e,t),this.materialDataUniformBuffer.onChange()}setUniform(e,t){super.setUniform(e,t),this.materialDataUniformBuffer.onChange()}setTexture(e,t){t&&this.textures[e]!=t&&(this.textures[e]&&this.textures[e].unBindStateChange(this),this._textureChange=!0,this.textures[e]=t,e=="envMap"?this.envMap=t:e=="prefilterMap"?this.prefilterMap=t:e=="reflectionMap"&&(this.reflectionMap=t),t.bindStateChange(()=>{this._textureChange=!0},this))}get baseColor(){return this.getUniform("baseColor")}set baseColor(e){this.setUniform("baseColor",e)}getTexture(e){return this.textures[e]}genRenderPipeline(e,t){let a=this.createGroupLayouts();this.createPipeline(e,t,a)}reBuild(e,t){this.compileShader(_a.vertex,this._destVS,t),this.compileShader(_a.fragment,this._destFS,t),this.genRenderPipeline(e,t)}apply(e,t,a){this.materialDataUniformBuffer.apply(),this._textureChange&&this._textureGroup!=-1&&(this._textureChange=!1,this.genGroups(this._textureGroup,this.shaderReflection.groups,!0)),this._valueChange&&(this._shaderChange&&(this.preCompile(e),this._shaderChange=!1),this.shaderVariant=Tt.genRenderShaderVariant(this),this.reBuild(e,t),this._valueChange=!1,a&&a())}preCompile(e){this.preDefine(e),this.preCompileShader(_a.vertex,this._sourceVS.concat()),this.preCompileShader(_a.fragment,this._sourceFS.concat()),this.genReflection()}applyPostDefine(e,t){return t.renderTargetTextures.length>1?(this.defineValue.USE_WORLDPOS=!0,this.defineValue.USEGBUFFER=!0):(this.defineValue.USE_WORLDPOS=!1,this.defineValue.USEGBUFFER=!1),_.setting.render.useCompressGBuffer?this.defineValue.USE_COMPRESSGBUFFER=!0:this.defineValue.USE_COMPRESSGBUFFER=!1,Da.parse(e,this.defineValue)}setBindGroup(e,t){this.bindGroups[e]=t}checkBuffer(e,t){}preCompileShader(e,t,a){let r=t;if(r.indexOf("version ")!=-1){var i=i0.convertGLSL(r);r=i.sourceCode}for(const n in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,n)){const o=this.constValues[n];r=r.replaceAll(`&${n}`,o.toString())}switch(e){case _a.vertex:this._destVS=r;break;case _a.fragment:this._destFS=r;break}}compileShader(e,t,a){let r=t;r=this.applyPostDefine(r,a);let i=t;for(let o in this.defineValue)i+=`${o}=${this.defineValue[o]},`;let n=Ha.renderShaderModulePool.get(i);switch(n||(r=this.applyPostDefine(r,a),n=I.device.createShaderModule({label:e==_a.vertex?this.vsName:this.fsName,code:r}),n.getCompilationInfo().then(o=>{o.messages.length>0&&(console.log(r),console.log(o))}),Ha.renderShaderModulePool.set(i,n)),e){case _a.vertex:this._vsShaderModule=n,this._destVS=r;break;case _a.fragment:this._fsShaderModule=n,this._destFS=r;break}}getGroupLayout(e,t){let a=[];for(let r=0;r<t.length;r++){const i=t[r];if(i)if(i.varType=="uniform"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"uniform"}};a.push(o)}else if(i.varType=="storage-read"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"read-only-storage"}};a.push(o)}else if(i.varType=="var")switch(i.dataType){case"sampler":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:_.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.samplerBindingLayout};a.push(l),this._textureGroup=e}break;case"sampler_comparison":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:_.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.sampler_comparisonBindingLayout};a.push(l),this._textureGroup=e}break;case"texture_2d<f32>":case"texture_2d_array<f32>":case"texture_cube<f32>":case"texture_depth_2d":case"texture_depth_2d_array":case"texture_depth_cube":case"texture_depth_cube_array":{let n=this.textures[i.varName]?this.textures[i.varName]:_.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,ke.getInstance().attached(n,this)}break;case"texture_external":{let n=this.textures[i.varName]?this.textures[i.varName]:_.res.redTexture,o={binding:i.binding,visibility:n.visibility,externalTexture:{}};a.push(o),this._textureGroup=e,ke.getInstance().attached(n,this)}break;default:{let n=this.textures[i.varName]?this.textures[i.varName]:_.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,ke.getInstance().attached(n,this)}break}else{debugger;console.error("bind group can't empty")}}return a}_cacheEntries;genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;o++){const l=r[o];if(l){if(l.varType=="uniform"){let c=this._bufferDic.get(l.varName);if(c){if(c.bufferType==Aa.MaterialDataUniformGPUBuffer){let d=[];if(l.dataFields)for(let h=0;h<l.dataFields.length;h++){const u=l.dataFields[h];this.uniforms[u.name]?d.push(this.uniforms[u.name]):console.error(`shader-${this.vsName}:${this.fsName} ${u.name}is empty`)}d.length>0&&this.materialDataUniformBuffer.initDataUniform(d)}let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`shader${this.vsName}-${this.fsName}`,`buffer ${l.varName} is missing!`)}else if(l.varType=="storage-read"){let c=this._bufferDic.get(l.varName);if(c){let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`buffer ${l.varName} is missing!`)}else if(l.varType=="var")if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f||(f=_.res.blackTexture,this.setTexture(c,f)),f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else{let c=this.textures[l.varName];if(c||(c=_.res.whiteTexture,this.setTexture(l.varName,c)),c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}}}let n=I.device.createBindGroup({layout:this.bindGroupLayouts[e],entries:i});this.bindGroups[e]=n}}createPipeline(e,t,a){let r=e,i=this.shaderState,n=[];for(const c of t.renderTargetTextures)n.push({format:c.format});for(let c=0;c<n.length;c++){const f=n[c];i.writeMasks&&i.writeMasks.length>0&&(f.writeMask=i.writeMasks[c])}if(t.outColor!=-1){let c=n[t.outColor];i.blendMode!=De.NONE?c.blend=Hc.getBlend(i.blendMode):delete c.blend}let o={label:this.vsName+"|"+this.fsName,layout:a,primitive:{topology:i.topology,cullMode:i.cullMode,frontFace:i.frontFace},vertex:void 0};this.vsEntryPoint!=""&&(o.vertex={module:this._vsShaderModule,entryPoint:this.vsEntryPoint,buffers:r.vertexBuffer.vertexBufferLayouts}),this.fsEntryPoint!=""&&(o.fragment={module:this._fsShaderModule,entryPoint:this.fsEntryPoint,targets:n}),i.multisample>0&&(o.multisample={count:i.multisample}),(t.zPreTexture||t.depthTexture)&&(i.blendMode!=De.NONE,_.setting.render.zPrePass&&t.zPreTexture&&i.useZ?o.depthStencil={depthWriteEnabled:!1,depthCompare:nt.less,format:t.zPreTexture.format}:o.depthStencil={depthWriteEnabled:i.depthWriteEnabled,depthCompare:i.depthCompare,format:t.depthTexture.format});let l=Jn.getSharePipeline(this.shaderVariant);l?this.pipeline=l:(this.pipeline=k.createPipeline(o),Jn.setSharePipeline(this.shaderVariant,this.pipeline))}createGroupLayouts(){this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroupLayouts=[Ln.getGlobalDataBindGroupLayout()];for(let a=1;a<e.groups.length;a++){let r=e.groups[a];if(r){let i=this.getGroupLayout(a,r);this._groupsShaderReflectionVarInfos[a]=r;let n=I.device.createBindGroupLayout({entries:i,label:`vs${this.vsName} fs${this.fsName} ${r.length}`});this.bindGroupLayouts[a]=n}else console.error("can't set empty group!",a)}let t=I.device.createPipelineLayout({bindGroupLayouts:this.bindGroupLayouts});return this._groupsShaderReflectionVarInfos[1]&&this.genGroups(1,this._groupsShaderReflectionVarInfos),this._groupsShaderReflectionVarInfos[2]&&this.genGroups(2,this._groupsShaderReflectionVarInfos),this._groupsShaderReflectionVarInfos[3]&&this.genGroups(3,this._groupsShaderReflectionVarInfos),t}preDefine(e){let t=e.hasAttribute(G.TEXCOORD_1),a=e.hasAttribute(G.joints0),r=e.hasAttribute(G.a_morphPositions_0),i=e.hasAttribute(G.TANGENT),n=e.hasAttribute(G.color),o=this.shaderState.acceptGI,l=this.shaderState.useLight;t&&(this.defineValue.USE_SECONDUV=!0),a&&r?this.defineValue.USE_METAHUMAN=!0:(this.defineValue.USE_SKELETON=a,this.defineValue.USE_MORPHTARGETS=r),"USE_TANGENT"in this.defineValue||(this.defineValue.USE_TANGENT=i),this.defineValue.USE_GI=o,this.defineValue.USE_SHADOWMAPING=this.shaderState.acceptShadow,this.defineValue.USE_LIGHT=l,this.defineValue.USE_VERTXCOLOR=n,_.setting.pick.mode=="pixel"&&(this.defineValue.USE_WORLDPOS=!0),_.setting.gi.enable?this.defineValue.USEGI=!0:this.defineValue.USEGI=!1,_.setting.render.debug&&(this.defineValue.USE_DEBUG=!0,this.defineValue.DEBUG_CLUSTER=!0),this.shaderState.useLight?this.defineValue.USE_LIGHT=!0:this.defineValue.USE_LIGHT=!1,_.setting.render.useLogDepth?(this.defineValue.USE_LOGDEPTH=!0,this.shaderState.useFragDepth=!0):this.defineValue.USE_LOGDEPTH=!1,this.shaderState.useFragDepth?this.defineValue.USE_OUTDEPTH=!0:this.defineValue.USE_OUTDEPTH=!1,this.defineValue.USE_PCF_SHADOW=_.setting.shadow.type=="PCF",this.defineValue.USE_HARD_SHADOW=_.setting.shadow.type=="HARD",this.defineValue.USE_SOFT_SHADOW=_.setting.shadow.type=="SOFT",this.defineValue.USE_CSM=sa.Cascades>1,this.defineValue.USE_IES_PROFILE=Ia.use}genReflection(){this.shaderVariant=Tt.genRenderShaderVariant(this);let e=Tt.poolGetReflection(this.shaderVariant);if(e)this.shaderReflection=e;else{let t=Da.parse(this._destVS,this.defineValue);t=Da.parse(t,this.defineValue),Tt.getShaderReflection2(t,this);let a=Da.parse(this._destFS,this.defineValue);a=Da.parse(a,this.defineValue),Tt.getShaderReflection2(a,this),Tt.final(this)}this.shaderState.splitTexture=this.shaderReflection.useSplit}destroy(e){for(const t in this.textures)if(Object.prototype.hasOwnProperty.call(this.textures,t)){const a=this.textures[t];if(ke.getInstance().detached(a,this),e&&!ke.getInstance().hasReference(a))a.destroy(e);else{a.destroy(!1);let r=ke.getInstance().getReference(a);if(r){let i=[];r.forEach((n,o)=>{"name"in n?i.push(n.name):i.push("NaN")})}}}this.bindGroups.length=0,this.shaderState=null,this.textures=null,this.pipeline=null,this.bindGroupLayouts=null,this._sourceVS=null,this._sourceFS=null,this._destVS=null,this._destFS=null,this._vsShaderModule=null,this._fsShaderModule=null,this.materialDataUniformBuffer.destroy(e),this.materialDataUniformBuffer=null}static destroyShader(e){Ha.renderShader.has(e)&&(Ha.renderShader.get(e).destroy(),Ha.renderShader.delete(e))}static getShader(e){return Ha.renderShader.get(e)}static createShader(e,t){let a=new qe(e,t);return Ha.renderShader.set(a.instanceID,a),a.instanceID}}class l0 extends qe{constructor(){super("sky_vs_frag_wgsl","SkyGBuffer_fs"),this.passType=fe.GI,this.setUniformVector3("eyesPos",new b),this.setUniformFloat("exposure",1),this.setUniformFloat("roughness",0);let e=this.shaderState;e.frontFace="ccw",e.cullMode=Lt.front,e.depthWriteEnabled=!1,e.depthCompare=nt.less}}class c0 extends qe{transparency;constructor(){super("gbuffer_vs","gbuffer_fs"),this.setShaderEntry("VertMain","FragMain"),this.passType=fe.GI,this.setUniformColor("baseColor",new J),this.setUniformColor("emissiveColor",new J),this.setUniformFloat("emissiveIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("alphaCutoff",1),this.blendMode=De.NONE,this.setTexture("normalMap",_.res.normalTexture)}}class f0 extends qe{constructor(){super("shadowCastMap_vert","directionShadowCastMap_frag"),this.passType=fe.SHADOW,this.setShaderEntry("main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",b.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class d0 extends qe{constructor(){super("castPointShadowMap_vert","shadowCastMap_frag"),this.passType=fe.POINT_SHADOW,this.setShaderEntry("main","main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",b.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class h0 extends qe{constructor(){super("ZPass_shader_vs","ZPass_shader_vs"),this.passType=fe.DEPTH,this.setShaderEntry("main"),this.useRz=!1;let e=this.shaderState;e.receiveEnv=!1}}class yi{static createGIPass(e,t){if(ia.hasMask(e.rendererMask,Ne.Sky)){if(!t.passShader.get(fe.GI)){let r=t.getSubShaders(fe.COLOR)[0],i=new l0;i.setTexture("baseMap",r.getTexture("baseMap")),i.cullMode=r.cullMode,i.frontFace=r.frontFace,t.addRenderPass(i,0),i.preCompile(e.geometry)}}else this.castGBufferPass(e,t)}static castGBufferPass(e,t){let a=t.getDefaultShaders();for(let r=0;r<a.length;r++){const i=a[r];let n=t.getSubShaders(fe.GI);if(!n||n.length==0||n.length<r){let o=new c0;o.setTexture("baseMap",i.getTexture("baseMap")),o.setTexture("normalMap",i.getTexture("normalMap")),o.setTexture("emissiveMap",i.getTexture("emissiveMap")),i.uniforms.baseColor&&o.setUniform("baseColor",i.getUniform("baseColor")),i.uniforms.envIntensity&&o.setUniform("envIntensity",i.getUniform("envIntensity")),i.uniforms.emissiveColor&&o.setUniform("emissiveColor",i.getUniform("emissiveColor")),i.uniforms.emissiveIntensity&&o.setUniform("emissiveIntensity",i.getUniform("emissiveIntensity")),i.uniforms.alphaCutoff&&o.setUniform("alphaCutoff",i.getUniform("alphaCutoff")),o.cullMode=i.cullMode,o.frontFace=i.frontFace,o.preCompile(e.geometry),t.addRenderPass(o)}}}static createShadowPass(e,t){let a=ia.hasMask(e.rendererMask,Ne.SkinnedMesh),r=e.geometry.hasAttribute(G.TANGENT),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=t.getSubShaders(fe.COLOR);for(let l=0;l<o.length;l++){const c=o[l];let f=t.getSubShaders(fe.SHADOW);if(!f||f.length<l+1){let h=new f0;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),c.cullMode=="none"?h.shaderState.cullMode="none":c.cullMode=="back"?h.shaderState.cullMode="front":c.cullMode=="front"&&(h.shaderState.cullMode="back"),h.preCompile(e.geometry),t.addRenderPass(h)}let d=t.getSubShaders(fe.POINT_SHADOW);if(!d||d.length<l+1){let h=new d0;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),h.setDefine("USE_ALPHACUT",1);for(let u=0;u<1;u++)r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),h.shaderState.cullMode="front",h.preCompile(e.geometry);t.addRenderPass(h)}}}static createDepthPass(e,t){let a=t.getSubShaders(fe.COLOR),r=e.geometry.hasAttribute("TANGENT"),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=ia.hasMask(e.rendererMask,Ne.SkinnedMesh);for(let l=0;l<a.length;l++){const c=a[l];let f=t.getSubShaders(fe.DEPTH);if(!f&&c.shaderState.useZ&&(!f||f.length<l)){let d=new h0;d.setTexture("baseMap",c.getTexture("baseMap")),r||d.setDefine("USE_TANGENT",r),o&&d.setDefine("USE_SKELETON",o),i&&d.setDefine("USE_MORPHTARGETS",i),n&&d.setDefine("USE_MORPHNORMALS",n),d.cullMode=c.cullMode,d.frontFace=c.frontFace,d.preCompile(e.geometry),t.addRenderPass(d)}}}static createReflectionPass(e,t){let a=t.getDefaultShaders();for(let o=0;o<a.length;o++){const l=a[o];let c=t.getSubShaders(fe.REFLECTION);if(!c||c.length==0||c.length<o){let f=new qe(l.vsName,l.fsName);f.vsEntryPoint=l.vsEntryPoint,f.fsEntryPoint=l.fsEntryPoint,f.passType=fe.REFLECTION;for(const d in l.shaderState){var r=l.shaderState[d];f.shaderState[d]=r}for(const d in l.textures){var i=l.getTexture(d);f.setTexture(d,i)}for(const d in l.uniforms){var n=l.getUniform(d);f.setUniform(d,n)}for(const d in l.defineValue){var n=l.defineValue[d];f.setDefine(d,n)}f.setDefine("USE_CASTREFLECTION",!0),f.preCompile(e.geometry),t.addRenderPass(f)}}}}class Cr{static _v1=new b;static _v2=new b;entities;box;subTrees=[];parent;level;static maxSplitLevel=6;static autoSplitLevel=3;index;uuid;constructor(e,t=0,a=null,r=0){this.parent=a,this.box=e.clone(),this.level=r,this.index=t,this.uuid=r+"_"+t,this.entities=new Map}tryInsertEntity(e){let t=e.renderer.object3D.bound;if(this.level==0||this.box.containsBox(t)){this.subTrees.length==0&&this.level<Cr.maxSplitLevel&&this.splitTree();let a;if(this.subTrees.length>0){for(let r of this.subTrees)if(r.tryInsertEntity(e)){a=!0;break}}return a||e.enterNode(this),!0}return!1}splitTree(){if(this.subTrees.length==0){const e=Cr._v1,t=this.box.extents.clone();let a=this.level+1,r=0;for(let i=0;i<2;i++)for(let n=0;n<2;n++)for(let o=0;o<2;o++){const l=new Ce;this.box.min.add(e.set(i,n,o).multiply(t),l.min),l.min.add(t,l.max),l.setFromMinMax(l.min,l.max);let c=new Cr(l,r++,this,a);this.subTrees.push(c)}}}__rayCastTempVector=new b;rayCasts(e,t){if(this.level==0||e.intersectBox(this.box,this.__rayCastTempVector)){this.entities.size>0&&t.push(...this.entities.values());for(let a of this.subTrees)a.rayCasts(e,t);return!0}return!1}frustumCasts(e,t){if(this.level==0||e.containsBox2(this.box)>0){if(this.entities.size>0)for(const a of this.entities.values())(this.level>Cr.autoSplitLevel||e.containsBox2(a.renderer.object3D.bound)>0)&&t.push(a);for(let a of this.subTrees)a.frustumCasts(e,t);return!0}return!1}getRenderNode(e,t){if(this.level==0||e.containsBox2(this.box)>0){if(this.entities.size>0)for(const a of this.entities.values())(this.level>Cr.autoSplitLevel||e.containsBox2(a.renderer.object3D.bound)>0)&&(a.renderer.renderOrder<3e3?t.opaqueList.push(a.renderer):a.renderer.renderOrder>=3e3&&t.transparentList.push(a.renderer));for(let a of this.subTrees)a.getRenderNode(e,t);return!0}return!1}boxCasts(e,t){if(e.intersectsBox(this.box)){this.entities.size>0&&t.push(...this.entities.values());for(let a of this.subTrees)a.boxCasts(e,t);return!0}return!1}clean(){for(let e of this.entities.values())e.leaveNode();return this.entities.clear(),this}}class u0{_pool=[];_worldPosition=new b;_viewPosition=new b;_zSortList=[];pop(){return this._pool.pop()||{}}recycle(){for(let e of this._zSortList)e.z=0,e.userData=null,e.obj3d=null,this._pool.push(e);this._zSortList.length=0}sort(e,t,a,r){this._zSortList=[];for(let i of t){let n=this.pop();n.userData=i,n.obj3d=a(i),n.z=this.worldToCameraDepth(n.obj3d,e),this._zSortList.push(n)}this._zSortList.sort((i,n)=>i.z-n.z>0?1:-1),r||=[];for(let i of this._zSortList)r.push(i.userData);return this.recycle(),r}worldToCameraDepth(e,t){t||=e.transform.view3D.camera;let a=0;return t&&(this._worldPosition.copyFrom(e.transform.worldPosition),t.worldToScreenPoint(this._worldPosition,this._viewPosition),a=this._viewPosition.z),a}}let b0=new u0;var Ci=(s=>(s[s.None=2]="None",s[s.StaticBatch=4]="StaticBatch",s[s.DynamicBatch=8]="DynamicBatch",s[s.Hiden=16]="Hiden",s))(Ci||{});class jn{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)!=0}}class g0{opaqueList=[];transparentList=[];sky;clean(){this.opaqueList.length=0,this.transparentList.length=0}}class p0{renderGroup;constructor(){this.renderGroup=new Map}collect_add(e){let t="",a="";t+=e.geometry.instanceID;for(let i=0;i<e.materials.length;i++){const n=e.materials[i];a+=n.shader.getDefaultColorShader().shaderVariant}let r=t+a;this.renderGroup.has(r)||this.renderGroup.set(r,{bundleMap:new Map,key:r,renderNodes:[]}),this.renderGroup.get(r).renderNodes.indexOf(e)==-1&&this.renderGroup.get(r).renderNodes.push(e)}}class m0{renderShaderUpdateList=new Map;renderNodeList=new Map;collect_add(e){let t=e.transform.view3D;t&&e.materials&&e.materials.forEach(a=>{let r=this.renderShaderUpdateList.get(t);r||(r=new Map,this.renderShaderUpdateList.set(t,r));let i=this.renderNodeList.get(t);i||(i=new Map,this.renderNodeList.set(t,i)),i.set(e.instanceID,e);let n=a.getAllPass();for(let o=0;o<n.length;o++){const l=n[o];let c=`${e.geometry.instanceID+l.instanceID}`,f=r.get(c);f||(f=new Map,r.set(c,f)),f.set(e.instanceID,e)}})}collect_remove(e){let t=e.transform.view3D;if(t&&e.materials){let a=this.renderShaderUpdateList.get(t);a&&e.materials.forEach(r=>{let i=r.getAllPass();for(let n=0;n<i.length;n++){const o=i[n];let l=`${e.geometry.instanceID+o.instanceID}`;a.delete(l)}})}}}class q{static _instance;_sceneLights;_sceneGIProbes;_op_RenderNodes;_tr_RenderNodes;_octreeRenderNodes;_reflections;_graphics;_op_renderGroup;_tr_renderGroup;_renderShaderCollect;state={giLightingChange:!0};sky;_collectInfo;rendererOctree;static get instance(){return this._instance||(this._instance=new q),this._instance}constructor(){this._sceneLights=new Map,this._sceneGIProbes=new Map,this._op_RenderNodes=new Map,this._tr_RenderNodes=new Map,this._reflections=new Map,this._graphics=[],this._op_renderGroup=new Map,this._tr_renderGroup=new Map,this._collectInfo=new g0,this._renderShaderCollect=new m0,this._octreeRenderNodes=new Map}getPashList(e,t){if(t.renderOrder<3e3)return this._op_RenderNodes.get(e);if(t.renderOrder>=3e3)return this._tr_RenderNodes.get(e)}sortRenderNode(e,t){for(let a=e.length-1;a>0;a--)if(e[a].renderOrder<t.renderOrder){e.push(t);return}e.push(t)}addRenderNode(e,t){if(!e)return;let a=t.renderOrder>=3e3;if(t.hasMask(Ne.Sky))this.sky=t;else if(t.hasMask(Ne.Reflection)){this.removeRenderNode(e,t);let r=this._reflections.get(e);r||(r=[],this._reflections.set(e,r),r.push(t)),r.includes(t)||r.push(t)}else if(t.hasMask(Ne.Graphic3D))this._graphics.indexOf(t)==-1&&this._graphics.push(t);else if(jn.hasMask(t.renderLayer,Ci.None)){this.removeRenderNode(e,t);let r=a?this._tr_RenderNodes:this._op_RenderNodes;r.has(e)||r.set(e,[]),r.get(e).push(t),_.setting.occlusionQuery.octree&&t.attachSceneOctree(this.getOctree(e));let i=this.getPashList(e,t);i.indexOf(t)==-1&&this.sortRenderNode(i,t)}else{this.removeRenderNode(e,t);let r=a?this._tr_renderGroup:this._op_renderGroup;r.has(e)||r.set(e,new p0),r.get(e).collect_add(t)}t.object3D.renderNode=t,this._renderShaderCollect.collect_add(t)}getOctree(e){let t,a=_.setting.occlusionQuery.octree;if(a&&(t=this._octreeRenderNodes.get(e),!t)){let r=new b(a.x,a.y,a.z),i=new b(a.width,a.height,a.depth),n=new Ce(r,i);t=new Cr(n),this._octreeRenderNodes.set(e,t)}return t}removeRenderNode(e,t){if(t.detachSceneOctree(),t.hasMask(Ne.Sky))this.sky=null;else if(t.hasMask(Ne.Reflection)){let a=this._reflections.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}else if(jn.hasMask(t.renderLayer,Ci.None)){let a=this.getPashList(e,t);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}this._renderShaderCollect.collect_remove(t)}addLight(e,t){if(!this._sceneLights.has(e))this._sceneLights.set(e,[t]);else{let a=this._sceneLights.get(e);if(a.length>=_.setting.light.maxLight){console.warn("Alreay meet maxmium light number:",_.setting.light.maxLight);return}a.indexOf(t)!=-1||a.push(t)}}removeLight(e,t){if(this._sceneLights.has(e)){let a=this._sceneLights.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getLights(e){let t=this._sceneLights.get(e);return t||[]}addGIProbe(e,t){this._sceneGIProbes.has(e)?this._sceneGIProbes.get(e).push(t):this._sceneGIProbes.set(e,[t])}removeGIProbe(e,t){if(this._sceneGIProbes.has(e)){let a=this._sceneGIProbes.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getProbes(e){let t=this._sceneGIProbes.get(e);return t||[]}getReflections(e){let t=this._reflections.get(e);return t||[]}autoSortRenderNodes(e){let t=this._tr_RenderNodes.get(e);if(!t)return;let a=!1;for(const r of t)if(r.isRenderOrderChange||r.needSortOnCameraZ){a=!0;break}if(a){for(const r of t){let i=r.renderOrder;if(r.needSortOnCameraZ){let n=b0.worldToCameraDepth(r.object3D);n=1-Math.max(0,Math.min(1,n)),i+=n}r.__renderOrder=i,r.isRenderOrderChange=!1}t.sort((r,i)=>r.__renderOrder>i.__renderOrder?1:-1)}return this}getRenderNodes(e,t){if(this.autoSortRenderNodes(e),this._collectInfo.clean(),this._collectInfo.sky=this.sky,_.setting.occlusionQuery.octree)this.rendererOctree=this.getOctree(e),this.rendererOctree.getRenderNode(t.frustum,this._collectInfo);else{let a=this._op_RenderNodes.get(e);a&&(this._collectInfo.opaqueList=a.concat());let r=this._tr_RenderNodes.get(e);r&&(this._collectInfo.transparentList=r.concat())}return this._collectInfo}getOpRenderGroup(e){return this._op_renderGroup.get(e)}getTrRenderGroup(e){return this._tr_renderGroup.get(e)}getGraphicList(){return this._graphics}getRenderShaderCollect(e){return this._renderShaderCollect.renderShaderUpdateList.get(e)}}class A0{renderer;owner;uuid;constructor(e){this.renderer=e,this.uuid=e.object3D.instanceID}leaveNode(){this.owner&&(this.owner.entities.delete(this.uuid),this.owner=null)}enterNode(e){this.owner&&this.leaveNode(),this.owner=e,e.entities.set(this.uuid,this)}update(e){return this.owner?.tryInsertEntity(this)||(this.leaveNode(),e.tryInsertEntity(this)),this.owner}}var V2=Object.defineProperty,O2=Object.getOwnPropertyDescriptor,Zn=(s,e,t,a)=>{for(var r=O2(e,t),i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(e,t,r)||r);return r&&V2(e,t,r),r};class Ba extends et{instanceCount=0;lodLevel=0;alwaysRender=!1;instanceID;drawType=0;_geometry;_materials=[];_castShadow=!0;_castReflection=!0;_castGI=!1;_rendererMask=Ne.Default;_inRenderer=!1;_readyPipeline=!1;_combineShaderRefection;_ignoreEnvMap;_ignorePrefilterMap;__renderOrder=0;_renderOrder=0;_passInit=new Map;isRenderOrderChange;needSortOnCameraZ;isRecievePostEffectUI;_octreeBinder;_renderLayer=Ci.None;_computes;init(e){this.renderOrder=0,this.rendererMask=Ne.Default,this.instanceID=yn().toString(),this._computes=[]}attachSceneOctree(e){this._octreeBinder={octree:e,entity:new A0(this)},this.transform.eventDispatcher.addEventListener(Zt.LOCAL_ONCHANGE,this.updateOctreeEntity,this)}detachSceneOctree(){this._octreeBinder&&(this._octreeBinder.entity?.leaveNode(),this.transform.eventDispatcher.removeEventListener(Zt.LOCAL_ONCHANGE,this.updateOctreeEntity,this),this._octreeBinder=null)}updateOctreeEntity(e){this._octreeBinder?.entity?.update(this._octreeBinder.octree)}copyComponent(e){return super.copyComponent(e),this.geometry=e._geometry,this.materials=e._materials.slice(),this.drawType=e.drawType,this.alwaysRender=e.alwaysRender,this.needSortOnCameraZ=e.needSortOnCameraZ,this.isRenderOrderChange=e.isRenderOrderChange,this.castShadow=e.castShadow,this.castGI=e.castGI,this.rendererMask=e.rendererMask,this.isRecievePostEffectUI=e.isRecievePostEffectUI,this}get renderLayer(){return this._renderLayer}set renderLayer(e){this._renderLayer=e}get geometry(){return this._geometry}set geometry(e){this._geometry!=e&&(this._readyPipeline=!1,this._geometry&&ke.getInstance().detached(this._geometry,this),e&&ke.getInstance().attached(e,this)),this._geometry=e}addMask(e){this._rendererMask=ia.addMask(this.rendererMask,e)}removeMask(e){this._rendererMask=ia.removeMask(this.rendererMask,e)}hasMask(e){return ia.hasMask(this.rendererMask,e)}get rendererMask(){return this._rendererMask}set rendererMask(e){this._rendererMask=e}get renderOrder(){return this._renderOrder}set renderOrder(e){e!=this._renderOrder&&(this.isRenderOrderChange=!0,this.__renderOrder=e),this._renderOrder=e}get materials(){return this._materials}set materials(e){this._readyPipeline=!1;for(let a=0;a<this._materials.length;a++){let r=this._materials[a];ke.getInstance().detached(r,this),r.shader&&r.shader.computes&&this.removeComputes(r.shader.computes)}for(let a=0;a<e.length;a++){let r=e[a];ke.getInstance().attached(r,this),r.shader&&r.shader.computes&&this.addComputes(r.shader.computes)}this._materials=e;let t=0;for(let a=0;a<e.length;a++){const n=e[a].getPass(fe.COLOR)[0];n.shaderState.transparent&&(t=t>n.renderOrder?t:n.renderOrder)}this.renderOrder=t,this._readyPipeline||this.initPipeline()}addComputes(e){this._computes.push(...e)}removeComputes(e){for(const t of e){let a=this._computes.indexOf(t);a!=-1&&this._computes.splice(a,1)}}addRendererMask(e){this._rendererMask=ia.addMask(this._rendererMask,e)}removeRendererMask(e){this._rendererMask=ia.removeMask(this._rendererMask,e)}onEnable(){this._readyPipeline||this.initPipeline(),q.instance.addRenderNode(this.transform.scene3D,this),this.updateOctreeEntity()}onDisable(){this._enable=!1,q.instance.removeRenderNode(this.transform.scene3D,this),super.onDisable?.()}selfCloneMaterials(e){let t=[];for(let a=0,r=this.materials.length;a<r;a++){const i=this.materials[a].clone();t.push(i)}return this.materials=t,this._readyPipeline=!1,this.initPipeline(),this}initPipeline(){if(this._geometry&&this._materials.length>0){for(let t=0;t<this._materials.length;t++){let r=this._materials[t].getPass(fe.COLOR);for(let i=0;i<r.length;i++){const n=r[i];n.shaderReflection||n.preCompile(this._geometry),this._geometry.generate(n.shaderReflection)}this.object3D.bound=this._geometry.bounds.clone()}this._readyPipeline=!0;let e=0;for(let t=0;t<this.materials.length;t++){const i=this.materials[t].getPass(fe.COLOR)[0];i.renderOrder>=3e3?e=e>i.renderOrder?e:i.renderOrder:e=Math.max(e-3e3,0),this.castNeedPass()}this.renderOrder=e,this.enable&&this.transform&&this.transform.scene3D&&q.instance.addRenderNode(this.transform.scene3D,this)}}castNeedPass(){if(this.castGI)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];yi.createGIPass(this,a.shader)}for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castShadow&&yi.createShadowPass(this,a.shader)}if(this.castReflection)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castReflection&&yi.createReflectionPass(this,a.shader)}if(!ia.hasMask(this.rendererMask,Ne.IgnoreDepthPass)&&_.setting.render.zPrePass)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];yi.createDepthPass(this,a.shader)}else for(let t=0;t<this.materials.length;t++)this.materials[t].shader.removeShaderByIndex(fe.DEPTH,0)}get castShadow(){return this._castShadow}set castShadow(e){this._castShadow=e}get castGI(){return this._castGI}set castGI(e){this._castGI=e}get castReflection(){return this._castReflection}set castReflection(e){this._castReflection=e}renderPass(e,t,a){if(!this._geometry)return;let r=this,i=r.transform._worldMatrix;const n=Math.max(r.materials.length,r._geometry.subGeometries.length);for(let o=0;o<n;o++){const l=o>=r.materials.length?r.materials[0]:r.materials[o];if(!l||!l.enable)continue;let c=l.getPass(t);if(!(!c||c.length==0)){k.bindGeometryBuffer(a.encoder,r._geometry),dt.viewCount_vertex(e,fe[t],r._geometry.vertexCount);for(let f=0;f<c.length;f++){if(!c||c.length==0)continue;const h=c[f];if(h.pipeline){h.shaderState.splitTexture&&(a.endRenderPass(),Mt.WriteSplitColorTexture(r.instanceID),a.beginOpaqueRenderPass(),k.bindCamera(a.encoder,e.camera),k.bindGeometryBuffer(a.encoder,r._geometry)),k.bindPipeline(a.encoder,h)&&dt.viewCount_pipeline(e,fe[t]);let p=(o>=r._geometry.subGeometries.length?r._geometry.subGeometries[0]:r._geometry.subGeometries[o]).lodLevels[r.lodLevel];r.instanceCount>0?(dt.viewCount_instance(e,fe[t],r.instanceCount),dt.viewCount_indices(e,fe[t],p.indexCount),dt.viewCount_tri(e,fe[t],p.indexCount/3*r.instanceCount),k.drawIndexed(a.encoder,p.indexCount,r.instanceCount,p.indexStart,0,0)):(dt.viewCount_indices(e,fe[t],p.indexCount),dt.viewCount_tri(e,fe[t],p.indexCount/3),k.drawIndexed(a.encoder,p.indexCount,1,p.indexStart,0,i.index)),dt.viewCount_draw(e,fe[t])}}}}}renderPass2(e,t,a,r,i,n=!1){if(!this.enable||!this._geometry)return;let o=this,l=o.object3D.transform._worldMatrix;for(let c=0;c<this.materials.length;c++){const f=this.materials[c];if(!f.castShadow&&t==fe.SHADOW)continue;let d=f.getPass(t);if(!d||d.length==0)return;if(this.drawType==2)for(let h of d)h.pipeline&&(k.bindPipeline(i,h),k.draw(i,6,1,0,l.index));else{k.bindGeometryBuffer(i,o._geometry);for(let h of d)if(h.pipeline){k.bindPipeline(i,h);let p=o._geometry.subGeometries[c].lodLevels[o.lodLevel];k.drawIndexed(i,p.indexCount,1,p.indexStart,0,l.index)}}}}recordRenderPass2(e,t,a,r,i,n=!1){if(!this.enable)return;let o=this;for(let l=0;l<this.materials.length;l++){let f=this.materials[l].getPass(t);if(!f||f.length==0)return;let d=o.object3D.transform._worldMatrix;for(let h=0;h<f.length;h++){const u=f[h];k.bindPipeline(i,u);let D=o._geometry.subGeometries[l].lodLevels[o.lodLevel];k.drawIndexed(i,D.indexCount,1,D.indexStart,0,d.index)}}}noticeShaderChange(){this.enable&&(this.onEnable(),this._passInit.forEach((e,t)=>{this._passInit.set(t,!1)}))}preInit(e){return this._passInit.get(e)}nodeUpdate(e,t,a,r){let i=this,n=e.scene.envMap;for(let o=0;o<i.materials.length;o++){let c=i.materials[o].getPass(t);if(c)for(let f=0;f<c.length;f++){const h=c[f];if(h.shaderState.splitTexture){let B=Mt.CreateSplitTexture(i.instanceID);h.setTexture("splitTexture_Map",B)}!i._ignoreEnvMap&&h.envMap!=n&&h.setTexture("envMap",n),h.prefilterMap||h.setTexture("prefilterMap",n);let u=xe.getReflectionEntries(e.scene);if(!h.reflectionMap&&u&&u.reflectionMap&&(h.setTexture("reflectionMap",u.reflectionMap),h.setStorageBuffer("reflectionBuffer",u.storageGPUBuffer)),h.pipeline){h.apply(i._geometry,a,()=>i.noticeShaderChange());continue}let m=_.res.getTexture("BRDFLUT");h.setTexture("brdflutMap",m);let g=_.getRenderJob(e).shadowMapPassRenderer;g&&g.depth2DArrayTexture&&h.setTexture("shadowMap",_.getRenderJob(e).shadowMapPassRenderer.depth2DArrayTexture);let p=_.getRenderJob(e).pointLightShadowRenderer;p&&p.cubeArrayTexture&&h.setTexture("pointShadowMap",p.cubeArrayTexture);let D=Ia.iesTexture;D&&h.setTexture("iesTextureArrayMap",D),a.irradianceBuffer&&a.irradianceBuffer.length>0&&(h.setTexture("irradianceMap",a.irradianceBuffer[0]),h.setTexture("irradianceDepthMap",a.irradianceBuffer[1]));let A=xe.getLightEntries(e.scene);A&&(h.setStorageBuffer("lightBuffer",A.storageGPUBuffer),A.irradianceVolume&&h.setUniformBuffer("irradianceData",A.irradianceVolume.irradianceVolumeBuffer)),r&&(h.setStorageBuffer("clustersUniform",r.clustersUniformBuffer),h.setStorageBuffer("lightAssignBuffer",r.lightAssignBuffer),h.setStorageBuffer("assignTable",r.assignTableBuffer),h.setStorageBuffer("clusterBuffer",r.clusterBuffer)),h.apply(i._geometry,a),this._passInit.set(t,!0)}}}beforeDestroy(e){this._geometry&&(ke.getInstance().detached(this._geometry,this),ke.getInstance().hasReference(this._geometry)||this._geometry.destroy(e));for(let t=0;t<this._materials.length;t++){const a=this._materials[t];a&&(ke.getInstance().detached(a,this),ke.getInstance().hasReference(a)||a.destroy(e))}this._computes&&(this._computes.length=0),this.detachSceneOctree(),super.beforeDestroy(e)}destroy(e){super.destroy(e),this._geometry=void 0,this._materials.length=0,this._computes=null,this._passInit&&(this._passInit.clear(),this._passInit=null),this._combineShaderRefection=void 0}}Zn([Kr],Ba.prototype,"materials"),Zn([Kr],Ba.prototype,"castShadow"),Zn([Kr],Ba.prototype,"castGI");class vt{instanceID;name;enable=!0;_defaultSubShader;_shader;_isDestroyed=!1;constructor(){this.instanceID=zt()}set shader(e){this._shader=e,this._defaultSubShader=e.getDefaultShaders()[0]}get shader(){return this._shader}get doubleSide(){return this._defaultSubShader.doubleSide}set doubleSide(e){this._defaultSubShader.doubleSide=e}get castShadow(){return this._defaultSubShader.shaderState.castShadow}set castShadow(e){let t=this._defaultSubShader.shaderState;e!=t.castShadow&&(t.castShadow=e)}get acceptShadow(){return this._defaultSubShader.shaderState.acceptShadow}set acceptShadow(e){let t=this._defaultSubShader.shaderState;t.acceptShadow!=e&&(t.acceptShadow=e,this._defaultSubShader.noticeShaderChange(),this._defaultSubShader.noticeValueChange())}get castReflection(){return this._defaultSubShader.shaderState.castReflection}set castReflection(e){this._defaultSubShader.shaderState.castReflection=e}get blendMode(){return this._defaultSubShader.blendMode}set blendMode(e){this._defaultSubShader.blendMode=e}get depthCompare(){return this._defaultSubShader.depthCompare}set depthCompare(e){this._defaultSubShader.depthCompare=e;for(let t of this._shader.passShader.values())for(let a of t)a.depthCompare=e}get transparent(){return this._defaultSubShader.shaderState.transparent}set transparent(e){this._defaultSubShader.shaderState.transparent=e,e&&(this._defaultSubShader.renderOrder=3e3)}get cullMode(){return this._defaultSubShader.cullMode}set cullMode(e){if(this._defaultSubShader.cullMode!=e){for(let t of this._shader.passShader.values())for(let a of t)a.cullMode=e;this._defaultSubShader.cullMode=e}}get depthWriteEnabled(){return this._defaultSubShader.depthWriteEnabled}set depthWriteEnabled(e){this._defaultSubShader.depthWriteEnabled=e}set useBillboard(e){this._defaultSubShader.setDefine("USE_BILLBOARD",e)}get topology(){return this._defaultSubShader.topology}set topology(e){this._defaultSubShader.topology=e}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}getPass(e){return this._shader.getSubShaders(e)}getAllPass(){return this._shader.getSubShaders(fe.COLOR)}clone(){let e=new vt;return e.shader=this.shader.clone(),e}destroy(e){this._isDestroyed||(this.name=null,this.instanceID=null,this._shader&&(this._shader.destroy(e),this._shader=null),this._defaultSubShader=null,this._isDestroyed=!0)}setDefine(e,t){this.shader.setDefine(e,t)}setTexture(e,t){this._shader.setTexture(e,t)}setStorageBuffer(e,t){this._shader.setStorageBuffer(e,t)}setUniformBuffer(e,t){this._shader.setStorageBuffer(e,t)}setUniformFloat(e,t){this._shader.setUniformFloat(e,t)}setUniformVector2(e,t){this._shader.setUniformVector2(e,t)}setUniformVector3(e,t){this._shader.setUniformVector3(e,t)}setUniformVector4(e,t){this._shader.setUniformVector4(e,t)}setUniformColor(e,t){this._shader.setUniformColor(e,t)}getUniformFloat(e){return this._shader.getUniform(e).data}getUniformV2(e){return this._shader.getUniformVector2(e)}getUniformV3(e){return this._shader.getUniformVector3(e)}getUniformV4(e){return this._shader.getUniformVector4(e)}getUniformColor(e){return this._shader.getUniformColor(e)}getTexture(e){return this._shader.getTexture(e)}getStorageBuffer(e){return this._shader.getStorageBuffer(e)}getStructStorageBuffer(e){return this._shader.getStructStorageBuffer(e)}getUniformBuffer(e){return this._shader.getUniformBuffer(e)}applyUniform(){this._shader.applyUniform()}}const D0=`
|
|
5746
5746
|
#include "GlobalUniform"
|
|
5747
5747
|
|
|
5748
5748
|
// Constants
|
|
@@ -5852,11 +5852,23 @@ struct InstanceData {
|
|
|
5852
5852
|
let radius = length(vec2f((diagonal1 - diagonal2) * 0.5, offDiagonal));
|
|
5853
5853
|
let lambda1 = mid + radius;
|
|
5854
5854
|
let lambda2 = max(mid - radius, MIN_LAMBDA);
|
|
5855
|
+
|
|
5856
|
+
let vmin = min(MAX_SPLAT_SIZE, min(viewport.x, viewport.y));
|
|
5857
|
+
let l1 = 2.0 * min(sqrt(2.0 * lambda1), vmin);
|
|
5858
|
+
let l2 = 2.0 * min(sqrt(2.0 * lambda2), vmin);
|
|
5859
|
+
|
|
5860
|
+
// if (l1 < 2.0 && l2 < 2.0) {
|
|
5861
|
+
// return discardSplat();
|
|
5862
|
+
// }
|
|
5863
|
+
|
|
5864
|
+
let centerProj = projMat * vec4f(splat_cam, 1.0);
|
|
5865
|
+
let c = centerProj.ww * vec2f(1.0 / viewport.x, 1.0 / viewport.y);
|
|
5866
|
+
|
|
5855
5867
|
let diagonalVector = normalize(vec2f(offDiagonal, lambda1 - diagonal1));
|
|
5856
5868
|
|
|
5857
5869
|
// Calculate axis vectors with size clamping
|
|
5858
|
-
let v1 =
|
|
5859
|
-
let v2 =
|
|
5870
|
+
let v1 = l1 * diagonalVector;
|
|
5871
|
+
let v2 = l2 * vec2f(diagonalVector.y, -diagonalVector.x);
|
|
5860
5872
|
|
|
5861
5873
|
// WebGPU Y-axis flip: WebGPU NDC Y goes from top(-1) to bottom(1), opposite of WebGL
|
|
5862
5874
|
return vec4f(v1.x, -v1.y, v2.x, -v2.y);
|
|
@@ -5922,11 +5934,13 @@ struct InstanceData {
|
|
|
5922
5934
|
let v1v2 = calcV1V2(splat_cam.xyz, splatData.covA, splatData.covB, W, viewport, matrix_projection);
|
|
5923
5935
|
|
|
5924
5936
|
// Calculate scale based on alpha (optimized formula)
|
|
5925
|
-
let
|
|
5937
|
+
let t = pow(splat_cam.z + 0.5, 5);
|
|
5938
|
+
let scale = min(1.0, sqrt(-log(1.0 / (255.0 * color.a))) / 2.0);
|
|
5926
5939
|
|
|
5927
5940
|
// Apply visBoost (size multiplier)
|
|
5928
5941
|
let visBoost = materialUniform.tex_params.w;
|
|
5929
|
-
let
|
|
5942
|
+
let expt = exp(-1.0 / t);
|
|
5943
|
+
let v1v2_scaled = v1v2 * (scale * visBoost * expt);
|
|
5930
5944
|
|
|
5931
5945
|
// Pixel coverage culling (vectorized squared length calculation)
|
|
5932
5946
|
let v1v2_sq = v1v2_scaled * v1v2_scaled;
|
|
@@ -5960,7 +5974,7 @@ struct InstanceData {
|
|
|
5960
5974
|
|
|
5961
5975
|
var o: VSOut;
|
|
5962
5976
|
o.member = splat_proj + vec4f(offset, 0.0, 0.0);
|
|
5963
|
-
o.vTexCoord = vertex_pos * (scale
|
|
5977
|
+
o.vTexCoord = vertex_pos * (scale);
|
|
5964
5978
|
o.vColor = color;
|
|
5965
5979
|
|
|
5966
5980
|
return o;
|
|
@@ -5970,16 +5984,30 @@ struct InstanceData {
|
|
|
5970
5984
|
|
|
5971
5985
|
// Constants
|
|
5972
5986
|
const ALPHA_THRESHOLD: f32 = 0.00392156863; // 1.0 / 255.0
|
|
5973
|
-
const GAUSSIAN_SCALE: f32 = 4.0;
|
|
5987
|
+
// const GAUSSIAN_SCALE: f32 = 4.0;
|
|
5988
|
+
const EXP4 = exp(-4.0);
|
|
5989
|
+
const INV_EXP4 = 1.0 / (1.0 - EXP4);
|
|
5990
|
+
|
|
5991
|
+
fn normExp(x: f32) -> f32 {
|
|
5992
|
+
return (exp(x * -4.0) - EXP4) * INV_EXP4;
|
|
5993
|
+
}
|
|
5974
5994
|
|
|
5975
5995
|
// === evalSplat() - optimized gaussian evaluation ===
|
|
5976
5996
|
fn evalSplat(texCoord: vec2f, color: vec4f) -> vec4f {
|
|
5977
5997
|
let A = dot(texCoord, texCoord);
|
|
5998
|
+
|
|
5999
|
+
if (A > 1.0) {
|
|
6000
|
+
discard;
|
|
6001
|
+
// return vec4f(1.0, 0.0, 0.0, 0.5);
|
|
6002
|
+
}
|
|
5978
6003
|
|
|
5979
6004
|
// Branch-less optimization using select
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
6005
|
+
var alpha = normExp(A) * color.a;
|
|
6006
|
+
|
|
6007
|
+
if (alpha < ALPHA_THRESHOLD) {
|
|
6008
|
+
discard;
|
|
6009
|
+
// alpha = 0.5;
|
|
6010
|
+
}
|
|
5983
6011
|
return vec4f(color.rgb, alpha);
|
|
5984
6012
|
}
|
|
5985
6013
|
|
|
@@ -5992,7 +6020,7 @@ struct InstanceData {
|
|
|
5992
6020
|
o.color = evalSplat(vTexCoord, vColor);
|
|
5993
6021
|
return o;
|
|
5994
6022
|
}
|
|
5995
|
-
`;class At{computes;passShader;constructor(){this.computes=[],this.passShader=new Map}addRenderPass(e,t=-1){let a=this.passShader.get(e.passType)||[];t==-1?a.push(e):a.splice(t,-1,e),this.passShader.set(e.passType,a)}removeShader(e,t=-1){let a=this.passShader.get(e.passType);if(a)if(t==-1){let r=a.indexOf(e);r!=-1&&a.splice(r)}else a.splice(t,1)}removeShaderByIndex(e,t=-1){let a=this.passShader.get(e);a&&(t==-1?this.passShader.delete(e):a.splice(t,1))}getSubShaders(e){return this.passShader.get(e)||[]}hasSubShaders(e){return this.passShader.get(e).length>0}getDefaultShaders(){return this.passShader.get(fe.COLOR)}getDefaultColorShader(){return this.passShader.get(fe.COLOR)[0]}setDefine(e,t){for(const a of this.passShader)for(const r of a[1])r.setDefine(e,t)}hasDefine(e){for(const t of this.passShader)for(const a of t[1]){let r=a.hasDefine(e);if(r)return r}return!1}deleteDefine(e){for(const t of this.passShader)for(const a of t[1])a.deleteDefine(e)}setUniform(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniform(e,t)}setUniformFloat(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformFloat(e,t)}setUniformVector2(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformVector2(e,t)}setUniformVector3(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformVector3(e,t)}setUniformVector4(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformVector4(e,t)}setUniformColor(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformColor(e,t)}getUniform(e){return this.getDefaultColorShader().getUniform(e)}getUniformFloat(e){return this.getDefaultColorShader().getUniformFloat(e)}getUniformVector2(e){return this.getDefaultColorShader().getUniformVector2(e)}getUniformVector3(e){return this.getDefaultColorShader().getUniformVector3(e)}getUniformVector4(e){return this.getDefaultColorShader().getUniformVector4(e)}getUniformColor(e){return this.getDefaultColorShader().getUniformColor(e)}setTexture(e,t){for(const a of this.passShader)for(const r of a[1])r.setTexture(e,t);this.setDefine(`USE_${e.toLocaleUpperCase()}`,!0)}getTexture(e){return this.getDefaultColorShader().textures[e]}setUniformBuffer(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformBuffer(e,t)}getUniformBuffer(e){return this.getDefaultColorShader().getBuffer(e)}setStorageBuffer(e,t){for(const a of this.passShader)for(const r of a[1])r.setStorageBuffer(e,t)}getStorageBuffer(e){return this.getDefaultColorShader().getBuffer(e)}setStructStorageBuffer(e,t){for(const a of this.passShader)for(const r of a[1])r.setStructStorageBuffer(e,t)}getStructStorageBuffer(e){return this.getDefaultColorShader().getBuffer(e)}noticeValueChange(){for(const e of this.passShader)for(const t of e[1])t.noticeValueChange()}destroy(e){for(const t of this.passShader)for(const a of t[1])a.destroy(e);this.passShader.clear(),this.passShader=null,this.computes=null}clone(){let e=new At,t=this.getDefaultShaders();for(const a of t)e.addRenderPass(a);return e}applyUniform(){for(const e of this.passShader)for(const t of e[1])t.applyUniform()}}var L2=Object.getOwnPropertyDescriptor,G2=(s,e,t,a)=>{for(var r=a>1?void 0:a?L2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Si=class extends At{constructor(){super();const s=new qe("gsplat_vs_dc","gsplat_fs_dc");s.passType=fe.COLOR,s.setShaderEntry("VertMain","FragMain"),s.topology=Ss.triangle_list,s.depthWriteEnabled=!1,s.cullMode=Lt.none,s.shaderState.transparent=!0,s.shaderState.blendMode=De.NORMAL,s.shaderState.writeMasks=[15,15],s.shaderState.castReflection=!1,this.addRenderPass(s),this.setDefault()}setDefault(){const s=this.getDefaultColorShader(),e=new R;s.setUniform("modelMatrix",e.rawData),s.setUniform("pixelCull",new Float32Array([2,0,0,0]))}};Si=G2([Na(Si,"GSplatShader")],Si);class Yn extends vt{_pixelCullArray=new Float32Array(4);constructor(){super(),Y.register("gsplat_vs_dc",D0),Y.register("gsplat_fs_dc",_0),this.shader=new Si}setSplatTextures(e,t,a,r,i){const n=this.shader.getDefaultColorShader();n.setTexture("splatColor",e),n.setTexture("transformA",t),n.setTexture("transformB",a),n.setUniformArray("tex_params",r),i&&n.setTexture("splatOrder",i),n.shaderState.depthCompare=ft.less}setTransformMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}setPixelCulling(e,t,a=0,r=128){this._pixelCullArray[0]=e,this._pixelCullArray[1]=t,this._pixelCullArray[2]=a,this._pixelCullArray[3]=r,this.shader.getDefaultColorShader().setUniform("pixelCull",this._pixelCullArray)}setTexParams(e){this.shader.getDefaultColorShader().setUniformArray("tex_params",e)}}class Rs extends Ya{node;constructor(e){super(),this.bufferType=Aa.VertexGPUBuffer,this.createVertexBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,e)}createVertexBuffer(e,t){let a=I.device;this.byteSize=t*Float32Array.BYTES_PER_ELEMENT,this.usage=e,this.buffer&&this.destroy(),this.buffer=a.createBuffer({label:"VertexGPUBuffer",size:this.byteSize,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),this.node=this.memory.allocation_node(this.byteSize)}}var kt=(s=>(s[s.split=0]="split",s[s.compose=1]="compose",s[s.compose_bin=2]="compose_bin",s))(kt||{});class B0{vertexCount=0;vertexGPUBuffer;geometryType=kt.compose;_vertexBufferLayouts;_attributeSlotLayouts;_attributeLocation;constructor(){this._vertexBufferLayouts=[],this._attributeLocation={},this._attributeSlotLayouts=[]}get vertexBufferLayouts(){return this._vertexBufferLayouts}createVertexBuffer(e,t){switch(this.geometryType){case kt.split:this.createSplitVertexBuffer(e,t);break;case kt.compose:this.createComposeVertexBuffer(e,t);break;case kt.compose_bin:this.createComposBinVertexBuffer(e,t);break}}createSplitVertexBuffer(e,t){let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:0,shaderLocation:i.location,stride:dr[i.format]};this._attributeSlotLayouts[i.location]=[n];let o=e.get(i.name);o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o));let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l,this._vertexBufferLayouts[i.location]={name:i.name,arrayStride:i.size*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[i.location],offset:a*4,size:this.vertexCount*i.size*4},a+=this.vertexCount*i.size}this.vertexGPUBuffer=new Rs(a)}createComposeVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index"||i.type=="builtin")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:a*4,shaderLocation:i.location,stride:dr[i.format]};this._attributeSlotLayouts[0][i.location]=n;let o=e.get(i.name);if(o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o)),o.data){let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l}a+=i.size}this._vertexBufferLayouts[0]={name:"composeStruct",arrayStride:a*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[0],offset:0,size:this.vertexCount*a*4},this.vertexGPUBuffer=new Rs(this.vertexCount*a)}createComposBinVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let n=0;n<t.attributes.length;n++){const o=t.attributes[n];if(o.name=="index"||o.type=="builtin")continue;this._attributeLocation[o.name]=o.location;let l={name:o.name,format:o.format,offset:a*4,shaderLocation:o.location,stride:dr[o.format]};this._attributeSlotLayouts[0][o.location]=l;let c=e.get(o.name);if(c||(c={attribute:o.name,data:new Float32Array(o.size*this.vertexCount)},e.set(o.name,c)),c.data){let f=c.data.length/l.stride;this.vertexCount!=0&&this.vertexCount!=f&&console.error(" vertex count not match attribute count"),this.vertexCount=f}a+=o.size}let i=e.get(G.all).data.length/a;this.vertexCount=i,this._vertexBufferLayouts[0]={name:"composeStruct",arrayStride:a*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[0],offset:0,size:this.vertexCount*a*4},this.vertexGPUBuffer=new Rs(this.vertexCount*a)}upload(e,t){if(this.vertexGPUBuffer){switch(this.geometryType){case kt.split:{let a=this._attributeLocation[e],r=this._vertexBufferLayouts[a];this.vertexGPUBuffer.node.setFloat32Array(r.offset/4,t.data)}break;case kt.compose:for(let a=0;a<this.vertexCount;a++){const r=this._attributeSlotLayouts[0][this._attributeLocation[e]];for(let i=0;i<r.stride;i++){let n=t.data[a*r.stride+i],o=a*(this._vertexBufferLayouts[0].arrayStride/4)+r.offset/4+i;this.vertexGPUBuffer.node.setFloat(n,o)}}break;case kt.compose_bin:this.vertexGPUBuffer.node.setFloat32Array(0,t.data);break}this.vertexGPUBuffer?.apply()}}updateAttributes(e){switch(this.geometryType){case kt.split:for(let t=0;t<this._vertexBufferLayouts.length;t++){const a=this._vertexBufferLayouts[t];let r=e.get(a.name);this.vertexGPUBuffer.node.setFloat32Array(a.offset/4,r.data)}break;case kt.compose:for(let t=0;t<this.vertexCount;t++)this._attributeSlotLayouts.forEach(a=>{for(let r=0;r<a.length;r++){const i=a[r];let n=e.get(i.name);for(let o=0;o<i.stride;o++){let l=n.data[t*i.stride+o],c=t*(this._vertexBufferLayouts[0].arrayStride/4)+i.offset/4+o;this.vertexGPUBuffer.node.setFloat(l,c)}}});break;case kt.compose_bin:{let t=e.get(G.all);this.vertexGPUBuffer.node.setFloat32Array(0,t.data)}break}this.vertexGPUBuffer.apply()}compute(){}destroy(e){this.vertexCount=null,this.geometryType=null,this._vertexBufferLayouts=null,this._attributeSlotLayouts=null,this._attributeLocation=null,this.vertexGPUBuffer&&this.vertexGPUBuffer.destroy(e),this.vertexGPUBuffer=null}}class v0 extends Ya{indicesNode;constructor(e){super(),this.bufferType=Aa.IndicesGPUBuffer,this.createIndicesBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.INDEX|GPUBufferUsage.INDIRECT,e)}createIndicesBuffer(e,t){let a=I.device;if(this.byteSize=t.length*4,this.usage=e,this.buffer&&this.destroy(),this.buffer=a.createBuffer({label:"IndicesGPUBuffer",size:this.byteSize,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),t){this.indicesNode=this.memory.allocation_node(t.length*4);const r=t.buffer instanceof ArrayBuffer?t.buffer:new Uint8Array(t.buffer).buffer;this.indicesNode.setArrayBuffer(0,r),this.apply()}}}class x0{uuid="";name;indicesGPUBuffer;indicesFormat="uint16";indicesCount=0;constructor(){}createIndicesBuffer(e){e.data instanceof Uint16Array?this.indicesFormat="uint16":e.data instanceof Uint32Array&&(this.indicesFormat="uint32"),this.indicesCount=e.data.length,this.indicesGPUBuffer=new v0(e.data)}upload(e){this.indicesGPUBuffer.indicesNode.setArrayBuffer(0,e),this.indicesGPUBuffer.apply()}compute(){}destroy(){this.uuid=null,this.name=null,this.indicesFormat=null,this.indicesCount=null,this.indicesGPUBuffer.destroy(),this.indicesGPUBuffer=null}}class U0{lodLevels}class Le{instanceID;name;subGeometries=[];morphTargetsRelative;morphTargetDictionary;skinNames;bindPose;blendShapeData;vertexDim;vertexCount=0;_bounds;_attributeMap;_attributes;_indicesBuffer;_vertexBuffer;_onChange=!0;_wireframeLines;_isDestroyed=!1;constructor(){this.instanceID=zt(),this._attributeMap=new Map,this._attributes=[],this._vertexBuffer=new B0}get indicesBuffer(){return this._indicesBuffer}get vertexBuffer(){return this._vertexBuffer}get vertexAttributes(){return this._attributes}get vertexAttributeMap(){return this._attributeMap}get geometryType(){return this._vertexBuffer.geometryType}set geometryType(e){this._vertexBuffer.geometryType=e}get bounds(){if(!this._bounds){this._bounds=new Ce(new b,new b(1,1,1)),this._bounds.min.x=Number.MAX_VALUE,this._bounds.min.y=Number.MAX_VALUE,this._bounds.min.z=Number.MAX_VALUE,this._bounds.max.x=-Number.MAX_VALUE,this._bounds.max.y=-Number.MAX_VALUE,this._bounds.max.z=-Number.MAX_VALUE;let e=this.getAttribute(G.position);if(e&&e.data)for(let t=0;t<e.data.length/3;t++){const a=e.data[t*3+0],r=e.data[t*3+1],i=e.data[t*3+2];this._bounds.min.x>a&&(this._bounds.min.x=a),this._bounds.min.y>r&&(this._bounds.min.y=r),this._bounds.min.z>i&&(this._bounds.min.z=i),this._bounds.max.x<a&&(this._bounds.max.x=a),this._bounds.max.y<r&&(this._bounds.max.y=r),this._bounds.max.z<i&&(this._bounds.max.z=i)}this._bounds.setFromMinMax(this._bounds.min,this._bounds.max)}return this._bounds}set bounds(e){this._bounds=e}addSubGeometry(...e){let t=new U0;return t.lodLevels=e,this.subGeometries.push(t),t}generate(e){this._onChange&&(this._onChange=!1,this._indicesBuffer.upload(this.getAttribute(G.indices).data),this._vertexBuffer.createVertexBuffer(this._attributeMap,e),this._vertexBuffer.updateAttributes(this._attributeMap),this.vertexCount=this._vertexBuffer.vertexCount)}setIndices(e){if(!this._attributeMap.has(G.indices)){let t={attribute:G.indices,data:e};this._attributeMap.set(G.indices,t),this._indicesBuffer=new x0,this._indicesBuffer.createIndicesBuffer(t)}}setAttribute(e,t){if(e==G.indices)this.setIndices(t);else{let a={attribute:e,data:t};this._attributeMap.set(e,a),this._attributes.push(e)}}getAttribute(e){return this._attributeMap.get(e)}hasAttribute(e){return this._attributeMap.has(e)}genWireframe(){if(this._wireframeLines)return this._wireframeLines;if(this.geometryType==kt.split||this.geometryType==kt.compose){let e=this.getAttribute(G.position),t=this.getAttribute(G.indices);if(t&&e&&t.data.length>0){let a=e.data,r=[];for(let i=0;i<t.data.length/3;i++){const n=t.data[i*3+0],o=t.data[i*3+1],l=t.data[i*3+2];let c=new b(a[n*3+0],a[n*3+1],a[n*3+2]),f=new b(a[o*3+0],a[o*3+1],a[o*3+2]),d=new b(a[l*3+0],a[l*3+1],a[l*3+2]);r.push(c,f),r.push(f,d),r.push(d,c)}return this._wireframeLines=r,r}}else if(this.geometryType==kt.compose_bin){let e=this.getAttribute(G.all),t=this.vertexDim,a=this.getAttribute(G.indices);if(a&&e&&a.data.length>0){let r=e.data,i=[];for(let n=0;n<a.data.length/3;n++){const o=a.data[n*3+0],l=a.data[n*3+1],c=a.data[n*3+2];let f=new b(r[o*t+0],r[o*t+1],r[o*t+2]),d=new b(r[l*t+0],r[l*t+1],r[l*t+2]),h=new b(r[c*t+0],r[c*t+1],r[c*t+2]);i.push(f,d),i.push(d,h),i.push(h,f)}return this._wireframeLines=i,i}}return null}compute(){this._indicesBuffer&&this._indicesBuffer.compute(),this._vertexBuffer&&this._vertexBuffer.compute()}static crossA=b.UP.clone();static crossB=b.UP.clone();static crossRet=b.UP.clone();static point1=b.UP.clone();static point2=b.UP.clone();static point3=b.UP.clone();computeNormals(){let e=this.getAttribute(G.position),t=this.getAttribute(G.normal),a=this.getAttribute(G.indices);if(!e||!t||!a)return this;let r=a.data.length/3,i=Le.point1,n=Le.point2,o=Le.point3,l=Le.crossA,c=Le.crossB,f=Le.crossRet;for(let d=0;d<r;d++){let h=a.data[d*3],u=a.data[d*3+1],m=a.data[d*3+2];i.set(e.data[h*3],e.data[h*3+1],e.data[h*3+2]),n.set(e.data[u*3],e.data[u*3+1],e.data[u*3+2]),o.set(e.data[m*3],e.data[m*3+1],e.data[m*3+2]),b.sub(i,n,l).normalize(),b.sub(i,o,c).normalize();let g=l.crossProduct(c,f).normalize();t.data[h*3]=t.data[u*3]=t.data[m*3]=g.x,t.data[h*3+1]=t.data[u*3+1]=t.data[m*3+1]=g.y,t.data[h*3+2]=t.data[u*3+2]=t.data[m*3+2]=g.z}return this._vertexBuffer.upload(G.normal,t),this}isPrimitive(){return!1}destroy(e){this._isDestroyed||(this.instanceID=null,this.name=null,this.subGeometries=null,this.morphTargetDictionary=null,this.skinNames=null,this.bindPose=null,this.blendShapeData=null,this._wireframeLines=null,this._bounds&&(this._bounds.destroy(),this._bounds=null),this._attributeMap&&(this._attributeMap.forEach(t=>{t&&t.data&&(t.data=null)}),this._attributeMap.clear(),this._attributeMap=null),this._attributes=null,this._indicesBuffer&&(this._indicesBuffer.destroy(),this._indicesBuffer=null),this._vertexBuffer&&(this._vertexBuffer.destroy(),this._vertexBuffer=null),this._isDestroyed=!0)}}class Xn extends Le{batchSize;constructor(e=128){super(),this.batchSize=e;const t=new Float32Array(12*e);for(let r=0;r<e;++r)t.set([-2,-2,r,2,-2,r,2,2,r,-2,2,r],r*12);const a=new Uint32Array(6*e);for(let r=0;r<e;++r){const i=r*4;a.set([0+i,1+i,2+i,0+i,2+i,3+i],r*6)}this.setAttribute(G.position,t),this.setIndices(a),this.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:t.length/3,firstStart:0,index:0,topology:0})}}class Fi extends ut{_dataBuffer;create(e,t,a,r=!1){let i=I.device;const n=Math.ceil(e*4/256)*256;this.format=oe.rgba8unorm,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const o=this._dataBuffer=i.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});i.queue.writeBuffer(o,0,a.buffer);const l=k.beginCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(l),r&&wa.webGPUGenerateMipmap(this),this}updateTexture(e,t,a,r,i){let n=I.device;const o=Math.ceil(e*4/256)*256;if(this.mipmapCount=Math.floor(Math.log2(e)),r!==void 0&&i!==void 0&&i<t){const f=i,d=r*e*4,h=a.subarray(d,d+f*e*4),u=h.byteLength;(!this._dataBuffer||this._dataBuffer.size<u)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=n.createBuffer({size:u,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),n.queue.writeBuffer(this._dataBuffer,0,h.buffer,h.byteOffset,h.byteLength);const m=k.beginCommandEncoder();m.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:o,offset:0},{texture:this.getGPUTexture(),origin:[0,r,0]},{width:e,height:f,depthOrArrayLayers:1}),k.endCommandEncoder(m);return}this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null;const l=this._dataBuffer=n.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});n.queue.writeBuffer(l,0,a.buffer);const c=k.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:o},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(c),this.gpuSampler=n.createSampler(this),this.mipmapCount>1&&wa.webGPUGenerateMipmap(this)}}class Hn extends ut{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4*4;this.format=oe.rgba32uint,this.createTextureDescriptor(e,t,1,this.format);const o=this._dataBuffer=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,a.buffer);const l=r.createCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),r.queue.submit([l.finish()]),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="uint",this.gpuSampler=r.createSampler({}),this}updateTexture(e,t,a,r,i){let n=I.device;const o=e*4*4;if(r!==void 0&&i!==void 0&&i<t){const l=i,c=r*e*4,f=a.subarray(c,c+l*e*4);n.queue.writeTexture({texture:this.getGPUTexture(),origin:[0,r,0]},f.buffer,{bytesPerRow:o,offset:f.byteOffset},{width:e,height:l,depthOrArrayLayers:1});return}n.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:o},{width:e,height:t,depthOrArrayLayers:1})}}class Qs extends ut{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4;this.format=oe.r32uint,this.createTextureDescriptor(e,t,1,this.format);const o=this._dataBuffer=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,a.buffer);const l=r.createCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),r.queue.submit([l.finish()]),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="uint",this.gpuSampler=r.createSampler({}),this}updateTexture(e,t,a){let r=I.device;const i=e*4;r.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:i},{width:e,height:t,depthOrArrayLayers:1})}}const y0=new Float32Array(1),z2=new Int32Array(y0.buffer);function C0(s,e,t,a){for(let r=0;r<a;r++){const i=s[t+r];y0[0]=i;const n=z2[0];let o=n>>16&32768,l=n>>12&2047;const c=n>>23&255;if(c<103){e[t+r]=o;continue}if(c>142){o|=31744,o|=(c==255?1:0)&&n&8388607,e[t+r]=o;continue}if(c<114){l|=2048,o|=(l>>114-c)+(l>>113-c&1),e[t+r]=o;continue}o|=c-112<<10|l>>1,o+=l&1,e[t+r]=o}}class Ts extends ut{uint16Array;floatArray;_dataBuffer;create(e,t,a=null,r=!0){if(a==null){a=[];for(let i=0,n=e*t*4;i<n;i++)a[i]=0}return this.updateTexture(e,t,a,r),this}updateTexture(e,t,a,r=!0,i,n){(e!=this.width||t!=this.height)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null,this.gpuTexture&&this.gpuTexture.destroy(),this.gpuTexture=null),this.floatArray=a;let o=I.device;const l=e*4*2;if(this.format=oe.rgba16float,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format),i!==void 0&&n!==void 0&&n<t){const h=n,u=i*e*4,m=h*e*4;(!this.uint16Array||this.uint16Array.length<u+m)&&(!this.uint16Array||this.uint16Array.length<a.length)&&(this.uint16Array=new Uint16Array(a.length));const g=this.uint16Array;C0(a,g,u,m);const p=g.subarray(u,u+m),D=p.byteLength;(!this._dataBuffer||this._dataBuffer.size<D)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=o.createBuffer({size:D,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),o.queue.writeBuffer(this._dataBuffer,0,p.buffer,p.byteOffset,p.byteLength);const A=k.beginCommandEncoder();A.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:l,offset:0},{texture:this.getGPUTexture(),origin:[0,i,0]},{width:e,height:h,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),k.endCommandEncoder(A);return}(!this.uint16Array||this.uint16Array.length!=a.length)&&(this.uint16Array=new Uint16Array(a.length));const c=this.uint16Array;C0(a,c,0,a.length);const f=c.byteLength;(!this._dataBuffer||this._dataBuffer.size<f)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=o.createBuffer({size:f,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),o.queue.writeBuffer(this._dataBuffer,0,c.buffer,c.byteOffset,c.byteLength);const d=k.beginCommandEncoder();d.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:l},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),k.endCommandEncoder(d),this.gpuSampler=o.createSampler(this),this.gpuTexture=this.getGPUTexture(),this.mipmapCount>1&&wa.webGPUGenerateMipmap(this)}}const S0=new Float32Array(1),W2=new Int32Array(S0.buffer);let Ka=function(s){S0[0]=s;const e=W2[0];let t=e>>16&32768,a=e>>12&2047;const r=e>>23&255;return r<103?t:r>142?(t|=31744,t|=(r==255?1:0)&&e&8388607,t):r<114?(a|=2048,t|=(a>>114-r)+(a>>113-r&1),t):(t|=r-112<<10|a>>1,t+=a&1,t)};var J2=Object.getOwnPropertyDescriptor,j2=(s,e,t,a)=>{for(var r=a>1?void 0:a?J2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ii=class extends Ba{count=0;size=new de;splatColor;transformA;transformB;texParams;splatOrder;gsplatMaterial;_positions;get positions(){return this._positions}_worldPositions;_orderData;_sortWorker;_lastSentTime=0;_minIntervalMs=16;_centersSent=!1;_lastViewMatrixHash=0;_lastCameraSpeed=0;_adaptiveSorting=!0;_lastPixelCullParams="";_texturesInitialized=!1;_lodEnabled=!1;_lodDistances=[5,10,20,40];_lodRatios=[1,.75,.5,.25,.1];_currentLodLevel=0;_minPixelCoverage=4;_maxPixelCoverage=0;_maxPixelCullDistance=0;_mapping=null;_fullCount=0;get fullCount(){return this._fullCount}_batchSize=128;instanceCount=0;constructor(){super()}initAsset(s){this.count=s.count,this._fullCount=s.count,this.size=this.evalTextureSize(s.count),this.buildColor(s),this.buildTransform(s),this.texParams=new Float32Array([this.count,this.size.x,this.count,1]),this._positions=s.position;const e=this.size.x*this.size.y;this._orderData=new Uint32Array(e);for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;this.splatOrder=new Qs().create(this.size.x,this.size.y,this._orderData),this.splatOrder.name="splatOrder",this.splatOrder.minFilter="nearest",this.splatOrder.magFilter="nearest",this.splatOrder.addressModeU="clamp-to-edge",this.splatOrder.addressModeV="clamp-to-edge",this.gsplatMaterial=new Yn,this.geometry=new Xn(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}onBeforeUpdate(s){this.count>0&&s?.camera&&(this._lodEnabled&&this.updateLOD(s),s.camera.viewMatrix&&this.scheduleOrder(s.camera.viewMatrix))}updateLOD(s){if(!this._worldPositions||this._fullCount===0)return;const t=s.camera.viewMatrix.rawData,a=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),r=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),i=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]);let n=0,o=0,l=0;const c=Math.min(100,this._fullCount);for(let g=0;g<c;g++){const p=Math.floor(g/c*this._fullCount)*3;n+=this._worldPositions[p+0],o+=this._worldPositions[p+1],l+=this._worldPositions[p+2]}n/=c,o/=c,l/=c;const f=a-n,d=r-o,h=i-l,u=Math.sqrt(f*f+d*d+h*h);let m=this._lodDistances.length;for(let g=0;g<this._lodDistances.length;g++)if(u<this._lodDistances[g]){m=g;break}if(m!==this._currentLodLevel){this._currentLodLevel=m;const g=this._lodRatios[m],p=Math.floor(this._fullCount*g);if(this._mapping){const D=this._mapping;this._mapping=new Uint32Array(Math.min(p,D.length));for(let A=0;A<this._mapping.length;A++)this._mapping[A]=D[A];this.setMapping(this._mapping)}else this.count=p,this.texParams[0]=this.count,this.texParams[2]=this.count}}setMapping(s){this._mapping=s&&s.length>0?s:null,this.count=this._mapping?this._mapping.length:this._fullCount,this.texParams[0]=this.count,this.texParams[2]=Math.min(this.texParams[0],this.count);const e=this.size.x*this.size.y;for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;if(this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData),this._sortWorker){const t=this._worldPositions||this._positions,a=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(t);if(this._mapping)for(let r=0;r<this._mapping.length;++r){const i=this._mapping[r]*3,n=r*3;a[n+0]=t[i+0],a[n+1]=t[i+1],a[n+2]=t[i+2]}this._sortWorker.postMessage({type:"centers",centers:a.buffer,mapping:this._mapping?this._mapping:null},[a.buffer]),this._centersSent=!0}else this._centersSent=!1;this.instanceCount=0}setVisBoost(s){this.texParams[3]=Math.max(0,s)}setSortThrottle(s){this._minIntervalMs=Math.max(0,s|0)}setAdaptiveSorting(s){this._adaptiveSorting=s}setLOD(s,e,t){this._lodEnabled=s,e&&(this._lodDistances=e),t&&(this._lodRatios=t)}getLODStats(){return{enabled:this._lodEnabled,currentLevel:this._currentLodLevel,distances:this._lodDistances,ratios:this._lodRatios,currentRatio:this._lodRatios[this._currentLodLevel],visibleCount:this._lodEnabled?Math.floor(this._fullCount*this._lodRatios[this._currentLodLevel]):this._fullCount}}setPixelCulling(s,e=0,t=0){this._minPixelCoverage=Math.max(0,s),this._maxPixelCoverage=Math.max(0,e),this._maxPixelCullDistance=Math.max(0,t)}getPixelCullingStats(){return{minPixels:this._minPixelCoverage,maxPixels:this._maxPixelCoverage,maxPixelCullDistance:this._maxPixelCullDistance,maxEnabled:this._maxPixelCoverage>0,distanceEnabled:this._maxPixelCullDistance>0}}getBatchingStats(){return{enabled:!0,batchSize:this._batchSize,instanceCount:this.instanceCount,splatCount:this.count,reduction:this.count>0?(1-this.instanceCount/this.count)*100:0}}evalTextureSize(s){let e=Math.ceil(Math.sqrt(s));const t=64;e=Math.ceil(e/t)*t;const a=Math.ceil(s/e);return new de(e,a)}buildColor(s){const e=this.size.x|0,t=this.size.y|0,a=new Uint8Array(e*t*4),r=.28209479177387814,i=s.count,n=s.sh?.coeffs,o=n?n.length/(3*i):1;for(let l=0;l<i;l++){let c=.5,f=.5,d=.5;if(n&&o>=1){const m=l*o*3;c=.5+n[m+0]*r,f=.5+n[m+o+0]*r,d=.5+n[m+2*o+0]*r}const h=s.opacity?1/(1+Math.exp(-s.opacity[l])):1,u=l*4;a[u+0]=Math.max(0,Math.min(255,Math.floor(c*255))),a[u+1]=Math.max(0,Math.min(255,Math.floor(f*255))),a[u+2]=Math.max(0,Math.min(255,Math.floor(d*255))),a[u+3]=Math.max(0,Math.min(255,Math.floor(h*255)))}this.splatColor=new Fi().create(e,t,a,!1),this.splatColor.name="splatColor",this.splatColor.minFilter="nearest",this.splatColor.magFilter="nearest",this.splatColor.mipmapFilter="nearest",this.splatColor.addressModeU="clamp-to-edge",this.splatColor.addressModeV="clamp-to-edge"}buildTransform(s){const e=this.size.x|0,t=this.size.y|0,a=s.count,r=new Uint32Array(e*t*4),i=new Array(e*t*4).fill(0),n=new ArrayBuffer(4),o=new Float32Array(n),l=new Uint32Array(n),c=u=>(o[0]=u,l[0]),f=s.position,d=s.rotation,h=s.scale;for(let u=0;u<a;u++){const m=u*4,g=f[u*3+0],p=f[u*3+1],D=f[u*3+2];r[m+0]=c(g),r[m+1]=c(p),r[m+2]=c(D);let A=0,B=0,v=0,U=1;if(d){A=d[u*4+0],B=d[u*4+1],v=d[u*4+2],U=d[u*4+3];const Pt=1/Math.hypot(A,B,v,U);A*=Pt,B*=Pt,v*=Pt,U*=Pt}let y=1,S=1,F=1;h&&(y=Math.exp(h[u*3+0]),S=Math.exp(h[u*3+1]),F=Math.exp(h[u*3+2]));const C=A+A,w=B+B,E=v+v,Q=A*C,T=A*w,j=A*E,ue=B*w,ee=B*E,N=v*E,M=U*C,O=U*w,W=U*E,ae=1-(ue+N),z=T+W,K=j-O,$=T-W,re=1-(Q+N),ce=ee+M,Ae=j+O,Qe=ee-M,Ve=1-(Q+ue),H=ae*y,ie=z*y,le=K*y,ge=$*S,Ie=re*S,me=ce*S,ye=Ae*F,Se=Qe*F,Me=Ve*F,Ze=H*H+ge*ge+ye*ye,$e=H*ie+ge*Ie+ye*Se,ct=H*le+ge*me+ye*Me,ja=ie*ie+Ie*Ie+Se*Se,ba=ie*le+Ie*me+Se*Me,Ra=le*le+me*me+Me*Me,Xt=m;i[Xt+0]=Ze,i[Xt+1]=$e,i[Xt+2]=ct,i[Xt+3]=Ra;const Qa=Ka(ja)&65535,Ta=Ka(ba)&65535;r[m+3]=Qa|Ta<<16}this.transformA=new Hn().create(e,t,r),this.transformA.name="transformA",this.transformA.minFilter="nearest",this.transformA.magFilter="nearest",this.transformA.addressModeU="clamp-to-edge",this.transformA.addressModeV="clamp-to-edge",this.transformB=new Ts().create(e,t,i,!1),this.transformB.name="transformB",this.transformB.minFilter="nearest",this.transformB.magFilter="nearest",this.transformB.mipmapFilter="nearest",this.transformB.addressModeU="clamp-to-edge",this.transformB.addressModeV="clamp-to-edge"}updateWorldPositions(){if(!this._positions)return;const s=this.object3D.transform.worldMatrix,e=this._positions,t=this._fullCount;this._worldPositions||(this._worldPositions=new Float32Array(e.length));const a=s.rawData;for(let r=0;r<t;r++){const i=r*3,n=e[i+0],o=e[i+1],l=e[i+2];this._worldPositions[i+0]=a[0]*n+a[4]*o+a[8]*l+a[12],this._worldPositions[i+1]=a[1]*n+a[5]*o+a[9]*l+a[13],this._worldPositions[i+2]=a[2]*n+a[6]*o+a[10]*l+a[14]}this._centersSent=!1}scheduleOrder(s){if(this.count===0)return;const e=this.object3D.transform.localChange;(e||!this._worldPositions)&&this.updateWorldPositions();const t=s.rawData,a=t[2],r=t[6],i=t[10],n=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),o=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),l=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]),c=performance.now(),f=(c-this._lastSentTime)/1e3,d=Math.floor(n*1e3)^Math.floor(o*1e3)^Math.floor(l*1e3),h=Math.floor(a*1e3)^Math.floor(r*1e3)^Math.floor(i*1e3),u=d^h;if(u===this._lastViewMatrixHash&&!e)return;let m=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const p=Math.abs(u-this._lastViewMatrixHash)/Math.max(f,.001);p<1e3?m=this._minIntervalMs:p<1e4?m=this._minIntervalMs*.5:m=this._minIntervalMs*.2,this._lastCameraSpeed=p}if(!(c-this._lastSentTime<m)){if(this._lastViewMatrixHash=u,this._lastSentTime=c,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=A=>{const B=A.data.order,v=this._orderData.buffer;this._sortWorker.postMessage({order:v},[v]);const U=new Uint32Array(B),y=this.size.x*this.size.y,S=this.count;(!this._orderData||this._orderData.length!==y)&&(this._orderData=new Uint32Array(y));const F=Math.min(S,U.length);if(this._orderData.set(U.subarray(0,F),0),F<y){const E=S>0?S-1:0;this._orderData.fill(E,F,y)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const C=Math.max(0,Math.min(this.count,A.data.count|0));this.texParams[2]=C;const w=Math.ceil(C/this._batchSize);this.instanceCount=w};const g=this._worldPositions||this._positions,p=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let A=0;A<this._mapping.length;++A){const B=this._mapping[A]*3,v=A*3;p[v+0]=g[B+0],p[v+1]=g[B+1],p[v+2]=g[B+2]}const D=new Uint32Array(this.count);for(let A=0;A<this.count;A++)D[A]=A;this._sortWorker.postMessage({order:D.buffer,centers:p.buffer,mapping:this._mapping},[D.buffer,p.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const g=this._worldPositions||this._positions,p=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let D=0;D<this._mapping.length;++D){const A=this._mapping[D]*3,B=D*3;p[B+0]=g[A+0],p[B+1]=g[A+1],p[B+2]=g[A+2]}this._sortWorker.postMessage({type:"centers",centers:p.buffer,mapping:this._mapping?this._mapping:null},[p.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:n,y:o,z:l},cameraDirection:{x:-a,y:-r,z:-i}})}}createSortWorker(){function s(){let n,o,l,c,f,d=!1;const h={x:0,y:0,z:0},u={x:0,y:0,z:0},m={x:0,y:0,z:0},g={x:0,y:0,z:0};let p,D;const A=(v,U,y)=>{for(;v<=U;){const S=U+v>>1,F=y(S);if(F>0)v=S+1;else if(F<0)U=S-1;else return S}return~v},B=()=>{if(!n||!o||!c||!f)return;const v=c.x,U=c.y,y=c.z,S=f.x,F=f.y,C=f.z,w=.001;if(!d&&Math.abs(v-h.x)<w&&Math.abs(U-h.y)<w&&Math.abs(y-h.z)<w&&Math.abs(S-u.x)<w&&Math.abs(F-u.y)<w&&Math.abs(C-u.z)<w)return;d=!1,h.x=v,h.y=U,h.z=y,u.x=S,u.y=F,u.z=C;const E=o.length/3;p?.length!==E&&(p=new Uint32Array(E));let Q,T;for(let O=0;O<8;++O){const W=(O&1?m.x:g.x)-v,ae=(O&2?m.y:g.y)-U,z=(O&4?m.z:g.z)-y,K=W*S+ae*F+z*C;O===0?Q=T=K:(Q=Math.min(Q,K),T=Math.max(T,K))}D?D.fill(0):D=new Uint32Array(65537);const j=T-Q,ue=j<1e-6?0:1/j*2**16;for(let O=0;O<E;++O){const W=O*3,ae=o[W+0]-v,z=o[W+1]-U,K=o[W+2]-y,$=ae*S+z*F+K*C,re=Math.floor(($-Q)*ue);p[O]=re,D[re]++}for(let O=1;O<65537;O++)D[O]+=D[O-1];for(let O=0;O<E;O++){const W=p[O],ae=--D[W];n[ae]=O}const ee=O=>p[n[O]]/ue+Q,N=()=>{const O=A(0,E-1,W=>-ee(W));return Math.min(E,Math.abs(O))},M=ee(E-1)>=0?N():E;if(l)for(let O=0;O<E;++O)n[O]=l[n[O]];self.postMessage({order:n.buffer,count:M},[n.buffer]),n=null};self.onmessage=v=>{if(v.data.order&&(n=new Uint32Array(v.data.order)),v.data.centers){o=new Float32Array(v.data.centers),m.x=g.x=o[0],m.y=g.y=o[1],m.z=g.z=o[2];const U=o.length/3;for(let y=1;y<U;++y){const S=o[y*3+0],F=o[y*3+1],C=o[y*3+2];m.x=Math.min(m.x,S),m.y=Math.min(m.y,F),m.z=Math.min(m.z,C),g.x=Math.max(g.x,S),g.y=Math.max(g.y,F),g.z=Math.max(g.z,C)}d=!0}v.data.hasOwnProperty("mapping")&&(l=v.data.mapping?new Uint32Array(v.data.mapping):null,d=!0),v.data.cameraPosition&&(c=v.data.cameraPosition),v.data.cameraDirection&&(f=v.data.cameraDirection),B()}}const e=`(${s.toString()})()`,t=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(t);return new Worker(a)}nodeUpdate(s,e,t,a){const r=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(r);const i=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;i!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=i),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(s,e,t,a)}renderPass(s,e,t){const a=t.encoder;for(let r of this.materials){const i=r.getPass(e);if(!(!i||i.length===0))for(const n of i){if(!n.pipeline)continue;n.apply(this.geometry,t.rendererPassState||t),k.bindPipeline(a,n),k.bindGeometryBuffer(a,this.geometry);const l=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?k.drawIndexed(a,l.indexCount,this.instanceCount,l.indexStart,0,0):k.drawIndexed(a,l.indexCount,1,l.indexStart,0,0)}}}destroy(s){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(s),this.splatColor=null),this.transformA&&(this.transformA.destroy(s),this.transformA=null),this.transformB&&(this.transformB.destroy(s),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(s),this.splatOrder=null),this._positions=null,this._worldPositions=null,this._orderData=null,this.texParams=null,this._mapping=null,super.destroy(s)}};ii=j2([Ot(ii,"GSplatRenderer")],ii);const F0=`
|
|
6023
|
+
`;class At{computes;passShader;constructor(){this.computes=[],this.passShader=new Map}addRenderPass(e,t=-1){let a=this.passShader.get(e.passType)||[];t==-1?a.push(e):a.splice(t,-1,e),this.passShader.set(e.passType,a)}removeShader(e,t=-1){let a=this.passShader.get(e.passType);if(a)if(t==-1){let r=a.indexOf(e);r!=-1&&a.splice(r)}else a.splice(t,1)}removeShaderByIndex(e,t=-1){let a=this.passShader.get(e);a&&(t==-1?this.passShader.delete(e):a.splice(t,1))}getSubShaders(e){return this.passShader.get(e)||[]}hasSubShaders(e){return this.passShader.get(e).length>0}getDefaultShaders(){return this.passShader.get(fe.COLOR)}getDefaultColorShader(){return this.passShader.get(fe.COLOR)[0]}setDefine(e,t){for(const a of this.passShader)for(const r of a[1])r.setDefine(e,t)}hasDefine(e){for(const t of this.passShader)for(const a of t[1]){let r=a.hasDefine(e);if(r)return r}return!1}deleteDefine(e){for(const t of this.passShader)for(const a of t[1])a.deleteDefine(e)}setUniform(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniform(e,t)}setUniformFloat(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformFloat(e,t)}setUniformVector2(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformVector2(e,t)}setUniformVector3(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformVector3(e,t)}setUniformVector4(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformVector4(e,t)}setUniformColor(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformColor(e,t)}getUniform(e){return this.getDefaultColorShader().getUniform(e)}getUniformFloat(e){return this.getDefaultColorShader().getUniformFloat(e)}getUniformVector2(e){return this.getDefaultColorShader().getUniformVector2(e)}getUniformVector3(e){return this.getDefaultColorShader().getUniformVector3(e)}getUniformVector4(e){return this.getDefaultColorShader().getUniformVector4(e)}getUniformColor(e){return this.getDefaultColorShader().getUniformColor(e)}setTexture(e,t){for(const a of this.passShader)for(const r of a[1])r.setTexture(e,t);this.setDefine(`USE_${e.toLocaleUpperCase()}`,!0)}getTexture(e){return this.getDefaultColorShader().textures[e]}setUniformBuffer(e,t){for(const a of this.passShader)for(const r of a[1])r.setUniformBuffer(e,t)}getUniformBuffer(e){return this.getDefaultColorShader().getBuffer(e)}setStorageBuffer(e,t){for(const a of this.passShader)for(const r of a[1])r.setStorageBuffer(e,t)}getStorageBuffer(e){return this.getDefaultColorShader().getBuffer(e)}setStructStorageBuffer(e,t){for(const a of this.passShader)for(const r of a[1])r.setStructStorageBuffer(e,t)}getStructStorageBuffer(e){return this.getDefaultColorShader().getBuffer(e)}noticeValueChange(){for(const e of this.passShader)for(const t of e[1])t.noticeValueChange()}destroy(e){for(const t of this.passShader)for(const a of t[1])a.destroy(e);this.passShader.clear(),this.passShader=null,this.computes=null}clone(){let e=new At,t=this.getDefaultShaders();for(const a of t)e.addRenderPass(a);return e}applyUniform(){for(const e of this.passShader)for(const t of e[1])t.applyUniform()}}var L2=Object.getOwnPropertyDescriptor,G2=(s,e,t,a)=>{for(var r=a>1?void 0:a?L2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Si=class extends At{constructor(){super();const s=new qe("gsplat_vs_dc","gsplat_fs_dc");s.passType=fe.COLOR,s.setShaderEntry("VertMain","FragMain"),s.topology=Ss.triangle_list,s.depthWriteEnabled=!1,s.cullMode=Lt.none,s.shaderState.transparent=!0,s.shaderState.blendMode=De.NORMAL,s.shaderState.writeMasks=[15,0],s.shaderState.castReflection=!1,s.shaderState.depthCompare=nt.less,this.addRenderPass(s),this.setDefault()}setDefault(){const s=this.getDefaultColorShader(),e=new R;s.setUniform("modelMatrix",e.rawData),s.setUniform("pixelCull",new Float32Array([2,0,0,0]))}};Si=G2([Na(Si,"GSplatShader")],Si);class Yn extends vt{_pixelCullArray=new Float32Array(4);constructor(){super(),Y.register("gsplat_vs_dc",D0),Y.register("gsplat_fs_dc",_0),this.shader=new Si}setSplatTextures(e,t,a,r,i){const n=this.shader.getDefaultColorShader();n.setTexture("splatColor",e),n.setTexture("transformA",t),n.setTexture("transformB",a),n.setUniformArray("tex_params",r),i&&n.setTexture("splatOrder",i),n.shaderState.depthCompare=nt.less}setTransformMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}setPixelCulling(e,t,a=0,r=128){this._pixelCullArray[0]=e,this._pixelCullArray[1]=t,this._pixelCullArray[2]=a,this._pixelCullArray[3]=r,this.shader.getDefaultColorShader().setUniform("pixelCull",this._pixelCullArray)}setTexParams(e){this.shader.getDefaultColorShader().setUniformArray("tex_params",e)}}class Rs extends Ya{node;constructor(e){super(),this.bufferType=Aa.VertexGPUBuffer,this.createVertexBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,e)}createVertexBuffer(e,t){let a=I.device;this.byteSize=t*Float32Array.BYTES_PER_ELEMENT,this.usage=e,this.buffer&&this.destroy(),this.buffer=a.createBuffer({label:"VertexGPUBuffer",size:this.byteSize,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),this.node=this.memory.allocation_node(this.byteSize)}}var kt=(s=>(s[s.split=0]="split",s[s.compose=1]="compose",s[s.compose_bin=2]="compose_bin",s))(kt||{});class B0{vertexCount=0;vertexGPUBuffer;geometryType=kt.compose;_vertexBufferLayouts;_attributeSlotLayouts;_attributeLocation;constructor(){this._vertexBufferLayouts=[],this._attributeLocation={},this._attributeSlotLayouts=[]}get vertexBufferLayouts(){return this._vertexBufferLayouts}createVertexBuffer(e,t){switch(this.geometryType){case kt.split:this.createSplitVertexBuffer(e,t);break;case kt.compose:this.createComposeVertexBuffer(e,t);break;case kt.compose_bin:this.createComposBinVertexBuffer(e,t);break}}createSplitVertexBuffer(e,t){let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:0,shaderLocation:i.location,stride:dr[i.format]};this._attributeSlotLayouts[i.location]=[n];let o=e.get(i.name);o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o));let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l,this._vertexBufferLayouts[i.location]={name:i.name,arrayStride:i.size*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[i.location],offset:a*4,size:this.vertexCount*i.size*4},a+=this.vertexCount*i.size}this.vertexGPUBuffer=new Rs(a)}createComposeVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index"||i.type=="builtin")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:a*4,shaderLocation:i.location,stride:dr[i.format]};this._attributeSlotLayouts[0][i.location]=n;let o=e.get(i.name);if(o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o)),o.data){let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l}a+=i.size}this._vertexBufferLayouts[0]={name:"composeStruct",arrayStride:a*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[0],offset:0,size:this.vertexCount*a*4},this.vertexGPUBuffer=new Rs(this.vertexCount*a)}createComposBinVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let n=0;n<t.attributes.length;n++){const o=t.attributes[n];if(o.name=="index"||o.type=="builtin")continue;this._attributeLocation[o.name]=o.location;let l={name:o.name,format:o.format,offset:a*4,shaderLocation:o.location,stride:dr[o.format]};this._attributeSlotLayouts[0][o.location]=l;let c=e.get(o.name);if(c||(c={attribute:o.name,data:new Float32Array(o.size*this.vertexCount)},e.set(o.name,c)),c.data){let f=c.data.length/l.stride;this.vertexCount!=0&&this.vertexCount!=f&&console.error(" vertex count not match attribute count"),this.vertexCount=f}a+=o.size}let i=e.get(G.all).data.length/a;this.vertexCount=i,this._vertexBufferLayouts[0]={name:"composeStruct",arrayStride:a*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[0],offset:0,size:this.vertexCount*a*4},this.vertexGPUBuffer=new Rs(this.vertexCount*a)}upload(e,t){if(this.vertexGPUBuffer){switch(this.geometryType){case kt.split:{let a=this._attributeLocation[e],r=this._vertexBufferLayouts[a];this.vertexGPUBuffer.node.setFloat32Array(r.offset/4,t.data)}break;case kt.compose:for(let a=0;a<this.vertexCount;a++){const r=this._attributeSlotLayouts[0][this._attributeLocation[e]];for(let i=0;i<r.stride;i++){let n=t.data[a*r.stride+i],o=a*(this._vertexBufferLayouts[0].arrayStride/4)+r.offset/4+i;this.vertexGPUBuffer.node.setFloat(n,o)}}break;case kt.compose_bin:this.vertexGPUBuffer.node.setFloat32Array(0,t.data);break}this.vertexGPUBuffer?.apply()}}updateAttributes(e){switch(this.geometryType){case kt.split:for(let t=0;t<this._vertexBufferLayouts.length;t++){const a=this._vertexBufferLayouts[t];let r=e.get(a.name);this.vertexGPUBuffer.node.setFloat32Array(a.offset/4,r.data)}break;case kt.compose:for(let t=0;t<this.vertexCount;t++)this._attributeSlotLayouts.forEach(a=>{for(let r=0;r<a.length;r++){const i=a[r];let n=e.get(i.name);for(let o=0;o<i.stride;o++){let l=n.data[t*i.stride+o],c=t*(this._vertexBufferLayouts[0].arrayStride/4)+i.offset/4+o;this.vertexGPUBuffer.node.setFloat(l,c)}}});break;case kt.compose_bin:{let t=e.get(G.all);this.vertexGPUBuffer.node.setFloat32Array(0,t.data)}break}this.vertexGPUBuffer.apply()}compute(){}destroy(e){this.vertexCount=null,this.geometryType=null,this._vertexBufferLayouts=null,this._attributeSlotLayouts=null,this._attributeLocation=null,this.vertexGPUBuffer&&this.vertexGPUBuffer.destroy(e),this.vertexGPUBuffer=null}}class v0 extends Ya{indicesNode;constructor(e){super(),this.bufferType=Aa.IndicesGPUBuffer,this.createIndicesBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.INDEX|GPUBufferUsage.INDIRECT,e)}createIndicesBuffer(e,t){let a=I.device;if(this.byteSize=t.length*4,this.usage=e,this.buffer&&this.destroy(),this.buffer=a.createBuffer({label:"IndicesGPUBuffer",size:this.byteSize,usage:e,mappedAtCreation:!1}),this.memory=new cr,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),t){this.indicesNode=this.memory.allocation_node(t.length*4);const r=t.buffer instanceof ArrayBuffer?t.buffer:new Uint8Array(t.buffer).buffer;this.indicesNode.setArrayBuffer(0,r),this.apply()}}}class x0{uuid="";name;indicesGPUBuffer;indicesFormat="uint16";indicesCount=0;constructor(){}createIndicesBuffer(e){e.data instanceof Uint16Array?this.indicesFormat="uint16":e.data instanceof Uint32Array&&(this.indicesFormat="uint32"),this.indicesCount=e.data.length,this.indicesGPUBuffer=new v0(e.data)}upload(e){this.indicesGPUBuffer.indicesNode.setArrayBuffer(0,e),this.indicesGPUBuffer.apply()}compute(){}destroy(){this.uuid=null,this.name=null,this.indicesFormat=null,this.indicesCount=null,this.indicesGPUBuffer.destroy(),this.indicesGPUBuffer=null}}class U0{lodLevels}class Le{instanceID;name;subGeometries=[];morphTargetsRelative;morphTargetDictionary;skinNames;bindPose;blendShapeData;vertexDim;vertexCount=0;_bounds;_attributeMap;_attributes;_indicesBuffer;_vertexBuffer;_onChange=!0;_wireframeLines;_isDestroyed=!1;constructor(){this.instanceID=zt(),this._attributeMap=new Map,this._attributes=[],this._vertexBuffer=new B0}get indicesBuffer(){return this._indicesBuffer}get vertexBuffer(){return this._vertexBuffer}get vertexAttributes(){return this._attributes}get vertexAttributeMap(){return this._attributeMap}get geometryType(){return this._vertexBuffer.geometryType}set geometryType(e){this._vertexBuffer.geometryType=e}get bounds(){if(!this._bounds){this._bounds=new Ce(new b,new b(1,1,1)),this._bounds.min.x=Number.MAX_VALUE,this._bounds.min.y=Number.MAX_VALUE,this._bounds.min.z=Number.MAX_VALUE,this._bounds.max.x=-Number.MAX_VALUE,this._bounds.max.y=-Number.MAX_VALUE,this._bounds.max.z=-Number.MAX_VALUE;let e=this.getAttribute(G.position);if(e&&e.data)for(let t=0;t<e.data.length/3;t++){const a=e.data[t*3+0],r=e.data[t*3+1],i=e.data[t*3+2];this._bounds.min.x>a&&(this._bounds.min.x=a),this._bounds.min.y>r&&(this._bounds.min.y=r),this._bounds.min.z>i&&(this._bounds.min.z=i),this._bounds.max.x<a&&(this._bounds.max.x=a),this._bounds.max.y<r&&(this._bounds.max.y=r),this._bounds.max.z<i&&(this._bounds.max.z=i)}this._bounds.setFromMinMax(this._bounds.min,this._bounds.max)}return this._bounds}set bounds(e){this._bounds=e}addSubGeometry(...e){let t=new U0;return t.lodLevels=e,this.subGeometries.push(t),t}generate(e){this._onChange&&(this._onChange=!1,this._indicesBuffer.upload(this.getAttribute(G.indices).data),this._vertexBuffer.createVertexBuffer(this._attributeMap,e),this._vertexBuffer.updateAttributes(this._attributeMap),this.vertexCount=this._vertexBuffer.vertexCount)}setIndices(e){if(!this._attributeMap.has(G.indices)){let t={attribute:G.indices,data:e};this._attributeMap.set(G.indices,t),this._indicesBuffer=new x0,this._indicesBuffer.createIndicesBuffer(t)}}setAttribute(e,t){if(e==G.indices)this.setIndices(t);else{let a={attribute:e,data:t};this._attributeMap.set(e,a),this._attributes.push(e)}}getAttribute(e){return this._attributeMap.get(e)}hasAttribute(e){return this._attributeMap.has(e)}genWireframe(){if(this._wireframeLines)return this._wireframeLines;if(this.geometryType==kt.split||this.geometryType==kt.compose){let e=this.getAttribute(G.position),t=this.getAttribute(G.indices);if(t&&e&&t.data.length>0){let a=e.data,r=[];for(let i=0;i<t.data.length/3;i++){const n=t.data[i*3+0],o=t.data[i*3+1],l=t.data[i*3+2];let c=new b(a[n*3+0],a[n*3+1],a[n*3+2]),f=new b(a[o*3+0],a[o*3+1],a[o*3+2]),d=new b(a[l*3+0],a[l*3+1],a[l*3+2]);r.push(c,f),r.push(f,d),r.push(d,c)}return this._wireframeLines=r,r}}else if(this.geometryType==kt.compose_bin){let e=this.getAttribute(G.all),t=this.vertexDim,a=this.getAttribute(G.indices);if(a&&e&&a.data.length>0){let r=e.data,i=[];for(let n=0;n<a.data.length/3;n++){const o=a.data[n*3+0],l=a.data[n*3+1],c=a.data[n*3+2];let f=new b(r[o*t+0],r[o*t+1],r[o*t+2]),d=new b(r[l*t+0],r[l*t+1],r[l*t+2]),h=new b(r[c*t+0],r[c*t+1],r[c*t+2]);i.push(f,d),i.push(d,h),i.push(h,f)}return this._wireframeLines=i,i}}return null}compute(){this._indicesBuffer&&this._indicesBuffer.compute(),this._vertexBuffer&&this._vertexBuffer.compute()}static crossA=b.UP.clone();static crossB=b.UP.clone();static crossRet=b.UP.clone();static point1=b.UP.clone();static point2=b.UP.clone();static point3=b.UP.clone();computeNormals(){let e=this.getAttribute(G.position),t=this.getAttribute(G.normal),a=this.getAttribute(G.indices);if(!e||!t||!a)return this;let r=a.data.length/3,i=Le.point1,n=Le.point2,o=Le.point3,l=Le.crossA,c=Le.crossB,f=Le.crossRet;for(let d=0;d<r;d++){let h=a.data[d*3],u=a.data[d*3+1],m=a.data[d*3+2];i.set(e.data[h*3],e.data[h*3+1],e.data[h*3+2]),n.set(e.data[u*3],e.data[u*3+1],e.data[u*3+2]),o.set(e.data[m*3],e.data[m*3+1],e.data[m*3+2]),b.sub(i,n,l).normalize(),b.sub(i,o,c).normalize();let g=l.crossProduct(c,f).normalize();t.data[h*3]=t.data[u*3]=t.data[m*3]=g.x,t.data[h*3+1]=t.data[u*3+1]=t.data[m*3+1]=g.y,t.data[h*3+2]=t.data[u*3+2]=t.data[m*3+2]=g.z}return this._vertexBuffer.upload(G.normal,t),this}isPrimitive(){return!1}destroy(e){this._isDestroyed||(this.instanceID=null,this.name=null,this.subGeometries=null,this.morphTargetDictionary=null,this.skinNames=null,this.bindPose=null,this.blendShapeData=null,this._wireframeLines=null,this._bounds&&(this._bounds.destroy(),this._bounds=null),this._attributeMap&&(this._attributeMap.forEach(t=>{t&&t.data&&(t.data=null)}),this._attributeMap.clear(),this._attributeMap=null),this._attributes=null,this._indicesBuffer&&(this._indicesBuffer.destroy(),this._indicesBuffer=null),this._vertexBuffer&&(this._vertexBuffer.destroy(),this._vertexBuffer=null),this._isDestroyed=!0)}}class Xn extends Le{batchSize;constructor(e=128){super(),this.batchSize=e;const t=new Float32Array(12*e);for(let r=0;r<e;++r)t.set([-1,-1,r,1,-1,r,1,1,r,-1,1,r],r*12);const a=new Uint32Array(6*e);for(let r=0;r<e;++r){const i=r*4;a.set([0+i,1+i,2+i,0+i,2+i,3+i],r*6)}this.setAttribute(G.position,t),this.setIndices(a),this.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:t.length/3,firstStart:0,index:0,topology:0})}}class Fi extends ut{_dataBuffer;create(e,t,a,r=!1){let i=I.device;const n=Math.ceil(e*4/256)*256;this.format=oe.rgba8unorm,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const o=this._dataBuffer=i.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});i.queue.writeBuffer(o,0,a.buffer);const l=k.beginCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(l),r&&wa.webGPUGenerateMipmap(this),this}updateTexture(e,t,a,r,i){let n=I.device;const o=Math.ceil(e*4/256)*256;if(this.mipmapCount=Math.floor(Math.log2(e)),r!==void 0&&i!==void 0&&i<t){const f=i,d=r*e*4,h=a.subarray(d,d+f*e*4),u=h.byteLength;(!this._dataBuffer||this._dataBuffer.size<u)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=n.createBuffer({size:u,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),n.queue.writeBuffer(this._dataBuffer,0,h.buffer,h.byteOffset,h.byteLength);const m=k.beginCommandEncoder();m.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:o,offset:0},{texture:this.getGPUTexture(),origin:[0,r,0]},{width:e,height:f,depthOrArrayLayers:1}),k.endCommandEncoder(m);return}this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null;const l=this._dataBuffer=n.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});n.queue.writeBuffer(l,0,a.buffer);const c=k.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:o},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(c),this.gpuSampler=n.createSampler(this),this.mipmapCount>1&&wa.webGPUGenerateMipmap(this)}}class Hn extends ut{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4*4;this.format=oe.rgba32uint,this.createTextureDescriptor(e,t,1,this.format);const o=this._dataBuffer=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,a.buffer);const l=r.createCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),r.queue.submit([l.finish()]),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="uint",this.gpuSampler=r.createSampler({}),this}updateTexture(e,t,a,r,i){let n=I.device;const o=e*4*4;if(r!==void 0&&i!==void 0&&i<t){const l=i,c=r*e*4,f=a.subarray(c,c+l*e*4);n.queue.writeTexture({texture:this.getGPUTexture(),origin:[0,r,0]},f.buffer,{bytesPerRow:o,offset:f.byteOffset},{width:e,height:l,depthOrArrayLayers:1});return}n.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:o},{width:e,height:t,depthOrArrayLayers:1})}}class Qs extends ut{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4;this.format=oe.r32uint,this.createTextureDescriptor(e,t,1,this.format);const o=this._dataBuffer=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,a.buffer);const l=r.createCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),r.queue.submit([l.finish()]),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="uint",this.gpuSampler=r.createSampler({}),this}updateTexture(e,t,a){let r=I.device;const i=e*4;r.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:i},{width:e,height:t,depthOrArrayLayers:1})}}const y0=new Float32Array(1),z2=new Int32Array(y0.buffer);function C0(s,e,t,a){for(let r=0;r<a;r++){const i=s[t+r];y0[0]=i;const n=z2[0];let o=n>>16&32768,l=n>>12&2047;const c=n>>23&255;if(c<103){e[t+r]=o;continue}if(c>142){o|=31744,o|=(c==255?1:0)&&n&8388607,e[t+r]=o;continue}if(c<114){l|=2048,o|=(l>>114-c)+(l>>113-c&1),e[t+r]=o;continue}o|=c-112<<10|l>>1,o+=l&1,e[t+r]=o}}class Ts extends ut{uint16Array;floatArray;_dataBuffer;create(e,t,a=null,r=!0){if(a==null){a=[];for(let i=0,n=e*t*4;i<n;i++)a[i]=0}return this.updateTexture(e,t,a,r),this}updateTexture(e,t,a,r=!0,i,n){(e!=this.width||t!=this.height)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null,this.gpuTexture&&this.gpuTexture.destroy(),this.gpuTexture=null),this.floatArray=a;let o=I.device;const l=e*4*2;if(this.format=oe.rgba16float,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format),i!==void 0&&n!==void 0&&n<t){const h=n,u=i*e*4,m=h*e*4;(!this.uint16Array||this.uint16Array.length<u+m)&&(!this.uint16Array||this.uint16Array.length<a.length)&&(this.uint16Array=new Uint16Array(a.length));const g=this.uint16Array;C0(a,g,u,m);const p=g.subarray(u,u+m),D=p.byteLength;(!this._dataBuffer||this._dataBuffer.size<D)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=o.createBuffer({size:D,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),o.queue.writeBuffer(this._dataBuffer,0,p.buffer,p.byteOffset,p.byteLength);const A=k.beginCommandEncoder();A.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:l,offset:0},{texture:this.getGPUTexture(),origin:[0,i,0]},{width:e,height:h,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),k.endCommandEncoder(A);return}(!this.uint16Array||this.uint16Array.length!=a.length)&&(this.uint16Array=new Uint16Array(a.length));const c=this.uint16Array;C0(a,c,0,a.length);const f=c.byteLength;(!this._dataBuffer||this._dataBuffer.size<f)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=o.createBuffer({size:f,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),o.queue.writeBuffer(this._dataBuffer,0,c.buffer,c.byteOffset,c.byteLength);const d=k.beginCommandEncoder();d.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:l},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),k.endCommandEncoder(d),this.gpuSampler=o.createSampler(this),this.gpuTexture=this.getGPUTexture(),this.mipmapCount>1&&wa.webGPUGenerateMipmap(this)}}const S0=new Float32Array(1),W2=new Int32Array(S0.buffer);let Ka=function(s){S0[0]=s;const e=W2[0];let t=e>>16&32768,a=e>>12&2047;const r=e>>23&255;return r<103?t:r>142?(t|=31744,t|=(r==255?1:0)&&e&8388607,t):r<114?(a|=2048,t|=(a>>114-r)+(a>>113-r&1),t):(t|=r-112<<10|a>>1,t+=a&1,t)};var J2=Object.getOwnPropertyDescriptor,j2=(s,e,t,a)=>{for(var r=a>1?void 0:a?J2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ii=class extends Ba{count=0;size=new de;splatColor;transformA;transformB;texParams;splatOrder;gsplatMaterial;_positions;get positions(){return this._positions}_worldPositions;_orderData;_sortWorker;_lastSentTime=0;_minIntervalMs=16;_centersSent=!1;_lastViewMatrixHash=0;_lastCameraSpeed=0;_adaptiveSorting=!0;_lastPixelCullParams="";_texturesInitialized=!1;_lodEnabled=!1;_lodDistances=[5,10,20,40];_lodRatios=[1,.75,.5,.25,.1];_currentLodLevel=0;_minPixelCoverage=4;_maxPixelCoverage=0;_maxPixelCullDistance=0;_mapping=null;_fullCount=0;get fullCount(){return this._fullCount}_batchSize=128;instanceCount=0;constructor(){super()}initAsset(s){this.count=s.count,this._fullCount=s.count,this.size=this.evalTextureSize(s.count),this.buildColor(s),this.buildTransform(s),this.texParams=new Float32Array([this.count,this.size.x,this.count,1]),this._positions=s.position;const e=this.size.x*this.size.y;this._orderData=new Uint32Array(e);for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;this.splatOrder=new Qs().create(this.size.x,this.size.y,this._orderData),this.splatOrder.name="splatOrder",this.splatOrder.minFilter="nearest",this.splatOrder.magFilter="nearest",this.splatOrder.addressModeU="clamp-to-edge",this.splatOrder.addressModeV="clamp-to-edge",this.gsplatMaterial=new Yn,this.geometry=new Xn(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}onBeforeUpdate(s){this.count>0&&s?.camera&&(this._lodEnabled&&this.updateLOD(s),s.camera.viewMatrix&&this.scheduleOrder(s.camera.viewMatrix))}updateLOD(s){if(!this._worldPositions||this._fullCount===0)return;const t=s.camera.viewMatrix.rawData,a=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),r=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),i=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]);let n=0,o=0,l=0;const c=Math.min(100,this._fullCount);for(let g=0;g<c;g++){const p=Math.floor(g/c*this._fullCount)*3;n+=this._worldPositions[p+0],o+=this._worldPositions[p+1],l+=this._worldPositions[p+2]}n/=c,o/=c,l/=c;const f=a-n,d=r-o,h=i-l,u=Math.sqrt(f*f+d*d+h*h);let m=this._lodDistances.length;for(let g=0;g<this._lodDistances.length;g++)if(u<this._lodDistances[g]){m=g;break}if(m!==this._currentLodLevel){this._currentLodLevel=m;const g=this._lodRatios[m],p=Math.floor(this._fullCount*g);if(this._mapping){const D=this._mapping;this._mapping=new Uint32Array(Math.min(p,D.length));for(let A=0;A<this._mapping.length;A++)this._mapping[A]=D[A];this.setMapping(this._mapping)}else this.count=p,this.texParams[0]=this.count,this.texParams[2]=this.count}}setMapping(s){this._mapping=s&&s.length>0?s:null,this.count=this._mapping?this._mapping.length:this._fullCount,this.texParams[0]=this.count,this.texParams[2]=Math.min(this.texParams[0],this.count);const e=this.size.x*this.size.y;for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;if(this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData),this._sortWorker){const t=this._worldPositions||this._positions,a=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(t);if(this._mapping)for(let r=0;r<this._mapping.length;++r){const i=this._mapping[r]*3,n=r*3;a[n+0]=t[i+0],a[n+1]=t[i+1],a[n+2]=t[i+2]}this._sortWorker.postMessage({type:"centers",centers:a.buffer,mapping:this._mapping?this._mapping:null},[a.buffer]),this._centersSent=!0}else this._centersSent=!1;this.instanceCount=0}setVisBoost(s){this.texParams[3]=Math.max(0,s)}setSortThrottle(s){this._minIntervalMs=Math.max(0,s|0)}setAdaptiveSorting(s){this._adaptiveSorting=s}setLOD(s,e,t){this._lodEnabled=s,e&&(this._lodDistances=e),t&&(this._lodRatios=t)}getLODStats(){return{enabled:this._lodEnabled,currentLevel:this._currentLodLevel,distances:this._lodDistances,ratios:this._lodRatios,currentRatio:this._lodRatios[this._currentLodLevel],visibleCount:this._lodEnabled?Math.floor(this._fullCount*this._lodRatios[this._currentLodLevel]):this._fullCount}}setPixelCulling(s,e=0,t=0){this._minPixelCoverage=Math.max(0,s),this._maxPixelCoverage=Math.max(0,e),this._maxPixelCullDistance=Math.max(0,t)}getPixelCullingStats(){return{minPixels:this._minPixelCoverage,maxPixels:this._maxPixelCoverage,maxPixelCullDistance:this._maxPixelCullDistance,maxEnabled:this._maxPixelCoverage>0,distanceEnabled:this._maxPixelCullDistance>0}}getBatchingStats(){return{enabled:!0,batchSize:this._batchSize,instanceCount:this.instanceCount,splatCount:this.count,reduction:this.count>0?(1-this.instanceCount/this.count)*100:0}}evalTextureSize(s){let e=Math.ceil(Math.sqrt(s));const t=64;e=Math.ceil(e/t)*t;const a=Math.ceil(s/e);return new de(e,a)}buildColor(s){const e=this.size.x|0,t=this.size.y|0,a=new Uint8Array(e*t*4),r=.28209479177387814,i=s.count,n=s.sh?.coeffs,o=n?n.length/(3*i):1;for(let l=0;l<i;l++){let c=.5,f=.5,d=.5;if(n&&o>=1){const m=l*o*3;c=.5+n[m+0]*r,f=.5+n[m+o+0]*r,d=.5+n[m+2*o+0]*r}const h=s.opacity?1/(1+Math.exp(-s.opacity[l])):1,u=l*4;a[u+0]=Math.max(0,Math.min(255,Math.floor(c*255))),a[u+1]=Math.max(0,Math.min(255,Math.floor(f*255))),a[u+2]=Math.max(0,Math.min(255,Math.floor(d*255))),a[u+3]=Math.max(0,Math.min(255,Math.floor(h*255)))}this.splatColor=new Fi().create(e,t,a,!1),this.splatColor.name="splatColor",this.splatColor.minFilter="nearest",this.splatColor.magFilter="nearest",this.splatColor.mipmapFilter="nearest",this.splatColor.addressModeU="clamp-to-edge",this.splatColor.addressModeV="clamp-to-edge"}buildTransform(s){const e=this.size.x|0,t=this.size.y|0,a=s.count,r=new Uint32Array(e*t*4),i=new Array(e*t*4).fill(0),n=new ArrayBuffer(4),o=new Float32Array(n),l=new Uint32Array(n),c=u=>(o[0]=u,l[0]),f=s.position,d=s.rotation,h=s.scale;for(let u=0;u<a;u++){const m=u*4,g=f[u*3+0],p=f[u*3+1],D=f[u*3+2];r[m+0]=c(g),r[m+1]=c(p),r[m+2]=c(D);let A=0,B=0,v=0,U=1;if(d){A=d[u*4+0],B=d[u*4+1],v=d[u*4+2],U=d[u*4+3];const Pt=1/Math.hypot(A,B,v,U);A*=Pt,B*=Pt,v*=Pt,U*=Pt}let y=1,S=1,F=1;h&&(y=Math.exp(h[u*3+0]),S=Math.exp(h[u*3+1]),F=Math.exp(h[u*3+2]));const C=A+A,w=B+B,E=v+v,Q=A*C,T=A*w,j=A*E,ue=B*w,ee=B*E,N=v*E,M=U*C,O=U*w,W=U*E,ae=1-(ue+N),z=T+W,K=j-O,$=T-W,re=1-(Q+N),ce=ee+M,Ae=j+O,Qe=ee-M,Ve=1-(Q+ue),H=ae*y,ie=z*y,le=K*y,ge=$*S,Ie=re*S,me=ce*S,ye=Ae*F,Se=Qe*F,Me=Ve*F,Ze=H*H+ge*ge+ye*ye,$e=H*ie+ge*Ie+ye*Se,ft=H*le+ge*me+ye*Me,ja=ie*ie+Ie*Ie+Se*Se,ba=ie*le+Ie*me+Se*Me,Ra=le*le+me*me+Me*Me,Xt=m;i[Xt+0]=Ze,i[Xt+1]=$e,i[Xt+2]=ft,i[Xt+3]=Ra;const Qa=Ka(ja)&65535,Ta=Ka(ba)&65535;r[m+3]=Qa|Ta<<16}this.transformA=new Hn().create(e,t,r),this.transformA.name="transformA",this.transformA.minFilter="nearest",this.transformA.magFilter="nearest",this.transformA.addressModeU="clamp-to-edge",this.transformA.addressModeV="clamp-to-edge",this.transformB=new Ts().create(e,t,i,!1),this.transformB.name="transformB",this.transformB.minFilter="nearest",this.transformB.magFilter="nearest",this.transformB.mipmapFilter="nearest",this.transformB.addressModeU="clamp-to-edge",this.transformB.addressModeV="clamp-to-edge"}updateWorldPositions(){if(!this._positions)return;const s=this.object3D.transform.worldMatrix,e=this._positions,t=this._fullCount;this._worldPositions||(this._worldPositions=new Float32Array(e.length));const a=s.rawData;for(let r=0;r<t;r++){const i=r*3,n=e[i+0],o=e[i+1],l=e[i+2];this._worldPositions[i+0]=a[0]*n+a[4]*o+a[8]*l+a[12],this._worldPositions[i+1]=a[1]*n+a[5]*o+a[9]*l+a[13],this._worldPositions[i+2]=a[2]*n+a[6]*o+a[10]*l+a[14]}this._centersSent=!1}scheduleOrder(s){if(this.count===0)return;const e=this.object3D.transform.localChange;(e||!this._worldPositions)&&this.updateWorldPositions();const t=s.rawData,a=t[2],r=t[6],i=t[10],n=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),o=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),l=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]),c=performance.now(),f=(c-this._lastSentTime)/1e3,d=Math.floor(n*1e3)^Math.floor(o*1e3)^Math.floor(l*1e3),h=Math.floor(a*1e3)^Math.floor(r*1e3)^Math.floor(i*1e3),u=d^h;if(u===this._lastViewMatrixHash&&!e)return;let m=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const p=Math.abs(u-this._lastViewMatrixHash)/Math.max(f,.001);p<1e3?m=this._minIntervalMs:p<1e4?m=this._minIntervalMs*.5:m=this._minIntervalMs*.2,this._lastCameraSpeed=p}if(!(c-this._lastSentTime<m)){if(this._lastViewMatrixHash=u,this._lastSentTime=c,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=A=>{const B=A.data.order,v=this._orderData.buffer;this._sortWorker.postMessage({order:v},[v]);const U=new Uint32Array(B),y=this.size.x*this.size.y,S=this.count;(!this._orderData||this._orderData.length!==y)&&(this._orderData=new Uint32Array(y));const F=Math.min(S,U.length);if(this._orderData.set(U.subarray(0,F),0),F<y){const E=S>0?S-1:0;this._orderData.fill(E,F,y)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const C=Math.max(0,Math.min(this.count,A.data.count|0));this.texParams[2]=C;const w=Math.ceil(C/this._batchSize);this.instanceCount=w};const g=this._worldPositions||this._positions,p=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let A=0;A<this._mapping.length;++A){const B=this._mapping[A]*3,v=A*3;p[v+0]=g[B+0],p[v+1]=g[B+1],p[v+2]=g[B+2]}const D=new Uint32Array(this.count);for(let A=0;A<this.count;A++)D[A]=A;this._sortWorker.postMessage({order:D.buffer,centers:p.buffer,mapping:this._mapping},[D.buffer,p.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const g=this._worldPositions||this._positions,p=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let D=0;D<this._mapping.length;++D){const A=this._mapping[D]*3,B=D*3;p[B+0]=g[A+0],p[B+1]=g[A+1],p[B+2]=g[A+2]}this._sortWorker.postMessage({type:"centers",centers:p.buffer,mapping:this._mapping?this._mapping:null},[p.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:n,y:o,z:l},cameraDirection:{x:-a,y:-r,z:-i}})}}createSortWorker(){function s(){let n,o,l,c,f,d=!1;const h={x:0,y:0,z:0},u={x:0,y:0,z:0},m={x:0,y:0,z:0},g={x:0,y:0,z:0};let p,D;const A=(v,U,y)=>{for(;v<=U;){const S=U+v>>1,F=y(S);if(F>0)v=S+1;else if(F<0)U=S-1;else return S}return~v},B=()=>{if(!n||!o||!c||!f)return;const v=c.x,U=c.y,y=c.z,S=f.x,F=f.y,C=f.z,w=.001;if(!d&&Math.abs(v-h.x)<w&&Math.abs(U-h.y)<w&&Math.abs(y-h.z)<w&&Math.abs(S-u.x)<w&&Math.abs(F-u.y)<w&&Math.abs(C-u.z)<w)return;d=!1,h.x=v,h.y=U,h.z=y,u.x=S,u.y=F,u.z=C;const E=o.length/3;p?.length!==E&&(p=new Uint32Array(E));let Q,T;for(let O=0;O<8;++O){const W=(O&1?m.x:g.x)-v,ae=(O&2?m.y:g.y)-U,z=(O&4?m.z:g.z)-y,K=W*S+ae*F+z*C;O===0?Q=T=K:(Q=Math.min(Q,K),T=Math.max(T,K))}D?D.fill(0):D=new Uint32Array(65537);const j=T-Q,ue=j<1e-6?0:1/j*2**16;for(let O=0;O<E;++O){const W=O*3,ae=o[W+0]-v,z=o[W+1]-U,K=o[W+2]-y,$=ae*S+z*F+K*C,re=Math.floor(($-Q)*ue);p[O]=re,D[re]++}for(let O=1;O<65537;O++)D[O]+=D[O-1];for(let O=0;O<E;O++){const W=p[O],ae=--D[W];n[ae]=O}const ee=O=>p[n[O]]/ue+Q,N=()=>{const O=A(0,E-1,W=>-ee(W));return Math.min(E,Math.abs(O))},M=ee(E-1)>=0?N():E;if(l)for(let O=0;O<E;++O)n[O]=l[n[O]];self.postMessage({order:n.buffer,count:M},[n.buffer]),n=null};self.onmessage=v=>{if(v.data.order&&(n=new Uint32Array(v.data.order)),v.data.centers){o=new Float32Array(v.data.centers),m.x=g.x=o[0],m.y=g.y=o[1],m.z=g.z=o[2];const U=o.length/3;for(let y=1;y<U;++y){const S=o[y*3+0],F=o[y*3+1],C=o[y*3+2];m.x=Math.min(m.x,S),m.y=Math.min(m.y,F),m.z=Math.min(m.z,C),g.x=Math.max(g.x,S),g.y=Math.max(g.y,F),g.z=Math.max(g.z,C)}d=!0}v.data.hasOwnProperty("mapping")&&(l=v.data.mapping?new Uint32Array(v.data.mapping):null,d=!0),v.data.cameraPosition&&(c=v.data.cameraPosition),v.data.cameraDirection&&(f=v.data.cameraDirection),B()}}const e=`(${s.toString()})()`,t=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(t);return new Worker(a)}nodeUpdate(s,e,t,a){const r=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(r);const i=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;i!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=i),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(s,e,t,a)}renderPass(s,e,t){const a=t.encoder;for(let r of this.materials){const i=r.getPass(e);if(!(!i||i.length===0))for(const n of i){if(!n.pipeline)continue;n.apply(this.geometry,t.rendererPassState||t),k.bindPipeline(a,n),k.bindGeometryBuffer(a,this.geometry);const l=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?k.drawIndexed(a,l.indexCount,this.instanceCount,l.indexStart,0,0):k.drawIndexed(a,l.indexCount,1,l.indexStart,0,0)}}}destroy(s){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(s),this.splatColor=null),this.transformA&&(this.transformA.destroy(s),this.transformA=null),this.transformB&&(this.transformB.destroy(s),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(s),this.splatOrder=null),this._positions=null,this._worldPositions=null,this._orderData=null,this.texParams=null,this._mapping=null,super.destroy(s)}};ii=j2([Ot(ii,"GSplatRenderer")],ii);const F0=`
|
|
5996
6024
|
#include "GlobalUniform"
|
|
5997
6025
|
|
|
5998
6026
|
const ALPHA_THRESHOLD: f32 = 0.00392156863;
|
|
@@ -6118,7 +6146,7 @@ struct InstanceData {
|
|
|
6118
6146
|
o.gBuffer = vec4f(0.0);
|
|
6119
6147
|
return o;
|
|
6120
6148
|
}
|
|
6121
|
-
`;var Z2=Object.getOwnPropertyDescriptor,Y2=(s,e,t,a)=>{for(var r=a>1?void 0:a?Z2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ki=class extends At{constructor(){super(),Y.register("pointcloud_vs_dc",F0),Y.register("pointcloud_fs_dc",k0);const s=new qe("pointcloud_vs_dc","pointcloud_fs_dc");s.passType=fe.COLOR,s.setShaderEntry("VertMain","FragMain"),s.topology=Ss.triangle_list,s.depthWriteEnabled=!0,s.cullMode=Lt.none,s.shaderState.transparent=!1,s.shaderState.blendMode=De.NORMAL,s.shaderState.writeMasks=[15,15],s.shaderState.castReflection=!1,this.addRenderPass(s),this.setDefault()}setDefault(){const s=this.getDefaultColorShader(),e=new R;s.setUniform("modelMatrix",e.rawData),s.setUniformArray("tex_params",new Float32Array([0,0,0,4])),s.setUniformArray("pointParams",new Float32Array([0,0,0,128]))}};ki=Y2([Na(ki,"PointCloudShader")],ki);class E0 extends vt{_texParams=new Float32Array([0,0,0,4]);_pointParamsArray=new Float32Array([0,0,0,128]);constructor(){super(),this.shader=new ki}setPointTextures(e,t,a,r){const i=this.shader.getDefaultColorShader();if(!i.getUniform("modelMatrix")){const n=new R;i.setUniform("modelMatrix",n.rawData)}i.setTexture("pointColor",t),i.setTexture("pointPosition",e),this._texParams[0]=a[0],this._texParams[1]=a[1],this._texParams[2]=a[2],this._texParams[3]=a[3],i.setUniformArray("tex_params",this._texParams),i.setUniformArray("pointParams",this._pointParamsArray),r&&i.setTexture("pointOrder",r),i.shaderState.depthCompare=ft.less}setTransformMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}setPointSize(e){this._texParams[3]=Math.max(.1,e),this.shader.getDefaultColorShader().setUniformArray("tex_params",this._texParams)}setPointShape(e){this._pointParamsArray[0]=e==="circle"?1:0,this.shader.getDefaultColorShader().setUniformArray("pointParams",this._pointParamsArray)}enableDebugFullScreen(e){this._pointParamsArray[1]=e?1:0,this.shader.getDefaultColorShader().setUniformArray("pointParams",this._pointParamsArray)}setBatchSize(e){this._pointParamsArray[3]=Math.max(1,e|0),this.shader.getDefaultColorShader().setUniformArray("pointParams",this._pointParamsArray)}}class Kn extends Le{batchSize;constructor(e=128){super(),this.batchSize=e;const t=new Float32Array(12*e);for(let r=0;r<e;++r){const i=r*12;t.set([-1,-1,r,1,-1,r,1,1,r,-1,1,r],i)}const a=new Uint32Array(6*e);for(let r=0;r<e;++r){const i=r*4,n=r*6;a.set([0+i,1+i,2+i,0+i,2+i,3+i],n)}this.setAttribute(G.position,t),this.setIndices(a),this.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:t.length/3,firstStart:0,index:0,topology:0})}}class w0 extends ut{create(e,t,a,r=!0){let i=I.device;const n=e*4*4;this.format=oe.rgba32float,this.createTextureDescriptor(e,t,1,this.format);const l=i.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});i.queue.writeBuffer(l,0,a.buffer);const c=k.beginCommandEncoder();return c.copyBufferToTexture({buffer:l,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(c),r&&(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float"),this.gpuSampler=i.createSampler({}),this}fromBuffer(e,t,a){let r=I.device;const i=e*4*4;this.format=oe.rgba32float,this.mipmapCount=1,this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const n=k.beginCommandEncoder();return n.copyBufferToTexture({buffer:a,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(n),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=r.createSampler({}),this}}var X2=Object.getOwnPropertyDescriptor,H2=(s,e,t,a)=>{for(var r=a>1?void 0:a?X2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let qa=class extends Ba{count=0;size=new de;pointColor;pointPosition;pointOrder;texParams;pointCloudMaterial;_positions;get positions(){return this._positions}_colors;_orderData;_fullCount=0;get fullCount(){return this._fullCount}_batchSize=128;instanceCount=0;_texturesInitialized=!1;_debugFullScreen=!1;_centerOffset=new b;get centerOffset(){return this._centerOffset}constructor(){super()}initFromData(s,e,t){if(!s||!e||t<=0){console.error("PointCloudRenderer: Invalid input data");return}if(s.length<t*3){console.error("PointCloudRenderer: Positions array too small");return}if(e.length<t*4){console.error("PointCloudRenderer: Colors array too small");return}this.count=t,this._fullCount=t,this.size=this.evalTextureSize(t),this._positions=s,this._colors=e,this.centerizePositions(),this.buildPositionTexture(),this.buildColorTexture(),this.texParams=new Float32Array([this.count,this.size.x,this.count,4]),this.buildOrderTexture(),this.pointCloudMaterial=new E0,this.geometry=new Kn(this._batchSize),this.materials=[this.pointCloudMaterial],this.instanceCount=Math.ceil(this.count/this._batchSize)}evalTextureSize(s){let e=Math.ceil(Math.sqrt(s));const t=64;e=Math.ceil(e/t)*t;const a=Math.ceil(s/e);return new de(e,a)}centerizePositions(){if(this.count===0)return;let s=0,e=0,t=0;for(let n=0;n<this.count;n++){const o=n*3;s+=this._positions[o+0],e+=this._positions[o+1],t+=this._positions[o+2]}const a=s/this.count,r=e/this.count,i=t/this.count;this._centerOffset.set(a,r,i);for(let n=0;n<this.count;n++){const o=n*3;this._positions[o+0]-=a,this._positions[o+1]-=r,this._positions[o+2]-=i}this.object3D.localPosition=this._centerOffset}buildPositionTexture(){const s=this.size.x|0,e=this.size.y|0,t=this.count,a=new Float32Array(s*e*4);for(let r=0;r<t;r++){const i=r*4,n=r*3;a[i+0]=this._positions[n+0],a[i+1]=this._positions[n+1],a[i+2]=this._positions[n+2],a[i+3]=0}if(t<s*e){const r=(t-1)*4;for(let i=t;i<s*e;i++){const n=i*4;a[n+0]=a[r+0],a[n+1]=a[r+1],a[n+2]=a[r+2],a[n+3]=0}}this.pointPosition=new w0().create(s,e,a),this.pointPosition.name="pointPosition",this.pointPosition.minFilter="nearest",this.pointPosition.magFilter="nearest",this.pointPosition.addressModeU="clamp-to-edge",this.pointPosition.addressModeV="clamp-to-edge"}buildColorTexture(){const s=this.size.x|0,e=this.size.y|0,t=this.count,a=new Uint8Array(s*e*4);for(let r=0;r<t;r++){const i=r*4,n=r*4;a[i+0]=this._colors[n+0],a[i+1]=this._colors[n+1],a[i+2]=this._colors[n+2],a[i+3]=this._colors[n+3]}if(t<s*e){const r=(t-1)*4;for(let i=t;i<s*e;i++){const n=i*4;a[n+0]=a[r+0],a[n+1]=a[r+1],a[n+2]=a[r+2],a[n+3]=a[r+3]}}this.pointColor=new Fi().create(s,e,a,!1),this.pointColor.name="pointColor",this.pointColor.minFilter="nearest",this.pointColor.magFilter="nearest",this.pointColor.mipmapFilter="nearest",this.pointColor.addressModeU="clamp-to-edge",this.pointColor.addressModeV="clamp-to-edge"}buildOrderTexture(){const s=this.size.x*this.size.y;this._orderData=new Uint32Array(s);for(let e=0;e<s;e++)this._orderData[e]=e<this.count?e:this.count>0?this.count-1:0;this.pointOrder=new Qs().create(this.size.x,this.size.y,this._orderData),this.pointOrder.name="pointOrder",this.pointOrder.minFilter="nearest",this.pointOrder.magFilter="nearest",this.pointOrder.addressModeU="clamp-to-edge",this.pointOrder.addressModeV="clamp-to-edge"}nodeUpdate(s,e,t,a){const r=this.object3D.transform.worldMatrix;this.pointCloudMaterial.setTransformMatrix(r),this._texturesInitialized||(this.pointCloudMaterial.setPointTextures(this.pointPosition,this.pointColor,this.texParams,this.pointOrder),this.pointCloudMaterial.setBatchSize(this._batchSize),this.pointCloudMaterial.setPointSize(this.texParams[3]),this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen),this._texturesInitialized=!0),super.nodeUpdate(s,e,t,a)}renderPass(s,e,t){const a=t.encoder;for(let r of this.materials){const i=r.getPass(e);if(!(!i||i.length===0))for(const n of i){if(!n.pipeline)continue;n.apply(this.geometry,t.rendererPassState||t),k.bindPipeline(a,n),k.bindGeometryBuffer(a,this.geometry);const l=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?k.drawIndexed(a,l.indexCount,this.instanceCount,l.indexStart,0,0):k.drawIndexed(a,l.indexCount,1,l.indexStart,0,0)}}}setPointSize(s){this.texParams[3]=Math.max(.1,s),this.pointCloudMaterial&&this.pointCloudMaterial.setPointSize(s)}setPointShape(s){this.pointCloudMaterial&&this.pointCloudMaterial.setPointShape(s)}enableDebugFullScreen(s){this._debugFullScreen=s,this.pointCloudMaterial&&this.pointCloudMaterial.enableDebugFullScreen(s)}setBatchSize(s){if(this._batchSize=Math.max(1,s|0),this.geometry){const e=this.geometry;ke.getInstance().detached(e,this),ke.getInstance().hasReference(e)||e.destroy(),this.geometry=new Kn(this._batchSize)}this.pointCloudMaterial&&(this.pointCloudMaterial.setBatchSize(this._batchSize),this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen)),this.instanceCount=Math.ceil(this.count/this._batchSize)}destroy(s){this.pointColor&&(this.pointColor.destroy(s),this.pointColor=null),this.pointPosition&&(this.pointPosition.destroy(s),this.pointPosition=null),this.pointOrder&&(this.pointOrder.destroy(s),this.pointOrder=null),this._positions=null,this._colors=null,this._orderData=null,this.texParams=null,super.destroy(s)}};qa=H2([Ot(qa,"PointCloudRenderer")],qa);class qn{static maxVector=new b(Number.MAX_VALUE*.1,Number.MAX_VALUE*.1,Number.MAX_VALUE*.1);static minVector=this.maxVector.clone().multiplyScalar(-1);static genMeshMaxVector=b.ZERO.clone();static genMeshMinVector=b.ZERO.clone();static genMeshVectorList8=[new b,new b,new b,new b,new b,new b,new b,new b];static genPointCloudBounds(e,t){t||=new Ce(b.ZERO,b.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(qa);if(!a)return console.warn("genPointCloudBounds: No PointCloudRenderer found on object"),t;for(const r of a){const i=r.positions,n=r.fullCount;if(!i||n===0){console.warn("genPointCloudBounds: No position data available");continue}const o=r.object3D.transform.worldMatrix,l=new b;for(let c=0;c<n;c++){const f=c*3;l.set(i[f+0],i[f+1],i[f+2]),o.transformPoint(l,l),t.expandByPoint(l)}}return t}static genGSplatBounds(e,t){t||=new Ce(b.ZERO,b.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(ii);if(!a)return console.warn("genGSplatBounds: No GSplatRenderer found on object"),t;for(const r of a){const i=r.positions,n=r.fullCount;if(!i||n===0)return console.warn("genGSplatBounds: No position data available"),t;const o=r.object3D.transform.worldMatrix,l=new b;for(let c=0;c<n;c++){const f=c*3;l.set(i[f+0],i[f+1],i[f+2]),o.transformPoint(l,l),t.expandByPoint(l)}t.setFromMinMax(t.min,t.max)}return t}static genMeshBounds(e,t){let a=this.genMeshMinVector,r=this.genMeshMaxVector,i=this.genMeshVectorList8;t||=new Ce(b.ZERO,b.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let n=e.getComponents(he);for(const o of n)if(o&&o.geometry){let l=o.object3D.transform.worldMatrix;a.copy(o.geometry.bounds.min),r.copy(o.geometry.bounds.max),i[0].set(a.x,a.y,a.z),i[1].set(a.x,a.y,r.z),i[2].set(a.x,r.y,a.z),i[3].set(a.x,r.y,r.z),i[4].set(r.x,a.y,a.z),i[5].set(r.x,a.y,r.z),i[6].set(r.x,r.y,a.z),i[7].set(r.x,r.y,r.z);for(const c of i)l.transformPoint(c,c),t.expandByPoint(c)}return r.copyFrom(t.max),a.copyFrom(t.min),t.setFromMinMax(a,r),t}static transformBound(e,t,a){let r=this.genMeshMinVector.copyFrom(t.min),i=this.genMeshMaxVector.copyFrom(t.max),n=this.genMeshVectorList8;a||=new Ce(b.ZERO,b.ZERO),a.setFromMinMax(this.maxVector,this.minVector),n[0].set(r.x,r.y,r.z),n[1].set(r.x,r.y,i.z),n[2].set(r.x,i.y,r.z),n[3].set(r.x,i.y,i.z),n[4].set(i.x,r.y,r.z),n[5].set(i.x,r.y,i.z),n[6].set(i.x,i.y,r.z),n[7].set(i.x,i.y,i.z);for(const o of n)e.transformPoint(o,o),a.expandByPoint(o);return i.copyFrom(a.max),r.copyFrom(a.min),a.setFromMinMax(r,i),a}}class I0 extends Za{name="";_instanceID="";_numChildren;get instanceID(){return this._instanceID}transform;renderNode;entityChildren;components;waitDisposeComponents;_bound;_boundWorld;_isBoundChange=!0;_dispose=!1;get dispose(){return this._dispose}getObjectByName(e){if(e.indexOf("/")>=0){let a=e.split("/"),r=this;for(;a.length>0&&r;){let i=a.shift();if(r=r.getChildByName(i,!1),!r)return null}return r}else return this.getChildByName(e,!1)}constructor(){super(),this.entityChildren=[],this.components=new Map,this._instanceID=yn().toString(),this.waitDisposeComponents=[]}get numChildren(){return this._numChildren}addChild(e){if(e==null)throw new Error("child is null!");if(e===this)throw new Error("child is self!");return this.entityChildren.indexOf(e)==-1?(e.removeFromParent(),e.transform.parent=this.transform,this.entityChildren.push(e),this._numChildren=this.entityChildren.length,this.noticeComponents("onAddChild",e),e):null}removeChild(e){if(e===null)return;if(e===this)throw new Error("add child is self!");let t=this.entityChildren.indexOf(e);t!=-1&&(this.entityChildren.splice(t,1),e.transform.parent=null,this._numChildren=this.entityChildren.length,this.noticeComponents("onRemoveChild",e))}removeAllChild(){for(;this.numChildren>0;)this.removeChild(this.entityChildren[0])}removeSelf(){return this.removeFromParent()}removeChildByIndex(e){e>=0&&e<this.entityChildren.length?this.removeChild(this.entityChildren[e]):console.error("remove child by index , index out of range")}hasChild(e){return this.entityChildren.indexOf(e)!=-1}removeFromParent(){let e=this.transform.parent;return e&&e.object3D&&e.object3D.removeChild(this),this}getChildByIndex(e){let t=null;return e<this.entityChildren.length&&(t=this.entityChildren[e]),t}getChildByName(e,t=!0){let a=null;for(const r of this.entityChildren){if(r.name==e)return a=r,a;if(t&&(a=r.getChildByName(e,t),a))return a}return a}update(){}instantiate(){return null}onTransformLocalChange(e){this._isBoundChange=!0}get bound(){return(this._isBoundChange||!this._bound)&&this.updateBound(),this._boundWorld}set bound(e){this._bound=e,this._boundWorld=this._bound.clone(),this._isBoundChange=!0}updateBound(){return this._bound||(this._bound=new Ce,this._boundWorld=this._bound.clone(),this._isBoundChange=!0),this._isBoundChange&&(qn.transformBound(this.transform.worldMatrix,this._bound,this._boundWorld),this._isBoundChange=!1),this._boundWorld}waitUpdate(){this._dispose?(this.transform.parent&&this.transform.parent.object3D.removeChild(this),this.components.forEach((e,t)=>{e.enable=!1,e.beforeDestroy(),e.destroy()}),this.components.clear()):Oe.waitStartComponent.forEach((e,t)=>{for(;e.length>0;){const a=e.shift();a.__start(),Oe.waitStartComponent.delete(a.object3D)}})}noticeComponents(e,t){for(let a of this.components.values())a[e]?.(t)}destroy(e){this._dispose||(this.components.forEach(t=>{t.beforeDestroy(e)}),this.components.forEach(t=>{t.destroy(e)}),this.components.clear(),this.components.clear(),this.entityChildren&&(this.entityChildren.forEach(t=>{t.destroy(e)}),this.removeAllChild(),this.entityChildren=[]),this._bound&&this._bound.destroy&&(this._bound.destroy(),this._bound=null),this._boundWorld&&this._boundWorld.destroy&&(this._boundWorld.destroy(),this._boundWorld=null),this.transform.parent=null,this._dispose=!0,super.destroy())}}var K2=Object.getOwnPropertyDescriptor,q2=(s,e,t,a)=>{for(var r=a>1?void 0:a?K2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ne=class extends I0{_isScene3D;prefabRef;serializeTag;constructor(){super(),this.transform=this.addComponent(Zt),this.transform.eventDispatcher.addEventListener(Zt.LOCAL_ONCHANGE,this.onTransformLocalChange,this)}get isScene3D(){return this._isScene3D}forChild(s){this.entityChildren.forEach(e=>{s(e),e.forChild(s)})}addComponent(s,e){if(!this.components.has(s)){let t=new s;return t.object3D=this,this.components.set(s,t),t.__init(e),Oe.appendWaitStart(t),t}return this.components.get(s)}getOrAddComponent(s){let e=this.components.get(s);return e||(e=this.addComponent(s)),e}removeComponent(s){if(this.components.has(s)){let e=this.components.get(s);Oe.removeWaitStart(this,e),this.components.delete(s),e.__stop(),e.beforeDestroy(),e.destroy()}}hasComponent(s){return this.components.has(s)}getComponent(s){return this.components.get(s)}getComponentFromParent(s){if(!this.parent)return null;let e=this.parent.object3D.getComponent(s);return e||this.parent.object3D.getComponentFromParent(s)}getComponentsInChild(s){let e=[],t=this.components.get(s);t&&e.push(t);for(let a=0;a<this.entityChildren.length;a++){let i=this.entityChildren[a].getComponentsInChild(s);e.push(...i)}return e}getComponents(s,e,t){e||=[];let a=this.getComponent(s);a&&(a.enable||t)&&e.push(a);for(let r=0,i=this.entityChildren.length;r<i;r++){let n=this.entityChildren[r];n&&n instanceof ne&&n.getComponents(s,e,t)}return e}getComponentsExt(s,e,t){e||=[];let a=this.components.get(s);if(a&&(a.enable||t))e.push(a);else for(const r of this.entityChildren)r instanceof ne&&r.getComponentsExt(s,e,t);return e}getComponentsByProperty(s,e,t=!0,a,r){a||=[];let i;for(const n of this.components.values())n&&(n.enable||r)&&n[s]===e&&(a.push(n),i=!0);if(!(i&&t))for(const n of this.entityChildren)n instanceof ne&&n.getComponentsByProperty(s,e,t,a,r);return a}clone(){return this.instantiate()}instantiate(){let s=new ne;return s.name=this.name,s.serializeTag=this.serializeTag,s.prefabRef=this.prefabRef,this.entityChildren.forEach((e,t)=>{let a=e.instantiate();s.addChild(a)}),this.components.forEach((e,t)=>{e.cloneTo(s)}),s}get localPosition(){return this.transform.localPosition}set localPosition(s){this.transform.localPosition=s}get localRotation(){return this.transform.localRotation}set localRotation(s){this.transform.localRotation=s}get localScale(){return this.transform.localScale}set localScale(s){this.transform.localScale=s}get localQuaternion(){return this.transform.localRotQuat}set localQuaternion(s){this.transform.localRotQuat=s}notifyChange(){this.transform.notifyChange()}get parent(){return this.transform.parent}get parentObject(){return this.transform.parent.object3D}set x(s){this.transform.x=s}get x(){return this.transform.x}set y(s){this.transform.y=s}get y(){return this.transform.y}set z(s){this.transform.z=s}get z(){return this.transform.z}set scaleX(s){this.transform.scaleX=s}get scaleX(){return this.transform.scaleX}set scaleY(s){this.transform.scaleY=s}get scaleY(){return this.transform.scaleY}set scaleZ(s){this.transform.scaleZ=s}get scaleZ(){return this.transform.scaleZ}set rotationX(s){this.transform.rotationX=s}get rotationX(){return this.transform.rotationX}set rotationY(s){this.transform.rotationY=s}get rotationY(){return this.transform.rotationY}set rotationZ(s){this.transform.rotationZ=s}get rotationZ(){return this.transform.rotationZ}fixedUpdate(){}lateUpdate(){}traverse(s){s(this);for(let e=0,t=this.entityChildren.length;e<t;e++){let a=this.entityChildren[e];a instanceof ne&&a.traverse(s)}}destroy(s){this.transform.eventDispatcher.removeEventListener(Zt.LOCAL_ONCHANGE,this.onTransformLocalChange,this);const e=this.batchTable;e&&typeof e.destroy=="function"&&(e.destroy(),this.batchTable=null);const t=this.featureTable;t&&typeof t.destroy=="function"&&(t.destroy(),this.featureTable=null),super.destroy(s)}};ne=q2([$2],ne);function $2(s,e){return class extends ne{set active(t){this.transform.enable=t>0}get active(){return this.transform.enable?1:0}get materialColor(){return this.getComponent(he)?.material?.shader.getDefaultColorShader().baseColor}set materialColor(t){let a=this.getComponent(he)?.material;a&&(a.shader.getDefaultColorShader().baseColor=t)}notifyMaterialColorChange(t,a){this.getComponent(he).materials?.[t]?.shader.getDefaultColorShader().uniforms[a].onChange()}}}class bt{static createCamera3DObject(e,t){return this.createCamera3D(null,e,t)}static createCamera3D(e,t,a){return e||=new ne,t&&t.addChild(e),a&&(e.name=a),e.getOrAddComponent(ti)}static UnProjection(e,t,a=1,r){let i=new b(e,t,0),n=1,o=b.HELP_0,l=I.canvas.offsetLeft,c=I.canvas.offsetTop,f=I.canvas.clientWidth,d=I.canvas.clientHeight;o.x=((i.x-l)*n/f-.5)*2,o.y=-((i.y-c)*n/d-.5)*2,o.z=a;let h=new b(0,0,0),u=R.helpMatrix2;u.copyFrom(r.projectionMatrix),u.invert();let m=R.helpMatrix;return m.identity(),m.multiply(u),m.multiply(r.transform.worldMatrix),m.perspectiveMultiplyPoint3(o,h),h}static Projection(e,t,a){let r=a||new b(0,0,0),i=R.helpMatrix;i.copyFrom(t.viewMatrix),i.multiply(t.projectionMatrix),i.perspectiveMultiplyPoint3(e,r);let n=I.canvas.clientWidth/2,o=I.canvas.clientHeight/2;return r.x=r.x*n+n,r.y=o-r.y*o,r}static UnProjection2(e,t,a,r,i){let n=i||new b(0,0,0),o=R.helpMatrix;o.copyFrom(r.pvMatrixInv);let l=I.canvas.clientWidth/2,c=I.canvas.clientHeight/2;return n.x=(e-l)/l,n.y=(c-t)/c,n.z=a,o.perspectiveMultiplyPoint3(n,n),n}}class jt{static maxNumDirectionShadow=8;static maxNumPointShadow=8;static directionLightList;static pointLightList;static shadowLights;static init(){this.directionLightList=new Map,this.pointLightList=new Map,this.shadowLights=new Map}static createBuffer(e){if(!this.shadowLights.has(e.scene)){let t=new Float32Array(16);this.shadowLights.set(e.scene,t)}}static getShadowLightList(e){if(!e.transform.view3D)return null;if(e.lightData.lightType==ht.DirectionLight){let t=this.directionLightList.get(e.transform.view3D.scene);return t||(t=[],this.directionLightList.set(e.transform.view3D.scene,t)),t}else if(e.lightData.lightType==ht.PointLight){let t=this.pointLightList.get(e.transform.view3D.scene);return t||(t=[],this.pointLightList.set(e.transform.view3D.scene,t)),t}else if(e.lightData.lightType==ht.SpotLight){let t=this.pointLightList.get(e.transform.view3D.scene);return t||(t=[],this.pointLightList.set(e.transform.view3D.scene,t)),t}}static getShadowLightWhichScene(e,t){if(t==ht.DirectionLight){let a=this.directionLightList.get(e);return a||(a=[],this.directionLightList.set(e,a)),a}else if(t==ht.PointLight){let a=this.pointLightList.get(e);return a||(a=[],this.pointLightList.set(e,a)),a}}static getDirectShadowLightWhichScene(e){let t=this.directionLightList.get(e);return t||(t=[],this.directionLightList.set(e,t)),t}static getPointShadowLightWhichScene(e){let t=this.pointLightList.get(e);return t||(t=[],this.pointLightList.set(e,t)),t}static addShadowLight(e){if(!e.transform.view3D)return null;let t=e.transform.view3D.scene;if(e.lightData.lightType==ht.DirectionLight){let a=this.directionLightList.get(t);if(a||(a=[],this.directionLightList.set(t,a)),!e.shadowCamera){e.shadowCamera=bt.createCamera3DObject(null,"shadowCamera"),e.shadowCamera.isShadowCamera=!0;let r=-1e3;e.shadowCamera.orthoOffCenter(r,-r,r,-r,1,1e4)}return a.indexOf(e)==-1&&a.push(e),a}else if(e.lightData.lightType==ht.PointLight||e.lightData.lightType==ht.SpotLight){let a=this.pointLightList.get(t);return a&&a.length>=8||(a||(a=[],this.pointLightList.set(t,a)),a.indexOf(e)==-1&&a.push(e)),a}}static removeShadowLight(e){if(e.lightData.castShadowIndex=-1,!e.transform.view3D)return null;if(e.lightData.lightType==ht.DirectionLight){let t=this.directionLightList.get(e.transform.view3D.scene);if(t){let a=t.indexOf(e);a!=-1&&t.splice(a,1)}return e.lightData.castShadowIndex=-1,t}else if(e.lightData.lightType==ht.PointLight||e.lightData.lightType==ht.SpotLight){let t=this.pointLightList.get(e.transform.view3D.scene);if(t){let a=t.indexOf(e);a!=-1&&t.splice(a,1)}return e.lightData.castShadowIndex=-1,t}}static update(e){let t=this.shadowLights.get(e.scene),a=jt.directionLightList.get(e.scene),r=jt.pointLightList.get(e.scene),i=0,n=0,o=0,l=0;if(t.fill(0),a){let f=0;for(let d=0;d<a.length;d++){const h=a[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}n=a.length}if(r){o=n;let f=0;for(let d=o;d<r.length;d++){const h=r[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}l=o+r.length}xe.getAllCameraGroup().forEach(f=>{f.dirShadowStart=i,f.dirShadowEnd=n,f.pointShadowStart=o,f.pointShadowEnd=l,f.shadowLights.set(new Float32Array(t))})}}class $n{uuid;usage;globalBindGroup;uniformGPUBuffer;matrixBindGroup;uniformByteLength;matrixesByteLength;shadowMatrixRaw=new Float32Array(128);csmMatrixRaw=new Float32Array(sa.Cascades*16);csmShadowBias=new Float32Array(4);shadowLights=new Float32Array(16);dirShadowStart=0;dirShadowEnd=0;pointShadowStart=0;pointShadowEnd=0;constructor(e){this.uuid=zt(),this.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.uniformGPUBuffer=new Ct(8336),this.uniformGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBindGroup=e,this.createBindGroup()}createBindGroup(){this.uniformByteLength=this.uniformGPUBuffer.memory.shareDataBuffer.byteLength,this.matrixesByteLength=R.block*4*R.maxCount,this.globalBindGroup=I.device.createBindGroup({label:"global_bindGroupLayout",layout:Ln.getGlobalDataBindGroupLayout(),entries:[{binding:0,resource:{buffer:this.uniformGPUBuffer.buffer,offset:0,size:this.uniformByteLength}},{binding:1,resource:{buffer:this.matrixBindGroup.matrixBufferDst.buffer,offset:0,size:this.matrixesByteLength}}]})}setCamera(e){this.uniformGPUBuffer.setMatrix("_projectionMatrix",e.projectionMatrix),this.uniformGPUBuffer.setMatrix("_viewMatrix",e.viewMatrix),this.uniformGPUBuffer.setMatrix("_cameraWorldMatrix",e.transform.worldMatrix),this.uniformGPUBuffer.setMatrix("pvMatrixInv",e.projectionMatrixInv),this.uniformGPUBuffer.setMatrix("viewToWorld",e.cameraToWorld);let t=jt.getDirectShadowLightWhichScene(e.transform.scene3D);this.csmShadowBias.fill(1e-4),this.shadowMatrixRaw.fill(0),this.csmMatrixRaw.fill(0);for(let l=0;l<8;l++)if(l<t.length){let c=t[l].shadowCamera;this.shadowMatrixRaw.set(c.pvMatrix.rawData,l*16)}else this.shadowMatrixRaw.set(e.transform.worldMatrix.rawData,l*16);this.uniformGPUBuffer.setFloat32Array("shadowMatrix",this.shadowMatrixRaw);let a=_.setting.shadow.shadowSize;if(sa.Cascades>1&&e.enableCSM&&t[0])for(let l=0;l<sa.Cascades;l++){let c=e.csm.children[l].shadowCamera;this.csmMatrixRaw.set(c.pvMatrix.rawData,l*16),this.csmShadowBias[l]=e.getCSMShadowBiasScale(c)}this.uniformGPUBuffer.setFloat32Array("csmShadowBias",this.csmShadowBias),this.uniformGPUBuffer.setFloat32Array("csmMatrix",this.csmMatrixRaw),this.uniformGPUBuffer.setFloat32Array("shadowLights",this.shadowLights);let r=_.setting.reflectionSetting,i=q.instance.getReflections(e.transform.scene3D).length;this.uniformGPUBuffer.setFloat("reflectionProbeSize",r.reflectionProbeSize),this.uniformGPUBuffer.setFloat("reflectionProbeMaxCount",r.reflectionProbeMaxCount),this.uniformGPUBuffer.setFloat("reflectionMapWidth",r.width),this.uniformGPUBuffer.setFloat("reflectionMapHeight",r.height),this.uniformGPUBuffer.setFloat("reflectionCount",i),this.uniformGPUBuffer.setFloat("test2",dt.testObj.testValue2),this.uniformGPUBuffer.setFloat("test3",dt.testObj.testValue3),this.uniformGPUBuffer.setFloat("test4",dt.testObj.testValue4),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",We.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",We.time),this.uniformGPUBuffer.setFloat("delta",We.delta),this.uniformGPUBuffer.setFloat("shadowBias",e.getShadowBias(a)),this.uniformGPUBuffer.setFloat("skyExposure",_.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",_.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",_.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",_.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",_.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",_.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",_.setting.render.renderState_split);let n=_.inputSystem.mouseX*I.pixelRatio,o=_.inputSystem.mouseY*I.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",n),this.uniformGPUBuffer.setFloat("mouseY",o),this.uniformGPUBuffer.setFloat("windowWidth",I.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",I.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",_.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",a),this.uniformGPUBuffer.setFloat("shadowSoft",_.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",e.enableCSM?1:0),this.uniformGPUBuffer.setFloat("csmMargin",_.setting.shadow.csmMargin),this.uniformGPUBuffer.setInt32("nDirShadowStart",this.dirShadowStart),this.uniformGPUBuffer.setInt32("nDirShadowEnd",this.dirShadowEnd),this.uniformGPUBuffer.setInt32("nPointShadowStart",this.pointShadowStart),this.uniformGPUBuffer.setInt32("nPointShadowEnd",this.pointShadowEnd),this.uniformGPUBuffer.setVector3("cameraForward",e.transform.forward),this.uniformGPUBuffer.setVector4Array("frustumPlanes",e.frustum.planes),this.uniformGPUBuffer.apply()}setShadowCamera(e){this.uniformGPUBuffer.setMatrix("_projectionMatrix",e.projectionMatrix),this.uniformGPUBuffer.setMatrix("_viewMatrix",e.viewMatrix),this.uniformGPUBuffer.setMatrix("_pvMatrix",e.pvMatrix),this.uniformGPUBuffer.setMatrix("pvMatrixInv",e.projectionMatrixInv),this.uniformGPUBuffer.setMatrix("viewToWorld",e.cameraToWorld),this.csmShadowBias.fill(1e-4),this.shadowMatrixRaw.fill(0),this.csmMatrixRaw.fill(0),this.uniformGPUBuffer.setFloat32Array("shadowCamera",this.shadowMatrixRaw),this.uniformGPUBuffer.setFloat32Array("csmShadowBias",this.csmShadowBias),this.uniformGPUBuffer.setFloat32Array("csmMatrix",this.csmMatrixRaw),this.uniformGPUBuffer.setFloat32Array("shadowLights",this.shadowLights),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",We.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",We.time),this.uniformGPUBuffer.setFloat("delta",We.delta),this.uniformGPUBuffer.setFloat("shadowBias",_.setting.shadow.shadowBias),this.uniformGPUBuffer.setFloat("skyExposure",_.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",_.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",_.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",_.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",_.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",_.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",_.setting.render.renderState_split);let t=_.inputSystem.mouseX*I.pixelRatio,a=_.inputSystem.mouseY*I.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",t),this.uniformGPUBuffer.setFloat("mouseY",a),this.uniformGPUBuffer.setFloat("windowWidth",I.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",I.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",_.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",_.setting.shadow.shadowSize),this.uniformGPUBuffer.setFloat("shadowSoft",_.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",0),this.uniformGPUBuffer.setFloat("csmMargin",_.setting.shadow.csmMargin),this.uniformGPUBuffer.setInt32("nDirShadowStart",this.dirShadowStart),this.uniformGPUBuffer.setInt32("nDirShadowEnd",this.dirShadowEnd),this.uniformGPUBuffer.setInt32("nPointShadowStart",this.pointShadowStart),this.uniformGPUBuffer.setInt32("nPointShadowEnd",this.pointShadowEnd),this.uniformGPUBuffer.apply()}setShadowLight(){}}class R0{setting;probesBufferData;probesBuffer;isVolumeFrameChange=!0;randomOrientation;startPosition=new b;isVolumeChange=!0;irradianceVolumeBuffer;directionDistance=20;randomSeedCount=3;useRandomIndex=0;centerDirection=new b(0,0,this.directionDistance).normalize(1);arroundPositions=[];updateOrientation(){return this.useRandomIndex++,this.useRandomIndex>=this.arroundPositions.length&&(this.useRandomIndex=0),R.fromToRotation(this.centerDirection,this.arroundPositions[this.useRandomIndex],this.randomOrientation),this.randomOrientation}init(e){this.setting=e,this.randomOrientation=new R(!1),this.randomOrientation.identity(),this.irradianceVolumeBuffer=new Ct(80),this.createFramesBuffer(),this.arroundPositions.push(this.centerDirection.clone());for(let t=0;t<this.randomSeedCount;t++){let a=Math.PI*2*t/this.randomSeedCount,r=new b(Math.sin(a),Math.cos(a),this.directionDistance).normalize(1);this.arroundPositions.push(r)}}setVolumeDataChange(){this.isVolumeChange=!0}updateProbes(e){let t=this.probesBufferData;for(let a of e){let r=a.index*4;t[r+3]=a.drawCallFrame}}createFramesBuffer(){if(!this.probesBufferData){let e=this.setting.probeXCount*this.setting.probeYCount*this.setting.probeZCount;this.probesBufferData=new Float32Array(e*4),this.probesBufferData.fill(-1),this.probesBuffer=new Pe(e*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST)}}uploadBuffer(){this.isVolumeChange&&(this.fillIrradianceData(),this.isVolumeChange=!1,this.isVolumeFrameChange=!0),this.probesBuffer.setFloat32Array("uniformFramesBuffer",this.probesBufferData)}calcPosition(e,t,a,r){let i=this.setting,n=this.setting.probeSpace;return r=r||new b,r.x=e*n-n*(i.probeXCount-1)*.5+i.offsetX,r.y=t*n-n*(i.probeYCount-1)*.5+i.offsetY,r.z=a*n-n*(i.probeZCount-1)*.5+i.offsetZ,r}debugX=0;debugY=0;debugZ=0;fillIrradianceData(){let e=this.setting,t=this.calcPosition(0,0,0,this.startPosition);this.irradianceVolumeBuffer.setFloat("orientationIndex",this.randomOrientation.index),this.irradianceVolumeBuffer.setFloat("hysteresis",e.hysteresis),this.irradianceVolumeBuffer.setFloat("OctRTSideSize",e.octRTSideSize),this.irradianceVolumeBuffer.setFloat("OctRTMaxSize",e.octRTMaxSize),this.irradianceVolumeBuffer.setFloat("startX",t.x),this.irradianceVolumeBuffer.setFloat("startY",t.y),this.irradianceVolumeBuffer.setFloat("startZ",t.z),this.irradianceVolumeBuffer.setFloat("ProbeSpace",e.probeSpace),this.irradianceVolumeBuffer.setFloat("probeXCount",e.probeXCount),this.irradianceVolumeBuffer.setFloat("probeYCount",e.probeYCount),this.irradianceVolumeBuffer.setFloat("probeZCount",e.probeZCount),this.irradianceVolumeBuffer.setFloat("maxDistance",e.probeSpace*1.732),this.irradianceVolumeBuffer.setFloat("depthSharpness",e.depthSharpness),this.irradianceVolumeBuffer.setFloat("ProbeSourceTextureSize",e.probeSourceTextureSize),this.irradianceVolumeBuffer.setFloat("ProbeSize",e.probeSize),this.irradianceVolumeBuffer.setFloat("bounceIntensity",e.bounceIntensity),this.irradianceVolumeBuffer.setFloat("probeRoughness",e.probeRoughness),this.irradianceVolumeBuffer.setFloat("normalBias",e.normalBias),this.irradianceVolumeBuffer.setFloat("irradianceChebyshevBias",e.irradianceChebyshevBias),this.irradianceVolumeBuffer.setFloat("rayNumber",e.rayNumber),this.irradianceVolumeBuffer.setFloat("irradianceDistanceBias",e.irradianceDistanceBias),this.irradianceVolumeBuffer.setFloat("indirectIntensity",e.indirectIntensity),this.irradianceVolumeBuffer.setFloat("ddgiGamma",e.ddgiGamma),this.irradianceVolumeBuffer.setFloat("lerpHysteresis",e.lerpHysteresis),this.irradianceVolumeBuffer.setFloat("debugX",this.debugX),this.irradianceVolumeBuffer.setFloat("debugY",this.debugY),this.irradianceVolumeBuffer.setFloat("debugZ",this.debugZ),this.irradianceVolumeBuffer.apply()}}class Q0{storageGPUBuffer;irradianceVolume;_lightList=[];constructor(){this.storageGPUBuffer=new Pe(ws.lightSize*_.setting.light.maxLight,GPUBufferUsage.COPY_SRC),this.irradianceVolume=new R0,this.irradianceVolume.init(_.setting.gi);for(let e=0;e<_.setting.light.maxLight;e++){let t=this.storageGPUBuffer.memory.allocation_node(ws.lightSize*4);this._lightList.push(t)}this.storageGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e){this.storageGPUBuffer.clean();let t=q.instance.getLights(e.scene);for(let a=0;a<t.length;a++){const r=t[a].lightData;r.index=a,this.writeLightBytes(r,this._lightList[a])}this.storageGPUBuffer.apply()}writeLightBytes(e,t){t.offset=0,t.writeFloat(e.index),t.writeInt32(e.lightType),t.writeFloat(e.radius),t.writeFloat(e.linear),t.writeVector3(e.lightPosition),t.writeFloat(e.lightMatrixIndex),t.writeVector3(e.direction),t.writeFloat(e.quadratic),t.writeRGBColor(e.lightColor),t.writeFloat(e.intensity),t.writeFloat(e.innerAngle),t.writeFloat(e.outerAngle),t.writeFloat(e.range),t.writeInt32(e.castShadowIndex),t.writeVector3(e.lightTangent),t.writeFloat(e.iesIndex)}}class T0{storageGPUBuffer;reflectionMap;sourceReflectionMap;count;constructor(){this.storageGPUBuffer=new Pe(768)}update(e){this.storageGPUBuffer.clean();let t=q.instance.getReflections(e.scene);for(let a=0;a<t.length;a++){const r=t[a];r.gid=a,this.storageGPUBuffer.setFloat("gid",r.gid),this.storageGPUBuffer.setVector3("worldPosition",r.transform.worldPosition),this.storageGPUBuffer.setFloat("radius",r.radius),this.storageGPUBuffer.setVector3("bound",r.transform.worldPosition)}this.count=t.length,this.storageGPUBuffer.apply()}}class M0 extends Ya{size;constructor(e,t=0,a){super(),this.bufferType=Aa.StorageGPUBuffer,this.size=e,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"MatrixGPUBuffer")}writeBufferByHeap(e,t){let a;e instanceof Float64Array?a=new Float32Array(e):a=e;let r=I.device;if(a.length>0){let i=null;for(;this.mapAsyncReady.length&&(i=this.mapAsyncReady.shift(),i.usedSize!=a.byteLength);)i.destroy(),this.mapAsyncBuffersOutstanding--,i=null;i||(i=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,mappedAtCreation:!0}),i.usedSize=a.byteLength,this.mapAsyncBuffersOutstanding++,this.mapAsyncBuffersOutstanding>10&&console.warn(` Warning: mapAsync requests from ${this.mapAsyncBuffersOutstanding} frames ago have not resolved yet. MB of staging buffers allocated.`));let n=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(n),i.unmap();const l=r.createCommandEncoder();l.copyBufferToBuffer(i,0,this.buffer,0,t*4),r.queue.submit([l.finish()]),i.mapAsync(GPUMapMode.WRITE).then(()=>this.mapAsyncReady.push(i))}}}class N0{uuid;index;usage;groupBufferSize;matrixBufferDst;constructor(){this.uuid=zt(),this.groupBufferSize=0,this.usage=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.cacheWorldMatrix()}cacheWorldMatrix(){this.groupBufferSize=R.maxCount*R.blockBytes,this.matrixBufferDst=new M0(this.groupBufferSize/4),this.matrixBufferDst.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBufferDst.buffer.label=this.groupBufferSize.toString()}writeBuffer(e){const t=R.dynamicMatrixBytes;this.matrixBufferDst.mapAsyncWrite(t,e)}}class xe{static _cameraBindGroups;static _lightEntriesMap;static _reflectionEntriesMap;static modelMatrixBindGroup;static init(){this.modelMatrixBindGroup=new N0,this._cameraBindGroups=new Map,this._lightEntriesMap=new Map,this._reflectionEntriesMap=new Map}static getAllCameraGroup(){return this._cameraBindGroups}static getCameraGroup(e){let t=this._cameraBindGroups.get(e);return t||(t=new $n(this.modelMatrixBindGroup),this._cameraBindGroups.set(e,t)),e.isShadowCamera?t.setShadowCamera(e):t.setCamera(e),t}static updateCameraGroup(e){let t=this._cameraBindGroups.get(e);t||(t=new $n(this.modelMatrixBindGroup),this._cameraBindGroups.set(e,t)),e.isShadowCamera?t.setShadowCamera(e):t.setCamera(e)}static getLightEntries(e){e||console.log("getLightEntries scene is null");let t=this._lightEntriesMap.get(e);return t||(t=new Q0,this._lightEntriesMap.set(e,t)),this._lightEntriesMap.get(e)}static getReflectionEntries(e){e||console.log("getLightEntries scene is null");let t=this._reflectionEntriesMap.get(e);return t||(t=new T0,this._reflectionEntriesMap.set(e,t)),this._reflectionEntriesMap.get(e)}}class k{static lastGeometry;static lastPipeline;static lastShader;static drawCount=0;static renderPassCount=0;static geometryCount=0;static pipelineCount=0;static matrixCount=0;static lastRenderPassState;static LastCommand;static bindPipeline(e,t){if(k.lastShader!=t)k.lastShader=t;else return!1;k.lastPipeline!=t.pipeline&&(k.lastPipeline=t.pipeline,e.setPipeline(t.pipeline));for(let a=1;a<t.bindGroups.length;a++){const r=t.bindGroups[a];r&&e.setBindGroup(a,r)}return!0}static bindCamera(e,t){let a=xe.getCameraGroup(t);e.setBindGroup(0,a.globalBindGroup)}static bindGeometryBuffer(e,t){if(this.lastGeometry!=t&&(this.lastGeometry=t,t.indicesBuffer)){e.setIndexBuffer(t.indicesBuffer.indicesGPUBuffer.buffer,t.indicesBuffer.indicesFormat);let a=t.vertexBuffer.vertexGPUBuffer,r=t.vertexBuffer.vertexBufferLayouts;for(let i=0;i<r.length;i++){const n=r[i];e.setVertexBuffer(i,a.buffer,n.offset,n.size)}}}static cleanCache(){this.lastGeometry=null,this.lastPipeline=null,this.lastShader=null}static createPipeline(e){return dt.countStart("GPUContext","pipeline"),I.device.createRenderPipeline(e)}static beginCommandEncoder(){return dt.countStart("GPUContext","beginCommandEncoder"),this.LastCommand&&I.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=I.device.createCommandEncoder(),this.LastCommand}static endCommandEncoder(e){this.LastCommand==e&&(I.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=null,dt.countStart("GPUContext","endCommandEncoder"))}static recordBundleEncoder(e){return I.device.createRenderBundleEncoder(e)}static beginRenderPass(e,t){if(this.cleanCache(),this.renderPassCount++,this.lastRenderPassState=t,t.depthTexture){let a=t.renderPassDescriptor.depthStencilAttachment;a.view=t.depthTexture.getGPUView()}if(t.renderTargets&&t.renderTargets.length>0){for(let a=0;a<t.renderTargets.length;++a){const r=t.renderTargets[a];let i=t.renderPassDescriptor.colorAttachments[a];t.multisample>0&&t.renderTargets.length==1?(i.view=t.multiTexture.createView(),i.resolveTarget=r.getGPUView()):i.view=r.getGPUTexture().createView()}return e.beginRenderPass(t.renderPassDescriptor)}else{let a=t.renderPassDescriptor.colorAttachments[0];return a&&(t.multisample>0?(a.view=t.multiTexture.createView(),a.resolveTarget=I.context.getCurrentTexture().createView()):a.view=I.context.getCurrentTexture().createView()),e.beginRenderPass(t.renderPassDescriptor)}}static drawIndexed(e,t,a,r,i,n){e.drawIndexed(t,a,r,i,n),this.drawCount++}static draw(e,t,a,r,i){e.draw(t,a,r,i),this.drawCount++}static endPass(e){e.insertDebugMarker("end"),e.end()}static computeCommand(e,t){let a=e.beginComputePass();for(let r=0;r<t.length;r++)t[r].compute(a);a.end()}static copyTexture(e,t,a){e.copyTextureToTexture({texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{width:a.width,height:a.height,depthOrArrayLayers:1})}}class P0{source;input;output;reset(e){this.input&&this.input.destroy(),this.output&&this.output.destroy(),this.input=this.output=null,this.source=e}apply(e){if(this.source){if(!this.input){let t=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;this.input=new Pe(this.source.length,t,this.source),this.input.apply()}if(!this.output){let t=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC;this.output=new Pe(e*3,t),this.output.apply()}}}}class V0{enable;morphTargetsRelative;MaxMorphTargetCount=64;_computeConfigArray;_computeConfigBuffer;_morphInfluenceArray;_morphInfluenceBuffer;_positionAttrDataGroup;_normalAttrDataGroup;_isInfluenceDirty;_morphTargetCount;_totalVertexCount;_computeShader;_computeShaders;_computeWorkGroupXY=1;_collectMorphTargetData;_blendTarget;constructor(){this._isInfluenceDirty=!0,this.generateGPUBuffer(),this._positionAttrDataGroup=new P0,this._normalAttrDataGroup=new P0}initMorphTarget(e){this._collectMorphTargetData=this.collectMorphTargetList(e),this._computeShader&&this._computeShader.destroy();let t=Ht.CsMain;this._computeShader=new Fe(t),this._collectMorphTargetData.mergedNormal?this._computeShader.setDefine("USE_MORPHNORMALS",!0):this._computeShader.deleteDefine("USE_MORPHNORMALS"),this._computeShaders=[this._computeShader],this._isInfluenceDirty=!0,this._morphTargetCount=this._collectMorphTargetData.mtCount,this._totalVertexCount=this._collectMorphTargetData.vCount,this._morphInfluenceArray.fill(0),this._computeWorkGroupXY=this.calcWorkGroup(this._totalVertexCount),this._positionAttrDataGroup.reset(this._collectMorphTargetData.mergedPos),this._normalAttrDataGroup.reset(this._collectMorphTargetData.mergedNormal)}applyRenderShader(e){this.uploadMorphTargetBuffer(),this.uploadConfigGBuffer(),e.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),e.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&e.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)}computeMorphTarget(e){this.uploadConfigGBuffer(),this.uploadMorphTargetBuffer(),this._computeShader.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),this._computeShader.setStorageBuffer("morphTargetInfluence",this._morphInfluenceBuffer),this._computeShader.setStorageBuffer("morphTargetPositions",this._positionAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&(this._computeShader.setStorageBuffer("morphTargetNormals",this._normalAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)),this._computeShader.workerSizeX=this._computeWorkGroupXY,this._computeShader.workerSizeY=this._computeWorkGroupXY,this._computeShader.workerSizeZ=1,k.computeCommand(e,this._computeShaders)}updateInfluence(e,t){this._isInfluenceDirty=!0,this._morphInfluenceArray[e]=t}get blendShape(){return this._blendTarget}collectMorphTargetList(e){let t=this.collectAttribute("a_morphPositions_",e),a=t.length,r=t[0].data.length/3;if(this._blendTarget={},e.blendShapeData)for(let l=0;l<e.blendShapeData.shapeIndexs.length;l++){let c=e.blendShapeData.shapeIndexs[l],f=e.blendShapeData.shapeNames[l].split("."),d=f[f.length-1];this._blendTarget[d]=h=>this.updateInfluence(c,h)}let i=new Float32Array(r*a*3);{let l=0;for(let c=0;c<a;c++){let f=t[c];i.set(f.data,l),l+=f.data.length}}let n=this.collectAttribute("a_morphNormals_",e),o;if(n&&n.length>0){let l=0;o=new Float32Array(r*a*3);for(let c=0;c<a;c++){let f=n[c];o.set(f.data,l),l+=f.data.length}}return{mtCount:a,vCount:r,mergedPos:i,mergedNormal:o}}collectAttribute(e,t){let a=[];for(let r=0;r<this.MaxMorphTargetCount;r++){let i=e+r,n=t.getAttribute(i);if(n)a[r]=n;else break}return a}uploadConfigGBuffer(){if(this._isInfluenceDirty){let e=0;for(let t=0;t<this._morphTargetCount;t++)e+=this._morphInfluenceArray[t];this._morphInfluenceBuffer.setFloat32Array("data",this._morphInfluenceArray),this._morphInfluenceBuffer.apply(),this._computeConfigArray[0]=this.morphTargetsRelative?1:1-e,this._computeConfigArray[1]=this._morphTargetCount,this._computeConfigArray[2]=this._totalVertexCount,this._computeConfigArray[3]=this._computeWorkGroupXY,this._computeConfigBuffer.setFloat32Array("data",this._computeConfigArray),this._computeConfigBuffer.apply(),this._isInfluenceDirty=!1}}calcWorkGroup(e){let t=Math.ceil(Math.sqrt(e)),a=Math.ceil(Math.log2(t));return t=Math.pow(2,a),t}uploadMorphTargetBuffer(){this._positionAttrDataGroup.output||this._positionAttrDataGroup.apply(this._totalVertexCount),this._normalAttrDataGroup.output||this._normalAttrDataGroup.apply(this._totalVertexCount)}generateGPUBuffer(){this._computeConfigArray=new Float32Array(4),this._computeConfigBuffer=new Ct(4),this._morphInfluenceArray=new Float32Array(this.MaxMorphTargetCount);let e=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;this._morphInfluenceBuffer=new Pe(this.MaxMorphTargetCount,e)}destroy(e){this._computeConfigBuffer&&(this._computeConfigBuffer.destroy(e),this._computeConfigBuffer=null),this._morphInfluenceBuffer&&(this._morphInfluenceBuffer.destroy(e),this._morphInfluenceBuffer=null),this._computeShader&&(this._computeShader.destroy(e),this._computeShader=null),this._positionAttrDataGroup&&(this._positionAttrDataGroup.input&&this._positionAttrDataGroup.input.destroy(e),this._positionAttrDataGroup.output&&this._positionAttrDataGroup.output.destroy(e),this._positionAttrDataGroup=null),this._normalAttrDataGroup&&(this._normalAttrDataGroup.input&&this._normalAttrDataGroup.input.destroy(e),this._normalAttrDataGroup.output&&this._normalAttrDataGroup.output.destroy(e),this._normalAttrDataGroup=null),this._computeConfigArray=null,this._morphInfluenceArray=null,this._collectMorphTargetData=null,this._blendTarget=null,this._computeShaders=null}}var eb=Object.defineProperty,tb=Object.getOwnPropertyDescriptor,eo=(s,e,t,a)=>{for(var r=a>1?void 0:a?tb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(a?n(e,t,r):n(r))||r);return a&&r&&eb(e,t,r),r};let he=class extends Ba{receiveShadow;morphData;constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(s){s.addComponent(he).copyComponent(this)}copyComponent(s){return super.copyComponent(s),this.receiveShadow=s.receiveShadow,this}get geometry(){return this._geometry}set geometry(s){if(super.geometry=s,s){let e=s.morphTargetDictionary!=null;e&&(this.morphData||=new V0,this.morphData.morphTargetsRelative=s.morphTargetsRelative,this.morphData.initMorphTarget(s)),this.morphData&&(this.morphData.enable=e),this.morphData?.enable?this.addRendererMask(Ne.MorphTarget):this.removeRendererMask(Ne.MorphTarget),this.object3D.bound=this._geometry.bounds.clone()}else this.morphData&&(this.morphData.enable=!1),this.removeRendererMask(Ne.MorphTarget);this._readyPipeline||(this.initPipeline(),this._computes&&(this.onCompute=Cs(this.onCompute,()=>{for(let e=0;e<this._computes.length;e++)this._computes[e].onUpdate()})))}get material(){return this._materials[0]}set material(s){this.materials=[s]}setMorphInfluence(s,e){if(this.morphData&&this.morphData.enable){let t=this._geometry.morphTargetDictionary[s];t>=0&&this.morphData.updateInfluence(t,e)}}setMorphInfluenceIndex(s,e){this.morphData&&this.morphData.enable&&s>=0&&this.morphData.updateInfluence(s,e)}onCompute(s,e){this.morphData&&this.morphData.enable&&this.morphData.computeMorphTarget(e)}nodeUpdate(s,e,t,a){if(this.morphData&&this.morphData.enable)for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++)this.morphData.applyRenderShader(n[o])}super.nodeUpdate(s,e,t,a)}destroy(s){this.morphData&&(this.morphData.destroy(s),this.morphData=null),super.destroy(s)}};eo([Kr],he.prototype,"geometry",1),eo([Kr],he.prototype,"material",1),he=eo([Ot(he,"MeshRenderer")],he);class Pa{static compressGBufferTex_NAME="compressGBufferTex_NAME";static colorBufferTex_NAME="colorBufferTex";static positionBufferTex_NAME="positionBufferTex";static normalBufferTex_NAME="normalBufferTex";static materialBufferTex_NAME="materialBufferTex";static zBufferTexture_NAME="zBufferTexture";static zPreDepthTexture_NAME="zPreDepthTexture";static outTex_NAME="outTex"}class O0{label="";customSize=!1;zPreTexture=null;depthTexture=null;renderTargetTextures;outColor=-1;renderTargets;rtTextureDescriptors;irradianceBuffer;multisample=0;multiTexture;depthViewIndex=0;depthCleanValue=0;isOutTarget=!0;camera3D;rtFrame;renderPassDescriptor;renderBundleEncoderDescriptor;depthLoadOp;getLastRenderTexture(){return this.renderTargets&&this.renderTargets.length>0?this.renderTargets[0]:_.res.redTexture}}class Rt extends ut{resolveTarget;sampleCount;autoResize;clear;constructor(e,t,a=oe.rgba8unorm,r=!1,i,n=1,o=0,l=!0,c=!0){super(e,t,n),this.name=zt(),this.autoResize=c,this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.clear=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t),this.autoResize&&I.addEventListener(lr.RESIZE,f=>{let{width:d,height:h}=f.data;this.resize(d,h),this._textureChange=!0},this)}resize(e,t){let a=I.device;this.gpuTexture&&(ut.delayDestroyTexture(this.gpuTexture),this.gpuTexture=null,this.view=null),this.width=e,this.height=t,this.createTextureDescriptor(e,t,1,this.format,this.usage,this.numberLayer,this.sampleCount),this.useMipmap=!1,this.visibility=GPUShaderStage.COMPUTE|GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,this.format==oe.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==oe.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==oe.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float",this.sampleCount>0&&(this.textureBindingLayout.multisampled=!0),this.minFilter="linear",this.magFilter="linear",this.mipmapFilter="linear",this.addressModeU=Kt.clamp_to_edge,this.addressModeV=Kt.clamp_to_edge,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=I.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=k.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(l)}clone(){let e=new Rt(this.width,this.height,this.format,this.useMipmap,this.usage,this.numberLayer,this.sampleCount,this.clear,this.autoResize);return e.name="clone_"+e.name,e}readTextureToImage(){let e=I.device,t=I.windowWidth,a=I.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return k.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class Je{storeOp="store";loadOp="clear";clearValue=[0,0,0,0]}class lt{label;customSize=!1;renderTargets;rtDescriptors;zPreTexture;depthTexture;depthViewIndex=0;depthCleanValue=1;depthLoadOp="clear";isOutTarget=!0;constructor(e,t,a,r,i=!0){this.renderTargets=e,this.rtDescriptors=t,this.depthTexture=a,this.zPreTexture=r,this.isOutTarget=i}clone2Frame(e){e.renderTargets.push(...this.renderTargets.concat());for(let t=0;t<this.rtDescriptors.length;t++){const a=this.rtDescriptors[t];let r=new Je;r.loadOp=a.loadOp,r.storeOp=a.storeOp,r.clearValue=a.clearValue,e.rtDescriptors.push(r)}e.depthTexture=this.depthTexture,e.zPreTexture=this.zPreTexture,e.customSize=this.customSize}clone(){let e=new lt([],[]);return this.clone2Frame(e),e}}class ve extends lt{static colorPass_GBuffer="ColorPassGBuffer";static reflections_GBuffer="reflections_GBuffer";static gui_GBuffer="gui_GBuffer";static gBufferMap=new Map;_colorBufferTex;_compressGBufferTex;constructor(){super([],[])}createGBuffer(e,t,a,r=!0,i=!0,n){let o=this.renderTargets,l=this.rtDescriptors;if(i){let f=new Je;f.loadOp="clear",this._colorBufferTex=Mt.createRTTexture(e+Pa.colorBufferTex_NAME,t,a,oe.rgba16float,!0),o.push(this._colorBufferTex),l.push(f)}this._compressGBufferTex=new Rt(t,a,oe.rgba32float,!1,void 0,1,0,!0,!0),o.push(this._compressGBufferTex),n?this.depthTexture=n:(this.depthTexture=new Rt(t,a,oe.depth24plus,!1,void 0,1,0,!0,!0),this.depthTexture.name=e+"_depthTexture");let c;c=new Je,l.push(c)}getPositionMap(){return this.renderTargets[1]}getNormalMap(){return this.renderTargets[2]}getColorTexture(){return this._colorBufferTex}getCompressGBufferTexture(){return this._compressGBufferTex}static getGBufferFrame(e,t=0,a=0,r=!0,i){let n;if(ve.gBufferMap.has(e))n=ve.gBufferMap.get(e);else{n=new ve;let o=I.presentationSize;n.createGBuffer(e,t==0?o[0]:t,a==0?o[1]:a,t!=0&&a!=0,r,i),ve.gBufferMap.set(e,n)}return n}static getGUIBufferFrame(){let e=this.getGBufferFrame(this.colorPass_GBuffer);return ve.getGBufferFrame(ve.gui_GBuffer,0,0,!0,e.depthTexture)}clone(){let e=new ve;return this.clone2Frame(e),e}}class He{static rendererPassState=new Map;static createRendererPassState(e,t=null){let a=He.rendererPassState.get(e);if(a||(a=new O0,a.label=e.label,a.customSize=e.customSize,a.rtFrame=e,a.zPreTexture=e.zPreTexture,a.depthTexture=e.depthTexture,a.depthViewIndex=e.depthViewIndex,a.isOutTarget=e.isOutTarget,a.depthCleanValue=e.depthCleanValue,a.depthLoadOp=e.depthLoadOp,He.rendererPassState.set(e,a)),e&&e.renderTargets.length>0){a.renderTargets=e.renderTargets,a.rtTextureDescriptors=e.rtDescriptors,a.renderPassDescriptor=He.getRenderPassDescriptor(a),a.renderPassDescriptor.depthStencilAttachment&&(a.renderPassDescriptor.depthStencilAttachment.depthLoadOp=e.depthLoadOp),t=="load"&&e?.renderTargets[0]&&e.renderTargets[0].name.startsWith(ve.gui_GBuffer)&&(a.renderPassDescriptor.colorAttachments[0].loadOp="load"),a.depthLoadOp=e.depthLoadOp,a.renderBundleEncoderDescriptor=He.getRenderBundleDescriptor(a),a.renderTargetTextures=[];for(let r=0;r<e.renderTargets.length;r++){const i=e.renderTargets[r];a.renderTargetTextures[r]={format:i.format},i.name.indexOf(Pa.colorBufferTex_NAME)!=-1&&(a.outColor=r)}}else a.renderPassDescriptor=He.getRenderPassDescriptor(a,t),a.renderBundleEncoderDescriptor=He.getRenderBundleDescriptor(a),a.renderTargetTextures=[{format:I.presentationFormat}],a.outColor=0;return a}static getRenderPassDescriptor(e,t=null){if(e.renderPassDescriptor)return e.renderPassDescriptor;I.device,I.presentationSize;let a=[];if(e.renderTargets&&e.renderTargets.length>0){e.renderTargets[0].width,e.renderTargets[0].height;for(let i=0;i<e.renderTargets.length;i++){const n=e.renderTargets[i],o=e.rtTextureDescriptors[i];a.push({view:n.getGPUView(),resolveTarget:void 0,loadOp:o.loadOp,clearValue:o.clearValue,storeOp:o.storeOp})}}else if(!e.customSize){let i=I.canvasConfig&&I.canvasConfig.alpha?[1,1,1,0]:[0,0,0,1];e.isOutTarget==!0&&a.push({view:void 0,resolveTarget:void 0,loadOp:I.canvasConfig&&I.canvasConfig.alpha||t!=null?"load":"clear",clearValue:i,storeOp:"store"})}let r=null;return e.depthTexture||e.zPreTexture?(e.zPreTexture&&(e.depthTexture=e.zPreTexture),r={label:`${e.label} renderPassDescriptor zPreTexture${e.zPreTexture?"load":"clear"}`,colorAttachments:a,depthStencilAttachment:{view:e.depthTexture.getGPUView(),depthLoadOp:e.zPreTexture?"load":e.depthLoadOp,depthClearValue:e.zPreTexture?1:e.depthCleanValue,depthStoreOp:"store"}}):r={colorAttachments:a,label:"renderPassDescriptor not writeDepth"},e.renderPassDescriptor=r,r}static getRenderBundleDescriptor(e){if(e.renderBundleEncoderDescriptor)return e.renderBundleEncoderDescriptor;I.presentationSize;let t=[];if(e.renderTargets&&e.renderTargets.length>0){e.renderTargets[0].width,e.renderTargets[0].height;for(let r=0;r<e.renderTargets.length;r++){const i=e.renderTargets[r];t.push(i.format)}}let a=null;return e.depthTexture?a={colorFormats:t,depthStencilFormat:e.depthTexture.format}:a={colorFormats:t},e.renderBundleEncoderDescriptor=a,e.renderBundleEncoderDescriptor}}class si extends Le{width;height;segmentW;segmentH;up;constructor(e,t,a=1,r=1,i=b.Y_AXIS){super(),this.width=e,this.height=t,this.segmentW=a,this.segmentH=r,this.up=i,this.buildGeometry(this.up)}buildGeometry(e){var t,a,r,i,n=this.segmentW+1;(this.segmentH+1)*n,this.bounds=new Ce(b.ZERO.clone(),new b(this.width,1,this.height)),r=this.segmentH*this.segmentW*6;let o=(this.segmentW+1)*(this.segmentH+1),l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d;this.segmentW*this.segmentH*2*3>=Uint16Array.length?d=new Uint32Array(this.segmentW*this.segmentH*2*3):d=new Uint16Array(this.segmentW*this.segmentH*2*3),r=0;for(var u=0,m=0,g=0,p=0;p<=this.segmentH;++p)for(var D=0;D<=this.segmentW;++D){switch(t=(D/this.segmentW-.5)*this.width,a=(p/this.segmentH-.5)*this.height,e){case b.Y_AXIS:l[u++]=t,l[u++]=0,l[u++]=a,c[m++]=0,c[m++]=1,c[m++]=0;break;case b.Z_AXIS:l[u++]=t,l[u++]=-a,l[u++]=0,c[m++]=0,c[m++]=0,c[m++]=1;break;case b.X_AXIS:l[u++]=0,l[u++]=t,l[u++]=a,c[m++]=1,c[m++]=0,c[m++]=0;break;default:l[u++]=t,l[u++]=0,l[u++]=a,c[m++]=0,c[m++]=1,c[m++]=0;break}f[g++]=D/this.segmentW,f[g++]=p/this.segmentH,D!=this.segmentW&&p!=this.segmentH&&(i=D+p*n,d[r++]=i+1,d[r++]=i,d[r++]=i+n,d[r++]=i+1,d[r++]=i+n,d[r++]=i+n+1)}this.setIndices(d),this.setAttribute(G.position,l),this.setAttribute(G.normal,c),this.setAttribute(G.uv,f),this.setAttribute(G.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}var ab=Object.getOwnPropertyDescriptor,rb=(s,e,t,a)=>{for(var r=a>1?void 0:a?ab(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ei=class extends At{constructor(s="QuadGlsl_vs",e="QuadGlsl_fs"){super();let t=new qe(s,e);this.addRenderPass(t);let a=t.shaderState;t.blendMode=De.NONE,a.frontFace="cw",a.depthWriteEnabled=!1,a.depthCompare=ft.always,a.multisample=0,this.setTexture("baseMap",_.res.blackTexture),this.setUniformFloat("x",0),this.setUniformFloat("y",0),this.setUniformFloat("width",100),this.setUniformFloat("height",100)}};Ei=rb([Na(Ei,"QuadShader")],Ei);class to extends ne{width=128;height=128;quadRenderer;material;rendererPassState;quadShader;constructor(e="QuadGlsl_vs",t="QuadGlsl_fs",a,r=0,i=!1){super();let n=a?a.renderTargets:[];this.material=new vt,this.quadShader=new Ei(e,t),this.material.shader=this.quadShader,this.quadRenderer=this.addComponent(he),this.quadRenderer.material=this.material,this.quadRenderer.castGI=!1,this.quadRenderer.castShadow=!1,this.quadRenderer.drawType=i?2:0,this.quadRenderer.geometry=new si(100,100,1,1),this.quadRenderer.material=this.material,this.quadRenderer.__start(),this.quadRenderer._enable=!0,this.quadRenderer.onEnable(),this.rendererPassState=He.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=I.device.createTexture({size:{width:I.presentationSize[0],height:I.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT})),I.addEventListener(lr.RESIZE,o=>{this.rendererPassState=He.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=I.device.createTexture({size:{width:I.presentationSize[0],height:I.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT}))},this)}renderTarget(e,t,a){let r=e.camera,i=k.beginRenderPass(a,t.rendererPassState);k.bindCamera(i,r),t.quadRenderer.nodeUpdate(e,fe.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,fe.COLOR,t.rendererPassState,null,i),k.endPass(i)}renderToViewQuad(e,t,a,r){let i=e.camera;t.quadShader.setTexture("baseMap",r);let n=k.beginRenderPass(a,t.rendererPassState);k.bindCamera(n,i),t.quadRenderer.nodeUpdate(e,fe.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,fe.COLOR,t.rendererPassState,null,n),k.endPass(n)}}class Mt{static rtTextureMap;static rtViewQuad;static init(){this.rtTextureMap=new Map,this.rtViewQuad=new Map}static createRTTexture(e,t,a,r,i=!1,n=0){let o=this.rtTextureMap.get(e);return o||(e==Pa.colorBufferTex_NAME?o=new Rt(t,a,r,i,void 0,1,n,!1):o=new Rt(t,a,r,i,void 0,1,n,!0),o.name=e,Mt.rtTextureMap.set(e,o)),o}static createRTTextureArray(e,t,a,r,i=1,n=!1,o=0){let l=this.rtTextureMap.get(e);return l||(l=new Rt(t,a,r,n,void 0,i,o),l.name=e,Mt.rtTextureMap.set(e,l)),l}static createViewQuad(e,t,a,r,i=0){let n=new lt([r],[new Je]),o=new to(t,a,n,i);return Mt.rtViewQuad.set(e,o),o}static getTexture(e){return this.rtTextureMap.get(e)}static CreateSplitTexture(e){let t=this.getTexture(Pa.colorBufferTex_NAME),a=this.getTexture(e+"_split");return a||(a=this.createRTTexture(e+"_split",t.width,t.height,t.format,!1)),a}static WriteSplitColorTexture(e){let t=this.getTexture(Pa.colorBufferTex_NAME),a=this.getTexture(e+"_split");const r=k.beginCommandEncoder();r.copyTextureToTexture({texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{width:a.width,height:a.height,depthOrArrayLayers:1}),k.endCommandEncoder(r)}}class ao{command;encoder;rendererPassStates;rtFrame;constructor(e){this.rtFrame=e,this.rendererPassStates=[]}clean(){this.rendererPassStates.length=0,k.cleanCache()}beginContinueRendererPassState(e="load",t="load"){if(this.rendererPassStates.length>0){let a=this.rtFrame.clone();for(const i of a.rtDescriptors)i.loadOp="load";a.depthLoadOp=t;let r=He.createRendererPassState(a,e);return this.rendererPassStates.push(r),r}else{this.rtFrame.depthLoadOp=t;let a=He.createRendererPassState(this.rtFrame,e);return this.rendererPassStates.push(a),a}}get rendererPassState(){return this.rendererPassStates[this.rendererPassStates.length-1]}beginOpaqueRenderPass(){this.beginContinueRendererPassState("clear","clear"),this.begineNewCommand(),this.beginNewEncoder()}beginTransparentRenderPass(){this.beginContinueRendererPassState("load","load"),this.begineNewCommand(),this.beginNewEncoder()}specialtRenderPass(){this.beginContinueRendererPassState("load","load"),this.begineNewCommand(),this.beginNewEncoder()}endRenderPass(){this.endEncoder(),this.endCommand()}begineNewCommand(){return this.command=k.beginCommandEncoder(),this.command}endCommand(){k.endCommandEncoder(this.command),this.command=null}beginNewEncoder(){return this.encoder=k.beginRenderPass(this.command,this.rendererPassState),this.encoder}endEncoder(){k.endPass(this.encoder),this.encoder=null}}class Va extends Za{rendererPassState;splitRendererPassState;useRenderBundle=!1;debugViewQuads;debugTextures;renderContext;_rendererType;_rtFrame;get passType(){return this._rendererType}set passType(e){this._rendererType=e}constructor(){super(),this.debugTextures=[],this.debugViewQuads=[]}setRenderStates(e){if(this._rtFrame=e,e){this.rendererPassState=He.createRendererPassState(e);let t=e.clone();t.depthLoadOp="load";for(const a of t.rtDescriptors)a.loadOp="load";this.splitRendererPassState=He.createRendererPassState(t)}this.renderContext=new ao(e)}getRenderContext(e){return this._rtFrame=e,new ao(e)}setIrradiance(e,t){this.rendererPassState.irradianceBuffer=[e,t]}compute(e,t){}render(e,t,a,r=!1){k.cleanCache();let i=e.camera,n=e.scene;this.rendererPassState.camera3D=i;let o=q.instance.getRenderNodes(n,i),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{let f=k.beginCommandEncoder(),d=k.beginRenderPass(f,this.rendererPassState);l.length>0&&d.executeBundles(l),!r&&q.instance.sky&&(k.bindCamera(d,i),q.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,d)),this.drawRenderNodes(e,d,f,o.opaqueList,t),k.endPass(d),k.endCommandEncoder(f)}{let f=k.beginCommandEncoder(),d=k.beginRenderPass(f,this.rendererPassState);c.length>0&&d.executeBundles(c),r||(k.bindCamera(d,i),this.drawRenderNodes(e,d,f,o.transparentList,t)),k.endPass(d),k.endCommandEncoder(f)}}nodeUpload(e,t,a){}occlusionRenderNodeTest(e,t,a){return a?a.occlusionRenderNodeTest(e)>0:!0}renderOp(e,t,a,r,i){}renderTr(e,t,a,r,i){}renderBundleOp(e,t,a,r){let i=q.instance.getOpRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=k.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}renderBundleTr(e,t,a,r){let i=q.instance.getTrRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=k.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}recordRenderBundleNode(e,t,a,r){k.bindCamera(t,e.camera),k.bindGeometryBuffer(t,a[0].geometry);for(let i=0;i<a.length;++i){let n=a[i];n.transform.worldMatrix.index,n.transform.enable&&n.recordRenderPass2(e,this._rendererType,this.rendererPassState,r,t)}}drawRenderNodes(e,t,a,r,i,n){k.bindCamera(t,e.camera);for(let o=_.setting.render.drawOpMin;o<Math.min(r.length,_.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)}}}class L0 extends Va{constructor(){super(),this.passType=fe.COLOR}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,n=e.camera;xe.updateCameraGroup(n),this.rendererPassState.camera3D=n;let o=q.instance.getRenderNodes(i,n),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{this.renderContext.beginOpaqueRenderPass();let f=this.renderContext.encoder;l.length>0&&(q.instance.getOpRenderGroup(i),f.executeBundles(l)),!r&&q.instance.sky&&(k.bindCamera(f,n),q.instance.sky.preInit(this._rendererType)||q.instance.sky.nodeUpdate(e,this._rendererType,this.rendererPassState,a),q.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,f)),o.opaqueList&&(k.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let f=this.renderContext.encoder;c.length>0&&f.executeBundles(c),!r&&o.transparentList&&(k.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.transparentList,t,a));let d=q.instance.getGraphicList();for(let h=0;h<d.length;h++){const u=d[h];u.nodeUpdate(e,this._rendererType,this.splitRendererPassState,a),u.renderPass2(e,this._rendererType,this.splitRendererPassState,a,f)}this.renderContext.endRenderPass(),dt.end("ColorPass Draw Transparent")}}drawNodes(e,t,a,r,i){let n=q.instance.getRenderShaderCollect(e);if(n){for(const o of n){let l=o[1];for(const c of l){let f=c[1];if(!f.isDestroyed&&f.preInit(this._rendererType)){f.nodeUpdate(e,this._rendererType,this.rendererPassState,i);break}}}for(let o=_.setting.render.drawOpMin;o<Math.min(a.length,_.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(l.hasMask(Ne.UI)&&!l.isRecievePostEffectUI||l.isDestroyed||(l.preInit(this._rendererType)||l.nodeUpdate(e,this._rendererType,this.rendererPassState,i),l.renderPass(e,this.passType,this.renderContext)))}}}occlusionRenderNodeTest(e,t,a){return a.zDepthRenderNodeTest(t)>0}}class ro{frustumCullingList;zVisibleList;_renderList;static enable=!0;constructor(){this._renderList=new Map}occlusionRenderNodeTest(e){return _.setting.occlusionQuery.enable?this.frustumCullingList?this.frustumCullingList[e]:0:1}zDepthRenderNodeTest(e){return this.zVisibleList?this.zVisibleList[e]:0}update(e,t){}collect(e,t){}renderCommitTesting(e,t){return!0}}class ni extends Ya{constructor(e,t){super(),this.bufferType=Aa.ComputeGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,e,t,"ComputeGPUBuffer")}}class G0{clusterBuffer;lightAssignBuffer;assignTableBuffer;clustersUniformBuffer;constructor(e,t){this.clusterBuffer=new ni(e*2*4),this.clustersUniformBuffer=new Ct(10),this.clustersUniformBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.lightAssignBuffer=new ni(e*t),this.lightAssignBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.assignTableBuffer=new ni(e*4),this.assignTableBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e,t,a,r,i,n,o,l,c,f){this.clustersUniformBuffer.setFloat("clusterTileX",r),this.clustersUniformBuffer.setFloat("clusterTileY",i),this.clustersUniformBuffer.setFloat("clusterTileZ",n),this.clustersUniformBuffer.setFloat("numLights",o),this.clustersUniformBuffer.setFloat("maxNumLightsPerCluster",l),this.clustersUniformBuffer.setFloat("near",c),this.clustersUniformBuffer.setFloat("far",f),this.clustersUniformBuffer.setFloat("screenWidth",e),this.clustersUniformBuffer.setFloat("screenHeight",t),this.clustersUniformBuffer.setFloat("clusterPix",a),this.clustersUniformBuffer.apply()}}class Et{static clusterTileX=16;static clusterTileY=16;static clusterTileZ=32}let z0=`
|
|
6149
|
+
`;var Z2=Object.getOwnPropertyDescriptor,Y2=(s,e,t,a)=>{for(var r=a>1?void 0:a?Z2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ki=class extends At{constructor(){super(),Y.register("pointcloud_vs_dc",F0),Y.register("pointcloud_fs_dc",k0);const s=new qe("pointcloud_vs_dc","pointcloud_fs_dc");s.passType=fe.COLOR,s.setShaderEntry("VertMain","FragMain"),s.topology=Ss.triangle_list,s.depthWriteEnabled=!0,s.cullMode=Lt.none,s.shaderState.transparent=!1,s.shaderState.blendMode=De.NORMAL,s.shaderState.writeMasks=[15,15],s.shaderState.castReflection=!1,this.addRenderPass(s),this.setDefault()}setDefault(){const s=this.getDefaultColorShader(),e=new R;s.setUniform("modelMatrix",e.rawData),s.setUniformArray("tex_params",new Float32Array([0,0,0,4])),s.setUniformArray("pointParams",new Float32Array([0,0,0,128]))}};ki=Y2([Na(ki,"PointCloudShader")],ki);class E0 extends vt{_texParams=new Float32Array([0,0,0,4]);_pointParamsArray=new Float32Array([0,0,0,128]);constructor(){super(),this.shader=new ki}setPointTextures(e,t,a,r){const i=this.shader.getDefaultColorShader();if(!i.getUniform("modelMatrix")){const n=new R;i.setUniform("modelMatrix",n.rawData)}i.setTexture("pointColor",t),i.setTexture("pointPosition",e),this._texParams[0]=a[0],this._texParams[1]=a[1],this._texParams[2]=a[2],this._texParams[3]=a[3],i.setUniformArray("tex_params",this._texParams),i.setUniformArray("pointParams",this._pointParamsArray),r&&i.setTexture("pointOrder",r),i.shaderState.depthCompare=nt.less}setTransformMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}setPointSize(e){this._texParams[3]=Math.max(.1,e),this.shader.getDefaultColorShader().setUniformArray("tex_params",this._texParams)}setPointShape(e){this._pointParamsArray[0]=e==="circle"?1:0,this.shader.getDefaultColorShader().setUniformArray("pointParams",this._pointParamsArray)}enableDebugFullScreen(e){this._pointParamsArray[1]=e?1:0,this.shader.getDefaultColorShader().setUniformArray("pointParams",this._pointParamsArray)}setBatchSize(e){this._pointParamsArray[3]=Math.max(1,e|0),this.shader.getDefaultColorShader().setUniformArray("pointParams",this._pointParamsArray)}}class Kn extends Le{batchSize;constructor(e=128){super(),this.batchSize=e;const t=new Float32Array(12*e);for(let r=0;r<e;++r){const i=r*12;t.set([-1,-1,r,1,-1,r,1,1,r,-1,1,r],i)}const a=new Uint32Array(6*e);for(let r=0;r<e;++r){const i=r*4,n=r*6;a.set([0+i,1+i,2+i,0+i,2+i,3+i],n)}this.setAttribute(G.position,t),this.setIndices(a),this.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:t.length/3,firstStart:0,index:0,topology:0})}}class w0 extends ut{create(e,t,a,r=!0){let i=I.device;const n=e*4*4;this.format=oe.rgba32float,this.createTextureDescriptor(e,t,1,this.format);const l=i.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});i.queue.writeBuffer(l,0,a.buffer);const c=k.beginCommandEncoder();return c.copyBufferToTexture({buffer:l,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(c),r&&(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float"),this.gpuSampler=i.createSampler({}),this}fromBuffer(e,t,a){let r=I.device;const i=e*4*4;this.format=oe.rgba32float,this.mipmapCount=1,this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const n=k.beginCommandEncoder();return n.copyBufferToTexture({buffer:a,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(n),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=r.createSampler({}),this}}var X2=Object.getOwnPropertyDescriptor,H2=(s,e,t,a)=>{for(var r=a>1?void 0:a?X2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let qa=class extends Ba{count=0;size=new de;pointColor;pointPosition;pointOrder;texParams;pointCloudMaterial;_positions;get positions(){return this._positions}_colors;_orderData;_fullCount=0;get fullCount(){return this._fullCount}_batchSize=128;instanceCount=0;_texturesInitialized=!1;_debugFullScreen=!1;_centerOffset=new b;get centerOffset(){return this._centerOffset}constructor(){super()}initFromData(s,e,t){if(!s||!e||t<=0){console.error("PointCloudRenderer: Invalid input data");return}if(s.length<t*3){console.error("PointCloudRenderer: Positions array too small");return}if(e.length<t*4){console.error("PointCloudRenderer: Colors array too small");return}this.count=t,this._fullCount=t,this.size=this.evalTextureSize(t),this._positions=s,this._colors=e,this.centerizePositions(),this.buildPositionTexture(),this.buildColorTexture(),this.texParams=new Float32Array([this.count,this.size.x,this.count,4]),this.buildOrderTexture(),this.pointCloudMaterial=new E0,this.geometry=new Kn(this._batchSize),this.materials=[this.pointCloudMaterial],this.instanceCount=Math.ceil(this.count/this._batchSize)}evalTextureSize(s){let e=Math.ceil(Math.sqrt(s));const t=64;e=Math.ceil(e/t)*t;const a=Math.ceil(s/e);return new de(e,a)}centerizePositions(){if(this.count===0)return;let s=0,e=0,t=0;for(let n=0;n<this.count;n++){const o=n*3;s+=this._positions[o+0],e+=this._positions[o+1],t+=this._positions[o+2]}const a=s/this.count,r=e/this.count,i=t/this.count;this._centerOffset.set(a,r,i);for(let n=0;n<this.count;n++){const o=n*3;this._positions[o+0]-=a,this._positions[o+1]-=r,this._positions[o+2]-=i}this.object3D.localPosition=this._centerOffset}buildPositionTexture(){const s=this.size.x|0,e=this.size.y|0,t=this.count,a=new Float32Array(s*e*4);for(let r=0;r<t;r++){const i=r*4,n=r*3;a[i+0]=this._positions[n+0],a[i+1]=this._positions[n+1],a[i+2]=this._positions[n+2],a[i+3]=0}if(t<s*e){const r=(t-1)*4;for(let i=t;i<s*e;i++){const n=i*4;a[n+0]=a[r+0],a[n+1]=a[r+1],a[n+2]=a[r+2],a[n+3]=0}}this.pointPosition=new w0().create(s,e,a),this.pointPosition.name="pointPosition",this.pointPosition.minFilter="nearest",this.pointPosition.magFilter="nearest",this.pointPosition.addressModeU="clamp-to-edge",this.pointPosition.addressModeV="clamp-to-edge"}buildColorTexture(){const s=this.size.x|0,e=this.size.y|0,t=this.count,a=new Uint8Array(s*e*4);for(let r=0;r<t;r++){const i=r*4,n=r*4;a[i+0]=this._colors[n+0],a[i+1]=this._colors[n+1],a[i+2]=this._colors[n+2],a[i+3]=this._colors[n+3]}if(t<s*e){const r=(t-1)*4;for(let i=t;i<s*e;i++){const n=i*4;a[n+0]=a[r+0],a[n+1]=a[r+1],a[n+2]=a[r+2],a[n+3]=a[r+3]}}this.pointColor=new Fi().create(s,e,a,!1),this.pointColor.name="pointColor",this.pointColor.minFilter="nearest",this.pointColor.magFilter="nearest",this.pointColor.mipmapFilter="nearest",this.pointColor.addressModeU="clamp-to-edge",this.pointColor.addressModeV="clamp-to-edge"}buildOrderTexture(){const s=this.size.x*this.size.y;this._orderData=new Uint32Array(s);for(let e=0;e<s;e++)this._orderData[e]=e<this.count?e:this.count>0?this.count-1:0;this.pointOrder=new Qs().create(this.size.x,this.size.y,this._orderData),this.pointOrder.name="pointOrder",this.pointOrder.minFilter="nearest",this.pointOrder.magFilter="nearest",this.pointOrder.addressModeU="clamp-to-edge",this.pointOrder.addressModeV="clamp-to-edge"}nodeUpdate(s,e,t,a){const r=this.object3D.transform.worldMatrix;this.pointCloudMaterial.setTransformMatrix(r),this._texturesInitialized||(this.pointCloudMaterial.setPointTextures(this.pointPosition,this.pointColor,this.texParams,this.pointOrder),this.pointCloudMaterial.setBatchSize(this._batchSize),this.pointCloudMaterial.setPointSize(this.texParams[3]),this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen),this._texturesInitialized=!0),super.nodeUpdate(s,e,t,a)}renderPass(s,e,t){const a=t.encoder;for(let r of this.materials){const i=r.getPass(e);if(!(!i||i.length===0))for(const n of i){if(!n.pipeline)continue;n.apply(this.geometry,t.rendererPassState||t),k.bindPipeline(a,n),k.bindGeometryBuffer(a,this.geometry);const l=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?k.drawIndexed(a,l.indexCount,this.instanceCount,l.indexStart,0,0):k.drawIndexed(a,l.indexCount,1,l.indexStart,0,0)}}}setPointSize(s){this.texParams[3]=Math.max(.1,s),this.pointCloudMaterial&&this.pointCloudMaterial.setPointSize(s)}setPointShape(s){this.pointCloudMaterial&&this.pointCloudMaterial.setPointShape(s)}enableDebugFullScreen(s){this._debugFullScreen=s,this.pointCloudMaterial&&this.pointCloudMaterial.enableDebugFullScreen(s)}setBatchSize(s){if(this._batchSize=Math.max(1,s|0),this.geometry){const e=this.geometry;ke.getInstance().detached(e,this),ke.getInstance().hasReference(e)||e.destroy(),this.geometry=new Kn(this._batchSize)}this.pointCloudMaterial&&(this.pointCloudMaterial.setBatchSize(this._batchSize),this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen)),this.instanceCount=Math.ceil(this.count/this._batchSize)}destroy(s){this.pointColor&&(this.pointColor.destroy(s),this.pointColor=null),this.pointPosition&&(this.pointPosition.destroy(s),this.pointPosition=null),this.pointOrder&&(this.pointOrder.destroy(s),this.pointOrder=null),this._positions=null,this._colors=null,this._orderData=null,this.texParams=null,super.destroy(s)}};qa=H2([Ot(qa,"PointCloudRenderer")],qa);class qn{static maxVector=new b(Number.MAX_VALUE*.1,Number.MAX_VALUE*.1,Number.MAX_VALUE*.1);static minVector=this.maxVector.clone().multiplyScalar(-1);static genMeshMaxVector=b.ZERO.clone();static genMeshMinVector=b.ZERO.clone();static genMeshVectorList8=[new b,new b,new b,new b,new b,new b,new b,new b];static genPointCloudBounds(e,t){t||=new Ce(b.ZERO,b.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(qa);if(!a)return console.warn("genPointCloudBounds: No PointCloudRenderer found on object"),t;for(const r of a){const i=r.positions,n=r.fullCount;if(!i||n===0){console.warn("genPointCloudBounds: No position data available");continue}const o=r.object3D.transform.worldMatrix,l=new b;for(let c=0;c<n;c++){const f=c*3;l.set(i[f+0],i[f+1],i[f+2]),o.transformPoint(l,l),t.expandByPoint(l)}}return t}static genGSplatBounds(e,t){t||=new Ce(b.ZERO,b.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(ii);if(!a)return console.warn("genGSplatBounds: No GSplatRenderer found on object"),t;for(const r of a){const i=r.positions,n=r.fullCount;if(!i||n===0)return console.warn("genGSplatBounds: No position data available"),t;const o=r.object3D.transform.worldMatrix,l=new b;for(let c=0;c<n;c++){const f=c*3;l.set(i[f+0],i[f+1],i[f+2]),o.transformPoint(l,l),t.expandByPoint(l)}t.setFromMinMax(t.min,t.max)}return t}static genMeshBounds(e,t){let a=this.genMeshMinVector,r=this.genMeshMaxVector,i=this.genMeshVectorList8;t||=new Ce(b.ZERO,b.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let n=e.getComponents(he);for(const o of n)if(o&&o.geometry){let l=o.object3D.transform.worldMatrix;a.copy(o.geometry.bounds.min),r.copy(o.geometry.bounds.max),i[0].set(a.x,a.y,a.z),i[1].set(a.x,a.y,r.z),i[2].set(a.x,r.y,a.z),i[3].set(a.x,r.y,r.z),i[4].set(r.x,a.y,a.z),i[5].set(r.x,a.y,r.z),i[6].set(r.x,r.y,a.z),i[7].set(r.x,r.y,r.z);for(const c of i)l.transformPoint(c,c),t.expandByPoint(c)}return r.copyFrom(t.max),a.copyFrom(t.min),t.setFromMinMax(a,r),t}static transformBound(e,t,a){let r=this.genMeshMinVector.copyFrom(t.min),i=this.genMeshMaxVector.copyFrom(t.max),n=this.genMeshVectorList8;a||=new Ce(b.ZERO,b.ZERO),a.setFromMinMax(this.maxVector,this.minVector),n[0].set(r.x,r.y,r.z),n[1].set(r.x,r.y,i.z),n[2].set(r.x,i.y,r.z),n[3].set(r.x,i.y,i.z),n[4].set(i.x,r.y,r.z),n[5].set(i.x,r.y,i.z),n[6].set(i.x,i.y,r.z),n[7].set(i.x,i.y,i.z);for(const o of n)e.transformPoint(o,o),a.expandByPoint(o);return i.copyFrom(a.max),r.copyFrom(a.min),a.setFromMinMax(r,i),a}}class I0 extends Za{name="";_instanceID="";_numChildren;get instanceID(){return this._instanceID}transform;renderNode;entityChildren;components;waitDisposeComponents;_bound;_boundWorld;_isBoundChange=!0;_dispose=!1;get dispose(){return this._dispose}getObjectByName(e){if(e.indexOf("/")>=0){let a=e.split("/"),r=this;for(;a.length>0&&r;){let i=a.shift();if(r=r.getChildByName(i,!1),!r)return null}return r}else return this.getChildByName(e,!1)}constructor(){super(),this.entityChildren=[],this.components=new Map,this._instanceID=yn().toString(),this.waitDisposeComponents=[]}get numChildren(){return this._numChildren}addChild(e){if(e==null)throw new Error("child is null!");if(e===this)throw new Error("child is self!");return this.entityChildren.indexOf(e)==-1?(e.removeFromParent(),e.transform.parent=this.transform,this.entityChildren.push(e),this._numChildren=this.entityChildren.length,this.noticeComponents("onAddChild",e),e):null}removeChild(e){if(e===null)return;if(e===this)throw new Error("add child is self!");let t=this.entityChildren.indexOf(e);t!=-1&&(this.entityChildren.splice(t,1),e.transform.parent=null,this._numChildren=this.entityChildren.length,this.noticeComponents("onRemoveChild",e))}removeAllChild(){for(;this.numChildren>0;)this.removeChild(this.entityChildren[0])}removeSelf(){return this.removeFromParent()}removeChildByIndex(e){e>=0&&e<this.entityChildren.length?this.removeChild(this.entityChildren[e]):console.error("remove child by index , index out of range")}hasChild(e){return this.entityChildren.indexOf(e)!=-1}removeFromParent(){let e=this.transform.parent;return e&&e.object3D&&e.object3D.removeChild(this),this}getChildByIndex(e){let t=null;return e<this.entityChildren.length&&(t=this.entityChildren[e]),t}getChildByName(e,t=!0){let a=null;for(const r of this.entityChildren){if(r.name==e)return a=r,a;if(t&&(a=r.getChildByName(e,t),a))return a}return a}update(){}instantiate(){return null}onTransformLocalChange(e){this._isBoundChange=!0}get bound(){return(this._isBoundChange||!this._bound)&&this.updateBound(),this._boundWorld}set bound(e){this._bound=e,this._boundWorld=this._bound.clone(),this._isBoundChange=!0}updateBound(){return this._bound||(this._bound=new Ce,this._boundWorld=this._bound.clone(),this._isBoundChange=!0),this._isBoundChange&&(qn.transformBound(this.transform.worldMatrix,this._bound,this._boundWorld),this._isBoundChange=!1),this._boundWorld}waitUpdate(){this._dispose?(this.transform.parent&&this.transform.parent.object3D.removeChild(this),this.components.forEach((e,t)=>{e.enable=!1,e.beforeDestroy(),e.destroy()}),this.components.clear()):Oe.waitStartComponent.forEach((e,t)=>{for(;e.length>0;){const a=e.shift();a.__start(),Oe.waitStartComponent.delete(a.object3D)}})}noticeComponents(e,t){for(let a of this.components.values())a[e]?.(t)}destroy(e){this._dispose||(this.components.forEach(t=>{t.beforeDestroy(e)}),this.components.forEach(t=>{t.destroy(e)}),this.components.clear(),this.components.clear(),this.entityChildren&&(this.entityChildren.forEach(t=>{t.destroy(e)}),this.removeAllChild(),this.entityChildren=[]),this._bound&&this._bound.destroy&&(this._bound.destroy(),this._bound=null),this._boundWorld&&this._boundWorld.destroy&&(this._boundWorld.destroy(),this._boundWorld=null),this.transform.parent=null,this._dispose=!0,super.destroy())}}var K2=Object.getOwnPropertyDescriptor,q2=(s,e,t,a)=>{for(var r=a>1?void 0:a?K2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ne=class extends I0{_isScene3D;prefabRef;serializeTag;constructor(){super(),this.transform=this.addComponent(Zt),this.transform.eventDispatcher.addEventListener(Zt.LOCAL_ONCHANGE,this.onTransformLocalChange,this)}get isScene3D(){return this._isScene3D}forChild(s){this.entityChildren.forEach(e=>{s(e),e.forChild(s)})}addComponent(s,e){if(!this.components.has(s)){let t=new s;return t.object3D=this,this.components.set(s,t),t.__init(e),Oe.appendWaitStart(t),t}return this.components.get(s)}getOrAddComponent(s){let e=this.components.get(s);return e||(e=this.addComponent(s)),e}removeComponent(s){if(this.components.has(s)){let e=this.components.get(s);Oe.removeWaitStart(this,e),this.components.delete(s),e.__stop(),e.beforeDestroy(),e.destroy()}}hasComponent(s){return this.components.has(s)}getComponent(s){return this.components.get(s)}getComponentFromParent(s){if(!this.parent)return null;let e=this.parent.object3D.getComponent(s);return e||this.parent.object3D.getComponentFromParent(s)}getComponentsInChild(s){let e=[],t=this.components.get(s);t&&e.push(t);for(let a=0;a<this.entityChildren.length;a++){let i=this.entityChildren[a].getComponentsInChild(s);e.push(...i)}return e}getComponents(s,e,t){e||=[];let a=this.getComponent(s);a&&(a.enable||t)&&e.push(a);for(let r=0,i=this.entityChildren.length;r<i;r++){let n=this.entityChildren[r];n&&n instanceof ne&&n.getComponents(s,e,t)}return e}getComponentsExt(s,e,t){e||=[];let a=this.components.get(s);if(a&&(a.enable||t))e.push(a);else for(const r of this.entityChildren)r instanceof ne&&r.getComponentsExt(s,e,t);return e}getComponentsByProperty(s,e,t=!0,a,r){a||=[];let i;for(const n of this.components.values())n&&(n.enable||r)&&n[s]===e&&(a.push(n),i=!0);if(!(i&&t))for(const n of this.entityChildren)n instanceof ne&&n.getComponentsByProperty(s,e,t,a,r);return a}clone(){return this.instantiate()}instantiate(){let s=new ne;return s.name=this.name,s.serializeTag=this.serializeTag,s.prefabRef=this.prefabRef,this.entityChildren.forEach((e,t)=>{let a=e.instantiate();s.addChild(a)}),this.components.forEach((e,t)=>{e.cloneTo(s)}),s}get localPosition(){return this.transform.localPosition}set localPosition(s){this.transform.localPosition=s}get localRotation(){return this.transform.localRotation}set localRotation(s){this.transform.localRotation=s}get localScale(){return this.transform.localScale}set localScale(s){this.transform.localScale=s}get localQuaternion(){return this.transform.localRotQuat}set localQuaternion(s){this.transform.localRotQuat=s}notifyChange(){this.transform.notifyChange()}get parent(){return this.transform.parent}get parentObject(){return this.transform.parent.object3D}set x(s){this.transform.x=s}get x(){return this.transform.x}set y(s){this.transform.y=s}get y(){return this.transform.y}set z(s){this.transform.z=s}get z(){return this.transform.z}set scaleX(s){this.transform.scaleX=s}get scaleX(){return this.transform.scaleX}set scaleY(s){this.transform.scaleY=s}get scaleY(){return this.transform.scaleY}set scaleZ(s){this.transform.scaleZ=s}get scaleZ(){return this.transform.scaleZ}set rotationX(s){this.transform.rotationX=s}get rotationX(){return this.transform.rotationX}set rotationY(s){this.transform.rotationY=s}get rotationY(){return this.transform.rotationY}set rotationZ(s){this.transform.rotationZ=s}get rotationZ(){return this.transform.rotationZ}fixedUpdate(){}lateUpdate(){}traverse(s){s(this);for(let e=0,t=this.entityChildren.length;e<t;e++){let a=this.entityChildren[e];a instanceof ne&&a.traverse(s)}}destroy(s){this.transform.eventDispatcher.removeEventListener(Zt.LOCAL_ONCHANGE,this.onTransformLocalChange,this);const e=this.batchTable;e&&typeof e.destroy=="function"&&(e.destroy(),this.batchTable=null);const t=this.featureTable;t&&typeof t.destroy=="function"&&(t.destroy(),this.featureTable=null),super.destroy(s)}};ne=q2([$2],ne);function $2(s,e){return class extends ne{set active(t){this.transform.enable=t>0}get active(){return this.transform.enable?1:0}get materialColor(){return this.getComponent(he)?.material?.shader.getDefaultColorShader().baseColor}set materialColor(t){let a=this.getComponent(he)?.material;a&&(a.shader.getDefaultColorShader().baseColor=t)}notifyMaterialColorChange(t,a){this.getComponent(he).materials?.[t]?.shader.getDefaultColorShader().uniforms[a].onChange()}}}class bt{static createCamera3DObject(e,t){return this.createCamera3D(null,e,t)}static createCamera3D(e,t,a){return e||=new ne,t&&t.addChild(e),a&&(e.name=a),e.getOrAddComponent(ti)}static UnProjection(e,t,a=1,r){let i=new b(e,t,0),n=1,o=b.HELP_0,l=I.canvas.offsetLeft,c=I.canvas.offsetTop,f=I.canvas.clientWidth,d=I.canvas.clientHeight;o.x=((i.x-l)*n/f-.5)*2,o.y=-((i.y-c)*n/d-.5)*2,o.z=a;let h=new b(0,0,0),u=R.helpMatrix2;u.copyFrom(r.projectionMatrix),u.invert();let m=R.helpMatrix;return m.identity(),m.multiply(u),m.multiply(r.transform.worldMatrix),m.perspectiveMultiplyPoint3(o,h),h}static Projection(e,t,a){let r=a||new b(0,0,0),i=R.helpMatrix;i.copyFrom(t.viewMatrix),i.multiply(t.projectionMatrix),i.perspectiveMultiplyPoint3(e,r);let n=I.canvas.clientWidth/2,o=I.canvas.clientHeight/2;return r.x=r.x*n+n,r.y=o-r.y*o,r}static UnProjection2(e,t,a,r,i){let n=i||new b(0,0,0),o=R.helpMatrix;o.copyFrom(r.pvMatrixInv);let l=I.canvas.clientWidth/2,c=I.canvas.clientHeight/2;return n.x=(e-l)/l,n.y=(c-t)/c,n.z=a,o.perspectiveMultiplyPoint3(n,n),n}}class jt{static maxNumDirectionShadow=8;static maxNumPointShadow=8;static directionLightList;static pointLightList;static shadowLights;static init(){this.directionLightList=new Map,this.pointLightList=new Map,this.shadowLights=new Map}static createBuffer(e){if(!this.shadowLights.has(e.scene)){let t=new Float32Array(16);this.shadowLights.set(e.scene,t)}}static getShadowLightList(e){if(!e.transform.view3D)return null;if(e.lightData.lightType==ht.DirectionLight){let t=this.directionLightList.get(e.transform.view3D.scene);return t||(t=[],this.directionLightList.set(e.transform.view3D.scene,t)),t}else if(e.lightData.lightType==ht.PointLight){let t=this.pointLightList.get(e.transform.view3D.scene);return t||(t=[],this.pointLightList.set(e.transform.view3D.scene,t)),t}else if(e.lightData.lightType==ht.SpotLight){let t=this.pointLightList.get(e.transform.view3D.scene);return t||(t=[],this.pointLightList.set(e.transform.view3D.scene,t)),t}}static getShadowLightWhichScene(e,t){if(t==ht.DirectionLight){let a=this.directionLightList.get(e);return a||(a=[],this.directionLightList.set(e,a)),a}else if(t==ht.PointLight){let a=this.pointLightList.get(e);return a||(a=[],this.pointLightList.set(e,a)),a}}static getDirectShadowLightWhichScene(e){let t=this.directionLightList.get(e);return t||(t=[],this.directionLightList.set(e,t)),t}static getPointShadowLightWhichScene(e){let t=this.pointLightList.get(e);return t||(t=[],this.pointLightList.set(e,t)),t}static addShadowLight(e){if(!e.transform.view3D)return null;let t=e.transform.view3D.scene;if(e.lightData.lightType==ht.DirectionLight){let a=this.directionLightList.get(t);if(a||(a=[],this.directionLightList.set(t,a)),!e.shadowCamera){e.shadowCamera=bt.createCamera3DObject(null,"shadowCamera"),e.shadowCamera.isShadowCamera=!0;let r=-1e3;e.shadowCamera.orthoOffCenter(r,-r,r,-r,1,1e4)}return a.indexOf(e)==-1&&a.push(e),a}else if(e.lightData.lightType==ht.PointLight||e.lightData.lightType==ht.SpotLight){let a=this.pointLightList.get(t);return a&&a.length>=8||(a||(a=[],this.pointLightList.set(t,a)),a.indexOf(e)==-1&&a.push(e)),a}}static removeShadowLight(e){if(e.lightData.castShadowIndex=-1,!e.transform.view3D)return null;if(e.lightData.lightType==ht.DirectionLight){let t=this.directionLightList.get(e.transform.view3D.scene);if(t){let a=t.indexOf(e);a!=-1&&t.splice(a,1)}return e.lightData.castShadowIndex=-1,t}else if(e.lightData.lightType==ht.PointLight||e.lightData.lightType==ht.SpotLight){let t=this.pointLightList.get(e.transform.view3D.scene);if(t){let a=t.indexOf(e);a!=-1&&t.splice(a,1)}return e.lightData.castShadowIndex=-1,t}}static update(e){let t=this.shadowLights.get(e.scene),a=jt.directionLightList.get(e.scene),r=jt.pointLightList.get(e.scene),i=0,n=0,o=0,l=0;if(t.fill(0),a){let f=0;for(let d=0;d<a.length;d++){const h=a[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}n=a.length}if(r){o=n;let f=0;for(let d=o;d<r.length;d++){const h=r[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}l=o+r.length}xe.getAllCameraGroup().forEach(f=>{f.dirShadowStart=i,f.dirShadowEnd=n,f.pointShadowStart=o,f.pointShadowEnd=l,f.shadowLights.set(new Float32Array(t))})}}class $n{uuid;usage;globalBindGroup;uniformGPUBuffer;matrixBindGroup;uniformByteLength;matrixesByteLength;shadowMatrixRaw=new Float32Array(128);csmMatrixRaw=new Float32Array(sa.Cascades*16);csmShadowBias=new Float32Array(4);shadowLights=new Float32Array(16);dirShadowStart=0;dirShadowEnd=0;pointShadowStart=0;pointShadowEnd=0;constructor(e){this.uuid=zt(),this.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.uniformGPUBuffer=new Ct(8336),this.uniformGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBindGroup=e,this.createBindGroup()}createBindGroup(){this.uniformByteLength=this.uniformGPUBuffer.memory.shareDataBuffer.byteLength,this.matrixesByteLength=R.block*4*R.maxCount,this.globalBindGroup=I.device.createBindGroup({label:"global_bindGroupLayout",layout:Ln.getGlobalDataBindGroupLayout(),entries:[{binding:0,resource:{buffer:this.uniformGPUBuffer.buffer,offset:0,size:this.uniformByteLength}},{binding:1,resource:{buffer:this.matrixBindGroup.matrixBufferDst.buffer,offset:0,size:this.matrixesByteLength}}]})}setCamera(e){this.uniformGPUBuffer.setMatrix("_projectionMatrix",e.projectionMatrix),this.uniformGPUBuffer.setMatrix("_viewMatrix",e.viewMatrix),this.uniformGPUBuffer.setMatrix("_cameraWorldMatrix",e.transform.worldMatrix),this.uniformGPUBuffer.setMatrix("pvMatrixInv",e.projectionMatrixInv),this.uniformGPUBuffer.setMatrix("viewToWorld",e.cameraToWorld);let t=jt.getDirectShadowLightWhichScene(e.transform.scene3D);this.csmShadowBias.fill(1e-4),this.shadowMatrixRaw.fill(0),this.csmMatrixRaw.fill(0);for(let l=0;l<8;l++)if(l<t.length){let c=t[l].shadowCamera;this.shadowMatrixRaw.set(c.pvMatrix.rawData,l*16)}else this.shadowMatrixRaw.set(e.transform.worldMatrix.rawData,l*16);this.uniformGPUBuffer.setFloat32Array("shadowMatrix",this.shadowMatrixRaw);let a=_.setting.shadow.shadowSize;if(sa.Cascades>1&&e.enableCSM&&t[0])for(let l=0;l<sa.Cascades;l++){let c=e.csm.children[l].shadowCamera;this.csmMatrixRaw.set(c.pvMatrix.rawData,l*16),this.csmShadowBias[l]=e.getCSMShadowBiasScale(c)}this.uniformGPUBuffer.setFloat32Array("csmShadowBias",this.csmShadowBias),this.uniformGPUBuffer.setFloat32Array("csmMatrix",this.csmMatrixRaw),this.uniformGPUBuffer.setFloat32Array("shadowLights",this.shadowLights);let r=_.setting.reflectionSetting,i=q.instance.getReflections(e.transform.scene3D).length;this.uniformGPUBuffer.setFloat("reflectionProbeSize",r.reflectionProbeSize),this.uniformGPUBuffer.setFloat("reflectionProbeMaxCount",r.reflectionProbeMaxCount),this.uniformGPUBuffer.setFloat("reflectionMapWidth",r.width),this.uniformGPUBuffer.setFloat("reflectionMapHeight",r.height),this.uniformGPUBuffer.setFloat("reflectionCount",i),this.uniformGPUBuffer.setFloat("test2",dt.testObj.testValue2),this.uniformGPUBuffer.setFloat("test3",dt.testObj.testValue3),this.uniformGPUBuffer.setFloat("test4",dt.testObj.testValue4),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",We.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",We.time),this.uniformGPUBuffer.setFloat("delta",We.delta),this.uniformGPUBuffer.setFloat("shadowBias",e.getShadowBias(a)),this.uniformGPUBuffer.setFloat("skyExposure",_.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",_.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",_.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",_.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",_.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",_.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",_.setting.render.renderState_split);let n=_.inputSystem.mouseX*I.pixelRatio,o=_.inputSystem.mouseY*I.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",n),this.uniformGPUBuffer.setFloat("mouseY",o),this.uniformGPUBuffer.setFloat("windowWidth",I.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",I.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",_.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",a),this.uniformGPUBuffer.setFloat("shadowSoft",_.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",e.enableCSM?1:0),this.uniformGPUBuffer.setFloat("csmMargin",_.setting.shadow.csmMargin),this.uniformGPUBuffer.setInt32("nDirShadowStart",this.dirShadowStart),this.uniformGPUBuffer.setInt32("nDirShadowEnd",this.dirShadowEnd),this.uniformGPUBuffer.setInt32("nPointShadowStart",this.pointShadowStart),this.uniformGPUBuffer.setInt32("nPointShadowEnd",this.pointShadowEnd),this.uniformGPUBuffer.setVector3("cameraForward",e.transform.forward),this.uniformGPUBuffer.setVector4Array("frustumPlanes",e.frustum.planes),this.uniformGPUBuffer.apply()}setShadowCamera(e){this.uniformGPUBuffer.setMatrix("_projectionMatrix",e.projectionMatrix),this.uniformGPUBuffer.setMatrix("_viewMatrix",e.viewMatrix),this.uniformGPUBuffer.setMatrix("_pvMatrix",e.pvMatrix),this.uniformGPUBuffer.setMatrix("pvMatrixInv",e.projectionMatrixInv),this.uniformGPUBuffer.setMatrix("viewToWorld",e.cameraToWorld),this.csmShadowBias.fill(1e-4),this.shadowMatrixRaw.fill(0),this.csmMatrixRaw.fill(0),this.uniformGPUBuffer.setFloat32Array("shadowCamera",this.shadowMatrixRaw),this.uniformGPUBuffer.setFloat32Array("csmShadowBias",this.csmShadowBias),this.uniformGPUBuffer.setFloat32Array("csmMatrix",this.csmMatrixRaw),this.uniformGPUBuffer.setFloat32Array("shadowLights",this.shadowLights),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",We.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",We.time),this.uniformGPUBuffer.setFloat("delta",We.delta),this.uniformGPUBuffer.setFloat("shadowBias",_.setting.shadow.shadowBias),this.uniformGPUBuffer.setFloat("skyExposure",_.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",_.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",_.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",_.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",_.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",_.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",_.setting.render.renderState_split);let t=_.inputSystem.mouseX*I.pixelRatio,a=_.inputSystem.mouseY*I.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",t),this.uniformGPUBuffer.setFloat("mouseY",a),this.uniformGPUBuffer.setFloat("windowWidth",I.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",I.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",_.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",_.setting.shadow.shadowSize),this.uniformGPUBuffer.setFloat("shadowSoft",_.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",0),this.uniformGPUBuffer.setFloat("csmMargin",_.setting.shadow.csmMargin),this.uniformGPUBuffer.setInt32("nDirShadowStart",this.dirShadowStart),this.uniformGPUBuffer.setInt32("nDirShadowEnd",this.dirShadowEnd),this.uniformGPUBuffer.setInt32("nPointShadowStart",this.pointShadowStart),this.uniformGPUBuffer.setInt32("nPointShadowEnd",this.pointShadowEnd),this.uniformGPUBuffer.apply()}setShadowLight(){}}class R0{setting;probesBufferData;probesBuffer;isVolumeFrameChange=!0;randomOrientation;startPosition=new b;isVolumeChange=!0;irradianceVolumeBuffer;directionDistance=20;randomSeedCount=3;useRandomIndex=0;centerDirection=new b(0,0,this.directionDistance).normalize(1);arroundPositions=[];updateOrientation(){return this.useRandomIndex++,this.useRandomIndex>=this.arroundPositions.length&&(this.useRandomIndex=0),R.fromToRotation(this.centerDirection,this.arroundPositions[this.useRandomIndex],this.randomOrientation),this.randomOrientation}init(e){this.setting=e,this.randomOrientation=new R(!1),this.randomOrientation.identity(),this.irradianceVolumeBuffer=new Ct(80),this.createFramesBuffer(),this.arroundPositions.push(this.centerDirection.clone());for(let t=0;t<this.randomSeedCount;t++){let a=Math.PI*2*t/this.randomSeedCount,r=new b(Math.sin(a),Math.cos(a),this.directionDistance).normalize(1);this.arroundPositions.push(r)}}setVolumeDataChange(){this.isVolumeChange=!0}updateProbes(e){let t=this.probesBufferData;for(let a of e){let r=a.index*4;t[r+3]=a.drawCallFrame}}createFramesBuffer(){if(!this.probesBufferData){let e=this.setting.probeXCount*this.setting.probeYCount*this.setting.probeZCount;this.probesBufferData=new Float32Array(e*4),this.probesBufferData.fill(-1),this.probesBuffer=new Pe(e*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST)}}uploadBuffer(){this.isVolumeChange&&(this.fillIrradianceData(),this.isVolumeChange=!1,this.isVolumeFrameChange=!0),this.probesBuffer.setFloat32Array("uniformFramesBuffer",this.probesBufferData)}calcPosition(e,t,a,r){let i=this.setting,n=this.setting.probeSpace;return r=r||new b,r.x=e*n-n*(i.probeXCount-1)*.5+i.offsetX,r.y=t*n-n*(i.probeYCount-1)*.5+i.offsetY,r.z=a*n-n*(i.probeZCount-1)*.5+i.offsetZ,r}debugX=0;debugY=0;debugZ=0;fillIrradianceData(){let e=this.setting,t=this.calcPosition(0,0,0,this.startPosition);this.irradianceVolumeBuffer.setFloat("orientationIndex",this.randomOrientation.index),this.irradianceVolumeBuffer.setFloat("hysteresis",e.hysteresis),this.irradianceVolumeBuffer.setFloat("OctRTSideSize",e.octRTSideSize),this.irradianceVolumeBuffer.setFloat("OctRTMaxSize",e.octRTMaxSize),this.irradianceVolumeBuffer.setFloat("startX",t.x),this.irradianceVolumeBuffer.setFloat("startY",t.y),this.irradianceVolumeBuffer.setFloat("startZ",t.z),this.irradianceVolumeBuffer.setFloat("ProbeSpace",e.probeSpace),this.irradianceVolumeBuffer.setFloat("probeXCount",e.probeXCount),this.irradianceVolumeBuffer.setFloat("probeYCount",e.probeYCount),this.irradianceVolumeBuffer.setFloat("probeZCount",e.probeZCount),this.irradianceVolumeBuffer.setFloat("maxDistance",e.probeSpace*1.732),this.irradianceVolumeBuffer.setFloat("depthSharpness",e.depthSharpness),this.irradianceVolumeBuffer.setFloat("ProbeSourceTextureSize",e.probeSourceTextureSize),this.irradianceVolumeBuffer.setFloat("ProbeSize",e.probeSize),this.irradianceVolumeBuffer.setFloat("bounceIntensity",e.bounceIntensity),this.irradianceVolumeBuffer.setFloat("probeRoughness",e.probeRoughness),this.irradianceVolumeBuffer.setFloat("normalBias",e.normalBias),this.irradianceVolumeBuffer.setFloat("irradianceChebyshevBias",e.irradianceChebyshevBias),this.irradianceVolumeBuffer.setFloat("rayNumber",e.rayNumber),this.irradianceVolumeBuffer.setFloat("irradianceDistanceBias",e.irradianceDistanceBias),this.irradianceVolumeBuffer.setFloat("indirectIntensity",e.indirectIntensity),this.irradianceVolumeBuffer.setFloat("ddgiGamma",e.ddgiGamma),this.irradianceVolumeBuffer.setFloat("lerpHysteresis",e.lerpHysteresis),this.irradianceVolumeBuffer.setFloat("debugX",this.debugX),this.irradianceVolumeBuffer.setFloat("debugY",this.debugY),this.irradianceVolumeBuffer.setFloat("debugZ",this.debugZ),this.irradianceVolumeBuffer.apply()}}class Q0{storageGPUBuffer;irradianceVolume;_lightList=[];constructor(){this.storageGPUBuffer=new Pe(ws.lightSize*_.setting.light.maxLight,GPUBufferUsage.COPY_SRC),this.irradianceVolume=new R0,this.irradianceVolume.init(_.setting.gi);for(let e=0;e<_.setting.light.maxLight;e++){let t=this.storageGPUBuffer.memory.allocation_node(ws.lightSize*4);this._lightList.push(t)}this.storageGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e){this.storageGPUBuffer.clean();let t=q.instance.getLights(e.scene);for(let a=0;a<t.length;a++){const r=t[a].lightData;r.index=a,this.writeLightBytes(r,this._lightList[a])}this.storageGPUBuffer.apply()}writeLightBytes(e,t){t.offset=0,t.writeFloat(e.index),t.writeInt32(e.lightType),t.writeFloat(e.radius),t.writeFloat(e.linear),t.writeVector3(e.lightPosition),t.writeFloat(e.lightMatrixIndex),t.writeVector3(e.direction),t.writeFloat(e.quadratic),t.writeRGBColor(e.lightColor),t.writeFloat(e.intensity),t.writeFloat(e.innerAngle),t.writeFloat(e.outerAngle),t.writeFloat(e.range),t.writeInt32(e.castShadowIndex),t.writeVector3(e.lightTangent),t.writeFloat(e.iesIndex)}}class T0{storageGPUBuffer;reflectionMap;sourceReflectionMap;count;constructor(){this.storageGPUBuffer=new Pe(768)}update(e){this.storageGPUBuffer.clean();let t=q.instance.getReflections(e.scene);for(let a=0;a<t.length;a++){const r=t[a];r.gid=a,this.storageGPUBuffer.setFloat("gid",r.gid),this.storageGPUBuffer.setVector3("worldPosition",r.transform.worldPosition),this.storageGPUBuffer.setFloat("radius",r.radius),this.storageGPUBuffer.setVector3("bound",r.transform.worldPosition)}this.count=t.length,this.storageGPUBuffer.apply()}}class M0 extends Ya{size;constructor(e,t=0,a){super(),this.bufferType=Aa.StorageGPUBuffer,this.size=e,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"MatrixGPUBuffer")}writeBufferByHeap(e,t){let a;e instanceof Float64Array?a=new Float32Array(e):a=e;let r=I.device;if(a.length>0){let i=null;for(;this.mapAsyncReady.length&&(i=this.mapAsyncReady.shift(),i.usedSize!=a.byteLength);)i.destroy(),this.mapAsyncBuffersOutstanding--,i=null;i||(i=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,mappedAtCreation:!0}),i.usedSize=a.byteLength,this.mapAsyncBuffersOutstanding++,this.mapAsyncBuffersOutstanding>10&&console.warn(` Warning: mapAsync requests from ${this.mapAsyncBuffersOutstanding} frames ago have not resolved yet. MB of staging buffers allocated.`));let n=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(n),i.unmap();const l=r.createCommandEncoder();l.copyBufferToBuffer(i,0,this.buffer,0,t*4),r.queue.submit([l.finish()]),i.mapAsync(GPUMapMode.WRITE).then(()=>this.mapAsyncReady.push(i))}}}class N0{uuid;index;usage;groupBufferSize;matrixBufferDst;constructor(){this.uuid=zt(),this.groupBufferSize=0,this.usage=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.cacheWorldMatrix()}cacheWorldMatrix(){this.groupBufferSize=R.maxCount*R.blockBytes,this.matrixBufferDst=new M0(this.groupBufferSize/4),this.matrixBufferDst.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBufferDst.buffer.label=this.groupBufferSize.toString()}writeBuffer(e){const t=R.dynamicMatrixBytes;this.matrixBufferDst.mapAsyncWrite(t,e)}}class xe{static _cameraBindGroups;static _lightEntriesMap;static _reflectionEntriesMap;static modelMatrixBindGroup;static init(){this.modelMatrixBindGroup=new N0,this._cameraBindGroups=new Map,this._lightEntriesMap=new Map,this._reflectionEntriesMap=new Map}static getAllCameraGroup(){return this._cameraBindGroups}static getCameraGroup(e){let t=this._cameraBindGroups.get(e);return t||(t=new $n(this.modelMatrixBindGroup),this._cameraBindGroups.set(e,t)),e.isShadowCamera?t.setShadowCamera(e):t.setCamera(e),t}static updateCameraGroup(e){let t=this._cameraBindGroups.get(e);t||(t=new $n(this.modelMatrixBindGroup),this._cameraBindGroups.set(e,t)),e.isShadowCamera?t.setShadowCamera(e):t.setCamera(e)}static getLightEntries(e){e||console.log("getLightEntries scene is null");let t=this._lightEntriesMap.get(e);return t||(t=new Q0,this._lightEntriesMap.set(e,t)),this._lightEntriesMap.get(e)}static getReflectionEntries(e){e||console.log("getLightEntries scene is null");let t=this._reflectionEntriesMap.get(e);return t||(t=new T0,this._reflectionEntriesMap.set(e,t)),this._reflectionEntriesMap.get(e)}}class k{static lastGeometry;static lastPipeline;static lastShader;static drawCount=0;static renderPassCount=0;static geometryCount=0;static pipelineCount=0;static matrixCount=0;static lastRenderPassState;static LastCommand;static multiTextureViewCache=new WeakMap;static swapchainTextureCache={texture:null,view:null};static bindPipeline(e,t){if(k.lastShader!=t)k.lastShader=t;else return!1;k.lastPipeline!=t.pipeline&&(k.lastPipeline=t.pipeline,e.setPipeline(t.pipeline));for(let a=1;a<t.bindGroups.length;a++){const r=t.bindGroups[a];r&&e.setBindGroup(a,r)}return!0}static bindCamera(e,t){let a=xe.getCameraGroup(t);e.setBindGroup(0,a.globalBindGroup)}static bindGeometryBuffer(e,t){if(this.lastGeometry!=t&&(this.lastGeometry=t,t.indicesBuffer)){e.setIndexBuffer(t.indicesBuffer.indicesGPUBuffer.buffer,t.indicesBuffer.indicesFormat);let a=t.vertexBuffer.vertexGPUBuffer,r=t.vertexBuffer.vertexBufferLayouts;for(let i=0;i<r.length;i++){const n=r[i];e.setVertexBuffer(i,a.buffer,n.offset,n.size)}}}static cleanCache(){this.lastGeometry=null,this.lastPipeline=null,this.lastShader=null}static createPipeline(e){return dt.countStart("GPUContext","pipeline"),I.device.createRenderPipeline(e)}static beginCommandEncoder(){return dt.countStart("GPUContext","beginCommandEncoder"),this.LastCommand&&I.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=I.device.createCommandEncoder(),this.LastCommand}static endCommandEncoder(e){this.LastCommand==e&&(I.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=null,dt.countStart("GPUContext","endCommandEncoder"))}static recordBundleEncoder(e){return I.device.createRenderBundleEncoder(e)}static beginRenderPass(e,t){if(this.cleanCache(),this.renderPassCount++,this.lastRenderPassState=t,t.depthTexture){let a=t.renderPassDescriptor.depthStencilAttachment;a.view=t.depthTexture.getGPUView()}if(t.renderTargets&&t.renderTargets.length>0){for(let a=0;a<t.renderTargets.length;++a){const r=t.renderTargets[a];let i=t.renderPassDescriptor.colorAttachments[a];if(t.multisample>0&&t.renderTargets.length==1){let n=this.multiTextureViewCache.get(t.multiTexture);n||(n=t.multiTexture.createView(),this.multiTextureViewCache.set(t.multiTexture,n)),i.view=n,i.resolveTarget=r.getGPUView()}else i.view=r.getGPUView()}return e.beginRenderPass(t.renderPassDescriptor)}else{let a=t.renderPassDescriptor.colorAttachments[0];if(a){const r=I.context.getCurrentTexture();if(t.multisample>0){let i=this.multiTextureViewCache.get(t.multiTexture);i||(i=t.multiTexture.createView(),this.multiTextureViewCache.set(t.multiTexture,i)),a.view=i,this.swapchainTextureCache.texture!==r&&(this.swapchainTextureCache.texture=r,this.swapchainTextureCache.view=r.createView()),a.resolveTarget=this.swapchainTextureCache.view}else this.swapchainTextureCache.texture!==r&&(this.swapchainTextureCache.texture=r,this.swapchainTextureCache.view=r.createView()),a.view=this.swapchainTextureCache.view}return e.beginRenderPass(t.renderPassDescriptor)}}static drawIndexed(e,t,a,r,i,n){e.drawIndexed(t,a,r,i,n),this.drawCount++}static draw(e,t,a,r,i){e.draw(t,a,r,i),this.drawCount++}static endPass(e){e.insertDebugMarker("end"),e.end()}static computeCommand(e,t){let a=e.beginComputePass();for(let r=0;r<t.length;r++)t[r].compute(a);a.end()}static copyTexture(e,t,a){e.copyTextureToTexture({texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{width:a.width,height:a.height,depthOrArrayLayers:1})}}class P0{source;input;output;reset(e){this.input&&this.input.destroy(),this.output&&this.output.destroy(),this.input=this.output=null,this.source=e}apply(e){if(this.source){if(!this.input){let t=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;this.input=new Pe(this.source.length,t,this.source),this.input.apply()}if(!this.output){let t=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC;this.output=new Pe(e*3,t),this.output.apply()}}}}class V0{enable;morphTargetsRelative;MaxMorphTargetCount=64;_computeConfigArray;_computeConfigBuffer;_morphInfluenceArray;_morphInfluenceBuffer;_positionAttrDataGroup;_normalAttrDataGroup;_isInfluenceDirty;_morphTargetCount;_totalVertexCount;_computeShader;_computeShaders;_computeWorkGroupXY=1;_collectMorphTargetData;_blendTarget;constructor(){this._isInfluenceDirty=!0,this.generateGPUBuffer(),this._positionAttrDataGroup=new P0,this._normalAttrDataGroup=new P0}initMorphTarget(e){this._collectMorphTargetData=this.collectMorphTargetList(e),this._computeShader&&this._computeShader.destroy();let t=Ht.CsMain;this._computeShader=new Fe(t),this._collectMorphTargetData.mergedNormal?this._computeShader.setDefine("USE_MORPHNORMALS",!0):this._computeShader.deleteDefine("USE_MORPHNORMALS"),this._computeShaders=[this._computeShader],this._isInfluenceDirty=!0,this._morphTargetCount=this._collectMorphTargetData.mtCount,this._totalVertexCount=this._collectMorphTargetData.vCount,this._morphInfluenceArray.fill(0),this._computeWorkGroupXY=this.calcWorkGroup(this._totalVertexCount),this._positionAttrDataGroup.reset(this._collectMorphTargetData.mergedPos),this._normalAttrDataGroup.reset(this._collectMorphTargetData.mergedNormal)}applyRenderShader(e){this.uploadMorphTargetBuffer(),this.uploadConfigGBuffer(),e.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),e.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&e.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)}computeMorphTarget(e){this.uploadConfigGBuffer(),this.uploadMorphTargetBuffer(),this._computeShader.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),this._computeShader.setStorageBuffer("morphTargetInfluence",this._morphInfluenceBuffer),this._computeShader.setStorageBuffer("morphTargetPositions",this._positionAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&(this._computeShader.setStorageBuffer("morphTargetNormals",this._normalAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)),this._computeShader.workerSizeX=this._computeWorkGroupXY,this._computeShader.workerSizeY=this._computeWorkGroupXY,this._computeShader.workerSizeZ=1,k.computeCommand(e,this._computeShaders)}updateInfluence(e,t){this._isInfluenceDirty=!0,this._morphInfluenceArray[e]=t}get blendShape(){return this._blendTarget}collectMorphTargetList(e){let t=this.collectAttribute("a_morphPositions_",e),a=t.length,r=t[0].data.length/3;if(this._blendTarget={},e.blendShapeData)for(let l=0;l<e.blendShapeData.shapeIndexs.length;l++){let c=e.blendShapeData.shapeIndexs[l],f=e.blendShapeData.shapeNames[l].split("."),d=f[f.length-1];this._blendTarget[d]=h=>this.updateInfluence(c,h)}let i=new Float32Array(r*a*3);{let l=0;for(let c=0;c<a;c++){let f=t[c];i.set(f.data,l),l+=f.data.length}}let n=this.collectAttribute("a_morphNormals_",e),o;if(n&&n.length>0){let l=0;o=new Float32Array(r*a*3);for(let c=0;c<a;c++){let f=n[c];o.set(f.data,l),l+=f.data.length}}return{mtCount:a,vCount:r,mergedPos:i,mergedNormal:o}}collectAttribute(e,t){let a=[];for(let r=0;r<this.MaxMorphTargetCount;r++){let i=e+r,n=t.getAttribute(i);if(n)a[r]=n;else break}return a}uploadConfigGBuffer(){if(this._isInfluenceDirty){let e=0;for(let t=0;t<this._morphTargetCount;t++)e+=this._morphInfluenceArray[t];this._morphInfluenceBuffer.setFloat32Array("data",this._morphInfluenceArray),this._morphInfluenceBuffer.apply(),this._computeConfigArray[0]=this.morphTargetsRelative?1:1-e,this._computeConfigArray[1]=this._morphTargetCount,this._computeConfigArray[2]=this._totalVertexCount,this._computeConfigArray[3]=this._computeWorkGroupXY,this._computeConfigBuffer.setFloat32Array("data",this._computeConfigArray),this._computeConfigBuffer.apply(),this._isInfluenceDirty=!1}}calcWorkGroup(e){let t=Math.ceil(Math.sqrt(e)),a=Math.ceil(Math.log2(t));return t=Math.pow(2,a),t}uploadMorphTargetBuffer(){this._positionAttrDataGroup.output||this._positionAttrDataGroup.apply(this._totalVertexCount),this._normalAttrDataGroup.output||this._normalAttrDataGroup.apply(this._totalVertexCount)}generateGPUBuffer(){this._computeConfigArray=new Float32Array(4),this._computeConfigBuffer=new Ct(4),this._morphInfluenceArray=new Float32Array(this.MaxMorphTargetCount);let e=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;this._morphInfluenceBuffer=new Pe(this.MaxMorphTargetCount,e)}destroy(e){this._computeConfigBuffer&&(this._computeConfigBuffer.destroy(e),this._computeConfigBuffer=null),this._morphInfluenceBuffer&&(this._morphInfluenceBuffer.destroy(e),this._morphInfluenceBuffer=null),this._computeShader&&(this._computeShader.destroy(e),this._computeShader=null),this._positionAttrDataGroup&&(this._positionAttrDataGroup.input&&this._positionAttrDataGroup.input.destroy(e),this._positionAttrDataGroup.output&&this._positionAttrDataGroup.output.destroy(e),this._positionAttrDataGroup=null),this._normalAttrDataGroup&&(this._normalAttrDataGroup.input&&this._normalAttrDataGroup.input.destroy(e),this._normalAttrDataGroup.output&&this._normalAttrDataGroup.output.destroy(e),this._normalAttrDataGroup=null),this._computeConfigArray=null,this._morphInfluenceArray=null,this._collectMorphTargetData=null,this._blendTarget=null,this._computeShaders=null}}var eb=Object.defineProperty,tb=Object.getOwnPropertyDescriptor,eo=(s,e,t,a)=>{for(var r=a>1?void 0:a?tb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(a?n(e,t,r):n(r))||r);return a&&r&&eb(e,t,r),r};let he=class extends Ba{receiveShadow;morphData;constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(s){s.addComponent(he).copyComponent(this)}copyComponent(s){return super.copyComponent(s),this.receiveShadow=s.receiveShadow,this}get geometry(){return this._geometry}set geometry(s){if(super.geometry=s,s){let e=s.morphTargetDictionary!=null;e&&(this.morphData||=new V0,this.morphData.morphTargetsRelative=s.morphTargetsRelative,this.morphData.initMorphTarget(s)),this.morphData&&(this.morphData.enable=e),this.morphData?.enable?this.addRendererMask(Ne.MorphTarget):this.removeRendererMask(Ne.MorphTarget),this.object3D.bound=this._geometry.bounds.clone()}else this.morphData&&(this.morphData.enable=!1),this.removeRendererMask(Ne.MorphTarget);this._readyPipeline||(this.initPipeline(),this._computes&&(this.onCompute=Cs(this.onCompute,()=>{for(let e=0;e<this._computes.length;e++)this._computes[e].onUpdate()})))}get material(){return this._materials[0]}set material(s){this.materials=[s]}setMorphInfluence(s,e){if(this.morphData&&this.morphData.enable){let t=this._geometry.morphTargetDictionary[s];t>=0&&this.morphData.updateInfluence(t,e)}}setMorphInfluenceIndex(s,e){this.morphData&&this.morphData.enable&&s>=0&&this.morphData.updateInfluence(s,e)}onCompute(s,e){this.morphData&&this.morphData.enable&&this.morphData.computeMorphTarget(e)}nodeUpdate(s,e,t,a){if(this.morphData&&this.morphData.enable)for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++)this.morphData.applyRenderShader(n[o])}super.nodeUpdate(s,e,t,a)}destroy(s){this.morphData&&(this.morphData.destroy(s),this.morphData=null),super.destroy(s)}};eo([Kr],he.prototype,"geometry",1),eo([Kr],he.prototype,"material",1),he=eo([Ot(he,"MeshRenderer")],he);class Pa{static compressGBufferTex_NAME="compressGBufferTex_NAME";static colorBufferTex_NAME="colorBufferTex";static positionBufferTex_NAME="positionBufferTex";static normalBufferTex_NAME="normalBufferTex";static materialBufferTex_NAME="materialBufferTex";static zBufferTexture_NAME="zBufferTexture";static zPreDepthTexture_NAME="zPreDepthTexture";static outTex_NAME="outTex"}class O0{label="";customSize=!1;zPreTexture=null;depthTexture=null;renderTargetTextures;outColor=-1;renderTargets;rtTextureDescriptors;irradianceBuffer;multisample=0;multiTexture;depthViewIndex=0;depthCleanValue=0;isOutTarget=!0;camera3D;rtFrame;renderPassDescriptor;renderBundleEncoderDescriptor;depthLoadOp;getLastRenderTexture(){return this.renderTargets&&this.renderTargets.length>0?this.renderTargets[0]:_.res.redTexture}}class Rt extends ut{resolveTarget;sampleCount;autoResize;clear;constructor(e,t,a=oe.rgba8unorm,r=!1,i,n=1,o=0,l=!0,c=!0){super(e,t,n),this.name=zt(),this.autoResize=c,this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.clear=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t),this.autoResize&&I.addEventListener(lr.RESIZE,f=>{let{width:d,height:h}=f.data;this.resize(d,h),this._textureChange=!0},this)}resize(e,t){let a=I.device;this.gpuTexture&&(ut.delayDestroyTexture(this.gpuTexture),this.gpuTexture=null,this.view=null),this.width=e,this.height=t,this.createTextureDescriptor(e,t,1,this.format,this.usage,this.numberLayer,this.sampleCount),this.useMipmap=!1,this.visibility=GPUShaderStage.COMPUTE|GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,this.format==oe.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==oe.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==oe.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float",this.sampleCount>0&&(this.textureBindingLayout.multisampled=!0),this.minFilter="linear",this.magFilter="linear",this.mipmapFilter="linear",this.addressModeU=Kt.clamp_to_edge,this.addressModeV=Kt.clamp_to_edge,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=I.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=k.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(l)}clone(){let e=new Rt(this.width,this.height,this.format,this.useMipmap,this.usage,this.numberLayer,this.sampleCount,this.clear,this.autoResize);return e.name="clone_"+e.name,e}readTextureToImage(){let e=I.device,t=I.windowWidth,a=I.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return k.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class Je{storeOp="store";loadOp="clear";clearValue=[0,0,0,0]}class ct{label;customSize=!1;renderTargets;rtDescriptors;zPreTexture;depthTexture;depthViewIndex=0;depthCleanValue=1;depthLoadOp="clear";isOutTarget=!0;constructor(e,t,a,r,i=!0){this.renderTargets=e,this.rtDescriptors=t,this.depthTexture=a,this.zPreTexture=r,this.isOutTarget=i}clone2Frame(e){e.renderTargets.push(...this.renderTargets.concat());for(let t=0;t<this.rtDescriptors.length;t++){const a=this.rtDescriptors[t];let r=new Je;r.loadOp=a.loadOp,r.storeOp=a.storeOp,r.clearValue=a.clearValue,e.rtDescriptors.push(r)}e.depthTexture=this.depthTexture,e.zPreTexture=this.zPreTexture,e.customSize=this.customSize}clone(){let e=new ct([],[]);return this.clone2Frame(e),e}}class ve extends ct{static colorPass_GBuffer="ColorPassGBuffer";static reflections_GBuffer="reflections_GBuffer";static gui_GBuffer="gui_GBuffer";static gBufferMap=new Map;_colorBufferTex;_compressGBufferTex;constructor(){super([],[])}createGBuffer(e,t,a,r=!0,i=!0,n){let o=this.renderTargets,l=this.rtDescriptors;if(i){let f=new Je;f.loadOp="clear",this._colorBufferTex=Mt.createRTTexture(e+Pa.colorBufferTex_NAME,t,a,oe.rgba16float,!0),o.push(this._colorBufferTex),l.push(f)}this._compressGBufferTex=new Rt(t,a,oe.rgba32float,!1,void 0,1,0,!0,!0),o.push(this._compressGBufferTex),n?this.depthTexture=n:(this.depthTexture=new Rt(t,a,oe.depth24plus,!1,void 0,1,0,!0,!0),this.depthTexture.name=e+"_depthTexture");let c;c=new Je,l.push(c)}getPositionMap(){return this.renderTargets[1]}getNormalMap(){return this.renderTargets[2]}getColorTexture(){return this._colorBufferTex}getCompressGBufferTexture(){return this._compressGBufferTex}static getGBufferFrame(e,t=0,a=0,r=!0,i){let n;if(ve.gBufferMap.has(e))n=ve.gBufferMap.get(e);else{n=new ve;let o=I.presentationSize;n.createGBuffer(e,t==0?o[0]:t,a==0?o[1]:a,t!=0&&a!=0,r,i),ve.gBufferMap.set(e,n)}return n}static getGUIBufferFrame(){let e=this.getGBufferFrame(this.colorPass_GBuffer);return ve.getGBufferFrame(ve.gui_GBuffer,0,0,!0,e.depthTexture)}clone(){let e=new ve;return this.clone2Frame(e),e}}class He{static rendererPassState=new Map;static createRendererPassState(e,t=null){let a=He.rendererPassState.get(e);if(a||(a=new O0,a.label=e.label,a.customSize=e.customSize,a.rtFrame=e,a.zPreTexture=e.zPreTexture,a.depthTexture=e.depthTexture,a.depthViewIndex=e.depthViewIndex,a.isOutTarget=e.isOutTarget,a.depthCleanValue=e.depthCleanValue,a.depthLoadOp=e.depthLoadOp,He.rendererPassState.set(e,a)),e&&e.renderTargets.length>0){a.renderTargets=e.renderTargets,a.rtTextureDescriptors=e.rtDescriptors,a.renderPassDescriptor=He.getRenderPassDescriptor(a),a.renderPassDescriptor.depthStencilAttachment&&(a.renderPassDescriptor.depthStencilAttachment.depthLoadOp=e.depthLoadOp),t=="load"&&e?.renderTargets[0]&&e.renderTargets[0].name.startsWith(ve.gui_GBuffer)&&(a.renderPassDescriptor.colorAttachments[0].loadOp="load"),a.depthLoadOp=e.depthLoadOp,a.renderBundleEncoderDescriptor=He.getRenderBundleDescriptor(a),a.renderTargetTextures=[];for(let r=0;r<e.renderTargets.length;r++){const i=e.renderTargets[r];a.renderTargetTextures[r]={format:i.format},i.name.indexOf(Pa.colorBufferTex_NAME)!=-1&&(a.outColor=r)}}else a.renderPassDescriptor=He.getRenderPassDescriptor(a,t),a.renderBundleEncoderDescriptor=He.getRenderBundleDescriptor(a),a.renderTargetTextures=[{format:I.presentationFormat}],a.outColor=0;return a}static getRenderPassDescriptor(e,t=null){if(e.renderPassDescriptor)return e.renderPassDescriptor;I.device,I.presentationSize;let a=[];if(e.renderTargets&&e.renderTargets.length>0){e.renderTargets[0].width,e.renderTargets[0].height;for(let i=0;i<e.renderTargets.length;i++){const n=e.renderTargets[i],o=e.rtTextureDescriptors[i];a.push({view:n.getGPUView(),resolveTarget:void 0,loadOp:o.loadOp,clearValue:o.clearValue,storeOp:o.storeOp})}}else if(!e.customSize){let i=I.canvasConfig&&I.canvasConfig.alpha?[1,1,1,0]:[0,0,0,1];e.isOutTarget==!0&&a.push({view:void 0,resolveTarget:void 0,loadOp:I.canvasConfig&&I.canvasConfig.alpha||t!=null?"load":"clear",clearValue:i,storeOp:"store"})}let r=null;return e.depthTexture||e.zPreTexture?(e.zPreTexture&&(e.depthTexture=e.zPreTexture),r={label:`${e.label} renderPassDescriptor zPreTexture${e.zPreTexture?"load":"clear"}`,colorAttachments:a,depthStencilAttachment:{view:e.depthTexture.getGPUView(),depthLoadOp:e.zPreTexture?"load":e.depthLoadOp,depthClearValue:e.zPreTexture?1:e.depthCleanValue,depthStoreOp:"store"}}):r={colorAttachments:a,label:"renderPassDescriptor not writeDepth"},e.renderPassDescriptor=r,r}static getRenderBundleDescriptor(e){if(e.renderBundleEncoderDescriptor)return e.renderBundleEncoderDescriptor;I.presentationSize;let t=[];if(e.renderTargets&&e.renderTargets.length>0){e.renderTargets[0].width,e.renderTargets[0].height;for(let r=0;r<e.renderTargets.length;r++){const i=e.renderTargets[r];t.push(i.format)}}let a=null;return e.depthTexture?a={colorFormats:t,depthStencilFormat:e.depthTexture.format}:a={colorFormats:t},e.renderBundleEncoderDescriptor=a,e.renderBundleEncoderDescriptor}}class si extends Le{width;height;segmentW;segmentH;up;constructor(e,t,a=1,r=1,i=b.Y_AXIS){super(),this.width=e,this.height=t,this.segmentW=a,this.segmentH=r,this.up=i,this.buildGeometry(this.up)}buildGeometry(e){var t,a,r,i,n=this.segmentW+1;(this.segmentH+1)*n,this.bounds=new Ce(b.ZERO.clone(),new b(this.width,1,this.height)),r=this.segmentH*this.segmentW*6;let o=(this.segmentW+1)*(this.segmentH+1),l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d;this.segmentW*this.segmentH*2*3>=Uint16Array.length?d=new Uint32Array(this.segmentW*this.segmentH*2*3):d=new Uint16Array(this.segmentW*this.segmentH*2*3),r=0;for(var u=0,m=0,g=0,p=0;p<=this.segmentH;++p)for(var D=0;D<=this.segmentW;++D){switch(t=(D/this.segmentW-.5)*this.width,a=(p/this.segmentH-.5)*this.height,e){case b.Y_AXIS:l[u++]=t,l[u++]=0,l[u++]=a,c[m++]=0,c[m++]=1,c[m++]=0;break;case b.Z_AXIS:l[u++]=t,l[u++]=-a,l[u++]=0,c[m++]=0,c[m++]=0,c[m++]=1;break;case b.X_AXIS:l[u++]=0,l[u++]=t,l[u++]=a,c[m++]=1,c[m++]=0,c[m++]=0;break;default:l[u++]=t,l[u++]=0,l[u++]=a,c[m++]=0,c[m++]=1,c[m++]=0;break}f[g++]=D/this.segmentW,f[g++]=p/this.segmentH,D!=this.segmentW&&p!=this.segmentH&&(i=D+p*n,d[r++]=i+1,d[r++]=i,d[r++]=i+n,d[r++]=i+1,d[r++]=i+n,d[r++]=i+n+1)}this.setIndices(d),this.setAttribute(G.position,l),this.setAttribute(G.normal,c),this.setAttribute(G.uv,f),this.setAttribute(G.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}var ab=Object.getOwnPropertyDescriptor,rb=(s,e,t,a)=>{for(var r=a>1?void 0:a?ab(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ei=class extends At{constructor(s="QuadGlsl_vs",e="QuadGlsl_fs"){super();let t=new qe(s,e);this.addRenderPass(t);let a=t.shaderState;t.blendMode=De.NONE,a.frontFace="cw",a.depthWriteEnabled=!1,a.depthCompare=nt.always,a.multisample=0,this.setTexture("baseMap",_.res.blackTexture),this.setUniformFloat("x",0),this.setUniformFloat("y",0),this.setUniformFloat("width",100),this.setUniformFloat("height",100)}};Ei=rb([Na(Ei,"QuadShader")],Ei);class to extends ne{width=128;height=128;quadRenderer;material;rendererPassState;quadShader;constructor(e="QuadGlsl_vs",t="QuadGlsl_fs",a,r=0,i=!1){super();let n=a?a.renderTargets:[];this.material=new vt,this.quadShader=new Ei(e,t),this.material.shader=this.quadShader,this.quadRenderer=this.addComponent(he),this.quadRenderer.material=this.material,this.quadRenderer.castGI=!1,this.quadRenderer.castShadow=!1,this.quadRenderer.drawType=i?2:0,this.quadRenderer.geometry=new si(100,100,1,1),this.quadRenderer.material=this.material,this.quadRenderer.__start(),this.quadRenderer._enable=!0,this.quadRenderer.onEnable(),this.rendererPassState=He.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=I.device.createTexture({size:{width:I.presentationSize[0],height:I.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT})),I.addEventListener(lr.RESIZE,o=>{this.rendererPassState=He.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=I.device.createTexture({size:{width:I.presentationSize[0],height:I.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT}))},this)}renderTarget(e,t,a){let r=e.camera,i=k.beginRenderPass(a,t.rendererPassState);k.bindCamera(i,r),t.quadRenderer.nodeUpdate(e,fe.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,fe.COLOR,t.rendererPassState,null,i),k.endPass(i)}renderToViewQuad(e,t,a,r){let i=e.camera;t.quadShader.setTexture("baseMap",r);let n=k.beginRenderPass(a,t.rendererPassState);k.bindCamera(n,i),t.quadRenderer.nodeUpdate(e,fe.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,fe.COLOR,t.rendererPassState,null,n),k.endPass(n)}}class Mt{static rtTextureMap;static rtViewQuad;static init(){this.rtTextureMap=new Map,this.rtViewQuad=new Map}static createRTTexture(e,t,a,r,i=!1,n=0){let o=this.rtTextureMap.get(e);return o||(e==Pa.colorBufferTex_NAME?o=new Rt(t,a,r,i,void 0,1,n,!1):o=new Rt(t,a,r,i,void 0,1,n,!0),o.name=e,Mt.rtTextureMap.set(e,o)),o}static createRTTextureArray(e,t,a,r,i=1,n=!1,o=0){let l=this.rtTextureMap.get(e);return l||(l=new Rt(t,a,r,n,void 0,i,o),l.name=e,Mt.rtTextureMap.set(e,l)),l}static createViewQuad(e,t,a,r,i=0){let n=new ct([r],[new Je]),o=new to(t,a,n,i);return Mt.rtViewQuad.set(e,o),o}static getTexture(e){return this.rtTextureMap.get(e)}static CreateSplitTexture(e){let t=this.getTexture(Pa.colorBufferTex_NAME),a=this.getTexture(e+"_split");return a||(a=this.createRTTexture(e+"_split",t.width,t.height,t.format,!1)),a}static WriteSplitColorTexture(e){let t=this.getTexture(Pa.colorBufferTex_NAME),a=this.getTexture(e+"_split");const r=k.beginCommandEncoder();r.copyTextureToTexture({texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{width:a.width,height:a.height,depthOrArrayLayers:1}),k.endCommandEncoder(r)}}class ao{command;encoder;rendererPassStates;rtFrame;constructor(e){this.rtFrame=e,this.rendererPassStates=[]}clean(){this.rendererPassStates.length=0,k.cleanCache()}beginContinueRendererPassState(e="load",t="load"){if(this.rendererPassStates.length>0){let a=this.rtFrame.clone();for(const i of a.rtDescriptors)i.loadOp="load";a.depthLoadOp=t;let r=He.createRendererPassState(a,e);return this.rendererPassStates.push(r),r}else{this.rtFrame.depthLoadOp=t;let a=He.createRendererPassState(this.rtFrame,e);return this.rendererPassStates.push(a),a}}get rendererPassState(){return this.rendererPassStates[this.rendererPassStates.length-1]}beginOpaqueRenderPass(){this.beginContinueRendererPassState("clear","clear"),this.begineNewCommand(),this.beginNewEncoder()}beginTransparentRenderPass(){this.beginContinueRendererPassState("load","load"),this.begineNewCommand(),this.beginNewEncoder()}specialtRenderPass(){this.beginContinueRendererPassState("load","load"),this.begineNewCommand(),this.beginNewEncoder()}endRenderPass(){this.endEncoder(),this.endCommand()}begineNewCommand(){return this.command=k.beginCommandEncoder(),this.command}endCommand(){k.endCommandEncoder(this.command),this.command=null}beginNewEncoder(){return this.encoder=k.beginRenderPass(this.command,this.rendererPassState),this.encoder}endEncoder(){k.endPass(this.encoder),this.encoder=null}}class Va extends Za{rendererPassState;splitRendererPassState;useRenderBundle=!1;debugViewQuads;debugTextures;renderContext;_rendererType;_rtFrame;get passType(){return this._rendererType}set passType(e){this._rendererType=e}constructor(){super(),this.debugTextures=[],this.debugViewQuads=[]}setRenderStates(e){if(this._rtFrame=e,e){this.rendererPassState=He.createRendererPassState(e);let t=e.clone();t.depthLoadOp="load";for(const a of t.rtDescriptors)a.loadOp="load";this.splitRendererPassState=He.createRendererPassState(t)}this.renderContext=new ao(e)}getRenderContext(e){return this._rtFrame=e,new ao(e)}setIrradiance(e,t){this.rendererPassState.irradianceBuffer=[e,t]}compute(e,t){}render(e,t,a,r=!1){k.cleanCache();let i=e.camera,n=e.scene;this.rendererPassState.camera3D=i;let o=q.instance.getRenderNodes(n,i),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{let f=k.beginCommandEncoder(),d=k.beginRenderPass(f,this.rendererPassState);l.length>0&&d.executeBundles(l),!r&&q.instance.sky&&(k.bindCamera(d,i),q.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,d)),this.drawRenderNodes(e,d,f,o.opaqueList,t),k.endPass(d),k.endCommandEncoder(f)}{let f=k.beginCommandEncoder(),d=k.beginRenderPass(f,this.rendererPassState);c.length>0&&d.executeBundles(c),r||(k.bindCamera(d,i),this.drawRenderNodes(e,d,f,o.transparentList,t)),k.endPass(d),k.endCommandEncoder(f)}}nodeUpload(e,t,a){}occlusionRenderNodeTest(e,t,a){return a?a.occlusionRenderNodeTest(e)>0:!0}renderOp(e,t,a,r,i){}renderTr(e,t,a,r,i){}renderBundleOp(e,t,a,r){let i=q.instance.getOpRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=k.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}renderBundleTr(e,t,a,r){let i=q.instance.getTrRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=k.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}recordRenderBundleNode(e,t,a,r){k.bindCamera(t,e.camera),k.bindGeometryBuffer(t,a[0].geometry);for(let i=0;i<a.length;++i){let n=a[i];n.transform.worldMatrix.index,n.transform.enable&&n.recordRenderPass2(e,this._rendererType,this.rendererPassState,r,t)}}drawRenderNodes(e,t,a,r,i,n){k.bindCamera(t,e.camera);for(let o=_.setting.render.drawOpMin;o<Math.min(r.length,_.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)}}}class L0 extends Va{constructor(){super(),this.passType=fe.COLOR}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,n=e.camera;xe.updateCameraGroup(n),this.rendererPassState.camera3D=n;let o=q.instance.getRenderNodes(i,n),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{this.renderContext.beginOpaqueRenderPass();let f=this.renderContext.encoder;l.length>0&&(q.instance.getOpRenderGroup(i),f.executeBundles(l)),!r&&q.instance.sky&&(k.bindCamera(f,n),q.instance.sky.preInit(this._rendererType)||q.instance.sky.nodeUpdate(e,this._rendererType,this.rendererPassState,a),q.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,f)),o.opaqueList&&(k.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let f=this.renderContext.encoder;c.length>0&&f.executeBundles(c),!r&&o.transparentList&&(k.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.transparentList,t,a));let d=q.instance.getGraphicList();for(let h=0;h<d.length;h++){const u=d[h];u.nodeUpdate(e,this._rendererType,this.splitRendererPassState,a),u.renderPass2(e,this._rendererType,this.splitRendererPassState,a,f)}this.renderContext.endRenderPass(),dt.end("ColorPass Draw Transparent")}}drawNodes(e,t,a,r,i){let n=q.instance.getRenderShaderCollect(e);if(n){for(const o of n){let l=o[1];for(const c of l){let f=c[1];if(!f.isDestroyed&&f.preInit(this._rendererType)){f.nodeUpdate(e,this._rendererType,this.rendererPassState,i);break}}}for(let o=_.setting.render.drawOpMin;o<Math.min(a.length,_.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(l.hasMask(Ne.UI)&&!l.isRecievePostEffectUI||l.isDestroyed||(l.preInit(this._rendererType)||l.nodeUpdate(e,this._rendererType,this.rendererPassState,i),l.renderPass(e,this.passType,this.renderContext)))}}}occlusionRenderNodeTest(e,t,a){return a.zDepthRenderNodeTest(t)>0}}class ro{frustumCullingList;zVisibleList;_renderList;static enable=!0;constructor(){this._renderList=new Map}occlusionRenderNodeTest(e){return _.setting.occlusionQuery.enable?this.frustumCullingList?this.frustumCullingList[e]:0:1}zDepthRenderNodeTest(e){return this.zVisibleList?this.zVisibleList[e]:0}update(e,t){}collect(e,t){}renderCommitTesting(e,t){return!0}}class ni extends Ya{constructor(e,t){super(),this.bufferType=Aa.ComputeGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,e,t,"ComputeGPUBuffer")}}class G0{clusterBuffer;lightAssignBuffer;assignTableBuffer;clustersUniformBuffer;constructor(e,t){this.clusterBuffer=new ni(e*2*4),this.clustersUniformBuffer=new Ct(10),this.clustersUniformBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.lightAssignBuffer=new ni(e*t),this.lightAssignBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.assignTableBuffer=new ni(e*4),this.assignTableBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e,t,a,r,i,n,o,l,c,f){this.clustersUniformBuffer.setFloat("clusterTileX",r),this.clustersUniformBuffer.setFloat("clusterTileY",i),this.clustersUniformBuffer.setFloat("clusterTileZ",n),this.clustersUniformBuffer.setFloat("numLights",o),this.clustersUniformBuffer.setFloat("maxNumLightsPerCluster",l),this.clustersUniformBuffer.setFloat("near",c),this.clustersUniformBuffer.setFloat("far",f),this.clustersUniformBuffer.setFloat("screenWidth",e),this.clustersUniformBuffer.setFloat("screenHeight",t),this.clustersUniformBuffer.setFloat("clusterPix",a),this.clustersUniformBuffer.apply()}}class Et{static clusterTileX=16;static clusterTileY=16;static clusterTileZ=32}let z0=`
|
|
6122
6150
|
#include "GlobalUniform"
|
|
6123
6151
|
|
|
6124
6152
|
struct ClusterBox{
|
|
@@ -6329,7 +6357,7 @@ struct InstanceData {
|
|
|
6329
6357
|
idx.empty1 = f32(clustersUniform.maxNumLightsPerCluster);
|
|
6330
6358
|
assignTable[clusterId_1D] = idx;
|
|
6331
6359
|
}
|
|
6332
|
-
`;class J0 extends Va{maxNumLightsPerCluster=64;clusterPix=1;clusterLightingBuffer;_currentLightCount=0;_clusterGenerateCompute;_clusterLightingCompute;_useCamera;resize=!1;constructor(e){super(),this.passType=fe.Cluster,this.initCompute(e)}initCompute(e){this._clusterGenerateCompute=new Fe(z0),this._clusterLightingCompute=new Fe(W0);let t=I.presentationSize,a=Et.clusterTileX*Et.clusterTileY*Et.clusterTileZ,r=e.camera,i=r.near,n=r.far;this.clusterLightingBuffer=new G0(a,this.maxNumLightsPerCluster),this.clusterLightingBuffer.update(t[0],t[1],this.clusterPix,Et.clusterTileX,Et.clusterTileY,Et.clusterTileZ,0,this.maxNumLightsPerCluster,i,n),this._clusterGenerateCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterGenerateCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer);let o=xe.getLightEntries(e.scene);this._clusterLightingCompute.setStorageBuffer("models",xe.modelMatrixBindGroup.matrixBufferDst),this._clusterLightingCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterLightingCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer),this._clusterLightingCompute.setStorageBuffer("lightBuffer",o.storageGPUBuffer),this._clusterLightingCompute.setStorageBuffer("lightAssignBuffer",this.clusterLightingBuffer.lightAssignBuffer),this._clusterLightingCompute.setStorageBuffer("assignTable",this.clusterLightingBuffer.assignTableBuffer),this.resize=!0}render(e,t){let a=e.scene,r=q.instance.getLights(a);if(this._useCamera!=e.camera){this._useCamera=e.camera;let o=xe.getCameraGroup(this._useCamera);this._clusterGenerateCompute.setUniformBuffer("globalUniform",o.uniformGPUBuffer),this._clusterLightingCompute.setUniformBuffer("globalUniform",o.uniformGPUBuffer)}this._currentLightCount!=r.length&&(this._currentLightCount=r.length,this.clusterLightingBuffer.clustersUniformBuffer.setFloat("numLights",r.length),this.clusterLightingBuffer.clustersUniformBuffer.apply(),this._clusterGenerateCompute.workerSizeX=Et.clusterTileZ,this._clusterLightingCompute.workerSizeX=Et.clusterTileZ);let i=I.presentationSize;this.clusterLightingBuffer.update(i[0],i[1],this.clusterPix,Et.clusterTileX,Et.clusterTileY,Et.clusterTileZ,r.length,this.maxNumLightsPerCluster,e.camera.near,e.camera.far),this.resize=!1;let n=k.beginCommandEncoder();k.computeCommand(n,[this._clusterGenerateCompute,this._clusterLightingCompute]),k.endCommandEncoder(n)}}class Te extends ut{resolveTarget;sampleCount;clone(){let e=new Te(this.width,this.height,this.format,this.useMipmap,this.usage,this.numberLayer,this.sampleCount);return e.name="clone_"+e.name,e}constructor(e,t,a=oe.rgba8unorm,r=!1,i,n=1,o=0,l=1){super(e,t,n),I.device,this.name=zt(),this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.mipmapCount=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t)}resize(e,t){let a=I.device;this.gpuTexture&&(ut.delayDestroyTexture(this.gpuTexture),this.gpuTexture=null,this.view=null),this.width=e,this.height=t,this.createTextureDescriptor(e,t,this.mipmapCount,this.format,this.usage,this.numberLayer,this.sampleCount),this.useMipmap=!1,this.visibility=GPUShaderStage.COMPUTE|GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,this.format==oe.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==oe.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==oe.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float",this.sampleCount>0&&(this.textureBindingLayout.multisampled=!0),this.minFilter="linear",this.magFilter="linear",this.mipmapFilter="nearest",this.maxAnisotropy=1,this.addressModeU=Kt.mirror_repeat,this.addressModeV=Kt.mirror_repeat,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=I.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=k.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(l)}readTextureToImage(){let e=I.device,t=I.windowWidth,a=I.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return k.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class j0 extends ne{up_camera;down_camera;left_camera;right_camera;front_camera;back_camera;set label(e){this.up_camera.name=e+"up",this.down_camera.name=e+"down",this.left_camera.name=e+"left",this.right_camera.name=e+"right",this.front_camera.name=e+"front",this.back_camera.name=e+"back"}constructor(e=.001,t=1e4,a=90,r=!1){super(),this.initCubeCamera(e,t,a,r)}initCubeCamera(e,t,a=90,r=!1){this.up_camera=bt.createCamera3DObject(this,"up"),this.down_camera=bt.createCamera3DObject(this,"down"),this.left_camera=bt.createCamera3DObject(this,"left"),this.right_camera=bt.createCamera3DObject(this,"right"),this.front_camera=bt.createCamera3DObject(this,"front"),this.back_camera=bt.createCamera3DObject(this,"back"),this.up_camera.isShadowCamera=r,this.down_camera.isShadowCamera=r,this.left_camera.isShadowCamera=r,this.right_camera.isShadowCamera=r,this.front_camera.isShadowCamera=r,this.back_camera.isShadowCamera=r;let i=1;this.up_camera.perspective(a,i,e,t),this.up_camera.lookAt(b.ZERO,b.UP,b.DOWN),this.up_camera.object3D.scaleX=-1,this.up_camera.object3D.rotationY=180,this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(b.ZERO,b.DOWN,b.DOWN),this.down_camera.object3D.scaleX=-1,this.down_camera.object3D.rotationY=180,this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(b.ZERO,b.LEFT),this.left_camera.object3D.scaleX=-1,this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(b.ZERO,b.RIGHT),this.right_camera.object3D.scaleX=-1,this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(b.ZERO,b.FORWARD),this.front_camera.object3D.scaleX=-1,this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(b.ZERO,b.BACK),this.back_camera.object3D.scaleX=-1,this.up_camera.type=nt.shadow,this.down_camera.type=nt.shadow,this.left_camera.type=nt.shadow,this.right_camera.type=nt.shadow,this.front_camera.type=nt.shadow,this.back_camera.type=nt.shadow}}class Z0 extends ut{constructor(e,t,a){super(e,t,a),this.format=oe.depth32float,this.mipmapCount=1,this.init()}internalCreateBindingLayoutDesc(){this.textureBindingLayout.sampleType="depth",this.textureBindingLayout.viewDimension="cube-array",this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison"}internalCreateTexture(){this.textureDescriptor={format:this.format,size:{width:this.width,height:this.height,depthOrArrayLayers:6*this.numberLayer},dimension:"2d",usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING},this.gpuTexture=this.getGPUTexture()}internalCreateView(){this.viewDescriptor={dimension:"cube-array"},this.view=this.getGPUView()}internalCreateSampler(){this.gpuSampler=I.device.createSampler({minFilter:hr.linear,magFilter:hr.linear}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})}}class Y0 extends Va{shadowPassCount;_forceUpdate=!1;_shadowCameraDic;shadowCamera;cubeArrayTexture;colorTexture;shadowSize=1024;constructor(){super(),this.passType=fe.POINT_SHADOW,this._shadowCameraDic=new Map,this.cubeArrayTexture=new Z0(this.shadowSize,this.shadowSize,8),this.colorTexture=new Te(this.shadowSize,this.shadowSize,oe.bgra8unorm,!1),ke.getInstance().attached(this.cubeArrayTexture,this)}getShadowCamera(e,t){let a;if(this._shadowCameraDic.has(t))a=this._shadowCameraDic.get(t);else{let r=new j0(e.camera.near,e.camera.far,90,!0);r.label=t.name;let i=[],n=[];for(let o=0;o<6;o++){let l=new Te(this.shadowSize,this.shadowSize,this.cubeArrayTexture.format,!1),c=new lt([this.colorTexture],[new Je]);l.name="shadowDepthTexture_"+t.name+o+"_face",i[o]=l,c.depthTexture=l,c.label="shadowRender",c.customSize=!0,n[o]=this.getRenderContext(c)}a={cubeCamera:r,depthTexture:i,renderContext:n},this._shadowCameraDic.set(t,a)}return a}render(e,t){if(!_.setting.shadow.enable)return;this.shadowPassCount=0,e.camera;let a=e.scene,r=jt.getPointShadowLightWhichScene(a),i=r.length;for(let n=0;n<i;n++){let o=r[n];if(o.lightData.lightType!=ht.DirectionLight&&o.lightData.castShadowIndex>-1&&(o.needUpdateShadow||this._forceUpdate||We.frame<5||o.realTimeShadow)){o.needUpdateShadow=!1;let l=this.getShadowCamera(e,o),c=o.transform.worldPosition;l.cubeCamera.x=c.x,l.cubeCamera.y=c.y,l.cubeCamera.z=c.z;let f;l.cubeCamera.transform.updateWorldMatrix(!0),t.update(l.cubeCamera.right_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.right_camera),this.renderSceneOnce(0,l,e,l.cubeCamera.right_camera,f,t),t.update(l.cubeCamera.left_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.left_camera),this.renderSceneOnce(1,l,e,l.cubeCamera.left_camera,f,t),t.update(l.cubeCamera.up_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.up_camera),this.renderSceneOnce(2,l,e,l.cubeCamera.up_camera,f,t),t.update(l.cubeCamera.down_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.down_camera),this.renderSceneOnce(3,l,e,l.cubeCamera.down_camera,f,t),t.update(l.cubeCamera.front_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.front_camera),this.renderSceneOnce(4,l,e,l.cubeCamera.front_camera,f,t),t.update(l.cubeCamera.back_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.back_camera),this.renderSceneOnce(5,l,e,l.cubeCamera.back_camera,f,t);let d=k.beginCommandEncoder();for(let h=0;h<6;h++)d.copyTextureToTexture({texture:l.depthTexture[h].getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:this.cubeArrayTexture.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:o.shadowIndex*6+h}},{width:this.shadowSize,height:this.shadowSize,depthOrArrayLayers:1});k.endCommandEncoder(d)}}this._forceUpdate=!1}renderSceneOnce(e,t,a,r,i,n){let o=t.renderContext[e];o.clean(),o.beginOpaqueRenderPass(),o.encoder.setViewport(0,0,this.shadowSize,this.shadowSize,0,1),o.encoder.setScissorRect(0,0,this.shadowSize,this.shadowSize),r.onUpdate(),r.transform.updateWorldMatrix(!0);for(const l of i.opaqueList){let c=l;if(!c.isDestroyed&&c.preInit(this._rendererType)){c.nodeUpdate(a,this._rendererType,o.rendererPassState,null);break}}this.drawShadowRenderNodes(a,r,o,i.opaqueList,n),this.drawShadowRenderNodes(a,r,o,i.transparentList,n),o.endRenderPass()}drawShadowRenderNodes(e,t,a,r,i){xe.updateCameraGroup(t),k.bindCamera(a.encoder,t),this.drawNodes(e,t,a,r,i,null)}drawNodes(e,t,a,r,i,n){let o=q.instance.getRenderShaderCollect(e);if(o){for(const l of o){let c=l[1];for(const f of c){let d=f[1];if(!d.isDestroyed&&d.preInit(this._rendererType)){d.nodeUpdate(e,this._rendererType,a.rendererPassState,n);break}}}for(let l=_.setting.render.drawOpMin;l<Math.min(r.length,_.setting.render.drawOpMax);++l){let c=r[l];if(c.transform.enable&&c.enable&&c.castShadow&&!c.isDestroyed){c.preInit(this._rendererType)||c.nodeUpdate(e,this._rendererType,a.rendererPassState,n);for(let f of c.materials){let d=f.getPass(this._rendererType);if(!(!d||d.length==0))for(let h of d){const u=h;u.pipeline&&(u.setUniformFloat("cameraFar",t.far),u.setUniformVector3("lightWorldPos",t.transform.worldPosition),u.materialDataUniformBuffer.apply())}}c.renderPass(e,this.passType,a)}}}}}class X0 extends ut{constructor(e,t,a=oe.depth32float,r=4){super(e,t,r),this.format=a,this.mipmapCount=1,this.init()}internalCreateBindingLayoutDesc(){this.textureBindingLayout.sampleType="depth",this.textureBindingLayout.viewDimension="2d-array",this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison"}internalCreateTexture(){this.textureDescriptor={format:this.format,size:{width:this.width,height:this.height,depthOrArrayLayers:this.numberLayer},dimension:"2d",usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING},this.gpuTexture=this.getGPUTexture()}internalCreateView(){this.viewDescriptor={dimension:"2d-array"},this.view=this.getGPUView()}internalCreateSampler(){this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})}}class H0 extends Va{shadowPassCount;depth2DArrayTexture;rendererPassStates;_forceUpdate=!1;constructor(){super(),this.setShadowMap(_.setting.shadow.shadowSize,sa.Cascades),this.passType=fe.SHADOW}setShadowMap(e,t){this.rendererPassStates=[],this.depth2DArrayTexture=new X0(e,e,oe.depth32float,8),ke.getInstance().attached(this.depth2DArrayTexture,this);for(let a=0;a<8;a++){let r=new lt([],[]);const i=new Te(e,e,oe.depth32float,!1);i.name=`shadowDepthTexture_${a}`,r.depthTexture=i,r.label="shadowRender",r.customSize=!0,r.depthCleanValue=1;let n=He.createRendererPassState(r);this.rendererPassStates[a]=n}}render(e,t){let a=_.setting.shadow;if(!a.enable)return;let r=e.camera,i=e.scene;if(this.shadowPassCount=0,!a.needUpdate||We.frame%a.updateFrameRate!=0)return;let n=jt.getDirectShadowLightWhichScene(i),o=a.shadowSize;const l=sa.Cascades;for(let c of n){const f=c;let d=f.shadowIndex;this.rendererPassState=this.rendererPassStates[d],o=this.rendererPassState.depthTexture.width;let h=q.instance.getRenderShaderCollect(e);for(const u of h){let m=u[1];for(const g of m){let p=g[1];if(!p.isDestroyed&&p.preInit(this._rendererType)){p.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}if(f.castShadow&&f.needUpdateShadow||this._forceUpdate||f.castShadow&&a.autoUpdate)if(f.needUpdateShadow=!1,r.enableCSM&&d==0)for(let u=0;u<l;u++){this.rendererPassState=this.rendererPassStates[u];let m=r.csm.children[u],g=r.getCSMShadowWorldExtents(u);this.poseShadowCamera(r,f.direction,m.shadowCamera,g,m.bound.center),this.renderShadow(e,m.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,u,o)}else{r.enableCSM&&(d+=l-1);let u=r.getShadowWorldExtents();this.rendererPassState=this.rendererPassStates[d],this.poseShadowCamera(r,f.direction,f.shadowCamera,u,r.lookTarget),this.renderShadow(e,f.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,d,o)}}this._forceUpdate=!1}copyDepthTexture(e,t,a,r){let i=k.beginCommandEncoder();i.copyTextureToTexture({texture:e.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:a}},{width:r,height:r,depthOrArrayLayers:1}),k.endCommandEncoder(i)}_shadowPos=new b;_shadowCameraTarget=new b;poseShadowCamera(e,t,a,r,i){this._shadowPos.copy(t).normalize(e.far),i.add(this._shadowPos,this._shadowCameraTarget),i.subtract(this._shadowPos,this._shadowPos),a.transform.lookAt(this._shadowPos,this._shadowCameraTarget),a.orthoOffCenter(-r,r,-r,r,e.near,e.far*2)}compute(){}renderShadow(e,t,a,r){let i=q.instance.getRenderNodes(e.scene,t),n=k.beginCommandEncoder(),o=k.beginRenderPass(n,r);t.transform.updateWorldMatrix(),ro.enable&&(a.update(t,e.scene),a.collect(i,t)),xe.updateCameraGroup(t),k.bindCamera(o,t);let l=this.renderShadowBundleOp(e,t,r),c=this.renderShadowBundleTr(e,t,r);l.length>0&&o.executeBundles(l),this.drawShadowRenderNodes(e,t,o,i.opaqueList),c.length>0&&o.executeBundles(c),this.drawShadowRenderNodes(e,t,o,i.transparentList),k.endPass(o),k.endCommandEncoder(n)}renderShadowBundleOp(e,t,a){let r=q.instance.getOpRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=k.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}renderShadowBundleTr(e,t,a){let r=q.instance.getTrRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=k.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}recordShadowRenderBundleNode(e,t,a,r,i){if(xe.updateCameraGroup(t),k.bindCamera(a,t),r){k.bindGeometryBuffer(a,r[0].geometry);for(let n=0;n<r.length;++n){let o=r[n];o.transform.enable&&o.recordRenderPass2(e,this._rendererType,this.rendererPassState,i,a)}}}drawShadowRenderNodes(e,t,a,r,i){if(xe.updateCameraGroup(t),k.bindCamera(a,t),r)for(let n=_.setting.render.drawOpMin;n<Math.min(r.length,_.setting.render.drawOpMax);++n){let o=r[n];o.transform.enable&&o.enable&&o.castShadow&&(o.isDestroyed||(o.preInit(this._rendererType)||o.nodeUpdate(e,this._rendererType,this.rendererPassState,i),o.renderPass2(e,this._rendererType,this.rendererPassState,i,a)))}}}class K0 extends Va{zBufferTexture;useRenderBundle=!1;shadowPassCount;zCullingCompute;constructor(){super(),this.passType=fe.DEPTH;let e=I.presentationSize,t=1;this.zBufferTexture=Mt.createRTTexture(Pa.zBufferTexture_NAME,Math.floor(e[0]*t),Math.floor(e[1]*t),oe.rgba16float,!1);let a=new Je;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=new lt([],[],Mt.createRTTexture(Pa.zPreDepthTexture_NAME,Math.floor(e[0]),Math.floor(e[1]),oe.depth32float,!1),null,!1);this.setRenderStates(r)}render(e,t){let a=e.camera,r=e.scene;k.cleanCache(),dt.start("DepthPass Renderer");let i=r;this.rendererPassState.camera3D=a;let n=q.instance.getRenderNodes(i,a);this.compute(e,t);let o=this.renderBundleOp(e,n,t),l=[],c=k.beginCommandEncoder(),f=k.beginRenderPass(c,this.rendererPassState);o.length>0&&f.executeBundles(o);let d=q.instance.getRenderShaderCollect(e);for(const h of d){let u=h[1];for(const m of u){let g=m[1];if(!g.isDestroyed&&g.preInit(this._rendererType)){g.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}this.drawRenderNodes(e,f,c,n.opaqueList,t),l.length>0&&f.executeBundles(l),k.endPass(f),k.endCommandEncoder(c),dt.end("DepthPass Renderer")}drawRenderNodes(e,t,a,r,i,n){k.bindCamera(t,e.camera);for(let o=_.setting.render.drawOpMin;o<Math.min(r.length,_.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&(l.isDestroyed||(l.preInit(this._rendererType)||l.nodeUpdate(e,this._rendererType,this.rendererPassState),l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)))}}}class q0{map;passRendererList;constructor(){this.map=new Map,this.passRendererList=[]}addRenderer(e){this.map.has(e.passType)?console.error("same renderer pass repeat!"):(this.map.set(e.passType,e),e.passType<=8&&this.addPassRenderer(e))}getRenderer(e){return this.map.get(e)}addPassRenderer(e){this.passRendererList.push(e)}getAllRenderer(){return this.map}getAllPassRenderer(){return this.passRendererList}}class $0 extends Va{finalQuadView;postList;constructor(){super(),this._rendererType=fe.POST,this.postList=new Map,this.initRenderer()}initRenderer(){Y.register("FullQuad_vert_wgsl",fc),this.finalQuadView=new to("Quad_vert_wgsl","Quad_frag_wgsl",new lt([],[]),0,!1)}attachPost(e,t){t.postRenderer=this;let a=t.constructor.name;this.postList.get(a)||(this.postList.set(a,t),t.onAttach(e))}detachPost(e,t){let a=t.constructor.name,r=this.postList.get(a);return r&&(this.postList.delete(a),t.onDetach(e),t.postRenderer=null),r!=null}render(e){this.postList.forEach(a=>{a.enable&&a.compute(e)});let t=k.beginCommandEncoder();this.postList.forEach(a=>{a.enable&&a.render(e,t)}),k.endCommandEncoder(t)}presentContent(e,t){let a=k.beginCommandEncoder();this.finalQuadView.renderToViewQuad(e,this.finalQuadView,a,t),k.endCommandEncoder(a)}}class Wt{enable=!0;postRenderer;rtViewQuad;virtualTexture;constructor(){this.rtViewQuad=new Map,this.virtualTexture=new Map,I.addEventListener(lr.RESIZE,this.onResize,this)}createRTTexture(e,t,a,r,i=!1,n=0){let o=Mt.createRTTexture(e,t,a,r,i,n);return o.name=e,this.virtualTexture.set(e,o),ke.getInstance().attached(o,this),o}createViewQuad(e,t,a,r=0){let i=Mt.createViewQuad(e,"Quad_vert_wgsl",t,a,r);return this.rtViewQuad.set(e,i),i}getOutTexture(){let e,t=k.lastRenderPassState.renderTargets;return t.length>0?e=t[0]:e=Mt.getTexture(Pa.colorBufferTex_NAME),e}autoSetColorTexture(e,t){let a=this.getOutTexture();t.setSamplerTexture(e,a)}compute(e){}onAttach(e){}onDetach(e){}onResize(){}render(e,t){this.compute(e),this.rtViewQuad.forEach((a,r)=>{let i=k.lastRenderPassState.getLastRenderTexture();a.renderToViewQuad(e,a,t,i)})}destroy(e){this.postRenderer=null;for(let t=0;t<this.rtViewQuad.size;t++)this.rtViewQuad.values[t].destroy(e);this.rtViewQuad.clear(),this.rtViewQuad=null;for(let t=0;t<this.virtualTexture.size;t++){const a=this.virtualTexture.values[t];ke.getInstance().detached(a,this),a.destroy(e)}}}class io extends ne{up_camera;down_camera;left_camera;right_camera;front_camera;back_camera;_near;_far;constructor(e=.001,t=1e4,a=90,r=!1){super(),this.initCubeCamera(e,t,a,r)}initCubeCamera(e,t,a=90,r=!1){this.up_camera=bt.createCamera3DObject(this,"up"),this.down_camera=bt.createCamera3DObject(this,"down"),this.left_camera=bt.createCamera3DObject(this,"left"),this.right_camera=bt.createCamera3DObject(this,"right"),this.front_camera=bt.createCamera3DObject(this,"front"),this.back_camera=bt.createCamera3DObject(this,"back"),this.up_camera.isShadowCamera=r,this.down_camera.isShadowCamera=r,this.left_camera.isShadowCamera=r,this.right_camera.isShadowCamera=r,this.front_camera.isShadowCamera=r,this.back_camera.isShadowCamera=r;let i=1;this.up_camera.perspective(a,i,e,t),this.up_camera.lookAt(b.ZERO,b.UP,b.DOWN),this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(b.ZERO,b.DOWN,b.DOWN),this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(b.ZERO,b.LEFT),this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(b.ZERO,b.RIGHT),this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(b.ZERO,b.FORWARD),this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(b.ZERO,b.BACK),this.up_camera.type=nt.shadow,this.down_camera.type=nt.shadow,this.left_camera.type=nt.shadow,this.right_camera.type=nt.shadow,this.front_camera.type=nt.shadow,this.back_camera.type=nt.shadow}set near(e){this._near=e,this.up_camera.near=e,this.down_camera.near=e,this.left_camera.near=e,this.right_camera.near=e,this.front_camera.near=e,this.back_camera.near=e}get near(){return this._near}set far(e){this._far=e,this.up_camera.far=e,this.down_camera.far=e,this.left_camera.far=e,this.right_camera.far=e,this.front_camera.far=e,this.back_camera.far=e}get far(){return this._far}}let ef=`
|
|
6360
|
+
`;class J0 extends Va{maxNumLightsPerCluster=64;clusterPix=1;clusterLightingBuffer;_currentLightCount=0;_clusterGenerateCompute;_clusterLightingCompute;_useCamera;resize=!1;constructor(e){super(),this.passType=fe.Cluster,this.initCompute(e)}initCompute(e){this._clusterGenerateCompute=new Fe(z0),this._clusterLightingCompute=new Fe(W0);let t=I.presentationSize,a=Et.clusterTileX*Et.clusterTileY*Et.clusterTileZ,r=e.camera,i=r.near,n=r.far;this.clusterLightingBuffer=new G0(a,this.maxNumLightsPerCluster),this.clusterLightingBuffer.update(t[0],t[1],this.clusterPix,Et.clusterTileX,Et.clusterTileY,Et.clusterTileZ,0,this.maxNumLightsPerCluster,i,n),this._clusterGenerateCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterGenerateCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer);let o=xe.getLightEntries(e.scene);this._clusterLightingCompute.setStorageBuffer("models",xe.modelMatrixBindGroup.matrixBufferDst),this._clusterLightingCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterLightingCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer),this._clusterLightingCompute.setStorageBuffer("lightBuffer",o.storageGPUBuffer),this._clusterLightingCompute.setStorageBuffer("lightAssignBuffer",this.clusterLightingBuffer.lightAssignBuffer),this._clusterLightingCompute.setStorageBuffer("assignTable",this.clusterLightingBuffer.assignTableBuffer),this.resize=!0}render(e,t){let a=e.scene,r=q.instance.getLights(a);if(this._useCamera!=e.camera){this._useCamera=e.camera;let o=xe.getCameraGroup(this._useCamera);this._clusterGenerateCompute.setUniformBuffer("globalUniform",o.uniformGPUBuffer),this._clusterLightingCompute.setUniformBuffer("globalUniform",o.uniformGPUBuffer)}this._currentLightCount!=r.length&&(this._currentLightCount=r.length,this.clusterLightingBuffer.clustersUniformBuffer.setFloat("numLights",r.length),this.clusterLightingBuffer.clustersUniformBuffer.apply(),this._clusterGenerateCompute.workerSizeX=Et.clusterTileZ,this._clusterLightingCompute.workerSizeX=Et.clusterTileZ);let i=I.presentationSize;this.clusterLightingBuffer.update(i[0],i[1],this.clusterPix,Et.clusterTileX,Et.clusterTileY,Et.clusterTileZ,r.length,this.maxNumLightsPerCluster,e.camera.near,e.camera.far),this.resize=!1;let n=k.beginCommandEncoder();k.computeCommand(n,[this._clusterGenerateCompute,this._clusterLightingCompute]),k.endCommandEncoder(n)}}class Te extends ut{resolveTarget;sampleCount;clone(){let e=new Te(this.width,this.height,this.format,this.useMipmap,this.usage,this.numberLayer,this.sampleCount);return e.name="clone_"+e.name,e}constructor(e,t,a=oe.rgba8unorm,r=!1,i,n=1,o=0,l=1){super(e,t,n),I.device,this.name=zt(),this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.mipmapCount=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t)}resize(e,t){let a=I.device;this.gpuTexture&&(ut.delayDestroyTexture(this.gpuTexture),this.gpuTexture=null,this.view=null),this.width=e,this.height=t,this.createTextureDescriptor(e,t,this.mipmapCount,this.format,this.usage,this.numberLayer,this.sampleCount),this.useMipmap=!1,this.visibility=GPUShaderStage.COMPUTE|GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,this.format==oe.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==oe.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==oe.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})):(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float",this.sampleCount>0&&(this.textureBindingLayout.multisampled=!0),this.minFilter="linear",this.magFilter="linear",this.mipmapFilter="nearest",this.maxAnisotropy=1,this.addressModeU=Kt.mirror_repeat,this.addressModeV=Kt.mirror_repeat,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=I.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=k.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),k.endCommandEncoder(l)}readTextureToImage(){let e=I.device,t=I.windowWidth,a=I.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return k.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class j0 extends ne{up_camera;down_camera;left_camera;right_camera;front_camera;back_camera;set label(e){this.up_camera.name=e+"up",this.down_camera.name=e+"down",this.left_camera.name=e+"left",this.right_camera.name=e+"right",this.front_camera.name=e+"front",this.back_camera.name=e+"back"}constructor(e=.001,t=1e4,a=90,r=!1){super(),this.initCubeCamera(e,t,a,r)}initCubeCamera(e,t,a=90,r=!1){this.up_camera=bt.createCamera3DObject(this,"up"),this.down_camera=bt.createCamera3DObject(this,"down"),this.left_camera=bt.createCamera3DObject(this,"left"),this.right_camera=bt.createCamera3DObject(this,"right"),this.front_camera=bt.createCamera3DObject(this,"front"),this.back_camera=bt.createCamera3DObject(this,"back"),this.up_camera.isShadowCamera=r,this.down_camera.isShadowCamera=r,this.left_camera.isShadowCamera=r,this.right_camera.isShadowCamera=r,this.front_camera.isShadowCamera=r,this.back_camera.isShadowCamera=r;let i=1;this.up_camera.perspective(a,i,e,t),this.up_camera.lookAt(b.ZERO,b.UP,b.DOWN),this.up_camera.object3D.scaleX=-1,this.up_camera.object3D.rotationY=180,this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(b.ZERO,b.DOWN,b.DOWN),this.down_camera.object3D.scaleX=-1,this.down_camera.object3D.rotationY=180,this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(b.ZERO,b.LEFT),this.left_camera.object3D.scaleX=-1,this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(b.ZERO,b.RIGHT),this.right_camera.object3D.scaleX=-1,this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(b.ZERO,b.FORWARD),this.front_camera.object3D.scaleX=-1,this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(b.ZERO,b.BACK),this.back_camera.object3D.scaleX=-1,this.up_camera.type=ot.shadow,this.down_camera.type=ot.shadow,this.left_camera.type=ot.shadow,this.right_camera.type=ot.shadow,this.front_camera.type=ot.shadow,this.back_camera.type=ot.shadow}}class Z0 extends ut{constructor(e,t,a){super(e,t,a),this.format=oe.depth32float,this.mipmapCount=1,this.init()}internalCreateBindingLayoutDesc(){this.textureBindingLayout.sampleType="depth",this.textureBindingLayout.viewDimension="cube-array",this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison"}internalCreateTexture(){this.textureDescriptor={format:this.format,size:{width:this.width,height:this.height,depthOrArrayLayers:6*this.numberLayer},dimension:"2d",usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING},this.gpuTexture=this.getGPUTexture()}internalCreateView(){this.viewDescriptor={dimension:"cube-array"},this.view=this.getGPUView()}internalCreateSampler(){this.gpuSampler=I.device.createSampler({minFilter:hr.linear,magFilter:hr.linear}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})}}class Y0 extends Va{shadowPassCount;_forceUpdate=!1;_shadowCameraDic;shadowCamera;cubeArrayTexture;colorTexture;shadowSize=1024;constructor(){super(),this.passType=fe.POINT_SHADOW,this._shadowCameraDic=new Map,this.cubeArrayTexture=new Z0(this.shadowSize,this.shadowSize,8),this.colorTexture=new Te(this.shadowSize,this.shadowSize,oe.bgra8unorm,!1),ke.getInstance().attached(this.cubeArrayTexture,this)}getShadowCamera(e,t){let a;if(this._shadowCameraDic.has(t))a=this._shadowCameraDic.get(t);else{let r=new j0(e.camera.near,e.camera.far,90,!0);r.label=t.name;let i=[],n=[];for(let o=0;o<6;o++){let l=new Te(this.shadowSize,this.shadowSize,this.cubeArrayTexture.format,!1),c=new ct([this.colorTexture],[new Je]);l.name="shadowDepthTexture_"+t.name+o+"_face",i[o]=l,c.depthTexture=l,c.label="shadowRender",c.customSize=!0,n[o]=this.getRenderContext(c)}a={cubeCamera:r,depthTexture:i,renderContext:n},this._shadowCameraDic.set(t,a)}return a}render(e,t){if(!_.setting.shadow.enable)return;this.shadowPassCount=0,e.camera;let a=e.scene,r=jt.getPointShadowLightWhichScene(a),i=r.length;for(let n=0;n<i;n++){let o=r[n];if(o.lightData.lightType!=ht.DirectionLight&&o.lightData.castShadowIndex>-1&&(o.needUpdateShadow||this._forceUpdate||We.frame<5||o.realTimeShadow)){o.needUpdateShadow=!1;let l=this.getShadowCamera(e,o),c=o.transform.worldPosition;l.cubeCamera.x=c.x,l.cubeCamera.y=c.y,l.cubeCamera.z=c.z;let f;l.cubeCamera.transform.updateWorldMatrix(!0),t.update(l.cubeCamera.right_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.right_camera),this.renderSceneOnce(0,l,e,l.cubeCamera.right_camera,f,t),t.update(l.cubeCamera.left_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.left_camera),this.renderSceneOnce(1,l,e,l.cubeCamera.left_camera,f,t),t.update(l.cubeCamera.up_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.up_camera),this.renderSceneOnce(2,l,e,l.cubeCamera.up_camera,f,t),t.update(l.cubeCamera.down_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.down_camera),this.renderSceneOnce(3,l,e,l.cubeCamera.down_camera,f,t),t.update(l.cubeCamera.front_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.front_camera),this.renderSceneOnce(4,l,e,l.cubeCamera.front_camera,f,t),t.update(l.cubeCamera.back_camera,a),f=q.instance.getRenderNodes(a,l.cubeCamera.back_camera),this.renderSceneOnce(5,l,e,l.cubeCamera.back_camera,f,t);let d=k.beginCommandEncoder();for(let h=0;h<6;h++)d.copyTextureToTexture({texture:l.depthTexture[h].getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:this.cubeArrayTexture.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:o.shadowIndex*6+h}},{width:this.shadowSize,height:this.shadowSize,depthOrArrayLayers:1});k.endCommandEncoder(d)}}this._forceUpdate=!1}renderSceneOnce(e,t,a,r,i,n){let o=t.renderContext[e];o.clean(),o.beginOpaqueRenderPass(),o.encoder.setViewport(0,0,this.shadowSize,this.shadowSize,0,1),o.encoder.setScissorRect(0,0,this.shadowSize,this.shadowSize),r.onUpdate(),r.transform.updateWorldMatrix(!0);for(const l of i.opaqueList){let c=l;if(!c.isDestroyed&&c.preInit(this._rendererType)){c.nodeUpdate(a,this._rendererType,o.rendererPassState,null);break}}this.drawShadowRenderNodes(a,r,o,i.opaqueList,n),this.drawShadowRenderNodes(a,r,o,i.transparentList,n),o.endRenderPass()}drawShadowRenderNodes(e,t,a,r,i){xe.updateCameraGroup(t),k.bindCamera(a.encoder,t),this.drawNodes(e,t,a,r,i,null)}drawNodes(e,t,a,r,i,n){let o=q.instance.getRenderShaderCollect(e);if(o){for(const l of o){let c=l[1];for(const f of c){let d=f[1];if(!d.isDestroyed&&d.preInit(this._rendererType)){d.nodeUpdate(e,this._rendererType,a.rendererPassState,n);break}}}for(let l=_.setting.render.drawOpMin;l<Math.min(r.length,_.setting.render.drawOpMax);++l){let c=r[l];if(c.transform.enable&&c.enable&&c.castShadow&&!c.isDestroyed){c.preInit(this._rendererType)||c.nodeUpdate(e,this._rendererType,a.rendererPassState,n);for(let f of c.materials){let d=f.getPass(this._rendererType);if(!(!d||d.length==0))for(let h of d){const u=h;u.pipeline&&(u.setUniformFloat("cameraFar",t.far),u.setUniformVector3("lightWorldPos",t.transform.worldPosition),u.materialDataUniformBuffer.apply())}}c.renderPass(e,this.passType,a)}}}}}class X0 extends ut{constructor(e,t,a=oe.depth32float,r=4){super(e,t,r),this.format=a,this.mipmapCount=1,this.init()}internalCreateBindingLayoutDesc(){this.textureBindingLayout.sampleType="depth",this.textureBindingLayout.viewDimension="2d-array",this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison"}internalCreateTexture(){this.textureDescriptor={format:this.format,size:{width:this.width,height:this.height,depthOrArrayLayers:this.numberLayer},dimension:"2d",usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING},this.gpuTexture=this.getGPUTexture()}internalCreateView(){this.viewDescriptor={dimension:"2d-array"},this.view=this.getGPUView()}internalCreateSampler(){this.gpuSampler=I.device.createSampler({}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})}}class H0 extends Va{shadowPassCount;depth2DArrayTexture;rendererPassStates;_forceUpdate=!1;constructor(){super(),this.setShadowMap(_.setting.shadow.shadowSize,sa.Cascades),this.passType=fe.SHADOW}setShadowMap(e,t){this.rendererPassStates=[],this.depth2DArrayTexture=new X0(e,e,oe.depth32float,8),ke.getInstance().attached(this.depth2DArrayTexture,this);for(let a=0;a<8;a++){let r=new ct([],[]);const i=new Te(e,e,oe.depth32float,!1);i.name=`shadowDepthTexture_${a}`,r.depthTexture=i,r.label="shadowRender",r.customSize=!0,r.depthCleanValue=1;let n=He.createRendererPassState(r);this.rendererPassStates[a]=n}}render(e,t){let a=_.setting.shadow;if(!a.enable)return;let r=e.camera,i=e.scene;if(this.shadowPassCount=0,!a.needUpdate||We.frame%a.updateFrameRate!=0)return;let n=jt.getDirectShadowLightWhichScene(i),o=a.shadowSize;const l=sa.Cascades;for(let c of n){const f=c;let d=f.shadowIndex;this.rendererPassState=this.rendererPassStates[d],o=this.rendererPassState.depthTexture.width;let h=q.instance.getRenderShaderCollect(e);for(const u of h){let m=u[1];for(const g of m){let p=g[1];if(!p.isDestroyed&&p.preInit(this._rendererType)){p.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}if(f.castShadow&&f.needUpdateShadow||this._forceUpdate||f.castShadow&&a.autoUpdate)if(f.needUpdateShadow=!1,r.enableCSM&&d==0)for(let u=0;u<l;u++){this.rendererPassState=this.rendererPassStates[u];let m=r.csm.children[u],g=r.getCSMShadowWorldExtents(u);this.poseShadowCamera(r,f.direction,m.shadowCamera,g,m.bound.center),this.renderShadow(e,m.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,u,o)}else{r.enableCSM&&(d+=l-1);let u=r.getShadowWorldExtents();this.rendererPassState=this.rendererPassStates[d],this.poseShadowCamera(r,f.direction,f.shadowCamera,u,r.lookTarget),this.renderShadow(e,f.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,d,o)}}this._forceUpdate=!1}copyDepthTexture(e,t,a,r){let i=k.beginCommandEncoder();i.copyTextureToTexture({texture:e.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:a}},{width:r,height:r,depthOrArrayLayers:1}),k.endCommandEncoder(i)}_shadowPos=new b;_shadowCameraTarget=new b;poseShadowCamera(e,t,a,r,i){this._shadowPos.copy(t).normalize(e.far),i.add(this._shadowPos,this._shadowCameraTarget),i.subtract(this._shadowPos,this._shadowPos),a.transform.lookAt(this._shadowPos,this._shadowCameraTarget),a.orthoOffCenter(-r,r,-r,r,e.near,e.far*2)}compute(){}renderShadow(e,t,a,r){let i=q.instance.getRenderNodes(e.scene,t),n=k.beginCommandEncoder(),o=k.beginRenderPass(n,r);t.transform.updateWorldMatrix(),ro.enable&&(a.update(t,e.scene),a.collect(i,t)),xe.updateCameraGroup(t),k.bindCamera(o,t);let l=this.renderShadowBundleOp(e,t,r),c=this.renderShadowBundleTr(e,t,r);l.length>0&&o.executeBundles(l),this.drawShadowRenderNodes(e,t,o,i.opaqueList),c.length>0&&o.executeBundles(c),this.drawShadowRenderNodes(e,t,o,i.transparentList),k.endPass(o),k.endCommandEncoder(n)}renderShadowBundleOp(e,t,a){let r=q.instance.getOpRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=k.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}renderShadowBundleTr(e,t,a){let r=q.instance.getTrRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=k.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}recordShadowRenderBundleNode(e,t,a,r,i){if(xe.updateCameraGroup(t),k.bindCamera(a,t),r){k.bindGeometryBuffer(a,r[0].geometry);for(let n=0;n<r.length;++n){let o=r[n];o.transform.enable&&o.recordRenderPass2(e,this._rendererType,this.rendererPassState,i,a)}}}drawShadowRenderNodes(e,t,a,r,i){if(xe.updateCameraGroup(t),k.bindCamera(a,t),r)for(let n=_.setting.render.drawOpMin;n<Math.min(r.length,_.setting.render.drawOpMax);++n){let o=r[n];o.transform.enable&&o.enable&&o.castShadow&&(o.isDestroyed||(o.preInit(this._rendererType)||o.nodeUpdate(e,this._rendererType,this.rendererPassState,i),o.renderPass2(e,this._rendererType,this.rendererPassState,i,a)))}}}class K0 extends Va{zBufferTexture;useRenderBundle=!1;shadowPassCount;zCullingCompute;constructor(){super(),this.passType=fe.DEPTH;let e=I.presentationSize,t=1;this.zBufferTexture=Mt.createRTTexture(Pa.zBufferTexture_NAME,Math.floor(e[0]*t),Math.floor(e[1]*t),oe.rgba16float,!1);let a=new Je;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=new ct([],[],Mt.createRTTexture(Pa.zPreDepthTexture_NAME,Math.floor(e[0]),Math.floor(e[1]),oe.depth32float,!1),null,!1);this.setRenderStates(r)}render(e,t){let a=e.camera,r=e.scene;k.cleanCache(),dt.start("DepthPass Renderer");let i=r;this.rendererPassState.camera3D=a;let n=q.instance.getRenderNodes(i,a);this.compute(e,t);let o=this.renderBundleOp(e,n,t),l=[],c=k.beginCommandEncoder(),f=k.beginRenderPass(c,this.rendererPassState);o.length>0&&f.executeBundles(o);let d=q.instance.getRenderShaderCollect(e);for(const h of d){let u=h[1];for(const m of u){let g=m[1];if(!g.isDestroyed&&g.preInit(this._rendererType)){g.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}this.drawRenderNodes(e,f,c,n.opaqueList,t),l.length>0&&f.executeBundles(l),k.endPass(f),k.endCommandEncoder(c),dt.end("DepthPass Renderer")}drawRenderNodes(e,t,a,r,i,n){k.bindCamera(t,e.camera);for(let o=_.setting.render.drawOpMin;o<Math.min(r.length,_.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&(l.isDestroyed||(l.preInit(this._rendererType)||l.nodeUpdate(e,this._rendererType,this.rendererPassState),l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)))}}}class q0{map;passRendererList;constructor(){this.map=new Map,this.passRendererList=[]}addRenderer(e){this.map.has(e.passType)?console.error("same renderer pass repeat!"):(this.map.set(e.passType,e),e.passType<=8&&this.addPassRenderer(e))}getRenderer(e){return this.map.get(e)}addPassRenderer(e){this.passRendererList.push(e)}getAllRenderer(){return this.map}getAllPassRenderer(){return this.passRendererList}}class $0 extends Va{finalQuadView;postList;constructor(){super(),this._rendererType=fe.POST,this.postList=new Map,this.initRenderer()}initRenderer(){Y.register("FullQuad_vert_wgsl",fc),this.finalQuadView=new to("Quad_vert_wgsl","Quad_frag_wgsl",new ct([],[]),0,!1)}attachPost(e,t){t.postRenderer=this;let a=t.constructor.name;this.postList.get(a)||(this.postList.set(a,t),t.onAttach(e))}detachPost(e,t){let a=t.constructor.name,r=this.postList.get(a);return r&&(this.postList.delete(a),t.onDetach(e),t.postRenderer=null),r!=null}render(e){this.postList.forEach(a=>{a.enable&&a.compute(e)});let t=k.beginCommandEncoder();this.postList.forEach(a=>{a.enable&&a.render(e,t)}),k.endCommandEncoder(t)}presentContent(e,t){let a=k.beginCommandEncoder();this.finalQuadView.renderToViewQuad(e,this.finalQuadView,a,t),k.endCommandEncoder(a)}}class Wt{enable=!0;postRenderer;rtViewQuad;virtualTexture;constructor(){this.rtViewQuad=new Map,this.virtualTexture=new Map,I.addEventListener(lr.RESIZE,this.onResize,this)}createRTTexture(e,t,a,r,i=!1,n=0){let o=Mt.createRTTexture(e,t,a,r,i,n);return o.name=e,this.virtualTexture.set(e,o),ke.getInstance().attached(o,this),o}createViewQuad(e,t,a,r=0){let i=Mt.createViewQuad(e,"Quad_vert_wgsl",t,a,r);return this.rtViewQuad.set(e,i),i}getOutTexture(){let e,t=k.lastRenderPassState.renderTargets;return t.length>0?e=t[0]:e=Mt.getTexture(Pa.colorBufferTex_NAME),e}autoSetColorTexture(e,t){let a=this.getOutTexture();t.setSamplerTexture(e,a)}compute(e){}onAttach(e){}onDetach(e){}onResize(){}render(e,t){this.compute(e),this.rtViewQuad.forEach((a,r)=>{let i=k.lastRenderPassState.getLastRenderTexture();a.renderToViewQuad(e,a,t,i)})}destroy(e){this.postRenderer=null;for(let t=0;t<this.rtViewQuad.size;t++)this.rtViewQuad.values[t].destroy(e);this.rtViewQuad.clear(),this.rtViewQuad=null;for(let t=0;t<this.virtualTexture.size;t++){const a=this.virtualTexture.values[t];ke.getInstance().detached(a,this),a.destroy(e)}}}class io extends ne{up_camera;down_camera;left_camera;right_camera;front_camera;back_camera;_near;_far;constructor(e=.001,t=1e4,a=90,r=!1){super(),this.initCubeCamera(e,t,a,r)}initCubeCamera(e,t,a=90,r=!1){this.up_camera=bt.createCamera3DObject(this,"up"),this.down_camera=bt.createCamera3DObject(this,"down"),this.left_camera=bt.createCamera3DObject(this,"left"),this.right_camera=bt.createCamera3DObject(this,"right"),this.front_camera=bt.createCamera3DObject(this,"front"),this.back_camera=bt.createCamera3DObject(this,"back"),this.up_camera.isShadowCamera=r,this.down_camera.isShadowCamera=r,this.left_camera.isShadowCamera=r,this.right_camera.isShadowCamera=r,this.front_camera.isShadowCamera=r,this.back_camera.isShadowCamera=r;let i=1;this.up_camera.perspective(a,i,e,t),this.up_camera.lookAt(b.ZERO,b.UP,b.DOWN),this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(b.ZERO,b.DOWN,b.DOWN),this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(b.ZERO,b.LEFT),this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(b.ZERO,b.RIGHT),this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(b.ZERO,b.FORWARD),this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(b.ZERO,b.BACK),this.up_camera.type=ot.shadow,this.down_camera.type=ot.shadow,this.left_camera.type=ot.shadow,this.right_camera.type=ot.shadow,this.front_camera.type=ot.shadow,this.back_camera.type=ot.shadow}set near(e){this._near=e,this.up_camera.near=e,this.down_camera.near=e,this.left_camera.near=e,this.right_camera.near=e,this.front_camera.near=e,this.back_camera.near=e}get near(){return this._near}set far(e){this._far=e,this.up_camera.far=e,this.down_camera.far=e,this.left_camera.far=e,this.right_camera.far=e,this.front_camera.far=e,this.back_camera.far=e}get far(){return this._far}}let ef=`
|
|
6333
6361
|
#include "GenerayRandomDir"
|
|
6334
6362
|
#include "BitUtil"
|
|
6335
6363
|
#include "MathShader"
|
|
@@ -6604,7 +6632,7 @@ struct InstanceData {
|
|
|
6604
6632
|
}
|
|
6605
6633
|
return FragmentOutput(vec4<f32>(color.rgb,basecol.a));
|
|
6606
6634
|
}
|
|
6607
|
-
`;class so extends Wt{postQuad;renderTexture;constructor(){super();let[e,t]=I.presentationSize;Y.register("FXAA_Shader",af),this.renderTexture=this.createRTTexture("FXAAPost",e,t,oe.rgba16float),this.postQuad=this.createViewQuad("fxaa","FXAA_Shader",this.renderTexture),this.postQuad.quadShader.setUniform("u_texel",new de(1/e,1/t)),this.postQuad.quadShader.setUniform("u_strength",4)}onResize(){let[e,t]=I.presentationSize;this.renderTexture.resize(e,t)}onAttach(e){_.setting.render.postProcessing.fxaa.enable=!0}onDetach(e){_.setting.render.postProcessing.fxaa.enable=!1}}class rf{rendererMap;shadowMapPassRenderer;pointLightShadowRenderer;ddgiProbeRenderer;_postRenderer;get postRenderer(){if(!this._postRenderer){let e=ve.getGBufferFrame("ColorPassGBuffer");this._postRenderer=this.addRenderer($0),this._postRenderer.setRenderStates(e)}return this._postRenderer}clusterLightingRender;reflectionRenderer;occlusionSystem;depthPassRenderer;get colorPassRenderer(){return this.rendererMap.getRenderer(fe.COLOR)}pauseRender=!1;pickFire;renderState=!1;_view;constructor(e){this._view=e,this.rendererMap=new q0,this.occlusionSystem=new ro,this.clusterLightingRender=this.addRenderer(J0,e),this.reflectionRenderer=this.addRenderer(tf,e),_.setting.render.zPrePass&&(this.depthPassRenderer=this.addRenderer(K0)),this.shadowMapPassRenderer=new H0,this.pointLightShadowRenderer=new Y0,_.setting.render.postProcessing.fxaa.enable&&this.addPost(new so)}addRenderer(e,t){let a;return t?a=new e(t):a=new e,this.rendererMap.addRenderer(a),a}get view(){return this._view}set view(e){this._view=e}start(){this.renderState=!0}stop(){}pause(){this.pauseRender=!0}resume(){this.pauseRender=!1}addPost(e){return e instanceof Wt&&this.postRenderer.attachPost(this.view,e),e}removePost(e){if(e instanceof Wt)this.postRenderer.detachPost(this.view,e);else for(let t=0;t<e.length;t++)this.postRenderer.detachPost(this.view,e[t])}renderFrame(){let e=this._view;dt.startView(e),this.clusterLightingRender&&(xe.getLightEntries(e.scene).update(e),xe.getReflectionEntries(e.scene).update(e)),_.setting.occlusionQuery.enable&&this.occlusionSystem&&this.occlusionSystem.update(e.camera,e.scene),this.clusterLightingRender&&this.clusterLightingRender.render(e,this.occlusionSystem),_.setting.shadow.enable&&this.shadowMapPassRenderer&&(jt.update(e),this.shadowMapPassRenderer.render(e,this.occlusionSystem)),_.setting.shadow.enable&&this.pointLightShadowRenderer&&this.pointLightShadowRenderer.render(e,this.occlusionSystem),this.depthPassRenderer&&(this.depthPassRenderer.compute(e,this.occlusionSystem),this.depthPassRenderer.render(e,this.occlusionSystem)),_.setting.gi.enable&&this.ddgiProbeRenderer&&(this.ddgiProbeRenderer.compute(e,this.occlusionSystem),this.ddgiProbeRenderer.render(e,this.occlusionSystem));let t=this.rendererMap.getAllPassRenderer();for(let i=0;i<t.length;i++){const n=t[i];n.compute(e,this.occlusionSystem),n.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1)}this.postRenderer.render(e);let a=this.rendererMap.getRenderer(fe.UI);a.compute(e,this.occlusionSystem),a.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1);let r=ve.getGUIBufferFrame().getColorTexture();this.postRenderer.presentContent(e,r)}debug(){}}class sf extends
|
|
6635
|
+
`;class so extends Wt{postQuad;renderTexture;constructor(){super();let[e,t]=I.presentationSize;Y.register("FXAA_Shader",af),this.renderTexture=this.createRTTexture("FXAAPost",e,t,oe.rgba16float),this.postQuad=this.createViewQuad("fxaa","FXAA_Shader",this.renderTexture),this.postQuad.quadShader.setUniform("u_texel",new de(1/e,1/t)),this.postQuad.quadShader.setUniform("u_strength",4)}onResize(){let[e,t]=I.presentationSize;this.renderTexture.resize(e,t)}onAttach(e){_.setting.render.postProcessing.fxaa.enable=!0}onDetach(e){_.setting.render.postProcessing.fxaa.enable=!1}}class rf{rendererMap;shadowMapPassRenderer;pointLightShadowRenderer;ddgiProbeRenderer;_postRenderer;get postRenderer(){if(!this._postRenderer){let e=ve.getGBufferFrame("ColorPassGBuffer");this._postRenderer=this.addRenderer($0),this._postRenderer.setRenderStates(e)}return this._postRenderer}clusterLightingRender;reflectionRenderer;occlusionSystem;depthPassRenderer;get colorPassRenderer(){return this.rendererMap.getRenderer(fe.COLOR)}pauseRender=!1;pickFire;renderState=!1;_view;constructor(e){this._view=e,this.rendererMap=new q0,this.occlusionSystem=new ro,this.clusterLightingRender=this.addRenderer(J0,e),this.reflectionRenderer=this.addRenderer(tf,e),_.setting.render.zPrePass&&(this.depthPassRenderer=this.addRenderer(K0)),this.shadowMapPassRenderer=new H0,this.pointLightShadowRenderer=new Y0,_.setting.render.postProcessing.fxaa.enable&&this.addPost(new so)}addRenderer(e,t){let a;return t?a=new e(t):a=new e,this.rendererMap.addRenderer(a),a}get view(){return this._view}set view(e){this._view=e}start(){this.renderState=!0}stop(){}pause(){this.pauseRender=!0}resume(){this.pauseRender=!1}addPost(e){return e instanceof Wt&&this.postRenderer.attachPost(this.view,e),e}removePost(e){if(e instanceof Wt)this.postRenderer.detachPost(this.view,e);else for(let t=0;t<e.length;t++)this.postRenderer.detachPost(this.view,e[t])}renderFrame(){let e=this._view;dt.startView(e),this.clusterLightingRender&&(xe.getLightEntries(e.scene).update(e),xe.getReflectionEntries(e.scene).update(e)),_.setting.occlusionQuery.enable&&this.occlusionSystem&&this.occlusionSystem.update(e.camera,e.scene),this.clusterLightingRender&&this.clusterLightingRender.render(e,this.occlusionSystem),_.setting.shadow.enable&&this.shadowMapPassRenderer&&(jt.update(e),this.shadowMapPassRenderer.render(e,this.occlusionSystem)),_.setting.shadow.enable&&this.pointLightShadowRenderer&&this.pointLightShadowRenderer.render(e,this.occlusionSystem),this.depthPassRenderer&&(this.depthPassRenderer.compute(e,this.occlusionSystem),this.depthPassRenderer.render(e,this.occlusionSystem)),_.setting.gi.enable&&this.ddgiProbeRenderer&&(this.ddgiProbeRenderer.compute(e,this.occlusionSystem),this.ddgiProbeRenderer.render(e,this.occlusionSystem));let t=this.rendererMap.getAllPassRenderer();for(let i=0;i<t.length;i++){const n=t[i];n.compute(e,this.occlusionSystem),n.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1)}this.postRenderer.render(e);let a=this.rendererMap.getRenderer(fe.UI);a.compute(e,this.occlusionSystem),a.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1);let r=ve.getGUIBufferFrame().getColorTexture();this.postRenderer.presentContent(e,r)}debug(){}}class sf extends ct{constructor(e,t,a=!0){super([],[]),this.crateGBuffer(e,t,a)}crateGBuffer(e,t,a){let r=this.renderTargets,i=this.rtDescriptors,n=new Rt(e,t,oe.rgba16float,!1,void 0,1,0,!0,a);n.name="positionMap";let o=new Je;o.loadOp="load";let l=new Rt(e,t,oe.rgba16float,!1,void 0,1,0,!0,a);l.name="normalMap";let c=new Je;c.loadOp="load";let f=new Rt(e,t,oe.rgba16float,!1,void 0,1,0,!0,a);f.name="colorMap";let d=new Je;d.loadOp="load";let h=new Rt(e,t,oe.depth24plus,!1,void 0,1,0,!0,a);h.name="depthTexture";let u=new Je;u.loadOp="load",r.push(n),r.push(l),r.push(f),i.push(o),i.push(c),i.push(d),this.depthTexture=h}}let nf=`
|
|
6608
6636
|
#include "GenerayRandomDir"
|
|
6609
6637
|
#include "MathShader"
|
|
6610
6638
|
#include "IrradianceVolumeData_frag"
|
|
@@ -7888,7 +7916,7 @@ else if (typeof exports === 'object')
|
|
|
7888
7916
|
`;class td{compute;constructor(){this.compute=new Fe(ed)}generateBRDFLUTTexture(){let e=new Te(256,256,oe.rgba8unorm,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING);this.compute.setStorageTexture("brdflutTexture",e),this.compute.workerSizeX=256/8,this.compute.workerSizeY=256/8;let t=k.beginCommandEncoder();return k.computeCommand(t,[this.compute]),k.endCommandEncoder(t),e}}class ci{id;guiTexture;uvRec=new be(0,0,1,1);uvBorder=new be(0,0,0,0);offsetSize=new be(0,0,4,4);borderSize=new be(0,0,0,0);trimSize=new de;isSliced=!1;height=4;width=4;xadvance=0;xoffset=0;yoffset=0;constructor(e){this.guiTexture=e||_.res.defaultGUITexture}}class Fr{static _maxUid=-1;_staticId=-1;dynamicId=-1;texture;width=1;height=1;get staticId(){return this._staticId}constructor(e){e||=_.res.whiteTexture,e.addressModeU="clamp-to-edge",e.addressModeV="clamp-to-edge",this.texture=e,Fr._maxUid++,this._staticId=Fr._maxUid,this.init()}init(){this.dynamicId=-1,this.width=this.texture.width,this.height=this.texture.height}}class wb{fntCache={};fntData={};addFontData(e,t,a){this.fntData[`${e}${t}`]=a}getFontData(e,t){return this.fntData[`${e}${t}`]}addFnt(e,t,a,r){let i=`${e}${t}`;this.fntCache[i]||(this.fntCache[i]={}),this.fntCache[i][a]=r}getFnt(e,t,a){let r=`${e}${t}`,i=this.fntCache[r];return i?i[a]:this.fntCache[" "]}}let fi=new wb;class ad{face="";size=0;bold=!1;italic=!1;stretchH=0;spacing="";outline=0;lineHeight=0;base=0;scaleW=0;scaleH=0;pages=0;packed=0;alphaChnl=0;redChnl=0;greenChnl=0;blueChnl=0;count=0;fontPage=[];fontChar={};constructor(){}}class rd{id=0;file=""}class id{id=-1;x=0;y=0;width=0;height=0;xoffset=0;yoffset=0;xadvance=0;page=0;chnl=0}class ir extends it{static format=je.TEXT;static parseSprite(e,t){for(const a in t.fontChar)if(Object.prototype.hasOwnProperty.call(t.fontChar,a)){const r=t.fontChar[a];let i=new ci;i.id=r.id.toString(),i.offsetSize.set(0,0,r.width,r.height),i.trimSize.set(r.width,r.height),i.width=r.width,i.height=r.height,i.xadvance=r.xadvance,i.xoffset=r.xoffset,i.yoffset=r.yoffset,i.guiTexture=e[r.page],i.uvRec.set(r.x/t.scaleW,(t.scaleH-(r.y+r.height))/t.scaleH,r.width/t.scaleW,r.height/t.scaleH),fi.addFnt(t.face,t.size,i.id,i)}}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}async parseString(e){let t=this.getNewLine(e),a=e,r=new ad;a.trim().split(t).forEach((i,n)=>{if(n<2)ir.readLineProperty(i,r);else if(n<r.pages+2){let o=new rd;ir.readLineProperty(i,o),r.fontPage.push(o)}else if(n<r.pages+3)ir.readLineProperty(i,r);else if(r.count>0){let o=new id;ir.readLineProperty(i,o),r.fontChar[o.id]=o,r.count--}}),a="",this.data=r,await this.loadFontTextures()}getNewLine(e){return e.indexOf(`\r
|
|
7889
7917
|
`)!=-1?`\r
|
|
7890
7918
|
`:e.indexOf("\r")!=-1?"\r":`
|
|
7891
|
-
`}async loadFontTextures(){let e=[],t=this.data;for(const a of t.fontPage){let r=this.baseUrl+a.file;await _.res.loadTexture(r,null,!0);let i=_.res.getTexture(r),n=new Fr(i);e.push(n)}ir.parseSprite(e,t),t.fontChar[" "]||ir.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new ci,r=e.size*.5,i=e.lineHeight*.5;a.id=" ",a.offsetSize.set(0,0,e.size,e.size),a.trimSize.set(r,i),a.width=r,a.height=i,a.xadvance=0,a.xoffset=0,a.yoffset=0,a.guiTexture=t,a.uvRec.set(0,0,1e-6,1e-6),fi.addFnt(e.face,e.size,a.id,a)}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let n=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,n)&&(o.indexOf('"')==-1?t[n]=parseFloat(i[1]):t[n]=o.replace('"',"").replace('"',""))}})}}function Ib(s,e){let t=new ci;return t.id=s,t.offsetSize.set(0,0,e.width,e.height),t.trimSize.set(e.width,e.height),t.width=e.width,t.height=e.height,t.xadvance=0,t.xoffset=0,t.yoffset=0,t.guiTexture=new Fr(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function sd(s,e,t){let a=new ci;a.guiTexture=s,a.id=e,a.uvRec.copyFrom(t.textureRect),a.trimSize.x=t.textureRect.z,a.trimSize.y=t.textureRect.w,a.offsetSize.x=t.textureRectOffset.x,a.offsetSize.y=t.textureRectOffset.y,a.offsetSize.z=t.size.x,a.offsetSize.w=t.size.y,a.width=t.size.x,a.height=t.size.y;let r=1/s.width,i=1/s.height;a.uvRec.set(a.uvRec.x*r,a.uvRec.y*i,a.uvRec.z*r,a.uvRec.w*i);let n=.1;return t.border.x<=n&&t.border.y<=n&&t.border.z<=n&&t.border.x<=n?a.isSliced=!1:(a.borderSize.copyFrom(t.border),a.uvBorder.copyFrom(t.border),a.uvBorder.x-=t.textureRectOffset.x,a.uvBorder.y-=t.textureRectOffset.y,a.uvBorder.z=t.border.z-(t.size.x-t.textureRect.z-t.textureRectOffset.x),a.uvBorder.w=t.border.w-(t.size.y-t.textureRect.w-t.textureRectOffset.y),a.uvBorder.x/=t.textureRect.z,a.uvBorder.z/=t.textureRect.z,a.uvBorder.y/=t.textureRect.w,a.uvBorder.w/=t.textureRect.w,a.isSliced=!0),a}class nd{_spriteMap=new Map;_spriteList=[];textureSize=new de;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=sd(e,t,a);return this._spriteMap.set(r.id,r),this._spriteList.push(r),r}getSprite(e){return this._spriteMap.get(e)}get spriteList(){return this._spriteList}}class od extends it{static format=je.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await _.res.loadTexture(t,null,!0),this.data={json:this._json,texture:this._texture},this.parseAtlas()}verification(){if(this.data)return!0;throw new Error("verify failed.")}parseAtlas(){let e=new nd(this._json.size),t=new Fr(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);_.res.addAtlas(this.baseUrl,e),this.data=e}}var qt=Uint8Array,di=Uint16Array,Rb=Int32Array,ld=new qt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cd=new qt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Qb=new qt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fd=function(s,e){for(var t=new di(31),a=0;a<31;++a)t[a]=e+=1<<s[a-1];for(var r=new Rb(t[30]),a=1;a<30;++a)for(var i=t[a];i<t[a+1];++i)r[i]=i-t[a]<<5|a;return{b:t,r}},dd=fd(ld,2),hd=dd.b,Tb=dd.r;hd[28]=258,Tb[258]=28;for(var Mb=fd(cd,0),Nb=Mb.b,wo=new di(32768),Ke=0;Ke<32768;++Ke){var gr=(Ke&43690)>>1|(Ke&21845)<<1;gr=(gr&52428)>>2|(gr&13107)<<2,gr=(gr&61680)>>4|(gr&3855)<<4,wo[Ke]=((gr&65280)>>8|(gr&255)<<8)>>1}for(var Pi=(function(s,e,t){for(var a=s.length,r=0,i=new di(e);r<a;++r)s[r]&&++i[s[r]-1];var n=new di(e);for(r=1;r<e;++r)n[r]=n[r-1]+i[r-1]<<1;var o;if(t){o=new di(1<<e);var l=15-e;for(r=0;r<a;++r)if(s[r])for(var c=r<<4|s[r],f=e-s[r],d=n[s[r]-1]++<<f,h=d|(1<<f)-1;d<=h;++d)o[wo[d]>>l]=c}else for(o=new di(a),r=0;r<a;++r)s[r]&&(o[r]=wo[n[s[r]-1]++]>>15-s[r]);return o}),Vi=new qt(288),Ke=0;Ke<144;++Ke)Vi[Ke]=8;for(var Ke=144;Ke<256;++Ke)Vi[Ke]=9;for(var Ke=256;Ke<280;++Ke)Vi[Ke]=7;for(var Ke=280;Ke<288;++Ke)Vi[Ke]=8;for(var ud=new qt(32),Ke=0;Ke<32;++Ke)ud[Ke]=5;var Pb=Pi(Vi,9,1),Vb=Pi(ud,5,1),Io=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},va=function(s,e,t){var a=e/8|0;return(s[a]|s[a+1]<<8)>>(e&7)&t},Ro=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},Ob=function(s){return(s+7)/8|0},Qo=function(s,e,t){return(e==null||e<0)&&(e=0),(t==null||t>s.length)&&(t=s.length),new qt(s.subarray(e,t))},Lb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ca=function(s,e,t){var a=new Error(e||Lb[s]);if(a.code=s,Error.captureStackTrace&&Error.captureStackTrace(a,ca),!t)throw a;return a},Gb=function(s,e,t,a){var r=s.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new qt(0);var n=!t,o=n||e.i!=2,l=e.i;n&&(t=new qt(r*3));var c=function(ie){var le=t.length;if(ie>le){var ge=new qt(Math.max(le*2,ie));ge.set(t),t=ge}},f=e.f||0,d=e.p||0,h=e.b||0,u=e.l,m=e.d,g=e.m,p=e.n,D=r*8;do{if(!u){f=va(s,d,1);var A=va(s,d+1,3);if(d+=3,A)if(A==1)u=Pb,m=Vb,g=9,p=5;else if(A==2){var y=va(s,d,31)+257,S=va(s,d+10,15)+4,F=y+va(s,d+5,31)+1;d+=14;for(var C=new qt(F),w=new qt(19),E=0;E<S;++E)w[Qb[E]]=va(s,d+E*3,7);d+=S*3;for(var Q=Io(w),T=(1<<Q)-1,j=Pi(w,Q,1),E=0;E<F;){var ue=j[va(s,d,T)];d+=ue&15;var B=ue>>4;if(B<16)C[E++]=B;else{var ee=0,N=0;for(B==16?(N=3+va(s,d,3),d+=2,ee=C[E-1]):B==17?(N=3+va(s,d,7),d+=3):B==18&&(N=11+va(s,d,127),d+=7);N--;)C[E++]=ee}}var M=C.subarray(0,y),O=C.subarray(y);g=Io(M),p=Io(O),u=Pi(M,g,1),m=Pi(O,p,1)}else ca(1);else{var B=Ob(d)+4,v=s[B-4]|s[B-3]<<8,U=B+v;if(U>r){l&&ca(0);break}o&&c(h+v),t.set(s.subarray(B,U),h),e.b=h+=v,e.p=d=U*8,e.f=f;continue}if(d>D){l&&ca(0);break}}o&&c(h+131072);for(var W=(1<<g)-1,ae=(1<<p)-1,z=d;;z=d){var ee=u[Ro(s,d)&W],K=ee>>4;if(d+=ee&15,d>D){l&&ca(0);break}if(ee||ca(2),K<256)t[h++]=K;else if(K==256){z=d,u=null;break}else{var $=K-254;if(K>264){var E=K-257,re=ld[E];$=va(s,d,(1<<re)-1)+hd[E],d+=re}var ce=m[Ro(s,d)&ae],Ae=ce>>4;ce||ca(3),d+=ce&15;var O=Nb[Ae];if(Ae>3){var re=cd[Ae];O+=Ro(s,d)&(1<<re)-1,d+=re}if(d>D){l&&ca(0);break}o&&c(h+131072);var Qe=h+$;if(h<O){var Ve=i-O,H=Math.min(O,Qe);for(Ve+h<0&&ca(3);h<H;++h)t[h]=a[Ve+h]}for(;h<Qe;++h)t[h]=t[h-O]}}e.l=u,e.p=z,e.b=h,e.f=f,u&&(f=1,e.m=g,e.d=m,e.n=p)}while(!f);return h!=t.length&&n?Qo(t,0,h):t.subarray(0,h)},zb=new qt(0),Oa=function(s,e){return s[e]|s[e+1]<<8},xa=function(s,e){return(s[e]|s[e+1]<<8|s[e+2]<<16|s[e+3]<<24)>>>0},To=function(s,e){return xa(s,e)+xa(s,e+4)*4294967296};function Wb(s,e){return Gb(s,{i:2},e&&e.out,e&&e.dictionary)}var Mo=typeof TextDecoder<"u"&&new TextDecoder,Jb=0;try{Mo.decode(zb,{stream:!0}),Jb=1}catch{}var jb=function(s){for(var e="",t=0;;){var a=s[t++],r=(a>127)+(a>223)+(a>239);if(t+r>s.length)return{s:e,r:Qo(s,t-1)};r?r==3?(a=((a&15)<<18|(s[t++]&63)<<12|(s[t++]&63)<<6|s[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):r&1?e+=String.fromCharCode((a&31)<<6|s[t++]&63):e+=String.fromCharCode((a&15)<<12|(s[t++]&63)<<6|s[t++]&63):e+=String.fromCharCode(a)}};function bd(s,e){if(e){for(var t="",a=0;a<s.length;a+=16384)t+=String.fromCharCode.apply(null,s.subarray(a,a+16384));return t}else{if(Mo)return Mo.decode(s);var r=jb(s),i=r.s,t=r.r;return t.length&&ca(8),i}}var Zb=function(s,e){return e+30+Oa(s,e+26)+Oa(s,e+28)},Yb=function(s,e,t){var a=Oa(s,e+28),r=bd(s.subarray(e+46,e+46+a),!(Oa(s,e+8)&2048)),i=e+46+a,n=xa(s,e+20),o=t&&n==4294967295?Xb(s,i):[n,xa(s,e+24),xa(s,e+42)],l=o[0],c=o[1],f=o[2];return[Oa(s,e+10),l,c,r,i+Oa(s,e+30)+Oa(s,e+32),f]},Xb=function(s,e){for(;Oa(s,e)!=1;e+=4+Oa(s,e+2));return[To(s,e+12),To(s,e+4),To(s,e+20)]};function Hb(s,e){for(var t={},a=s.length-22;xa(s,a)!=101010256;--a)(!a||s.length-a>65558)&&ca(13);var r=Oa(s,a+8);if(!r)return{};var i=xa(s,a+16),n=i==4294967295||r==65535;if(n){var o=xa(s,a-12);n=xa(s,o)==101075792,n&&(r=xa(s,o+32),i=xa(s,o+48))}for(var l=0;l<r;++l){var c=Yb(s,i,n),f=c[0],d=c[1],h=c[2],u=c[3],m=c[4],g=c[5],p=Zb(s,g);i=m,f?f==8?t[u]=Wb(s.subarray(p,p+d),{out:new qt(h)}):ca(14,"unknown compression type "+f):t[u]=Qo(s,p,p+d)}return t}class Bt extends vt{constructor(){super(),this.shader=new qi,this.baseMap=_.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Nr extends Le{shape_vertices=[];shape_indices=[];radius;widthSegments;heightSegments;phiStart;phiLength;thetaStart;thetaLength;constructor(e,t,a,r,i,n,o){super(),this.radius=e,this.widthSegments=t,this.heightSegments=a,this.phiStart=r,this.phiLength=i,this.thetaStart=n,this.thetaLength=o,this.buildGeometry()}buildGeometry(){var e,t,a=0;let r=this.heightSegments,i=this.widthSegments,n=this.radius;var o=(r+1)*(i+1);let l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d=new Uint16Array(i*r*2*3),h=0,u=0,m=0;for(t=0;t<=r;++t){var g=Math.PI*t/r,p=n*Math.cos(g),D=n*Math.sin(g);for(e=0;e<=i;++e){var A=2*Math.PI*e/i,B=D*Math.cos(A),v=D*Math.sin(A),U=1/Math.sqrt(B*B+p*p+v*v);if(l[h++]=B,l[h++]=p,l[h++]=v,c[u++]=B*U,c[u++]=p*U,c[u++]=v*U,f[m++]=e/i,f[m++]=t/r,e>0&&t>0){var y=(i+1)*t+e,S=(i+1)*t+e-1,F=(i+1)*(t-1)+e-1,C=(i+1)*(t-1)+e;t==r?(d[a++]=y,d[a++]=F,d[a++]=C):t==1?(d[a++]=y,d[a++]=S,d[a++]=F):(d[a++]=y,d[a++]=S,d[a++]=F,d[a++]=y,d[a++]=F,d[a++]=C)}}}this.setIndices(d),this.setAttribute(G.position,l),this.setAttribute(G.normal,c),this.setAttribute(G.uv,f),this.setAttribute(G.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new Ce(b.ZERO,new b(this.radius*2,this.radius*2,this.radius*2))}}class _s extends ne{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new b(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),_s.register3DRepresentation)this.marker=_s.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new ne;const e=this.marker.addComponent(he);e.geometry=new Nr(.1,32,16),e.material=new Bt,e.material.baseColor=this.positionValid?new J(0,1,0,1):new J(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class Bs extends ne{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new _s(t);this.addChild(a)}this.entityChildren=this.entityChildren.sort((t,a)=>t.positionIndex-a.positionIndex)}setup3DRepresentation(){this.line&&(this.removeChild(this.line),this.line=null),Bs.register3DRepresentation?(this.line=Bs.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new J(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Le,r=new Float32Array(e.length*3);for(let c=0;c<e.length;c++)r[c*3]=e[c].x,r[c*3+1]=e[c].y,r[c*3+2]=e[c].z;const i=new Uint16Array((e.length-1)*2);for(let c=0;c<e.length-1;c++)i[c*2]=c,i[c*2+1]=c+1;a.setIndices(i),a.setAttribute(G.position,r),a.addSubGeometry({indexStart:0,indexCount:i.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});const n=new ne,o=n.addComponent(he),l=new Bt;return l.topology="line-list",l.baseColor=t,l.blendMode=De.ADD,l.castReflection=!1,o.geometry=a,o.material=l,n}}class gd extends it{static format=je.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=Hb(new Uint8Array(e));for(const i in a){const n=a[i],l=new DOMParser().parseFromString(bd(n),"application/xml"),c={};this.parseNode(l,c);const f=i.replace("wpmz/","").split(".")[0];Object.assign(t,{[f]:c["#document"].kml.Document})}const r=new Bs(t.waylines);this.data=r}catch(t){this.parserError(`KMZ parsing failed: ${t}`,-1)}}parseNode(e,t){const a=["Placemark","actionGroup","action"],r=e.nodeName.replace("wpml:","");if(!e.childNodes.length)t[r]=void 0;else{let i=null,n=!1;for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];if(l.nodeType==Node.TEXT_NODE){const c=l.nodeValue?.trim();c&&c.length>0&&(i=c)}else l.nodeType==Node.ELEMENT_NODE&&(n=!0)}if(i&&!n)t[r]=i;else if(n){a.includes(r)?t[r]?.length?t[r].push({}):t[r]=[{}]:t[r]={};for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];l.nodeType==Node.ELEMENT_NODE&&this.parseNode(l,Array.isArray(t[r])?t[r].at(-1):t[r])}}else t[r]=void 0}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class pd{_texturePool;_materialPool;_prefabPool;_gltfPool;_geometryPool;_atlasList;_obj;constructor(){this._texturePool=new Map,this._materialPool=new Map,this._prefabPool=new Map,this._geometryPool=new Map,this._gltfPool=new Map,this._atlasList=new Map,this._obj=new Map}getGltf(e){return this._gltfPool.get(e)}addObj(e,t){this._obj.set(e,t)}getObj(e){return this._obj.get(e)}addTexture(e,t){this._texturePool.set(e,t)}getTexture(e){return this._texturePool.get(e)}addGeometry(e,t){this._geometryPool.set(e,t)}getGeometry(e){return this._geometryPool.get(e)}addMat(e,t){return this._materialPool.set(e,t)}getMat(e){return this._materialPool.get(e)}addPrefab(e,t){this._prefabPool.set(e,t)}getPrefab(e){return this._prefabPool.get(e).instantiate()}addAtlas(e,t){t.name=e,this._atlasList.set(e,t)}getAtlas(e){return this._atlasList.get(e)}getGUISprite(e){for(let t of this._atlasList.values()){let a=t.getSprite(e);if(a)return a}return null}async load(e,t,a){return(await new It().load(e,t,a)).data}async loadGltf(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new It;r==".gltf"?a=await i.load(e,xt,t):a=await i.load(e,_o,t);let n=a.data;return this._prefabPool.set(e,n),this._gltfPool.set(e,a.gltf),n}async loadObj(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new It;r==".obj"&&(a=await i.load(e,Ds,t));let n=a.data;return this._prefabPool.set(e,n),n}async loadB3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new It().load(e,So,t,a)).data;return this._prefabPool.set(e,n),n}async loadI3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new It().load(e,Eo,t,a)).data;return this._prefabPool.set(e,n),n}async loadTexture(e,t,a){if(this._texturePool.has(e))return this._texturePool.get(e);let r=new $a;r.flipY=a;try{await r.load(e,t)}catch(i){return console.error(`Failed to load texture: ${e}`,i),null}return this._texturePool.set(e,r),r}destroyTexture(e){const t=this._texturePool.get(e);return t?ke.getInstance().hasReference(t)?!1:(t.isDestroyed||t.destroy(),this._texturePool.delete(e),!0):!1}destroyTextureAllUnUsed(){for(const[e,t]of this._texturePool.entries())this.destroyTexture(e)}async loadTextureCount(e,t,a,r){return new Promise(async(i,n)=>{let o=0,l=[];t==0&&i(l);for(let c=0;c<t;c++){const f=e.shift();this.loadTexture(f,a,r).then(d=>{l.push(d),o++,o==t&&i(l)})}})}async loadBitmapTextures(e,t=5,a,r){let i=[],n=Math.floor(e.length/t)+1,o=Math.floor(e.length%t);for(let l=0;l<n;l++){let c=await this.loadTextureCount(e,l==n-1?o:t,a,r);i.push(...c)}return i}async loadHDRTexture(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new xo;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadHDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Os;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadLDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Gs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadTextureCubeMaps(e){let t=e[0];if(this._texturePool.has(t))return this._texturePool.get(t);let a=new Bo;return await a.load(e),this._texturePool.set(e[0],a),a}async loadTextureCubeStd(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Bo;return await a.loadStd(e),a}async loadJSON(e,t){return await new It().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new It().load(e,ir,t,a),n=i.data;return fi.addFontData(n.face,n.size,n),i.data}async loadAtlas(e,t){return(await new It().load(e,od,t,e)).data}async loadKMZ(e,t){return(await new It().load(e,gd,t)).data}normalTexture;maskTexture;whiteTexture;blackTexture;redTexture;blueTexture;greenTexture;yellowTexture;grayTexture;defaultSky;defaultGUITexture;defaultGUISprite;defaultMaterial;createTexture(e,t,a,r,i,n,o){let l=32,c=32,f=new Uint8Array(l*c*4);this.fillColor(f,e,t,a,r,i,n);let d=new Fi;return d.name=o,d.create(16,16,f,!0),o&&this.addTexture(o,d),d}fillColor(e,t,a,r,i,n,o){for(let l=0;l<t;l++)for(let c=0;c<a;c++){let f=c*t+l;e[f*4+0]=r,e[f*4+1]=i,e[f*4+2]=n,e[f*4+3]=o}}initDefault(){this.normalTexture=this.createTexture(32,32,255*.5,255*.5,255,255,"default-normalTexture"),this.maskTexture=this.createTexture(32,32,255,255*.5,255,255,"default-maskTexture"),this.whiteTexture=this.createTexture(32,32,255,255,255,255,"default-whiteTexture"),this.blackTexture=this.createTexture(32,32,0,0,0,255,"default-blackTexture"),this.redTexture=this.createTexture(32,32,255,0,0,255,"default-redTexture"),this.blueTexture=this.createTexture(32,32,0,0,255,255,"default-blueTexture"),this.greenTexture=this.createTexture(32,32,0,255,0,255,"default-greenTexture"),this.yellowTexture=this.createTexture(32,32,0,255,255,255,"default-yellowTexture"),this.grayTexture=this.createTexture(32,32,128,128,128,255,"default-grayTexture");let t=new td().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new Os,this.defaultSky.createFromTexture(128,this.blackTexture),ke.getInstance().attached(this.defaultSky,this),ke.getInstance().attached(t,this),ke.getInstance().attached(this.normalTexture,this),ke.getInstance().attached(this.maskTexture,this),ke.getInstance().attached(this.whiteTexture,this),ke.getInstance().attached(this.blackTexture,this),ke.getInstance().attached(this.redTexture,this),ke.getInstance().attached(this.blueTexture,this),ke.getInstance().attached(this.greenTexture,this),ke.getInstance().attached(this.yellowTexture,this),ke.getInstance().attached(this.grayTexture,this),this.defaultGUITexture=new Fr(this.whiteTexture),this.defaultGUISprite=new ci(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new ta}}class md extends et{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=_.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=_.getRenderJob(e);this._postList.forEach(a=>{t.removePost(a)})}addPost(e){if(this._postList.has(e))return;let t=new e;return this._postList.set(e,t),this._enable&&this.activePost(),t}removePost(e){if(!this._postList.has(e))return;let t=this._postList.get(e);this._postList.delete(e);let a=this.transform.view3D;_.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Kb="1.0.41";class _{static res;static inputSystem;static views;static _frameRateValue=0;static _frameRate=360;static _time=0;static _beforeRender;static _renderLoop;static _lateRender;static _requestAnimationFrameID=0;static get frameRate(){return this._frameRate}static set frameRate(e){this._frameRate=e,this._frameRateValue=1e3/e,e>=360&&(this._frameRateValue=0)}static get size(){return I.presentationSize}static get aspect(){return I.aspect}static get width(){return I.windowWidth}static get height(){return I.windowHeight}static setting={doublePrecision:!1,occlusionQuery:{enable:!0,debug:!1},pick:{enable:!0,mode:"bound",detail:"mesh"},render:{debug:!1,renderPassState:4,renderState_left:5,renderState_right:5,renderState_split:.5,quadScale:1,hdrExposure:1.5,debugQuad:-1,maxPointLight:1e3,maxDirectLight:4,maxSportLight:1e3,drawOpMin:0,drawOpMax:Number.MAX_SAFE_INTEGER,drawTrMin:0,drawTrMax:Number.MAX_SAFE_INTEGER,zPrePass:!1,useLogDepth:!1,useCompressGBuffer:!1,gi:!1,postProcessing:{bloom:{downSampleStep:3,downSampleBlurSize:9,downSampleBlurSigma:1,upSampleBlurSize:9,upSampleBlurSigma:1,luminanceThreshole:1,bloomIntensity:1,hdr:1},globalFog:{debug:!1,enable:!1,fogType:0,fogHeightScale:.1,start:400,end:10,density:.02,ins:.5,skyFactor:.5,skyRoughness:.4,overrideSkyFactor:.8,fogColor:new J(96/255,117/255,133/255,1),falloff:.7,rayLength:200,scatteringExponent:2.7,dirHeightLine:10},godRay:{blendColor:!0,rayMarchCount:16,scatteringExponent:5,intensity:.5},ssao:{enable:!1,radius:.15,bias:-.1,aoPower:2,debug:!0},outline:{enable:!1,strength:1,groupCount:4,outlinePixel:2,fadeOutlinePixel:4,textureScale:1,useAddMode:!1,debug:!0},taa:{enable:!1,jitterSeedCount:8,blendFactor:.1,sharpFactor:.6,sharpPreBlurFactor:.5,temporalJitterScale:.13,debug:!0},gtao:{enable:!1,darkFactor:1,maxDistance:5,maxPixel:50,rayMarchSegment:6,multiBounce:!1,usePosFloat32:!0,blendColor:!0,debug:!0},ssr:{enable:!1,pixelRatio:1,fadeEdgeRatio:.2,rayMarchRatio:.5,fadeDistanceMin:600,fadeDistanceMax:2e3,roughnessThreshold:.5,powDotRN:.2,mixThreshold:.1,debug:!0},fxaa:{enable:!1},depthOfView:{enable:!1,iterationCount:3,pixelOffset:1,near:150,far:300}}},shadow:{enable:!0,type:"HARD",pointShadowBias:5e-4,shadowSize:2048,pointShadowSize:1024,shadowSoft:.005,shadowBound:100,shadowBias:.05,needUpdate:!0,autoUpdate:!0,updateFrameRate:2,csmMargin:.1,csmScatteringExp:.7,csmAreaScale:.4,debug:!1},gi:{enable:!1,offsetX:0,offsetY:0,offsetZ:0,probeSpace:64,probeXCount:4,probeYCount:2,probeZCount:4,probeSize:32,probeSourceTextureSize:2048,octRTMaxSize:2048,octRTSideSize:16,maxDistance:64*1.73,normalBias:.25,depthSharpness:1,hysteresis:.98,lerpHysteresis:.01,irradianceChebyshevBias:.01,rayNumber:144,irradianceDistanceBias:32,indirectIntensity:1,ddgiGamma:2.2,bounceIntensity:.025,probeRoughness:1,realTimeGI:!1,debug:!1,autoRenderProbe:!1},sky:{type:"HDRSKY",sky:null,skyExposure:1,defaultFar:65536,defaultNear:1},light:{maxLight:4096},material:{materialChannelDebug:!1,materialDebug:!1},loader:{numConcurrent:20},reflectionSetting:{reflectionProbeMaxCount:8,reflectionProbeSize:256,width:256*6,height:8*256,enable:!0}};static renderJobs;static async init(e={}){console.log("Rings Version",Kb),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await Re.init(R.allocCount,this.setting.doublePrecision),await I.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,ve.getGBufferFrame(ve.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),Y.init(),Ha.init(),xe.init(),Mt.init(),jt.init(),this.res=new pd,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new Sl,this.inputSystem.initCanvas(I.canvas)}static startRenderJob(e){let t=new bf(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(md).addPost(so),(this.setting.pick.mode=="pixel"||this.setting.pick.mode=="bound")&&(e.enablePick=!0),t}static startRenderView(e){this.renderJobs||=new Map,this.views=[e];let t=this.startRenderJob(e);return this.resume(),t}static startRenderViews(e){this.renderJobs||=new Map,this.views=e;for(let t=0;t<e.length;t++)this.startRenderJob(e[t]);this.resume()}static getRenderJob(e){return this.renderJobs.get(e)}static pause(){this._requestAnimationFrameID!==0&&(cancelAnimationFrame(this._requestAnimationFrameID),this._requestAnimationFrameID=0)}static resume(){this._requestAnimationFrameID===0&&(this._requestAnimationFrameID=requestAnimationFrame(e=>this.render(e)))}static async render(e){if(this._frameRateValue>0){let t=e-this._time;if(t<this._frameRateValue){let a=performance.now();await new Promise(r=>{setTimeout(()=>{e+=performance.now()-a,r(!0)},this._frameRateValue-t)})}this._time=e}await this.updateFrame(e),this._requestAnimationFrameID=0,this.resume()}static async updateFrame(e){We.delta=e-We.time,We.time=e,We.frame+=1,Sr.tick(We.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const n=t[a];n.scene.waitUpdate();let[o,l]=I.presentationSize;n.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const n of Oe.componentsBeforeUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}let r=I.device.createCommandEncoder();for(const n of Oe.componentsComputeList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o,r)}}I.device.queue.submit([r.finish()]);for(const n of Oe.componentsUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}for(const n of Oe.graphicComponent){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];o&&f.enable&&d(o)}}this._renderLoop&&await this._renderLoop(),Re.updateAllContinueTransform(0,R.useCount,16),xe.modelMatrixBindGroup.writeBuffer(R.useCount*16),this.renderJobs.forEach((n,o)=>{n.renderState||n.start(),n.renderFrame()});for(const n of Oe.componentsLateUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}this._lateRender&&await this._lateRender()}}let zs=`
|
|
7919
|
+
`}async loadFontTextures(){let e=[],t=this.data;for(const a of t.fontPage){let r=this.baseUrl+a.file;await _.res.loadTexture(r,null,!0);let i=_.res.getTexture(r),n=new Fr(i);e.push(n)}ir.parseSprite(e,t),t.fontChar[" "]||ir.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new ci,r=e.size*.5,i=e.lineHeight*.5;a.id=" ",a.offsetSize.set(0,0,e.size,e.size),a.trimSize.set(r,i),a.width=r,a.height=i,a.xadvance=0,a.xoffset=0,a.yoffset=0,a.guiTexture=t,a.uvRec.set(0,0,1e-6,1e-6),fi.addFnt(e.face,e.size,a.id,a)}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let n=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,n)&&(o.indexOf('"')==-1?t[n]=parseFloat(i[1]):t[n]=o.replace('"',"").replace('"',""))}})}}function Ib(s,e){let t=new ci;return t.id=s,t.offsetSize.set(0,0,e.width,e.height),t.trimSize.set(e.width,e.height),t.width=e.width,t.height=e.height,t.xadvance=0,t.xoffset=0,t.yoffset=0,t.guiTexture=new Fr(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function sd(s,e,t){let a=new ci;a.guiTexture=s,a.id=e,a.uvRec.copyFrom(t.textureRect),a.trimSize.x=t.textureRect.z,a.trimSize.y=t.textureRect.w,a.offsetSize.x=t.textureRectOffset.x,a.offsetSize.y=t.textureRectOffset.y,a.offsetSize.z=t.size.x,a.offsetSize.w=t.size.y,a.width=t.size.x,a.height=t.size.y;let r=1/s.width,i=1/s.height;a.uvRec.set(a.uvRec.x*r,a.uvRec.y*i,a.uvRec.z*r,a.uvRec.w*i);let n=.1;return t.border.x<=n&&t.border.y<=n&&t.border.z<=n&&t.border.x<=n?a.isSliced=!1:(a.borderSize.copyFrom(t.border),a.uvBorder.copyFrom(t.border),a.uvBorder.x-=t.textureRectOffset.x,a.uvBorder.y-=t.textureRectOffset.y,a.uvBorder.z=t.border.z-(t.size.x-t.textureRect.z-t.textureRectOffset.x),a.uvBorder.w=t.border.w-(t.size.y-t.textureRect.w-t.textureRectOffset.y),a.uvBorder.x/=t.textureRect.z,a.uvBorder.z/=t.textureRect.z,a.uvBorder.y/=t.textureRect.w,a.uvBorder.w/=t.textureRect.w,a.isSliced=!0),a}class nd{_spriteMap=new Map;_spriteList=[];textureSize=new de;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=sd(e,t,a);return this._spriteMap.set(r.id,r),this._spriteList.push(r),r}getSprite(e){return this._spriteMap.get(e)}get spriteList(){return this._spriteList}}class od extends it{static format=je.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await _.res.loadTexture(t,null,!0),this.data={json:this._json,texture:this._texture},this.parseAtlas()}verification(){if(this.data)return!0;throw new Error("verify failed.")}parseAtlas(){let e=new nd(this._json.size),t=new Fr(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);_.res.addAtlas(this.baseUrl,e),this.data=e}}var qt=Uint8Array,di=Uint16Array,Rb=Int32Array,ld=new qt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cd=new qt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Qb=new qt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fd=function(s,e){for(var t=new di(31),a=0;a<31;++a)t[a]=e+=1<<s[a-1];for(var r=new Rb(t[30]),a=1;a<30;++a)for(var i=t[a];i<t[a+1];++i)r[i]=i-t[a]<<5|a;return{b:t,r}},dd=fd(ld,2),hd=dd.b,Tb=dd.r;hd[28]=258,Tb[258]=28;for(var Mb=fd(cd,0),Nb=Mb.b,wo=new di(32768),Ke=0;Ke<32768;++Ke){var gr=(Ke&43690)>>1|(Ke&21845)<<1;gr=(gr&52428)>>2|(gr&13107)<<2,gr=(gr&61680)>>4|(gr&3855)<<4,wo[Ke]=((gr&65280)>>8|(gr&255)<<8)>>1}for(var Pi=(function(s,e,t){for(var a=s.length,r=0,i=new di(e);r<a;++r)s[r]&&++i[s[r]-1];var n=new di(e);for(r=1;r<e;++r)n[r]=n[r-1]+i[r-1]<<1;var o;if(t){o=new di(1<<e);var l=15-e;for(r=0;r<a;++r)if(s[r])for(var c=r<<4|s[r],f=e-s[r],d=n[s[r]-1]++<<f,h=d|(1<<f)-1;d<=h;++d)o[wo[d]>>l]=c}else for(o=new di(a),r=0;r<a;++r)s[r]&&(o[r]=wo[n[s[r]-1]++]>>15-s[r]);return o}),Vi=new qt(288),Ke=0;Ke<144;++Ke)Vi[Ke]=8;for(var Ke=144;Ke<256;++Ke)Vi[Ke]=9;for(var Ke=256;Ke<280;++Ke)Vi[Ke]=7;for(var Ke=280;Ke<288;++Ke)Vi[Ke]=8;for(var ud=new qt(32),Ke=0;Ke<32;++Ke)ud[Ke]=5;var Pb=Pi(Vi,9,1),Vb=Pi(ud,5,1),Io=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},va=function(s,e,t){var a=e/8|0;return(s[a]|s[a+1]<<8)>>(e&7)&t},Ro=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},Ob=function(s){return(s+7)/8|0},Qo=function(s,e,t){return(e==null||e<0)&&(e=0),(t==null||t>s.length)&&(t=s.length),new qt(s.subarray(e,t))},Lb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ca=function(s,e,t){var a=new Error(e||Lb[s]);if(a.code=s,Error.captureStackTrace&&Error.captureStackTrace(a,ca),!t)throw a;return a},Gb=function(s,e,t,a){var r=s.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new qt(0);var n=!t,o=n||e.i!=2,l=e.i;n&&(t=new qt(r*3));var c=function(ie){var le=t.length;if(ie>le){var ge=new qt(Math.max(le*2,ie));ge.set(t),t=ge}},f=e.f||0,d=e.p||0,h=e.b||0,u=e.l,m=e.d,g=e.m,p=e.n,D=r*8;do{if(!u){f=va(s,d,1);var A=va(s,d+1,3);if(d+=3,A)if(A==1)u=Pb,m=Vb,g=9,p=5;else if(A==2){var y=va(s,d,31)+257,S=va(s,d+10,15)+4,F=y+va(s,d+5,31)+1;d+=14;for(var C=new qt(F),w=new qt(19),E=0;E<S;++E)w[Qb[E]]=va(s,d+E*3,7);d+=S*3;for(var Q=Io(w),T=(1<<Q)-1,j=Pi(w,Q,1),E=0;E<F;){var ue=j[va(s,d,T)];d+=ue&15;var B=ue>>4;if(B<16)C[E++]=B;else{var ee=0,N=0;for(B==16?(N=3+va(s,d,3),d+=2,ee=C[E-1]):B==17?(N=3+va(s,d,7),d+=3):B==18&&(N=11+va(s,d,127),d+=7);N--;)C[E++]=ee}}var M=C.subarray(0,y),O=C.subarray(y);g=Io(M),p=Io(O),u=Pi(M,g,1),m=Pi(O,p,1)}else ca(1);else{var B=Ob(d)+4,v=s[B-4]|s[B-3]<<8,U=B+v;if(U>r){l&&ca(0);break}o&&c(h+v),t.set(s.subarray(B,U),h),e.b=h+=v,e.p=d=U*8,e.f=f;continue}if(d>D){l&&ca(0);break}}o&&c(h+131072);for(var W=(1<<g)-1,ae=(1<<p)-1,z=d;;z=d){var ee=u[Ro(s,d)&W],K=ee>>4;if(d+=ee&15,d>D){l&&ca(0);break}if(ee||ca(2),K<256)t[h++]=K;else if(K==256){z=d,u=null;break}else{var $=K-254;if(K>264){var E=K-257,re=ld[E];$=va(s,d,(1<<re)-1)+hd[E],d+=re}var ce=m[Ro(s,d)&ae],Ae=ce>>4;ce||ca(3),d+=ce&15;var O=Nb[Ae];if(Ae>3){var re=cd[Ae];O+=Ro(s,d)&(1<<re)-1,d+=re}if(d>D){l&&ca(0);break}o&&c(h+131072);var Qe=h+$;if(h<O){var Ve=i-O,H=Math.min(O,Qe);for(Ve+h<0&&ca(3);h<H;++h)t[h]=a[Ve+h]}for(;h<Qe;++h)t[h]=t[h-O]}}e.l=u,e.p=z,e.b=h,e.f=f,u&&(f=1,e.m=g,e.d=m,e.n=p)}while(!f);return h!=t.length&&n?Qo(t,0,h):t.subarray(0,h)},zb=new qt(0),Oa=function(s,e){return s[e]|s[e+1]<<8},xa=function(s,e){return(s[e]|s[e+1]<<8|s[e+2]<<16|s[e+3]<<24)>>>0},To=function(s,e){return xa(s,e)+xa(s,e+4)*4294967296};function Wb(s,e){return Gb(s,{i:2},e&&e.out,e&&e.dictionary)}var Mo=typeof TextDecoder<"u"&&new TextDecoder,Jb=0;try{Mo.decode(zb,{stream:!0}),Jb=1}catch{}var jb=function(s){for(var e="",t=0;;){var a=s[t++],r=(a>127)+(a>223)+(a>239);if(t+r>s.length)return{s:e,r:Qo(s,t-1)};r?r==3?(a=((a&15)<<18|(s[t++]&63)<<12|(s[t++]&63)<<6|s[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):r&1?e+=String.fromCharCode((a&31)<<6|s[t++]&63):e+=String.fromCharCode((a&15)<<12|(s[t++]&63)<<6|s[t++]&63):e+=String.fromCharCode(a)}};function bd(s,e){if(e){for(var t="",a=0;a<s.length;a+=16384)t+=String.fromCharCode.apply(null,s.subarray(a,a+16384));return t}else{if(Mo)return Mo.decode(s);var r=jb(s),i=r.s,t=r.r;return t.length&&ca(8),i}}var Zb=function(s,e){return e+30+Oa(s,e+26)+Oa(s,e+28)},Yb=function(s,e,t){var a=Oa(s,e+28),r=bd(s.subarray(e+46,e+46+a),!(Oa(s,e+8)&2048)),i=e+46+a,n=xa(s,e+20),o=t&&n==4294967295?Xb(s,i):[n,xa(s,e+24),xa(s,e+42)],l=o[0],c=o[1],f=o[2];return[Oa(s,e+10),l,c,r,i+Oa(s,e+30)+Oa(s,e+32),f]},Xb=function(s,e){for(;Oa(s,e)!=1;e+=4+Oa(s,e+2));return[To(s,e+12),To(s,e+4),To(s,e+20)]};function Hb(s,e){for(var t={},a=s.length-22;xa(s,a)!=101010256;--a)(!a||s.length-a>65558)&&ca(13);var r=Oa(s,a+8);if(!r)return{};var i=xa(s,a+16),n=i==4294967295||r==65535;if(n){var o=xa(s,a-12);n=xa(s,o)==101075792,n&&(r=xa(s,o+32),i=xa(s,o+48))}for(var l=0;l<r;++l){var c=Yb(s,i,n),f=c[0],d=c[1],h=c[2],u=c[3],m=c[4],g=c[5],p=Zb(s,g);i=m,f?f==8?t[u]=Wb(s.subarray(p,p+d),{out:new qt(h)}):ca(14,"unknown compression type "+f):t[u]=Qo(s,p,p+d)}return t}class Bt extends vt{constructor(){super(),this.shader=new qi,this.baseMap=_.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Nr extends Le{shape_vertices=[];shape_indices=[];radius;widthSegments;heightSegments;phiStart;phiLength;thetaStart;thetaLength;constructor(e,t,a,r,i,n,o){super(),this.radius=e,this.widthSegments=t,this.heightSegments=a,this.phiStart=r,this.phiLength=i,this.thetaStart=n,this.thetaLength=o,this.buildGeometry()}buildGeometry(){var e,t,a=0;let r=this.heightSegments,i=this.widthSegments,n=this.radius;var o=(r+1)*(i+1);let l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d=new Uint16Array(i*r*2*3),h=0,u=0,m=0;for(t=0;t<=r;++t){var g=Math.PI*t/r,p=n*Math.cos(g),D=n*Math.sin(g);for(e=0;e<=i;++e){var A=2*Math.PI*e/i,B=D*Math.cos(A),v=D*Math.sin(A),U=1/Math.sqrt(B*B+p*p+v*v);if(l[h++]=B,l[h++]=p,l[h++]=v,c[u++]=B*U,c[u++]=p*U,c[u++]=v*U,f[m++]=e/i,f[m++]=t/r,e>0&&t>0){var y=(i+1)*t+e,S=(i+1)*t+e-1,F=(i+1)*(t-1)+e-1,C=(i+1)*(t-1)+e;t==r?(d[a++]=y,d[a++]=F,d[a++]=C):t==1?(d[a++]=y,d[a++]=S,d[a++]=F):(d[a++]=y,d[a++]=S,d[a++]=F,d[a++]=y,d[a++]=F,d[a++]=C)}}}this.setIndices(d),this.setAttribute(G.position,l),this.setAttribute(G.normal,c),this.setAttribute(G.uv,f),this.setAttribute(G.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new Ce(b.ZERO,new b(this.radius*2,this.radius*2,this.radius*2))}}class _s extends ne{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new b(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),_s.register3DRepresentation)this.marker=_s.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new ne;const e=this.marker.addComponent(he);e.geometry=new Nr(.1,32,16),e.material=new Bt,e.material.baseColor=this.positionValid?new J(0,1,0,1):new J(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class Bs extends ne{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new _s(t);this.addChild(a)}this.entityChildren=this.entityChildren.sort((t,a)=>t.positionIndex-a.positionIndex)}setup3DRepresentation(){this.line&&(this.removeChild(this.line),this.line=null),Bs.register3DRepresentation?(this.line=Bs.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new J(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Le,r=new Float32Array(e.length*3);for(let c=0;c<e.length;c++)r[c*3]=e[c].x,r[c*3+1]=e[c].y,r[c*3+2]=e[c].z;const i=new Uint16Array((e.length-1)*2);for(let c=0;c<e.length-1;c++)i[c*2]=c,i[c*2+1]=c+1;a.setIndices(i),a.setAttribute(G.position,r),a.addSubGeometry({indexStart:0,indexCount:i.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});const n=new ne,o=n.addComponent(he),l=new Bt;return l.topology="line-list",l.baseColor=t,l.blendMode=De.ADD,l.castReflection=!1,o.geometry=a,o.material=l,n}}class gd extends it{static format=je.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=Hb(new Uint8Array(e));for(const i in a){const n=a[i],l=new DOMParser().parseFromString(bd(n),"application/xml"),c={};this.parseNode(l,c);const f=i.replace("wpmz/","").split(".")[0];Object.assign(t,{[f]:c["#document"].kml.Document})}const r=new Bs(t.waylines);this.data=r}catch(t){this.parserError(`KMZ parsing failed: ${t}`,-1)}}parseNode(e,t){const a=["Placemark","actionGroup","action"],r=e.nodeName.replace("wpml:","");if(!e.childNodes.length)t[r]=void 0;else{let i=null,n=!1;for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];if(l.nodeType==Node.TEXT_NODE){const c=l.nodeValue?.trim();c&&c.length>0&&(i=c)}else l.nodeType==Node.ELEMENT_NODE&&(n=!0)}if(i&&!n)t[r]=i;else if(n){a.includes(r)?t[r]?.length?t[r].push({}):t[r]=[{}]:t[r]={};for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];l.nodeType==Node.ELEMENT_NODE&&this.parseNode(l,Array.isArray(t[r])?t[r].at(-1):t[r])}}else t[r]=void 0}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class pd{_texturePool;_materialPool;_prefabPool;_gltfPool;_geometryPool;_atlasList;_obj;constructor(){this._texturePool=new Map,this._materialPool=new Map,this._prefabPool=new Map,this._geometryPool=new Map,this._gltfPool=new Map,this._atlasList=new Map,this._obj=new Map}getGltf(e){return this._gltfPool.get(e)}addObj(e,t){this._obj.set(e,t)}getObj(e){return this._obj.get(e)}addTexture(e,t){this._texturePool.set(e,t)}getTexture(e){return this._texturePool.get(e)}addGeometry(e,t){this._geometryPool.set(e,t)}getGeometry(e){return this._geometryPool.get(e)}addMat(e,t){return this._materialPool.set(e,t)}getMat(e){return this._materialPool.get(e)}addPrefab(e,t){this._prefabPool.set(e,t)}getPrefab(e){return this._prefabPool.get(e).instantiate()}addAtlas(e,t){t.name=e,this._atlasList.set(e,t)}getAtlas(e){return this._atlasList.get(e)}getGUISprite(e){for(let t of this._atlasList.values()){let a=t.getSprite(e);if(a)return a}return null}async load(e,t,a){return(await new It().load(e,t,a)).data}async loadGltf(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new It;r==".gltf"?a=await i.load(e,xt,t):a=await i.load(e,_o,t);let n=a.data;return this._prefabPool.set(e,n),this._gltfPool.set(e,a.gltf),n}async loadObj(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new It;r==".obj"&&(a=await i.load(e,Ds,t));let n=a.data;return this._prefabPool.set(e,n),n}async loadB3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new It().load(e,So,t,a)).data;return this._prefabPool.set(e,n),n}async loadI3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new It().load(e,Eo,t,a)).data;return this._prefabPool.set(e,n),n}async loadTexture(e,t,a){if(this._texturePool.has(e))return this._texturePool.get(e);let r=new $a;r.flipY=a;try{await r.load(e,t)}catch(i){return console.error(`Failed to load texture: ${e}`,i),null}return this._texturePool.set(e,r),r}destroyTexture(e){const t=this._texturePool.get(e);return t?ke.getInstance().hasReference(t)?!1:(t.isDestroyed||t.destroy(),this._texturePool.delete(e),!0):!1}destroyTextureAllUnUsed(){for(const[e,t]of this._texturePool.entries())this.destroyTexture(e)}async loadTextureCount(e,t,a,r){return new Promise(async(i,n)=>{let o=0,l=[];t==0&&i(l);for(let c=0;c<t;c++){const f=e.shift();this.loadTexture(f,a,r).then(d=>{l.push(d),o++,o==t&&i(l)})}})}async loadBitmapTextures(e,t=5,a,r){let i=[],n=Math.floor(e.length/t)+1,o=Math.floor(e.length%t);for(let l=0;l<n;l++){let c=await this.loadTextureCount(e,l==n-1?o:t,a,r);i.push(...c)}return i}async loadHDRTexture(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new xo;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadHDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Os;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadLDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Gs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadTextureCubeMaps(e){let t=e[0];if(this._texturePool.has(t))return this._texturePool.get(t);let a=new Bo;return await a.load(e),this._texturePool.set(e[0],a),a}async loadTextureCubeStd(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Bo;return await a.loadStd(e),a}async loadJSON(e,t){return await new It().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new It().load(e,ir,t,a),n=i.data;return fi.addFontData(n.face,n.size,n),i.data}async loadAtlas(e,t){return(await new It().load(e,od,t,e)).data}async loadKMZ(e,t){return(await new It().load(e,gd,t)).data}normalTexture;maskTexture;whiteTexture;blackTexture;redTexture;blueTexture;greenTexture;yellowTexture;grayTexture;defaultSky;defaultGUITexture;defaultGUISprite;defaultMaterial;createTexture(e,t,a,r,i,n,o){let l=32,c=32,f=new Uint8Array(l*c*4);this.fillColor(f,e,t,a,r,i,n);let d=new Fi;return d.name=o,d.create(16,16,f,!0),o&&this.addTexture(o,d),d}fillColor(e,t,a,r,i,n,o){for(let l=0;l<t;l++)for(let c=0;c<a;c++){let f=c*t+l;e[f*4+0]=r,e[f*4+1]=i,e[f*4+2]=n,e[f*4+3]=o}}initDefault(){this.normalTexture=this.createTexture(32,32,255*.5,255*.5,255,255,"default-normalTexture"),this.maskTexture=this.createTexture(32,32,255,255*.5,255,255,"default-maskTexture"),this.whiteTexture=this.createTexture(32,32,255,255,255,255,"default-whiteTexture"),this.blackTexture=this.createTexture(32,32,0,0,0,255,"default-blackTexture"),this.redTexture=this.createTexture(32,32,255,0,0,255,"default-redTexture"),this.blueTexture=this.createTexture(32,32,0,0,255,255,"default-blueTexture"),this.greenTexture=this.createTexture(32,32,0,255,0,255,"default-greenTexture"),this.yellowTexture=this.createTexture(32,32,0,255,255,255,"default-yellowTexture"),this.grayTexture=this.createTexture(32,32,128,128,128,255,"default-grayTexture");let t=new td().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new Os,this.defaultSky.createFromTexture(128,this.blackTexture),ke.getInstance().attached(this.defaultSky,this),ke.getInstance().attached(t,this),ke.getInstance().attached(this.normalTexture,this),ke.getInstance().attached(this.maskTexture,this),ke.getInstance().attached(this.whiteTexture,this),ke.getInstance().attached(this.blackTexture,this),ke.getInstance().attached(this.redTexture,this),ke.getInstance().attached(this.blueTexture,this),ke.getInstance().attached(this.greenTexture,this),ke.getInstance().attached(this.yellowTexture,this),ke.getInstance().attached(this.grayTexture,this),this.defaultGUITexture=new Fr(this.whiteTexture),this.defaultGUISprite=new ci(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new ta}}class md extends et{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=_.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=_.getRenderJob(e);this._postList.forEach(a=>{t.removePost(a)})}addPost(e){if(this._postList.has(e))return;let t=new e;return this._postList.set(e,t),this._enable&&this.activePost(),t}removePost(e){if(!this._postList.has(e))return;let t=this._postList.get(e);this._postList.delete(e);let a=this.transform.view3D;_.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Kb="1.0.42";class _{static res;static inputSystem;static views;static _frameRateValue=0;static _frameRate=360;static _time=0;static _beforeRender;static _renderLoop;static _lateRender;static _requestAnimationFrameID=0;static get frameRate(){return this._frameRate}static set frameRate(e){this._frameRate=e,this._frameRateValue=1e3/e,e>=360&&(this._frameRateValue=0)}static get size(){return I.presentationSize}static get aspect(){return I.aspect}static get width(){return I.windowWidth}static get height(){return I.windowHeight}static setting={doublePrecision:!1,occlusionQuery:{enable:!0,debug:!1},pick:{enable:!0,mode:"bound",detail:"mesh"},render:{debug:!1,renderPassState:4,renderState_left:5,renderState_right:5,renderState_split:.5,quadScale:1,hdrExposure:1.5,debugQuad:-1,maxPointLight:1e3,maxDirectLight:4,maxSportLight:1e3,drawOpMin:0,drawOpMax:Number.MAX_SAFE_INTEGER,drawTrMin:0,drawTrMax:Number.MAX_SAFE_INTEGER,zPrePass:!1,useLogDepth:!1,useCompressGBuffer:!1,gi:!1,postProcessing:{bloom:{downSampleStep:3,downSampleBlurSize:9,downSampleBlurSigma:1,upSampleBlurSize:9,upSampleBlurSigma:1,luminanceThreshole:1,bloomIntensity:1,hdr:1},globalFog:{debug:!1,enable:!1,fogType:0,fogHeightScale:.1,start:400,end:10,density:.02,ins:.5,skyFactor:.5,skyRoughness:.4,overrideSkyFactor:.8,fogColor:new J(96/255,117/255,133/255,1),falloff:.7,rayLength:200,scatteringExponent:2.7,dirHeightLine:10},godRay:{blendColor:!0,rayMarchCount:16,scatteringExponent:5,intensity:.5},ssao:{enable:!1,radius:.15,bias:-.1,aoPower:2,debug:!0},outline:{enable:!1,strength:1,groupCount:4,outlinePixel:2,fadeOutlinePixel:4,textureScale:1,useAddMode:!1,debug:!0},taa:{enable:!1,jitterSeedCount:8,blendFactor:.1,sharpFactor:.6,sharpPreBlurFactor:.5,temporalJitterScale:.13,debug:!0},gtao:{enable:!1,darkFactor:1,maxDistance:5,maxPixel:50,rayMarchSegment:6,multiBounce:!1,usePosFloat32:!0,blendColor:!0,debug:!0},ssr:{enable:!1,pixelRatio:1,fadeEdgeRatio:.2,rayMarchRatio:.5,fadeDistanceMin:600,fadeDistanceMax:2e3,roughnessThreshold:.5,powDotRN:.2,mixThreshold:.1,debug:!0},fxaa:{enable:!1},depthOfView:{enable:!1,iterationCount:3,pixelOffset:1,near:150,far:300}}},shadow:{enable:!0,type:"HARD",pointShadowBias:5e-4,shadowSize:2048,pointShadowSize:1024,shadowSoft:.005,shadowBound:100,shadowBias:.05,needUpdate:!0,autoUpdate:!0,updateFrameRate:2,csmMargin:.1,csmScatteringExp:.7,csmAreaScale:.4,debug:!1},gi:{enable:!1,offsetX:0,offsetY:0,offsetZ:0,probeSpace:64,probeXCount:4,probeYCount:2,probeZCount:4,probeSize:32,probeSourceTextureSize:2048,octRTMaxSize:2048,octRTSideSize:16,maxDistance:64*1.73,normalBias:.25,depthSharpness:1,hysteresis:.98,lerpHysteresis:.01,irradianceChebyshevBias:.01,rayNumber:144,irradianceDistanceBias:32,indirectIntensity:1,ddgiGamma:2.2,bounceIntensity:.025,probeRoughness:1,realTimeGI:!1,debug:!1,autoRenderProbe:!1},sky:{type:"HDRSKY",sky:null,skyExposure:1,defaultFar:65536,defaultNear:1},light:{maxLight:4096},material:{materialChannelDebug:!1,materialDebug:!1},loader:{numConcurrent:20},reflectionSetting:{reflectionProbeMaxCount:8,reflectionProbeSize:256,width:256*6,height:8*256,enable:!0}};static renderJobs;static async init(e={}){console.log("Rings Version",Kb),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await Re.init(R.allocCount,this.setting.doublePrecision),await I.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,ve.getGBufferFrame(ve.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),Y.init(),Ha.init(),xe.init(),Mt.init(),jt.init(),this.res=new pd,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new Sl,this.inputSystem.initCanvas(I.canvas)}static startRenderJob(e){let t=new bf(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(md).addPost(so),(this.setting.pick.mode=="pixel"||this.setting.pick.mode=="bound")&&(e.enablePick=!0),t}static startRenderView(e){this.renderJobs||=new Map,this.views=[e];let t=this.startRenderJob(e);return this.resume(),t}static startRenderViews(e){this.renderJobs||=new Map,this.views=e;for(let t=0;t<e.length;t++)this.startRenderJob(e[t]);this.resume()}static getRenderJob(e){return this.renderJobs.get(e)}static pause(){this._requestAnimationFrameID!==0&&(cancelAnimationFrame(this._requestAnimationFrameID),this._requestAnimationFrameID=0)}static resume(){this._requestAnimationFrameID===0&&(this._requestAnimationFrameID=requestAnimationFrame(e=>this.render(e)))}static async render(e){if(this._frameRateValue>0){let t=e-this._time;if(t<this._frameRateValue){let a=performance.now();await new Promise(r=>{setTimeout(()=>{e+=performance.now()-a,r(!0)},this._frameRateValue-t)})}this._time=e}await this.updateFrame(e),this._requestAnimationFrameID=0,this.resume()}static async updateFrame(e){We.delta=e-We.time,We.time=e,We.frame+=1,Sr.tick(We.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const n=t[a];n.scene.waitUpdate();let[o,l]=I.presentationSize;n.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const n of Oe.componentsBeforeUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}let r=I.device.createCommandEncoder();for(const n of Oe.componentsComputeList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o,r)}}I.device.queue.submit([r.finish()]);for(const n of Oe.componentsUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}for(const n of Oe.graphicComponent){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];o&&f.enable&&d(o)}}this._renderLoop&&await this._renderLoop(),Re.updateAllContinueTransform(0,R.useCount,16),xe.modelMatrixBindGroup.writeBuffer(R.useCount*16),this.renderJobs.forEach((n,o)=>{n.renderState||n.start(),n.renderFrame()});for(const n of Oe.componentsLateUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}this._lateRender&&await this._lateRender()}}let zs=`
|
|
7892
7920
|
struct BloomCfg{
|
|
7893
7921
|
downSampleStep: f32,
|
|
7894
7922
|
downSampleBlurSize: f32,
|
|
@@ -11536,7 +11564,7 @@ fn frag(){
|
|
|
11536
11564
|
var fragColor:vec4<f32> = vec4<f32>((sky.rgb), 1.0);
|
|
11537
11565
|
return fragColor;
|
|
11538
11566
|
}
|
|
11539
|
-
`}class Hd{sunRadius=500;sunRadiance=11;mieG=.76;mieHeight=1200;eyePos=1500;sunX=.71;sunY=.56;sunBrightness=1;displaySun=!0;defaultTextureCubeSize=512;defaultTexture2DSize=1024;skyColor=new J(1,1,1,1)}class Kd extends Gs{_internalTexture;_cubeSize;setting;constructor(e){return super(),this.setting=e,this._cubeSize=e.defaultTextureCubeSize,this._internalTexture=new dg(e.defaultTexture2DSize,e.defaultTexture2DSize*.5),this._internalTexture.update(this.setting),this.createFromTexture(this._cubeSize,this._internalTexture),this}get texture2D(){return this._internalTexture}apply(){return this._internalTexture.update(this.setting),this._faceData.uploadErpTexture(this._internalTexture),this}}class dg extends Te{_computeShader;_uniformBuffer;constructor(e,t){super(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.initCompute(e,t)}initCompute(e,t){this._uniformBuffer=new Ct(64),this._uniformBuffer.apply(),this._computeShader=new Fe(Xd.cs),this._computeShader.setUniformBuffer("uniformBuffer",this._uniformBuffer),this._computeShader.setStorageTexture("outTexture",this),this._computeShader.workerSizeX=e/8,this._computeShader.workerSizeY=t/8}update(e){this._uniformBuffer.setFloat("width",this.width),this._uniformBuffer.setFloat("height",this.height),this._uniformBuffer.setFloat("sunU",e.sunX),this._uniformBuffer.setFloat("sunV",e.sunY),this._uniformBuffer.setFloat("eyePos",e.eyePos),this._uniformBuffer.setFloat("sunRadius",e.sunRadius),this._uniformBuffer.setFloat("sunRadiance",e.sunRadiance),this._uniformBuffer.setFloat("mieG",e.mieG),this._uniformBuffer.setFloat("mieHeight",e.mieHeight),this._uniformBuffer.setFloat("sunBrightness",e.sunBrightness),this._uniformBuffer.setFloat("displaySun",e.displaySun?1:0),this._uniformBuffer.setColor("skyColor",e.skyColor),this._uniformBuffer.apply();let t=k.beginCommandEncoder();return k.computeCommand(t,[this._computeShader]),k.endCommandEncoder(t),this}}var hg=Object.getOwnPropertyDescriptor,ug=(s,e,t,a)=>{for(var r=a>1?void 0:a?hg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Oi=class extends At{constructor(){super();let s=new qe("sky_vs_frag_wgsl","sky_fs_frag_wgsl");this.addRenderPass(s),s.setUniformVector3("eyesPos",new b),s.setUniformFloat("exposure",1),s.setUniformFloat("roughness",0);let e=s.shaderState;e.frontFace="cw",e.cullMode=Lt.back,e.depthWriteEnabled=!1,e.depthCompare=ft.less}};Oi=ug([Na(Oi,"SkyShader")],Oi);class qd extends vt{constructor(){super(),this.shader=new Oi,this.shader.setUniformVector3("eyesPos",new b),this.shader.setUniformFloat("exposure",1),this.shader.setUniformFloat("roughness",0)}set baseMap(e){this.setTexture("baseMap",e);const t="IS_HDR_SKY";this._shader.getDefaultShaders()[0].defineValue[t]!=e?.isHDRTexture&&this._shader.setDefine(t,!!e?.isHDRTexture)}get baseMap(){return this._shader.getDefaultColorShader().getTexture("baseMap")}set envMap(e){}set shadowMap(e){}get exposure(){return _.setting.sky.skyExposure}set exposure(e){_.setting.sky.skyExposure=e}get roughness(){return this._shader.getDefaultColorShader().uniforms.roughness.value}set roughness(e){let t=this._shader.getDefaultColorShader();"roughness"in t.uniforms&&(t.uniforms.roughness.value=e)}}class $d extends Ba{gid=0;needUpdate=!0;autoUpdate=!1;radius=500;init(){super.init(),this.addRendererMask(Ne.Reflection),this.alwaysRender=!0,this.object3D.bound=new Ce(b.ZERO.clone(),b.MAX),Cs(this.transform.onPositionChange,()=>{this.needUpdate=!0})}onEnable(){q.instance.addRenderNode(this.transform.scene3D,this)}onDisable(){q.instance.removeRenderNode(this.transform.scene3D,this)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class eh extends At{constructor(){super();let e=new qe("ReflectionShader_shader","ReflectionShader_shader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformFloat("alphaCutoff",0)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Lt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=De.NONE:t.blendMode=De.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}}class th extends vt{constructor(){super(),this.shader=new eh,this.baseMap=_.res.whiteTexture,this.setDefine("USE_CUSTOMUNIFORM",!0),this.reflectionIndex=0}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}set reflectionIndex(e){this.shader.setUniformFloat("reflectionIndex",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Lr{center=new b;extents;max;min;size;tmpVecA=new b;tmpVecB=new b;tmpVecC=new b;tmpVecD=new b;radius=0;diffBetweenPoints=new b;owner;forward=new b(0,0,1);worldCenter;worldSize;_center=new b;constructor(e,t){this.center=e||new b(0,0,0),this.radius=t===void 0?.5:t}updateBound(){throw new Error("Method not implemented.")}containsPoint(e){var t=this.tmpVecA.subtract(e,this.center).lengthSquared,a=this.radius;return t<a*a}intersectsRay(e,t){var a=this.tmpVecA.copyFrom(e.origin).subtract(this.center),r=a.dotProduct(this.tmpVecB.copyFrom(e.direction).normalize()),i=a.dotProduct(a)-this.radius*this.radius;if(i>0&&r>0)return null;var n=r*r-i;if(n<0)return!1;var o=Math.abs(-r-Math.sqrt(n));return t&&t.copyFrom(e.direction).scaleBy(o).add(e.origin),!0}intersectsBoundingSphere(e){this.tmpVecA.subtract(e.center,this.center);var t=e.radius+this.radius;return this.tmpVecA.lengthSquared<=t*t}calculateTransform(e){this.update(e)}inFrustum(e,t){return t.containsSphere(e)}clone(){return new Lr(this.center.clone(),this.radius)}update(e){this.owner=e,this._center.add(e.transform.worldMatrix.position,this.center),this.forward=e.transform.forward}merge(e){throw new Error("BoundingSphere merge is not ready!")}setFromCenterAndSize(e,t){this.center.copy(e),this.radius=t}}class ah extends $d{init(){super.init(),this.castShadow=!1,this.castGI=!1,this.addRendererMask(Ne.Reflection),this.alwaysRender=!0,this.object3D.bound=new Lr(b.ZERO.clone(),this.radius)}debug(e,t=1){let a=new ne,r=a.addComponent(he);r.addMask(Ne.ReflectionDebug),r.geometry=new Nr(25,30,30);let i=_.setting.reflectionSetting,n=ve.getGBufferFrame(ve.reflections_GBuffer,i.width,i.height),o=new th;o.reflectionIndex=e,o.baseMap=n.getCompressGBufferTexture(),r.material=o,this.object3D.addChild(a),a.scaleX=t,a.scaleY=t,a.scaleZ=t}onEnable(){super.onEnable()}onDisable(){super.onDisable()}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class Ws extends he{skyMaterial;init(){super.init(),this.castShadow=!1,this.castGI=!0,this.addRendererMask(Ne.Sky),this.alwaysRender=!0,this.object3D.bound=new Ce(b.ZERO.clone(),b.MAX),this.geometry=new Nr(_.setting.sky.defaultFar,20,20),this.skyMaterial||=new qd}onEnable(){this._readyPipeline?(this.castNeedPass(),!this._inRenderer&&this.transform.scene3D&&(q.instance.sky=this,this._inRenderer=!0)):this.initPipeline()}onDisable(){this._inRenderer&&this.transform.scene3D&&(this._inRenderer=!1,q.instance.sky=null),super.onDisable()}nodeUpdate(e,t,a,r){super.nodeUpdate(e,t,a,r)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}set map(e){this.skyMaterial.baseMap=e,this.skyMaterial.name==null&&(this.skyMaterial.name="skyMaterial"),this.material=this.skyMaterial}get map(){return this.skyMaterial.baseMap}get exposure(){return this.skyMaterial.exposure}set exposure(e){this.skyMaterial&&(this.skyMaterial.exposure=e)}get roughness(){return this.skyMaterial.roughness}set roughness(e){this.skyMaterial&&(this.skyMaterial.roughness=e)}useSkyReflection(){let e=new ne,t=e.addComponent(ah);t.autoUpdate=!1,e.x=0,e.y=300,e.z=0,this.object3D.addChild(e)}}class bg{rotateX;rotateY;sunX;sunY;constructor(){this.reset()}reset(){return this.rotateX=this.rotateY=this.sunX=this.sunY=Number.MAX_VALUE,this}isRotateChange(e,t){return Math.abs(this.rotateX-e)>=.001||Math.abs(this.rotateY-t)>=.001}isSkyChange(e,t){return Math.abs(this.sunX-e)>=.001||Math.abs(this.sunY-t)>=.001}save(e,t,a,r){return this.sunX=e,this.sunY=t,this.rotateX=a,this.rotateY=r,this}}class gg extends Ws{_atmosphericScatteringSky;_onChange=!0;_relatedTransform;_historyData;get sunX(){return this._atmosphericScatteringSky.setting.sunX}set sunX(e){this._atmosphericScatteringSky.setting.sunX!=e&&(this._atmosphericScatteringSky.setting.sunX=e,this._onChange=!0)}get sunY(){return this._atmosphericScatteringSky.setting.sunY}set sunY(e){this._atmosphericScatteringSky.setting.sunY!=e&&(this._atmosphericScatteringSky.setting.sunY=e,this._onChange=!0)}get eyePos(){return this._atmosphericScatteringSky.setting.eyePos}set eyePos(e){this._atmosphericScatteringSky.setting.eyePos!=e&&(this._atmosphericScatteringSky.setting.eyePos=e,this._onChange=!0)}get sunRadius(){return this._atmosphericScatteringSky.setting.sunRadius}set sunRadius(e){this._atmosphericScatteringSky.setting.sunRadius!=e&&(this._atmosphericScatteringSky.setting.sunRadius=e,this._onChange=!0)}get sunRadiance(){return this._atmosphericScatteringSky.setting.sunRadiance}set sunRadiance(e){this._atmosphericScatteringSky.setting.sunRadiance!=e&&(this._atmosphericScatteringSky.setting.sunRadiance=e,this._onChange=!0)}get sunBrightness(){return this._atmosphericScatteringSky.setting.sunBrightness}set sunBrightness(e){this._atmosphericScatteringSky.setting.sunBrightness!=e&&(this._atmosphericScatteringSky.setting.sunBrightness=e,this._onChange=!0)}get displaySun(){return this._atmosphericScatteringSky.setting.displaySun}set displaySun(e){this._atmosphericScatteringSky.setting.displaySun!=e&&(this._atmosphericScatteringSky.setting.displaySun=e,this._onChange=!0)}init(){super.init(),this._historyData=new bg,this._atmosphericScatteringSky=new Kd(new Hd);let e=this.transform.view3D,t=this.transform.scene3D;this.map=this._atmosphericScatteringSky,t.envMap=this._atmosphericScatteringSky,this.onUpdate(e)}start(e){let t=this.transform.scene3D;this.map=this._atmosphericScatteringSky,t.envMap=this._atmosphericScatteringSky,super.start()}get relativeTransform(){return this._relatedTransform}set relativeTransform(e){this._relatedTransform=e,this._historyData.reset()}onUpdate(e){this._relatedTransform&&(this._relatedTransform.rotationZ=0,this._historyData.isRotateChange(this._relatedTransform.rotationX,this._relatedTransform.rotationY)?(this.sunX=(this._relatedTransform.rotationY+90)/360,this.sunY=this._relatedTransform.rotationX/180+.5):this._historyData.isSkyChange(this.sunX,this.sunY)&&(this._relatedTransform.rotationY=this.sunX*360-90,this._relatedTransform.rotationX=(this.sunY-.5)*180),this._historyData.save(this.sunX,this.sunY,this._relatedTransform.rotationX,this._relatedTransform.rotationY)),this._onChange&&(this._onChange=!1,this._atmosphericScatteringSky.apply())}destroy(e){super.destroy(e),this._atmosphericScatteringSky.destroy(),this._atmosphericScatteringSky=null,this._onChange=null}}class Pr{static panelRatio=1;static quadMaxCountForWorld=256;static quadMaxCountForView=2048;static SortOrderStartWorld=7e3;static SortOrderStartView=8e3;static SortOrderCanvasSpan=1e4}var fa=(s=>(s[s.View=0]="View",s[s.World=2]="World",s))(fa||{}),hi=(s=>(s[s.Simple=0]="Simple",s[s.Sliced=1]="Sliced",s[s.Tiled=2]="Tiled",s[s.Filled=3]="Filled",s))(hi||{}),pr=(s=>(s[s.None=0]="None",s[s.BillboardY=9]="BillboardY",s[s.BillboardXYZ=10]="BillboardXYZ",s))(pr||{});class fs extends et{type;camera;_cameraPosition;constructor(){super(),this._cameraPosition=new b}onUpdate(){this.enable&&this.transform.view3D.camera&&this.updateBillboardMatrix()}updateBillboardMatrix(){let e=this.transform.view3D.camera;this._cameraPosition.copyFrom(e.transform.back),this.type==pr.BillboardXYZ||this.type==pr.BillboardY&&(this._cameraPosition.y=0),this._cameraPosition.normalize(),this._cameraPosition.add(this.object3D.localPosition,this._cameraPosition),this.transform.lookAt(this.object3D.localPosition,this._cameraPosition,e.transform.up)}cloneTo(e){let t=e.addComponent(fs);t.type=this.type}}var ui=(s=>(s[s.None=0]="None",s[s.Box=1]="Box",s[s.Capsule=2]="Capsule",s[s.Sphere=3]="Sphere",s[s.Mesh=4]="Mesh",s))(ui||{});class gt{_center;_size;_halfSize;_shapeType=0;static v3_help_0;static helpMatrix;static helpRay;constructor(){gt.v3_help_0||=new b,gt.helpMatrix||=new R,gt.helpRay||=new ua,this._center=new b,this._size=new b,this._halfSize=new b}get shapeType(){return this._shapeType}setFromCenterAndSize(e,t){return e&&this._center.copy(e),t&&this._size.copy(t),this}get center(){return this._center}set center(e){this._center.copy(e)}get size(){return this._size}set size(e){this._size.copy(e),this._halfSize.copy(e).multiplyScalar(.5)}get halfSize(){return this._halfSize}rayPick(e,t){return null}}class bi extends gt{_pickRet;box;constructor(){super(),this._shapeType=ui.Box,this.box=new Ce(new b,new b)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.size);let r=gt.helpMatrix;r.copyFrom(t).invert();let i=gt.helpRay.copy(e);i.applyMatrix(r);let n=i.intersectBox(this.box,gt.v3_help_0);return n?(this._pickRet||(this._pickRet={intersectPoint:new b,distance:0}),this._pickRet.intersectPoint=n,this._pickRet.distance=b.distance(i.origin,gt.v3_help_0),this._pickRet):null}}class da extends et{_shape;constructor(){super(),this._shape=new bi}start(){_.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.set(this.transform.worldMatrix.index,this)}onEnable(e){Oe.bindEnablePick(e,this,null)}onDisable(e){Oe.unBindEnablePick(e,this)}get shape(){return this._shape}set shape(e){this._shape=e}rayPick(e){return this._enable?this._shape.rayPick(e,this.transform.worldMatrix):null}beforeDestroy(e){_.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.delete(this.transform.worldMatrix.index),super.beforeDestroy(e)}}class rh{loop=!0;speed=1;t=0;time=0;weight=0;currFrame=0;lastFrame=-1;nextFrame=0;clip;animation;_isEnd=!1;_currSkeletonPose;constructor(e){this.clip=e,this._currSkeletonPose=new Ii(this.clip.skeleton)}reset(){this.time=0,this.weight=0,this._isEnd=!1}get name(){return this.clip.name}get currSkeletonPose(){return this._currSkeletonPose}update(e){this.time=(this.time+e*this.speed)%this.clip.totalTime;let t=this.time/this.clip.frameRate;if(this.currFrame=Math.trunc(t),this.t=t-this.currFrame,this.currFrame<0&&(this.currFrame=this.clip.numFrame+this.currFrame),this.time>=0?this.nextFrame=(this.currFrame+1)%this.clip.numFrame:(this.nextFrame=this.currFrame-1,this.nextFrame<0&&(this.nextFrame=this.clip.numFrame+this.nextFrame),this.t=1-this.t),this._isEnd)this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1;else if(this.currFrame!=this.lastFrame){let i=this.speed<0?0:this.clip.numFrame;this.currFrame==i&&(this.loop?(this.currFrame=0,this.nextFrame=1,this.time=this.t=0):(this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1,this._isEnd=!0));var a=this.clip.getEvents();if(a)for(let n of a){var r=Math.floor(n.time/this.clip.frameRate);if(r=Math.min(r,this.clip.numFrame),r=Math.max(r,0),r==this.currFrame){n.skeletonAnimation=this.animation,this.animation.eventDispatcher.dispatchEvent(n);break}}this.lastFrame=this.currFrame}this.clip.getLerpSkeletonPose(this.currFrame,this.nextFrame,this.t,this._currSkeletonPose)}}var pg=Object.getOwnPropertyDescriptor,mg=(s,e,t,a)=>{for(var r=a>1?void 0:a?pg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let mr=class extends et{isPlaying=!0;timeScale=1;_skeleton;_clips=[];_clipStates=new Map;_mixSkeletonPose;_mixTempSkeletonPose;_currentClipState;_bindList=[];_jointMatrixIndexTableBuffer;_crossFadeState;constructor(){super()}start(){}set skeleton(s){this._skeleton=s,this._mixSkeletonPose=new Ii(this._skeleton,!0),this._mixTempSkeletonPose=new Ii(this._skeleton);const e=new Float32Array(this._mixSkeletonPose.jointMatrixIndexTable);this._jointMatrixIndexTableBuffer=new Pe(this._skeleton.numJoint*4,0,e)}get skeleton(){return this._skeleton}get finalSkeletonPose(){return this._mixSkeletonPose}get jointMatrixIndexTableBuffer(){return this._jointMatrixIndexTableBuffer}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){const a=s[t];let r=this._skeleton.getJointByName(a);e[t]=r?r.index:-1}return e}addAnimationClip(s){if(!this._clipStates.has(s.name)){this._clips.push(s);let e=new rh(s);e.animation=this,this._clipStates.set(s.name,e),this._currentClipState||this.setCurrentClipState(e)}}getAnimationClip(s){var e=this.getAnimationClipState(s);return e?e.clip:null}getAnimationClips(){return this._clips}getAnimationClipState(s){return this._clipStates.has(s)?this._clipStates.get(s):null}getAnimationClipStates(){return this._clipStates}pause(){this.isPlaying=!1}resume(){this.isPlaying=!0}play(s,e=1,t=!1){if(this._currentClipState&&this._currentClipState.name==s)return t&&this._currentClipState.reset(),!1;let a=this.getAnimationClipState(s);return a?(a.speed=e,a.reset(),this._clipStates.forEach((r,i)=>{r.weight=0}),this.setCurrentClipState(a),!0):!1}crossFade(s,e){if(e<.01){this.play(s);return}if(this._currentClipState.name==s)return;let t=this.getAnimationClipState(s);t&&(t.reset(),this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(t,this._currentClipState,e)):this._crossFadeState=new Ag(t,this._currentClipState,e),this._currentClipState=t)}setAnimIsLoop(s,e){this._clipStates.has(s)&&(this._clipStates.get(s).loop=e)}addJointBind(s,e){this._bindList.push({jointName:s,obj:e})}removeJointBind(s){for(let e=0;e<this._bindList.length;e++)if(this._bindList[e].obj==s){this._bindList.splice(e,1);break}}onUpdate(){if(!this.isPlaying)return;let s=We.delta*.001*this.timeScale;this._crossFadeState&&this._crossFadeState.update(s);var e=0,t=[];if(this._clipStates.forEach((r,i)=>{r.weight>0&&(r.update(s),e+=r.weight,t.push(r))}),t.length>0){this._mixSkeletonPose.copyFrom(t[0].currSkeletonPose);for(var a=1;a<t.length;++a){const r=t[a];this._mixTempSkeletonPose.lerp(this._mixSkeletonPose,r.currSkeletonPose,r.weight/e),this._mixSkeletonPose.copyFrom(this._mixTempSkeletonPose)}}}cloneTo(s){let e=s.addComponent(mr);e.skeleton=this.skeleton;for(var t=0;t<this._clips.length;++t)e.addAnimationClip(this._clips[t])}setCurrentClipState(s){this._currentClipState!=s&&(this._currentClipState=s,this._currentClipState.weight=1)}};mr=mg([Ot(mr,"SkeletonAnimationComponent")],mr);class Ag{inClip;outClip;currentTime;crossFadeTime;constructor(e,t,a){this.reset(e,t,a)}reset(e,t,a){this.inClip=e,this.outClip=t,this.currentTime=0,this.crossFadeTime=a}update(e){!this.inClip||!this.outClip||(this.currentTime+=e,this.inClip.weight=Math.min(Math.abs(this.currentTime%this.crossFadeTime)/this.crossFadeTime,1),this.outClip.weight=1-this.inClip.weight,Math.abs(this.currentTime)>=this.crossFadeTime&&(this.inClip.weight=1,this.outClip.weight=0,this.inClip=null,this.outClip=null))}}var Dg=Object.getOwnPropertyDescriptor,_g=(s,e,t,a)=>{for(var r=a>1?void 0:a?Dg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let er=class extends et{timeScale=1;jointMatrixIndexTableBuffer;playBlendShapeLoop=!1;inverseBindMatrices;_avatar;_rendererList;propertyCache;_clips;_clipsState;_clipsMap;_currentSkeletonClip;_currentBlendAnimClip;_skeletonTime=0;_blendShapeTime=0;_skeletonSpeed=1;_blendShapeSpeed=1;_skeletonStart=!0;_blendShapeStart=!0;root;_avatarName;_bonePos=new b;_boneScale=new b;_boneRot=new se;_crossFadeState;init(s){this.propertyCache=new Map,this._clipsMap=new Map,this._clips=[],this._clipsState=[],this._rendererList=this.object3D.getComponentsInChild(Dr);let e=this.object3D.getComponentsInChild(he);for(let t of e){let a=t;a.blendShape=t.morphData,this._rendererList.push(a)}for(const t of this._rendererList)ia.hasMask(t.rendererMask,Ne.MorphTarget)&&t.selfCloneMaterials("MORPH_TARGET_UUID")}start(){}debug(){}playAnim(s,e=0,t=1){let a=this.getAnimationClipState(s);a?(this._currentSkeletonClip&&(this._currentSkeletonClip.weight=0),this._currentSkeletonClip=a,this._currentSkeletonClip.weight=1,this._skeletonTime=e,this._skeletonSpeed=t,this._skeletonStart=!0):console.warn(`not has anim ${s}`)}crossFade(s,e){let t=this.getAnimationClipState(s);if(!t){console.warn(`not has anim ${s}`);return}if(e<.01||!this._currentSkeletonClip){this.playAnim(s);return}if(this._currentSkeletonClip&&this._currentSkeletonClip.clip.clipName===s)return;let a=t,r=this._currentSkeletonClip;this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(a,r,e)):this._crossFadeState=new Bg(a,r,e),this._currentSkeletonClip=a}playBlendShape(s,e=0,t=1){this._clipsMap.has(s)?(this._currentBlendAnimClip=this._clipsMap.get(s),this._blendShapeTime=e,this._blendShapeSpeed=t,this._blendShapeStart=!0):console.warn(`not has blendShape ${s}`)}set avatar(s){this._avatarName=s,this.inverseBindMatrices=[],this._avatar=_.res.getObj(s);let e=this.buildSkeletonPose();const t=new Float32Array(e);this.jointMatrixIndexTableBuffer=new Pe(this._avatar.count,0,t)}get numJoint(){return this._avatar.count}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){let a=this._avatar.boneMap.get(s[t]);e[t]=a?a.boneID:-1}return e}skeltonPoseObject3D={};skeltonTPoseObject3D={};buildSkeletonPose(){let s=[];for(const e of this._avatar.boneData){let t=new ne;R.getEuler(b.HELP_6,e.q,!0,"ZYX"),t.localPosition=e.t.clone(),t.localRotation=b.HELP_6.clone(),t.localScale=b.ONE,e.s.clone(),this.skeltonPoseObject3D[e.boneName]=t,this.skeltonTPoseObject3D[e.bonePath]=t.clone(),e.parentBoneName&&e.parentBoneName!=""?this.skeltonPoseObject3D[e.parentBoneName].addChild(t):(this.object3D.transform.scene3D&&this.object3D.transform.scene3D.addChild(t),this.root=t),s.push(t.transform.worldMatrix.index);let a=new R;a.copyFrom(t.transform.worldMatrix),a.invert(),this.inverseBindMatrices.push(a.rawData)}return s}set clips(s){this._clips=s;for(const e of s)this._clipsMap.set(e.clipName,e);this._clipsState=[];for(const e of s)this._clipsState.push(new ih(e));this._currentSkeletonClip||this.playAnim(s[0].clipName)}get clips(){return this._clips}get clipsState(){return this._clipsState}cloneTo(s){let e=s.addComponent(er);e.avatar=this._avatarName,e.clips=this._clips}updateTime(){const s=We.delta*.001;this._skeletonStart&&(this._skeletonTime+=s*this._skeletonSpeed*this.timeScale,this._currentSkeletonClip&&this._currentSkeletonClip.clip.loopTime&&(this._skeletonTime=this._skeletonTime%this._currentSkeletonClip.clip.stopTime)),this._blendShapeStart&&(this._blendShapeTime+=s*this._blendShapeSpeed,this._currentBlendAnimClip&&(this._currentBlendAnimClip.loopTime&&this.playBlendShapeLoop?this._blendShapeTime=this._blendShapeTime%this._currentBlendAnimClip.stopTime:this._blendShapeTime=Math.min(this._blendShapeTime,this._currentBlendAnimClip.stopTime)-1e-4)),this._crossFadeState&&this._crossFadeState.update(s)}onUpdate(s){this.updateTime();let e=[];for(let t of this._clipsState)t.weight>0&&e.push(t);e.length>0?this.updateSkeletonAnimMix(e):this.updateSkeletonAnim(),this.updateMorphAnim()}updateSkeletonAnim(){if(this._currentSkeletonClip){let s=this._avatar.boneData,e=0,t=s.length;for(e=0;e<t;e++){const a=s[e];let r=this.skeltonPoseObject3D[a.boneName];if(this._currentSkeletonClip.clip.useSkeletonPos){let n=this.getPosition(a.bonePath,this._skeletonTime);r.transform.localPosition=n}let i=this.getRotation(a.bonePath,this._skeletonTime);if(r.transform.localRotQuat=i,this._currentSkeletonClip.clip.useSkeletonScale){let n=this.getScale(a.bonePath,this._skeletonTime);r.transform.localScale=n}}}}updateMorphAnim(){if(this._currentBlendAnimClip&&this._currentBlendAnimClip.floatCurves&&this._currentBlendAnimClip.floatCurves.size>0&&this._rendererList)for(const s of this._currentBlendAnimClip.floatCurves){let e=s[0],a=s[1].propertys,i=this._currentBlendAnimClip.floatCurves.get(e).getValue(this._blendShapeTime)/100;this.updateBlendShape(a,e,i)}}updateBlendShape(s,e,t){for(const a of this._rendererList)if(a.blendShape){let r=this.propertyCache.get(a);if(r&&e in r)r[e](t);else{r=a;for(const i of s){if(!r[i]){r=null;break}r=r[i]}if(!r||r==a)continue;this.propertyCache.get(a)||this.propertyCache.set(a,{}),this.propertyCache.get(a)[e]=r,r(t)}}}updateSkeletonAnimMix(s){let e=0;for(let t of s)e+=t.weight;if(s.length>0){let t=this._avatar.boneData,a=t.length;for(let r=0;r<a;r++){const i=t[r];let n=this.skeltonPoseObject3D[i.boneName];if(s[0].clip.useSkeletonPos){this._bonePos.copyFrom(this.getPosition(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonPos){let c=this.getPosition(i.bonePath,this._skeletonTime,l.clip);b.HELP_0.lerp(this._bonePos,c,l.weight/e),this._bonePos.copyFrom(b.HELP_0)}}n.transform.localPosition=this._bonePos}this._boneRot.copyFrom(this.getRotation(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];let c=this.getRotation(i.bonePath,this._skeletonTime,l.clip);se.HELP_2.slerp(this._boneRot,c,l.weight/e),this._boneRot.copyFrom(se.HELP_2)}if(n.transform.localRotQuat=this._boneRot,s[0].clip.useSkeletonScale){this._boneScale.copyFrom(this.getScale(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonScale){let c=this.getScale(i.bonePath,this._skeletonTime,l.clip);b.HELP_0.lerp(this._boneScale,c,l.weight/e),this._boneScale.copyFrom(b.HELP_0)}}n.transform.localScale=this._boneScale}}}}getPosition(s,e,t=this._currentSkeletonClip.clip){return t.positionCurves.has(s)?t.positionCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localPosition}getRotation(s,e,t=this._currentSkeletonClip.clip){if(t.rotationCurves.has(s)){let a=t.rotationCurves.get(s).getValue(e);return se.HELP_0.set(a.x,a.y,a.z,a.w),se.HELP_0}return this.skeltonTPoseObject3D[s].localQuaternion}getScale(s,e,t=this._currentSkeletonClip.clip){return t.scaleCurves.has(s)?t.scaleCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localScale}getAnimationClipState(s){for(let e of this._clipsState)if(e.clip.clipName===s)return e;return null}cloneMorphRenderers(){let s={};for(const e of this._rendererList)for(const t in e.geometry.morphTargetDictionary){let a=s[t]||[];a.push(e),s[t]=a}return s}};er=_g([Ot(er,"AnimatorComponent")],er);class ih{clip;weight=0;get totalTime(){return this.clip.stopTime-this.clip.startTime}constructor(e){this.clip=e}}class Bg{inClip;outClip;currentTime;crossFadeTime;constructor(e,t,a){this.reset(e,t,a)}reset(e,t,a){this.inClip=e,this.outClip=t,this.currentTime=0,this.crossFadeTime=a}update(e){!this.inClip||!this.outClip||(this.currentTime+=e,this.inClip.weight=Math.min(Math.abs(this.currentTime%this.crossFadeTime)/this.crossFadeTime,1),this.outClip.weight=1-this.inClip.weight,Math.abs(this.currentTime)>=this.crossFadeTime&&(this.inClip.weight=1,this.outClip.weight=0,this.inClip=null,this.outClip=null))}}class Lo{index;time;timeEnd;coeff=[]}var Ar=(s=>(s[s.PingPong=0]="PingPong",s[s.Repeat=1]="Repeat",s[s.Clamp=2]="Clamp",s))(Ar||{});class Js{serializedVersion="2";time;value;inSlope=0;outSlope=0;tangentMode=0;weightedMode=0;inWeight;outWeight;constructor(e=0,t=0){this.time=e,this.value=t}unSerialized(e){this.serializedVersion=e.serializedVersion,this.time=e.time,this.value=e.value,this.tangentMode=e.tangentMode,this.inSlope=e.inSlope=="Infinity"?NaN:e.inSlope,this.outSlope=e.outSlope=="Infinity"?NaN:e.outSlope}unSerialized2(e){this.serializedVersion=e.serializedVersion,this.time=e.time,this.value=e.value,this.tangentMode=e.tangentMode,this.inSlope=e.inTangent=="Infinity"?NaN:e.inTangent,this.outSlope=e.outTangent=="Infinity"?NaN:e.outTangent}}class Li{_totalTime=1;_cache=new Lo;_cacheOut={lhsIndex:0,rhsIndex:0};_InvalidateCache=!1;curve=[];serializedVersion;preWarpMode;postWarpMode;rotationOrder;get cacheOut(){return this._cacheOut}constructor(e,t=Ar.Repeat,a=Ar.Repeat){if(e)for(let r=0;r<e.length;r++){const i=e[r];this.addKeyFrame(i)}this.preWarpMode=t,this.postWarpMode=a}get totalTime(){return this._totalTime}get first(){return this.curve[0]}get last(){return this.curve[this.curve.length-1]}addKeyFrame(e){this.curve.indexOf(e)==-1&&this.curve.push(e),this.calcTotalTime()}removeKeyFrame(e){let t=this.curve.indexOf(e);t!=-1&&this.curve.splice(t,1),this.calcTotalTime()}calculateCacheData(e,t,a,r=0){let i=this.curve,n=i[t],o=i[a];e.index=t,e.time=n.time+r,e.timeEnd=o.time+r,e.index=t;let l,c,f,d,h,u,m;l=o.time-n.time,l=Math.max(l,1e-4),f=o.value-n.value,c=1/(l*l),d=n.outSlope,h=o.inSlope,u=d*l,m=h*l,e.coeff[0]=(u+m-f-f)*c/l,e.coeff[1]=(f+f+f-u-u-m)*c,e.coeff[2]=d,e.coeff[3]=n.value,this.setupStepped(e.coeff,n,o)}getValue(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),this.calculateCacheData(this._cache,this._cacheOut.lhsIndex,this._cacheOut.rhsIndex,0),this.evaluateCache(this._cache,e)}getCurveFramesExtent(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),{lhsIndex:this._cacheOut.lhsIndex,rhsIndex:this._cacheOut.rhsIndex,time:e}}getKeyCount(){return this.curve.length}getKey(e){return this.curve[e]}unSerialized(e){this.preWarpMode=e.m_PreInfinity,this.postWarpMode=e.m_PostInfinity,this.rotationOrder=e.m_RotationOrder;let t=e.m_Curve.length;for(let a=0;a<t;a++)this.curve[a]=new Js,this.curve[a].unSerialized(e.m_Curve[a.toString()]);return this.calcTotalTime(),this}unSerialized2(e){this.preWarpMode=e.preWrapMode,this.postWarpMode=e.postWrapMode;let t=e.keyFrames||e.keys,a=t.length;for(let r=0;r<a;r++)this.curve[r]=new Js,this.curve[r].unSerialized2(t[r.toString()]);return this.calcTotalTime(),this}wrapTime(e){let t=this.curve,a=t[0].time,r=t[t.length-1].time;return e<a?this.preWarpMode==Ar.Clamp?e=a:this.preWarpMode==Ar.PingPong?e=In(e,a,r):e=Rn(e,a,r):e>r&&(this.postWarpMode==Ar.Clamp?e=r:this.postWarpMode==Ar.PingPong?e=In(e,a,r):e=Rn(e,a,r)),e}evaluateCache(e,t){let a=t-e.time;return a*(a*(a*e.coeff[0]+e.coeff[1])+e.coeff[2])+e.coeff[3]}findCurve(e,t){let a=this.curve;for(let r=1;r<a.length;r++){let i=a[r-1],n=a[r];i.time<=e&&n.time>e&&(t.lhsIndex=r-1,t.rhsIndex=r)}}setupStepped(e,t,a){(isNaN(t.outSlope)||isNaN(a.inSlope))&&(e[0]=0,e[1]=0,e[2]=0,e[3]=t.value)}invalidateCache(){this._InvalidateCache=!0}calcTotalTime(){let e=0;for(let t of this.curve)t?e=Math.max(e,t.time):console.error(t);this._totalTime=e}static scaleCurveValue(e,t){if(!e._InvalidateCache)for(let a=0;a<e.curve.length;a++){let r=e.curve[a];r.value*=t,r.inSlope*=t,r.outSlope*=t}e.invalidateCache()}}class sh extends Li{attribute="";propertyList;path;constructor(){super()}unSerialized(e){let{attribute:t,path:a}=e;return this.attribute=t,this.path=a,this.propertyList=t.split("."),super.unSerialized(e.curve),this}}class nh{curve={}}var gi=(s=>(s[s.Default=0]="Default",s[s.Clamp=1]="Clamp",s[s.Once=1]="Once",s[s.Loop=2]="Loop",s[s.PingPong=4]="PingPong",s[s.ClampForever=8]="ClampForever",s))(gi||{});class vg{name;objAnimClip;totalTime=0;time=0;_stopTime=0;_loopTime;_wrapMode;_sampleRate;get wrapMode(){return this._wrapMode||(this._wrapMode=0),this._wrapMode}set wrapMode(e){this._wrapMode=e}parse(e){this.objAnimClip={};let t=e.AnimationClip,{m_Name:a,m_AnimationClipSettings:r,m_WrapMode:i,m_SampleRate:n}=t;this.name=a,this._wrapMode=i,this._sampleRate=n,this._loopTime=r.m_LoopTime;for(const o in t.m_EditorCurves)if(Object.prototype.hasOwnProperty.call(t.m_EditorCurves,o)){const l=t.m_EditorCurves[o];let c=l.attribute,f=new sh;f.unSerialized(l),this.totalTime=Math.max(this.totalTime,f.totalTime);let d=this.objAnimClip[l.path];d||(d=new nh,this.objAnimClip[l.path]=d),d.curve[c]=f}}}class oh{transform;quaternion;materialColor}class Gi{static Property={"m_LocalPosition.x":"localPosition.x","m_LocalPosition.y":"localPosition.y","m_LocalPosition.z":"localPosition.z","m_LocalRotation.x":"localQuaternion.x","m_LocalRotation.y":"localQuaternion.y","m_LocalRotation.z":"localQuaternion.z","m_LocalRotation.w":"localQuaternion.w","localEulerAnglesRaw.x":"localRotation.x","localEulerAnglesRaw.y":"localRotation.y","localEulerAnglesRaw.z":"localRotation.z","m_LocalEulerAngles.x":"localRotation.x","m_LocalEulerAngles.y":"localRotation.y","m_LocalEulerAngles.z":"localRotation.z","m_LocalScale.x":"localScale.x","m_LocalScale.y":"localScale.y","m_LocalScale.z":"localScale.z","m_Color.r":"materialColor.r","m_Color.g":"materialColor.g","m_Color.b":"materialColor.b","m_Color.a":"materialColor.a","material._Color.r":"materialColor.r","material._Color.g":"materialColor.g","material._Color.b":"materialColor.b","material._Color.a":"materialColor.a","material._UnlitColor.r":"materialColor.r","material._UnlitColor.g":"materialColor.g","material._UnlitColor.b":"materialColor.b","material._UnlitColor.a":"materialColor.a","field of view":"camera3D.fov",m_IsActive:"active",m_Sprite:"sprite",m_FlipX:"flipX",m_FlipY:"flipY"};static Scale={"m_LocalPosition.x":1,"m_LocalPosition.y":1,"m_LocalPosition.z":-1,"localEulerAnglesRaw.x":-1,"localEulerAnglesRaw.y":1,"localEulerAnglesRaw.z":1,"m_LocalEulerAngles.x":-1,"m_LocalEulerAngles.y":1,"m_LocalEulerAngles.z":1,"m_LocalRotation.x":1,"m_LocalRotation.y":1,"m_LocalRotation.z":-1,"m_LocalRotation.w":-1,"field of view":1,m_IsActive:1,m_Sprite:1};static updatePropertyTag(e,t){e.quaternion||=this.tag_quaternion[t],e.transform||=this.tag_transform[t],e.materialColor||=this.tag_materialColor[t]}static tag_quaternion={"m_LocalRotation.x":!0,"m_LocalRotation.y":!0,"m_LocalRotation.z":!0,"m_LocalRotation.w":!0};static tag_materialColor={"material._Color.r":!0,"material._Color.g":!0,"material._Color.b":!0,"material._Color.a":!0,"material._UnlitColor.r":!0,"material._UnlitColor.g":!0,"material._UnlitColor.b":!0,"material._UnlitColor.a":!0};static tag_transform={"m_LocalPosition.x":!0,"m_LocalPosition.y":!0,"m_LocalPosition.z":!0,"m_LocalRotation.x":!0,"m_LocalRotation.y":!0,"m_LocalRotation.z":!0,"m_LocalRotation.w":!0,"localEulerAnglesRaw.x":!0,"localEulerAnglesRaw.y":!0,"localEulerAnglesRaw.z":!0,"m_LocalEulerAngles.x":!0,"m_LocalEulerAngles.y":!0,"m_LocalEulerAngles.z":!0,"m_LocalScale.x":!0,"m_LocalScale.y":!0,"m_LocalScale.z":!0}}class Yr{static Complete=0;static Seek=1;_rootObject3D;_animation;_propertyCache;_currentClip;_frame=0;_time=0;_isPlaying=!0;speed=1;_propertyTagDic;constructor(e){this._rootObject3D=e.object3D,this._animation=e,this._propertyTagDic=new Map,this.reset()}reset(){this._propertyCache={},this._propertyTagDic.clear()}get time(){return this._time}get currentClip(){return this._currentClip}play(e,t=!0){this._isPlaying=!0,t&&(this._time=0),e!=this._currentClip&&e&&this.parseAnimClip(e),this._currentClip=e,this.validProperty()}parseAnimClip(e){this.reset();for(const t in e.objAnimClip){let a=e.objAnimClip[t],r=this._rootObject3D,i={};if(t==""?r=this._rootObject3D:r=this._rootObject3D.getObjectByName(t),!r)continue;let n=new oh;this._propertyTagDic.set(r,n);let o=a.curve;for(const l in o){Gi.updatePropertyTag(n,l);let c=this._propertyCache[t]||={},f=Gi.Property[l].split("."),d=f[0];if(f.length>1){let h=i[d];h||(h=i[d]=r[d]),c[l]={value:h,property:f[1]}}else c[l]={value:r,property:f[0]}}}return this}stop(){return this._isPlaying=!1,this}toggle(){return this._isPlaying=!this._isPlaying,this}get isPlaying(){return this._isPlaying}update(e,t){if(e=e*.001,t=t*.001,!this._currentClip||this._frame==e||!this._isPlaying)return;this._frame=e;let a=this._time;this._time=this.calcTime(a+t*this.speed),this.validProperty(),this._currentClip.wrapMode!=gi.Loop&&this._currentClip.wrapMode!=gi.Default&&(this.speed>0?this._time>=this._currentClip.totalTime:this._time<=0)&&(this._isPlaying=!1,this._animation.statusCall(Yr.Complete,a,this._time)),this._animation.statusCall(Yr.Seek,a,this._time)}seek(e){return this._time=this.calcTime(e),this._rootObject3D&&this.validProperty(),this}calcTime(e){return this._currentClip.wrapMode==gi.Loop||this._currentClip.wrapMode==gi.Default?e=Pn(e,this._currentClip.totalTime):e=Be(e,0,this._currentClip.totalTime),e}validProperty(){for(const e in this._currentClip.objAnimClip){let a=this._currentClip.objAnimClip[e].curve;for(const r in a){const i=a[r];let n=this._propertyCache[e][r],o=i.getValue(this._time);r in Gi.Scale&&(o*=Gi.Scale[r]),n.value[n.property]=o}}this._propertyTagDic.forEach((e,t)=>{this.applyProperty(e,t)})}applyProperty(e,t){e.quaternion&&R.getEuler(t.transform.localRotation,t.transform.localRotQuat,!0,"ZYX"),e.transform&&(t.transform.localPosition=t.transform.localPosition,t.transform.localRotation=t.transform.localRotation,t.transform.localScale=t.transform.localScale);let a=t;e.materialColor&&a.notifyMaterialColorChange(0,"baseColor")}}class xg{clipName;data;time}class zi extends pt{static SEEK="SEEK";static COMPLETE="COMPLETE";animation;frame;constructor(e,t){super(t),this.animation=e}}class ul extends et{_animator;_clips=[];defaultClip;autoPlay;_seekEvent;_completeEvent;_keyFrameList;constructor(){super(),this._seekEvent=new zi(this,zi.SEEK),this._completeEvent=new zi(this,zi.COMPLETE),this._keyFrameList={}}registerEventKeyFrame(e){let t=this._keyFrameList[e.clipName];t==null&&(this._keyFrameList[e.clipName]=t=[]),t.push(e)}init(){this._animator=new Yr(this)}onUpdate(){this.enable&&this._animator.update(We.time,We.delta)}appendClip(e){this._clips.push(e),this.play(e.name)}statusCall(e,t,a){if(e==Yr.Complete)this.eventDispatcher.dispatchEvent(this._completeEvent);else if(e==Yr.Seek&&t!=a){let r=this._keyFrameList[this.currentClip.name];if(r)for(let i of r)i.time>t&&i.time<=a&&(this._seekEvent.data=this._seekEvent.frame=i,this.eventDispatcher.dispatchEvent(this._seekEvent))}}set speed(e){this._animator.speed=e}get speed(){return this._animator.speed}stop(){this._animator.stop()}toggle(){this._animator.toggle()}getClip(e){let t;for(let a of this._clips)if(a.name==e){t=a;break}return t}get currentClip(){return this._animator.currentClip}get time(){return this._animator.time}seek(e){this._animator.seek(e)}play(e,t=!0){let a=this.getClip(e);return a?(this._animator.play(a,t),a):null}start(){this.autoPlay&&this.play(this.defaultClip)}copyComponent(e){this.autoPlay=e.autoPlay,this.defaultClip=e.defaultClip;let t=e._clips;for(let a=0,r=t.length;a<r;a++)this.appendClip(t[a]);return this}cloneTo(e){e.addComponent(ul).copyComponent(this)}}var Ug=Object.getOwnPropertyDescriptor,yg=(s,e,t,a)=>{for(var r=a>1?void 0:a?Ug(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Dr=class extends he{skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Ne.SkinnedMesh)}get geometry(){return this._geometry}set geometry(s){this.skinJointsName=s.skinNames;let e=[];for(let t=0;t<s.bindPose.length;t++)e.push(new Float32Array(s.bindPose[t].rawData.slice(0,16)));this.skinInverseBindMatrices=e,super.geometry=s}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(er),!this.skeletonAnimation){let s=this.object3D.parentObject.parentObject.getComponentsInChild(er);s.length>0&&(this.skeletonAnimation=s[0]);let e=this.object3D;for(;!this.skeletonAnimation&&e;)this.skeletonAnimation=e.getComponentFromParent(er),e.parent&&(e=e.parent.object3D)}}get blendShape(){return this.morphData}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(s){if(this.mSkeletonAnimation=s,!!s&&!this.mJointIndexTableBuffer){let e=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new Pe(e.length,0,new Float32Array(e)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(s){this.mInverseBindMatrixData=s;var e=new Float32Array(s.length*16);for(let t=0;t<s.length;t++){let a=t*16,r=s[t];e.set(r,a)}this.mInverseBindMatrixBuffer=new Pe(e.byteLength,0,e),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(s){let e=s.addComponent(Dr),t=[];for(const a of this.materials)t.push(a.clone());e.materials=t,e.geometry=this.geometry,e.castShadow=this.castShadow,e.castGI=this.castGI,e.receiveShadow=this.receiveShadow,e.rendererMask=this.rendererMask,e.skinJointsName=this.skinJointsName,e.skinInverseBindMatrices=this.skinInverseBindMatrices,e.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(s,e,t,a){for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++){const l=n[o];!l.pipeline&&this.mSkeletonAnimation&&(l.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),l.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),l.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(s,e,t,a)}};Dr=yg([Ot(Dr,"SkinnedMeshRenderer2")],Dr);class Cg extends et{_targetRenderers={};_vec3=new b;_matrix4=new R;_quaternion=new se;init(e){let t=this.fetchMorphRenderers(this.object3D,Dr),a=this.fetchMorphRenderers(this.object3D,he);t.push(...a);for(const r of t){ia.hasMask(r.rendererMask,Ne.MorphTarget)&&r.selfCloneMaterials("MORPH_TARGET_UUID");for(const n in r.geometry.morphTargetDictionary){let o=this._targetRenderers[n]||[];o.push(r),this._targetRenderers[n]=o}}}getMorphRenderersByKey(e){return this._targetRenderers[e]}cloneMorphRenderers(){let e={};for(let t in this._targetRenderers)e[t]=this._targetRenderers[t];return e}applyBlendShape(e,t,a=1){if(!e){console.warn("blendShape is null");return}this._vec3.setFromArray(e.transform.transform[3]),this._vec3.multiplyScalar(a),this.object3D.transform.localPosition=this._vec3,this._vec3.setFromArray(e.transform.transform[2]),this._matrix4.copyColFrom(2,this._vec3),this._vec3.setFromArray(e.transform.transform[1]),this._matrix4.copyColFrom(1,this._vec3),this._vec3.setFromArray(e.transform.transform[0]),this._matrix4.copyColFrom(0,this._vec3),this._matrix4.transpose(),this._quaternion.fromMatrix(this._matrix4),this.object3D.localQuaternion=this._quaternion;for(let r in t){let i=this._targetRenderers[r],n=t[r],o=e.texture[n];this.applyMorphTargetInfluence(r,o,i)}}applyMorphTargetInfluence(e,t,a){for(let r of a)r.setMorphInfluence(e,t)}fetchMorphRenderers(e,t){let a=e.getComponentsInChild(t),r=[];for(let i of a)i.hasMask(Ne.MorphTarget)&&r.push(i);return r}}class Sg{texture;transform}var lh=(s=>(s.mouthRollLower="mouthRollLower",s.browOuterUp_L="browOuterUpLeft",s.mouthSmile_L="mouthSmileLeft",s.jawRight="jawRight",s.eyeLookOut_L="eyeLookOutLeft",s.mouthFunnel="mouthFunnel",s.mouthUpperUp_R="mouthUpperUpRight",s.browDown_L="browDownLeft",s.jawLeft="jawLeft",s.mouthLowerDown_L="mouthLowerDownLeft",s.noseSneer_R="noseSneerRight",s.jawForward="jawForward",s.mouthLowerDown_R="mouthLowerDownRight",s.browInnerUp="browInnerUp",s.mouthRollUpper="mouthRollUpper",s.mouthStretch_R="mouthStretchRight",s.mouthPucker="mouthPucker",s.eyeBlink_L="eyeBlinkLeft",s.mouthUpperUp_L="mouthUpperUpLeft",s.mouthShrugUpper="mouthShrugUpper",s.eyeLookIn_R="eyeLookInRight",s.noseSneer_L="noseSneerLeft",s.mouthFrown_L="mouthFrownLeft",s.cheekSquint_L="cheekSquintLeft",s.eyeLookDown_L="eyeLookDownLeft",s.mouthDimple_L="mouthDimpleLeft",s.mouthFrown_R="mouthFrownRight",s.eyeLookIn_L="eyeLookInLeft",s.eyeLookOut_R="eyeLookOutRight",s.mouthLeft="mouthLeft",s.mouthStretch_L="mouthStretchLeft",s.mouthPress_L="mouthPressLeft",s.mouthDimple_R="mouthDimpleRight",s.eyeWide_R="eyeWideRight",s.browDown_R="browDownRight",s.eyeLookUp_R="eyeLookUpRight",s.eyeBlink_R="eyeBlinkRight",s.cheekSquint_R="cheekSquintRight",s.mouthRight="mouthDimpleRight",s.eyeLookDown_R="eyeLookDownRight",s.eyeLookUp_L="eyeLookUpLeft",s.eyeSquint_L="eyeSquintLeft",s.jawOpen="jawOpen",s.browOuterUp_R="browOuterUpRight",s.mouthClose="mouthClose",s.mouthShrugLower="mouthShrugLower",s.eyeWide_L="eyeWideLeft",s.tongueOut="tongueOut",s.eyeSquint_R="eyeSquintRight",s.cheekPuff="cheekPuff",s.mouthPress_R="mouthPressRight",s.mouthSmile_R="mouthSmileRight",s))(lh||{});class Fg{joints;constructor(e=[]){this.joints=e}get numJoint(){return this.joints.length}addJoint(e){e.index=this.joints.push(e)-1}getJointName(e){return this.joints[e].name}getJointParentIndex(e){let t=this.joints[e];return t.parent?t.parent.index:-1}getJointByName(e){for(let t of this.joints)if(t.name==e)return t;return null}}class kg{_computePipeline;_computeBindGroup;constructor(e,t){let a=I.device;this._computePipeline=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:e}),entryPoint:"CsMain"}}),this._computeBindGroup=a.createBindGroup({layout:this._computePipeline.getBindGroupLayout(0),entries:t})}compute(e,t,a,r){let i=e.beginComputePass();return i.setPipeline(this._computePipeline),i.setBindGroup(0,this._computeBindGroup),i.dispatchWorkgroups(t,a,r),i.end(),this}}class Eg extends cr{numJoint;numState;time;weight;argumentsData;_isDirty=!1;_argumentsBuffer;_argumentsBufferEntries;constructor(){super(),this.allocationMemorySet([{name:"numJoint",data:[0]},{name:"numState",data:[0]},{name:"retain1",data:[0]},{name:"retain2",data:[0]},{name:"time",data:[0,0]},{name:"weight",data:[0,0]}]),this.generateGPUBuffer()}getGPUBuffer(){return this._argumentsBuffer}getGPUBindGroupEntry(){return this._argumentsBufferEntries}updateGPUBuffer(){return this._isDirty&&(this._isDirty=!1,I.device.queue.writeBuffer(this._argumentsBuffer,0,this.shareDataBuffer)),this}allocationMemorySet(e){this.argumentsData={};let t=0;for(let a=0;a<e.length;a++){const r=e[a];t+=r.data.length}this.allocation(t*4);for(let a=0;a<e.length;a++){const r=e[a],i=r.name;this.argumentsData[i]=this.allocation_node(r.data.length*4)}}generateGPUBuffer(){let e=I.device;this._argumentsBuffer=e.createBuffer({size:this.shareDataBuffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,mappedAtCreation:!1}),this._argumentsBufferEntries={binding:0,resource:{buffer:this._argumentsBuffer,offset:0,size:this.shareDataBuffer.byteLength}}}}class wg extends cr{numJoint;numFrame;retain0;retain1;argumentsData;_isDirty=!1;_argumentsBuffer;_argumentsBufferEntries;constructor(){super(),this.allocationMemorySet([{name:"numJoint",data:[0]},{name:"numFrame",data:[0]},{name:"retain0",data:[0]},{name:"retain1",data:[0]}]),this.generateGPUBuffer()}getGPUBuffer(){return this._argumentsBuffer}getGPUBindGroupEntry(){return this._argumentsBufferEntries}updateGPUBuffer(){this._isDirty&&(this._isDirty=!1,I.device.queue.writeBuffer(this._argumentsBuffer,0,this.shareDataBuffer))}allocationMemorySet(e){this.argumentsData={};let t=0;for(let r=0;r<e.length;r++){const i=e[r];t+=i.data.length}this.allocation(t*4);let a=this;for(let r=0;r<e.length;r++){const i=e[r],n=i.name;this.argumentsData[n]=this.allocation_node(i.data.length*4),a[n]=this.argumentsData[n]}}generateGPUBuffer(){let e=I.device;this._argumentsBuffer=e.createBuffer({size:this.shareDataBuffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,mappedAtCreation:!1}),this._argumentsBufferEntries={binding:0,resource:{buffer:this._argumentsBuffer,offset:0,size:this.shareDataBuffer.byteLength}}}}class Ig{_autoUpdate=!0;_target;_lookAtObject;_origin=new b(0,0,0);_speed=300;constructor(e=null,t=null){this._target=e,this._lookAtObject=t}get target(){return this._target}set target(e){this._target!=e&&(this._target=e)}get lookAtObject(){return this._lookAtObject}set lookAtObject(e){this._lookAtObject!=e&&(this._lookAtObject=e)}get speed(){return this._speed}set speed(e){this._speed=e}update(){}}class Rg extends et{focus;distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(ti),!this._camera){console.error("FirstPersonCameraController need camera");return}if(!this.focus){console.error("FirstPersonCameraController need target");return}_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){_.inputSystem.addEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){let t=this.transform.localRotation;t.y+=e.movementX*.01,t.x+=e.movementY*.01,this.transform.localRotation=t}mouseWheel(e){this.distance+=_.inputSystem.wheelDelta*.1}onUpdate(){let e=new b;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var tt=(s=>(s[s.Key_BackSpace=8]="Key_BackSpace",s[s.Key_Tab=9]="Key_Tab",s[s.Key_Clear=12]="Key_Clear",s[s.Key_Enter=13]="Key_Enter",s[s.Key_Shift_L=16]="Key_Shift_L",s[s.Key_Control_L=17]="Key_Control_L",s[s.Key_Alt_L=18]="Key_Alt_L",s[s.Key_Pause=19]="Key_Pause",s[s.Key_CapsLock=20]="Key_CapsLock",s[s.Key_Escape=21]="Key_Escape",s[s.Key_Esc=27]="Key_Esc",s[s.Key_Space=32]="Key_Space",s[s.Key_Prior=33]="Key_Prior",s[s.Key_Next=34]="Key_Next",s[s.Key_End=35]="Key_End",s[s.Key_Home=36]="Key_Home",s[s.Key_Left=37]="Key_Left",s[s.Key_Up=38]="Key_Up",s[s.Key_Right=39]="Key_Right",s[s.Key_Down=40]="Key_Down",s[s.Key_Select=41]="Key_Select",s[s.Key_Print=42]="Key_Print",s[s.Key_Execute=43]="Key_Execute",s[s.Key_Insert=45]="Key_Insert",s[s.Key_Delete=46]="Key_Delete",s[s.Key_Help=47]="Key_Help",s[s.Key_0=48]="Key_0",s[s.Key_1=49]="Key_1",s[s.Key_2=50]="Key_2",s[s.Key_3=51]="Key_3",s[s.Key_4=52]="Key_4",s[s.Key_5=53]="Key_5",s[s.Key_6=54]="Key_6",s[s.Key_7=55]="Key_7",s[s.Key_8=56]="Key_8",s[s.Key_9=57]="Key_9",s[s.Key_A=65]="Key_A",s[s.Key_B=66]="Key_B",s[s.Key_C=67]="Key_C",s[s.Key_D=68]="Key_D",s[s.Key_E=69]="Key_E",s[s.Key_F=70]="Key_F",s[s.Key_G=71]="Key_G",s[s.Key_H=72]="Key_H",s[s.Key_I=73]="Key_I",s[s.Key_J=74]="Key_J",s[s.Key_K=75]="Key_K",s[s.Key_L=76]="Key_L",s[s.Key_M=77]="Key_M",s[s.Key_N=78]="Key_N",s[s.Key_O=79]="Key_O",s[s.Key_P=80]="Key_P",s[s.Key_Q=81]="Key_Q",s[s.Key_R=82]="Key_R",s[s.Key_S=83]="Key_S",s[s.Key_T=84]="Key_T",s[s.Key_U=85]="Key_U",s[s.Key_V=86]="Key_V",s[s.Key_W=87]="Key_W",s[s.Key_X=88]="Key_X",s[s.Key_Y=89]="Key_Y",s[s.Key_Z=90]="Key_Z",s[s.Key_KP_0=96]="Key_KP_0",s[s.Key_KP_1=97]="Key_KP_1",s[s.Key_KP_2=98]="Key_KP_2",s[s.Key_KP_3=99]="Key_KP_3",s[s.Key_KP_4=100]="Key_KP_4",s[s.Key_KP_5=101]="Key_KP_5",s[s.Key_KP_6=102]="Key_KP_6",s[s.Key_KP_7=103]="Key_KP_7",s[s.Key_KP_8=104]="Key_KP_8",s[s.Key_KP_9=105]="Key_KP_9",s[s.Key_Multiply=106]="Key_Multiply",s[s.Key_Add=107]="Key_Add",s[s.Key_Separator=108]="Key_Separator",s[s.Key_Subtract=109]="Key_Subtract",s[s.Key_Decimal=110]="Key_Decimal",s[s.Key_Divide=111]="Key_Divide",s[s.Key_F1=112]="Key_F1",s[s.Key_F2=113]="Key_F2",s[s.Key_F3=114]="Key_F3",s[s.Key_F4=115]="Key_F4",s[s.Key_F5=116]="Key_F5",s[s.Key_F6=117]="Key_F6",s[s.Key_F7=118]="Key_F7",s[s.Key_F8=119]="Key_F8",s[s.Key_F9=120]="Key_F9",s[s.Key_F10=121]="Key_F10",s[s.Key_F11=122]="Key_F11",s[s.Key_F12=123]="Key_F12",s[s.Key_F13=124]="Key_F13",s[s.Key_F14=125]="Key_F14",s[s.Key_F15=126]="Key_F15",s[s.Key_F16=127]="Key_F16",s[s.Key_F17=128]="Key_F17",s[s.Key_F18=129]="Key_F18",s[s.Key_F19=130]="Key_F19",s[s.Key_F20=131]="Key_F20",s[s.Key_F21=132]="Key_F21",s[s.Key_F22=133]="Key_F22",s[s.Key_F23=134]="Key_F23",s[s.Key_F24=135]="Key_F24",s[s.Key_Num_Lock=136]="Key_Num_Lock",s[s.Key_Scroll_Lock=137]="Key_Scroll_Lock",s))(tt||{});class Qg extends et{moveSpeed=2;targetPos=new b(0,0,10);lookAtPos=new b(0,0,0);config={shiftMoveScale:20};_moveScale=1;_dir;_mouseFactory=25;_factory=1.5;_mouseDown=!1;_lastPos;_keyState;constructor(){super(),this._lastPos=new b,this._keyState={front:!1,back:!1,left:!1,right:!1,q:!1,e:!1},this.setCamera(new b(0,0,100),new b(0,0,0))}setCamera(e,t){this.targetPos.copyFrom(e),this.lookAtPos.copyFrom(t),this.Reset()}start(){_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.mouseDown,this),_.inputSystem.addEventListener(Ma.KEY_UP,this.keyUp,this),_.inputSystem.addEventListener(Ma.KEY_DOWN,this.keyDown,this),this.transform.lookAt(this.targetPos,this.lookAtPos)}mouseWheel(e){}keyUp(e){switch(e.keyCode){case tt.Key_W:this._keyState.front=!1;break;case tt.Key_S:this._keyState.back=!1;break;case tt.Key_A:this._keyState.left=!1;break;case tt.Key_D:this._keyState.right=!1;break;case tt.Key_Shift_L:this._moveScale=1;break;case tt.Key_Q:this._keyState.q=!1;break;case tt.Key_E:this._keyState.e=!1;break;case tt.Key_F:this.transform.lookAt(this.targetPos,this.lookAtPos);break}}keyDown(e){switch(e.keyCode){case tt.Key_W:this._keyState.front=!0;break;case tt.Key_S:this._keyState.back=!0;break;case tt.Key_A:this._keyState.left=!0;break;case tt.Key_D:this._keyState.right=!0;break;case tt.Key_Q:this._keyState.q=!0;break;case tt.Key_E:this._keyState.e=!0;break;case tt.Key_Shift_L:this._moveScale=this.config.shiftMoveScale}}Reset(){this._lastPos.x=_.inputSystem.mouseLastX,this._lastPos.y=_.inputSystem.mouseLastY}mouseDown(e){this.Reset(),this._mouseDown=!0}mouseUp(e){this.Reset(),this._mouseDown=!1}get factory(){return this._factory}set factory(e){this._factory=e}get mouseFactory(){return this._mouseFactory}set mouseFactory(e){this._mouseFactory=e}internal(e,t,a){return(t-e)*a}onUpdate(){let e=this.transform,t=Be(We.delta,0,.016);if(this._mouseDown&&(e.rotationY-=this.internal(e.rotationY+(_.inputSystem.mouseLastX-this._lastPos.x)*.25,e.rotationY,t*this._mouseFactory),e.rotationX-=this.internal(e.rotationX+(_.inputSystem.mouseLastY-this._lastPos.y)*.25,e.rotationX,t*this._mouseFactory),this.Reset()),this._keyState.front){let a=e.forward;e.x-=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y-=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z-=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}if(this._keyState.back){let a=e.forward;e.x+=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y+=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z+=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}if(this._keyState.left){let a=e.left;e.x+=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y+=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z+=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}if(this._keyState.right){let a=e.left;e.x-=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y-=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z-=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}this._keyState.q&&(e.y=Mr(e.y,e.y-this.moveSpeed*this._moveScale,t*this._factory)),this._keyState.e&&(e.y=Mr(e.y,e.y+this.moveSpeed*this._moveScale,t*this._factory))}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.mouseDown,this),_.inputSystem.removeEventListener(Ma.KEY_UP,this.keyUp,this),_.inputSystem.removeEventListener(Ma.KEY_DOWN,this.keyDown,this),super.destroy(e)}}class Wi{static add(e,t,a){return a||(a=new b),a.x=e.x+t.x,a.y=e.y+t.y,a.z=e.z+t.z,a}static sub(e,t,a){return a||(a=new b),a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}static mul(e,t,a){return a||(a=new b),a.x=e.x*t.x,a.y=e.y*t.y,a.z=e.z*t.z,a}static mulScale(e,t,a){return a||(a=new b),a.x=e.x*t,a.y=e.y*t,a.z=e.z*t,a}static div(e,t,a){return a||(a=new b),a.x=e.x/t.x,a.y=e.y/t.y,a.z=e.z/t.z,a}static normalize(e){return e.clone().normalize()}static dot(e,t){let a=b.HELP_0;return a.copyFrom(e),a.dotProduct(t)}static calculateVectorAngle_xz(e,t){return Math.acos((e.x*t.x+e.y*t.y)/Math.sqrt((e.x*e.x+e.y*e.y)*(t.x*t.x+t.y*t.y)))}static distance(e,t){return b.distance(e,t)}static getRandomXYZ(e=-100,t=100){return new b(Math.random()*(t-e)+e,Math.random()*(t-e)+e,Math.random()*(t-e)+e)}static getRandomV3(e=-100,t=100,a,r){return new b(Math.random()*t+e,Math.random()*r+a,Math.random()*t+e)}static sphere(e){let t=e*Math.random(),a=new b(Math.random()*1-.5,Math.random()*1-.5,Math.random()*1-.5);return a.normalize(),a.scaleBy(t),a}static sphereXYZ(e,t,a=1,r=1,i=1){let n=e+(t-e)*Math.random(),o=new b(Math.random()*a-a*.5,Math.random()*r-r*.5,Math.random()*i-i*.5);return o.normalize(),o.scaleBy(n),o}}class Tg extends et{camera;minDistance=.1;maxDistance=500;rollSmooth=15;dragSmooth=20;wheelSmooth=10;wheelStep=.002;mouseRightFactor=.25;mouseLeftFactor=20;smooth=!0;_wheelStep=.002;_distance=0;distance=10;_roll=0;roll=0;_pitch=0;pitch=0;_currentPos;_targetPos;_flowTarget;_flowOffset;_mouseLeftDown=!1;_mouseRightDown=!1;_bottomClamp=89.99;_topClamp=-89.99;get bottomClamp(){return this._bottomClamp}set bottomClamp(e){this._bottomClamp=e>89.99?89.99:e}get topClamp(){return this._topClamp}set topClamp(e){this._topClamp=e<-89.99?-89.99:e}_tempDir=new b;_tempPos=new b;constructor(){super(),this._currentPos=new ne,this._targetPos=new ne}start(){this.camera=this.object3D.getOrAddComponent(ti),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onMouseDown,this),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onMouseMove,this,null,10),_.inputSystem.addEventListener(Z.POINTER_UP,this.onMouseUp,this,null,10),_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.onMouseWheel,this)}flowTarget(e,t=b.ZERO){this._flowTarget=e,this._flowOffset||=new b,this._flowOffset.copyFrom(t)}getFlowTarget(){return this._flowTarget}setCamera(e,t,a,r){this.roll=e,this.pitch=t,this.distance=a,this.maxDistance<a*1.5&&(this.maxDistance=a*1.5),r&&this._targetPos.transform.localPosition.copy(r)}focusByBounds(e){let t=qn.genMeshBounds(e);this.focusBound(t)}focusBound(e){this.target=e.center}set target(e){this._targetPos.transform.localPosition.copy(e)}get target(){return this._targetPos.transform.localPosition}onMouseWheel(e){this.enable&&(this._wheelStep=this.wheelStep*Wi.distance(this._currentPos.transform.worldPosition,this.camera.transform.worldPosition)/10,this.distance-=_.inputSystem.wheelDelta*this._wheelStep,this.distance=Be(this.distance,this.minDistance,this.maxDistance))}onMouseDown(e){if(this.enable)switch(e.mouseCode){case 0:this._mouseLeftDown=!0;break;case 1:break;case 2:this._mouseRightDown=!0;break}}onMouseUp(e){this._mouseLeftDown=!1,this._mouseRightDown=!1}onMouseMove(e){this.enable&&(this._mouseRightDown&&(b.HELP_1.x=-1*e.movementX*Math.cos(this._roll*Math.PI/180)-e.movementY*Math.sin(this._roll*Math.PI/180),b.HELP_1.z=-1*e.movementY*Math.cos(this._roll*Math.PI/180)+e.movementX*Math.sin(this._roll*Math.PI/180),this._targetPos.x+=b.HELP_1.x*this.mouseRightFactor,this._targetPos.z+=b.HELP_1.z*this.mouseRightFactor),this._mouseLeftDown&&(this.roll-=e.movementX*We.delta*.001*this.mouseLeftFactor,this.pitch-=e.movementY*We.delta*.001*this.mouseLeftFactor,this.pitch=Be(this.pitch,this._topClamp,this._bottomClamp)))}onBeforeUpdate(e){if(!this.enable)return;this._flowTarget&&(b.HELP_0.copyFrom(this._flowTarget.transform.worldPosition),b.HELP_0.add(this._flowOffset,b.HELP_0),this.target=b.HELP_0);let t=Be(We.delta,0,.016);this.smooth?(this._currentPos.x+=(this._targetPos.x-this._currentPos.x)*t*this.dragSmooth,this._currentPos.y+=(this._targetPos.y-this._currentPos.y)*t*this.dragSmooth,this._currentPos.z+=(this._targetPos.z-this._currentPos.z)*t*this.dragSmooth,this._distance+=(this.distance-this._distance)*t*this.wheelSmooth,this._roll+=(this.roll-this._roll)*t*this.rollSmooth,this._pitch+=(this.pitch-this._pitch)*t*this.rollSmooth):(this._currentPos.x=this._targetPos.x,this._currentPos.y=this._targetPos.y,this._currentPos.z=this._targetPos.z,this._distance=this.distance,this._roll=this.roll,this._pitch=this.pitch),this._tempDir.set(0,0,1);let a=se.HELP_0;a.fromEulerAngles(this._pitch,this._roll,0),this._tempDir.applyQuaternion(a),this._tempPos=Wi.mulScale(this._tempDir,this._distance,this._tempPos),this._tempPos.add(this._currentPos.transform.localPosition,this._tempPos),this.camera.lookAt(this._tempPos,this._currentPos.transform.localPosition,b.UP)}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.onMouseDown,this),_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.onMouseMove,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.onMouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.onMouseWheel,this),super.destroy(e),this.camera=null,this._flowTarget=null}}class Mg extends et{_camera;autoRotate=!1;autoRotateSpeed=.1;rotateFactor=.5;zoomFactor=.1;panFactor=.25;_smooth=5;_minDistance=1;_maxDistance=1e5;_maxPolarAngle=90;_minPolarAngle=-90;_target=new b(0,0,0);_cTarget=new b(0,0,0);_position=new b(0,0,0);_cPosition=new b(0,0,0);_spherical=new Ng;_isMouseDown=!1;_lastMouseX=-1;_lastMouseY=-1;_isPanning=!1;constructor(){super()}get target(){return this._target}set target(e){this._target=e}get smooth(){return this._smooth}set smooth(e){this._smooth=Math.max(e,1)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance=Be(e,2e-6,this._maxDistance)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance=Be(e,this._minDistance,1/0)}get minPolarAngle(){return this._minPolarAngle}set minPolarAngle(e){this._minPolarAngle=Be(e,-90,this._maxPolarAngle)}get maxPolarAngle(){return this._maxPolarAngle}set maxPolarAngle(e){this._maxPolarAngle=Be(e,this._minPolarAngle,90)}get spherical(){return this._spherical}start(){this._camera=this.object3D.getComponent(ti),this._position=this.object3D.transform.localPosition.clone(),this._cPosition=this._position.clone(),this._target=this._camera.lookTarget.clone(),this._cTarget=this._target.clone(),this._spherical.setCoords(this._position.x-this._target.x,this._position.y-this._target.y,this._position.z-this._target.z),this._camera.lookAt(this._cPosition,this._cTarget,b.UP),this.addEventListener()}onEnable(){this.addEventListener()}onDisable(){this.removeEventListener()}onUpdate(){let e=this._isPanning?1:this.smooth,t=!1;this._cPosition.equals(this.object3D.transform.localPosition)||(this._position.copyFrom(this.object3D.transform.localPosition),e=1,t=!0),this._cTarget.equals(this._target)||(this._cTarget.copyFrom(this._target),e=1,t=!0),t?this._spherical.setCoords(this._position.x-this._target.x,this._position.y-this._target.y,this._position.z-this._target.z):!this._isMouseDown&&this.autoRotate&&(this._spherical.theta-=this.autoRotateSpeed*Math.PI/180,this.updateCamera());let a=(this._position.x-this._cPosition.x)/e,r=(this._position.y-this._cPosition.y)/e,i=(this._position.z-this._cPosition.z)/e;this._cPosition.x=Math.abs(a)>1e-10?this._cPosition.x+a:this._position.x,this._cPosition.y=Math.abs(r)>1e-10?this._cPosition.y+r:this._position.y,this._cPosition.z=Math.abs(i)>1e-10?this._cPosition.z+i:this._position.z,this._camera.lookAt(this._cPosition,this._cTarget,b.UP)}onWheel(e){e.deltaY=Be(e.deltaY,-this._spherical.radius,this._spherical.radius),this._spherical.radius+=e.deltaY*this.zoomFactor,this._spherical.radius=Be(this._spherical.radius,this.minDistance,this.maxDistance),this.updateCamera()}onPointerDown(e){this._isMouseDown=!0,this._lastMouseX=e.mouseX,this._lastMouseY=e.mouseY,e.mouseCode===2&&(this._isPanning=!0)}onPointerMove(e){if(!this._isMouseDown||!this.enable)return;let t=e.mouseX,a=e.mouseY;if(e.mouseCode===0&&this._lastMouseX>0&&this._lastMouseY>0){const r=-(t-this._lastMouseX)*this.rotateFactor,i=(a-this._lastMouseY)*this.rotateFactor;this._spherical.theta+=r*Math.PI/180,this._spherical.phi-=i*Math.PI/180,this._spherical.phi=Be(this._spherical.phi,this.minPolarAngle,this.maxPolarAngle),this.updateCamera()}else e.mouseCode===2&&(Wi.mulScale(this.object3D.transform.up,e.movementY*this.panFactor*this._camera.aspect,b.HELP_1),e.ctrlKey||e.metaKey?this._target.y+=b.HELP_1.y:(this._target.x+=b.HELP_1.x,this._target.z+=b.HELP_1.z),Wi.mulScale(this.object3D.transform.right,-e.movementX*this.panFactor,b.HELP_1),this._target.x-=b.HELP_1.x,this._target.z-=b.HELP_1.z,this._cTarget.copyFrom(this._target),this.updateCamera());this._lastMouseX=t,this._lastMouseY=a}onPointerUp(e){this._isMouseDown=!1,e.mouseCode===2&&(this._isPanning=!1)}updateCamera(){this._spherical.makeSafe();let e=this._spherical.getCoords();this._position.set(e.x+this._target.x,e.y+this._target.y,e.z+this._target.z)}addEventListener(){_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.onWheel,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onPointerDown,this),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onPointerMove,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.onPointerUp,this)}removeEventListener(){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.onWheel,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.onPointerDown,this),_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.onPointerMove,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.onPointerUp,this)}}const ch=Math.PI/180/100;class Ng{radius;phi;theta;coords;constructor(e=1,t=0,a=0){return this.radius=e,this.phi=t,this.theta=a,this.coords=new b,this}set(e,t,a){return this.radius=e,this.phi=t,this.theta=a,this}makeSafe(){return this.phi=Math.max(ch,Math.min(Math.PI-ch,this.phi)),this}setFromVector3(e){return this.setCoords(e.x,e.y,e.z)}setCoords(e,t,a){return this.radius=Math.sqrt(e*e+t*t+a*a),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,a),this.phi=Math.acos(Be(t/this.radius,-1,1))),this}getCoords(){const e=Math.sin(this.phi)*this.radius;return this.coords.x=e*Math.sin(this.theta),this.coords.y=Math.cos(this.phi)*this.radius,this.coords.z=e*Math.cos(this.theta),this.coords}}class Pg extends et{focus;_rotation=new b(45,0,0);distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(ti),!this._camera){console.error("ThirdPersonCameraController need camera");return}if(!this.focus){console.error("ThirdPersonCameraController need target");return}_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){_.inputSystem.addEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){this._rotation.y+=e.movementX*.01,this._rotation.x+=e.movementY*.01}mouseWheel(e){this.distance+=_.inputSystem.wheelDelta*.1}onUpdate(){let e=new b;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t.subtract(e)}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var at=(s=>(s[s.NORMAL=0]="NORMAL",s[s.DOWN=1]="DOWN",s[s.OVER=2]="OVER",s[s.DISABLE=3]="DISABLE",s))(at||{});let Vg=Math.PI,fh=Vg*2;class Gr{a;b;c;d;tx;ty;constructor(e=1,t=0,a=0,r=1,i=0,n=0){this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n}clone(){return new Gr(this.a,this.b,this.c,this.d,this.tx,this.ty)}concat(e){let t=this.a,a=this.c,r=this.tx;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=a*e.a+this.d*e.c,this.d=a*e.b+this.d*e.d,this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}identity(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this}invert(){this._invertInto(this)}rotate(e){if(e=+e,e!==0){e=e*Dt;let t=Math.cos(e),a=Math.sin(e),r=this.a,i=this.b,n=this.c,o=this.d,l=this.tx,c=this.ty;this.a=r*t-i*a,this.b=r*a+i*t,this.c=n*t-o*a,this.d=n*a+o*t,this.tx=l*t-c*a,this.ty=l*a+c*t}}scale(e,t){e!==1&&(this.a*=e,this.c*=e,this.tx*=e),t!==1&&(this.b*=t,this.d*=t,this.ty*=t)}setTo(e,t,a,r,i,n){return this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n,this}transformPoint(e,t,a){let r=this.a*e+this.c*t+this.tx,i=this.b*e+this.d*t+this.ty;return a?(a.setTo(r,i,0,1),a):new b(r,i,0,1)}setTranslate(e,t){this.tx=e,this.ty=t}translate(e,t){this.tx+=e,this.ty+=t}mul(e){let t=this,a=e,r=t.a,i=t.b,n=t.c,o=t.d,l=t.tx,c=t.ty,f=a.a,d=a.b,h=a.c,u=a.d,m=a.tx,g=a.ty;d!==0||h!==0?(this.a=r*f+i*h,this.b=r*d+i*u,this.c=n*f+o*h,this.d=n*d+o*u,this.tx=f*l+h*c+m,this.ty=d*l+u*c+g):(this.a=r*f,this.b=i*u,this.c=n*f,this.d=o*u,this.tx=f*l+m,this.ty=u*c+g)}equals(e){return this.a==e.a&&this.b==e.b&&this.c==e.c&&this.d==e.d&&this.tx==e.tx&&this.ty==e.ty}prepend(e,t,a,r,i,n){let o=this.tx;if(e!=1||t!=0||a!=0||r!=1){let l=this.a,c=this.c;this.a=l*e+this.b*a,this.b=l*t+this.b*r,this.c=c*e+this.d*a,this.d=c*t+this.d*r}return this.tx=o*e+this.ty*a+i,this.ty=o*t+this.ty*r+n,this}append(e){let t=this.a,a=this.b,r=this.c,i=this.d;return(e.a!=1||e.b!=0||e.c!=0||e.d!=1)&&(this.a=e.a*t+e.b*r,this.b=e.a*a+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*a+e.d*i),this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*a+e.ty*i+this.ty,this}deltaTransformPoint(e){let t=this,a=t.a*e.x+t.c*e.y,r=t.b*e.x+t.d*e.y;return new b(a,r)}toString(){return"(a="+this.a+", b="+this.b+", c="+this.c+", d="+this.d+", tx="+this.tx+", ty="+this.ty+")"}createBox(e,t,a=0,r=0,i=0){let n=this;if(a!==0){a=a*Dt;let o=Math.cos(a),l=Math.sin(a);n.a=o*e,n.b=l*t,n.c=-l*e,n.d=o*t}else n.a=e,n.b=0,n.c=0,n.d=t;n.tx=r,n.ty=i}createGradientBox(e,t,a=0,r=0,i=0){this.createBox(e/1638.4,t/1638.4,a,r+e/2,i+t/2)}_invertInto(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty;if(a==0&&r==0){e.b=e.c=0,t==0||i==0?e.a=e.d=e.tx=e.ty=0:(t=e.a=1/t,i=e.d=1/i,e.tx=-t*n,e.ty=-i*o);return}let l=t*i-a*r;if(l==0){e.identity();return}l=1/l;let c=e.a=i*l;a=e.b=-a*l,r=e.c=-r*l,i=e.d=t*l,e.tx=-(c*n+r*o),e.ty=-(a*n+i*o)}getScaleX(){let e=this;if(e.a==1&&e.b==0)return 1;let t=Math.sqrt(e.a*e.a+e.b*e.b);return this.getDeterminant()<0?-t:t}getScaleY(){let e=this;if(e.c==0&&e.d==1)return 1;let t=Math.sqrt(e.c*e.c+e.d*e.d);return this.getDeterminant()<0?-t:t}getSkewX(){return Math.atan2(this.d,this.c)-Math.PI/2}getSkewY(){return Math.atan2(this.b,this.a)}updateScaleAndRotation(e,t,a,r){if((a==0||a==fh)&&(r==0||r==fh)){this.a=e,this.b=this.c=0,this.d=t;return}a=a*Dt,r=r*Dt;let i=Math.cos(a),n=Math.sin(a);a==r?(this.a=i*e,this.b=n*e):(this.a=Math.cos(r)*e,this.b=Math.sin(r)*e),this.c=-n*t,this.d=i*t}preMultiplyInto(e,t){let a=e.a*this.a,r=0,i=0,n=e.d*this.d,o=e.tx*this.a+this.tx,l=e.ty*this.d+this.ty;(e.b!==0||e.c!==0||this.b!==0||this.c!==0)&&(a+=e.b*this.c,n+=e.c*this.b,r+=e.a*this.b+e.b*this.d,i+=e.c*this.a+e.d*this.c,o+=e.ty*this.c,l+=e.tx*this.b),t.a=a,t.b=r,t.c=i,t.d=n,t.tx=o,t.ty=l}$transformBounds(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty,l=e.x,c=e.y,f=l+e.width,d=c+e.height,h=t*l+r*c+n,u=a*l+i*c+o,m=t*f+r*c+n,g=a*f+i*c+o,p=t*f+r*d+n,D=a*f+i*d+o,A=t*l+r*d+n,B=a*l+i*d+o,v=0;h>m&&(v=h,h=m,m=v),p>A&&(v=p,p=A,A=v),e.x=Math.floor(h<p?h:p),e.width=Math.ceil((m>A?m:A)-e.x),u>g&&(v=u,u=g,g=v),D>B&&(v=D,D=B,B=v),e.y=Math.floor(u<D?u:D),e.height=Math.ceil((g>B?g:B)-e.y)}getDeterminant(){return this.a*this.d-this.b*this.c}}class ds extends et{isGUICanvas=!0;index=0;addChild(e){return this.object3D.addChild(e),this}removeChild(e){return this.object3D.removeChild(e),this}cloneTo(e){e.getOrAddComponent(ds).copyComponent(this)}copyComponent(e){return e.index=e.index,this}}var ot=(s=>(s[s.NONE=0]="NONE",s[s.POSITION=1]="POSITION",s[s.SPRITE=2]="SPRITE",s[s.COLOR=4]="COLOR",s[s.MAX=7]="MAX",s))(ot||{});class Go{array;buffer;constructor(e){this.buffer=new Pe(e,0),this.array=new Float32Array(this.buffer.memory.shareDataBuffer)}}class dh extends Le{_attributeUV;_attributeVIndex;_faceIndexes;_uvSize=2;_vIndexSize=1;_posAttribute;_spriteAttribute;_colorAttribute;_onPositionChange=!0;_onSpriteChange=!0;_onColorChange=!0;maxQuadCount;constructor(e){super(),this.maxQuadCount=e}updateSubGeometry(e,t,a){let r=this.subGeometries[e];if(r){let i=r.lodLevels[0];i.indexStart=t,i.indexCount=a,i.index=e}else r=this.addSubGeometry({indexStart:t,indexCount:a,vertexStart:0,vertexCount:0,firstStart:0,index:e,topology:0});return r}resetSubGeometries(){for(let e of this.subGeometries){let t=e.lodLevels[0];t.indexStart=0,t.indexCount=0,t.index=0}}updateBounds(e,t){let a=Number.MAX_VALUE*.1;return e=new b(-a,-a,-a),t=new b(a,a,a),this.bounds.setFromMinMax(e,t),this}getPositionBuffer(){return this._onPositionChange&&(this._posAttribute.buffer.apply(),this._onPositionChange=!1),this._posAttribute.buffer}getSpriteBuffer(){return this._onSpriteChange&&(this._spriteAttribute.buffer.apply(),this._onSpriteChange=!1),this._spriteAttribute.buffer}getColorBuffer(){return this._onColorChange&&(this._colorAttribute.buffer.apply(),this._onColorChange=!1),this._colorAttribute.buffer}create(){this.createBuffer(),this.updateBounds();let e=this.maxQuadCount,t=[],a=[];for(let i=0;i<e;i++)t.push(...pi.attUV);for(let i=0,n=this.maxQuadCount*pi.vertexCount;i<n;i++)a[i]=i;this._attributeUV=new Float32Array(pi.vertexCount*e*this._uvSize),this._attributeVIndex=new Float32Array(pi.vertexCount*e*this._vIndexSize),this._attributeUV.set(t,0),this._attributeVIndex.set(a,0);let r=[];for(let i=0;i<e;i++)for(let n=0;n<pi.indecies.length;n++){const o=pi.indecies[n]+i*4;r.push(o)}return this._faceIndexes=new Uint32Array(e*6),this._faceIndexes.set(r,0),this.setIndices(this._faceIndexes),this.setAttribute(G.uv,this._attributeUV),this.setAttribute(G.vIndex,this._attributeVIndex),this.updateSubGeometry(0,0,this._faceIndexes.length),this}createBuffer(){let e=this.maxQuadCount;this._posAttribute=new Go(e*4),this._spriteAttribute=new Go(e*12),this._colorAttribute=new Go(e*4)}fillQuad(e,t){e.dirtyAttributes&ot.POSITION&&this.fillQuadPosition(e,t),e.dirtyAttributes&ot.COLOR&&this.fillQuadColor(e,t),e.dirtyAttributes&ot.SPRITE&&this.fillQuadSprite(e,t)}fillQuadPosition(e,t){hh.setXYZW(this._posAttribute.array,e.z,e.left,e.bottom,e.right,e.top),this._onPositionChange=!0}fillQuadColor(e,t){let a=e.color,r=this._colorAttribute.array;hh.setXYZW(r,e.z,a.r,a.g,a.b,a.a),this._onColorChange=!0}fillQuadSprite(e,t){let a=e.sprite,r=0,i=0;a.isSliced&&e.imageType==hi.Sliced&&(r=a.trimSize.x,r=(t.width-(a.offsetSize.z-a.trimSize.x))/r,i=a.trimSize.y,i=(t.height-(a.offsetSize.w-a.trimSize.y))/i);let n=a.guiTexture.dynamicId,o=a.uvRec,l=a.uvBorder,c=this._spriteAttribute.array,f=12*e.z;c[f+0]=o.x,c[f+1]=o.y,c[f+2]=o.z,c[f+3]=o.w,c[f+4]=l.x,c[f+5]=l.y,c[f+6]=l.z,c[f+7]=l.w,c[f+8]=r,c[f+9]=i,c[f+10]=n,c[f+11]=e.visible?1:0,this._onSpriteChange=!0}}class Og{static set(e,t,a,r,...i){let n=t*r+a;for(let o=0,l=i.length;o<l;o++)e[n+o]=i[o]}}class hh extends Og{static setXYZW(e,t,a,r,i,n){this.set(e,t,0,4,a,r,i,n)}static setXYZ(e,t,a,r,i){this.set(e,t,0,4,a,r,i)}static setZ(e,t,a){this.set(e,t,3,4,a)}}class pi{static vertexCount=4;static attUV=[0,0,1,0,1,1,0,1];static indecies=[0,1,2,0,2,3]}class uh{_textureMap=new Map;_textureList=[];build(e,t,a){let r=t._geometry;r.resetSubGeometries();let i=-1,n=0,o=0,l=0,c=0,f=this._textureList,d=this._textureMap;function h(){l>0&&(t.updateDrawCallSegment(c,o,l),t._uiRenderer.materials[c].setTextures(f),d.clear(),f.length=0,c++,o+=l,l=0,n=0)}d.clear(),f.length=0;let u=[],m=t.quadMaxCount-1;for(let g of e){let p=g.needUpdateQuads;u.length=0;const D=this.collectQuads(g.object3D,u);for(let A of D){let B=A.sprite.guiTexture;if(d.has(B.staticId)||(n==7&&h(),d.set(B.staticId,B),B.dynamicId=n,f[n]=B.texture,n+=1),A.z=++i,l+=6,A.cacheTextureId!=B.dynamicId&&(A.dirtyAttributes=ot.MAX,A.cacheTextureId=B.dynamicId),(p||a)&&(A.dirtyAttributes=ot.MAX),A.dirtyAttributes&ot.POSITION&&A.applyTransform(g),A.dirtyAttributes&&A.writeToGeometry(r,g),i==m)return h(),!0}}return h(),!1}collectQuads(e,t){t||=[];let a=e.components.values();for(let r of a){let i=r;if(i.isUIShadow||!i.mainQuads)continue;let n=i.getShadowRender();n&&this.push(n.mainQuads,t),this.push(i.mainQuads,t)}return t}push(e,t){e&&e.length>0&&t.push(...e)}}class zo{static bindTextureArray(){let e="";for(let t=0;t<7;t++)e+=`
|
|
11567
|
+
`}class Hd{sunRadius=500;sunRadiance=11;mieG=.76;mieHeight=1200;eyePos=1500;sunX=.71;sunY=.56;sunBrightness=1;displaySun=!0;defaultTextureCubeSize=512;defaultTexture2DSize=1024;skyColor=new J(1,1,1,1)}class Kd extends Gs{_internalTexture;_cubeSize;setting;constructor(e){return super(),this.setting=e,this._cubeSize=e.defaultTextureCubeSize,this._internalTexture=new dg(e.defaultTexture2DSize,e.defaultTexture2DSize*.5),this._internalTexture.update(this.setting),this.createFromTexture(this._cubeSize,this._internalTexture),this}get texture2D(){return this._internalTexture}apply(){return this._internalTexture.update(this.setting),this._faceData.uploadErpTexture(this._internalTexture),this}}class dg extends Te{_computeShader;_uniformBuffer;constructor(e,t){super(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.initCompute(e,t)}initCompute(e,t){this._uniformBuffer=new Ct(64),this._uniformBuffer.apply(),this._computeShader=new Fe(Xd.cs),this._computeShader.setUniformBuffer("uniformBuffer",this._uniformBuffer),this._computeShader.setStorageTexture("outTexture",this),this._computeShader.workerSizeX=e/8,this._computeShader.workerSizeY=t/8}update(e){this._uniformBuffer.setFloat("width",this.width),this._uniformBuffer.setFloat("height",this.height),this._uniformBuffer.setFloat("sunU",e.sunX),this._uniformBuffer.setFloat("sunV",e.sunY),this._uniformBuffer.setFloat("eyePos",e.eyePos),this._uniformBuffer.setFloat("sunRadius",e.sunRadius),this._uniformBuffer.setFloat("sunRadiance",e.sunRadiance),this._uniformBuffer.setFloat("mieG",e.mieG),this._uniformBuffer.setFloat("mieHeight",e.mieHeight),this._uniformBuffer.setFloat("sunBrightness",e.sunBrightness),this._uniformBuffer.setFloat("displaySun",e.displaySun?1:0),this._uniformBuffer.setColor("skyColor",e.skyColor),this._uniformBuffer.apply();let t=k.beginCommandEncoder();return k.computeCommand(t,[this._computeShader]),k.endCommandEncoder(t),this}}var hg=Object.getOwnPropertyDescriptor,ug=(s,e,t,a)=>{for(var r=a>1?void 0:a?hg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Oi=class extends At{constructor(){super();let s=new qe("sky_vs_frag_wgsl","sky_fs_frag_wgsl");this.addRenderPass(s),s.setUniformVector3("eyesPos",new b),s.setUniformFloat("exposure",1),s.setUniformFloat("roughness",0);let e=s.shaderState;e.frontFace="cw",e.cullMode=Lt.back,e.depthWriteEnabled=!1,e.depthCompare=nt.less}};Oi=ug([Na(Oi,"SkyShader")],Oi);class qd extends vt{constructor(){super(),this.shader=new Oi,this.shader.setUniformVector3("eyesPos",new b),this.shader.setUniformFloat("exposure",1),this.shader.setUniformFloat("roughness",0)}set baseMap(e){this.setTexture("baseMap",e);const t="IS_HDR_SKY";this._shader.getDefaultShaders()[0].defineValue[t]!=e?.isHDRTexture&&this._shader.setDefine(t,!!e?.isHDRTexture)}get baseMap(){return this._shader.getDefaultColorShader().getTexture("baseMap")}set envMap(e){}set shadowMap(e){}get exposure(){return _.setting.sky.skyExposure}set exposure(e){_.setting.sky.skyExposure=e}get roughness(){return this._shader.getDefaultColorShader().uniforms.roughness.value}set roughness(e){let t=this._shader.getDefaultColorShader();"roughness"in t.uniforms&&(t.uniforms.roughness.value=e)}}class $d extends Ba{gid=0;needUpdate=!0;autoUpdate=!1;radius=500;init(){super.init(),this.addRendererMask(Ne.Reflection),this.alwaysRender=!0,this.object3D.bound=new Ce(b.ZERO.clone(),b.MAX),Cs(this.transform.onPositionChange,()=>{this.needUpdate=!0})}onEnable(){q.instance.addRenderNode(this.transform.scene3D,this)}onDisable(){q.instance.removeRenderNode(this.transform.scene3D,this)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class eh extends At{constructor(){super();let e=new qe("ReflectionShader_shader","ReflectionShader_shader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformFloat("alphaCutoff",0)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Lt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=De.NONE:t.blendMode=De.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}}class th extends vt{constructor(){super(),this.shader=new eh,this.baseMap=_.res.whiteTexture,this.setDefine("USE_CUSTOMUNIFORM",!0),this.reflectionIndex=0}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}set reflectionIndex(e){this.shader.setUniformFloat("reflectionIndex",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Lr{center=new b;extents;max;min;size;tmpVecA=new b;tmpVecB=new b;tmpVecC=new b;tmpVecD=new b;radius=0;diffBetweenPoints=new b;owner;forward=new b(0,0,1);worldCenter;worldSize;_center=new b;constructor(e,t){this.center=e||new b(0,0,0),this.radius=t===void 0?.5:t}updateBound(){throw new Error("Method not implemented.")}containsPoint(e){var t=this.tmpVecA.subtract(e,this.center).lengthSquared,a=this.radius;return t<a*a}intersectsRay(e,t){var a=this.tmpVecA.copyFrom(e.origin).subtract(this.center),r=a.dotProduct(this.tmpVecB.copyFrom(e.direction).normalize()),i=a.dotProduct(a)-this.radius*this.radius;if(i>0&&r>0)return null;var n=r*r-i;if(n<0)return!1;var o=Math.abs(-r-Math.sqrt(n));return t&&t.copyFrom(e.direction).scaleBy(o).add(e.origin),!0}intersectsBoundingSphere(e){this.tmpVecA.subtract(e.center,this.center);var t=e.radius+this.radius;return this.tmpVecA.lengthSquared<=t*t}calculateTransform(e){this.update(e)}inFrustum(e,t){return t.containsSphere(e)}clone(){return new Lr(this.center.clone(),this.radius)}update(e){this.owner=e,this._center.add(e.transform.worldMatrix.position,this.center),this.forward=e.transform.forward}merge(e){throw new Error("BoundingSphere merge is not ready!")}setFromCenterAndSize(e,t){this.center.copy(e),this.radius=t}}class ah extends $d{init(){super.init(),this.castShadow=!1,this.castGI=!1,this.addRendererMask(Ne.Reflection),this.alwaysRender=!0,this.object3D.bound=new Lr(b.ZERO.clone(),this.radius)}debug(e,t=1){let a=new ne,r=a.addComponent(he);r.addMask(Ne.ReflectionDebug),r.geometry=new Nr(25,30,30);let i=_.setting.reflectionSetting,n=ve.getGBufferFrame(ve.reflections_GBuffer,i.width,i.height),o=new th;o.reflectionIndex=e,o.baseMap=n.getCompressGBufferTexture(),r.material=o,this.object3D.addChild(a),a.scaleX=t,a.scaleY=t,a.scaleZ=t}onEnable(){super.onEnable()}onDisable(){super.onDisable()}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class Ws extends he{skyMaterial;init(){super.init(),this.castShadow=!1,this.castGI=!0,this.addRendererMask(Ne.Sky),this.alwaysRender=!0,this.object3D.bound=new Ce(b.ZERO.clone(),b.MAX),this.geometry=new Nr(_.setting.sky.defaultFar,20,20),this.skyMaterial||=new qd}onEnable(){this._readyPipeline?(this.castNeedPass(),!this._inRenderer&&this.transform.scene3D&&(q.instance.sky=this,this._inRenderer=!0)):this.initPipeline()}onDisable(){this._inRenderer&&this.transform.scene3D&&(this._inRenderer=!1,q.instance.sky=null),super.onDisable()}nodeUpdate(e,t,a,r){super.nodeUpdate(e,t,a,r)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}set map(e){this.skyMaterial.baseMap=e,this.skyMaterial.name==null&&(this.skyMaterial.name="skyMaterial"),this.material=this.skyMaterial}get map(){return this.skyMaterial.baseMap}get exposure(){return this.skyMaterial.exposure}set exposure(e){this.skyMaterial&&(this.skyMaterial.exposure=e)}get roughness(){return this.skyMaterial.roughness}set roughness(e){this.skyMaterial&&(this.skyMaterial.roughness=e)}useSkyReflection(){let e=new ne,t=e.addComponent(ah);t.autoUpdate=!1,e.x=0,e.y=300,e.z=0,this.object3D.addChild(e)}}class bg{rotateX;rotateY;sunX;sunY;constructor(){this.reset()}reset(){return this.rotateX=this.rotateY=this.sunX=this.sunY=Number.MAX_VALUE,this}isRotateChange(e,t){return Math.abs(this.rotateX-e)>=.001||Math.abs(this.rotateY-t)>=.001}isSkyChange(e,t){return Math.abs(this.sunX-e)>=.001||Math.abs(this.sunY-t)>=.001}save(e,t,a,r){return this.sunX=e,this.sunY=t,this.rotateX=a,this.rotateY=r,this}}class gg extends Ws{_atmosphericScatteringSky;_onChange=!0;_relatedTransform;_historyData;get sunX(){return this._atmosphericScatteringSky.setting.sunX}set sunX(e){this._atmosphericScatteringSky.setting.sunX!=e&&(this._atmosphericScatteringSky.setting.sunX=e,this._onChange=!0)}get sunY(){return this._atmosphericScatteringSky.setting.sunY}set sunY(e){this._atmosphericScatteringSky.setting.sunY!=e&&(this._atmosphericScatteringSky.setting.sunY=e,this._onChange=!0)}get eyePos(){return this._atmosphericScatteringSky.setting.eyePos}set eyePos(e){this._atmosphericScatteringSky.setting.eyePos!=e&&(this._atmosphericScatteringSky.setting.eyePos=e,this._onChange=!0)}get sunRadius(){return this._atmosphericScatteringSky.setting.sunRadius}set sunRadius(e){this._atmosphericScatteringSky.setting.sunRadius!=e&&(this._atmosphericScatteringSky.setting.sunRadius=e,this._onChange=!0)}get sunRadiance(){return this._atmosphericScatteringSky.setting.sunRadiance}set sunRadiance(e){this._atmosphericScatteringSky.setting.sunRadiance!=e&&(this._atmosphericScatteringSky.setting.sunRadiance=e,this._onChange=!0)}get sunBrightness(){return this._atmosphericScatteringSky.setting.sunBrightness}set sunBrightness(e){this._atmosphericScatteringSky.setting.sunBrightness!=e&&(this._atmosphericScatteringSky.setting.sunBrightness=e,this._onChange=!0)}get displaySun(){return this._atmosphericScatteringSky.setting.displaySun}set displaySun(e){this._atmosphericScatteringSky.setting.displaySun!=e&&(this._atmosphericScatteringSky.setting.displaySun=e,this._onChange=!0)}init(){super.init(),this._historyData=new bg,this._atmosphericScatteringSky=new Kd(new Hd);let e=this.transform.view3D,t=this.transform.scene3D;this.map=this._atmosphericScatteringSky,t.envMap=this._atmosphericScatteringSky,this.onUpdate(e)}start(e){let t=this.transform.scene3D;this.map=this._atmosphericScatteringSky,t.envMap=this._atmosphericScatteringSky,super.start()}get relativeTransform(){return this._relatedTransform}set relativeTransform(e){this._relatedTransform=e,this._historyData.reset()}onUpdate(e){this._relatedTransform&&(this._relatedTransform.rotationZ=0,this._historyData.isRotateChange(this._relatedTransform.rotationX,this._relatedTransform.rotationY)?(this.sunX=(this._relatedTransform.rotationY+90)/360,this.sunY=this._relatedTransform.rotationX/180+.5):this._historyData.isSkyChange(this.sunX,this.sunY)&&(this._relatedTransform.rotationY=this.sunX*360-90,this._relatedTransform.rotationX=(this.sunY-.5)*180),this._historyData.save(this.sunX,this.sunY,this._relatedTransform.rotationX,this._relatedTransform.rotationY)),this._onChange&&(this._onChange=!1,this._atmosphericScatteringSky.apply())}destroy(e){super.destroy(e),this._atmosphericScatteringSky.destroy(),this._atmosphericScatteringSky=null,this._onChange=null}}class Pr{static panelRatio=1;static quadMaxCountForWorld=256;static quadMaxCountForView=2048;static SortOrderStartWorld=7e3;static SortOrderStartView=8e3;static SortOrderCanvasSpan=1e4}var fa=(s=>(s[s.View=0]="View",s[s.World=2]="World",s))(fa||{}),hi=(s=>(s[s.Simple=0]="Simple",s[s.Sliced=1]="Sliced",s[s.Tiled=2]="Tiled",s[s.Filled=3]="Filled",s))(hi||{}),pr=(s=>(s[s.None=0]="None",s[s.BillboardY=9]="BillboardY",s[s.BillboardXYZ=10]="BillboardXYZ",s))(pr||{});class fs extends et{type;camera;_cameraPosition;constructor(){super(),this._cameraPosition=new b}onUpdate(){this.enable&&this.transform.view3D.camera&&this.updateBillboardMatrix()}updateBillboardMatrix(){let e=this.transform.view3D.camera;this._cameraPosition.copyFrom(e.transform.back),this.type==pr.BillboardXYZ||this.type==pr.BillboardY&&(this._cameraPosition.y=0),this._cameraPosition.normalize(),this._cameraPosition.add(this.object3D.localPosition,this._cameraPosition),this.transform.lookAt(this.object3D.localPosition,this._cameraPosition,e.transform.up)}cloneTo(e){let t=e.addComponent(fs);t.type=this.type}}var ui=(s=>(s[s.None=0]="None",s[s.Box=1]="Box",s[s.Capsule=2]="Capsule",s[s.Sphere=3]="Sphere",s[s.Mesh=4]="Mesh",s))(ui||{});class gt{_center;_size;_halfSize;_shapeType=0;static v3_help_0;static helpMatrix;static helpRay;constructor(){gt.v3_help_0||=new b,gt.helpMatrix||=new R,gt.helpRay||=new ua,this._center=new b,this._size=new b,this._halfSize=new b}get shapeType(){return this._shapeType}setFromCenterAndSize(e,t){return e&&this._center.copy(e),t&&this._size.copy(t),this}get center(){return this._center}set center(e){this._center.copy(e)}get size(){return this._size}set size(e){this._size.copy(e),this._halfSize.copy(e).multiplyScalar(.5)}get halfSize(){return this._halfSize}rayPick(e,t){return null}}class bi extends gt{_pickRet;box;constructor(){super(),this._shapeType=ui.Box,this.box=new Ce(new b,new b)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.size);let r=gt.helpMatrix;r.copyFrom(t).invert();let i=gt.helpRay.copy(e);i.applyMatrix(r);let n=i.intersectBox(this.box,gt.v3_help_0);return n?(this._pickRet||(this._pickRet={intersectPoint:new b,distance:0}),this._pickRet.intersectPoint=n,this._pickRet.distance=b.distance(i.origin,gt.v3_help_0),this._pickRet):null}}class da extends et{_shape;constructor(){super(),this._shape=new bi}start(){_.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.set(this.transform.worldMatrix.index,this)}onEnable(e){Oe.bindEnablePick(e,this,null)}onDisable(e){Oe.unBindEnablePick(e,this)}get shape(){return this._shape}set shape(e){this._shape=e}rayPick(e){return this._enable?this._shape.rayPick(e,this.transform.worldMatrix):null}beforeDestroy(e){_.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.delete(this.transform.worldMatrix.index),super.beforeDestroy(e)}}class rh{loop=!0;speed=1;t=0;time=0;weight=0;currFrame=0;lastFrame=-1;nextFrame=0;clip;animation;_isEnd=!1;_currSkeletonPose;constructor(e){this.clip=e,this._currSkeletonPose=new Ii(this.clip.skeleton)}reset(){this.time=0,this.weight=0,this._isEnd=!1}get name(){return this.clip.name}get currSkeletonPose(){return this._currSkeletonPose}update(e){this.time=(this.time+e*this.speed)%this.clip.totalTime;let t=this.time/this.clip.frameRate;if(this.currFrame=Math.trunc(t),this.t=t-this.currFrame,this.currFrame<0&&(this.currFrame=this.clip.numFrame+this.currFrame),this.time>=0?this.nextFrame=(this.currFrame+1)%this.clip.numFrame:(this.nextFrame=this.currFrame-1,this.nextFrame<0&&(this.nextFrame=this.clip.numFrame+this.nextFrame),this.t=1-this.t),this._isEnd)this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1;else if(this.currFrame!=this.lastFrame){let i=this.speed<0?0:this.clip.numFrame;this.currFrame==i&&(this.loop?(this.currFrame=0,this.nextFrame=1,this.time=this.t=0):(this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1,this._isEnd=!0));var a=this.clip.getEvents();if(a)for(let n of a){var r=Math.floor(n.time/this.clip.frameRate);if(r=Math.min(r,this.clip.numFrame),r=Math.max(r,0),r==this.currFrame){n.skeletonAnimation=this.animation,this.animation.eventDispatcher.dispatchEvent(n);break}}this.lastFrame=this.currFrame}this.clip.getLerpSkeletonPose(this.currFrame,this.nextFrame,this.t,this._currSkeletonPose)}}var pg=Object.getOwnPropertyDescriptor,mg=(s,e,t,a)=>{for(var r=a>1?void 0:a?pg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let mr=class extends et{isPlaying=!0;timeScale=1;_skeleton;_clips=[];_clipStates=new Map;_mixSkeletonPose;_mixTempSkeletonPose;_currentClipState;_bindList=[];_jointMatrixIndexTableBuffer;_crossFadeState;constructor(){super()}start(){}set skeleton(s){this._skeleton=s,this._mixSkeletonPose=new Ii(this._skeleton,!0),this._mixTempSkeletonPose=new Ii(this._skeleton);const e=new Float32Array(this._mixSkeletonPose.jointMatrixIndexTable);this._jointMatrixIndexTableBuffer=new Pe(this._skeleton.numJoint*4,0,e)}get skeleton(){return this._skeleton}get finalSkeletonPose(){return this._mixSkeletonPose}get jointMatrixIndexTableBuffer(){return this._jointMatrixIndexTableBuffer}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){const a=s[t];let r=this._skeleton.getJointByName(a);e[t]=r?r.index:-1}return e}addAnimationClip(s){if(!this._clipStates.has(s.name)){this._clips.push(s);let e=new rh(s);e.animation=this,this._clipStates.set(s.name,e),this._currentClipState||this.setCurrentClipState(e)}}getAnimationClip(s){var e=this.getAnimationClipState(s);return e?e.clip:null}getAnimationClips(){return this._clips}getAnimationClipState(s){return this._clipStates.has(s)?this._clipStates.get(s):null}getAnimationClipStates(){return this._clipStates}pause(){this.isPlaying=!1}resume(){this.isPlaying=!0}play(s,e=1,t=!1){if(this._currentClipState&&this._currentClipState.name==s)return t&&this._currentClipState.reset(),!1;let a=this.getAnimationClipState(s);return a?(a.speed=e,a.reset(),this._clipStates.forEach((r,i)=>{r.weight=0}),this.setCurrentClipState(a),!0):!1}crossFade(s,e){if(e<.01){this.play(s);return}if(this._currentClipState.name==s)return;let t=this.getAnimationClipState(s);t&&(t.reset(),this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(t,this._currentClipState,e)):this._crossFadeState=new Ag(t,this._currentClipState,e),this._currentClipState=t)}setAnimIsLoop(s,e){this._clipStates.has(s)&&(this._clipStates.get(s).loop=e)}addJointBind(s,e){this._bindList.push({jointName:s,obj:e})}removeJointBind(s){for(let e=0;e<this._bindList.length;e++)if(this._bindList[e].obj==s){this._bindList.splice(e,1);break}}onUpdate(){if(!this.isPlaying)return;let s=We.delta*.001*this.timeScale;this._crossFadeState&&this._crossFadeState.update(s);var e=0,t=[];if(this._clipStates.forEach((r,i)=>{r.weight>0&&(r.update(s),e+=r.weight,t.push(r))}),t.length>0){this._mixSkeletonPose.copyFrom(t[0].currSkeletonPose);for(var a=1;a<t.length;++a){const r=t[a];this._mixTempSkeletonPose.lerp(this._mixSkeletonPose,r.currSkeletonPose,r.weight/e),this._mixSkeletonPose.copyFrom(this._mixTempSkeletonPose)}}}cloneTo(s){let e=s.addComponent(mr);e.skeleton=this.skeleton;for(var t=0;t<this._clips.length;++t)e.addAnimationClip(this._clips[t])}setCurrentClipState(s){this._currentClipState!=s&&(this._currentClipState=s,this._currentClipState.weight=1)}};mr=mg([Ot(mr,"SkeletonAnimationComponent")],mr);class Ag{inClip;outClip;currentTime;crossFadeTime;constructor(e,t,a){this.reset(e,t,a)}reset(e,t,a){this.inClip=e,this.outClip=t,this.currentTime=0,this.crossFadeTime=a}update(e){!this.inClip||!this.outClip||(this.currentTime+=e,this.inClip.weight=Math.min(Math.abs(this.currentTime%this.crossFadeTime)/this.crossFadeTime,1),this.outClip.weight=1-this.inClip.weight,Math.abs(this.currentTime)>=this.crossFadeTime&&(this.inClip.weight=1,this.outClip.weight=0,this.inClip=null,this.outClip=null))}}var Dg=Object.getOwnPropertyDescriptor,_g=(s,e,t,a)=>{for(var r=a>1?void 0:a?Dg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let er=class extends et{timeScale=1;jointMatrixIndexTableBuffer;playBlendShapeLoop=!1;inverseBindMatrices;_avatar;_rendererList;propertyCache;_clips;_clipsState;_clipsMap;_currentSkeletonClip;_currentBlendAnimClip;_skeletonTime=0;_blendShapeTime=0;_skeletonSpeed=1;_blendShapeSpeed=1;_skeletonStart=!0;_blendShapeStart=!0;root;_avatarName;_bonePos=new b;_boneScale=new b;_boneRot=new se;_crossFadeState;init(s){this.propertyCache=new Map,this._clipsMap=new Map,this._clips=[],this._clipsState=[],this._rendererList=this.object3D.getComponentsInChild(Dr);let e=this.object3D.getComponentsInChild(he);for(let t of e){let a=t;a.blendShape=t.morphData,this._rendererList.push(a)}for(const t of this._rendererList)ia.hasMask(t.rendererMask,Ne.MorphTarget)&&t.selfCloneMaterials("MORPH_TARGET_UUID")}start(){}debug(){}playAnim(s,e=0,t=1){let a=this.getAnimationClipState(s);a?(this._currentSkeletonClip&&(this._currentSkeletonClip.weight=0),this._currentSkeletonClip=a,this._currentSkeletonClip.weight=1,this._skeletonTime=e,this._skeletonSpeed=t,this._skeletonStart=!0):console.warn(`not has anim ${s}`)}crossFade(s,e){let t=this.getAnimationClipState(s);if(!t){console.warn(`not has anim ${s}`);return}if(e<.01||!this._currentSkeletonClip){this.playAnim(s);return}if(this._currentSkeletonClip&&this._currentSkeletonClip.clip.clipName===s)return;let a=t,r=this._currentSkeletonClip;this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(a,r,e)):this._crossFadeState=new Bg(a,r,e),this._currentSkeletonClip=a}playBlendShape(s,e=0,t=1){this._clipsMap.has(s)?(this._currentBlendAnimClip=this._clipsMap.get(s),this._blendShapeTime=e,this._blendShapeSpeed=t,this._blendShapeStart=!0):console.warn(`not has blendShape ${s}`)}set avatar(s){this._avatarName=s,this.inverseBindMatrices=[],this._avatar=_.res.getObj(s);let e=this.buildSkeletonPose();const t=new Float32Array(e);this.jointMatrixIndexTableBuffer=new Pe(this._avatar.count,0,t)}get numJoint(){return this._avatar.count}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){let a=this._avatar.boneMap.get(s[t]);e[t]=a?a.boneID:-1}return e}skeltonPoseObject3D={};skeltonTPoseObject3D={};buildSkeletonPose(){let s=[];for(const e of this._avatar.boneData){let t=new ne;R.getEuler(b.HELP_6,e.q,!0,"ZYX"),t.localPosition=e.t.clone(),t.localRotation=b.HELP_6.clone(),t.localScale=b.ONE,e.s.clone(),this.skeltonPoseObject3D[e.boneName]=t,this.skeltonTPoseObject3D[e.bonePath]=t.clone(),e.parentBoneName&&e.parentBoneName!=""?this.skeltonPoseObject3D[e.parentBoneName].addChild(t):(this.object3D.transform.scene3D&&this.object3D.transform.scene3D.addChild(t),this.root=t),s.push(t.transform.worldMatrix.index);let a=new R;a.copyFrom(t.transform.worldMatrix),a.invert(),this.inverseBindMatrices.push(a.rawData)}return s}set clips(s){this._clips=s;for(const e of s)this._clipsMap.set(e.clipName,e);this._clipsState=[];for(const e of s)this._clipsState.push(new ih(e));this._currentSkeletonClip||this.playAnim(s[0].clipName)}get clips(){return this._clips}get clipsState(){return this._clipsState}cloneTo(s){let e=s.addComponent(er);e.avatar=this._avatarName,e.clips=this._clips}updateTime(){const s=We.delta*.001;this._skeletonStart&&(this._skeletonTime+=s*this._skeletonSpeed*this.timeScale,this._currentSkeletonClip&&this._currentSkeletonClip.clip.loopTime&&(this._skeletonTime=this._skeletonTime%this._currentSkeletonClip.clip.stopTime)),this._blendShapeStart&&(this._blendShapeTime+=s*this._blendShapeSpeed,this._currentBlendAnimClip&&(this._currentBlendAnimClip.loopTime&&this.playBlendShapeLoop?this._blendShapeTime=this._blendShapeTime%this._currentBlendAnimClip.stopTime:this._blendShapeTime=Math.min(this._blendShapeTime,this._currentBlendAnimClip.stopTime)-1e-4)),this._crossFadeState&&this._crossFadeState.update(s)}onUpdate(s){this.updateTime();let e=[];for(let t of this._clipsState)t.weight>0&&e.push(t);e.length>0?this.updateSkeletonAnimMix(e):this.updateSkeletonAnim(),this.updateMorphAnim()}updateSkeletonAnim(){if(this._currentSkeletonClip){let s=this._avatar.boneData,e=0,t=s.length;for(e=0;e<t;e++){const a=s[e];let r=this.skeltonPoseObject3D[a.boneName];if(this._currentSkeletonClip.clip.useSkeletonPos){let n=this.getPosition(a.bonePath,this._skeletonTime);r.transform.localPosition=n}let i=this.getRotation(a.bonePath,this._skeletonTime);if(r.transform.localRotQuat=i,this._currentSkeletonClip.clip.useSkeletonScale){let n=this.getScale(a.bonePath,this._skeletonTime);r.transform.localScale=n}}}}updateMorphAnim(){if(this._currentBlendAnimClip&&this._currentBlendAnimClip.floatCurves&&this._currentBlendAnimClip.floatCurves.size>0&&this._rendererList)for(const s of this._currentBlendAnimClip.floatCurves){let e=s[0],a=s[1].propertys,i=this._currentBlendAnimClip.floatCurves.get(e).getValue(this._blendShapeTime)/100;this.updateBlendShape(a,e,i)}}updateBlendShape(s,e,t){for(const a of this._rendererList)if(a.blendShape){let r=this.propertyCache.get(a);if(r&&e in r)r[e](t);else{r=a;for(const i of s){if(!r[i]){r=null;break}r=r[i]}if(!r||r==a)continue;this.propertyCache.get(a)||this.propertyCache.set(a,{}),this.propertyCache.get(a)[e]=r,r(t)}}}updateSkeletonAnimMix(s){let e=0;for(let t of s)e+=t.weight;if(s.length>0){let t=this._avatar.boneData,a=t.length;for(let r=0;r<a;r++){const i=t[r];let n=this.skeltonPoseObject3D[i.boneName];if(s[0].clip.useSkeletonPos){this._bonePos.copyFrom(this.getPosition(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonPos){let c=this.getPosition(i.bonePath,this._skeletonTime,l.clip);b.HELP_0.lerp(this._bonePos,c,l.weight/e),this._bonePos.copyFrom(b.HELP_0)}}n.transform.localPosition=this._bonePos}this._boneRot.copyFrom(this.getRotation(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];let c=this.getRotation(i.bonePath,this._skeletonTime,l.clip);se.HELP_2.slerp(this._boneRot,c,l.weight/e),this._boneRot.copyFrom(se.HELP_2)}if(n.transform.localRotQuat=this._boneRot,s[0].clip.useSkeletonScale){this._boneScale.copyFrom(this.getScale(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonScale){let c=this.getScale(i.bonePath,this._skeletonTime,l.clip);b.HELP_0.lerp(this._boneScale,c,l.weight/e),this._boneScale.copyFrom(b.HELP_0)}}n.transform.localScale=this._boneScale}}}}getPosition(s,e,t=this._currentSkeletonClip.clip){return t.positionCurves.has(s)?t.positionCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localPosition}getRotation(s,e,t=this._currentSkeletonClip.clip){if(t.rotationCurves.has(s)){let a=t.rotationCurves.get(s).getValue(e);return se.HELP_0.set(a.x,a.y,a.z,a.w),se.HELP_0}return this.skeltonTPoseObject3D[s].localQuaternion}getScale(s,e,t=this._currentSkeletonClip.clip){return t.scaleCurves.has(s)?t.scaleCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localScale}getAnimationClipState(s){for(let e of this._clipsState)if(e.clip.clipName===s)return e;return null}cloneMorphRenderers(){let s={};for(const e of this._rendererList)for(const t in e.geometry.morphTargetDictionary){let a=s[t]||[];a.push(e),s[t]=a}return s}};er=_g([Ot(er,"AnimatorComponent")],er);class ih{clip;weight=0;get totalTime(){return this.clip.stopTime-this.clip.startTime}constructor(e){this.clip=e}}class Bg{inClip;outClip;currentTime;crossFadeTime;constructor(e,t,a){this.reset(e,t,a)}reset(e,t,a){this.inClip=e,this.outClip=t,this.currentTime=0,this.crossFadeTime=a}update(e){!this.inClip||!this.outClip||(this.currentTime+=e,this.inClip.weight=Math.min(Math.abs(this.currentTime%this.crossFadeTime)/this.crossFadeTime,1),this.outClip.weight=1-this.inClip.weight,Math.abs(this.currentTime)>=this.crossFadeTime&&(this.inClip.weight=1,this.outClip.weight=0,this.inClip=null,this.outClip=null))}}class Lo{index;time;timeEnd;coeff=[]}var Ar=(s=>(s[s.PingPong=0]="PingPong",s[s.Repeat=1]="Repeat",s[s.Clamp=2]="Clamp",s))(Ar||{});class Js{serializedVersion="2";time;value;inSlope=0;outSlope=0;tangentMode=0;weightedMode=0;inWeight;outWeight;constructor(e=0,t=0){this.time=e,this.value=t}unSerialized(e){this.serializedVersion=e.serializedVersion,this.time=e.time,this.value=e.value,this.tangentMode=e.tangentMode,this.inSlope=e.inSlope=="Infinity"?NaN:e.inSlope,this.outSlope=e.outSlope=="Infinity"?NaN:e.outSlope}unSerialized2(e){this.serializedVersion=e.serializedVersion,this.time=e.time,this.value=e.value,this.tangentMode=e.tangentMode,this.inSlope=e.inTangent=="Infinity"?NaN:e.inTangent,this.outSlope=e.outTangent=="Infinity"?NaN:e.outTangent}}class Li{_totalTime=1;_cache=new Lo;_cacheOut={lhsIndex:0,rhsIndex:0};_InvalidateCache=!1;curve=[];serializedVersion;preWarpMode;postWarpMode;rotationOrder;get cacheOut(){return this._cacheOut}constructor(e,t=Ar.Repeat,a=Ar.Repeat){if(e)for(let r=0;r<e.length;r++){const i=e[r];this.addKeyFrame(i)}this.preWarpMode=t,this.postWarpMode=a}get totalTime(){return this._totalTime}get first(){return this.curve[0]}get last(){return this.curve[this.curve.length-1]}addKeyFrame(e){this.curve.indexOf(e)==-1&&this.curve.push(e),this.calcTotalTime()}removeKeyFrame(e){let t=this.curve.indexOf(e);t!=-1&&this.curve.splice(t,1),this.calcTotalTime()}calculateCacheData(e,t,a,r=0){let i=this.curve,n=i[t],o=i[a];e.index=t,e.time=n.time+r,e.timeEnd=o.time+r,e.index=t;let l,c,f,d,h,u,m;l=o.time-n.time,l=Math.max(l,1e-4),f=o.value-n.value,c=1/(l*l),d=n.outSlope,h=o.inSlope,u=d*l,m=h*l,e.coeff[0]=(u+m-f-f)*c/l,e.coeff[1]=(f+f+f-u-u-m)*c,e.coeff[2]=d,e.coeff[3]=n.value,this.setupStepped(e.coeff,n,o)}getValue(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),this.calculateCacheData(this._cache,this._cacheOut.lhsIndex,this._cacheOut.rhsIndex,0),this.evaluateCache(this._cache,e)}getCurveFramesExtent(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),{lhsIndex:this._cacheOut.lhsIndex,rhsIndex:this._cacheOut.rhsIndex,time:e}}getKeyCount(){return this.curve.length}getKey(e){return this.curve[e]}unSerialized(e){this.preWarpMode=e.m_PreInfinity,this.postWarpMode=e.m_PostInfinity,this.rotationOrder=e.m_RotationOrder;let t=e.m_Curve.length;for(let a=0;a<t;a++)this.curve[a]=new Js,this.curve[a].unSerialized(e.m_Curve[a.toString()]);return this.calcTotalTime(),this}unSerialized2(e){this.preWarpMode=e.preWrapMode,this.postWarpMode=e.postWrapMode;let t=e.keyFrames||e.keys,a=t.length;for(let r=0;r<a;r++)this.curve[r]=new Js,this.curve[r].unSerialized2(t[r.toString()]);return this.calcTotalTime(),this}wrapTime(e){let t=this.curve,a=t[0].time,r=t[t.length-1].time;return e<a?this.preWarpMode==Ar.Clamp?e=a:this.preWarpMode==Ar.PingPong?e=In(e,a,r):e=Rn(e,a,r):e>r&&(this.postWarpMode==Ar.Clamp?e=r:this.postWarpMode==Ar.PingPong?e=In(e,a,r):e=Rn(e,a,r)),e}evaluateCache(e,t){let a=t-e.time;return a*(a*(a*e.coeff[0]+e.coeff[1])+e.coeff[2])+e.coeff[3]}findCurve(e,t){let a=this.curve;for(let r=1;r<a.length;r++){let i=a[r-1],n=a[r];i.time<=e&&n.time>e&&(t.lhsIndex=r-1,t.rhsIndex=r)}}setupStepped(e,t,a){(isNaN(t.outSlope)||isNaN(a.inSlope))&&(e[0]=0,e[1]=0,e[2]=0,e[3]=t.value)}invalidateCache(){this._InvalidateCache=!0}calcTotalTime(){let e=0;for(let t of this.curve)t?e=Math.max(e,t.time):console.error(t);this._totalTime=e}static scaleCurveValue(e,t){if(!e._InvalidateCache)for(let a=0;a<e.curve.length;a++){let r=e.curve[a];r.value*=t,r.inSlope*=t,r.outSlope*=t}e.invalidateCache()}}class sh extends Li{attribute="";propertyList;path;constructor(){super()}unSerialized(e){let{attribute:t,path:a}=e;return this.attribute=t,this.path=a,this.propertyList=t.split("."),super.unSerialized(e.curve),this}}class nh{curve={}}var gi=(s=>(s[s.Default=0]="Default",s[s.Clamp=1]="Clamp",s[s.Once=1]="Once",s[s.Loop=2]="Loop",s[s.PingPong=4]="PingPong",s[s.ClampForever=8]="ClampForever",s))(gi||{});class vg{name;objAnimClip;totalTime=0;time=0;_stopTime=0;_loopTime;_wrapMode;_sampleRate;get wrapMode(){return this._wrapMode||(this._wrapMode=0),this._wrapMode}set wrapMode(e){this._wrapMode=e}parse(e){this.objAnimClip={};let t=e.AnimationClip,{m_Name:a,m_AnimationClipSettings:r,m_WrapMode:i,m_SampleRate:n}=t;this.name=a,this._wrapMode=i,this._sampleRate=n,this._loopTime=r.m_LoopTime;for(const o in t.m_EditorCurves)if(Object.prototype.hasOwnProperty.call(t.m_EditorCurves,o)){const l=t.m_EditorCurves[o];let c=l.attribute,f=new sh;f.unSerialized(l),this.totalTime=Math.max(this.totalTime,f.totalTime);let d=this.objAnimClip[l.path];d||(d=new nh,this.objAnimClip[l.path]=d),d.curve[c]=f}}}class oh{transform;quaternion;materialColor}class Gi{static Property={"m_LocalPosition.x":"localPosition.x","m_LocalPosition.y":"localPosition.y","m_LocalPosition.z":"localPosition.z","m_LocalRotation.x":"localQuaternion.x","m_LocalRotation.y":"localQuaternion.y","m_LocalRotation.z":"localQuaternion.z","m_LocalRotation.w":"localQuaternion.w","localEulerAnglesRaw.x":"localRotation.x","localEulerAnglesRaw.y":"localRotation.y","localEulerAnglesRaw.z":"localRotation.z","m_LocalEulerAngles.x":"localRotation.x","m_LocalEulerAngles.y":"localRotation.y","m_LocalEulerAngles.z":"localRotation.z","m_LocalScale.x":"localScale.x","m_LocalScale.y":"localScale.y","m_LocalScale.z":"localScale.z","m_Color.r":"materialColor.r","m_Color.g":"materialColor.g","m_Color.b":"materialColor.b","m_Color.a":"materialColor.a","material._Color.r":"materialColor.r","material._Color.g":"materialColor.g","material._Color.b":"materialColor.b","material._Color.a":"materialColor.a","material._UnlitColor.r":"materialColor.r","material._UnlitColor.g":"materialColor.g","material._UnlitColor.b":"materialColor.b","material._UnlitColor.a":"materialColor.a","field of view":"camera3D.fov",m_IsActive:"active",m_Sprite:"sprite",m_FlipX:"flipX",m_FlipY:"flipY"};static Scale={"m_LocalPosition.x":1,"m_LocalPosition.y":1,"m_LocalPosition.z":-1,"localEulerAnglesRaw.x":-1,"localEulerAnglesRaw.y":1,"localEulerAnglesRaw.z":1,"m_LocalEulerAngles.x":-1,"m_LocalEulerAngles.y":1,"m_LocalEulerAngles.z":1,"m_LocalRotation.x":1,"m_LocalRotation.y":1,"m_LocalRotation.z":-1,"m_LocalRotation.w":-1,"field of view":1,m_IsActive:1,m_Sprite:1};static updatePropertyTag(e,t){e.quaternion||=this.tag_quaternion[t],e.transform||=this.tag_transform[t],e.materialColor||=this.tag_materialColor[t]}static tag_quaternion={"m_LocalRotation.x":!0,"m_LocalRotation.y":!0,"m_LocalRotation.z":!0,"m_LocalRotation.w":!0};static tag_materialColor={"material._Color.r":!0,"material._Color.g":!0,"material._Color.b":!0,"material._Color.a":!0,"material._UnlitColor.r":!0,"material._UnlitColor.g":!0,"material._UnlitColor.b":!0,"material._UnlitColor.a":!0};static tag_transform={"m_LocalPosition.x":!0,"m_LocalPosition.y":!0,"m_LocalPosition.z":!0,"m_LocalRotation.x":!0,"m_LocalRotation.y":!0,"m_LocalRotation.z":!0,"m_LocalRotation.w":!0,"localEulerAnglesRaw.x":!0,"localEulerAnglesRaw.y":!0,"localEulerAnglesRaw.z":!0,"m_LocalEulerAngles.x":!0,"m_LocalEulerAngles.y":!0,"m_LocalEulerAngles.z":!0,"m_LocalScale.x":!0,"m_LocalScale.y":!0,"m_LocalScale.z":!0}}class Yr{static Complete=0;static Seek=1;_rootObject3D;_animation;_propertyCache;_currentClip;_frame=0;_time=0;_isPlaying=!0;speed=1;_propertyTagDic;constructor(e){this._rootObject3D=e.object3D,this._animation=e,this._propertyTagDic=new Map,this.reset()}reset(){this._propertyCache={},this._propertyTagDic.clear()}get time(){return this._time}get currentClip(){return this._currentClip}play(e,t=!0){this._isPlaying=!0,t&&(this._time=0),e!=this._currentClip&&e&&this.parseAnimClip(e),this._currentClip=e,this.validProperty()}parseAnimClip(e){this.reset();for(const t in e.objAnimClip){let a=e.objAnimClip[t],r=this._rootObject3D,i={};if(t==""?r=this._rootObject3D:r=this._rootObject3D.getObjectByName(t),!r)continue;let n=new oh;this._propertyTagDic.set(r,n);let o=a.curve;for(const l in o){Gi.updatePropertyTag(n,l);let c=this._propertyCache[t]||={},f=Gi.Property[l].split("."),d=f[0];if(f.length>1){let h=i[d];h||(h=i[d]=r[d]),c[l]={value:h,property:f[1]}}else c[l]={value:r,property:f[0]}}}return this}stop(){return this._isPlaying=!1,this}toggle(){return this._isPlaying=!this._isPlaying,this}get isPlaying(){return this._isPlaying}update(e,t){if(e=e*.001,t=t*.001,!this._currentClip||this._frame==e||!this._isPlaying)return;this._frame=e;let a=this._time;this._time=this.calcTime(a+t*this.speed),this.validProperty(),this._currentClip.wrapMode!=gi.Loop&&this._currentClip.wrapMode!=gi.Default&&(this.speed>0?this._time>=this._currentClip.totalTime:this._time<=0)&&(this._isPlaying=!1,this._animation.statusCall(Yr.Complete,a,this._time)),this._animation.statusCall(Yr.Seek,a,this._time)}seek(e){return this._time=this.calcTime(e),this._rootObject3D&&this.validProperty(),this}calcTime(e){return this._currentClip.wrapMode==gi.Loop||this._currentClip.wrapMode==gi.Default?e=Pn(e,this._currentClip.totalTime):e=Be(e,0,this._currentClip.totalTime),e}validProperty(){for(const e in this._currentClip.objAnimClip){let a=this._currentClip.objAnimClip[e].curve;for(const r in a){const i=a[r];let n=this._propertyCache[e][r],o=i.getValue(this._time);r in Gi.Scale&&(o*=Gi.Scale[r]),n.value[n.property]=o}}this._propertyTagDic.forEach((e,t)=>{this.applyProperty(e,t)})}applyProperty(e,t){e.quaternion&&R.getEuler(t.transform.localRotation,t.transform.localRotQuat,!0,"ZYX"),e.transform&&(t.transform.localPosition=t.transform.localPosition,t.transform.localRotation=t.transform.localRotation,t.transform.localScale=t.transform.localScale);let a=t;e.materialColor&&a.notifyMaterialColorChange(0,"baseColor")}}class xg{clipName;data;time}class zi extends pt{static SEEK="SEEK";static COMPLETE="COMPLETE";animation;frame;constructor(e,t){super(t),this.animation=e}}class ul extends et{_animator;_clips=[];defaultClip;autoPlay;_seekEvent;_completeEvent;_keyFrameList;constructor(){super(),this._seekEvent=new zi(this,zi.SEEK),this._completeEvent=new zi(this,zi.COMPLETE),this._keyFrameList={}}registerEventKeyFrame(e){let t=this._keyFrameList[e.clipName];t==null&&(this._keyFrameList[e.clipName]=t=[]),t.push(e)}init(){this._animator=new Yr(this)}onUpdate(){this.enable&&this._animator.update(We.time,We.delta)}appendClip(e){this._clips.push(e),this.play(e.name)}statusCall(e,t,a){if(e==Yr.Complete)this.eventDispatcher.dispatchEvent(this._completeEvent);else if(e==Yr.Seek&&t!=a){let r=this._keyFrameList[this.currentClip.name];if(r)for(let i of r)i.time>t&&i.time<=a&&(this._seekEvent.data=this._seekEvent.frame=i,this.eventDispatcher.dispatchEvent(this._seekEvent))}}set speed(e){this._animator.speed=e}get speed(){return this._animator.speed}stop(){this._animator.stop()}toggle(){this._animator.toggle()}getClip(e){let t;for(let a of this._clips)if(a.name==e){t=a;break}return t}get currentClip(){return this._animator.currentClip}get time(){return this._animator.time}seek(e){this._animator.seek(e)}play(e,t=!0){let a=this.getClip(e);return a?(this._animator.play(a,t),a):null}start(){this.autoPlay&&this.play(this.defaultClip)}copyComponent(e){this.autoPlay=e.autoPlay,this.defaultClip=e.defaultClip;let t=e._clips;for(let a=0,r=t.length;a<r;a++)this.appendClip(t[a]);return this}cloneTo(e){e.addComponent(ul).copyComponent(this)}}var Ug=Object.getOwnPropertyDescriptor,yg=(s,e,t,a)=>{for(var r=a>1?void 0:a?Ug(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Dr=class extends he{skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Ne.SkinnedMesh)}get geometry(){return this._geometry}set geometry(s){this.skinJointsName=s.skinNames;let e=[];for(let t=0;t<s.bindPose.length;t++)e.push(new Float32Array(s.bindPose[t].rawData.slice(0,16)));this.skinInverseBindMatrices=e,super.geometry=s}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(er),!this.skeletonAnimation){let s=this.object3D.parentObject.parentObject.getComponentsInChild(er);s.length>0&&(this.skeletonAnimation=s[0]);let e=this.object3D;for(;!this.skeletonAnimation&&e;)this.skeletonAnimation=e.getComponentFromParent(er),e.parent&&(e=e.parent.object3D)}}get blendShape(){return this.morphData}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(s){if(this.mSkeletonAnimation=s,!!s&&!this.mJointIndexTableBuffer){let e=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new Pe(e.length,0,new Float32Array(e)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(s){this.mInverseBindMatrixData=s;var e=new Float32Array(s.length*16);for(let t=0;t<s.length;t++){let a=t*16,r=s[t];e.set(r,a)}this.mInverseBindMatrixBuffer=new Pe(e.byteLength,0,e),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(s){let e=s.addComponent(Dr),t=[];for(const a of this.materials)t.push(a.clone());e.materials=t,e.geometry=this.geometry,e.castShadow=this.castShadow,e.castGI=this.castGI,e.receiveShadow=this.receiveShadow,e.rendererMask=this.rendererMask,e.skinJointsName=this.skinJointsName,e.skinInverseBindMatrices=this.skinInverseBindMatrices,e.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(s,e,t,a){for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++){const l=n[o];!l.pipeline&&this.mSkeletonAnimation&&(l.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),l.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),l.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(s,e,t,a)}};Dr=yg([Ot(Dr,"SkinnedMeshRenderer2")],Dr);class Cg extends et{_targetRenderers={};_vec3=new b;_matrix4=new R;_quaternion=new se;init(e){let t=this.fetchMorphRenderers(this.object3D,Dr),a=this.fetchMorphRenderers(this.object3D,he);t.push(...a);for(const r of t){ia.hasMask(r.rendererMask,Ne.MorphTarget)&&r.selfCloneMaterials("MORPH_TARGET_UUID");for(const n in r.geometry.morphTargetDictionary){let o=this._targetRenderers[n]||[];o.push(r),this._targetRenderers[n]=o}}}getMorphRenderersByKey(e){return this._targetRenderers[e]}cloneMorphRenderers(){let e={};for(let t in this._targetRenderers)e[t]=this._targetRenderers[t];return e}applyBlendShape(e,t,a=1){if(!e){console.warn("blendShape is null");return}this._vec3.setFromArray(e.transform.transform[3]),this._vec3.multiplyScalar(a),this.object3D.transform.localPosition=this._vec3,this._vec3.setFromArray(e.transform.transform[2]),this._matrix4.copyColFrom(2,this._vec3),this._vec3.setFromArray(e.transform.transform[1]),this._matrix4.copyColFrom(1,this._vec3),this._vec3.setFromArray(e.transform.transform[0]),this._matrix4.copyColFrom(0,this._vec3),this._matrix4.transpose(),this._quaternion.fromMatrix(this._matrix4),this.object3D.localQuaternion=this._quaternion;for(let r in t){let i=this._targetRenderers[r],n=t[r],o=e.texture[n];this.applyMorphTargetInfluence(r,o,i)}}applyMorphTargetInfluence(e,t,a){for(let r of a)r.setMorphInfluence(e,t)}fetchMorphRenderers(e,t){let a=e.getComponentsInChild(t),r=[];for(let i of a)i.hasMask(Ne.MorphTarget)&&r.push(i);return r}}class Sg{texture;transform}var lh=(s=>(s.mouthRollLower="mouthRollLower",s.browOuterUp_L="browOuterUpLeft",s.mouthSmile_L="mouthSmileLeft",s.jawRight="jawRight",s.eyeLookOut_L="eyeLookOutLeft",s.mouthFunnel="mouthFunnel",s.mouthUpperUp_R="mouthUpperUpRight",s.browDown_L="browDownLeft",s.jawLeft="jawLeft",s.mouthLowerDown_L="mouthLowerDownLeft",s.noseSneer_R="noseSneerRight",s.jawForward="jawForward",s.mouthLowerDown_R="mouthLowerDownRight",s.browInnerUp="browInnerUp",s.mouthRollUpper="mouthRollUpper",s.mouthStretch_R="mouthStretchRight",s.mouthPucker="mouthPucker",s.eyeBlink_L="eyeBlinkLeft",s.mouthUpperUp_L="mouthUpperUpLeft",s.mouthShrugUpper="mouthShrugUpper",s.eyeLookIn_R="eyeLookInRight",s.noseSneer_L="noseSneerLeft",s.mouthFrown_L="mouthFrownLeft",s.cheekSquint_L="cheekSquintLeft",s.eyeLookDown_L="eyeLookDownLeft",s.mouthDimple_L="mouthDimpleLeft",s.mouthFrown_R="mouthFrownRight",s.eyeLookIn_L="eyeLookInLeft",s.eyeLookOut_R="eyeLookOutRight",s.mouthLeft="mouthLeft",s.mouthStretch_L="mouthStretchLeft",s.mouthPress_L="mouthPressLeft",s.mouthDimple_R="mouthDimpleRight",s.eyeWide_R="eyeWideRight",s.browDown_R="browDownRight",s.eyeLookUp_R="eyeLookUpRight",s.eyeBlink_R="eyeBlinkRight",s.cheekSquint_R="cheekSquintRight",s.mouthRight="mouthDimpleRight",s.eyeLookDown_R="eyeLookDownRight",s.eyeLookUp_L="eyeLookUpLeft",s.eyeSquint_L="eyeSquintLeft",s.jawOpen="jawOpen",s.browOuterUp_R="browOuterUpRight",s.mouthClose="mouthClose",s.mouthShrugLower="mouthShrugLower",s.eyeWide_L="eyeWideLeft",s.tongueOut="tongueOut",s.eyeSquint_R="eyeSquintRight",s.cheekPuff="cheekPuff",s.mouthPress_R="mouthPressRight",s.mouthSmile_R="mouthSmileRight",s))(lh||{});class Fg{joints;constructor(e=[]){this.joints=e}get numJoint(){return this.joints.length}addJoint(e){e.index=this.joints.push(e)-1}getJointName(e){return this.joints[e].name}getJointParentIndex(e){let t=this.joints[e];return t.parent?t.parent.index:-1}getJointByName(e){for(let t of this.joints)if(t.name==e)return t;return null}}class kg{_computePipeline;_computeBindGroup;constructor(e,t){let a=I.device;this._computePipeline=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:e}),entryPoint:"CsMain"}}),this._computeBindGroup=a.createBindGroup({layout:this._computePipeline.getBindGroupLayout(0),entries:t})}compute(e,t,a,r){let i=e.beginComputePass();return i.setPipeline(this._computePipeline),i.setBindGroup(0,this._computeBindGroup),i.dispatchWorkgroups(t,a,r),i.end(),this}}class Eg extends cr{numJoint;numState;time;weight;argumentsData;_isDirty=!1;_argumentsBuffer;_argumentsBufferEntries;constructor(){super(),this.allocationMemorySet([{name:"numJoint",data:[0]},{name:"numState",data:[0]},{name:"retain1",data:[0]},{name:"retain2",data:[0]},{name:"time",data:[0,0]},{name:"weight",data:[0,0]}]),this.generateGPUBuffer()}getGPUBuffer(){return this._argumentsBuffer}getGPUBindGroupEntry(){return this._argumentsBufferEntries}updateGPUBuffer(){return this._isDirty&&(this._isDirty=!1,I.device.queue.writeBuffer(this._argumentsBuffer,0,this.shareDataBuffer)),this}allocationMemorySet(e){this.argumentsData={};let t=0;for(let a=0;a<e.length;a++){const r=e[a];t+=r.data.length}this.allocation(t*4);for(let a=0;a<e.length;a++){const r=e[a],i=r.name;this.argumentsData[i]=this.allocation_node(r.data.length*4)}}generateGPUBuffer(){let e=I.device;this._argumentsBuffer=e.createBuffer({size:this.shareDataBuffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,mappedAtCreation:!1}),this._argumentsBufferEntries={binding:0,resource:{buffer:this._argumentsBuffer,offset:0,size:this.shareDataBuffer.byteLength}}}}class wg extends cr{numJoint;numFrame;retain0;retain1;argumentsData;_isDirty=!1;_argumentsBuffer;_argumentsBufferEntries;constructor(){super(),this.allocationMemorySet([{name:"numJoint",data:[0]},{name:"numFrame",data:[0]},{name:"retain0",data:[0]},{name:"retain1",data:[0]}]),this.generateGPUBuffer()}getGPUBuffer(){return this._argumentsBuffer}getGPUBindGroupEntry(){return this._argumentsBufferEntries}updateGPUBuffer(){this._isDirty&&(this._isDirty=!1,I.device.queue.writeBuffer(this._argumentsBuffer,0,this.shareDataBuffer))}allocationMemorySet(e){this.argumentsData={};let t=0;for(let r=0;r<e.length;r++){const i=e[r];t+=i.data.length}this.allocation(t*4);let a=this;for(let r=0;r<e.length;r++){const i=e[r],n=i.name;this.argumentsData[n]=this.allocation_node(i.data.length*4),a[n]=this.argumentsData[n]}}generateGPUBuffer(){let e=I.device;this._argumentsBuffer=e.createBuffer({size:this.shareDataBuffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,mappedAtCreation:!1}),this._argumentsBufferEntries={binding:0,resource:{buffer:this._argumentsBuffer,offset:0,size:this.shareDataBuffer.byteLength}}}}class Ig{_autoUpdate=!0;_target;_lookAtObject;_origin=new b(0,0,0);_speed=300;constructor(e=null,t=null){this._target=e,this._lookAtObject=t}get target(){return this._target}set target(e){this._target!=e&&(this._target=e)}get lookAtObject(){return this._lookAtObject}set lookAtObject(e){this._lookAtObject!=e&&(this._lookAtObject=e)}get speed(){return this._speed}set speed(e){this._speed=e}update(){}}class Rg extends et{focus;distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(ti),!this._camera){console.error("FirstPersonCameraController need camera");return}if(!this.focus){console.error("FirstPersonCameraController need target");return}_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){_.inputSystem.addEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){let t=this.transform.localRotation;t.y+=e.movementX*.01,t.x+=e.movementY*.01,this.transform.localRotation=t}mouseWheel(e){this.distance+=_.inputSystem.wheelDelta*.1}onUpdate(){let e=new b;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var tt=(s=>(s[s.Key_BackSpace=8]="Key_BackSpace",s[s.Key_Tab=9]="Key_Tab",s[s.Key_Clear=12]="Key_Clear",s[s.Key_Enter=13]="Key_Enter",s[s.Key_Shift_L=16]="Key_Shift_L",s[s.Key_Control_L=17]="Key_Control_L",s[s.Key_Alt_L=18]="Key_Alt_L",s[s.Key_Pause=19]="Key_Pause",s[s.Key_CapsLock=20]="Key_CapsLock",s[s.Key_Escape=21]="Key_Escape",s[s.Key_Esc=27]="Key_Esc",s[s.Key_Space=32]="Key_Space",s[s.Key_Prior=33]="Key_Prior",s[s.Key_Next=34]="Key_Next",s[s.Key_End=35]="Key_End",s[s.Key_Home=36]="Key_Home",s[s.Key_Left=37]="Key_Left",s[s.Key_Up=38]="Key_Up",s[s.Key_Right=39]="Key_Right",s[s.Key_Down=40]="Key_Down",s[s.Key_Select=41]="Key_Select",s[s.Key_Print=42]="Key_Print",s[s.Key_Execute=43]="Key_Execute",s[s.Key_Insert=45]="Key_Insert",s[s.Key_Delete=46]="Key_Delete",s[s.Key_Help=47]="Key_Help",s[s.Key_0=48]="Key_0",s[s.Key_1=49]="Key_1",s[s.Key_2=50]="Key_2",s[s.Key_3=51]="Key_3",s[s.Key_4=52]="Key_4",s[s.Key_5=53]="Key_5",s[s.Key_6=54]="Key_6",s[s.Key_7=55]="Key_7",s[s.Key_8=56]="Key_8",s[s.Key_9=57]="Key_9",s[s.Key_A=65]="Key_A",s[s.Key_B=66]="Key_B",s[s.Key_C=67]="Key_C",s[s.Key_D=68]="Key_D",s[s.Key_E=69]="Key_E",s[s.Key_F=70]="Key_F",s[s.Key_G=71]="Key_G",s[s.Key_H=72]="Key_H",s[s.Key_I=73]="Key_I",s[s.Key_J=74]="Key_J",s[s.Key_K=75]="Key_K",s[s.Key_L=76]="Key_L",s[s.Key_M=77]="Key_M",s[s.Key_N=78]="Key_N",s[s.Key_O=79]="Key_O",s[s.Key_P=80]="Key_P",s[s.Key_Q=81]="Key_Q",s[s.Key_R=82]="Key_R",s[s.Key_S=83]="Key_S",s[s.Key_T=84]="Key_T",s[s.Key_U=85]="Key_U",s[s.Key_V=86]="Key_V",s[s.Key_W=87]="Key_W",s[s.Key_X=88]="Key_X",s[s.Key_Y=89]="Key_Y",s[s.Key_Z=90]="Key_Z",s[s.Key_KP_0=96]="Key_KP_0",s[s.Key_KP_1=97]="Key_KP_1",s[s.Key_KP_2=98]="Key_KP_2",s[s.Key_KP_3=99]="Key_KP_3",s[s.Key_KP_4=100]="Key_KP_4",s[s.Key_KP_5=101]="Key_KP_5",s[s.Key_KP_6=102]="Key_KP_6",s[s.Key_KP_7=103]="Key_KP_7",s[s.Key_KP_8=104]="Key_KP_8",s[s.Key_KP_9=105]="Key_KP_9",s[s.Key_Multiply=106]="Key_Multiply",s[s.Key_Add=107]="Key_Add",s[s.Key_Separator=108]="Key_Separator",s[s.Key_Subtract=109]="Key_Subtract",s[s.Key_Decimal=110]="Key_Decimal",s[s.Key_Divide=111]="Key_Divide",s[s.Key_F1=112]="Key_F1",s[s.Key_F2=113]="Key_F2",s[s.Key_F3=114]="Key_F3",s[s.Key_F4=115]="Key_F4",s[s.Key_F5=116]="Key_F5",s[s.Key_F6=117]="Key_F6",s[s.Key_F7=118]="Key_F7",s[s.Key_F8=119]="Key_F8",s[s.Key_F9=120]="Key_F9",s[s.Key_F10=121]="Key_F10",s[s.Key_F11=122]="Key_F11",s[s.Key_F12=123]="Key_F12",s[s.Key_F13=124]="Key_F13",s[s.Key_F14=125]="Key_F14",s[s.Key_F15=126]="Key_F15",s[s.Key_F16=127]="Key_F16",s[s.Key_F17=128]="Key_F17",s[s.Key_F18=129]="Key_F18",s[s.Key_F19=130]="Key_F19",s[s.Key_F20=131]="Key_F20",s[s.Key_F21=132]="Key_F21",s[s.Key_F22=133]="Key_F22",s[s.Key_F23=134]="Key_F23",s[s.Key_F24=135]="Key_F24",s[s.Key_Num_Lock=136]="Key_Num_Lock",s[s.Key_Scroll_Lock=137]="Key_Scroll_Lock",s))(tt||{});class Qg extends et{moveSpeed=2;targetPos=new b(0,0,10);lookAtPos=new b(0,0,0);config={shiftMoveScale:20};_moveScale=1;_dir;_mouseFactory=25;_factory=1.5;_mouseDown=!1;_lastPos;_keyState;constructor(){super(),this._lastPos=new b,this._keyState={front:!1,back:!1,left:!1,right:!1,q:!1,e:!1},this.setCamera(new b(0,0,100),new b(0,0,0))}setCamera(e,t){this.targetPos.copyFrom(e),this.lookAtPos.copyFrom(t),this.Reset()}start(){_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.mouseDown,this),_.inputSystem.addEventListener(Ma.KEY_UP,this.keyUp,this),_.inputSystem.addEventListener(Ma.KEY_DOWN,this.keyDown,this),this.transform.lookAt(this.targetPos,this.lookAtPos)}mouseWheel(e){}keyUp(e){switch(e.keyCode){case tt.Key_W:this._keyState.front=!1;break;case tt.Key_S:this._keyState.back=!1;break;case tt.Key_A:this._keyState.left=!1;break;case tt.Key_D:this._keyState.right=!1;break;case tt.Key_Shift_L:this._moveScale=1;break;case tt.Key_Q:this._keyState.q=!1;break;case tt.Key_E:this._keyState.e=!1;break;case tt.Key_F:this.transform.lookAt(this.targetPos,this.lookAtPos);break}}keyDown(e){switch(e.keyCode){case tt.Key_W:this._keyState.front=!0;break;case tt.Key_S:this._keyState.back=!0;break;case tt.Key_A:this._keyState.left=!0;break;case tt.Key_D:this._keyState.right=!0;break;case tt.Key_Q:this._keyState.q=!0;break;case tt.Key_E:this._keyState.e=!0;break;case tt.Key_Shift_L:this._moveScale=this.config.shiftMoveScale}}Reset(){this._lastPos.x=_.inputSystem.mouseLastX,this._lastPos.y=_.inputSystem.mouseLastY}mouseDown(e){this.Reset(),this._mouseDown=!0}mouseUp(e){this.Reset(),this._mouseDown=!1}get factory(){return this._factory}set factory(e){this._factory=e}get mouseFactory(){return this._mouseFactory}set mouseFactory(e){this._mouseFactory=e}internal(e,t,a){return(t-e)*a}onUpdate(){let e=this.transform,t=Be(We.delta,0,.016);if(this._mouseDown&&(e.rotationY-=this.internal(e.rotationY+(_.inputSystem.mouseLastX-this._lastPos.x)*.25,e.rotationY,t*this._mouseFactory),e.rotationX-=this.internal(e.rotationX+(_.inputSystem.mouseLastY-this._lastPos.y)*.25,e.rotationX,t*this._mouseFactory),this.Reset()),this._keyState.front){let a=e.forward;e.x-=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y-=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z-=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}if(this._keyState.back){let a=e.forward;e.x+=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y+=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z+=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}if(this._keyState.left){let a=e.left;e.x+=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y+=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z+=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}if(this._keyState.right){let a=e.left;e.x-=this.internal(e.x+a.x*this.moveSpeed*this._moveScale,e.x,t*this._factory),e.y-=this.internal(e.y+a.y*this.moveSpeed*this._moveScale,e.y,t*this._factory),e.z-=this.internal(e.z+a.z*this.moveSpeed*this._moveScale,e.z,t*this._factory)}this._keyState.q&&(e.y=Mr(e.y,e.y-this.moveSpeed*this._moveScale,t*this._factory)),this._keyState.e&&(e.y=Mr(e.y,e.y+this.moveSpeed*this._moveScale,t*this._factory))}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.mouseDown,this),_.inputSystem.removeEventListener(Ma.KEY_UP,this.keyUp,this),_.inputSystem.removeEventListener(Ma.KEY_DOWN,this.keyDown,this),super.destroy(e)}}class Wi{static add(e,t,a){return a||(a=new b),a.x=e.x+t.x,a.y=e.y+t.y,a.z=e.z+t.z,a}static sub(e,t,a){return a||(a=new b),a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}static mul(e,t,a){return a||(a=new b),a.x=e.x*t.x,a.y=e.y*t.y,a.z=e.z*t.z,a}static mulScale(e,t,a){return a||(a=new b),a.x=e.x*t,a.y=e.y*t,a.z=e.z*t,a}static div(e,t,a){return a||(a=new b),a.x=e.x/t.x,a.y=e.y/t.y,a.z=e.z/t.z,a}static normalize(e){return e.clone().normalize()}static dot(e,t){let a=b.HELP_0;return a.copyFrom(e),a.dotProduct(t)}static calculateVectorAngle_xz(e,t){return Math.acos((e.x*t.x+e.y*t.y)/Math.sqrt((e.x*e.x+e.y*e.y)*(t.x*t.x+t.y*t.y)))}static distance(e,t){return b.distance(e,t)}static getRandomXYZ(e=-100,t=100){return new b(Math.random()*(t-e)+e,Math.random()*(t-e)+e,Math.random()*(t-e)+e)}static getRandomV3(e=-100,t=100,a,r){return new b(Math.random()*t+e,Math.random()*r+a,Math.random()*t+e)}static sphere(e){let t=e*Math.random(),a=new b(Math.random()*1-.5,Math.random()*1-.5,Math.random()*1-.5);return a.normalize(),a.scaleBy(t),a}static sphereXYZ(e,t,a=1,r=1,i=1){let n=e+(t-e)*Math.random(),o=new b(Math.random()*a-a*.5,Math.random()*r-r*.5,Math.random()*i-i*.5);return o.normalize(),o.scaleBy(n),o}}class Tg extends et{camera;minDistance=.1;maxDistance=500;rollSmooth=15;dragSmooth=20;wheelSmooth=10;wheelStep=.002;mouseRightFactor=.25;mouseLeftFactor=20;smooth=!0;_wheelStep=.002;_distance=0;distance=10;_roll=0;roll=0;_pitch=0;pitch=0;_currentPos;_targetPos;_flowTarget;_flowOffset;_mouseLeftDown=!1;_mouseRightDown=!1;_bottomClamp=89.99;_topClamp=-89.99;get bottomClamp(){return this._bottomClamp}set bottomClamp(e){this._bottomClamp=e>89.99?89.99:e}get topClamp(){return this._topClamp}set topClamp(e){this._topClamp=e<-89.99?-89.99:e}_tempDir=new b;_tempPos=new b;constructor(){super(),this._currentPos=new ne,this._targetPos=new ne}start(){this.camera=this.object3D.getOrAddComponent(ti),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onMouseDown,this),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onMouseMove,this,null,10),_.inputSystem.addEventListener(Z.POINTER_UP,this.onMouseUp,this,null,10),_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.onMouseWheel,this)}flowTarget(e,t=b.ZERO){this._flowTarget=e,this._flowOffset||=new b,this._flowOffset.copyFrom(t)}getFlowTarget(){return this._flowTarget}setCamera(e,t,a,r){this.roll=e,this.pitch=t,this.distance=a,this.maxDistance<a*1.5&&(this.maxDistance=a*1.5),r&&this._targetPos.transform.localPosition.copy(r)}focusByBounds(e){let t=qn.genMeshBounds(e);this.focusBound(t)}focusBound(e){this.target=e.center}set target(e){this._targetPos.transform.localPosition.copy(e)}get target(){return this._targetPos.transform.localPosition}onMouseWheel(e){this.enable&&(this._wheelStep=this.wheelStep*Wi.distance(this._currentPos.transform.worldPosition,this.camera.transform.worldPosition)/10,this.distance-=_.inputSystem.wheelDelta*this._wheelStep,this.distance=Be(this.distance,this.minDistance,this.maxDistance))}onMouseDown(e){if(this.enable)switch(e.mouseCode){case 0:this._mouseLeftDown=!0;break;case 1:break;case 2:this._mouseRightDown=!0;break}}onMouseUp(e){this._mouseLeftDown=!1,this._mouseRightDown=!1}onMouseMove(e){this.enable&&(this._mouseRightDown&&(b.HELP_1.x=-1*e.movementX*Math.cos(this._roll*Math.PI/180)-e.movementY*Math.sin(this._roll*Math.PI/180),b.HELP_1.z=-1*e.movementY*Math.cos(this._roll*Math.PI/180)+e.movementX*Math.sin(this._roll*Math.PI/180),this._targetPos.x+=b.HELP_1.x*this.mouseRightFactor,this._targetPos.z+=b.HELP_1.z*this.mouseRightFactor),this._mouseLeftDown&&(this.roll-=e.movementX*We.delta*.001*this.mouseLeftFactor,this.pitch-=e.movementY*We.delta*.001*this.mouseLeftFactor,this.pitch=Be(this.pitch,this._topClamp,this._bottomClamp)))}onBeforeUpdate(e){if(!this.enable)return;this._flowTarget&&(b.HELP_0.copyFrom(this._flowTarget.transform.worldPosition),b.HELP_0.add(this._flowOffset,b.HELP_0),this.target=b.HELP_0);let t=Be(We.delta,0,.016);this.smooth?(this._currentPos.x+=(this._targetPos.x-this._currentPos.x)*t*this.dragSmooth,this._currentPos.y+=(this._targetPos.y-this._currentPos.y)*t*this.dragSmooth,this._currentPos.z+=(this._targetPos.z-this._currentPos.z)*t*this.dragSmooth,this._distance+=(this.distance-this._distance)*t*this.wheelSmooth,this._roll+=(this.roll-this._roll)*t*this.rollSmooth,this._pitch+=(this.pitch-this._pitch)*t*this.rollSmooth):(this._currentPos.x=this._targetPos.x,this._currentPos.y=this._targetPos.y,this._currentPos.z=this._targetPos.z,this._distance=this.distance,this._roll=this.roll,this._pitch=this.pitch),this._tempDir.set(0,0,1);let a=se.HELP_0;a.fromEulerAngles(this._pitch,this._roll,0),this._tempDir.applyQuaternion(a),this._tempPos=Wi.mulScale(this._tempDir,this._distance,this._tempPos),this._tempPos.add(this._currentPos.transform.localPosition,this._tempPos),this.camera.lookAt(this._tempPos,this._currentPos.transform.localPosition,b.UP)}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.onMouseDown,this),_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.onMouseMove,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.onMouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.onMouseWheel,this),super.destroy(e),this.camera=null,this._flowTarget=null}}class Mg extends et{_camera;autoRotate=!1;autoRotateSpeed=.1;rotateFactor=.5;zoomFactor=.1;panFactor=.25;_smooth=5;_minDistance=1;_maxDistance=1e5;_maxPolarAngle=90;_minPolarAngle=-90;_target=new b(0,0,0);_cTarget=new b(0,0,0);_position=new b(0,0,0);_cPosition=new b(0,0,0);_spherical=new Ng;_isMouseDown=!1;_lastMouseX=-1;_lastMouseY=-1;_isPanning=!1;constructor(){super()}get target(){return this._target}set target(e){this._target=e}get smooth(){return this._smooth}set smooth(e){this._smooth=Math.max(e,1)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance=Be(e,2e-6,this._maxDistance)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance=Be(e,this._minDistance,1/0)}get minPolarAngle(){return this._minPolarAngle}set minPolarAngle(e){this._minPolarAngle=Be(e,-90,this._maxPolarAngle)}get maxPolarAngle(){return this._maxPolarAngle}set maxPolarAngle(e){this._maxPolarAngle=Be(e,this._minPolarAngle,90)}get spherical(){return this._spherical}start(){this._camera=this.object3D.getComponent(ti),this._position=this.object3D.transform.localPosition.clone(),this._cPosition=this._position.clone(),this._target=this._camera.lookTarget.clone(),this._cTarget=this._target.clone(),this._spherical.setCoords(this._position.x-this._target.x,this._position.y-this._target.y,this._position.z-this._target.z),this._camera.lookAt(this._cPosition,this._cTarget,b.UP),this.addEventListener()}onEnable(){this.addEventListener()}onDisable(){this.removeEventListener()}onUpdate(){let e=this._isPanning?1:this.smooth,t=!1;this._cPosition.equals(this.object3D.transform.localPosition)||(this._position.copyFrom(this.object3D.transform.localPosition),e=1,t=!0),this._cTarget.equals(this._target)||(this._cTarget.copyFrom(this._target),e=1,t=!0),t?this._spherical.setCoords(this._position.x-this._target.x,this._position.y-this._target.y,this._position.z-this._target.z):!this._isMouseDown&&this.autoRotate&&(this._spherical.theta-=this.autoRotateSpeed*Math.PI/180,this.updateCamera());let a=(this._position.x-this._cPosition.x)/e,r=(this._position.y-this._cPosition.y)/e,i=(this._position.z-this._cPosition.z)/e;this._cPosition.x=Math.abs(a)>1e-10?this._cPosition.x+a:this._position.x,this._cPosition.y=Math.abs(r)>1e-10?this._cPosition.y+r:this._position.y,this._cPosition.z=Math.abs(i)>1e-10?this._cPosition.z+i:this._position.z,this._camera.lookAt(this._cPosition,this._cTarget,b.UP)}onWheel(e){e.deltaY=Be(e.deltaY,-this._spherical.radius,this._spherical.radius),this._spherical.radius+=e.deltaY*this.zoomFactor,this._spherical.radius=Be(this._spherical.radius,this.minDistance,this.maxDistance),this.updateCamera()}onPointerDown(e){this._isMouseDown=!0,this._lastMouseX=e.mouseX,this._lastMouseY=e.mouseY,e.mouseCode===2&&(this._isPanning=!0)}onPointerMove(e){if(!this._isMouseDown||!this.enable)return;let t=e.mouseX,a=e.mouseY;if(e.mouseCode===0&&this._lastMouseX>0&&this._lastMouseY>0){const r=-(t-this._lastMouseX)*this.rotateFactor,i=(a-this._lastMouseY)*this.rotateFactor;this._spherical.theta+=r*Math.PI/180,this._spherical.phi-=i*Math.PI/180,this._spherical.phi=Be(this._spherical.phi,this.minPolarAngle,this.maxPolarAngle),this.updateCamera()}else e.mouseCode===2&&(Wi.mulScale(this.object3D.transform.up,e.movementY*this.panFactor*this._camera.aspect,b.HELP_1),e.ctrlKey||e.metaKey?this._target.y+=b.HELP_1.y:(this._target.x+=b.HELP_1.x,this._target.z+=b.HELP_1.z),Wi.mulScale(this.object3D.transform.right,-e.movementX*this.panFactor,b.HELP_1),this._target.x-=b.HELP_1.x,this._target.z-=b.HELP_1.z,this._cTarget.copyFrom(this._target),this.updateCamera());this._lastMouseX=t,this._lastMouseY=a}onPointerUp(e){this._isMouseDown=!1,e.mouseCode===2&&(this._isPanning=!1)}updateCamera(){this._spherical.makeSafe();let e=this._spherical.getCoords();this._position.set(e.x+this._target.x,e.y+this._target.y,e.z+this._target.z)}addEventListener(){_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.onWheel,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onPointerDown,this),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onPointerMove,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.onPointerUp,this)}removeEventListener(){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.onWheel,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.onPointerDown,this),_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.onPointerMove,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.onPointerUp,this)}}const ch=Math.PI/180/100;class Ng{radius;phi;theta;coords;constructor(e=1,t=0,a=0){return this.radius=e,this.phi=t,this.theta=a,this.coords=new b,this}set(e,t,a){return this.radius=e,this.phi=t,this.theta=a,this}makeSafe(){return this.phi=Math.max(ch,Math.min(Math.PI-ch,this.phi)),this}setFromVector3(e){return this.setCoords(e.x,e.y,e.z)}setCoords(e,t,a){return this.radius=Math.sqrt(e*e+t*t+a*a),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,a),this.phi=Math.acos(Be(t/this.radius,-1,1))),this}getCoords(){const e=Math.sin(this.phi)*this.radius;return this.coords.x=e*Math.sin(this.theta),this.coords.y=Math.cos(this.phi)*this.radius,this.coords.z=e*Math.cos(this.theta),this.coords}}class Pg extends et{focus;_rotation=new b(45,0,0);distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(ti),!this._camera){console.error("ThirdPersonCameraController need camera");return}if(!this.focus){console.error("ThirdPersonCameraController need target");return}_.inputSystem.addEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){_.inputSystem.addEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){this._rotation.y+=e.movementX*.01,this._rotation.x+=e.movementY*.01}mouseWheel(e){this.distance+=_.inputSystem.wheelDelta*.1}onUpdate(){let e=new b;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t.subtract(e)}destroy(e){_.inputSystem.removeEventListener(Z.POINTER_WHEEL,this.mouseWheel,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.mouseUp,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var at=(s=>(s[s.NORMAL=0]="NORMAL",s[s.DOWN=1]="DOWN",s[s.OVER=2]="OVER",s[s.DISABLE=3]="DISABLE",s))(at||{});let Vg=Math.PI,fh=Vg*2;class Gr{a;b;c;d;tx;ty;constructor(e=1,t=0,a=0,r=1,i=0,n=0){this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n}clone(){return new Gr(this.a,this.b,this.c,this.d,this.tx,this.ty)}concat(e){let t=this.a,a=this.c,r=this.tx;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=a*e.a+this.d*e.c,this.d=a*e.b+this.d*e.d,this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}identity(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this}invert(){this._invertInto(this)}rotate(e){if(e=+e,e!==0){e=e*Dt;let t=Math.cos(e),a=Math.sin(e),r=this.a,i=this.b,n=this.c,o=this.d,l=this.tx,c=this.ty;this.a=r*t-i*a,this.b=r*a+i*t,this.c=n*t-o*a,this.d=n*a+o*t,this.tx=l*t-c*a,this.ty=l*a+c*t}}scale(e,t){e!==1&&(this.a*=e,this.c*=e,this.tx*=e),t!==1&&(this.b*=t,this.d*=t,this.ty*=t)}setTo(e,t,a,r,i,n){return this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n,this}transformPoint(e,t,a){let r=this.a*e+this.c*t+this.tx,i=this.b*e+this.d*t+this.ty;return a?(a.setTo(r,i,0,1),a):new b(r,i,0,1)}setTranslate(e,t){this.tx=e,this.ty=t}translate(e,t){this.tx+=e,this.ty+=t}mul(e){let t=this,a=e,r=t.a,i=t.b,n=t.c,o=t.d,l=t.tx,c=t.ty,f=a.a,d=a.b,h=a.c,u=a.d,m=a.tx,g=a.ty;d!==0||h!==0?(this.a=r*f+i*h,this.b=r*d+i*u,this.c=n*f+o*h,this.d=n*d+o*u,this.tx=f*l+h*c+m,this.ty=d*l+u*c+g):(this.a=r*f,this.b=i*u,this.c=n*f,this.d=o*u,this.tx=f*l+m,this.ty=u*c+g)}equals(e){return this.a==e.a&&this.b==e.b&&this.c==e.c&&this.d==e.d&&this.tx==e.tx&&this.ty==e.ty}prepend(e,t,a,r,i,n){let o=this.tx;if(e!=1||t!=0||a!=0||r!=1){let l=this.a,c=this.c;this.a=l*e+this.b*a,this.b=l*t+this.b*r,this.c=c*e+this.d*a,this.d=c*t+this.d*r}return this.tx=o*e+this.ty*a+i,this.ty=o*t+this.ty*r+n,this}append(e){let t=this.a,a=this.b,r=this.c,i=this.d;return(e.a!=1||e.b!=0||e.c!=0||e.d!=1)&&(this.a=e.a*t+e.b*r,this.b=e.a*a+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*a+e.d*i),this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*a+e.ty*i+this.ty,this}deltaTransformPoint(e){let t=this,a=t.a*e.x+t.c*e.y,r=t.b*e.x+t.d*e.y;return new b(a,r)}toString(){return"(a="+this.a+", b="+this.b+", c="+this.c+", d="+this.d+", tx="+this.tx+", ty="+this.ty+")"}createBox(e,t,a=0,r=0,i=0){let n=this;if(a!==0){a=a*Dt;let o=Math.cos(a),l=Math.sin(a);n.a=o*e,n.b=l*t,n.c=-l*e,n.d=o*t}else n.a=e,n.b=0,n.c=0,n.d=t;n.tx=r,n.ty=i}createGradientBox(e,t,a=0,r=0,i=0){this.createBox(e/1638.4,t/1638.4,a,r+e/2,i+t/2)}_invertInto(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty;if(a==0&&r==0){e.b=e.c=0,t==0||i==0?e.a=e.d=e.tx=e.ty=0:(t=e.a=1/t,i=e.d=1/i,e.tx=-t*n,e.ty=-i*o);return}let l=t*i-a*r;if(l==0){e.identity();return}l=1/l;let c=e.a=i*l;a=e.b=-a*l,r=e.c=-r*l,i=e.d=t*l,e.tx=-(c*n+r*o),e.ty=-(a*n+i*o)}getScaleX(){let e=this;if(e.a==1&&e.b==0)return 1;let t=Math.sqrt(e.a*e.a+e.b*e.b);return this.getDeterminant()<0?-t:t}getScaleY(){let e=this;if(e.c==0&&e.d==1)return 1;let t=Math.sqrt(e.c*e.c+e.d*e.d);return this.getDeterminant()<0?-t:t}getSkewX(){return Math.atan2(this.d,this.c)-Math.PI/2}getSkewY(){return Math.atan2(this.b,this.a)}updateScaleAndRotation(e,t,a,r){if((a==0||a==fh)&&(r==0||r==fh)){this.a=e,this.b=this.c=0,this.d=t;return}a=a*Dt,r=r*Dt;let i=Math.cos(a),n=Math.sin(a);a==r?(this.a=i*e,this.b=n*e):(this.a=Math.cos(r)*e,this.b=Math.sin(r)*e),this.c=-n*t,this.d=i*t}preMultiplyInto(e,t){let a=e.a*this.a,r=0,i=0,n=e.d*this.d,o=e.tx*this.a+this.tx,l=e.ty*this.d+this.ty;(e.b!==0||e.c!==0||this.b!==0||this.c!==0)&&(a+=e.b*this.c,n+=e.c*this.b,r+=e.a*this.b+e.b*this.d,i+=e.c*this.a+e.d*this.c,o+=e.ty*this.c,l+=e.tx*this.b),t.a=a,t.b=r,t.c=i,t.d=n,t.tx=o,t.ty=l}$transformBounds(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty,l=e.x,c=e.y,f=l+e.width,d=c+e.height,h=t*l+r*c+n,u=a*l+i*c+o,m=t*f+r*c+n,g=a*f+i*c+o,p=t*f+r*d+n,D=a*f+i*d+o,A=t*l+r*d+n,B=a*l+i*d+o,v=0;h>m&&(v=h,h=m,m=v),p>A&&(v=p,p=A,A=v),e.x=Math.floor(h<p?h:p),e.width=Math.ceil((m>A?m:A)-e.x),u>g&&(v=u,u=g,g=v),D>B&&(v=D,D=B,B=v),e.y=Math.floor(u<D?u:D),e.height=Math.ceil((g>B?g:B)-e.y)}getDeterminant(){return this.a*this.d-this.b*this.c}}class ds extends et{isGUICanvas=!0;index=0;addChild(e){return this.object3D.addChild(e),this}removeChild(e){return this.object3D.removeChild(e),this}cloneTo(e){e.getOrAddComponent(ds).copyComponent(this)}copyComponent(e){return e.index=e.index,this}}var lt=(s=>(s[s.NONE=0]="NONE",s[s.POSITION=1]="POSITION",s[s.SPRITE=2]="SPRITE",s[s.COLOR=4]="COLOR",s[s.MAX=7]="MAX",s))(lt||{});class Go{array;buffer;constructor(e){this.buffer=new Pe(e,0),this.array=new Float32Array(this.buffer.memory.shareDataBuffer)}}class dh extends Le{_attributeUV;_attributeVIndex;_faceIndexes;_uvSize=2;_vIndexSize=1;_posAttribute;_spriteAttribute;_colorAttribute;_onPositionChange=!0;_onSpriteChange=!0;_onColorChange=!0;maxQuadCount;constructor(e){super(),this.maxQuadCount=e}updateSubGeometry(e,t,a){let r=this.subGeometries[e];if(r){let i=r.lodLevels[0];i.indexStart=t,i.indexCount=a,i.index=e}else r=this.addSubGeometry({indexStart:t,indexCount:a,vertexStart:0,vertexCount:0,firstStart:0,index:e,topology:0});return r}resetSubGeometries(){for(let e of this.subGeometries){let t=e.lodLevels[0];t.indexStart=0,t.indexCount=0,t.index=0}}updateBounds(e,t){let a=Number.MAX_VALUE*.1;return e=new b(-a,-a,-a),t=new b(a,a,a),this.bounds.setFromMinMax(e,t),this}getPositionBuffer(){return this._onPositionChange&&(this._posAttribute.buffer.apply(),this._onPositionChange=!1),this._posAttribute.buffer}getSpriteBuffer(){return this._onSpriteChange&&(this._spriteAttribute.buffer.apply(),this._onSpriteChange=!1),this._spriteAttribute.buffer}getColorBuffer(){return this._onColorChange&&(this._colorAttribute.buffer.apply(),this._onColorChange=!1),this._colorAttribute.buffer}create(){this.createBuffer(),this.updateBounds();let e=this.maxQuadCount,t=[],a=[];for(let i=0;i<e;i++)t.push(...pi.attUV);for(let i=0,n=this.maxQuadCount*pi.vertexCount;i<n;i++)a[i]=i;this._attributeUV=new Float32Array(pi.vertexCount*e*this._uvSize),this._attributeVIndex=new Float32Array(pi.vertexCount*e*this._vIndexSize),this._attributeUV.set(t,0),this._attributeVIndex.set(a,0);let r=[];for(let i=0;i<e;i++)for(let n=0;n<pi.indecies.length;n++){const o=pi.indecies[n]+i*4;r.push(o)}return this._faceIndexes=new Uint32Array(e*6),this._faceIndexes.set(r,0),this.setIndices(this._faceIndexes),this.setAttribute(G.uv,this._attributeUV),this.setAttribute(G.vIndex,this._attributeVIndex),this.updateSubGeometry(0,0,this._faceIndexes.length),this}createBuffer(){let e=this.maxQuadCount;this._posAttribute=new Go(e*4),this._spriteAttribute=new Go(e*12),this._colorAttribute=new Go(e*4)}fillQuad(e,t){e.dirtyAttributes<.POSITION&&this.fillQuadPosition(e,t),e.dirtyAttributes<.COLOR&&this.fillQuadColor(e,t),e.dirtyAttributes<.SPRITE&&this.fillQuadSprite(e,t)}fillQuadPosition(e,t){hh.setXYZW(this._posAttribute.array,e.z,e.left,e.bottom,e.right,e.top),this._onPositionChange=!0}fillQuadColor(e,t){let a=e.color,r=this._colorAttribute.array;hh.setXYZW(r,e.z,a.r,a.g,a.b,a.a),this._onColorChange=!0}fillQuadSprite(e,t){let a=e.sprite,r=0,i=0;a.isSliced&&e.imageType==hi.Sliced&&(r=a.trimSize.x,r=(t.width-(a.offsetSize.z-a.trimSize.x))/r,i=a.trimSize.y,i=(t.height-(a.offsetSize.w-a.trimSize.y))/i);let n=a.guiTexture.dynamicId,o=a.uvRec,l=a.uvBorder,c=this._spriteAttribute.array,f=12*e.z;c[f+0]=o.x,c[f+1]=o.y,c[f+2]=o.z,c[f+3]=o.w,c[f+4]=l.x,c[f+5]=l.y,c[f+6]=l.z,c[f+7]=l.w,c[f+8]=r,c[f+9]=i,c[f+10]=n,c[f+11]=e.visible?1:0,this._onSpriteChange=!0}}class Og{static set(e,t,a,r,...i){let n=t*r+a;for(let o=0,l=i.length;o<l;o++)e[n+o]=i[o]}}class hh extends Og{static setXYZW(e,t,a,r,i,n){this.set(e,t,0,4,a,r,i,n)}static setXYZ(e,t,a,r,i){this.set(e,t,0,4,a,r,i)}static setZ(e,t,a){this.set(e,t,3,4,a)}}class pi{static vertexCount=4;static attUV=[0,0,1,0,1,1,0,1];static indecies=[0,1,2,0,2,3]}class uh{_textureMap=new Map;_textureList=[];build(e,t,a){let r=t._geometry;r.resetSubGeometries();let i=-1,n=0,o=0,l=0,c=0,f=this._textureList,d=this._textureMap;function h(){l>0&&(t.updateDrawCallSegment(c,o,l),t._uiRenderer.materials[c].setTextures(f),d.clear(),f.length=0,c++,o+=l,l=0,n=0)}d.clear(),f.length=0;let u=[],m=t.quadMaxCount-1;for(let g of e){let p=g.needUpdateQuads;u.length=0;const D=this.collectQuads(g.object3D,u);for(let A of D){let B=A.sprite.guiTexture;if(d.has(B.staticId)||(n==7&&h(),d.set(B.staticId,B),B.dynamicId=n,f[n]=B.texture,n+=1),A.z=++i,l+=6,A.cacheTextureId!=B.dynamicId&&(A.dirtyAttributes=lt.MAX,A.cacheTextureId=B.dynamicId),(p||a)&&(A.dirtyAttributes=lt.MAX),A.dirtyAttributes<.POSITION&&A.applyTransform(g),A.dirtyAttributes&&A.writeToGeometry(r,g),i==m)return h(),!0}}return h(),!1}collectQuads(e,t){t||=[];let a=e.components.values();for(let r of a){let i=r;if(i.isUIShadow||!i.mainQuads)continue;let n=i.getShadowRender();n&&this.push(n.mainQuads,t),this.push(i.mainQuads,t)}return t}push(e,t){e&&e.length>0&&t.push(...e)}}class zo{static bindTextureArray(){let e="";for(let t=0;t<7;t++)e+=`
|
|
11540
11568
|
@group(1) @binding(auto)
|
|
11541
11569
|
var tex_${t}Sampler: sampler;
|
|
11542
11570
|
@group(1) @binding(auto)
|
|
@@ -11784,7 +11812,7 @@ fn frag(){
|
|
|
11784
11812
|
}
|
|
11785
11813
|
|
|
11786
11814
|
${this.fs}
|
|
11787
|
-
`}class Wo extends vt{_scissorRect;_screenSize=new de(1024,768);_scissorEnable=!1;constructor(e){super(),Y.register("GUI_shader_view",zo.GUI_shader_view),Y.register("GUI_shader_world",zo.GUI_shader_world);let t=new At;this.addColorPass(t,fe.COLOR,e),this.addColorPass(t,fe.UI,e),this.shader=t}addColorPass(e,t,a){let r=a==fa.View?"GUI_shader_view":"GUI_shader_world",i=new qe(r,r);i.passType=t,i.setShaderEntry("VertMain","FragMain"),i.setUniformVector4("scissorRect",new be),i.setUniformVector2("screenSize",this._screenSize),i.setUniformFloat("scissorCornerRadius",0),i.setUniformFloat("scissorFadeOutSize",0),i.setUniformFloat("pixelRatio",1),i.setUniformVector3("v3",b.ZERO);let n=i.shaderState;n.depthWriteEnabled=!1,i.blendMode=De.NORMAL,i.depthCompare=a==fa.View?ft.always:ft.less_equal,i.cullMode=Lt.back,e.addRenderPass(i)}setPanelRatio(e){this.shader.setUniformFloat("pixelRatio",e)}setScissorRect(e,t,a,r){this._scissorRect||=new be,this._scissorRect.set(e,t,a,r),this.shader.setUniformVector4("scissorRect",this._scissorRect)}setScissorEnable(e){this._scissorEnable!=e&&(this._scissorEnable=e,e?this.shader.setDefine("SCISSOR_ENABLE",!0):this.shader.deleteDefine("SCISSOR_ENABLE"),this.shader.noticeValueChange())}setScissorCorner(e,t){this.shader.setUniformFloat("scissorCornerRadius",e),this.shader.setUniformFloat("scissorFadeOutSize",t)}setScreenSize(e,t){return this._screenSize.set(e,t),this.shader.setUniformVector2("screenSize",this._screenSize),this}setTextures(e){for(let t=0;t<7;t++){let a=e[t]||_.res.whiteTexture;this.shader.setTexture(`tex_${t}`,a),this.setVideoTextureDefine(t,a.isVideoTexture)}}_videoTextureFlags={};setVideoTextureDefine(e,t){let a=!1;t!=this._videoTextureFlags[e]&&(t?this.shader.setDefine(`VideoTexture${e}`,!0):this.shader.deleteDefine(`VideoTexture${e}`),this._videoTextureFlags[e]=t,a=!0),a&&this.shader.noticeValueChange()}set envMap(e){}set shadowMap(e){}set baseMap(e){}set normalMap(e){}set emissiveMap(e){}set irradianceMap(e){}set irradianceDepthMap(e){}}class bh extends he{_guiGeometry;init(e){super.init(),this.addRendererMask(Ne.UI),this.removeRendererMask(Ne.Default),this.castGI=!1,this.castShadow=!1,this.alwaysRender=!0,this._ignoreEnvMap=this._ignorePrefilterMap=!0}get geometry(){return super.geometry}set geometry(e){super.geometry=e,this._guiGeometry=e}nodeUpdate(e,t,a,r){for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t),l=this._guiGeometry.getPositionBuffer(),c=this._guiGeometry.getSpriteBuffer(),f=this._guiGeometry.getColorBuffer();if(o)for(let d=0;d<o.length;d++){const h=o[d];h.pipeline||(h.setStorageBuffer("vPositionBuffer",l),h.setStorageBuffer("vSpriteBuffer",c),h.setStorageBuffer("vColorBuffer",f))}}super.nodeUpdate(e,t,a,r)}onUpdate(e){}}class gh{_use;_unUse;constructor(){this._use=[],this._unUse=[]}pushBack(e){let t=this._use.indexOf(e);t!=-1&&(this._use.splice(t,1),this._unUse.push(e))}getUseList(){return this._use}getOne(e,t){let a;return this._unUse.length>0?(a=this._unUse[0],this._unUse.splice(0,1),this._use.push(a),a):(a=new e(t),this._use.push(a),a)}hasFree(){return this._unUse.length>0}}let Ji;class Ja{x=0;y=0;z=0;width=1;height=1;_globalX=0;_globalY=0;_globalWidth=0;_globalHeight=0;_visible=!0;_offsetX=0;_offsetY=0;_sprite=_.res.defaultGUISprite;_color=new J(1,1,1,1);_imageType=hi.Simple;dirtyAttributes=ot.MAX;cacheTextureId=-1;static textPool;static get quadPool(){return this.textPool||=new gh,this.textPool}static recycleQuad(e){e.sprite=null,e.dirtyAttributes=ot.MAX,e.x=0,e.y=0,e.z=-1,e.cacheTextureId=-1,Ja.quadPool.pushBack(e)}static spawnQuad(){return Ja.quadPool.getOne(Ja)}get imageType(){return this._imageType}set imageType(e){this._imageType=e,this.setAttrChange(ot.SPRITE|ot.POSITION)}get color(){return this._color}set color(e){this._color.copyFrom(e),this.setAttrChange(ot.COLOR)}get visible(){return this._visible}set visible(e){e!=this._visible&&(this._visible=e,this.setAttrChange(ot.SPRITE))}get sprite(){return this._sprite}set sprite(e){this._sprite!=e&&(this._sprite=e,this.setAttrChange(ot.SPRITE|ot.POSITION))}get left(){return this._globalX-this._offsetX}get right(){return this.left+this._globalWidth}get top(){return this._globalY-this._offsetY}get bottom(){return this.top+this._globalHeight}setSize(e,t){this.width=e,this.height=t,this.setAttrChange(ot.POSITION)}setXY(e,t){this.x=e,this.y=t,this.setAttrChange(ot.POSITION)}setAttrChange(e){this.dirtyAttributes=this.dirtyAttributes|e}applyTransform(e){this.setAttrChange(ot.POSITION);let t=this._sprite,a=e.getWorldMatrix();(this.x!=0||this.y!=0)&&(a=this.getQuadMatrix(a));let r=a.getScaleX(),i=a.getScaleY(),n=t.isSliced&&this._imageType==hi.Sliced;if(this._offsetX=e.width*.5*r,this._offsetY=e.height*.5*i,n)this._globalWidth=r*(e.width-(t.offsetSize.z-t.trimSize.x)),this._globalHeight=i*(e.height-(t.offsetSize.w-t.trimSize.y)),this._globalX=a.tx+t.offsetSize.x*r,this._globalY=a.ty+t.offsetSize.y*i;else{let o=this.width/t.offsetSize.z,l=this.height/t.offsetSize.w;this._globalWidth=r*t.trimSize.x*o,this._globalHeight=i*t.trimSize.y*l,this._globalX=a.tx+t.offsetSize.x*o*r,this._globalY=a.ty+t.offsetSize.y*l*i}return this}getQuadMatrix(e){return Ji||=new Gr,Ji.identity(),Ji.setTranslate(this.x,this.y),Ji.mul(e),Ji}writeToGeometry(e,t){return e.fillQuad(this,t),this.dirtyAttributes=ot.NONE,this}}class Jo extends et{_uiTransform;_visible=!0;destroy(){this._uiTransform.setNeedUpdateUIPanel(),super.destroy()}get uiTransform(){return this._uiTransform}get visible(){return this._visible}set visible(e){this._visible!=e&&(this._visible=e,this.onUIComponentVisible?.(this._visible))}init(e){super.init?.(e),this._uiTransform=this.object3D.getOrAddComponent(or),this._uiTransform.setNeedUpdateUIPanel()}copyComponent(e){return this.visible=e.visible,this}}class ji extends Jo{_mainQuads;_shadowRender;_shadowSource;isUIShadow;isShadowless;needUpdateShadow;init(e){super.init?.(e),this._mainQuads=[]}destroy(){this.detachQuads(),this._shadowRender?.setShadowSource(null),this._shadowSource?.setShadowRenderer(null),super.destroy(),this._shadowRender=null,this._shadowSource=null}start(){super.start?.(),this.isUIShadow?this.autoBindShadow(null,this):this.isShadowless||this.autoBindShadow(this,null),this.setShadowDirty()}setShadowDirty(){this._shadowRender&&(this._shadowRender.needUpdateShadow=!0)}get mainQuads(){return this._mainQuads}setShadowRenderer(e){this._shadowRender=e}setShadowSource(e){this._shadowSource=e}getShadowRender(){return this._shadowRender}autoBindShadow(e,t){let a=this.object3D.components.values();if(!e)for(let r of a){let i=r;if(!(i.isShadowless||i.isUIShadow)&&i.mainQuads){e=i;break}}if(!t)for(let r of a){let i=r;if(i.isUIShadow&&i.mainQuads){t=i;break}}return e&&t?(e.setShadowRenderer(t),t.setShadowSource(e),!0):!1}recycleQuad(e){if(e&&this._mainQuads){let t=this._mainQuads.indexOf(e);t>=0?(this._mainQuads.splice(t,1),Ja.recycleQuad(e)):e=null}return e}attachQuad(e){return this._mainQuads&&this._mainQuads.push(e),this}detachQuads(){if(this._mainQuads)for(;this._mainQuads.length>0;){let e=this._mainQuads.shift();this.recycleQuad(e)}return this}copyComponent(e){return super.copyComponent(e),this.isUIShadow=e.isUIShadow,this.isShadowless=e.isShadowless,this}}class zr extends ji{init(e){super.init?.(e),this.attachQuad(Ja.spawnQuad()),this.sprite=_.res.defaultGUISprite}cloneTo(e){e.getOrAddComponent(zr).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.sprite=e.sprite,this.color=e.color,this.imageType=e.imageType,this}set sprite(e){e||=_.res.defaultGUISprite;for(let t of this._mainQuads)t.sprite=e,t.setSize(this._uiTransform.width,this._uiTransform.height);this.setShadowDirty()}onTransformResize(){this.applyTransformSize()}applyTransformSize(){for(let e of this._mainQuads)e.setSize(this._uiTransform.width,this._uiTransform.height);this.setShadowDirty()}get sprite(){return this._mainQuads[0].sprite}onUIComponentVisible(e){this.applyComponentVisible()}onUITransformVisible(e){this.applyComponentVisible()}applyComponentVisible(){let e=!this._visible||!this._uiTransform.globalVisible;for(let t of this._mainQuads)t.visible=!e;this.setShadowDirty()}get color(){return this._mainQuads[0].color}set color(e){for(let t of this._mainQuads)t.color=e;this.setShadowDirty()}get imageType(){return this._mainQuads[0].imageType}set imageType(e){for(let t of this._mainQuads)t.imageType=e;this.setShadowDirty()}}class hs extends zr{space=fa.World;needUpdateGeometry=!0;panelOrder=0;needSortOnCameraZ;_billboard;_rebuild;scissorEnable=!1;scissorCornerRadius=0;scissorFadeOutSize=0;_uiRenderer;_geometry;_maxCount=128;panelRatio=1;isUIPanel=!0;cloneTo(e){e.getOrAddComponent(hs).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.panelOrder=e.panelOrder,this.needSortOnCameraZ=e.needSortOnCameraZ,this.cullMode=e.cullMode,this.billboard=e.billboard,this.scissorEnable=e.scissorEnable,this.scissorCornerRadius=e.scissorCornerRadius,this.scissorFadeOutSize=e.scissorFadeOutSize,this}init(e){super.init(e),this._uiTransform.resize(I.canvas.width,I.canvas.height),this.create(this.space),this.visible=!1}updateDrawCallSegment(e,t,a){this._geometry.updateSubGeometry(e,t,a);let r=this._uiRenderer.material,i=this._uiRenderer.materials[e];if(!i){i=new Wo(this.space);let n=this._uiRenderer.materials.slice();n.push(i),this._uiRenderer.materials=n,i.cullMode=r.cullMode,i.depthCompare=r.depthCompare}}create(e){this._maxCount=this.space==fa.World?Pr.quadMaxCountForWorld:Pr.quadMaxCountForView,this._uiRenderer=this.object3D.addComponent(bh),this._geometry=this._uiRenderer.geometry=new dh(this._maxCount).create(),this._uiRenderer.material=new Wo(e),this._uiRenderer.renderOrder=Pr.SortOrderStartWorld,this._rebuild=new uh,this.object3D.bound=new Ce(new b,new b(1,1,1).multiplyScalar(Number.MAX_VALUE*.1))}get quadMaxCount(){return this._maxCount}get renderer(){return this._uiRenderer}set billboard(e){this.space==fa.View&&(e=pr.None,console.warn("Cannot enable billboard in view space")),e==pr.BillboardXYZ||e==pr.BillboardY?(this._billboard=this.object3D.getOrAddComponent(fs),this._billboard.type=e):(this.object3D.removeComponent(fs),this._billboard=null)}get billboard(){return this._billboard?this._billboard.type:pr.None}set cullMode(e){if(this.space==fa.World)for(let t of this._uiRenderer.materials)t.cullMode=e;else console.warn("Cannot change cullMode in view space")}get cullMode(){return this._uiRenderer.material.cullMode}onUpdate(e){super.onUpdate?.(e),this.rebuildGUIMesh(e)}_collectTransform=[];rebuildGUIMesh(e){let t=this,a=t._collectTransform;if(a.length=0,t.object3D.getComponents(or,a),a.length>0){t._rebuild.build(a,t,t.needUpdateGeometry);for(const o of a)o.needUpdateQuads=!1}let r=t.object3D.getComponentFromParent(ds),i=r?r.index:0;t._uiRenderer.enable=a.length>0;let n=t.isViewPanel?Pr.SortOrderStartView:Pr.SortOrderStartWorld;if(t._uiRenderer.renderOrder=i*Pr.SortOrderCanvasSpan+n+t.panelOrder,t._uiRenderer.needSortOnCameraZ=t.needSortOnCameraZ,this.space==fa.View){let o=I.canvas.clientWidth,l=I.canvas.clientHeight,c=this._uiTransform.width,f=this._uiTransform.height;this.panelRatio=this.updateGUIPixelRatio(o,l,c,f)}else this.panelRatio=1;for(let o of t._uiRenderer.materials){let l=o;if(l.setPanelRatio(this.panelRatio),l.setScreenSize(I.canvas.clientWidth,I.canvas.clientHeight),l.setScissorEnable(t.scissorEnable),t.scissorEnable){let c=t.mainQuads[0];l.setScissorRect(c.left,c.bottom,c.right,c.top),l.setScissorCorner(t.scissorCornerRadius,t.scissorFadeOutSize)}}t.needUpdateGeometry=!1}updateGUIPixelRatio(e,t,a,r){let i=a/r,n=e/t,o=1;return i<n?o=t/r:o=e/a,o}}class bn extends hs{isViewPanel=!0;space=fa.View;constructor(){super()}cloneTo(e){e.getOrAddComponent(bn).copyComponent(this)}}class gn extends hs{isWorldPanel=!0;space=fa.World;_depthTest=!0;constructor(){super()}cloneTo(e){e.getOrAddComponent(gn).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.depthTest=e.depthTest,this}get depthTest(){return this._depthTest}set depthTest(e){if(this._depthTest!=e){this._depthTest=e;let t=this.depthTest?ft.less_equal:ft.always;for(let a of this._uiRenderer.materials)a.depthCompare=t}}}let ph;class or extends et{useParentPivot=!1;parent;pivotX=.5;pivotY=.5;_width=100;_height=100;_localVisible=!0;_globalVisible=!0;_uiInteractiveList;get uiInteractiveList(){return this._uiInteractiveList}constructor(){super(),this._localMatrix=new Gr,this._worldMatrix=new Gr}init(e){super.init(e),this.transform.eventDispatcher.addEventListener(this.transform.eventLocalChange.type,this.onTransformChange,this),this.onParentChange(null,this.object3D.parent?.object3D)}onTransformChange(e){this.onChange=!0}addUIInteractive(e){return this._uiInteractiveList||=[],this._uiInteractiveList.push(e),this}removeUIInteractive(e){if(this._uiInteractiveList){let t=this._uiInteractiveList.indexOf(e);if(t>=0)return this._uiInteractiveList.slice(t,1),e}return null}get globalVisible(){return this._globalVisible}set visible(e){if(this._localVisible!=e){this._localVisible=e;let t=this.parent?this.parent._globalVisible:!0;this.onUITransformVisible(this._localVisible&&t)}}get visible(){return this._localVisible}onUITransformVisible(e){let t=this._localVisible&&e;t!=this._globalVisible&&(this._globalVisible=t,this.object3D.components.forEach((a,r)=>{let i=a;if(i.onUITransformVisible)if(i==this)for(let n of this.object3D.entityChildren){let o=n.getComponent(or);o&&o.onUITransformVisible(this._globalVisible)}else i.onUITransformVisible(this._globalVisible)}))}onParentChange(e,t){this.parent?.setNeedUpdateUIPanel(),this.parent=t?.getComponent(or),this.parent?.setNeedUpdateUIPanel()}get width(){return this._width}get height(){return this._height}resize(e,t){if(this._width!=e||this._height!=t){this._width=e,this._height=t,this.onChange=!0;for(let a of this.object3D.components.values())a.onTransformResize?.();return!0}return!1}get x(){return this.object3D.x}set x(e){e!=this.object3D.x&&(this.object3D.x=e,this.onChange=!0)}get y(){return this.object3D.y}set y(e){e!=this.object3D.y&&(this.object3D.y=e,this.onChange=!0)}setXY(e,t){let a=this.object3D.localPosition;a.set(e,t,a.z),this.object3D.localPosition=a,this.onChange=!0}get z(){return this.object3D.z}set z(e){e!=this.object3D.z&&(this.object3D.z=e,this.onChange=!0)}get scaleX(){return this.object3D.scaleX}set scaleX(e){this.onChange=!0,this.object3D.scaleX=e}get scaleY(){return this.object3D.scaleY}set scaleY(e){this.onChange=!0,this.object3D.scaleY=e}get scaleZ(){return this.object3D.scaleZ}set scaleZ(e){this.onChange=!0,this.object3D.scaleZ=e}_localMatrix;_worldMatrix;_onChange=!0;needUpdateQuads=!0;get onChange(){return this._onChange}_tempTransforms=[];set onChange(e){if(this._onChange!=e&&(this._onChange=e,e)){this._tempTransforms.length=0;let t=this.object3D.getComponents(or,this._tempTransforms,!0);for(let a of t)a._onChange=!0,a.needUpdateQuads=!0}}onEnable(){this.setNeedUpdateUIPanel(),this.onChange=!0}onDisable(){this.setNeedUpdateUIPanel(),this.onChange=!0}setNeedUpdateUIPanel(){let e;e=this.object3D.getComponentFromParent(gn),e||(e=this.object3D.getComponentFromParent(bn)),e&&(e.needUpdateGeometry=!0)}cloneTo(e){let t=e.getOrAddComponent(or);t.visible=this.visible,t.x=this.x,t.y=this.y,t.z=this.z,t.resize(this.width,this.height),t.pivotX=this.pivotX,t.pivotY=this.pivotY,t.scaleX=this.scaleX,t.scaleY=this.scaleY}matrix(){let e=this._localMatrix,t=this.object3D.rotationZ;return this.parent?(e.updateScaleAndRotation(this.object3D.scaleX,this.object3D.scaleY,t,t),e.tx=this.object3D.x,e.ty=this.object3D.y):e.updateScaleAndRotation(1,1,0,0),(this.pivotX!=.5||this.pivotY!=.5)&&(ph||=new Gr().identity(),e.mul(ph.setTo(1,0,0,1,-(this.pivotX-.5)*this.width,-(this.pivotY-.5)*this.height))),e}getWorldMatrix(){let e=this,t=e._worldMatrix;return this._onChange&&(t.copyFrom(e.matrix()),e.parent&&t.mul(e.parent.getWorldMatrix()),e._onChange=!1),t}beforeDestroy(e){this.transform.eventDispatcher.addEventListener(this.transform.eventLocalChange.type,this.onTransformChange,this),super.beforeDestroy?.(e)}}class mh{_ray;_mouseCode;_clickEvent;_outEvent;_overEvent;_upEvent;_downEvent;_view;init(e){this._view=e,this._ray=new ua,this._clickEvent=new yt(yt.PICK_CLICK_GUI),this._outEvent=new yt(yt.PICK_OUT_GUI),this._overEvent=new yt(yt.PICK_OVER_GUI),this._upEvent=new yt(yt.PICK_UP_GUI),this._downEvent=new yt(yt.PICK_DOWN_GUI),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onTouchDown,this,null,1),_.inputSystem.addEventListener(Z.POINTER_UP,this.onTouchUp,this,null,1),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onTouchMove,this,null,1),_.inputSystem.addEventListener(Z.POINTER_CLICK,this.onTouchClick,this,null,1)}_lastDownTarget;_lastOverTarget;onTouchClick(e){this._lastOverTarget&&e.stopImmediatePropagation()}onTouchMove(e){this._mouseCode=e.mouseCode,this.collectEntities();let t=this.pick(this._colliderOut);if(t){e.stopImmediatePropagation();let a=t.collider;a!=this._lastOverTarget&&(a.mouseStyle=at.OVER,Object.assign(this._overEvent,e),this._overEvent.type=yt.PICK_OVER_GUI,this._overEvent.target=a.object3D,this._overEvent.data=t,a.object3D.dispatchEvent(this._overEvent),this._lastOverTarget&&(this._lastOverTarget.mouseStyle=at.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=yt.PICK_OUT_GUI,this._outEvent.target=a.object3D,this._outEvent.data=t,this._lastOverTarget.object3D.dispatchEvent(this._outEvent))),this._lastOverTarget=a}else this._lastOverTarget&&(this._lastOverTarget.mouseStyle=at.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=yt.PICK_OUT_GUI,this._outEvent.target=this._lastOverTarget.object3D,this._outEvent.data=t,this._lastOverTarget.object3D.dispatchEvent(this._outEvent),this._lastOverTarget=null)}_lastDownPosition=new de;_calcDistanceVec2=new de;_lastDownTime=0;_clickTimeSpan=200;_clickDistanceSpan=10;onTouchDown(e){this._lastDownTime=We.time,this._lastDownPosition.set(e.mouseX,e.mouseY),this._mouseCode=e.mouseCode,this.collectEntities();let t=this.pick(this._colliderOut);t&&e.stopImmediatePropagation();let a=t?t.collider:null;a&&(a.mouseStyle=at.DOWN,Object.assign(this._downEvent,e),this._downEvent.type=yt.PICK_DOWN_GUI,this._downEvent.target=a.object3D,this._downEvent.data=t,a.object3D.dispatchEvent(this._downEvent)),this._lastDownTarget=a}onTouchUp(e){this._calcDistanceVec2.set(e.mouseX,e.mouseY),this._mouseCode=e.mouseCode,this.collectEntities();let t=this.pick(this._colliderOut);t&&e.stopImmediatePropagation();let a=t?t.collider:null;this._lastDownTarget&&this._lastDownTarget.enable&&(this._lastDownTarget.mouseStyle=at.NORMAL),a&&a==this._lastDownTarget&&We.time-this._lastDownTime<=this._clickTimeSpan&&(this._calcDistanceVec2.set(e.mouseX,e.mouseY),this._calcDistanceVec2.distance(this._lastDownPosition)<=this._clickDistanceSpan&&(Object.assign(this._clickEvent,e),this._clickEvent.type=yt.PICK_CLICK_GUI,this._clickEvent.target=a.object3D,this._clickEvent.data=t,a.object3D.dispatchEvent(this._clickEvent))),this._lastDownTarget=null}_colliderOut=[];_transformList=[];_sortWorldPanelList=[];_iteractive2PanelDict=new Map;collectEntities(){return this._colliderOut.length=0,this._sortWorldPanelList.length=0,this._iteractive2PanelDict.clear(),this._view.canvasList.slice().reverse().forEach(t=>{if(t&&t.transform&&t.transform.parent){let a=t.object3D.getComponentsByProperty("isUIPanel",!0,!0);a.sort((r,i)=>{let n=r._uiRenderer.__renderOrder,o=i._uiRenderer.__renderOrder;return n>o?-1:1});for(let r of a){this._transformList.length=0,r.object3D.getComponents(or,this._transformList),this._transformList.reverse();for(const i of this._transformList){let n=i.uiInteractiveList;if(n&&n.length>0)for(let o of n)this._colliderOut.push(o),this._iteractive2PanelDict.set(o,r)}}}}),this._colliderOut}pick(e){this._ray=this._view.camera.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY);let t=new de(_.inputSystem.mouseX,_.inputSystem.mouseY),a=new de(I.canvas.clientWidth,I.canvas.clientHeight),r;for(const i of e)if(i.interactive&&i.enable&&i.interactiveVisible){let n=this._iteractive2PanelDict.get(i);if(r=i.rayPick(this._ray,n,t,a),r)return r.collider=i,r}return null}}var Ah=(s=>(s[s.COLLINEAR=0]="COLLINEAR",s[s.LINES_INTERSECT=1]="LINES_INTERSECT",s[s.SEGMENTS_INTERSECT=2]="SEGMENTS_INTERSECT",s[s.A_BISECTS_B=3]="A_BISECTS_B",s[s.B_BISECTS_A=4]="B_BISECTS_A",s[s.PARALELL=5]="PARALELL",s))(Ah||{}),Dh=(s=>(s[s.ON_LINE=0]="ON_LINE",s[s.LEFT_SIDE=1]="LEFT_SIDE",s[s.RIGHT_SIDE=2]="RIGHT_SIDE",s))(Dh||{});class Ut{static cacluteLine0=new Ut(null,null);static cacluteLine1=new Ut(null,null);start;end;color=new J(1,1,1,1);_normal;_normalCalculated=!1;constructor(e,t){this.start=e,this.end=t}set(e,t){this.start=e,this.end=t}getCenter(){let e=b.HELP_0;return this.start.subtract(this.end,e),e.scaleBy(.5),e.add(this.end),e}inverse(){let e=this.start;this.start=this.end,this.end=e}equals(e){return this.start==e.start&&this.end==e.end||this.start==e.end&&this.end==e.start}toArray(){return[this.start.x,this.start.y,this.start.z,this.end.x,this.end.y,this.end.z]}static getLines(e){let t=[];for(let a=0;a<e.length;a++){let r=a,i=Pn(a+1,e.length),n=e[r],o=e[i];t.push(new Ut(n,o))}return t}intersection(e,t=null){var a=(e.end.z-e.start.z)*(this.end.x-this.start.x)-(e.end.x-e.start.x)*(this.end.z-this.start.z),r=(e.end.x-e.start.x)*(this.start.z-e.start.z)-(e.end.z-e.start.z)*(this.start.x-e.start.x),i=(e.start.x-this.start.x)*(this.end.z-this.start.z)-(e.start.z-this.start.z)*(this.end.x-this.start.x);if(a==0)return r==0&&i==0?0:5;r=r/a,i=i/a;var n=this.start.x+r*(this.end.x-this.start.x),o=this.start.z+r*(this.end.z-this.start.z);return t!=null&&(t.x=n,t.y=0,t.z=o),r>=0&&r<=1&&i>=0&&i<=1?2:i>=0&&i<=1?3:r>=0&&r<=1?4:1}getDirection(){var e=this.end.subtract(this.start),t=new b(e.x,e.y);return t.normalize()}copyFrom(e){this.start||(this.start=new b),this.end||(this.end=new b),this.start.copyFrom(e.start),this.end.copyFrom(e.end)}static IsEqual(e,t){return Math.abs(e-t)<1e-7}static squreDistanceSegmentToSegment(e,t,a){let r=e.start,i=e.end,n=t.start,o=t.end,l=r.x,c=r.y,f=r.z,d=i.x,h=i.y,u=i.z,m=n.x,g=n.y,p=n.z,D=o.x,A=o.y,B=o.z,v=d-l,U=h-c,y=u-f,S=D-m,F=A-g,C=B-p,w=l-m,E=c-g,Q=f-p,T=v*v+U*U+y*y,j=v*S+U*F+y*C,ue=S*S+F*F+C*C,ee=v*w+U*E+y*Q,N=S*w+F*E+C*Q,M=T*ue-j*j,O=M,W=M,ae=0,z=0;this.IsEqual(M,0)?(ae=0,O=1,z=N,W=ue):(ae=j*N-ue*ee,z=T*N-j*ee,ae<0?(ae=0,z=N,W=ue):ae>O&&(ae=O,z=N+j,W=ue)),z<0?(z=0,-ee<0?ae=0:-ee>T?ae=O:(ae=-ee,O=T)):z>W&&(z=W,-ee+j<0?ae=0:-ee+j>T?ae=O:(ae=-ee+j,O=T));let K=0,$=0;this.IsEqual(ae,0)?K=0:K=ae/O,this.IsEqual(z,0)?$=0:$=z/W;let re=w+K*v-$*S,ce=E+K*U-$*F,Ae=Q+K*y-$*C;return re*re+ce*ce+Ae*Ae}isNear(e,t=0,a){let r=b.HELP_0,i=b.HELP_1;r.copyFrom(e.origin),i.copyFrom(e.direction),i.scaleBy(9999),i.add(r,i),Ut.cacluteLine0.set(r,i),Ut.cacluteLine1.copyFrom(this),a&&(a.perspectiveMultiplyPoint3(Ut.cacluteLine1.start,Ut.cacluteLine1.start),a.perspectiveMultiplyPoint3(Ut.cacluteLine1.end,Ut.cacluteLine1.end));let n=Ut.squreDistanceSegmentToSegment(Ut.cacluteLine0,Ut.cacluteLine1,a);return n+1e-4<=t?(e.length=n,!0):(e.length=-999999,!1)}}class us{static ID=-1;v1;v2;v3;u1;u2;u3;n1;n2;n3;t0;t;u;v;min=new b;max=new b;id=0;constructor(e,t,a){this.id=us.ID+++200,e&&t&&a&&this.set(e,t,a)}set(e,t,a){this.v1=e,this.v2=t,this.v3=a;let r=this.min,i=this.max;return r.x=Math.min(this.v1.x,this.v2.x,this.v3.x),r.y=Math.min(this.v1.y,this.v2.y,this.v3.y),r.z=Math.min(this.v1.z,this.v2.z,this.v3.z),i.x=Math.max(this.v1.x,this.v2.x,this.v3.x),i.y=Math.max(this.v1.y,this.v2.y,this.v3.y),i.z=Math.max(this.v1.z,this.v2.z,this.v3.z),this}getNormal(){let e=this.v1,t=this.v2,a=this.v3,r=new b(t.x-e.x,t.y-e.y,t.z-e.z),n=new b(a.x-e.x,a.y-e.y,a.z-e.z).crossProduct(r);return n.normalize(),n}turnBack(){let e=this.v3;this.v3=this.v1,this.v1=e}getLines(){let e=this.v1,t=this.v2,a=this.v3;return[new Ut(e,t),new Ut(t,a),new Ut(a,e)]}equals(e){let t=this.getLines(),a=e.getLines(),r=0;for(let i=0;i<t.length;i++)for(let n=0;n<a.length;n++)t[i].equals(a[n])&&r++;return r==3}getCenter(){let e=this.min,t=this.max,a=new b;return a.x=(e.x+t.x)*.5,a.y=(e.y+t.y)*.5,a.z=(e.z+t.z)*.5,a}intersects(e){var t=this.max,a=this.min,r=e.max,i=e.min;return a.x<=r.x&&t.x>=i.x&&a.y<=r.y&&t.y>=i.y&&a.z<=r.z&&t.z>=i.z}sign2D(e,t,a){return(e.x-a.x)*(t.z-a.z)-(t.x-a.x)*(e.z-a.z)}pointInTriangle2D(e){let t=this.v1,a=this.v2,r=this.v3,i,n,o,l,c;return i=this.sign2D(e,t,a),n=this.sign2D(e,a,r),o=this.sign2D(e,r,t),l=i<0||n<0||o<0,c=i>0||n>0||o>0,!(l&&c)}toArray(){return[this.v1.x,this.v1.y,this.v1.z,this.v2.x,this.v2.y,this.v2.z,this.v3.x,this.v3.y,this.v3.z]}}class _h{static _pt0;static _pt1;static _pt2;static _pt3;static _hitPoint;static _worldMatrix;static _ray;static _triangle;static _isInit;static init(){this._pt0=new b,this._pt1=new b,this._pt2=new b,this._pt3=new b,this._ray=new ua,this._triangle=new us,this._hitPoint=new b,this._worldMatrix=new R}static rayPick(e,t,a,r,i,n,o){this._isInit||(this.init(),this._isInit=!0);let l=this._worldMatrix;if(r==fa.World){let c;this.calculateHotArea_World(n,this._pt0,this._pt1,this._pt2,this._pt3),l.copyFrom(o).invert();let f=this._ray;if(f.copy(e).applyMatrix(l),this._triangle.set(this._pt0,this._pt1,this._pt2),c=f.intersectTriangle(f.origin,f.direction,this._triangle),c||(this._triangle.set(this._pt1,this._pt2,this._pt3),c=f.intersectTriangle(f.origin,f.direction,this._triangle)),c)return{distance:0,intersectPoint:c}}else{this.calculateHotArea_View(n,i,this._pt0,this._pt1,this._pt2,this._pt3);let c=a.x,f=a.y,d=Math.min(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,h=Math.min(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5,u=Math.max(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,m=Math.max(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5;return t.x<=u&&t.x>=d&&t.y<=m&&t.y>=h?(this._hitPoint.set(t.x,t.y,0),{distance:0,intersectPoint:this._hitPoint}):null}return null}static calculateHotArea_View(e,t,a,r,i,n){let o=e.getWorldMatrix(),l=o.getScaleX(),c=o.getScaleY(),f=e.width*.5*l,d=e.height*.5*c;a.set(-f,-d,0),r.set(f,-d,0),i.set(-f,d,0),n.set(f,d,0);let h=o.tx;a.x+=h,r.x+=h,i.x+=h,n.x+=h,h=o.ty,a.y-=h,r.y-=h,i.y-=h,n.y-=h,a.multiplyScalar(t),r.multiplyScalar(t),i.multiplyScalar(t),n.multiplyScalar(t)}static calculateHotArea_World(e,t,a,r,i){let n=e.getWorldMatrix(),o=n.getScaleX(),l=n.getScaleY(),c=e.width*.5*o,f=e.height*.5*l;t.set(-c,f,0),a.set(c,f,0),r.set(-c,-f,0),i.set(c,-f,0);let d=n.tx;t.x+=d,a.x+=d,r.x+=d,i.x+=d,d=n.ty,t.y+=d,a.y+=d,r.y+=d,i.y+=d}}var Bh=(s=>(s[s.UpperLeft=0]="UpperLeft",s[s.UpperCenter=1]="UpperCenter",s[s.UpperRight=2]="UpperRight",s[s.MiddleLeft=3]="MiddleLeft",s[s.MiddleCenter=4]="MiddleCenter",s[s.MiddleRight=5]="MiddleRight",s[s.LowerLeft=6]="LowerLeft",s[s.LowerCenter=7]="LowerCenter",s[s.LowerRight=8]="LowerRight",s))(Bh||{}),vh=(s=>(s[s.Upper=0]="Upper",s[s.Middle=1]="Middle",s[s.Lower=2]="Lower",s))(vh||{}),xh=(s=>(s[s.Left=0]="Left",s[s.Center=1]="Center",s[s.Right=2]="Right",s))(xh||{});class Uh{charList=[];quadList=[];width=0;index=0}class yh{layout(e){let t=[],a=e.originSize,r=fi.getFontData(e.font,a),i=e.fontSize/a;return this.makeTextLine(e.uiTransform,e.alignment,t,e.font,r,e.text,i,a,e.lineSpacing),t}makeTextLine(e,t,a,r,i,n,o,l,c){let f=-1,d=0,h=l*o,u=h*.5,m=e.width/o,g=e.height/o,p=0,D=e.height,A=()=>{d=0,f++;let y=new Uh;return y.index=f,a.push(y),y},B=(y,S)=>{const F=y.charCodeAt(0).toString();let C=fi.getFnt(r,l,F),w=null;return C?(w=Ja.spawnQuad(),w.sprite=C,w.x=(d+C.xoffset)*o-p,w.y=(i.base-C.height-C.yoffset-i.base)*o+D,w.width=C.offsetSize.width*o,w.height=C.offsetSize.height*o,d+=C.xadvance):y==`
|
|
11815
|
+
`}class Wo extends vt{_scissorRect;_screenSize=new de(1024,768);_scissorEnable=!1;constructor(e){super(),Y.register("GUI_shader_view",zo.GUI_shader_view),Y.register("GUI_shader_world",zo.GUI_shader_world);let t=new At;this.addColorPass(t,fe.COLOR,e),this.addColorPass(t,fe.UI,e),this.shader=t}addColorPass(e,t,a){let r=a==fa.View?"GUI_shader_view":"GUI_shader_world",i=new qe(r,r);i.passType=t,i.setShaderEntry("VertMain","FragMain"),i.setUniformVector4("scissorRect",new be),i.setUniformVector2("screenSize",this._screenSize),i.setUniformFloat("scissorCornerRadius",0),i.setUniformFloat("scissorFadeOutSize",0),i.setUniformFloat("pixelRatio",1),i.setUniformVector3("v3",b.ZERO);let n=i.shaderState;n.depthWriteEnabled=!1,i.blendMode=De.NORMAL,i.depthCompare=a==fa.View?nt.always:nt.less_equal,i.cullMode=Lt.back,e.addRenderPass(i)}setPanelRatio(e){this.shader.setUniformFloat("pixelRatio",e)}setScissorRect(e,t,a,r){this._scissorRect||=new be,this._scissorRect.set(e,t,a,r),this.shader.setUniformVector4("scissorRect",this._scissorRect)}setScissorEnable(e){this._scissorEnable!=e&&(this._scissorEnable=e,e?this.shader.setDefine("SCISSOR_ENABLE",!0):this.shader.deleteDefine("SCISSOR_ENABLE"),this.shader.noticeValueChange())}setScissorCorner(e,t){this.shader.setUniformFloat("scissorCornerRadius",e),this.shader.setUniformFloat("scissorFadeOutSize",t)}setScreenSize(e,t){return this._screenSize.set(e,t),this.shader.setUniformVector2("screenSize",this._screenSize),this}setTextures(e){for(let t=0;t<7;t++){let a=e[t]||_.res.whiteTexture;this.shader.setTexture(`tex_${t}`,a),this.setVideoTextureDefine(t,a.isVideoTexture)}}_videoTextureFlags={};setVideoTextureDefine(e,t){let a=!1;t!=this._videoTextureFlags[e]&&(t?this.shader.setDefine(`VideoTexture${e}`,!0):this.shader.deleteDefine(`VideoTexture${e}`),this._videoTextureFlags[e]=t,a=!0),a&&this.shader.noticeValueChange()}set envMap(e){}set shadowMap(e){}set baseMap(e){}set normalMap(e){}set emissiveMap(e){}set irradianceMap(e){}set irradianceDepthMap(e){}}class bh extends he{_guiGeometry;init(e){super.init(),this.addRendererMask(Ne.UI),this.removeRendererMask(Ne.Default),this.castGI=!1,this.castShadow=!1,this.alwaysRender=!0,this._ignoreEnvMap=this._ignorePrefilterMap=!0}get geometry(){return super.geometry}set geometry(e){super.geometry=e,this._guiGeometry=e}nodeUpdate(e,t,a,r){for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t),l=this._guiGeometry.getPositionBuffer(),c=this._guiGeometry.getSpriteBuffer(),f=this._guiGeometry.getColorBuffer();if(o)for(let d=0;d<o.length;d++){const h=o[d];h.pipeline||(h.setStorageBuffer("vPositionBuffer",l),h.setStorageBuffer("vSpriteBuffer",c),h.setStorageBuffer("vColorBuffer",f))}}super.nodeUpdate(e,t,a,r)}onUpdate(e){}}class gh{_use;_unUse;constructor(){this._use=[],this._unUse=[]}pushBack(e){let t=this._use.indexOf(e);t!=-1&&(this._use.splice(t,1),this._unUse.push(e))}getUseList(){return this._use}getOne(e,t){let a;return this._unUse.length>0?(a=this._unUse[0],this._unUse.splice(0,1),this._use.push(a),a):(a=new e(t),this._use.push(a),a)}hasFree(){return this._unUse.length>0}}let Ji;class Ja{x=0;y=0;z=0;width=1;height=1;_globalX=0;_globalY=0;_globalWidth=0;_globalHeight=0;_visible=!0;_offsetX=0;_offsetY=0;_sprite=_.res.defaultGUISprite;_color=new J(1,1,1,1);_imageType=hi.Simple;dirtyAttributes=lt.MAX;cacheTextureId=-1;static textPool;static get quadPool(){return this.textPool||=new gh,this.textPool}static recycleQuad(e){e.sprite=null,e.dirtyAttributes=lt.MAX,e.x=0,e.y=0,e.z=-1,e.cacheTextureId=-1,Ja.quadPool.pushBack(e)}static spawnQuad(){return Ja.quadPool.getOne(Ja)}get imageType(){return this._imageType}set imageType(e){this._imageType=e,this.setAttrChange(lt.SPRITE|lt.POSITION)}get color(){return this._color}set color(e){this._color.copyFrom(e),this.setAttrChange(lt.COLOR)}get visible(){return this._visible}set visible(e){e!=this._visible&&(this._visible=e,this.setAttrChange(lt.SPRITE))}get sprite(){return this._sprite}set sprite(e){this._sprite!=e&&(this._sprite=e,this.setAttrChange(lt.SPRITE|lt.POSITION))}get left(){return this._globalX-this._offsetX}get right(){return this.left+this._globalWidth}get top(){return this._globalY-this._offsetY}get bottom(){return this.top+this._globalHeight}setSize(e,t){this.width=e,this.height=t,this.setAttrChange(lt.POSITION)}setXY(e,t){this.x=e,this.y=t,this.setAttrChange(lt.POSITION)}setAttrChange(e){this.dirtyAttributes=this.dirtyAttributes|e}applyTransform(e){this.setAttrChange(lt.POSITION);let t=this._sprite,a=e.getWorldMatrix();(this.x!=0||this.y!=0)&&(a=this.getQuadMatrix(a));let r=a.getScaleX(),i=a.getScaleY(),n=t.isSliced&&this._imageType==hi.Sliced;if(this._offsetX=e.width*.5*r,this._offsetY=e.height*.5*i,n)this._globalWidth=r*(e.width-(t.offsetSize.z-t.trimSize.x)),this._globalHeight=i*(e.height-(t.offsetSize.w-t.trimSize.y)),this._globalX=a.tx+t.offsetSize.x*r,this._globalY=a.ty+t.offsetSize.y*i;else{let o=this.width/t.offsetSize.z,l=this.height/t.offsetSize.w;this._globalWidth=r*t.trimSize.x*o,this._globalHeight=i*t.trimSize.y*l,this._globalX=a.tx+t.offsetSize.x*o*r,this._globalY=a.ty+t.offsetSize.y*l*i}return this}getQuadMatrix(e){return Ji||=new Gr,Ji.identity(),Ji.setTranslate(this.x,this.y),Ji.mul(e),Ji}writeToGeometry(e,t){return e.fillQuad(this,t),this.dirtyAttributes=lt.NONE,this}}class Jo extends et{_uiTransform;_visible=!0;destroy(){this._uiTransform.setNeedUpdateUIPanel(),super.destroy()}get uiTransform(){return this._uiTransform}get visible(){return this._visible}set visible(e){this._visible!=e&&(this._visible=e,this.onUIComponentVisible?.(this._visible))}init(e){super.init?.(e),this._uiTransform=this.object3D.getOrAddComponent(or),this._uiTransform.setNeedUpdateUIPanel()}copyComponent(e){return this.visible=e.visible,this}}class ji extends Jo{_mainQuads;_shadowRender;_shadowSource;isUIShadow;isShadowless;needUpdateShadow;init(e){super.init?.(e),this._mainQuads=[]}destroy(){this.detachQuads(),this._shadowRender?.setShadowSource(null),this._shadowSource?.setShadowRenderer(null),super.destroy(),this._shadowRender=null,this._shadowSource=null}start(){super.start?.(),this.isUIShadow?this.autoBindShadow(null,this):this.isShadowless||this.autoBindShadow(this,null),this.setShadowDirty()}setShadowDirty(){this._shadowRender&&(this._shadowRender.needUpdateShadow=!0)}get mainQuads(){return this._mainQuads}setShadowRenderer(e){this._shadowRender=e}setShadowSource(e){this._shadowSource=e}getShadowRender(){return this._shadowRender}autoBindShadow(e,t){let a=this.object3D.components.values();if(!e)for(let r of a){let i=r;if(!(i.isShadowless||i.isUIShadow)&&i.mainQuads){e=i;break}}if(!t)for(let r of a){let i=r;if(i.isUIShadow&&i.mainQuads){t=i;break}}return e&&t?(e.setShadowRenderer(t),t.setShadowSource(e),!0):!1}recycleQuad(e){if(e&&this._mainQuads){let t=this._mainQuads.indexOf(e);t>=0?(this._mainQuads.splice(t,1),Ja.recycleQuad(e)):e=null}return e}attachQuad(e){return this._mainQuads&&this._mainQuads.push(e),this}detachQuads(){if(this._mainQuads)for(;this._mainQuads.length>0;){let e=this._mainQuads.shift();this.recycleQuad(e)}return this}copyComponent(e){return super.copyComponent(e),this.isUIShadow=e.isUIShadow,this.isShadowless=e.isShadowless,this}}class zr extends ji{init(e){super.init?.(e),this.attachQuad(Ja.spawnQuad()),this.sprite=_.res.defaultGUISprite}cloneTo(e){e.getOrAddComponent(zr).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.sprite=e.sprite,this.color=e.color,this.imageType=e.imageType,this}set sprite(e){e||=_.res.defaultGUISprite;for(let t of this._mainQuads)t.sprite=e,t.setSize(this._uiTransform.width,this._uiTransform.height);this.setShadowDirty()}onTransformResize(){this.applyTransformSize()}applyTransformSize(){for(let e of this._mainQuads)e.setSize(this._uiTransform.width,this._uiTransform.height);this.setShadowDirty()}get sprite(){return this._mainQuads[0].sprite}onUIComponentVisible(e){this.applyComponentVisible()}onUITransformVisible(e){this.applyComponentVisible()}applyComponentVisible(){let e=!this._visible||!this._uiTransform.globalVisible;for(let t of this._mainQuads)t.visible=!e;this.setShadowDirty()}get color(){return this._mainQuads[0].color}set color(e){for(let t of this._mainQuads)t.color=e;this.setShadowDirty()}get imageType(){return this._mainQuads[0].imageType}set imageType(e){for(let t of this._mainQuads)t.imageType=e;this.setShadowDirty()}}class hs extends zr{space=fa.World;needUpdateGeometry=!0;panelOrder=0;needSortOnCameraZ;_billboard;_rebuild;scissorEnable=!1;scissorCornerRadius=0;scissorFadeOutSize=0;_uiRenderer;_geometry;_maxCount=128;panelRatio=1;isUIPanel=!0;cloneTo(e){e.getOrAddComponent(hs).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.panelOrder=e.panelOrder,this.needSortOnCameraZ=e.needSortOnCameraZ,this.cullMode=e.cullMode,this.billboard=e.billboard,this.scissorEnable=e.scissorEnable,this.scissorCornerRadius=e.scissorCornerRadius,this.scissorFadeOutSize=e.scissorFadeOutSize,this}init(e){super.init(e),this._uiTransform.resize(I.canvas.width,I.canvas.height),this.create(this.space),this.visible=!1}updateDrawCallSegment(e,t,a){this._geometry.updateSubGeometry(e,t,a);let r=this._uiRenderer.material,i=this._uiRenderer.materials[e];if(!i){i=new Wo(this.space);let n=this._uiRenderer.materials.slice();n.push(i),this._uiRenderer.materials=n,i.cullMode=r.cullMode,i.depthCompare=r.depthCompare}}create(e){this._maxCount=this.space==fa.World?Pr.quadMaxCountForWorld:Pr.quadMaxCountForView,this._uiRenderer=this.object3D.addComponent(bh),this._geometry=this._uiRenderer.geometry=new dh(this._maxCount).create(),this._uiRenderer.material=new Wo(e),this._uiRenderer.renderOrder=Pr.SortOrderStartWorld,this._rebuild=new uh,this.object3D.bound=new Ce(new b,new b(1,1,1).multiplyScalar(Number.MAX_VALUE*.1))}get quadMaxCount(){return this._maxCount}get renderer(){return this._uiRenderer}set billboard(e){this.space==fa.View&&(e=pr.None,console.warn("Cannot enable billboard in view space")),e==pr.BillboardXYZ||e==pr.BillboardY?(this._billboard=this.object3D.getOrAddComponent(fs),this._billboard.type=e):(this.object3D.removeComponent(fs),this._billboard=null)}get billboard(){return this._billboard?this._billboard.type:pr.None}set cullMode(e){if(this.space==fa.World)for(let t of this._uiRenderer.materials)t.cullMode=e;else console.warn("Cannot change cullMode in view space")}get cullMode(){return this._uiRenderer.material.cullMode}onUpdate(e){super.onUpdate?.(e),this.rebuildGUIMesh(e)}_collectTransform=[];rebuildGUIMesh(e){let t=this,a=t._collectTransform;if(a.length=0,t.object3D.getComponents(or,a),a.length>0){t._rebuild.build(a,t,t.needUpdateGeometry);for(const o of a)o.needUpdateQuads=!1}let r=t.object3D.getComponentFromParent(ds),i=r?r.index:0;t._uiRenderer.enable=a.length>0;let n=t.isViewPanel?Pr.SortOrderStartView:Pr.SortOrderStartWorld;if(t._uiRenderer.renderOrder=i*Pr.SortOrderCanvasSpan+n+t.panelOrder,t._uiRenderer.needSortOnCameraZ=t.needSortOnCameraZ,this.space==fa.View){let o=I.canvas.clientWidth,l=I.canvas.clientHeight,c=this._uiTransform.width,f=this._uiTransform.height;this.panelRatio=this.updateGUIPixelRatio(o,l,c,f)}else this.panelRatio=1;for(let o of t._uiRenderer.materials){let l=o;if(l.setPanelRatio(this.panelRatio),l.setScreenSize(I.canvas.clientWidth,I.canvas.clientHeight),l.setScissorEnable(t.scissorEnable),t.scissorEnable){let c=t.mainQuads[0];l.setScissorRect(c.left,c.bottom,c.right,c.top),l.setScissorCorner(t.scissorCornerRadius,t.scissorFadeOutSize)}}t.needUpdateGeometry=!1}updateGUIPixelRatio(e,t,a,r){let i=a/r,n=e/t,o=1;return i<n?o=t/r:o=e/a,o}}class bn extends hs{isViewPanel=!0;space=fa.View;constructor(){super()}cloneTo(e){e.getOrAddComponent(bn).copyComponent(this)}}class gn extends hs{isWorldPanel=!0;space=fa.World;_depthTest=!0;constructor(){super()}cloneTo(e){e.getOrAddComponent(gn).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.depthTest=e.depthTest,this}get depthTest(){return this._depthTest}set depthTest(e){if(this._depthTest!=e){this._depthTest=e;let t=this.depthTest?nt.less_equal:nt.always;for(let a of this._uiRenderer.materials)a.depthCompare=t}}}let ph;class or extends et{useParentPivot=!1;parent;pivotX=.5;pivotY=.5;_width=100;_height=100;_localVisible=!0;_globalVisible=!0;_uiInteractiveList;get uiInteractiveList(){return this._uiInteractiveList}constructor(){super(),this._localMatrix=new Gr,this._worldMatrix=new Gr}init(e){super.init(e),this.transform.eventDispatcher.addEventListener(this.transform.eventLocalChange.type,this.onTransformChange,this),this.onParentChange(null,this.object3D.parent?.object3D)}onTransformChange(e){this.onChange=!0}addUIInteractive(e){return this._uiInteractiveList||=[],this._uiInteractiveList.push(e),this}removeUIInteractive(e){if(this._uiInteractiveList){let t=this._uiInteractiveList.indexOf(e);if(t>=0)return this._uiInteractiveList.slice(t,1),e}return null}get globalVisible(){return this._globalVisible}set visible(e){if(this._localVisible!=e){this._localVisible=e;let t=this.parent?this.parent._globalVisible:!0;this.onUITransformVisible(this._localVisible&&t)}}get visible(){return this._localVisible}onUITransformVisible(e){let t=this._localVisible&&e;t!=this._globalVisible&&(this._globalVisible=t,this.object3D.components.forEach((a,r)=>{let i=a;if(i.onUITransformVisible)if(i==this)for(let n of this.object3D.entityChildren){let o=n.getComponent(or);o&&o.onUITransformVisible(this._globalVisible)}else i.onUITransformVisible(this._globalVisible)}))}onParentChange(e,t){this.parent?.setNeedUpdateUIPanel(),this.parent=t?.getComponent(or),this.parent?.setNeedUpdateUIPanel()}get width(){return this._width}get height(){return this._height}resize(e,t){if(this._width!=e||this._height!=t){this._width=e,this._height=t,this.onChange=!0;for(let a of this.object3D.components.values())a.onTransformResize?.();return!0}return!1}get x(){return this.object3D.x}set x(e){e!=this.object3D.x&&(this.object3D.x=e,this.onChange=!0)}get y(){return this.object3D.y}set y(e){e!=this.object3D.y&&(this.object3D.y=e,this.onChange=!0)}setXY(e,t){let a=this.object3D.localPosition;a.set(e,t,a.z),this.object3D.localPosition=a,this.onChange=!0}get z(){return this.object3D.z}set z(e){e!=this.object3D.z&&(this.object3D.z=e,this.onChange=!0)}get scaleX(){return this.object3D.scaleX}set scaleX(e){this.onChange=!0,this.object3D.scaleX=e}get scaleY(){return this.object3D.scaleY}set scaleY(e){this.onChange=!0,this.object3D.scaleY=e}get scaleZ(){return this.object3D.scaleZ}set scaleZ(e){this.onChange=!0,this.object3D.scaleZ=e}_localMatrix;_worldMatrix;_onChange=!0;needUpdateQuads=!0;get onChange(){return this._onChange}_tempTransforms=[];set onChange(e){if(this._onChange!=e&&(this._onChange=e,e)){this._tempTransforms.length=0;let t=this.object3D.getComponents(or,this._tempTransforms,!0);for(let a of t)a._onChange=!0,a.needUpdateQuads=!0}}onEnable(){this.setNeedUpdateUIPanel(),this.onChange=!0}onDisable(){this.setNeedUpdateUIPanel(),this.onChange=!0}setNeedUpdateUIPanel(){let e;e=this.object3D.getComponentFromParent(gn),e||(e=this.object3D.getComponentFromParent(bn)),e&&(e.needUpdateGeometry=!0)}cloneTo(e){let t=e.getOrAddComponent(or);t.visible=this.visible,t.x=this.x,t.y=this.y,t.z=this.z,t.resize(this.width,this.height),t.pivotX=this.pivotX,t.pivotY=this.pivotY,t.scaleX=this.scaleX,t.scaleY=this.scaleY}matrix(){let e=this._localMatrix,t=this.object3D.rotationZ;return this.parent?(e.updateScaleAndRotation(this.object3D.scaleX,this.object3D.scaleY,t,t),e.tx=this.object3D.x,e.ty=this.object3D.y):e.updateScaleAndRotation(1,1,0,0),(this.pivotX!=.5||this.pivotY!=.5)&&(ph||=new Gr().identity(),e.mul(ph.setTo(1,0,0,1,-(this.pivotX-.5)*this.width,-(this.pivotY-.5)*this.height))),e}getWorldMatrix(){let e=this,t=e._worldMatrix;return this._onChange&&(t.copyFrom(e.matrix()),e.parent&&t.mul(e.parent.getWorldMatrix()),e._onChange=!1),t}beforeDestroy(e){this.transform.eventDispatcher.addEventListener(this.transform.eventLocalChange.type,this.onTransformChange,this),super.beforeDestroy?.(e)}}class mh{_ray;_mouseCode;_clickEvent;_outEvent;_overEvent;_upEvent;_downEvent;_view;init(e){this._view=e,this._ray=new ua,this._clickEvent=new yt(yt.PICK_CLICK_GUI),this._outEvent=new yt(yt.PICK_OUT_GUI),this._overEvent=new yt(yt.PICK_OVER_GUI),this._upEvent=new yt(yt.PICK_UP_GUI),this._downEvent=new yt(yt.PICK_DOWN_GUI),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onTouchDown,this,null,1),_.inputSystem.addEventListener(Z.POINTER_UP,this.onTouchUp,this,null,1),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onTouchMove,this,null,1),_.inputSystem.addEventListener(Z.POINTER_CLICK,this.onTouchClick,this,null,1)}_lastDownTarget;_lastOverTarget;onTouchClick(e){this._lastOverTarget&&e.stopImmediatePropagation()}onTouchMove(e){this._mouseCode=e.mouseCode,this.collectEntities();let t=this.pick(this._colliderOut);if(t){e.stopImmediatePropagation();let a=t.collider;a!=this._lastOverTarget&&(a.mouseStyle=at.OVER,Object.assign(this._overEvent,e),this._overEvent.type=yt.PICK_OVER_GUI,this._overEvent.target=a.object3D,this._overEvent.data=t,a.object3D.dispatchEvent(this._overEvent),this._lastOverTarget&&(this._lastOverTarget.mouseStyle=at.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=yt.PICK_OUT_GUI,this._outEvent.target=a.object3D,this._outEvent.data=t,this._lastOverTarget.object3D.dispatchEvent(this._outEvent))),this._lastOverTarget=a}else this._lastOverTarget&&(this._lastOverTarget.mouseStyle=at.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=yt.PICK_OUT_GUI,this._outEvent.target=this._lastOverTarget.object3D,this._outEvent.data=t,this._lastOverTarget.object3D.dispatchEvent(this._outEvent),this._lastOverTarget=null)}_lastDownPosition=new de;_calcDistanceVec2=new de;_lastDownTime=0;_clickTimeSpan=200;_clickDistanceSpan=10;onTouchDown(e){this._lastDownTime=We.time,this._lastDownPosition.set(e.mouseX,e.mouseY),this._mouseCode=e.mouseCode,this.collectEntities();let t=this.pick(this._colliderOut);t&&e.stopImmediatePropagation();let a=t?t.collider:null;a&&(a.mouseStyle=at.DOWN,Object.assign(this._downEvent,e),this._downEvent.type=yt.PICK_DOWN_GUI,this._downEvent.target=a.object3D,this._downEvent.data=t,a.object3D.dispatchEvent(this._downEvent)),this._lastDownTarget=a}onTouchUp(e){this._calcDistanceVec2.set(e.mouseX,e.mouseY),this._mouseCode=e.mouseCode,this.collectEntities();let t=this.pick(this._colliderOut);t&&e.stopImmediatePropagation();let a=t?t.collider:null;this._lastDownTarget&&this._lastDownTarget.enable&&(this._lastDownTarget.mouseStyle=at.NORMAL),a&&a==this._lastDownTarget&&We.time-this._lastDownTime<=this._clickTimeSpan&&(this._calcDistanceVec2.set(e.mouseX,e.mouseY),this._calcDistanceVec2.distance(this._lastDownPosition)<=this._clickDistanceSpan&&(Object.assign(this._clickEvent,e),this._clickEvent.type=yt.PICK_CLICK_GUI,this._clickEvent.target=a.object3D,this._clickEvent.data=t,a.object3D.dispatchEvent(this._clickEvent))),this._lastDownTarget=null}_colliderOut=[];_transformList=[];_sortWorldPanelList=[];_iteractive2PanelDict=new Map;collectEntities(){return this._colliderOut.length=0,this._sortWorldPanelList.length=0,this._iteractive2PanelDict.clear(),this._view.canvasList.slice().reverse().forEach(t=>{if(t&&t.transform&&t.transform.parent){let a=t.object3D.getComponentsByProperty("isUIPanel",!0,!0);a.sort((r,i)=>{let n=r._uiRenderer.__renderOrder,o=i._uiRenderer.__renderOrder;return n>o?-1:1});for(let r of a){this._transformList.length=0,r.object3D.getComponents(or,this._transformList),this._transformList.reverse();for(const i of this._transformList){let n=i.uiInteractiveList;if(n&&n.length>0)for(let o of n)this._colliderOut.push(o),this._iteractive2PanelDict.set(o,r)}}}}),this._colliderOut}pick(e){this._ray=this._view.camera.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY);let t=new de(_.inputSystem.mouseX,_.inputSystem.mouseY),a=new de(I.canvas.clientWidth,I.canvas.clientHeight),r;for(const i of e)if(i.interactive&&i.enable&&i.interactiveVisible){let n=this._iteractive2PanelDict.get(i);if(r=i.rayPick(this._ray,n,t,a),r)return r.collider=i,r}return null}}var Ah=(s=>(s[s.COLLINEAR=0]="COLLINEAR",s[s.LINES_INTERSECT=1]="LINES_INTERSECT",s[s.SEGMENTS_INTERSECT=2]="SEGMENTS_INTERSECT",s[s.A_BISECTS_B=3]="A_BISECTS_B",s[s.B_BISECTS_A=4]="B_BISECTS_A",s[s.PARALELL=5]="PARALELL",s))(Ah||{}),Dh=(s=>(s[s.ON_LINE=0]="ON_LINE",s[s.LEFT_SIDE=1]="LEFT_SIDE",s[s.RIGHT_SIDE=2]="RIGHT_SIDE",s))(Dh||{});class Ut{static cacluteLine0=new Ut(null,null);static cacluteLine1=new Ut(null,null);start;end;color=new J(1,1,1,1);_normal;_normalCalculated=!1;constructor(e,t){this.start=e,this.end=t}set(e,t){this.start=e,this.end=t}getCenter(){let e=b.HELP_0;return this.start.subtract(this.end,e),e.scaleBy(.5),e.add(this.end),e}inverse(){let e=this.start;this.start=this.end,this.end=e}equals(e){return this.start==e.start&&this.end==e.end||this.start==e.end&&this.end==e.start}toArray(){return[this.start.x,this.start.y,this.start.z,this.end.x,this.end.y,this.end.z]}static getLines(e){let t=[];for(let a=0;a<e.length;a++){let r=a,i=Pn(a+1,e.length),n=e[r],o=e[i];t.push(new Ut(n,o))}return t}intersection(e,t=null){var a=(e.end.z-e.start.z)*(this.end.x-this.start.x)-(e.end.x-e.start.x)*(this.end.z-this.start.z),r=(e.end.x-e.start.x)*(this.start.z-e.start.z)-(e.end.z-e.start.z)*(this.start.x-e.start.x),i=(e.start.x-this.start.x)*(this.end.z-this.start.z)-(e.start.z-this.start.z)*(this.end.x-this.start.x);if(a==0)return r==0&&i==0?0:5;r=r/a,i=i/a;var n=this.start.x+r*(this.end.x-this.start.x),o=this.start.z+r*(this.end.z-this.start.z);return t!=null&&(t.x=n,t.y=0,t.z=o),r>=0&&r<=1&&i>=0&&i<=1?2:i>=0&&i<=1?3:r>=0&&r<=1?4:1}getDirection(){var e=this.end.subtract(this.start),t=new b(e.x,e.y);return t.normalize()}copyFrom(e){this.start||(this.start=new b),this.end||(this.end=new b),this.start.copyFrom(e.start),this.end.copyFrom(e.end)}static IsEqual(e,t){return Math.abs(e-t)<1e-7}static squreDistanceSegmentToSegment(e,t,a){let r=e.start,i=e.end,n=t.start,o=t.end,l=r.x,c=r.y,f=r.z,d=i.x,h=i.y,u=i.z,m=n.x,g=n.y,p=n.z,D=o.x,A=o.y,B=o.z,v=d-l,U=h-c,y=u-f,S=D-m,F=A-g,C=B-p,w=l-m,E=c-g,Q=f-p,T=v*v+U*U+y*y,j=v*S+U*F+y*C,ue=S*S+F*F+C*C,ee=v*w+U*E+y*Q,N=S*w+F*E+C*Q,M=T*ue-j*j,O=M,W=M,ae=0,z=0;this.IsEqual(M,0)?(ae=0,O=1,z=N,W=ue):(ae=j*N-ue*ee,z=T*N-j*ee,ae<0?(ae=0,z=N,W=ue):ae>O&&(ae=O,z=N+j,W=ue)),z<0?(z=0,-ee<0?ae=0:-ee>T?ae=O:(ae=-ee,O=T)):z>W&&(z=W,-ee+j<0?ae=0:-ee+j>T?ae=O:(ae=-ee+j,O=T));let K=0,$=0;this.IsEqual(ae,0)?K=0:K=ae/O,this.IsEqual(z,0)?$=0:$=z/W;let re=w+K*v-$*S,ce=E+K*U-$*F,Ae=Q+K*y-$*C;return re*re+ce*ce+Ae*Ae}isNear(e,t=0,a){let r=b.HELP_0,i=b.HELP_1;r.copyFrom(e.origin),i.copyFrom(e.direction),i.scaleBy(9999),i.add(r,i),Ut.cacluteLine0.set(r,i),Ut.cacluteLine1.copyFrom(this),a&&(a.perspectiveMultiplyPoint3(Ut.cacluteLine1.start,Ut.cacluteLine1.start),a.perspectiveMultiplyPoint3(Ut.cacluteLine1.end,Ut.cacluteLine1.end));let n=Ut.squreDistanceSegmentToSegment(Ut.cacluteLine0,Ut.cacluteLine1,a);return n+1e-4<=t?(e.length=n,!0):(e.length=-999999,!1)}}class us{static ID=-1;v1;v2;v3;u1;u2;u3;n1;n2;n3;t0;t;u;v;min=new b;max=new b;id=0;constructor(e,t,a){this.id=us.ID+++200,e&&t&&a&&this.set(e,t,a)}set(e,t,a){this.v1=e,this.v2=t,this.v3=a;let r=this.min,i=this.max;return r.x=Math.min(this.v1.x,this.v2.x,this.v3.x),r.y=Math.min(this.v1.y,this.v2.y,this.v3.y),r.z=Math.min(this.v1.z,this.v2.z,this.v3.z),i.x=Math.max(this.v1.x,this.v2.x,this.v3.x),i.y=Math.max(this.v1.y,this.v2.y,this.v3.y),i.z=Math.max(this.v1.z,this.v2.z,this.v3.z),this}getNormal(){let e=this.v1,t=this.v2,a=this.v3,r=new b(t.x-e.x,t.y-e.y,t.z-e.z),n=new b(a.x-e.x,a.y-e.y,a.z-e.z).crossProduct(r);return n.normalize(),n}turnBack(){let e=this.v3;this.v3=this.v1,this.v1=e}getLines(){let e=this.v1,t=this.v2,a=this.v3;return[new Ut(e,t),new Ut(t,a),new Ut(a,e)]}equals(e){let t=this.getLines(),a=e.getLines(),r=0;for(let i=0;i<t.length;i++)for(let n=0;n<a.length;n++)t[i].equals(a[n])&&r++;return r==3}getCenter(){let e=this.min,t=this.max,a=new b;return a.x=(e.x+t.x)*.5,a.y=(e.y+t.y)*.5,a.z=(e.z+t.z)*.5,a}intersects(e){var t=this.max,a=this.min,r=e.max,i=e.min;return a.x<=r.x&&t.x>=i.x&&a.y<=r.y&&t.y>=i.y&&a.z<=r.z&&t.z>=i.z}sign2D(e,t,a){return(e.x-a.x)*(t.z-a.z)-(t.x-a.x)*(e.z-a.z)}pointInTriangle2D(e){let t=this.v1,a=this.v2,r=this.v3,i,n,o,l,c;return i=this.sign2D(e,t,a),n=this.sign2D(e,a,r),o=this.sign2D(e,r,t),l=i<0||n<0||o<0,c=i>0||n>0||o>0,!(l&&c)}toArray(){return[this.v1.x,this.v1.y,this.v1.z,this.v2.x,this.v2.y,this.v2.z,this.v3.x,this.v3.y,this.v3.z]}}class _h{static _pt0;static _pt1;static _pt2;static _pt3;static _hitPoint;static _worldMatrix;static _ray;static _triangle;static _isInit;static init(){this._pt0=new b,this._pt1=new b,this._pt2=new b,this._pt3=new b,this._ray=new ua,this._triangle=new us,this._hitPoint=new b,this._worldMatrix=new R}static rayPick(e,t,a,r,i,n,o){this._isInit||(this.init(),this._isInit=!0);let l=this._worldMatrix;if(r==fa.World){let c;this.calculateHotArea_World(n,this._pt0,this._pt1,this._pt2,this._pt3),l.copyFrom(o).invert();let f=this._ray;if(f.copy(e).applyMatrix(l),this._triangle.set(this._pt0,this._pt1,this._pt2),c=f.intersectTriangle(f.origin,f.direction,this._triangle),c||(this._triangle.set(this._pt1,this._pt2,this._pt3),c=f.intersectTriangle(f.origin,f.direction,this._triangle)),c)return{distance:0,intersectPoint:c}}else{this.calculateHotArea_View(n,i,this._pt0,this._pt1,this._pt2,this._pt3);let c=a.x,f=a.y,d=Math.min(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,h=Math.min(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5,u=Math.max(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,m=Math.max(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5;return t.x<=u&&t.x>=d&&t.y<=m&&t.y>=h?(this._hitPoint.set(t.x,t.y,0),{distance:0,intersectPoint:this._hitPoint}):null}return null}static calculateHotArea_View(e,t,a,r,i,n){let o=e.getWorldMatrix(),l=o.getScaleX(),c=o.getScaleY(),f=e.width*.5*l,d=e.height*.5*c;a.set(-f,-d,0),r.set(f,-d,0),i.set(-f,d,0),n.set(f,d,0);let h=o.tx;a.x+=h,r.x+=h,i.x+=h,n.x+=h,h=o.ty,a.y-=h,r.y-=h,i.y-=h,n.y-=h,a.multiplyScalar(t),r.multiplyScalar(t),i.multiplyScalar(t),n.multiplyScalar(t)}static calculateHotArea_World(e,t,a,r,i){let n=e.getWorldMatrix(),o=n.getScaleX(),l=n.getScaleY(),c=e.width*.5*o,f=e.height*.5*l;t.set(-c,f,0),a.set(c,f,0),r.set(-c,-f,0),i.set(c,-f,0);let d=n.tx;t.x+=d,a.x+=d,r.x+=d,i.x+=d,d=n.ty,t.y+=d,a.y+=d,r.y+=d,i.y+=d}}var Bh=(s=>(s[s.UpperLeft=0]="UpperLeft",s[s.UpperCenter=1]="UpperCenter",s[s.UpperRight=2]="UpperRight",s[s.MiddleLeft=3]="MiddleLeft",s[s.MiddleCenter=4]="MiddleCenter",s[s.MiddleRight=5]="MiddleRight",s[s.LowerLeft=6]="LowerLeft",s[s.LowerCenter=7]="LowerCenter",s[s.LowerRight=8]="LowerRight",s))(Bh||{}),vh=(s=>(s[s.Upper=0]="Upper",s[s.Middle=1]="Middle",s[s.Lower=2]="Lower",s))(vh||{}),xh=(s=>(s[s.Left=0]="Left",s[s.Center=1]="Center",s[s.Right=2]="Right",s))(xh||{});class Uh{charList=[];quadList=[];width=0;index=0}class yh{layout(e){let t=[],a=e.originSize,r=fi.getFontData(e.font,a),i=e.fontSize/a;return this.makeTextLine(e.uiTransform,e.alignment,t,e.font,r,e.text,i,a,e.lineSpacing),t}makeTextLine(e,t,a,r,i,n,o,l,c){let f=-1,d=0,h=l*o,u=h*.5,m=e.width/o,g=e.height/o,p=0,D=e.height,A=()=>{d=0,f++;let y=new Uh;return y.index=f,a.push(y),y},B=(y,S)=>{const F=y.charCodeAt(0).toString();let C=fi.getFnt(r,l,F),w=null;return C?(w=Ja.spawnQuad(),w.sprite=C,w.x=(d+C.xoffset)*o-p,w.y=(i.base-C.height-C.yoffset-i.base)*o+D,w.width=C.offsetSize.width*o,w.height=C.offsetSize.height*o,d+=C.xadvance):y==`
|
|
11788
11816
|
`||(y==" "?d+=h:d+=u),S.width=d,S.quadList.push(w),S.charList.push(y),w},v=()=>{let y=this.getAlignment(t);switch(y.v){case 0:for(let S=0,F=a.length;S<F;S++){let C=a[S];if(S>0){let w=S*h*c;for(let E=0,Q=C.quadList.length;E<Q;E++){let T=C.quadList[E];T&&(T.y-=w)}}}break;case 1:for(let S=0,F=a.length;S<F;S++){let C=a[S],w=(g-F*l*c)*.5*o+S*h*c;for(let E=0,Q=C.quadList.length;E<Q;E++){let T=C.quadList[E];T&&(T.y-=w)}}break;case 2:for(let S=0,F=a.length;S<F;S++){let C=a[S],w=(g-F*l*c)*o+S*h*c;for(let E=0,Q=C.quadList.length;E<Q;E++){let T=C.quadList[E];T&&(T.y-=w)}}break}switch(y.h){case 0:break;case 1:for(let S=0,F=a.length;S<F;S++){let C=a[S],w=(m-C.width)*.5*o;for(let E=0,Q=C.quadList.length;E<Q;E++){let T=C.quadList[E];T&&(T.x+=w)}}break;case 2:for(let S=0,F=a.length;S<F;S++){let C=a[S],w=(m-C.width)*o;for(let E=0,Q=C.quadList.length;E<Q;E++){let T=C.quadList[E];T&&(T.x+=w)}}break}};(()=>{let y=null,S=n.length;for(let F=0;F<S;F++){y||=A();let C=n.charAt(F);C==`
|
|
11789
11817
|
`||C==" "?y=null:(B(C,y),y.width+u>=m&&(y=A()))}})(),v()}getAlignment(e){let t={v:0,h:0};switch(e){case 1:t.v=0,t.h=1;break;case 0:t.v=0,t.h=0;break;case 2:t.v=0,t.h=2;break;case 4:t.v=1,t.h=1;break;case 3:t.v=1,t.h=0;break;case 5:t.v=1,t.h=2;break;case 7:t.v=2,t.h=1;break;case 6:t.v=2,t.h=0;break;case 8:t.v=2,t.h=2;break}return t}}class pn extends Jo{_style=at.NORMAL;_interactive=!1;set interactive(e){this._interactive=e}get interactive(){return this._interactive}set mouseStyle(e){this._style=e}get interactiveVisible(){return this._uiTransform.globalVisible&&this._visible}init(e){super.init(e),this._uiTransform.addUIInteractive(this)}destroy(){this._uiTransform.removeUIInteractive(this),super.destroy()}rayPick(e,t,a,r){return _h.rayPick(e,a,r,t.space,t.panelRatio,this._uiTransform,t.transform.worldMatrix)}cloneTo(e){e.getOrAddComponent(pn).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.enable=e._enable,this.interactive=e._interactive,this.mouseStyle=e._style,this}}var Ch=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=1]="COLOR",s[s.SPRITE=2]="SPRITE",s))(Ch||{});class bl extends pn{_spriteMap;_colorMap;_image;_isCreateImage;_transition=2;init(e){super.init(e),this._interactive=!0,this._spriteMap=new Map,this._colorMap=new Map,this._image=this.object3D.getComponent(zr),this._isCreateImage=this._image==null,this._image||(this._image=this.object3D.addComponent(zr)),this.imageType=hi.Sliced}onEnable(){this.mouseStyle=at.NORMAL}onDisable(){this.mouseStyle=at.DISABLE}set transition(e){this._transition!=e&&(this._transition=e,this.validateStyle(this._style,!0))}get transition(){return this._transition}get imageType(){return this._image.imageType}set imageType(e){this._image.imageType=e}setStyleColor(e,t){return this._colorMap.set(e,t),this._style==e&&this.validateStyle(this._style,!0),this}getStyleColor(e){return this._colorMap.get(e)}set mouseStyle(e){super.mouseStyle=e,this.validateStyle(e,!0)}get normalSprite(){return this._spriteMap.get(at.NORMAL)}set normalSprite(e){this._spriteMap.set(at.NORMAL,e),this._style==at.NORMAL&&this.validateStyle(this._style,!0)}get overSprite(){return this._spriteMap.get(at.OVER)}set overSprite(e){this._spriteMap.set(at.OVER,e),this._style==at.OVER&&this.validateStyle(this._style,!0)}set downSprite(e){this._spriteMap.set(at.DOWN,e),this._style==at.DOWN&&this.validateStyle(this._style,!0)}get downSprite(){return this._spriteMap.get(at.DOWN)}set disableSprite(e){this._spriteMap.set(at.DISABLE,e),this._style==at.DISABLE&&this.validateStyle(this._style,!0)}get disableSprite(){return this._spriteMap.get(at.DISABLE)}validateStyle(e,t){if(this._transition&2){let a=this._spriteMap.get(e);this._image.sprite=a}if(this._transition&1){let a=this._colorMap.get(e);a&&(this._image.color=a)}}cloneTo(e){e.getOrAddComponent(bl).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.imageType=e.imageType,this.transition=e.transition,e._spriteMap.forEach((t,a)=>{t&&this._spriteMap.set(a,t)}),e._colorMap.forEach((t,a)=>{t&&this._colorMap.set(a,t.clone())}),this.mouseStyle=e.mouseStyle,this}destroy(){this._isCreateImage&&this._image&&(this.object3D.removeComponent(zr),this._image=null),super.destroy()}}class gl extends ji{_count=0;constructor(){super()}init(e){super.init?.(e),this._count=e?e.count:1;for(let t=0;t<this._count;t++)this.attachQuad(Ja.spawnQuad());this._uiTransform.resize(0,0)}getQuad(e){return this._mainQuads[e]}cloneTo(e){e.addComponent(gl,{count:this._count}).copyComponent(this)}copyComponent(e){super.copyComponent(e);for(let t=0;t<e._count;t++)this.setSprite(t,e.getSprite(t)),this.setColor(t,e.getColor(t)),this.setImageType(t,e.getImageType(t));return this}setSprite(e,t){this._mainQuads[e].sprite=t||_.res.defaultGUISprite,this.setShadowDirty()}getSprite(e){return this._mainQuads[e].sprite}onUIComponentVisible(e){this.applyComponentVisible()}onUITransformVisible(e){this.applyComponentVisible()}applyComponentVisible(){let e=!this._visible||!this._uiTransform.globalVisible;for(let t of this._mainQuads)t.visible=!e;this.setShadowDirty()}getColor(e){return this._mainQuads[e].color}setColor(e,t){this._mainQuads[e].color=t,this.setShadowDirty()}getImageType(e){return this._mainQuads[e].imageType}setImageType(e,t){this._mainQuads[e].imageType=t,this.setShadowDirty()}setSize(e,t,a){this._mainQuads[e].setSize(t,a),this.setShadowDirty()}setXY(e,t,a){this._mainQuads[e].setXY(t,a),this.setShadowDirty()}getXY(e,t){t||=new de;let a=this._mainQuads[e];return t.x=a.x,t.y=a.y,t}}class pl extends ji{_shadowQuality=1;_shadowOffset;_shadowRadius;_shadowColor;_subShadowColor;needUpdateShadow=!1;init(e){super.init?.(e),this._shadowRadius=2,this._shadowQuality=1,this._shadowOffset=new de(4,-4),this._shadowColor=new J(.1,.1,.1,.8),this._subShadowColor=this._shadowColor.clone(),this.isUIShadow=!0}cloneTo(e){e.getOrAddComponent(pl).copyComponent(this)}copyComponent(e){return super.copyComponent(this),this._shadowColor=e._shadowColor,this._shadowOffset=e._shadowOffset,this._shadowRadius=e._shadowRadius,this._shadowQuality=e.shadowQuality,this}get shadowColor(){return this._shadowColor}set shadowColor(e){this._shadowColor.copyFrom(e),this.needUpdateShadow=!0}set shadowQuality(e){e=Be(e,0,4),this._shadowQuality!=e&&(this._shadowQuality=e,this.needUpdateShadow=!0)}get shadowQuality(){return this._shadowQuality}set shadowOffset(e){this._shadowOffset=e,this.needUpdateShadow=!0}get shadowOffset(){return this._shadowOffset||=new de(4,-4),this._shadowOffset}set shadowRadius(e){this._shadowRadius!=e&&(this._shadowRadius=e,this.applyShadow())}get shadowRadius(){return this._shadowRadius}onUpdate(e){this.needUpdateShadow&&(this.applyShadow(),this.needUpdateShadow=!1)}applyShadow(){if(this.detachQuads(),this._shadowSource&&this._shadowQuality>0){let e=this._shadowSource.mainQuads;if(e.length>0)for(let t of e)this.createQuadShadow(t)}this._uiTransform.setNeedUpdateUIPanel()}createQuadShadow(e){let t=this._shadowQuality,a=Math.PI*2;this._subShadowColor.copyFrom(this._shadowColor),this._subShadowColor.a=1/Math.max(1,t);for(let r=0;r<t;r++){let i=Ja.spawnQuad(),n=0,o=0;if(r==0)i.color=this._shadowColor;else{let l=a*(r-1)/(t-1);n=Math.sin(l)*this._shadowRadius,o=Math.cos(l)*this._shadowRadius,i.color=this._subShadowColor}i.setXY(n+this._shadowOffset.x+e.x,o+this._shadowOffset.y+e.y),i.setSize(e.width,e.height),i.sprite=e.sprite,i.visible=e.visible,i.imageType=e.imageType,this.attachQuad(i)}}}class ml extends ji{_font="\u5FAE\u8F6F\u96C5\u9ED1";_fontSize=14;_originSize=42;_alignment=0;_lineSpacing=1;_text="";_color=new J(1,1,1,1);constructor(){super()}cloneTo(e){e.getOrAddComponent(ml).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this._font=e._font,this._fontSize=e._fontSize,this._originSize=e._originSize,this._alignment=e._alignment,this._lineSpacing=e._lineSpacing,this._color.copyFrom(e._color),this.text=e.text,this}get originSize(){return this._originSize}get font(){return this._font}set font(e){this._font=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!=e&&(this._fontSize=e,this.layoutText())}get text(){return this._text}set text(e){this._text!=e&&(e||(e=""),this._text=e,this.layoutText())}textLine=null;layoutProxy=new yh;layoutText(){this.detachQuads(),this.textLine=this.layoutProxy.layout(this);for(let e=0,t=this.textLine.length;e<t;e++){let a=this.textLine[e];for(let r=0,i=a.quadList.length;r<i;r++){let n=a.quadList[r];n&&this.attachQuad(n)}}this.color=this._color,this._uiTransform.setNeedUpdateUIPanel(),this.onUIComponentVisible(this._visible),this.setShadowDirty()}onUIComponentVisible(e){this.applyComponentVisible()}onUITransformVisible(e){this.applyComponentVisible()}applyComponentVisible(){let e=!this._visible||!this._uiTransform.globalVisible;for(let t of this._mainQuads)t&&(t.visible=!e);this.setShadowDirty()}onTransformResize(){this.layoutText()}get color(){return this._color}set color(e){this._color.copyFrom(e);for(let t of this._mainQuads)t.color=e;this.setShadowDirty()}get alignment(){return this._alignment}set alignment(e){this._alignment!=e&&(this._alignment=e,this.layoutText())}get lineSpacing(){return this._lineSpacing}set lineSpacing(e){this._lineSpacing!=e&&(this._lineSpacing=e,this.layoutText())}}var Lg=Object.getOwnPropertyDescriptor,Gg=(s,e,t,a)=>{for(var r=a>1?void 0:a?Lg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let js=class extends Ri{constructor(){super()}init(){super.init(),this.lightData.lightType=ht.PointLight,this.object3D.name==""&&(this.object3D.name="PointLight"+zt())}get range(){return this.lightData.range}set range(s){this.lightData.range=s,this.onChange()}get at(){return this.lightData.linear}set at(s){this.lightData.linear=s,this.onChange()}get radius(){return this.lightData.radius}set radius(s){this.lightData.radius=s,this.onChange()}get quadratic(){return this.lightData.quadratic}set quadratic(s){this.lightData.quadratic=s,this.onChange()}start(){this.transform.rotationX=90,super.start()}onUpdate(){}onGraphic(s){let e=s.scene.getChildByName("graphic3D");if(!e)return;let t=e.createCustomShape(`PointLight_${this.object3D.instanceID}`,this.transform);t.buildAxis(),t.buildCircle(b.ZERO,this.range,32,b.X_AXIS),t.buildCircle(b.ZERO,this.range,32,b.Y_AXIS),t.buildCircle(b.ZERO,this.range,32,b.Z_AXIS)}debug(){}debugDraw(s){}};js=Gg([Ot(js,"Light")],js);var zg=Object.getOwnPropertyDescriptor,Wg=(s,e,t,a)=>{for(var r=a>1?void 0:a?zg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let mi=class extends Ba{_fatLineMaterial=null;_fatLineGeometry=null;_cachedResolution=new de(0,0);constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(s){s.addComponent(mi).copyComponent(this)}copyComponent(s){return super.copyComponent(s),this}set geometry(s){super.geometry=s,this._fatLineGeometry=s,s&&(this.instanceCount=s.instanceCount,this._fatLineMaterial&&s.instanceBuffer&&this._fatLineMaterial.setInstanceBuffer(s.instanceBuffer))}get geometry(){return this._fatLineGeometry}set material(s){this.materials=[s],this._fatLineMaterial=s,this._fatLineGeometry&&this._fatLineGeometry.instanceBuffer&&s.setInstanceBuffer(this._fatLineGeometry.instanceBuffer)}get material(){return this._fatLineMaterial}nodeUpdate(s,e,t,a){if(this._fatLineMaterial&&this.object3D){this._fatLineMaterial.setModelMatrix(this.object3D.transform.worldMatrix);const r=I.presentationSize[0],i=I.presentationSize[1];r>0&&i>0&&(this._cachedResolution.x!==r||this._cachedResolution.y!==i)&&(this._cachedResolution.set(r,i),this._fatLineMaterial.resolution=this._cachedResolution.clone())}super.nodeUpdate(s,e,t,a)}destroy(s){super.destroy(s)}};mi=Wg([Ot(mi,"FatLineRenderer")],mi);var Jg=Object.getOwnPropertyDescriptor,jg=(s,e,t,a)=>{for(var r=a>1?void 0:a?Jg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Zi=class extends Ba{totalCount=0;size=new de;localBoundBox=new Ce;get worldBoundBox(){const s=new Ce;s.makeEmpty();const t=this.object3D.transform.worldMatrix.rawData,a=this.localBoundBox.min,r=this.localBoundBox.max,i=[[a.x,a.y,a.z],[r.x,a.y,a.z],[a.x,r.y,a.z],[r.x,r.y,a.z],[a.x,a.y,r.z],[r.x,a.y,r.z],[a.x,r.y,r.z],[r.x,r.y,r.z]];for(const[n,o,l]of i){const c=t[0]*n+t[4]*o+t[8]*l+t[12],f=t[1]*n+t[5]*o+t[9]*l+t[13],d=t[2]*n+t[6]*o+t[10]*l+t[14];s.expandByPoint(new b(c,f,d))}return s}splatColor;transformA;transformB;texParams;_texParamDirty=!0;splatOrder;gsplatMaterial;_colorData;_transformAData;_transformBData;_orderData;_positions;_splatSetFlags;_validCount=0;_sortWorker;_lastSentTime=0;_minIntervalMs=16;_centersSent=!1;_lastViewMatrixHash=0;_lastCameraSpeed=0;_adaptiveSorting=!0;_lastPixelCullParams="";_texturesInitialized=!1;_minPixelCoverage=4;_maxPixelCoverage=0;_maxPixelCullDistance=0;_batchSize=128;instanceCount=0;_pendingUpdates=new Set;_autoFlushThreshold=100;_frameCount=0;constructor(){super()}initCount(s,e=128){if(s<=0)throw new Error("Total count must be greater than 0");this.totalCount=s,this._batchSize=e,this.size=this.evalTextureSize(s);const t=this.size.x|0,a=this.size.y|0,r=t*a;this._colorData=new Uint8Array(r*4),this._colorData.fill(0),this._transformAData=new Uint32Array(r*4),this._transformAData.fill(0),this._transformBData=new Array(r*4).fill(0),this._orderData=new Uint32Array(r);for(let i=0;i<r;i++)this._orderData[i]=i<s?i:s>0?s-1:0;this._positions=new Float32Array(s*3),this._positions.fill(0),this.localBoundBox.makeEmpty(),this._splatSetFlags=new Array(s).fill(!1),this._validCount=0,this.texParams=new Float32Array([this._validCount,this.size.x,0,1]),this.splatColor=new Fi().create(t,a,this._colorData,!1),this.splatColor.name="splatColor",this.splatColor.minFilter="nearest",this.splatColor.magFilter="nearest",this.splatColor.mipmapFilter="nearest",this.splatColor.addressModeU="clamp-to-edge",this.splatColor.addressModeV="clamp-to-edge",this.transformA=new Hn().create(t,a,this._transformAData),this.transformA.name="transformA",this.transformA.minFilter="nearest",this.transformA.magFilter="nearest",this.transformA.addressModeU="clamp-to-edge",this.transformA.addressModeV="clamp-to-edge",this.transformB=new Ts().create(t,a,this._transformBData,!1),this.transformB.name="transformB",this.transformB.minFilter="nearest",this.transformB.magFilter="nearest",this.transformB.mipmapFilter="nearest",this.transformB.addressModeU="clamp-to-edge",this.transformB.addressModeV="clamp-to-edge",this.splatOrder=new Qs().create(t,a,this._orderData),this.splatOrder.name="splatOrder",this.splatOrder.minFilter="nearest",this.splatOrder.magFilter="nearest",this.splatOrder.addressModeU="clamp-to-edge",this.splatOrder.addressModeV="clamp-to-edge",this.gsplatMaterial=new Yn,this.geometry=new Xn(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}setSplatData(s,e){if(s<0||s>=this.totalCount)throw new Error(`Index ${s} out of range [0, ${this.totalCount})`);const t=this._splatSetFlags[s];this._positions[s*3+0]=e.position[0],this._positions[s*3+1]=e.position[1],this._positions[s*3+2]=e.position[2],this.localBoundBox.expandByPoint(new b(e.position[0],e.position[1],e.position[2]));const a=.28209479177387814;let r=.5,i=.5,n=.5;e.sh&&e.sh.coeffs&&e.sh.coeffs.length>=3&&(r=.5+e.sh.coeffs[0]*a,i=.5+e.sh.coeffs[1]*a,n=.5+e.sh.coeffs[2]*a);const o=e.opacity!==void 0?1/(1+Math.exp(-e.opacity)):1,l=s*4;this._colorData[l+0]=Math.max(0,Math.min(255,Math.floor(r*255))),this._colorData[l+1]=Math.max(0,Math.min(255,Math.floor(i*255))),this._colorData[l+2]=Math.max(0,Math.min(255,Math.floor(n*255))),this._colorData[l+3]=Math.max(0,Math.min(255,Math.floor(o*255))),this.updateTransformData(s,e),t||(this._splatSetFlags[s]=!0,this._validCount++),this._pendingUpdates.add(s)}updateTransformData(s,e){const t=s*4,a=new ArrayBuffer(4),r=new Float32Array(a),i=new Uint32Array(a),n=$e=>(r[0]=$e,i[0]),o=e.position[0],l=e.position[1],c=e.position[2];this._transformAData[t+0]=n(o),this._transformAData[t+1]=n(l),this._transformAData[t+2]=n(c);let f=0,d=0,h=0,u=1;if(e.rotation){f=e.rotation[0],d=e.rotation[1],h=e.rotation[2],u=e.rotation[3];const $e=1/Math.hypot(f,d,h,u);f*=$e,d*=$e,h*=$e,u*=$e}let m=1,g=1,p=1;e.scale&&(m=Math.exp(e.scale[0]),g=Math.exp(e.scale[1]),p=Math.exp(e.scale[2]));const D=f+f,A=d+d,B=h+h,v=f*D,U=f*A,y=f*B,S=d*A,F=d*B,C=h*B,w=u*D,E=u*A,Q=u*B,T=1-(S+C),j=U+Q,ue=y-E,ee=U-Q,N=1-(v+C),M=F+w,O=y+E,W=F-w,ae=1-(v+S),z=T*m,K=j*m,$=ue*m,re=ee*g,ce=N*g,Ae=M*g,Qe=O*p,Ve=W*p,H=ae*p,ie=z*z+re*re+Qe*Qe,le=z*K+re*ce+Qe*Ve,ge=z*$+re*Ae+Qe*H,Ie=K*K+ce*ce+Ve*Ve,me=K*$+ce*Ae+Ve*H,ye=$*$+Ae*Ae+H*H,Se=t;this._transformBData[Se+0]=ie,this._transformBData[Se+1]=le,this._transformBData[Se+2]=ge,this._transformBData[Se+3]=ye;const Me=Ka(Ie)&65535,Ze=Ka(me)&65535;this._transformAData[t+3]=Me|Ze<<16}flushUpdates(){if(this._pendingUpdates.size===0)return;const s=this.size.x|0,e=this.size.y|0,t=Array.from(this._pendingUpdates);if(t.length===0)return;let a=e,r=0;for(const o of t){const l=Math.floor(o/s);l<a&&(a=l),l>r&&(r=l)}const i=r-a+1;i/e<.5&&i<e?(this.splatColor.updateTexture(s,e,this._colorData,a,i),this.transformA.updateTexture(s,e,this._transformAData,a,i),this.transformB.updateTexture(s,e,this._transformBData,!1,a,i)):(this.splatColor.updateTexture(s,e,this._colorData),this.transformA.updateTexture(s,e,this._transformAData),this.transformB.updateTexture(s,e,this._transformBData,!1)),this.updatePendingWorldPositions(),this._pendingUpdates.clear()}setAutoFlushThreshold(s){this._autoFlushThreshold=Math.max(1,s)}getStreamingStats(){return{totalCount:this.totalCount,validCount:this._validCount,pendingUpdates:this._pendingUpdates.size,progress:this.totalCount>0?this._validCount/this.totalCount*100:0}}updateWorldPositions(){!this._positions||this._validCount===0||(this._centersSent=!1)}updatePendingWorldPositions(){!this._positions||this._validCount===0||(this._centersSent=!1)}scheduleOrder(s){if(this._validCount===0)return;const e=this.object3D.transform.localChange;e&&this.updateWorldPositions();const t=s.rawData,a=t[2],r=t[6],i=t[10],n=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),o=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),l=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]),c=performance.now(),f=(c-this._lastSentTime)/1e3,d=Math.floor(n*1e3)^Math.floor(o*1e3)^Math.floor(l*1e3),h=Math.floor(a*1e3)^Math.floor(r*1e3)^Math.floor(i*1e3),u=d^h;if(u===this._lastViewMatrixHash&&!e&&this._centersSent)return;let m=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const p=Math.abs(u-this._lastViewMatrixHash)/Math.max(f,.001);p<1e3?m=this._minIntervalMs:p<1e4?m=this._minIntervalMs*.5:m=this._minIntervalMs*.2,this._lastCameraSpeed=p}if(!(c-this._lastSentTime<m)){if(this._lastViewMatrixHash=u,this._lastSentTime=c,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=U=>{const y=U.data.order,S=this._orderData.buffer;this._sortWorker.postMessage({order:S},[S]);const F=new Uint32Array(y),C=this.size.x*this.size.y,w=Math.min(this._validCount,F.length);if((!this._orderData||this._orderData.length!==C)&&(this._orderData=new Uint32Array(C)),this._orderData.set(F.subarray(0,w),0),w<C){const T=this._validCount>0?this._validCount-1:0;this._orderData.fill(T,w,C)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const E=Math.max(0,Math.min(this._validCount,U.data.count|0));this.setCount(E),this._updateTexParams();const Q=Math.ceil(E/this._batchSize);this.instanceCount=Q};const g=new Float32Array(this._validCount*3);let p=0;const D=this.object3D.transform.worldMatrix,A=this._positions,B=D.rawData;for(let U=0;U<this._validCount;U++)if(this._splatSetFlags[U]){const y=U*3,S=A[y+0],F=A[y+1],C=A[y+2];g[p*3+0]=B[0]*S+B[4]*F+B[8]*C+B[12],g[p*3+1]=B[1]*S+B[5]*F+B[9]*C+B[13],g[p*3+2]=B[2]*S+B[6]*F+B[10]*C+B[14],p++}const v=new Uint32Array(this.totalCount);for(let U=0;U<this.totalCount;U++)v[U]=U<this._validCount?U:this._validCount>0?this._validCount-1:0;this._sortWorker.postMessage({order:v.buffer,centers:g.buffer},[v.buffer,g.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const g=new Float32Array(this._validCount*3);let p=0;const D=this.object3D.transform.worldMatrix,A=this._positions,B=D.rawData;for(let v=0;v<this._validCount;v++)if(this._splatSetFlags[v]){const U=v*3,y=A[U+0],S=A[U+1],F=A[U+2];g[p*3+0]=B[0]*y+B[4]*S+B[8]*F+B[12],g[p*3+1]=B[1]*y+B[5]*S+B[9]*F+B[13],g[p*3+2]=B[2]*y+B[6]*S+B[10]*F+B[14],p++}this._sortWorker.postMessage({type:"centers",centers:g.buffer},[g.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:n,y:o,z:l},cameraDirection:{x:-a,y:-r,z:-i}})}}createSortWorker(){function s(){let n,o,l,c,f=!1;const d={x:0,y:0,z:0},h={x:0,y:0,z:0},u={x:0,y:0,z:0},m={x:0,y:0,z:0};let g,p;const D=(B,v,U)=>{for(;B<=v;){const y=v+B>>1,S=U(y);if(S>0)B=y+1;else if(S<0)v=y-1;else return y}return~B},A=()=>{if(!n||!o||!l||!c)return;const B=l.x,v=l.y,U=l.z,y=c.x,S=c.y,F=c.z,C=.001;if(!f&&Math.abs(B-d.x)<C&&Math.abs(v-d.y)<C&&Math.abs(U-d.z)<C&&Math.abs(y-h.x)<C&&Math.abs(S-h.y)<C&&Math.abs(F-h.z)<C)return;f=!1,d.x=B,d.y=v,d.z=U,h.x=y,h.y=S,h.z=F;const w=o.length/3;g?.length!==w&&(g=new Uint32Array(w));let E,Q;for(let M=0;M<8;++M){const O=(M&1?u.x:m.x)-B,W=(M&2?u.y:m.y)-v,ae=(M&4?u.z:m.z)-U,z=O*y+W*S+ae*F;M===0?E=Q=z:(E=Math.min(E,z),Q=Math.max(Q,z))}p?p.fill(0):p=new Uint32Array(65537);const T=Q-E,j=T<1e-6?0:1/T*2**16;for(let M=0;M<w;++M){const O=M*3,W=o[O+0]-B,ae=o[O+1]-v,z=o[O+2]-U,K=W*y+ae*S+z*F,$=Math.floor((K-E)*j);g[M]=$,p[$]++}for(let M=1;M<65537;M++)p[M]+=p[M-1];for(let M=0;M<w;M++){const O=g[M],W=--p[O];n[W]=M}const ue=M=>g[n[M]]/j+E,ee=()=>{const M=D(0,w-1,O=>-ue(O));return Math.min(w,Math.abs(M))},N=ue(w-1)>=0?ee():w;self.postMessage({order:n.buffer,count:N},[n.buffer]),n=null};self.onmessage=B=>{if(B.data.order&&(n=new Uint32Array(B.data.order)),B.data.centers){o=new Float32Array(B.data.centers),u.x=m.x=o[0],u.y=m.y=o[1],u.z=m.z=o[2];const v=o.length/3;for(let U=1;U<v;++U){const y=o[U*3+0],S=o[U*3+1],F=o[U*3+2];u.x=Math.min(u.x,y),u.y=Math.min(u.y,S),u.z=Math.min(u.z,F),m.x=Math.max(m.x,y),m.y=Math.max(m.y,S),m.z=Math.max(m.z,F)}f=!0}B.data.cameraPosition&&(l=B.data.cameraPosition),B.data.cameraDirection&&(c=B.data.cameraDirection),A()}}const e=`(${s.toString()})()`,t=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(t);return new Worker(a)}setVisBoost(s){this.texParams[3]=Math.max(0,s),this._texParamDirty=!0}setCount(s){this.texParams[0]=Math.max(0,s),this._texParamDirty=!0}_updateTexParams(){this._texParamDirty&&(this.gsplatMaterial.setTexParams(this.texParams),this._texParamDirty=!1)}setSortThrottle(s){this._minIntervalMs=Math.max(0,s|0)}setAdaptiveSorting(s){this._adaptiveSorting=s}setPixelCulling(s,e=0,t=0){this._minPixelCoverage=Math.max(0,s),this._maxPixelCoverage=Math.max(0,e),this._maxPixelCullDistance=Math.max(0,t)}getPixelCullingStats(){return{minPixels:this._minPixelCoverage,maxPixels:this._maxPixelCoverage,maxPixelCullDistance:this._maxPixelCullDistance,maxEnabled:this._maxPixelCoverage>0,distanceEnabled:this._maxPixelCullDistance>0}}getBatchingStats(){return{enabled:!0,batchSize:this._batchSize,instanceCount:this.instanceCount,splatCount:this._validCount,reduction:this._validCount>0?(1-this.instanceCount/this._validCount)*100:0}}evalTextureSize(s){let e=Math.ceil(Math.sqrt(s));const t=64;e=Math.ceil(e/t)*t;const a=Math.ceil(s/e);return new de(e,a)}nodeUpdate(s,e,t,a){this._validCount>0&&s?.camera&&s.camera.viewMatrix&&this.scheduleOrder(s.camera.viewMatrix),this._pendingUpdates.size>0&&this._frameCount>=60&&this.flushUpdates(),this._frameCount>=60&&this._pendingUpdates.size===0&&(this._frameCount=0),this._frameCount++,this._updateTexParams();const r=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(r);const i=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;i!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=i),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(s,e,t,a)}renderPass(s,e,t){const a=t.encoder;for(let r of this.materials){const i=r.getPass(e);if(!(!i||i.length===0))for(const n of i){if(!n.pipeline)continue;n.apply(this.geometry,t.rendererPassState||t),k.bindPipeline(a,n),k.bindGeometryBuffer(a,this.geometry);const l=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?k.drawIndexed(a,l.indexCount,this.instanceCount,l.indexStart,0,0):k.drawIndexed(a,l.indexCount,1,l.indexStart,0,0)}}}destroy(s){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(s),this.splatColor=null),this.transformA&&(this.transformA.destroy(s),this.transformA=null),this.transformB&&(this.transformB.destroy(s),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(s),this.splatOrder=null),this._positions=null,this._orderData=null,this._colorData=null,this._transformAData=null,this._transformBData=null,this.texParams=null,this._splatSetFlags=null,this._pendingUpdates.clear(),super.destroy(s)}};Zi=jg([Ot(Zi,"GSplatStreamRenderer")],Zi);class Sh extends ne{index=0;drawCallFrame=-1;constructor(){super()}}var jo=(s=>(s[s.CastGI=0]="CastGI",s[s.ReceiveGI=1]="ReceiveGI",s[s.CastDepth=2]="CastDepth",s[s.Other=3]="Other",s))(jo||{});class Fh extends vt{static count=0;constructor(e=0,t=0){super(),Y.register("GIProbeShader",jd);let a=new At,r=new qe("GIProbeShader","GIProbeShader");r.passType=fe.COLOR,a.addRenderPass(r),r.setDefine("USE_BRDF",!0),r.setShaderEntry("VertMain","FragMain"),r.setUniformVector4("probeUniform",new be(t,e,0,0));let i=r.shaderState;i.acceptShadow=!1,i.castShadow=!1,i.receiveEnv=!1,i.acceptGI=!1,i.useLight=!1,a.setTexture("baseMap",_.res.whiteTexture),a.setTexture("normalMap",_.res.normalTexture),a.setTexture("emissiveMap",_.res.blackTexture),this.shader=a}}class Zg extends et{_probes;_volume;_debugMr=[];init(e){e||=_.views[0]?.scene,_.setting.gi.enable=!0,this._volume=xe.getLightEntries(e).irradianceVolume,this.initProbe(e)}initProbe(e){let t=this._volume.setting.probeXCount,a=this._volume.setting.probeYCount,r=this._volume.setting.probeZCount,i=new Nr(4,16,16),n=new b;this._probes=[];for(let o=0;o<t;o++)for(let l=0;l<a;l++)for(let c=0;c<r;c++){let f=o+c*t+l*(t*r),d=new Sh;d.index=f,d.name=`${o}_${l}_${c}`;let h=d.addComponent(he);h.material=new Fh(jo.CastGI,f),h.geometry=i,h.castGI=!1,h.castShadow=!1,this._debugMr.push(h),this.object3D.addChild(d),this._volume.calcPosition(o,l,c,n),d.x=n.x,d.y=n.y,d.z=n.z,this._probes[f]=d,this._debugMr.push(h)}for(let o=0;o<this._probes.length;o++)q.instance.addGIProbe(e,this._probes[o]);this.object3D.transform.enable=!1,this._volume.setting.debug&&this.debug()}debug(){}debugProbeRay(e,t){const a=_.setting.gi.rayNumber;let r=new se(0,-.7071067811865475,.7071067811865475,0);for(let i=0;i<a;i++){let n=e*a+i,o=new b(-t[n*4+0],-t[n*4+1],-t[n*4+2],0);r.transformVector(o,o);let l=t[n*4+3],c=this._probes[e].transform.worldPosition.clone(),f=o.scaleBy(l);f.add(c,f)}}changeProbesVolumeData(){this._volume.setVolumeDataChange()}changeProbesPosition(){this._volume.setVolumeDataChange();let e=this._volume.setting.probeXCount,t=this._volume.setting.probeYCount,a=this._volume.setting.probeZCount,r=new b;for(let i=0;i<e;i++)for(let n=0;n<t;n++)for(let o=0;o<a;o++){let l=i+o*e+n*(e*a),c=this._probes[l];this._volume.calcPosition(i,n,o,r),c.x=r.x,c.y=r.y,c.z=r.z}}onUpdate(){_.setting.gi.maxDistance=_.setting.gi.probeSpace*1.5;let e=this.transform.scene3D.view.camera,t=b.distance(e.transform.worldPosition,e.transform.targetPos)/300;if(this._debugMr&&this._debugMr.length>0)for(let a=0;a<this._debugMr.length;a++){const r=this._debugMr[a].transform;r.scaleX=t,r.scaleY=t,r.scaleZ=t}}}class Yg extends Ba{_keyRenderGroup;_keyBufferGroup;_keyIdsGroup;constructor(){super()}init(e){this._keyRenderGroup=new Map,this._keyBufferGroup=new Map,this._keyIdsGroup=new Map}start(){let e=[];this.object3D.getComponents(he,e,!0);for(let t=0;t<e.length;t++){const a=e[t];a.transform.updateWorldMatrix(!0),a.enable=!1;let r=a.geometry.instanceID;for(let i=0;i<a.materials.length;i++){const n=a.materials[i];r+=n.instanceID}if(this._keyRenderGroup.has(r))this._keyRenderGroup.get(r).push(a),this._keyIdsGroup.get(r).push(a.transform.worldMatrix.index);else{let i=new Pe(e.length);i.visibility=GPUShaderStage.VERTEX,this._keyRenderGroup.set(r,[a]),this._keyBufferGroup.set(r,i),this._keyIdsGroup.set(r,[a.transform.worldMatrix.index])}}this._keyBufferGroup.forEach((t,a)=>{let r=this._keyIdsGroup.get(a),i=this._keyBufferGroup.get(a);i.setInt32Array("matrixIDs",new Int32Array(r)),i.apply()})}reset(){this._keyRenderGroup.size>0&&(this._keyRenderGroup.clear(),this._keyBufferGroup.clear(),this._keyIdsGroup.clear(),this.start())}nodeUpdate(e,t,a,r){this._keyRenderGroup.forEach((i,n)=>{let o=this._keyBufferGroup.get(n),l=i[0];for(let c=0;c<l.materials.length;c++){let d=l.materials[c].getPass(t);if(d)for(let h=0;h<d.length;h++){const u=d[h];u.setDefine("USE_INSTANCEDRAW",!0),u.setStorageBuffer("instanceDrawID",o)}}l.nodeUpdate(e,t,a,r)})}renderPass(e,t,a){this._keyRenderGroup.forEach((r,i)=>{let n=r[0];n.instanceCount=r.length,this.renderItem(e,t,n,a)})}renderItem(e,t,a,r){let i=a.transform._worldMatrix;for(let n=0;n<a.materials.length;n++){let l=a.materials[n].getPass(t);if(!(!l||l.length==0))for(let c=0;c<l.length;c++){let f=l[c];k.bindGeometryBuffer(r.encoder,a.geometry);const d=f;d.shaderState.splitTexture&&(r.endRenderPass(),Mt.WriteSplitColorTexture(a.instanceID),r.beginOpaqueRenderPass(),k.bindCamera(r.encoder,e.camera),k.bindGeometryBuffer(r.encoder,a.geometry)),k.bindPipeline(r.encoder,d);let g=a.geometry.subGeometries[n].lodLevels[a.lodLevel];a.instanceCount>0?k.drawIndexed(r.encoder,g.indexCount,a.instanceCount,g.indexStart,0,0):k.drawIndexed(r.encoder,g.indexCount,1,g.indexStart,0,i.index)}}}beforeDestroy(e){this._keyRenderGroup.clear(),this._keyBufferGroup.clear(),this._keyIdsGroup.clear(),this._keyRenderGroup=this._keyBufferGroup=this._keyIdsGroup=void 0,Oe.removeWaitStart(this.object3D,this)}}var Xg=Object.getOwnPropertyDescriptor,Hg=(s,e,t,a)=>{for(var r=a>1?void 0:a?Xg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Zs=class extends he{constructor(){super()}get geometry(){return null}set geometry(s){}cloneTo(s){}set meshURL(s){let e=_.res.getGeometry(s);e?this.geometry=e:console.error("no geometry set",s)}};Zs=Hg([Ot(Zs,"MeshFilter")],Zs);var Kg=Object.getOwnPropertyDescriptor,qg=(s,e,t,a)=>{for(var r=a>1?void 0:a?Kg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Yi=class extends he{skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Ne.SkinnedMesh)}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(mr),!this.skeletonAnimation){let s=this.object3D.parentObject.parentObject.getComponentsInChild(mr);s.length>0&&(this.skeletonAnimation=s[0]);let e=this.object3D;for(;!this.skeletonAnimation&&e;)this.skeletonAnimation=e.getComponentFromParent(mr),e.parent&&(e=e.parent.object3D)}}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(s){if(this.mSkeletonAnimation=s,!!s&&!this.mJointIndexTableBuffer){let e=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new Pe(e.length*4,0,new Float32Array(e)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(s){this.mInverseBindMatrixData=s;var e=new Float32Array(s.length*16);for(let t=0;t<s.length;t++){let a=t*16,r=s[t];e.set(r,a)}this.mInverseBindMatrixBuffer=new Pe(e.byteLength,0,e),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(s){let e=s.addComponent(Yi);e.geometry=this.geometry,e.material=this.material.clone(),e.castShadow=this.castShadow,e.castGI=this.castGI,e.receiveShadow=this.receiveShadow,e.rendererMask=this.rendererMask,e.skinJointsName=this.skinJointsName,e.skinInverseBindMatrices=this.skinInverseBindMatrices,e.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(s,e,t,a){for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++){const l=n[o];!l.pipeline&&this.mSkeletonAnimation&&(l.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),l.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),l.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(s,e,t,a)}};Yi=qg([Ot(Yi,"SkinnedMeshRenderer")],Yi);class $g extends gt{radius=2.5;height=10;constructor(){super(),this._shapeType=ui.Capsule}}class mn extends gt{mesh;static triangle;_pickRet;constructor(){super(),this._shapeType=ui.Mesh}rayPick(e,t){if(this.mesh){mn.triangle||=new us(new b,new b,new b);let a=this.mesh.getAttribute(G.position),r=this.mesh.getAttribute(G.indices),i=gt.helpMatrix;i.copyFrom(t).invert();let n=gt.helpRay.copy(e);if(n.applyMatrix(i),n.intersectBox(this.mesh.bounds),!n.intersectBox(this.mesh.bounds,gt.v3_help_0))return null;if(r&&a&&r.data.length>0){let l=a.data;for(let c=0,f=r.data.length/3;c<f;c++){let d=c*3;const h=r.data[d+0]*3,u=r.data[d+1]*3,m=r.data[d+2]*3;let g=mn.triangle,p=g.v1.set(l[h+0],l[h+1],l[h+2]),D=g.v2.set(l[u+0],l[u+1],l[u+2]),A=g.v3.set(l[m+0],l[m+1],l[m+2]);g.set(p,D,A);let B=n.intersectTriangle(n.origin,n.direction,g);if(B){this._pickRet||={intersectPoint:new b,distance:0},this._pickRet.intersectPoint=B,this._pickRet.distance=b.distance(n.origin,B);let v=this.mesh.getAttribute(G.normal);if(v){let U=v.data,y=new b(U[h],U[h+1],U[h+2]);t.transformVector(y,y),y.normalize(),this._pickRet.normal=y}return this._pickRet}}}}return null}}class ep extends gt{_pickRet;box;radius=.5;constructor(e){super(),this._shapeType=ui.Sphere,this.radius=e,this.box=new Lr(new b,1)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.radius);let r=gt.helpMatrix;r.copyFrom(t).invert();let i=gt.helpRay.copy(e);i.applyMatrix(r);let n=i.intersectSphere(i.origin,i.direction,this.box.center,this.box.radius);return n?(this._pickRet||(this._pickRet={intersect:!1,intersectPoint:new b,distance:0}),this._pickRet.intersect=!0,this._pickRet.intersectPoint=n,this._pickRet.distance=b.distance(i.origin,gt.v3_help_0),this._pickRet):null}}class tp extends ne{_envMap;skyObject;envMapChange=!0;view;constructor(){super(),this.transform.scene3D=this,this.skyObject=new ne,this.addChild(this.skyObject),this._isScene3D=!0,this.envMap||=_.res.defaultSky}get envMap(){return this._envMap}set envMap(e){this._envMap!=e&&(this.envMapChange=!0),this._envMap=e,q.instance.sky&&"map"in q.instance.sky&&(q.instance.sky.map=e)}get exposure(){return q.instance.sky&&"exposure"in q.instance.sky?q.instance.sky.exposure:0}set exposure(e){q.instance.sky&&"exposure"in q.instance.sky&&(q.instance.sky.exposure=e,_.setting.sky.skyExposure=e)}get roughness(){if(q.instance.sky&&"roughness"in q.instance.sky)return q.instance.sky.roughness}set roughness(e){q.instance.sky&&"roughness"in q.instance.sky&&(q.instance.sky.roughness=e)}}class kh{_computeShader;_outBuffer;constructor(){}init(){let e=ve.getGBufferFrame(ve.colorPass_GBuffer);this._computeShader=new Fe(kd),this._outBuffer=new ni(32),this._computeShader.setStorageBuffer("outBuffer",this._outBuffer),this._computeShader.setSamplerTexture("gBufferTexture",e.getCompressGBufferTexture())}compute(e){let t=xe.getCameraGroup(e.camera);this._computeShader.setStorageBuffer("globalUniform",t.uniformGPUBuffer);let a=k.beginCommandEncoder();k.computeCommand(a,[this._computeShader]),k.endCommandEncoder(a),this._outBuffer.readBuffer()}getPickMeshID(){var e=this._outBuffer.outFloat32Array[0]+.1;return Math.floor(e)}getPickWorldPosition(e){e||=new b;var t=this._outBuffer.outFloat32Array[4],a=this._outBuffer.outFloat32Array[5],r=this._outBuffer.outFloat32Array[6];return e.set(t,a,r),e}getPickWorldNormal(e){e||=new b;var t=this._outBuffer.outFloat32Array[8],a=this._outBuffer.outFloat32Array[9],r=this._outBuffer.outFloat32Array[10];return e.set(t*2-1,a*2-1,r*2-1).normalize(),e}getPickScreenUV(e){e||=new de;var t=this._outBuffer.outFloat32Array[2],a=this._outBuffer.outFloat32Array[3];return e.set(t,a),e}}class Eh extends Za{ray;isTouching=!1;_mouseCode;_pickEvent;_outEvent;_overEvent;_upEvent;_downEvent;_mouseMove;_pickCompute;_lastDownTarget;mouseEnableMap;_view;constructor(e){super(),this._view=e,this.init()}init(){this.ray=new ua,this.mouseEnableMap=new Map,this._pickEvent=new Z(Z.PICK_CLICK),this._outEvent=new Z(Z.PICK_OUT),this._overEvent=new Z(Z.PICK_OVER),this._mouseMove=new Z(Z.PICK_MOVE),this._upEvent=new Z(Z.PICK_UP),this._downEvent=new Z(Z.PICK_DOWN)}start(){_.setting.pick.enable&&(_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onTouchStart,this),_.inputSystem.addEventListener(Z.POINTER_UP,this.onTouchEnd,this),_.inputSystem.addEventListener(Z.POINTER_CLICK,this.onTouchOnce,this),_.inputSystem.addEventListener(Z.POINTER_RIGHT_CLICK,this.onTouchOnce,this),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onTouchMove,this)),_.setting.pick.mode=="pixel"&&(this._pickCompute=new kh,this._pickCompute.init())}stop(){_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.onTouchStart,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.onTouchEnd,this),_.inputSystem.removeEventListener(Z.POINTER_CLICK,this.onTouchOnce,this),_.inputSystem.removeEventListener(Z.POINTER_RIGHT_CLICK,this.onTouchOnce,this),_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.onTouchMove,this)}onTouchStart(e){this.isTouching=!0,this._mouseCode=e.mouseCode,this.pick(this._view.camera);let t=this.findNearestObj(this._interestList,this._view.camera);this._lastDownTarget=t,t&&(Object.assign(this._downEvent,e),this._downEvent.type=Z.PICK_DOWN,this._downEvent.target=t.object3D,this._downEvent.data=this.getPickInfo(),this.dispatchEvent(this._downEvent),t.object3D.containEventListener(Z.PICK_DOWN)&&t.object3D.dispatchEvent(this._downEvent))}onTouchEnd(e){this.isTouching=!1,this._mouseCode=e.mouseCode,this.pick(this._view.camera);let t=this.findNearestObj(this._interestList,this._view.camera);t&&(Object.assign(this._upEvent,e),this._upEvent.type=Z.PICK_UP,this._upEvent.target=t.object3D,this._upEvent.data=this.getPickInfo(),this.dispatchEvent(this._upEvent),t.object3D.containEventListener(Z.PICK_UP)&&t.object3D.dispatchEvent(this._upEvent))}_lastFocus;getPickInfo(){if(_.setting.pick.mode=="pixel")return{worldPos:this._pickCompute.getPickWorldPosition(),worldNormal:this._pickCompute.getPickWorldNormal(),screenUv:this._pickCompute.getPickScreenUV(),meshID:this._pickCompute.getPickMeshID()};{let e=this._interestList[0];return{worldPos:e.intersectPoint,worldNormal:e.normal,meshID:e.collider.transform.worldMatrix.index,distance:e.distance}}}onTouchMove(e){this.isTouching=!0,this._mouseCode=e.mouseCode,this.pick(this._view.camera);let t=this.findNearestObj(this._interestList,this._view.camera);t&&(Object.assign(this._mouseMove,e),this._mouseMove.type=Z.PICK_MOVE,this._mouseMove.target=t.object3D,this._mouseMove.data=this.getPickInfo(),this.dispatchEvent(this._mouseMove),t.object3D.containEventListener(Z.PICK_MOVE)&&t.object3D.dispatchEvent(this._mouseMove)),t!=this._lastFocus&&(this._lastFocus&&this._lastFocus.object3D&&(Object.assign(this._outEvent,e),this._outEvent.type=Z.PICK_OUT,this._outEvent.target=this._lastFocus.object3D,this._outEvent.data=this.getPickInfo(),this.dispatchEvent(this._outEvent),this._lastFocus.object3D.containEventListener(Z.PICK_OUT)&&this._lastFocus.object3D.dispatchEvent(this._outEvent)),t&&(Object.assign(this._overEvent,e),this._overEvent.type=Z.PICK_OVER,this._overEvent.target=t.object3D,this._overEvent.data=this.getPickInfo(),this.dispatchEvent(this._overEvent),t.object3D.containEventListener(Z.PICK_OVER)&&t.object3D.dispatchEvent(this._overEvent))),this._lastFocus=t}onTouchOnce(e){this.isTouching=!0,this._mouseCode=e.mouseCode,this.pick(this._view.camera);let t=this.findNearestObj(this._interestList,this._view.camera);if(t){let a=this.getPickInfo();Object.assign(this._pickEvent,e),this._pickEvent.type=Z.PICK_CLICK,this._pickEvent.target=t.object3D,this._pickEvent.data=a,this.dispatchEvent(this._pickEvent),t===this._lastDownTarget&&t.object3D.containEventListener(Z.PICK_CLICK)&&t.object3D.dispatchEvent(this._pickEvent)}this._lastDownTarget=null}findNearestObj(e,t){return e.sort((a,r)=>a.distance>r.distance?1:-1),e[0]?.collider}_interestList=[];pick(e){if(this._interestList.length=0,_.setting.pick.mode=="pixel"){this._pickCompute.compute(this._view);let t=this._pickCompute.getPickMeshID(),a=this.mouseEnableMap.get(t);if(a){let r=this._pickCompute.getPickWorldPosition(),i=b.distance(r,this.ray.origin);this._interestList.push({distance:i,collider:a,intersectPoint:r})}}else if(_.setting.pick.mode=="bound"){this.ray=e.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY);let t,a=Oe.componentsEnablePickerList.get(this._view);if(a)for(const r of a){let i=r[0];i.enable&&(t=i.rayPick(this.ray),t&&(t.collider=i,this._interestList.push(t)))}}}}class ap extends ys{_camera;_scene;_viewPort;_enablePick=!1;_enable=!0;pickFire;guiPick;canvasList;constructor(e=0,t=0,a=0,r=0){super(),this.canvasList=[],this._viewPort=new be(e,t,a,r)}get enable(){return this._enable}set enable(e){this._enable=e}get enablePick(){return this._enablePick}set enablePick(e){this._enablePick!=e&&(this.pickFire=new Eh(this),this.pickFire.start()),this._enablePick=e}get scene(){return this._scene}set scene(e){this._scene=e,e.view=this,jt.createBuffer(this),e&&this.canvasList.forEach(t=>{t&&e.addChild(t.object3D)})}get camera(){return this._camera}set camera(e){this._camera=e}get viewPort(){return this._viewPort}set viewPort(e){this._viewPort=e}enableUICanvas(e=0){let t=this.canvasList[e];if(!t){let a=new ne;a.name="Canvas "+e,t=a.addComponent(ds),t.index=e,this.canvasList[e]=t}return this.scene.addChild(t.object3D),this.guiPick||(this.guiPick=new mh,this.guiPick.init(this)),t}disableUICanvas(e=0){let t=this.canvasList[e];t&&t.object3D&&t.object3D.removeFromParent()}}class rp{normal;fixNormal;center;rotateShape;distance=0;index;constructor(e){this.index=e,this.rotateShape=[]}}class ip extends Le{vScale;uNegate;sections;build(e,t,a,r=1,i=!0){if(a.length<2)throw new Error("path length is not enough");return this.vScale=r,this.uNegate=i,e=e.slice(),t&&e.push(e[0]),this.sections=this.buildSections(e,a),this.buildGeometry(e,this.sections),this.bounds=new Ce(b.ZERO.clone(),new b(100,100,100)),this}buildSections(e,t){let a,r,i,n=[],o=t.length;for(let c=0;c<o;c++){let f=new rp(c);a=t[c],r=t[c+1],f.center=a.clone(),r==null?(f.normal=i.clone(),f.distance=0):(i=r.subtract(a),f.distance=i.length,f.normal=i.normalize()),n.push(f)}n[0].fixNormal=n[0].normal.clone();for(let c=1;c<o;c++){let f=n[c-1],d=n[c];d.fixNormal=d.normal.add(f.normal).normalize()}let l=new R().identity();for(let c=0;c<o;c++){let f=n[c],d,h;if(c==0)d=b.UP,h=e;else{let u=n[c-1];d=u.fixNormal,h=u.rotateShape}R.fromToRotation(d,f.fixNormal,l);for(let u=0,m=e.length;u<m;u++){let g=l.multiplyPoint3(h[u]);f.rotateShape.push(g)}}return n}buildGeometry(e,t){let a=t.length,r=e.length,i=a*r,n=a-1,o=new Float32Array(i*3),l=new Float32Array(i*3),c=new Float32Array(i*2),f=new Uint32Array(n*(r-1)*6),d=r-1,h=0,u=0,m=[0];for(let p=1;p<r;p++)u+=e[p-1].subtract(e[p]).length,m.push(u);for(let p=0;p<a;p++){let D=t[p];for(let A=0;A<r;A++){let B=(p*r+A)*3,v=D.rotateShape[A].add(D.center);o[B]=v.x,o[B+1]=v.y,o[B+2]=v.z,l[B+1]=1;let U=(p*r+A)*2,y=m[A]/u;c[U]=this.uNegate?1-y:y,c[U+1]=h*this.vScale}h+=D.distance}let g=0;for(let p=0;p<n;p++){let D=p*r;for(let A=0;A<d;A++){let B=A,v=A+1,U=B+r,y=v+r;f[g++]=B+D,f[g++]=v+D,f[g++]=U+D,f[g++]=v+D,f[g++]=y+D,f[g++]=U+D}}return this.setIndices(f),this.setAttribute(G.position,o),this.setAttribute(G.normal,l),this.setAttribute(G.uv,c),this.setAttribute(G.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.computeNormals(),this}}class wh extends Le{_instanceBuffer;_instanceData;_instanceCount=0;constructor(){super(),this.initBaseGeometry()}initBaseGeometry(){const e=new Float32Array([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0]),t=new Float32Array([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2]),a=new Uint16Array([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]);this.setIndices(a),this.setAttribute(G.position,e),this.setAttribute(G.uv,t),this.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:e.length/3,firstStart:0,index:0,topology:0})}setPositions(e){const t=e instanceof Float32Array?e:new Float32Array(e),r=t.length/3-1;if(r<=0)return console.warn("FatLineGeometry: Need at least 2 points"),this;const i=new Float32Array(r*16);for(let n=0;n<r;n++){const o=n*3,l=(n+1)*3;i[n*16+0]=t[o+0],i[n*16+1]=t[o+1],i[n*16+2]=t[o+2],i[n*16+3]=0,i[n*16+4]=t[l+0],i[n*16+5]=t[l+1],i[n*16+6]=t[l+2],i[n*16+7]=0,i[n*16+8]=1,i[n*16+9]=1,i[n*16+10]=1,i[n*16+11]=0,i[n*16+12]=1,i[n*16+13]=1,i[n*16+14]=1,i[n*16+15]=0}return this._instanceData=i,this._instanceCount=r,this.computeBoundingBox(t),this}setColors(e){const t=e instanceof Float32Array?e:new Float32Array(e);if(!this._instanceData)return console.warn("FatLineGeometry: Must call setPositions() before setColors()"),this;const r=t.length/3-1;if(r!==this._instanceCount)return console.warn("FatLineGeometry: Color array length doesn't match segment count"),this;for(let i=0;i<r;i++){const n=i*3,o=(i+1)*3;this._instanceData[i*16+8]=t[n+0],this._instanceData[i*16+9]=t[n+1],this._instanceData[i*16+10]=t[n+2],this._instanceData[i*16+12]=t[o+0],this._instanceData[i*16+13]=t[o+1],this._instanceData[i*16+14]=t[o+2]}return this}computeBoundingBox(e){const t=new b(1/0,1/0,1/0),a=new b(-1/0,-1/0,-1/0);for(let i=0;i<e.length;i+=3){const n=e[i],o=e[i+1],l=e[i+2];t.x=Math.min(t.x,n),t.y=Math.min(t.y,o),t.z=Math.min(t.z,l),a.x=Math.max(a.x,n),a.y=Math.max(a.y,o),a.z=Math.max(a.z,l)}const r=b.sub(a,t);this.bounds=new Ce(b.ZERO.clone(),r),this.bounds.setFromMinMax(t,a)}get instanceData(){return this._instanceData}get instanceCount(){return this._instanceCount}get instanceBuffer(){return!this._instanceBuffer&&this._instanceData&&(this._instanceBuffer=new Pe(this._instanceData.byteLength),this._instanceBuffer.setFloat32Array("",this._instanceData),this._instanceBuffer.apply()),this._instanceBuffer}updateInstanceBuffer(){this._instanceBuffer&&this._instanceData&&(this._instanceBuffer.setFloat32Array("",this._instanceData),this._instanceBuffer.apply())}}class sp{name;offset;size;arrayStride;stepMode;attributes}class np{name;format;offset;shaderLocation;stride}var Ih=(s=>(s[s.position=3]="position",s[s.normal=3]="normal",s[s.TANGENT=4]="TANGENT",s[s.uv=2]="uv",s[s.TEXCOORD_1=2]="TEXCOORD_1",s[s.color=4]="color",s[s.joints0=4]="joints0",s[s.weights0=4]="weights0",s[s.joints1=4]="joints1",s[s.weights1=4]="weights1",s[s.vIndex=1]="vIndex",s[s.weight=1]="weight",s[s.a_morphPositions_0=3]="a_morphPositions_0",s))(Ih||{});class op{get data(){return null}entity}class Rh{min=0;max=0;set(e,t){return this.max=t,this.min=e,this}copy(e){return this.max=e.max,this.min=e.min,this}isInterestRange(e){return!(this.max>e.min||e.max<this.min)}}class Qh{_spaceDesc;getRange(e){return this._spaceDesc[e]}initSpace(e){this._spaceDesc={};for(let t of e)(this._spaceDesc[t]=new Rh).set(-Number.MAX_VALUE,Number.MAX_VALUE);return this}isContain(e,t){let a=this._spaceDesc[e];return t>=a.min&&t<a.max}isInterestRange(e,t){let a=this._spaceDesc[e];return a?t.isInterestRange(a):!1}splitSpace(e,t,a){let r=this._spaceDesc[e];return t?r.max=a:r.min=a,this}copySpace(e){for(let t in e._spaceDesc){let a=e._spaceDesc[t];this._spaceDesc[t].copy(a)}return this}}class bs{static MaxEntityCountInLeaf=4;static MaxLayer=10;static ClearLeafLayer=bs.MaxLayer-4}class gs{static UUID=0;uuid="0";constructor(){this.uuid=(gs.UUID++).toString()}}class lp{map={};_count=0;get count(){return this._count}push(e){return this.map[e.uuid]?!1:(this.map[e.uuid]=e,this._count++,!0)}remove(e){return this.map[e]?(delete this.map[e],this._count--,!0):!1}}class yr extends gs{_dimensionIndex=0;_dimensions;_dimension;_left;_right;_space;_parent;_entities;layer;get dimension(){return this._dimension}constructor(e=0){super(),this.layer=e,yr.nodeCount++}initNode(e,t,a){return this._dimensions=t,this._dimensionIndex=a,this._dimension=t[a],this._space=new Qh().initSpace(t),e&&this._space.copySpace(e._space),this._parent=e,this._entities=new lp,this}updateEntity(e){if(e.isInNode(this,this._dimension)&&(e.attachTreeNode(this),this.autoSplit(),this._left&&this._right)){let t=(this._dimensionIndex+1)%this._dimensions.length,a=this._dimensions[t];e.isInNode(this._right,a)?this._right.updateEntity(e):e.isInNode(this._left,a)&&this._left.updateEntity(e)}}buildRoot(e){for(const t of e)t.entity.attachTreeNode(this);this.autoSplit()}_splitEntityList=[];autoSplit(){if(this._entities.count>bs.MaxEntityCountInLeaf&&!this._right&&!this._left&&this.layer<bs.MaxLayer){let e=this._splitEntityList,t=(this._dimensionIndex+1)%this._dimensions.length,a=this._dimensions[t],r=0;for(const i in this._entities.map){let n=this._entities.map[i];r+=n.centerValue(a),e.push(n)}r/=this._entities.count,this._left=new yr(this.layer+1),this._right=new yr(this.layer+1),this._left.initNode(this,this._dimensions,t),this._right.initNode(this,this._dimensions,t),this._left.setSpace(!0,r),this._right.setSpace(!1,r);for(let i of e)i.isInNode(this._right,a)?i.attachTreeNode(this._right):i.isInNode(this._left,a)&&i.attachTreeNode(this._left)}this._left&&this._left.autoSplit(),this._right&&this._right.autoSplit()}setSpace(e,t){return this._parent&&this._space.splitSpace(this._dimension,e,t),this}isEmpty(){return this._left==null&&this._right==null&&this._entities.count==0}pushEntity(e){return this._entities.push(e)}removeEntity(e){return this._entities.remove(e.uuid)}static nodeCount=0;autoClear(){let e=this;for(;e&&e.layer>bs.ClearLeafLayer&&e.clearLeaf();)e=e._parent}clearLeaf(){let e=!this._left&&!this._right,t=!e&&this._left.isEmpty()&&this._right.isEmpty();return t&&(this._left=this._right=null,yr.nodeCount-=2),e||t}isContain(e){return this._space.isContain(this._dimension,e)}static rangeBox=new Ce(new b(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),new b(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE));nodeIntersectsBox(e){let t=this._space.getRange("x"),a=this._space.getRange("y"),r=this._space.getRange("z"),i=yr.rangeBox;return i.min.set(t.min,a.min,r.min),i.max.set(t.max,a.max,r.max),i.intersectsBox(e)}nodeIntersectsRay(e){let t=this._space.getRange("x"),a=this._space.getRange("y"),r=this._space.getRange("z"),i=yr.rangeBox;return i.min.set(t.min,a.min,r.min),i.max.set(t.max,a.max,r.max),!0}pointCast(e,t=0,a){if(a=a||[],this._entities.count>0){let r=this._entities.map;for(let i in r){let n=r[i],o=n.entityContainPoint(e);!o&&t>0&&(o=n.squareDistanceTo(e,this._dimensions)<=t),o&&a.push(n)}}this._left&&this._left.isContain(e[this._left.dimension])&&this._left.pointCast(e,t,a),this._right&&this._right.isContain(e[this._right.dimension])&&this._right.pointCast(e,t,a)}boxCast(e,t){if(t=t||[],this._entities.count>0){let a=this._entities.map;for(let r in a){let i=a[r];i.entityIntersectsBox(e)&&t.push(i)}}this._left&&this._left.nodeIntersectsBox(e)&&this._left.boxCast(e,t),this._right&&this._right.nodeIntersectsBox(e)&&this._right.boxCast(e,t)}pointIntersect=new b;rayCast(e,t,a){t=t||[],a=a||[];let r=this.pointIntersect;if(this._entities.count>0){let i=this._entities.map;for(let n in i){let o=i[n];o.entityIntersectsRay(e,r)&&(a.push(new b().copyFrom(r)),t.push(o))}}this._left&&this._left.nodeIntersectsRay(e)&&this._left.rayCast(e,t,a),this._right&&this._right.nodeIntersectsRay(e)&&this._right.rayCast(e,t,a)}}class cp extends gs{userData;node;constructor(e){super(),this.userData=e}centerValue(e){return 0}isInNode(e,t){return!1}entityContainPoint(e){return!1}squareDistanceTo(e,t){return Number.MAX_VALUE}entityIntersectsBox(e){return!1}entityIntersectsRay(e,t){return!1}attachTreeNode(e){return this.node&&this.detachTreeNode(),this.node=e,this.node.pushEntity(this)}detachTreeNode(){let e=this.node.removeEntity(this);return this.node=null,e}updateNode(e){let t=this.node;t&&this.detachTreeNode(),e.updateEntity(this),t&&t.autoClear()}}class Nt{minPosX=0;minPosY=0;maxPosX=0;maxPosY=0;testID=0;points;offsetPosition;static TINY=1e-6;constructor(){this.points=new Array,this.offsetPosition=new b(0,0,0,0),this.clear()}setAABox(e,t,a,r){this.minPosX=e-a/2-Nt.TINY,this.maxPosX=e+a/2+Nt.TINY,this.minPosY=t-r/2-Nt.TINY,this.maxPosY=t+r/2+Nt.TINY,this.offsetPosition.setTo(0,0,0)}setOffset(e){this.maxPosX+=e.x-this.offsetPosition.x,this.minPosX+=e.x-this.offsetPosition.x,this.minPosY+=e.z-this.offsetPosition.z,this.maxPosY+=e.z-this.offsetPosition.z,this.offsetPosition.copyFrom(e)}setContainRect(e,t,a,r){this.minPosX>e&&(this.minPosX=e),this.minPosY>t&&(this.minPosY=t),this.maxPosX<a&&(this.maxPosX=a),this.maxPosY<r&&(this.maxPosY=r)}clear(){var e=1e9;this.minPosX=this.minPosY=e,this.maxPosX=this.maxPosY=-e,this.points.length=0,this.testID=0,this.offsetPosition.setTo(0,0,0)}addPoint(e){this.points.indexOf(e)==-1&&(e.x<this.minPosX&&(this.minPosX=e.x-Nt.TINY),e.x>this.maxPosX&&(this.maxPosX=e.x+Nt.TINY),e.z<this.minPosY&&(this.minPosY=e.z-Nt.TINY),e.z>this.maxPosY&&(this.maxPosY=e.z+Nt.TINY),this.points.push(e))}clone(){var e=new Nt;return e.minPosX=this.minPosX,e.minPosY=this.minPosY,e.maxPosX=this.maxPosX,e.maxPosY=this.maxPosY,e}get radius(){return Math.sqrt((this.maxPosY-this.minPosY)*(this.maxPosY-this.minPosY)+(this.maxPosX-this.minPosX)*(this.maxPosX-this.minPosX))}get sideX(){return this.maxPosX-this.minPosX}get sideY(){return this.maxPosY-this.minPosY}get centreX(){return(this.maxPosX-this.minPosX)*.5+this.minPosX}get centreY(){return(this.maxPosY-this.minPosY)*.5+this.minPosY}overlapTest(e){return!(this.minPosY>=e.maxPosY||this.maxPosY<=e.minPosY||this.minPosX>=e.maxPosX||this.maxPosX<=e.minPosX)}isPointInside(e){return e.x>=this.minPosX&&e.x<=this.maxPosX&&e.z>=this.minPosY&&e.z<=this.maxPosY}isIntersectLineSegment(e,t,a,r){var i=!1,n=t-r,o=a-e,l=e*r-a*t,c=(-l-n*this.minPosX)/o;c<=this.maxPosY&&c>=this.minPosY&&(i=!0),c=(-l-n*this.maxPosX)/o,c<=this.maxPosY&&c>=this.minPosY&&(i=!0);var f=(-l-o*this.minPosY)/n;return f<=this.maxPosX&&f>=this.minPosX&&(i=!0),f=(-l-o*this.maxPosY)/n,f<=this.maxPosX&&f>=this.minPosX&&(i=!0),i}}class kr{static NUM_CHILDREN=4;childCellIndices;nodeIndices;aabb;points;constructor(e){this.childCellIndices=new Array,this.childCellIndices.length=kr.NUM_CHILDREN,this.nodeIndices=new Array,this.clear(),e?this.aabb=e.clone():this.aabb=new Nt}isLeaf(){return this.childCellIndices[0]==-1}clear(){for(var e=0;e<kr.NUM_CHILDREN;e++)this.childCellIndices[e]=-1;this.nodeIndices.splice(0,this.nodeIndices.length)}}class Th{_cells;_rootCell;_quadNodes;_aabb;_cellsToTest;_testID;constructor(){this._testID=0,this._cells=new Array,this._quadNodes=new Array,this._cellsToTest=new Array,this._aabb=new Nt}getQuadNode(e){return this._quadNodes[e]}clear(){this._cells.length=0,this._quadNodes.length=0}initNodes(e){this.clear();for(var t=0,a=e.length;t<a;)e[t].calcGlobalQuadAABB(),this._quadNodes.push(e[t]),t++}buildQuadTree(e,t){this._aabb.clear();for(var a of this._quadNodes)if(a.isTriangle)for(var r of a.aabb.points)this._aabb.addPoint(r);else this._aabb.setContainRect(a.aabb.minPosX,a.aabb.minPosY,a.aabb.maxPosX,a.aabb.maxPosY);this._cells.length=0,this._rootCell=new kr(this._aabb),this._cells.push(this._rootCell);for(var i=this._quadNodes.length,n=0;n<i;n++)this._cells[0].nodeIndices[n]=n;var o=new Array;o.push(0);for(var l,c,f;o.length!=0;)if(c=o.pop(),!(this._cells[c].nodeIndices.length<=e||this._cells[c].aabb.radius<t)){for(n=0;n<kr.NUM_CHILDREN;n++){this._cells[c].childCellIndices[n]=this._cells.length,o.push(this._cells.length),this._cells.push(new kr(this.createAABox(this._cells[c].aabb,n))),f=this._cells[this._cells.length-1],i=this._cells[c].nodeIndices.length;for(var d=0;d<i;d++)l=this._cells[c].nodeIndices[d],this.doesNodeIntersectCell(this._quadNodes[l],f)&&f.nodeIndices.push(l)}this._cells[c].nodeIndices.length=0}}createAABox(e,t){var a=e.centreX,r=e.centreY,i=e.sideX,n=e.sideY,o=new Nt;switch(t){case 0:o.setAABox(a+i/4,r+n/4,i/2,n/2);break;case 1:o.setAABox(a-i/4,r+n/4,i/2,n/2);break;case 2:o.setAABox(a-i/4,r-n/4,i/2,n/2);break;case 3:o.setAABox(a+i/4,r-n/4,i/2,n/2);break;default:o.setAABox(a+i/4,r-n/4,i/2,n/2);break}return o}doesNodeIntersectCell(e,t){var a=e.aabb;if(!a.overlapTest(t.aabb))return!1;if(!e.isTriangle)return!0;var r=a.points,i=r[0],n=r[1],o=r[2];if(t.aabb.isPointInside(i)||t.aabb.isPointInside(n)||t.aabb.isPointInside(o))return!0;var l=this.pointInTriangle(t.aabb.minPosX,t.aabb.minPosY,i,n,o)||this.pointInTriangle(t.aabb.minPosX,t.aabb.maxPosY,i,n,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.maxPosY,i,n,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.minPosY,i,n,o);return l?!0:(l=t.aabb.isIntersectLineSegment(i.x,i.z,n.x,n.z)||t.aabb.isIntersectLineSegment(i.x,i.z,o.x,o.z)||t.aabb.isIntersectLineSegment(n.x,n.z,o.x,o.z),l)}getNodesIntersectingtAABox(e,t){if(this._cells.length==0)return 0;this._cellsToTest.length=0,this._cellsToTest.push(0),this.incrementTestCounter();for(var a,r,i,n,o=0;this._cellsToTest.length!=0;)if(a=this._cellsToTest.pop(),i=this._cells[a],!!t.overlapTest(i.aabb))if(i.isLeaf())for(r=i.nodeIndices.length,o=0;o<r;o++)n=this.getQuadNode(i.nodeIndices[o]).aabb,n.testID!=this._testID&&(n.testID=this._testID,t.overlapTest(n)&&e.push(i.nodeIndices[o]));else for(o=0;o<kr.NUM_CHILDREN;o++)this._cellsToTest.push(i.childCellIndices[o]);return e.length}pointInTriangle(e,t,a,r,i){var n=a,o=r,l=i,c=n.z-o.z,f=o.x-n.x,d=n.x*o.z-o.x*n.z,h=o.z-l.z,u=l.x-o.x,m=o.x*l.z-l.x*o.z,g=l.z-n.z,p=n.x-l.x,D=l.x*n.z-n.x*l.z,A=!1,B=c*e+f*t+d,v=h*e+u*t+m,U=g*e+p*t+D;const y=.01;return(B>=-y&&v>=-y&&U>=-y||B<=y&&v<=y&&U<=y)&&(A=!0),A}incrementTestCounter(){if(++this._testID,this._testID==0){for(var e=this._quadNodes.length,t=0;t<e;t++)this._quadNodes[t].aabb.testID=0;this._testID=1}}logDeep=0;logTree(e){if(!(e<0)){this.logDeep++;for(var t=this._cells[e],a="",r=0;r<this.logDeep-1;r++)a+="-|";console.log(a+"i="+e+" "+t.aabb.minPosX.toFixed(2)+" "+t.aabb.maxPosX.toFixed(2)+" "+t.aabb.minPosY.toFixed(2)+" "+t.aabb.maxPosY.toFixed(2));var i;for(i=0;i<t.nodeIndices.length;i++)if(t.nodeIndices[i]>=0){var n=this._quadNodes[t.nodeIndices[i]];console.log(a+" t="+t.nodeIndices[i]+" "+n.aabb.minPosX.toFixed(2)+" "+n.aabb.maxPosX.toFixed(2)+" "+n.aabb.minPosY.toFixed(2)+" "+n.aabb.maxPosY.toFixed(2))}for(i=0;i<t.childCellIndices.length;i++)t.childCellIndices[i]>=0&&this.logTree(t.childCellIndices[i]);this.logDeep--}}}class Mh{_maxNodesPerCell;_minCellSize;_quadTree;_collisionNodesIdx;_segBox;_collisionNodes;constructor(e=10,t=500){this._maxNodesPerCell=e,this._minCellSize=t,this._segBox=new Nt,this._collisionNodesIdx=new Array,this._collisionNodes=new Array}createQuadTree(e){this._quadTree=new Th,this._quadTree.initNodes(e),this._quadTree.buildQuadTree(this._maxNodesPerCell,this._minCellSize)}getNodesByAABB(e,t,a,r){this._segBox.clear(),this._segBox.maxPosX=a,this._segBox.maxPosY=r,this._segBox.minPosX=e,this._segBox.minPosY=t,this._collisionNodesIdx.length=0,this._collisionNodes.length=0,this._quadTree.getNodesIntersectingtAABox(this._collisionNodesIdx,this._segBox);for(var i,n=0;n<this._collisionNodesIdx.length;n++)i=this._quadTree.getQuadNode(this._collisionNodesIdx[n]),this._collisionNodes.push(i);return this._collisionNodes}getTriangleAtPoint(e,t=5){this._segBox.clear(),this._segBox.setAABox(e.x,e.z,1,1),this._collisionNodesIdx.length=0,this._collisionNodes.length=0,this._quadTree.getNodesIntersectingtAABox(this._collisionNodesIdx,this._segBox);for(var a=4294967295,r=0,i,n,o,l,c=0;c<this._collisionNodesIdx.length;c++)n=this._quadTree.getQuadNode(this._collisionNodesIdx[c]),l=n.aabb,b.pointInsideTriangle(e,l.points[0],l.points[1],l.points[2])&&(o=n,r=Math.abs(o.plane.distance(e)),!(r>t)&&(n==null||r<=a)&&(i=o,a=r));return i}}var Ys=(s=>(s[s.MOUSE_LEFT=0]="MOUSE_LEFT",s[s.MOUSE_MID=1]="MOUSE_MID",s[s.MOUSE_RIGHT=2]="MOUSE_RIGHT",s))(Ys||{});class fp extends pt{static LOADER_PROGRESS="loaderProgress";static LOADER_COMPLETE="loaderComplete"}class dp extends pt{static ADDED="added";static REMOVED="removed";static CHILD_ADD_EVENT="childAddEvent";static CHILD_REMOVED="childRemoved"}class hp extends pt{static SHOW="show";static HIDE="hide";static UPDATE="update"}class up{static merge(e,t,a,r){let i=0,n=0;i=Math.max(e.width,i),i=Math.max(t.width,i),i=Math.max(a.width,i),i=Math.max(r.width,i),n=Math.max(e.height,n),n=Math.max(t.height,n),n=Math.max(a.height,n),n=Math.max(r.height,n);let o=new Te(i,n,oe.rgba8unorm),l=new Fe(yd);l.setSamplerTexture("textureR",e),l.setSamplerTexture("textureG",t),l.setSamplerTexture("textureB",a),l.setSamplerTexture("textureA",r),l.setStorageTexture("outTex",o),l.workerSizeX=Math.ceil(i/8),l.workerSizeY=Math.ceil(n/8);let c=k.beginCommandEncoder();return k.computeCommand(c,[l]),k.endCommandEncoder(c),o}}class Nh{computeShader;setInputes(e,t,a){this.computeShader=new Fe(Ld(e,t,a,8,8,1));for(let r=0;r<t.length;r++)this.computeShader.setSamplerTexture(`source${r}Map`,t[r]);for(let r=0;r<a.length;r++)this.computeShader.setStorageTexture(`dest${r}Map`,a[r]);e&&this.computeShader.setSamplerTexture("colorMap",e),this.computeShader.workerSizeX=a[0].width/8,this.computeShader.workerSizeY=a[0].height/8,this.computeShader.workerSizeZ=1}}class Ph{sourceShader;compute;needUpdate=!0;constructor(e,t){this.sourceShader=t,this.compute=new Fe(e),this.init()}init(){}onUpdate(){this.onFrame&&this.onFrame(),this.onOnce&&this.needUpdate&&(this.needUpdate=!1,this.onFrame())}}class Vh extends Ph{constructor(e){super(Ed,e)}init(){let e=new Te(256,256,oe.rgba8unorm,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING);return this.compute.setStorageTexture("sssMap",e),this.sourceShader.setTexture("lutMap",e),e}onFrame(){this.compute.workerSizeX=256/8,this.compute.workerSizeY=256/8;let e=k.beginCommandEncoder();k.computeCommand(e,[this.compute]),k.endCommandEncoder(e)}}class bp{gpuBuffer;probes;memoryDo;_probeInfoList;initDataUniform(e){this.memoryDo=new cr,this.probes=e,this._probeInfoList=[],this.memoryDo.destroy(),this.memoryDo.allocation(e.length*17*4);for(let a=0;a<e.length;a++){var t=17;let r=this.memoryDo.allocation_node(t*4);this._probeInfoList.push(r);let i=e[a].transform.worldPosition;r.setArray(0,[i.x,i.y,i.z])}this.gpuBuffer=I.device.createBuffer({size:this.memoryDo.shareDataBuffer.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,label:"ProbeBuffer",mappedAtCreation:!1})}updateGPUBuffer(){const e=this.memoryDo.shareDataBuffer;let t=this.memoryDo.shareDataBuffer.byteLength,a=0;const r=5e3*64;for(;a<t;)I.device.queue.writeBuffer(this.gpuBuffer,a,e,a,Math.floor(Math.min(r,t-a))),a+=r}}class gp extends Ya{constructor(e,t,a=0){super(),this.bufferType=Aa.StructStorageGPUBuffer,this.createBufferByStruct(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|a,e,t)}}class pp{static codeMax=`
|
|
11790
11818
|
@group(0) @binding(0) var inputTexture : texture_2d<f32>;
|
|
@@ -11812,10 +11840,10 @@ fn frag(){
|
|
|
11812
11840
|
let dstCoord = vec2<i32>(i32(GlobalInvocationID.x), i32(GlobalInvocationID.y));
|
|
11813
11841
|
textureStore(outputTexture, dstCoord, fromColor);
|
|
11814
11842
|
}
|
|
11815
|
-
`;static _pipelineMax;static _pipelineMin;static createMipmap(e,t){const a=I.device;this._pipelineMax||=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:this.codeMax}),entryPoint:"main"}}),this._pipelineMin||=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:this.codeMin}),entryPoint:"main"}});let r=Math.ceil(e.width*.5),i=Math.ceil(e.height*.5),n={mipmapCount:t,texture:e,srcView:null,mipLevel:1,dstHeight:i,dstWidth:r};n.srcView=e.getGPUTexture().createView({format:e.format,dimension:"2d",baseMipLevel:0,mipLevelCount:1}),e.width>1024&&e.height>1024?this.mipmap(this._pipelineMax,n):this.mipmap(this._pipelineMin,n)}static mipmap(e,t){const a=I.device,r=k.beginCommandEncoder();let i=e==this._pipelineMax,n,o;for(let l=t.mipLevel;l<t.mipmapCount;l++){let c=[],f=0;c.push({binding:f++,resource:t.srcView}),c.push({binding:f++,resource:t.texture.gpuSampler}),n=t.texture.getGPUTexture().createView({format:t.texture.format,dimension:"2d",baseMipLevel:l,mipLevelCount:1}),c.push({binding:f++,resource:n});const d=a.createBindGroup({layout:e.getBindGroupLayout(0),entries:c}),h=r.beginComputePass();h.setPipeline(e),h.setBindGroup(0,d);let u=t.dstWidth,m=t.dstHeight;if(i&&(u=Math.max(1,Math.floor(t.dstWidth/8)),m=Math.max(1,Math.floor(t.dstHeight/8))),h.dispatchWorkgroups(u,m),t.dstHeight*=.5,t.dstWidth*=.5,t.srcView=n,t.mipLevel=l+1,o=i&&(t.dstWidth<8||t.dstHeight<8),h.end(),o)break}k.endCommandEncoder(r),o&&this.mipmap(this._pipelineMin,t)}}class Oh{name="";passMap=new Map}class Lh{passType="";shaderState=new Map;vertexShader="";fragmentShader=""}class mp{static passKeyword="pass";static shaderKeyword="Shader";static vertexKeyword="vertex";static fragmentKeyword="fragment";static passTypeKeyword="PassType";static parser(e,t){e=Da.filterComment(e);let a=new Oh,r=e.indexOf(this.shaderKeyword),i=e.indexOf("{",r),n=e.substring(r+this.shaderKeyword.length,i).trim();a.name=n.substring(1,n.length-1),n=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));let o=this.splitPassBlock(n);for(let l of o){let c=this.parserPassBlock(l),f;a.passMap.has(c.passType)?f=a.passMap.get(c.passType):(f=[],a.passMap.set(c.passType,f)),f.push(c),c.vertexShader.length>0&&(c.vertexShader=Da.parse(c.vertexShader,t)),c.fragmentShader.length>0&&(c.fragmentShader=Da.parse(c.fragmentShader,t))}return a}static splitPassBlock(e){let t=0,a=[];for(;t<e.length;){let r=e.indexOf(this.passKeyword,t);if(r==-1){a.push(e.substring(t));break}t!=0&&a.push(e.substring(t,r)),t=r+this.passKeyword.length}return a}static parserPassBlock(e){let t=new Lh,a=e.indexOf(this.passTypeKeyword),r=e.indexOf('"',a);return a=e.indexOf('"',r+1),t.passType=e.substring(a+1,r).trim(),this.parserShaderState(t,e),a=e.indexOf(this.vertexKeyword),a!=-1&&(t.vertexShader=this.extractBlock(e.substring(a+this.vertexKeyword.length),"{","}")),a=e.indexOf(this.fragmentKeyword),a!=-1&&(t.fragmentShader=this.extractBlock(e.substring(a+this.fragmentKeyword.length),"{","}")),t}static parserShaderState(e,t){let a=t.indexOf("ShaderState");if(a==-1)return!1;a=t.indexOf("{",a);let r=t.indexOf("}",a),n=t.substring(a+1,r).split(",");for(let o of n){let l=o.split(":"),c=l[0].trim(),f=this.convertValue(l[1].trim());e.shaderState.set(c,f)}return!0}static convertValue(e){return e.length==4&&e.toLowerCase()=="true"?!0:e.length==5&&e.toLowerCase()=="false"?!1:e[0]=='"'?e.substring(1,e.length-1):Number.parseInt(e)}static extractBlock(e,t,a){let r=e.indexOf(t);if(r==-1)return"";let i=0,n=0;e=e.substring(r);for(let l of e){if(l==t?i++:l==a&&i--,i<=0)break;n++}return e.substring(1,n).trim()}}let Gh=new pt("IrradianceDataReaderCompleteEvent");class vs extends Za{readFlag=!1;probeRenderer;opColorBuffer;opDepthBuffer;srcColorMap;srcDepthMap;opDepthArray;opColorArray;initReader(e,t,a){this.probeRenderer=e,this.srcColorMap=t,this.srcDepthMap=a;let r=_.setting.gi,i=r.octRTMaxSize*r.octRTMaxSize;this.opColorBuffer=I.device.createBuffer({size:i*4*4,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}),this.opColorArray=new Float32Array(i*4),this.opDepthBuffer=I.device.createBuffer({size:i*4*4,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}),this.opDepthArray=new Float32Array(i*4),this.probeRenderer.addEventListener(no.type,()=>{this.onProbeRenderComplete()},this),this.probeRenderer.addEventListener(Ms.type,()=>{console.log("GIRenderStartEvent")},this)}async onProbeRenderComplete(){if(console.log("GIRenderCompleteEvent"),this.readFlag)console.log("irradianceDataReader is reading yet!!!");else{this.readFlag=!0;let e=Date.now();console.log("irradianceDataReader start reading "),await vs.read(this.srcColorMap.getGPUTexture(),this.opColorBuffer,this.opColorArray),await vs.read(this.srcDepthMap.getGPUTexture(),this.opDepthBuffer,this.opDepthArray),this.readFlag=!1,console.log("process time :",Date.now()-e),console.log("irradianceDataReader read complete"),this.dispatchEvent(Gh)}}static async read(e,t,a){let r=k.beginCommandEncoder();r.copyTextureToBuffer({texture:e},{buffer:t,bytesPerRow:e.width*16},[e.width,e.height]),k.endCommandEncoder(r),await t.mapAsync(GPUMapMode.READ);const i=t.getMappedRange();a.set(new Float32Array(i),0),t.unmap()}}let Ap=new vs;class Dp{computeShader;visibleBuffer;texture;constructor(){this.computeShader=new Fe(zd),this.visibleBuffer=new ni(8192*2),this.computeShader.setStorageBuffer("visibleBuffer",this.visibleBuffer),this.texture=Mt.getTexture(Pa.zBufferTexture_NAME),this.computeShader.setSamplerTexture("zBufferTexture",this.texture),this.computeShader.workerSizeX=Math.ceil(this.texture.width/8),this.computeShader.workerSizeY=Math.ceil(this.texture.height/8),this.computeShader.workerSizeZ=1}compute(e,t){this.visibleBuffer.reset(!0,0),this.visibleBuffer.apply();let a=k.beginCommandEncoder();k.computeCommand(a,[this.computeShader]),this.visibleBuffer.readBuffer(),t.zVisibleList=this.visibleBuffer.outFloat32Array}}class _p extends Wt{RT_BloomUp;RT_BloomDown;RT_threshold;rendererPassState;thresholdCompute;downSampleComputes;upSampleComputes;postCompute;bloomSetting;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.bloom.enable=!0,this.createGUI()}onDetach(e){_.setting.render.postProcessing.bloom.enable=!1,this.removeGUI()}createGUI(){}removeGUI(){}get downSampleBlurSize(){return _.setting.render.postProcessing.bloom.downSampleBlurSize}set downSampleBlurSize(e){_.setting.render.postProcessing.bloom.downSampleBlurSize=e}get downSampleBlurSigma(){return _.setting.render.postProcessing.bloom.downSampleBlurSigma}set downSampleBlurSigma(e){_.setting.render.postProcessing.bloom.downSampleBlurSigma=e}get upSampleBlurSize(){return _.setting.render.postProcessing.bloom.upSampleBlurSize}set upSampleBlurSize(e){_.setting.render.postProcessing.bloom.upSampleBlurSize=e}get upSampleBlurSigma(){return _.setting.render.postProcessing.bloom.upSampleBlurSigma}set upSampleBlurSigma(e){_.setting.render.postProcessing.bloom.upSampleBlurSigma=e}get luminanceThreshole(){return _.setting.render.postProcessing.bloom.luminanceThreshole}set luminanceThreshole(e){_.setting.render.postProcessing.bloom.luminanceThreshole=e}get bloomIntensity(){return _.setting.render.postProcessing.bloom.bloomIntensity}set bloomIntensity(e){_.setting.render.postProcessing.bloom.bloomIntensity=e}get hdr(){return _.setting.render.postProcessing.bloom.hdr}set hdr(e){_.setting.render.postProcessing.bloom.hdr=e}createThreshouldCompute(){this.thresholdCompute=new Fe(Dd),this.autoSetColorTexture("inTex",this.thresholdCompute),this.thresholdCompute.setStorageTexture("outTex",this.RT_threshold),this.thresholdCompute.setUniformBuffer("bloomCfg",this.bloomSetting),this.thresholdCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.thresholdCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.thresholdCompute.workerSizeZ=1}createDownSampleComputes(){const t=_.setting.render.postProcessing.bloom.downSampleStep;this.downSampleComputes=[];for(let a=0;a<t;a++){let r=new Fe(_d),i=this.RT_BloomDown[a],n=a==0?this.RT_threshold:this.RT_BloomDown[a-1];r.setSamplerTexture("inTex",n),r.setStorageTexture("outTex",i),r.setUniformBuffer("bloomCfg",this.bloomSetting),r.workerSizeX=Math.ceil(i.width/8),r.workerSizeY=Math.ceil(i.height/8),r.workerSizeZ=1,this.downSampleComputes.push(r)}}createUpSampleComputes(){const t=_.setting.render.postProcessing.bloom.downSampleStep;this.upSampleComputes=[];{let a=new Fe(Vo),r=this.RT_BloomUp[0],i=this.RT_BloomDown[t-2];a.setSamplerTexture("_MainTex",i),a.setSamplerTexture("_PrevMip",this.RT_BloomDown[t-1]),a.setStorageTexture("outTex",r),a.setUniformBuffer("bloomCfg",this.bloomSetting),a.workerSizeX=Math.ceil(r.width/8),a.workerSizeY=Math.ceil(r.height/8),a.workerSizeZ=1,this.upSampleComputes.push(a)}for(let a=1;a<t-1;a++){let r=new Fe(Vo),i=this.RT_BloomUp[a],n=this.RT_BloomDown[t-2-a];r.setSamplerTexture("_MainTex",n),r.setSamplerTexture("_PrevMip",this.RT_BloomUp[a-1]),r.setStorageTexture("outTex",i),r.setUniformBuffer("bloomCfg",this.bloomSetting),r.workerSizeX=Math.ceil(i.width/8),r.workerSizeY=Math.ceil(i.height/8),r.workerSizeZ=1,this.upSampleComputes.push(r)}}createPostCompute(){const t=_.setting.render.postProcessing.bloom.downSampleStep;this.postCompute=new Fe(Bd),this.autoSetColorTexture("_MainTex",this.postCompute),this.postCompute.setSamplerTexture("_BloomTex",this.RT_BloomUp[t-2]),this.postCompute.setStorageTexture("outTex",this.RT_threshold),this.postCompute.setUniformBuffer("bloomCfg",this.bloomSetting),this.postCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.postCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.postCompute.workerSizeZ=1}createResource(){let e=_.setting.render.postProcessing.bloom;this.bloomSetting=new Ct(8);let[t,a]=I.presentationSize,r=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING;this.RT_threshold=new Te(t,a,oe.rgba16float,!1,r);const i=e.downSampleStep;{this.RT_BloomDown=[];let o=Math.ceil(t/4),l=Math.ceil(a/4);for(let c=0;c<i;c++)this.RT_BloomDown[c]=new Te(o,l,oe.rgba16float,!1,r),o=Math.ceil(o/2),l=Math.ceil(l/2)}{this.RT_BloomUp=[];for(let o=0;o<i-1;o++){let l=this.RT_BloomDown[i-2-o].width,c=this.RT_BloomDown[i-2-o].height;this.RT_BloomUp[o]=new Te(l,c,oe.rgba16float,!1,r)}}let n=new Je;n.loadOp="load",this.rtFrame=new lt([this.RT_threshold],[n])}render(e,t){this.thresholdCompute||(this.createResource(),this.createThreshouldCompute(),this.createDownSampleComputes(),this.createUpSampleComputes(),this.createPostCompute(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="Bloom");let a=_.setting.render.postProcessing.bloom;this.bloomSetting.setFloat("downSampleStep",a.downSampleStep),this.bloomSetting.setFloat("downSampleBlurSize",a.downSampleBlurSize),this.bloomSetting.setFloat("downSampleBlurSigma",a.downSampleBlurSigma),this.bloomSetting.setFloat("upSampleBlurSize",a.upSampleBlurSize),this.bloomSetting.setFloat("upSampleBlurSigma",a.upSampleBlurSigma),this.bloomSetting.setFloat("luminanceThreshole",a.luminanceThreshole),this.bloomSetting.setFloat("bloomIntensity",a.bloomIntensity),this.bloomSetting.setFloat("hdr",a.hdr),this.bloomSetting.apply(),k.computeCommand(t,[this.thresholdCompute,...this.downSampleComputes,...this.upSampleComputes,this.postCompute]),k.lastRenderPassState=this.rendererPassState}onResize(){let e=_.setting.render.postProcessing.bloom,[t,a]=I.presentationSize;this.RT_threshold.resize(t,a);const r=e.downSampleStep;let i=Math.ceil(t/4),n=Math.ceil(a/4);for(let o=0;o<r;o++)this.RT_BloomDown[o].resize(i,n),i=Math.ceil(i/2),n=Math.ceil(n/2);for(let o=0;o<r-1;o++){let l=this.RT_BloomDown[r-2-o].width,c=this.RT_BloomDown[r-2-o].height;this.RT_BloomUp[o].resize(l,c)}this.thresholdCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.thresholdCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.thresholdCompute.workerSizeZ=1;for(let o=0;o<r;o++){let l=this.downSampleComputes[o],c=this.RT_BloomDown[o];l.workerSizeX=Math.ceil(c.width/8),l.workerSizeY=Math.ceil(c.height/8),l.workerSizeZ=1}{let o=this.RT_BloomUp[0],l=this.upSampleComputes[0];l.workerSizeX=Math.ceil(o.width/8),l.workerSizeY=Math.ceil(o.height/8),l.workerSizeZ=1}for(let o=1;o<r-1;o++){let l=this.RT_BloomUp[o],c=this.upSampleComputes[o];c.workerSizeX=Math.ceil(l.width/8),c.workerSizeY=Math.ceil(l.height/8),c.workerSizeZ=1}this.postCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.postCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.postCompute.workerSizeZ=1}}class Bp extends Wt{blurTexture1;blurTexture2;rendererPassState;blurComputes;blurSettings;outTexture;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.depthOfView.enable=!0}onDetach(e){_.setting.render.postProcessing.depthOfView.enable=!1}get pixelOffset(){return _.setting.render.postProcessing.depthOfView.pixelOffset}set pixelOffset(e){e=Math.max(0,e);let t=_.setting.render.postProcessing.depthOfView;t.pixelOffset=e}get near(){return _.setting.render.postProcessing.depthOfView.near}set near(e){e=Math.max(0,e);let t=_.setting.render.postProcessing.depthOfView;t.near=e}get far(){return _.setting.render.postProcessing.depthOfView.far}set far(e){e=Math.max(0,e);let t=_.setting.render.postProcessing.depthOfView;t.far=e}createBlurCompute(){this.blurSettings=[],this.blurComputes=[];let e=_.setting.render.postProcessing.depthOfView;for(let t=0;t<e.iterationCount;t++){let a=new Ct(4),r=new Fe(vd);this.blurComputes.push(r),this.blurSettings.push(a),r.setUniformBuffer("blurSetting",a);let i=ve.getGBufferFrame(ve.colorPass_GBuffer);r.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture());let n=t%2==0?this.blurTexture1:this.blurTexture2,o=t%2==1?this.blurTexture1:this.blurTexture2;r.setSamplerTexture("inTex",n),r.setStorageTexture("outTex",o),r.workerSizeX=Math.ceil(this.blurTexture1.width/8),r.workerSizeY=Math.ceil(this.blurTexture1.height/8),r.workerSizeZ=1,this.outTexture=o}}createResource(){let e=I.presentationSize,t=e[0],a=e[1];this.blurTexture1=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture1.name="dof1";let r=new Je;r.clearValue=[0,0,0,1],r.loadOp="clear",this.blurTexture2=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture2.name="dof2";let i=new Je;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new lt([this.blurTexture1,this.blurTexture2],[r,i])}render(e,t){if(!this.blurComputes){this.createResource(),this.createBlurCompute();let r=xe.getCameraGroup(e.camera);for(let i=0;i<this.blurComputes.length;i++)this.blurComputes[i].setUniformBuffer("globalUniform",r.uniformGPUBuffer);this.rendererPassState=He.createRendererPassState(this.rtFrame,null)}this.autoSetColorTexture("inTex",this.blurComputes[0]);let a=_.setting.render.postProcessing.depthOfView;a.far=Math.max(a.near,a.far)+1e-4;for(let r=0;r<a.iterationCount;r++){let i=this.blurComputes[r],n=this.blurSettings[r];n.setFloat("near",a.near),n.setFloat("far",a.far),n.setFloat("pixelOffset",(r+1)*a.pixelOffset),n.apply(),i.setStorageBuffer("blurSetting",n)}k.computeCommand(t,this.blurComputes),k.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=_.setting.render.postProcessing.depthOfView;r.far=Math.max(r.near,r.far)+1e-4,this.blurTexture1.resize(t,a),this.blurTexture2.resize(t,a);for(let i=0;i<r.iterationCount;i++){let n=this.blurComputes[i];n.workerSizeX=Math.ceil(this.blurTexture1.width/8),n.workerSizeY=Math.ceil(this.blurTexture1.height/8),n.workerSizeZ=1}}}class vp extends Wt{outTexture;rendererPassState;rtFrame;view;gBufferTexture;testCompute;_state=0;_state1=256;_state2=256;uniformBuffer;currentRenderTexture;constructor(){super()}onAttach(e){this.view=e}onDetach(e){}set state(e){this._state=e,this.uniformBuffer.setInt32("state",e),this.uniformBuffer.apply()}get state(){return this._state}set size1(e){this._state1=e,this.uniformBuffer.setInt32("state1",e),this.uniformBuffer.apply()}get size1(){return this._state1}set size2(e){this._state2=e,this.uniformBuffer.setInt32("state2",e),this.uniformBuffer.apply()}get size2(){return this._state2}createResource(){let e=ve.getGBufferFrame("ColorPassGBuffer");this.currentRenderTexture=e.getColorTexture(),this.gBufferTexture=e.getCompressGBufferTexture();let[t,a]=I.presentationSize;this.outTexture=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let r=new Je;r.loadOp="load",this.rtFrame=new lt([this.outTexture],[r])}createCompute(){this.uniformBuffer=new Ct(4),this.uniformBuffer.setInt32("state",this._state);let e=xe.getCameraGroup(this.view.camera),a=ve.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture(),r=_.setting.reflectionSetting,n=ve.getGBufferFrame(ve.reflections_GBuffer,r.width,r.height).getCompressGBufferTexture(),o=_.renderJobs.get(this.view).reflectionRenderer.outTexture;this.testCompute=new Fe(Od),this.testCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.testCompute.setUniformBuffer("uniformData",this.uniformBuffer),this.testCompute.setSamplerTexture("gBufferTexture",a),this.testCompute.setSamplerTexture("currentRenderTexture",this.currentRenderTexture),this.testCompute.setSamplerTexture("reflectionsGBufferTexture",n),this.testCompute.setSamplerTexture("envMap",o),this.testCompute.setStorageTexture("outputTexture",this.outTexture),this.testCompute.workerSizeX=Math.ceil(this.outTexture.width/16),this.testCompute.workerSizeY=Math.ceil(this.outTexture.height/16),this.testCompute.workerSizeZ=1}render(e,t){}compute(e){this.testCompute||(this.createResource(),this.createCompute(),this.onResize(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="test");let t=k.beginCommandEncoder();k.computeCommand(t,[this.testCompute]),k.endCommandEncoder(t),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize;this.outTexture.resize(e,t),this.testCompute.workerSizeX=Math.ceil(this.outTexture.width/16),this.testCompute.workerSizeY=Math.ceil(this.outTexture.height/16)}}class xp extends Wt{gtaoTexture;rendererPassState;gtaoCompute;gtaoSetting;aoBuffer;directionsBuffer;directionsArray;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.gtao.enable=!0}Render;onDetach(e){_.setting.render.postProcessing.gtao.enable=!1}get maxDistance(){return _.setting.render.postProcessing.gtao.maxDistance}set maxDistance(e){e=Be(e,.1,50);let t=_.setting.render.postProcessing.gtao;t.maxDistance=e}get maxPixel(){return _.setting.render.postProcessing.gtao.maxPixel}set maxPixel(e){e=Be(e,5,100);let t=_.setting.render.postProcessing.gtao;t.maxPixel=e}get darkFactor(){return _.setting.render.postProcessing.gtao.darkFactor}set darkFactor(e){e=Be(e,.01,1);let t=_.setting.render.postProcessing.gtao;t.darkFactor=e}get rayMarchSegment(){return _.setting.render.postProcessing.gtao.rayMarchSegment}set rayMarchSegment(e){e=Be(e,4,10);let t=_.setting.render.postProcessing.gtao;t.rayMarchSegment=e}get multiBounce(){return _.setting.render.postProcessing.gtao.multiBounce}set multiBounce(e){let t=_.setting.render.postProcessing.gtao;t.multiBounce=e}get blendColor(){return _.setting.render.postProcessing.gtao.blendColor}set blendColor(e){let t=_.setting.render.postProcessing.gtao;t.blendColor=e}get usePosFloat32(){return _.setting.render.postProcessing.gtao.usePosFloat32}set usePosFloat32(e){let t=_.setting.render.postProcessing.gtao;t.usePosFloat32=e}createCompute(){this.gtaoCompute=new Fe(xd);let e=new Ct(8);this.gtaoCompute.setUniformBuffer("gtaoData",e),this.directionsArray=new Float32Array(16),this.directionsBuffer=new Pe(16),this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply(),this.gtaoCompute.setStorageBuffer("directions",this.directionsBuffer),this.aoBuffer=new Pe(this.gtaoTexture.width*this.gtaoTexture.height),this.gtaoCompute.setStorageBuffer("aoBuffer",this.aoBuffer);let t=ve.getGBufferFrame(ve.colorPass_GBuffer);this.gtaoCompute.setSamplerTexture("gBufferTexture",t.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",this.gtaoCompute),this.gtaoCompute.setStorageTexture("outTex",this.gtaoTexture),this.gtaoSetting=e}createResource(){let[e,t]=I.presentationSize;this.gtaoTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.gtaoTexture.name="gtaoTex";let a=new Je;a.loadOp="load",this.rtFrame=new lt([this.gtaoTexture],[a])}randomCount=0;randomDirection(){this.randomCount=0;let e=Math.PI*2*this.randomCount/16,t=Math.PI*2/8;for(let a=0;a<8;a++){let r=e+a*t;this.directionsArray[a*2]=Math.sin(r),this.directionsArray[a*2+1]=Math.cos(r)}return this.directionsArray}render(e,t){if(!this.gtaoCompute){this.createResource(),this.createCompute(),this.onResize(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GTAO";let l=xe.getCameraGroup(e.camera);this.gtaoCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=_.setting.render.postProcessing.gtao;this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply();let r=1-.2*(We.frame%2),i=a.maxDistance*r,n=a.maxPixel*r;this.gtaoSetting.setFloat("maxDistance",i),this.gtaoSetting.setFloat("maxPixel",n),this.gtaoSetting.setFloat("darkFactor",a.darkFactor),this.gtaoSetting.setFloat("rayMarchSegment",a.rayMarchSegment);let o=e.camera;this.gtaoSetting.setFloat("cameraNear",o.near),this.gtaoSetting.setFloat("cameraFar",o.far),this.gtaoSetting.setFloat("multiBounce",a.multiBounce?1:0),this.gtaoSetting.setFloat("blendColor",a.blendColor?1:0),this.gtaoSetting.apply(),k.computeCommand(t,[this.gtaoCompute]),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize;this.gtaoTexture.resize(e,t),this.gtaoCompute.workerSizeX=Math.ceil(this.gtaoTexture.width/8),this.gtaoCompute.workerSizeY=Math.ceil(this.gtaoTexture.height/8),this.gtaoCompute.workerSizeZ=1}}class Up extends Wt{fogSetting;fogOpTexture;fogCompute;fogUniform;rendererPassState;constructor(){super(),this.fogSetting=_.setting.render.postProcessing.globalFog}createCompute(e){Y.register("GlobalFog_shader",Oo),this.fogCompute=new Fe(Oo),this.fogUniform=new Ct(20),this.fogCompute.setUniformBuffer("fogUniform",this.fogUniform);let t=ve.getGBufferFrame(ve.colorPass_GBuffer);this.fogCompute.setSamplerTexture("gBufferTexture",t.getCompressGBufferTexture()),this.fogCompute.setSamplerTexture("inTex",t.getColorTexture()),this._lastSkyTexture=this.getSkyTexture(),this.fogCompute.setSamplerTexture("prefilterMap",this._lastSkyTexture),this.fogCompute.setStorageTexture("outTex",this.fogOpTexture),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="FOG";let a=xe.getLightEntries(e.scene);this.fogCompute.setStorageBuffer("lightBuffer",a.storageGPUBuffer)}uploadSetting(){let e=this.fogUniform,t=this.fogSetting;e.setColor("fogColor",t.fogColor),e.setFloat("fogType",t.fogType),e.setFloat("fogHeightScale",t.fogHeightScale),e.setFloat("start",t.start),e.setFloat("end",t.end),e.setFloat("density",t.density),e.setFloat("ins",t.ins),e.setFloat("falloff",t.falloff),e.setFloat("rayLength",t.rayLength),e.setFloat("scatteringExponent",t.scatteringExponent),e.setFloat("dirHeightLine",t.dirHeightLine),e.setFloat("skyFactor",t.skyFactor),e.setFloat("skyRoughness",t.skyRoughness),e.setFloat("overrideSkyFactor",t.overrideSkyFactor),e.setFloat("isSkyHDR",0),e.apply(),this.fogCompute.setUniformBuffer("fogUniform",this.fogUniform)}rtFrame;createResource(){let[e,t]=I.presentationSize;this.fogOpTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.fogOpTexture.name="fogTex";let a=new Je;a.loadOp="load",this.rtFrame=new lt([this.fogOpTexture],[a])}onAttach(e){_.setting.render.postProcessing.globalFog.enable=!0}onDetach(e){_.setting.render.postProcessing.globalFog.enable=!1}set fogType(e){this.fogSetting.fogType=e}get fogType(){return this.fogSetting.fogType}set fogHeightScale(e){this.fogSetting.fogHeightScale=e}get fogHeightScale(){return this.fogSetting.fogHeightScale}set start(e){this.fogSetting.start=e}get start(){return this.fogSetting.start}set end(e){this.fogSetting.end=e}get end(){return this.fogSetting.end}set ins(e){this.fogSetting.ins=e}get ins(){return this.fogSetting.ins}set density(e){this.fogSetting.density=e}get density(){return this.fogSetting.density}set skyRoughness(e){this.fogSetting.skyRoughness=e}get skyRoughness(){return this.fogSetting.skyRoughness}set skyFactor(e){this.fogSetting.skyFactor=e}get skyFactor(){return this.fogSetting.skyFactor}set overrideSkyFactor(e){this.fogSetting.overrideSkyFactor=e}get overrideSkyFactor(){return this.fogSetting.overrideSkyFactor}get fogColor(){return this.fogSetting.fogColor}set fogColor(e){this.fogSetting.fogColor.copyFrom(e)}set falloff(e){this.fogSetting.falloff=e}get falloff(){return this.fogSetting.falloff}set rayLength(e){this.fogSetting.rayLength=e}get rayLength(){return this.fogSetting.rayLength}set scatteringExponent(e){this.fogSetting.scatteringExponent=e}get scatteringExponent(){return this.fogSetting.scatteringExponent}set dirHeightLine(e){this.fogSetting.dirHeightLine=e}get dirHeightLine(){return this.fogSetting.dirHeightLine}_lastSkyTexture;getSkyTexture(){let e=_.res.defaultSky;return q.instance.sky instanceof Ws&&(e=q.instance.sky.map),e}render(e,t){if(!this.fogCompute){this.createResource(),this.createCompute(e),this.onResize();let r=xe.getCameraGroup(e.camera);this.fogCompute.setUniformBuffer("globalUniform",r.uniformGPUBuffer)}let a=this.getSkyTexture();a!=this._lastSkyTexture&&(this._lastSkyTexture=a,this.fogCompute.setSamplerTexture("prefilterMap",this._lastSkyTexture)),this.fogCompute.setUniformFloat("isSkyHDR",a.isHDRTexture?1:0),this.uploadSetting(),k.computeCommand(t,[this.fogCompute]),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize;this.fogOpTexture.resize(e,t),this.fogCompute.workerSizeX=Math.ceil(this.fogOpTexture.width/8),this.fogCompute.workerSizeY=Math.ceil(this.fogOpTexture.height/8),this.fogCompute.workerSizeZ=1}}class yp extends Wt{godRayTexture;rendererPassState;godRayCompute;historyGodRayData;godRaySetting;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.godRay.enable=!0,this.createGUI()}Render;onDetach(e){_.setting.render.postProcessing.godRay.enable=!1,this.removeGUI()}get blendColor(){return _.setting.render.postProcessing.godRay.blendColor}set blendColor(e){_.setting.render.postProcessing.godRay.blendColor=e}get rayMarchCount(){return _.setting.render.postProcessing.godRay.rayMarchCount}set rayMarchCount(e){e=Be(e,8,20),_.setting.render.postProcessing.godRay.rayMarchCount=e}get scatteringExponent(){return _.setting.render.postProcessing.godRay.scatteringExponent}set scatteringExponent(e){e=Be(e,1,40),_.setting.render.postProcessing.godRay.scatteringExponent=e}get intensity(){return _.setting.render.postProcessing.godRay.intensity}set intensity(e){e=Be(e,.01,5),_.setting.render.postProcessing.godRay.intensity=e}createGUI(){}removeGUI(){}createCompute(e){this.godRayCompute=new Fe(Ud);let t=new Ct(12);this.godRayCompute.setUniformBuffer("godRayUniform",t),this.historyGodRayData=new Pe(4*this.godRayTexture.width*this.godRayTexture.height),this.godRayCompute.setStorageBuffer("historyGodRayData",this.historyGodRayData);let a=ve.getGBufferFrame(ve.colorPass_GBuffer);this.godRayCompute.setSamplerTexture("gBufferTexture",a.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",this.godRayCompute),this.godRayCompute.setStorageTexture("outTex",this.godRayTexture);let r=_.getRenderJob(e).shadowMapPassRenderer;this.godRayCompute.setSamplerTexture("shadowMap",r.depth2DArrayTexture),this.godRaySetting=t,this.onResize()}createResource(){let e=I.presentationSize,[t,a]=e;this.godRayTexture=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.godRayTexture.name="godRayTexture";let r=new Je;r.loadOp="load",this.rtFrame=new lt([this.godRayTexture],[r])}onResize(){let e=I.presentationSize,[t,a]=e;this.godRayTexture.resize(t,a),this.historyGodRayData.resizeBuffer(4*this.godRayTexture.width*this.godRayTexture.height),this.godRayCompute.setStorageBuffer("historyGodRayData",this.historyGodRayData),this.godRayCompute.workerSizeX=Math.ceil(this.godRayTexture.width/8),this.godRayCompute.workerSizeY=Math.ceil(this.godRayTexture.height/8),this.godRayCompute.workerSizeZ=1}render(e,t){if(!this.godRayCompute){this.createResource(),this.createCompute(e);let o=xe.getLightEntries(e.scene);this.godRayCompute.setStorageBuffer("lightBuffer",o.storageGPUBuffer),this.godRayCompute.setStorageBuffer("models",xe.modelMatrixBindGroup.matrixBufferDst),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GodRay";let l=xe.getCameraGroup(e.camera);this.godRayCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=_.setting.render.postProcessing.godRay;this.godRaySetting.setFloat("intensity",a.intensity),this.godRaySetting.setFloat("rayMarchCount",a.rayMarchCount);let r=I.presentationSize,[i,n]=r;this.godRaySetting.setFloat("viewPortWidth",i),this.godRaySetting.setFloat("viewPortHeight",n),this.godRaySetting.setFloat("blendColor",a.blendColor?1:0),this.godRaySetting.setFloat("scatteringExponent",a.scatteringExponent),this.godRaySetting.apply(),k.computeCommand(t,[this.godRayCompute]),k.lastRenderPassState=this.rendererPassState}}class zh{indexList;color;count}class Wh{SlotCount=8;MaxEntities=16;defaultColor=new J(.2,1,1,1);slots=[];dataDirty=!0;constructor(){let e=_.setting.render.postProcessing.outline.groupCount;this.SlotCount=Math.max(1,Math.min(e,this.SlotCount));for(let t=0;t<this.SlotCount;t++){let a=this.slots[t]=new zh;a.indexList=new Float32Array(this.MaxEntities),a.color=this.defaultColor.clone(),a.count=0}}clear(){for(let e=0;e<this.SlotCount;e++)this.clearAt(e)}clearAt(e){this.dataDirty=!0;let t=this.slots[e];return t.color.copyFrom(this.defaultColor),t.indexList.fill(-1),t.count=0,this}fillDataAt(e,t,a){this.dataDirty=!0;let r=this.slots[e];if(r){r.indexList.fill(-1);for(let i=0,n=t.length;i<n;i++)r.indexList[i]=t[i];r.count=t.length,r.color.copyFrom(a)}return this}fetchData(e){return e.dirty=this.dataDirty,e.slots=this.slots,this.dataDirty=!1,this}}let Ua=new Wh;class Cp extends Wt{outlineTex;lowTex;rendererPassState;calcWeightCompute;outlineCompute;blendCompute;outlineSetting;slotsBuffer;slotsArray;entitiesArray;entitiesBuffer;weightBuffer;lowTexSize;oldOutlineColor;rtFrame;view;constructor(){super()}onAttach(e){this.view=e,_.setting.render.postProcessing.outline.enable=!0}onDetach(e){_.setting.render.postProcessing.outline.enable=!1}set outlinePixel(e){e=Be(e,0,8);let t=_.setting.render.postProcessing.outline;t.outlinePixel!=e&&(t.outlinePixel=e)}get outlinePixel(){return _.setting.render.postProcessing.outline.outlinePixel}set fadeOutlinePixel(e){let t=_.setting.render.postProcessing.outline;e=Be(e,0,8),t.fadeOutlinePixel!=e&&(t.fadeOutlinePixel=e)}get fadeOutlinePixel(){return _.setting.render.postProcessing.outline.fadeOutlinePixel}set strength(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.outline;t.strength!=e&&(t.strength=e)}get strength(){return _.setting.render.postProcessing.outline.strength}set useAddMode(e){_.setting.render.postProcessing.outline.useAddMode=e}get useAddMode(){return _.setting.render.postProcessing.outline.useAddMode}createGUI(){}createCompute(){let e=ve.getGBufferFrame(ve.colorPass_GBuffer);this.calcWeightCompute=new Fe(Sd);let t=xe.getCameraGroup(this.view.camera);this.calcWeightCompute.setUniformBuffer("globalUniform",t.uniformGPUBuffer),this.calcWeightCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.calcWeightCompute.setStorageBuffer("slotsBuffer",this.slotsBuffer),this.calcWeightCompute.setStorageBuffer("weightBuffer",this.weightBuffer),this.calcWeightCompute.setStorageBuffer("entitiesBuffer",this.entitiesBuffer),this.calcWeightCompute.setSamplerTexture("gBufferTexture",e.getCompressGBufferTexture()),this.calcWeightCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.calcWeightCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.calcWeightCompute.workerSizeZ=1,this.outlineCompute=new Fe(Fd),this.outlineCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.outlineCompute.setStorageBuffer("slotsBuffer",this.slotsBuffer),this.outlineCompute.setStorageBuffer("weightBuffer",this.weightBuffer),this.outlineCompute.setStorageBuffer("oldOutlineColor",this.oldOutlineColor),this.outlineCompute.setStorageTexture("lowTex",this.lowTex),this.outlineCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.outlineCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.outlineCompute.workerSizeZ=1,this.blendCompute=new Fe(Cd),this.blendCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.autoSetColorTexture("inTex",this.blendCompute),this.blendCompute.setSamplerTexture("lowTex",this.lowTex),this.blendCompute.setStorageTexture("outlineTex",this.outlineTex),this.blendCompute.workerSizeX=Math.ceil(this.outlineTex.width/8),this.blendCompute.workerSizeY=Math.ceil(this.outlineTex.height/8),this.blendCompute.workerSizeZ=1}createResource(){let e=I.presentationSize,t=e[0],a=e[1],r=_.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new de(Math.ceil(t*r),Math.ceil(a*r)),this.lowTex=new Te(this.lowTexSize.x,this.lowTexSize.y,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lowTex.name="lowTex";let i=new Je;i.clearValue=[0,0,0,1],i.loadOp="clear",this.outlineTex=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outlineTex.name="outlineTex";let n=new Je;n.clearValue=[0,0,0,1],n.loadOp="clear",this.rtFrame=new lt([this.outlineTex],[n]),this.outlineSetting=new Ct(8),this.weightBuffer=new Pe(this.lowTexSize.x*this.lowTexSize.y*4,GPUBufferUsage.COPY_SRC),this.oldOutlineColor=new Pe(this.lowTexSize.x*this.lowTexSize.y*4,GPUBufferUsage.COPY_SRC),this.slotsArray=new Float32Array(Ua.SlotCount*4),this.slotsBuffer=new Pe(this.slotsArray.length),this.slotsBuffer.setFloat32Array("slotsArray",this.slotsArray),this.slotsBuffer.apply(),this.entitiesArray=new Float32Array(Ua.SlotCount*Ua.MaxEntities),this.entitiesBuffer=new Pe(this.entitiesArray.length),this.entitiesBuffer.setFloat32Array("entitiesArray",this.entitiesArray),this.slotsBuffer.apply(),this.fetchData||={}}fetchData;fetchOutlineData(){if(Ua.fetchData(this.fetchData),this.fetchData.dirty){let e=Ua.SlotCount,t=Ua.MaxEntities;for(let a=0;a<e;a++){let r=4*a,i=this.fetchData.slots[a];this.slotsArray[r+0]=i.color.r,this.slotsArray[r+1]=i.color.g,this.slotsArray[r+2]=i.color.b,this.slotsArray[r+3]=i.count,r=t*a,this.entitiesArray.set(i.indexList,r)}this.slotsBuffer.setFloat32Array("slotsArray",this.slotsArray),this.slotsBuffer.apply(),this.entitiesBuffer.setFloat32Array("entitiesArray",this.entitiesArray),this.entitiesBuffer.apply()}}computeList;render(e,t){this.calcWeightCompute||(this.createResource(),this.createCompute(),this.createGUI(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null)),this.computeList||=[this.calcWeightCompute,this.outlineCompute,this.blendCompute];let a=_.setting.render.postProcessing.outline;this.outlineSetting.setFloat("strength",a.strength),this.outlineSetting.setFloat("useAddMode",a.useAddMode?1:0),this.outlineSetting.setFloat("outlinePixel",a.outlinePixel),this.outlineSetting.setFloat("fadeOutlinePixel",a.fadeOutlinePixel),this.outlineSetting.setFloat("lowTexWidth",this.lowTexSize.x),this.outlineSetting.setFloat("lowTexHeight",this.lowTexSize.y),this.outlineSetting.apply(),this.fetchOutlineData(),k.computeCommand(t,this.computeList),k.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=_.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new de(Math.ceil(t*r),Math.ceil(a*r)),this.lowTex.resize(this.lowTexSize.x,this.lowTexSize.y),this.outlineTex.resize(t,a),this.weightBuffer.resizeBuffer(this.lowTexSize.x*this.lowTexSize.y*4),this.oldOutlineColor.resizeBuffer(this.lowTexSize.x*this.lowTexSize.y*4),this.calcWeightCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.calcWeightCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.calcWeightCompute.workerSizeZ=1,this.outlineCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.outlineCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.outlineCompute.workerSizeZ=1,this.blendCompute.workerSizeX=Math.ceil(this.outlineTex.width/8),this.blendCompute.workerSizeY=Math.ceil(this.outlineTex.height/8),this.blendCompute.workerSizeZ=1}}class Sp extends Wt{outTexture;newTexture;oldTexture;combineTexture;rendererPassState;ssgiCompute;delayCompute;combineCompute;rtFrame;textureScaleSmallCompute;textureScaleBigCompute;view;colorTexture;posTexture;normalTexture;gBufferTexture;lastPosTexture;downSampleCofe=1;debugChanal="0";updateBuffer;constructor(){super(),this.updateBuffer=new Pe(32),this.updateBuffer.setFloat("frameCount",10),this.updateBuffer.setFloat("indirectIns",1.5),this.updateBuffer.setFloat("delay",.02),this.updateBuffer.setFloat("colorIns",1),this.updateBuffer.setFloat("d1",.03),this.updateBuffer.apply()}onAttach(e){this.view=e,e.camera.transform.onPositionChange=e.camera.transform.onPositionChange?Cs(e.camera.transform.onPositionChange,(t,a)=>this.onCameraChange(t,a)):(t,a)=>this.onCameraChange(t,a)}onCameraChange(e,t){console.log("a");let a=b.distance(e,t);a=Math.min(.45,a)+.01,this.updateBuffer.setFloat("delay",a)}Render;onDetach(e){}set ins(e){this.updateBuffer.setFloat("indirectIns",e),this.updateBuffer.apply()}get ins(){return this.updateBuffer.getFloat("indirectIns")}set delay(e){this.updateBuffer.setFloat("delay",e),this.updateBuffer.apply()}get delay(){return this.updateBuffer.getFloat("delay")}set colorIns(e){this.updateBuffer.setFloat("colorIns",e),this.updateBuffer.apply()}get colorIns(){return this.updateBuffer.getFloat("colorIns")}set frameCount(e){this.updateBuffer.setFloat("frameCount",e),this.updateBuffer.apply()}get frameCount(){return this.updateBuffer.getFloat("frameCount")}set d1(e){this.updateBuffer.setFloat("d1",e),this.updateBuffer.apply()}get d1(){return this.updateBuffer.getFloat("d1")}createResource(){let e=ve.getGBufferFrame("ColorPassGBuffer");this.gBufferTexture=e.getCompressGBufferTexture();let t=I.presentationSize,a=t[0],r=t[1];this.lastPosTexture=new Te(a,r,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lastPosTexture.name="lastPosTexture",this.outTexture=new Te(a,r,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let i=Math.floor(a*this.downSampleCofe),n=Math.floor(r*this.downSampleCofe);this.newTexture=new Te(i,n,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.newTexture.name="newTexture",this.oldTexture=new Te(i,n,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.oldTexture.name="oldTexture",this.combineTexture=new Te(i,n,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.combineTexture.name="combineTexture";let o=new Je;o.loadOp="load",this.rtFrame=new lt([this.outTexture],[o])}createCompute(){this.ssgiCompute=new Fe(wd),this.delayCompute=new Fe(Vd),this.combineCompute=new Fe(Pd);let e=xe.getCameraGroup(this.view.camera);this.ssgiCompute.setSamplerTexture("gBufferTexture",this.gBufferTexture),this.ssgiCompute.setSamplerTexture("combineTexture",this.combineTexture),this.ssgiCompute.setSamplerTexture("oldTexture",this.oldTexture),this.ssgiCompute.setStorageTexture("newTexture",this.newTexture),this.ssgiCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.ssgiCompute.setStorageBuffer("updateBuffer",this.updateBuffer),this.autoSetColorTexture("inTex",this.ssgiCompute),this.delayCompute.setSamplerTexture("newTexture",this.newTexture),this.delayCompute.setSamplerTexture("oldTexture",this.oldTexture),this.delayCompute.setStorageTexture("combineTexture",this.combineTexture),this.delayCompute.setStorageBuffer("updateBuffer",this.updateBuffer),this.combineCompute.setSamplerTexture("inputBTexture",this.combineTexture),this.combineCompute.setSamplerTexture("gBufferTexture",this.gBufferTexture),this.combineCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.combineCompute.setStorageTexture("outTexture",this.outTexture),this.combineCompute.setStorageBuffer("updateBuffer",this.updateBuffer),this.textureScaleBigCompute=new Nh,this.textureScaleBigCompute.setInputes(null,[this.combineTexture],[this.outTexture])}render(e,t){}frame=0;compute(e){this.ssgiCompute||(this.createResource(),this.createCompute(),this.onResize(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="SSGI"),this.frameCount=this.frame,this.frame++;let t=k.beginCommandEncoder();switch(parseInt(this.debugChanal)){case 0:k.copyTexture(t,this.combineTexture,this.oldTexture),k.computeCommand(t,[this.ssgiCompute,this.delayCompute,this.combineCompute]);break;case 1:k.copyTexture(t,this.posTexture,this.lastPosTexture),k.copyTexture(t,this.lastPosTexture,this.outTexture);break;case 2:k.copyTexture(t,this.normalTexture,this.outTexture);break;case 3:k.copyTexture(t,this.posTexture,this.outTexture);break;case 4:k.copyTexture(t,this.colorTexture,this.outTexture);break;case 5:k.copyTexture(t,this.gBufferTexture,this.outTexture);break}k.lastRenderPassState=this.rendererPassState,this.updateBuffer.setFloat("delay",.01)}onResize(){let e=I.presentationSize,t=e[0],a=e[1];this.outTexture.resize(t,a),this.ssgiCompute.workerSizeX=Math.ceil(this.newTexture.width/16),this.ssgiCompute.workerSizeY=Math.ceil(this.newTexture.height/16),this.ssgiCompute.workerSizeZ=1,this.delayCompute.workerSizeX=Math.ceil(this.combineTexture.width/16),this.delayCompute.workerSizeY=Math.ceil(this.combineTexture.height/16),this.delayCompute.workerSizeZ=1,this.combineCompute.workerSizeX=Math.ceil(this.outTexture.width/16),this.combineCompute.workerSizeY=Math.ceil(this.outTexture.height/16),this.combineCompute.workerSizeZ=1}}class Fp extends Wt{SSR_RayTraceCompute;SSR_IS_Compute;SSR_Blend_Compute;isRetTexture;finalTexture;rendererPassState;ssrUniformBuffer;rayTraceData;ssrColorData;rtFrame;historyPosition;view;onAttach(e){this.view=e,_.setting.render.postProcessing.ssr.enable=!0}onDetach(e){_.setting.render.postProcessing.ssr.enable=!1}reflectionRatio=.5;get fadeEdgeRatio(){return _.setting.render.postProcessing.ssr.fadeEdgeRatio}set fadeEdgeRatio(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.fadeEdgeRatio=e}get rayMarchRatio(){return _.setting.render.postProcessing.ssr.rayMarchRatio}set rayMarchRatio(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.rayMarchRatio=e}get roughnessThreshold(){return _.setting.render.postProcessing.ssr.roughnessThreshold}set roughnessThreshold(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.roughnessThreshold=e}get fadeDistanceMin(){return _.setting.render.postProcessing.ssr.fadeDistanceMin}set fadeDistanceMin(e){e=Be(e,0,1e4);let t=_.setting.render.postProcessing.ssr;t.fadeDistanceMin=e}get fadeDistanceMax(){return _.setting.render.postProcessing.ssr.fadeDistanceMax}set fadeDistanceMax(e){e=Be(e,0,1e4);let t=_.setting.render.postProcessing.ssr;t.fadeDistanceMax=e}get powDotRN(){return _.setting.render.postProcessing.ssr.powDotRN}set powDotRN(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.powDotRN=e}createRayTraceShader(){let e=xe.getCameraGroup(this.view.camera);this.SSR_RayTraceCompute=new Fe(Qd),this.SSR_RayTraceCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.SSR_RayTraceCompute.setUniformBuffer("ssrUniform",this.ssrUniformBuffer),this.SSR_RayTraceCompute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_RayTraceCompute.setStorageBuffer("historyPosition",this.historyPosition);let a=ve.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture();this.SSR_RayTraceCompute.setSamplerTexture("gBufferTexture",a),q.instance.sky instanceof Ws&&this.SSR_RayTraceCompute.setSamplerTexture("prefilterMap",q.instance.sky.map),this.SSR_RayTraceCompute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_RayTraceCompute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_RayTraceCompute.workerSizeZ=1}createISShader(){this.SSR_IS_Compute=new Fe(Rd),this.SSR_IS_Compute.setStorageBuffer("ssrUniform",this.ssrUniformBuffer),this.SSR_IS_Compute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_IS_Compute.setStorageBuffer("ssrColorData",this.ssrColorData),this.SSR_IS_Compute.setStorageBuffer("historyPosition",this.historyPosition),this.SSR_IS_Compute.setSamplerTexture("colorMap",this.getOutTexture()),this.SSR_IS_Compute.setStorageTexture("outTex",this.isRetTexture),this.SSR_IS_Compute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_IS_Compute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_IS_Compute.workerSizeZ=1}createBlendShader(e){let t=xe.getCameraGroup(this.view.camera);this.SSR_Blend_Compute=new Fe(Id),this.SSR_Blend_Compute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_Blend_Compute.setUniformBuffer("globalUniform",t.uniformGPUBuffer);let r=ve.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture();this.SSR_Blend_Compute.setSamplerTexture("gBufferTexture",r),this.SSR_Blend_Compute.setSamplerTexture("colorMap",this.getOutTexture()),this.SSR_Blend_Compute.setSamplerTexture("ssrMap",e),this.SSR_Blend_Compute.setStorageTexture("outTex",this.finalTexture),this.SSR_Blend_Compute.workerSizeX=Math.ceil(this.finalTexture.width/8),this.SSR_Blend_Compute.workerSizeY=Math.ceil(this.finalTexture.height/8),this.SSR_Blend_Compute.workerSizeZ=1}createResource(){let[e,t]=I.presentationSize;this.finalTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.finalTexture.name="ssrOutTex";let a=new Je;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=Math.ceil(e*_.setting.render.postProcessing.ssr.pixelRatio),i=Math.ceil(t*_.setting.render.postProcessing.ssr.pixelRatio);this.isRetTexture=new Te(r,i,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.isRetTexture.name="ssrTextureIn";let n=new Je;n.clearValue=[0,0,0,0],n.loadOp="clear",this.rtFrame=new lt([this.finalTexture,this.isRetTexture],[a,n]),this.rayTraceData=new Pe(r*i*8,GPUBufferUsage.COPY_SRC),this.ssrColorData=new Pe(r*i*4,GPUBufferUsage.COPY_SRC),this.historyPosition=new Pe(r*i*4,GPUBufferUsage.COPY_SRC),this.ssrUniformBuffer=new Ct(32),this.ssrUniformBuffer.setFloat("ssrBufferSizeX",this.isRetTexture.width),this.ssrUniformBuffer.setFloat("ssrBufferSizeY",this.isRetTexture.height),this.ssrUniformBuffer.setFloat("colorMapSizeX",this.finalTexture.width),this.ssrUniformBuffer.setFloat("colorMapSizeY",this.finalTexture.height),this.ssrUniformBuffer.apply()}render(e,t){if(!this.SSR_RayTraceCompute){this.createResource(),this.createISShader(),this.createRayTraceShader(),this.createBlendShader(this.isRetTexture),this.rendererPassState=He.createRendererPassState(this.rtFrame,null);let i=xe.getCameraGroup(e.camera);this.SSR_RayTraceCompute.setUniformBuffer("standUniform",i.uniformGPUBuffer)}let a=_.setting.render.postProcessing.ssr;this.ssrUniformBuffer.setFloat("fadeEdgeRatio",a.fadeEdgeRatio),this.ssrUniformBuffer.setFloat("rayMarchRatio",a.rayMarchRatio),this.ssrUniformBuffer.setFloat("fadeDistanceMin",a.fadeDistanceMin),this.ssrUniformBuffer.setFloat("fadeDistanceMax",a.fadeDistanceMax),this.ssrUniformBuffer.setFloat("mixThreshold",a.mixThreshold),this.ssrUniformBuffer.setFloat("roughnessThreshold",a.roughnessThreshold),this.ssrUniformBuffer.setFloat("reflectionRatio",this.reflectionRatio),this.ssrUniformBuffer.setFloat("powDotRN",a.powDotRN),this.ssrUniformBuffer.setFloat("randomSeedX",Math.random()),this.ssrUniformBuffer.setFloat("randomSeedY",Math.random()),this.ssrUniformBuffer.apply();let r=[this.SSR_RayTraceCompute,this.SSR_IS_Compute,this.SSR_Blend_Compute];k.computeCommand(t,r),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize,a=Math.ceil(e*_.setting.render.postProcessing.ssr.pixelRatio),r=Math.ceil(t*_.setting.render.postProcessing.ssr.pixelRatio);this.finalTexture.resize(e,t),this.isRetTexture.resize(a,r),this.rayTraceData.resizeBuffer(a*r*8),this.ssrColorData.resizeBuffer(a*r*4),this.historyPosition.resizeBuffer(a*r*4),this.ssrUniformBuffer.setFloat("ssrBufferSizeX",this.isRetTexture.width),this.ssrUniformBuffer.setFloat("ssrBufferSizeY",this.isRetTexture.height),this.ssrUniformBuffer.setFloat("colorMapSizeX",this.finalTexture.width),this.ssrUniformBuffer.setFloat("colorMapSizeY",this.finalTexture.height),this.SSR_RayTraceCompute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_RayTraceCompute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_RayTraceCompute.workerSizeZ=1,this.SSR_IS_Compute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_IS_Compute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_IS_Compute.workerSizeZ=1,this.SSR_Blend_Compute.workerSizeX=Math.ceil(this.finalTexture.width/8),this.SSR_Blend_Compute.workerSizeY=Math.ceil(this.finalTexture.height/8),this.SSR_Blend_Compute.workerSizeZ=1}}class kp{static createSeeds(){let e=20,t=32,a=[new b(0,0,e)],r=0,i=.02;for(let n=1;n<t;n++){let o=new b;a.push(o),r+=1-(1-.618)*n/t,i+=n*.01,o.x=Math.sin(r)*i,o.y=Math.cos(r)*i,o.z=1-n/t,o.multiplyScalar(e)}return a}}class Ep extends Wt{taaTexture;outTexture;rendererPassState;taaCompute;copyTexCompute;sharpCompute;taaSetting;preColorBuffer;preColorTex;preProjMatrix;preViewMatrix;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.taa.enable=!0,e.camera.enableJitterProjection(!0),this.createGUI()}onDetach(e){_.setting.render.postProcessing.taa.enable=!1,e.camera.enableJitterProjection(!1)}get jitterSeedCount(){return _.setting.render.postProcessing.taa.jitterSeedCount}set jitterSeedCount(e){e=Be(e,2,32),e=Math.round(e);let t=_.setting.render.postProcessing.taa;t.jitterSeedCount=e}get blendFactor(){return _.setting.render.postProcessing.taa.blendFactor}set blendFactor(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.taa;t.blendFactor=e}get sharpFactor(){return _.setting.render.postProcessing.taa.sharpFactor}set sharpFactor(e){e=Be(e,.1,.99);let t=_.setting.render.postProcessing.taa;t.sharpFactor=e}get sharpPreBlurFactor(){return _.setting.render.postProcessing.taa.sharpPreBlurFactor}set sharpPreBlurFactor(e){e=Be(e,.1,.99);let t=_.setting.render.postProcessing.taa;t.sharpPreBlurFactor=e}get temporalJitterScale(){return _.setting.render.postProcessing.taa.temporalJitterScale}set temporalJitterScale(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.taa;t.temporalJitterScale=e}createGUI(){}createCompute(e){let t=new Fe(Nd),a=new Ct(44),r=xe.getCameraGroup(e.camera);t.setUniformBuffer("globalUniform",r.uniformGPUBuffer),t.setUniformBuffer("taaData",a),t.setStorageBuffer("preColorBuffer",this.preColorBuffer);let i=ve.getGBufferFrame(ve.colorPass_GBuffer);t.setSamplerTexture("preColorTex",this.preColorTex),t.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",t),t.setStorageTexture("outTex",this.taaTexture),t.workerSizeX=Math.ceil(this.taaTexture.width/8),t.workerSizeY=Math.ceil(this.taaTexture.height/8),t.workerSizeZ=1,this.taaCompute=t,this.taaSetting=a,this.copyTexCompute=new Fe(Td),this.copyTexCompute.setStorageBuffer("preColor",this.preColorBuffer),this.copyTexCompute.setStorageTexture("preColorTex",this.preColorTex),this.copyTexCompute.workerSizeX=Math.ceil(this.taaTexture.width/8),this.copyTexCompute.workerSizeY=Math.ceil(this.taaTexture.height/8),this.copyTexCompute.workerSizeZ=1,this.sharpCompute=new Fe(Md),this.sharpCompute.setUniformBuffer("taaData",a),this.sharpCompute.setSamplerTexture("inTex",this.taaTexture),this.sharpCompute.setStorageTexture("outTex",this.outTexture),this.sharpCompute.workerSizeX=Math.ceil(this.outTexture.width/8),this.sharpCompute.workerSizeY=Math.ceil(this.outTexture.height/8),this.sharpCompute.workerSizeZ=1}createResource(){this.preProjMatrix=new R().identity(),this.preViewMatrix=new R().identity();let[e,t]=I.presentationSize;this.preColorBuffer=new Pe(e*t*4,GPUBufferUsage.COPY_SRC),this.preColorTex=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.preColorTex.name="taaTex";let a=new Je;a.clearValue=[0,0,0,1],a.loadOp="clear",this.taaTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.taaTexture.name="taaTex";let r=new Je;r.clearValue=[0,0,0,1],r.loadOp="clear",this.outTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="sharpTaaTex";let i=new Je;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new lt([this.preColorTex,this.taaTexture,this.outTexture],[a,r,i])}render(e,t){this.taaCompute||(this.createResource(),this.createCompute(e),this.rendererPassState=He.createRendererPassState(this.rtFrame,null));let a=_.setting.render.postProcessing.taa;this.taaSetting.setMatrix("preProjMatrix",this.preProjMatrix),this.taaSetting.setMatrix("preViewMatrix",this.preViewMatrix),this.taaSetting.setFloat("jitterFrameIndex",e.camera.jitterFrameIndex),this.taaSetting.setFloat("blendFactor",a.blendFactor),this.taaSetting.setFloat("sharpFactor",a.sharpFactor),this.taaSetting.setFloat("sharpPreBlurFactor",a.sharpPreBlurFactor),this.taaSetting.setFloat("jitterX",e.camera.jitterX),this.taaSetting.setFloat("jitterY",e.camera.jitterY),this.taaSetting.apply(),k.computeCommand(t,[this.copyTexCompute,this.taaCompute,this.sharpCompute]),k.lastRenderPassState=this.rendererPassState,this.preProjMatrix.copyFrom(e.camera.projectionMatrix),this.preViewMatrix.copyFrom(e.camera.viewMatrix)}onResize(){let[e,t]=I.presentationSize;this.preColorBuffer.resizeBuffer(e*t*4),this.taaTexture.resize(e,t),this.outTexture.resize(e,t),this.preColorTex.resize(e,t),this.taaCompute.workerSizeX=Math.ceil(this.taaTexture.width/8),this.taaCompute.workerSizeY=Math.ceil(this.taaTexture.height/8),this.taaCompute.workerSizeZ=1,this.copyTexCompute.workerSizeX=Math.ceil(this.taaTexture.width/8),this.copyTexCompute.workerSizeY=Math.ceil(this.taaTexture.height/8),this.copyTexCompute.workerSizeZ=1,this.sharpCompute.workerSizeX=Math.ceil(this.outTexture.width/8),this.sharpCompute.workerSizeY=Math.ceil(this.outTexture.height/8),this.sharpCompute.workerSizeZ=1}}class Jh{_tempIndexArray=[];setOutline(e,t){this.setOutlineList([e],t?[t]:null)}setOutlineList(e,t){e||=[];let a=Ua.defaultColor,r=Ua.SlotCount;for(let i=0;i<r;i++){this._tempIndexArray.length=0;let n=e[i],o=(t?t[i]:null)||a;if(n)for(const l of n)this.getEntityIdList(l,this._tempIndexArray);Ua.fillDataAt(i,this._tempIndexArray,o)}}clearOutline(){return Ua.clear(),this}_rendererList=[];getEntityIdList(e,t){this._rendererList.length=0;let a=e.getComponents(he,this._rendererList);for(const r of a)t.push(r.object3D.transform._worldMatrix.index)}}let wp=new Jh;class jh{localPosition=new b;worldPosition=new b;uv=new de;faceIndex;isIn=!1;t=0;u=0;v=0;triangle;v0;v1;v2;pickList;color}class Bi{static EPS=1e-4;static FLT_MAX=3402823466e29;static distPtTri(e,t,a,r){let i=new b,n=new b,o=new b;r.subtract(t,i),a.subtract(t,n),e.subtract(t,o);let l=Ft(i,i),c=Ft(i,n),f=Ft(i,o),d=Ft(n,n),h=Ft(n,o),u=1/(l*d-c*c),m=(d*f-c*h)*u,g=(l*h-c*f)*u;if(m>=-Bi.EPS&&g>=-Bi.EPS&&m+g<=1+Bi.EPS){let p=t[1]+i[1]*m+n[1]*g;return Math.abs(p-e[1])}return Bi.FLT_MAX}static _info=new jh;static IntersectTriangle(e,t,a){let r=t.v1,i=t.v2,n=t.v3,o=i.subtract(r,b.HELP_3),l=n.subtract(r,b.HELP_4),c=e.direction.crossProduct(l,b.HELP_5),f=Ft(o,c),d;if(f>0){if(a)return null;d=e.origin.subtract(r,b.HELP_2)}else d=r.subtract(e.origin,b.HELP_2),f=-f;if(f<1e-4)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let h=Ft(d,c);if(h<0||h>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let u=d.crossProduct(o,b.HELP_1),m=Ft(e.direction,u);if(m<0||h+m>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let g=Ft(l,u),p=1/f;g*=p,h*=p,m*=p,this._info.isIn=!0,this._info.t=g,this._info.u=h,this._info.v=m;let D=1-h-m;return this._u0.copyFrom(t.u1),this._u0.scale(D),this._u1.copyFrom(t.u2),this._u1.scale(h),this._u2.copyFrom(t.u3),this._u2.scale(m),this._info.uv.copyFrom(this._u0),this._info.uv.add(this._u1,this._info.uv),this._info.uv.add(this._u2,this._info.uv),this._info.localPosition.copyFrom(e.direction).multiplyScalar(g),this._info.localPosition.add(e.origin,this._info.localPosition),this._info}static _u0=new de;static _u1=new de;static _u2=new de}class An extends Za{static _instance;_maxRetry=3;loadAll(e,t){return new Promise((a,r)=>{let i=e.length,n=[];e.forEach((o,l)=>{let c=new t;this.load(o,t).then(f=>{c.parse(f),n.push(c),i--,i===0&&a(n)})})})}constructor(){if(super(),An._instance)throw new Error("LoadManager is singleton class...")}static getInstance(){return this._instance||(this._instance=new An)}loadUrls(e,t){return new Promise((a,r)=>{let i=e.length,n=[];e.forEach((o,l)=>{this.load(o,t).then(c=>{n.push(c),i--,i===0&&a(n),i<0&&console.error(`loadUrls ${e} error`)})})})}get maxRetry(){return this._maxRetry}set maxRetry(e){this._maxRetry=e}load(e,t){return new Promise((a,r)=>{t.format})}}class Ip extends Er{async loadStream(e,t,a,r){if(t.format!==je.BIN)throw new Error("StreamLoader only supports BIN format parsers");return new Promise(async(i,n)=>{let o=!1,l=null,c=null;const f=()=>{o=!0,l&&(l.cancel().catch(()=>{}),l.releaseLock()),c&&c.abort(),d&&typeof d.cancel=="function"&&d.cancel()};let d=null;try{this.baseUrl=e.substring(0,e.lastIndexOf("/")+1),this.initUrl=e,c=new AbortController;const h=await fetch(e,{headers:a?.headers,signal:c.signal});if(!h.ok)throw new Error(`Request rejected with status ${h.status}`);l=h.body.getReader();const u=+h.headers.get("Content-Length")||0;if(d=new t,d.userData=r,d.baseUrl=this.baseUrl,d.initUrl=e,d.loaderFunctions=a,typeof d.initStream!="function")throw new Error(`Parser ${t.name} does not support streaming. Implement initStream() method.`);let m=!1;await d.initStream(u,()=>{!m&&!o&&d&&d.verification()&&(m=!0,i({parser:d,cancel:f}))});let g=0;for(;!o;){const{done:p,value:D}=await l.read();if(p||o){if(!o&&(typeof d.finalizeStream=="function"&&await d.finalizeStream(),!m&&d))if(d.verification())m=!0,i({parser:d,cancel:f});else throw new Error("Parser verification failed");break}if(o)break;g+=D.length,u>0&&a?.onProgress&&!o&&a.onProgress.call(this,g,u,e,d),!o&&typeof d.processChunk=="function"&&await d.processChunk(D,g,u),!m&&!o&&d&&d.verification()&&(m=!0,i({parser:d,cancel:f}))}!o&&a?.onComplete&&a.onComplete.call(this,e)}catch(h){if(o)return;a?.onError&&a.onError(h),n(h)}finally{if(l&&!o)try{l.releaseLock()}catch{}}})}}function Zo(s){const e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let a=0;a<s.length;a+=3){const r=s[a+0],i=s[a+1],n=s[a+2];r<e[0]&&(e[0]=r),i<e[1]&&(e[1]=i),n<e[2]&&(e[2]=n),r>t[0]&&(t[0]=r),i>t[1]&&(t[1]=i),n>t[2]&&(t[2]=n)}return{min:e,max:t}}var Ai=(s=>(s.PLY="ply",s.SPLAT="splat",s.KSPLAT="ksplat",s.UNKNOWN="unknown",s))(Ai||{});function Zh(s){if(s.byteLength<16)return"unknown";const e=new Uint8Array(s,0,Math.min(512,s.byteLength));return new TextDecoder("utf-8").decode(e).startsWith("ply")?"ply":"unknown"}var ya=(s=>(s[s.Splat=0]="Splat",s[s.PointCloud=1]="PointCloud",s[s.Mesh=2]="Mesh",s))(ya||{});const Xi=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],Yo=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"];function $t(s){switch(s){case"char":case"uchar":case"uint8":case"int8":return 1;case"short":case"ushort":case"int16":case"uint16":return 2;case"int":case"uint":case"int32":case"uint32":case"float":case"float32":return 4;case"double":case"float64":return 8;default:return 4}}function pe(s,e,t){switch(t){case"char":case"int8":return s.getInt8(e);case"uchar":case"uint8":return s.getUint8(e);case"short":case"int16":return s.getInt16(e,!0);case"ushort":case"uint16":return s.getUint16(e,!0);case"int":case"int32":return s.getInt32(e,!0);case"uint":case"uint32":return s.getUint32(e,!0);case"double":case"float64":return s.getFloat64(e,!0);case"float":case"float32":default:return s.getFloat32(e,!0)}}function Xo(s){const e=Math.round(Math.sqrt(s));return Math.max(0,e-1)}function Hi(s){const e=new TextDecoder("utf-8").decode(new Uint8Array(s,0,Math.min(4096,s.byteLength)));if(!e.startsWith("ply"))throw new Error("PLY: Unsupported format. Expecting PLY file.");const t=e.indexOf(`end_header
|
|
11843
|
+
`;static _pipelineMax;static _pipelineMin;static createMipmap(e,t){const a=I.device;this._pipelineMax||=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:this.codeMax}),entryPoint:"main"}}),this._pipelineMin||=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:this.codeMin}),entryPoint:"main"}});let r=Math.ceil(e.width*.5),i=Math.ceil(e.height*.5),n={mipmapCount:t,texture:e,srcView:null,mipLevel:1,dstHeight:i,dstWidth:r};n.srcView=e.getGPUTexture().createView({format:e.format,dimension:"2d",baseMipLevel:0,mipLevelCount:1}),e.width>1024&&e.height>1024?this.mipmap(this._pipelineMax,n):this.mipmap(this._pipelineMin,n)}static mipmap(e,t){const a=I.device,r=k.beginCommandEncoder();let i=e==this._pipelineMax,n,o;for(let l=t.mipLevel;l<t.mipmapCount;l++){let c=[],f=0;c.push({binding:f++,resource:t.srcView}),c.push({binding:f++,resource:t.texture.gpuSampler}),n=t.texture.getGPUTexture().createView({format:t.texture.format,dimension:"2d",baseMipLevel:l,mipLevelCount:1}),c.push({binding:f++,resource:n});const d=a.createBindGroup({layout:e.getBindGroupLayout(0),entries:c}),h=r.beginComputePass();h.setPipeline(e),h.setBindGroup(0,d);let u=t.dstWidth,m=t.dstHeight;if(i&&(u=Math.max(1,Math.floor(t.dstWidth/8)),m=Math.max(1,Math.floor(t.dstHeight/8))),h.dispatchWorkgroups(u,m),t.dstHeight*=.5,t.dstWidth*=.5,t.srcView=n,t.mipLevel=l+1,o=i&&(t.dstWidth<8||t.dstHeight<8),h.end(),o)break}k.endCommandEncoder(r),o&&this.mipmap(this._pipelineMin,t)}}class Oh{name="";passMap=new Map}class Lh{passType="";shaderState=new Map;vertexShader="";fragmentShader=""}class mp{static passKeyword="pass";static shaderKeyword="Shader";static vertexKeyword="vertex";static fragmentKeyword="fragment";static passTypeKeyword="PassType";static parser(e,t){e=Da.filterComment(e);let a=new Oh,r=e.indexOf(this.shaderKeyword),i=e.indexOf("{",r),n=e.substring(r+this.shaderKeyword.length,i).trim();a.name=n.substring(1,n.length-1),n=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));let o=this.splitPassBlock(n);for(let l of o){let c=this.parserPassBlock(l),f;a.passMap.has(c.passType)?f=a.passMap.get(c.passType):(f=[],a.passMap.set(c.passType,f)),f.push(c),c.vertexShader.length>0&&(c.vertexShader=Da.parse(c.vertexShader,t)),c.fragmentShader.length>0&&(c.fragmentShader=Da.parse(c.fragmentShader,t))}return a}static splitPassBlock(e){let t=0,a=[];for(;t<e.length;){let r=e.indexOf(this.passKeyword,t);if(r==-1){a.push(e.substring(t));break}t!=0&&a.push(e.substring(t,r)),t=r+this.passKeyword.length}return a}static parserPassBlock(e){let t=new Lh,a=e.indexOf(this.passTypeKeyword),r=e.indexOf('"',a);return a=e.indexOf('"',r+1),t.passType=e.substring(a+1,r).trim(),this.parserShaderState(t,e),a=e.indexOf(this.vertexKeyword),a!=-1&&(t.vertexShader=this.extractBlock(e.substring(a+this.vertexKeyword.length),"{","}")),a=e.indexOf(this.fragmentKeyword),a!=-1&&(t.fragmentShader=this.extractBlock(e.substring(a+this.fragmentKeyword.length),"{","}")),t}static parserShaderState(e,t){let a=t.indexOf("ShaderState");if(a==-1)return!1;a=t.indexOf("{",a);let r=t.indexOf("}",a),n=t.substring(a+1,r).split(",");for(let o of n){let l=o.split(":"),c=l[0].trim(),f=this.convertValue(l[1].trim());e.shaderState.set(c,f)}return!0}static convertValue(e){return e.length==4&&e.toLowerCase()=="true"?!0:e.length==5&&e.toLowerCase()=="false"?!1:e[0]=='"'?e.substring(1,e.length-1):Number.parseInt(e)}static extractBlock(e,t,a){let r=e.indexOf(t);if(r==-1)return"";let i=0,n=0;e=e.substring(r);for(let l of e){if(l==t?i++:l==a&&i--,i<=0)break;n++}return e.substring(1,n).trim()}}let Gh=new pt("IrradianceDataReaderCompleteEvent");class vs extends Za{readFlag=!1;probeRenderer;opColorBuffer;opDepthBuffer;srcColorMap;srcDepthMap;opDepthArray;opColorArray;initReader(e,t,a){this.probeRenderer=e,this.srcColorMap=t,this.srcDepthMap=a;let r=_.setting.gi,i=r.octRTMaxSize*r.octRTMaxSize;this.opColorBuffer=I.device.createBuffer({size:i*4*4,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}),this.opColorArray=new Float32Array(i*4),this.opDepthBuffer=I.device.createBuffer({size:i*4*4,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}),this.opDepthArray=new Float32Array(i*4),this.probeRenderer.addEventListener(no.type,()=>{this.onProbeRenderComplete()},this),this.probeRenderer.addEventListener(Ms.type,()=>{console.log("GIRenderStartEvent")},this)}async onProbeRenderComplete(){if(console.log("GIRenderCompleteEvent"),this.readFlag)console.log("irradianceDataReader is reading yet!!!");else{this.readFlag=!0;let e=Date.now();console.log("irradianceDataReader start reading "),await vs.read(this.srcColorMap.getGPUTexture(),this.opColorBuffer,this.opColorArray),await vs.read(this.srcDepthMap.getGPUTexture(),this.opDepthBuffer,this.opDepthArray),this.readFlag=!1,console.log("process time :",Date.now()-e),console.log("irradianceDataReader read complete"),this.dispatchEvent(Gh)}}static async read(e,t,a){let r=k.beginCommandEncoder();r.copyTextureToBuffer({texture:e},{buffer:t,bytesPerRow:e.width*16},[e.width,e.height]),k.endCommandEncoder(r),await t.mapAsync(GPUMapMode.READ);const i=t.getMappedRange();a.set(new Float32Array(i),0),t.unmap()}}let Ap=new vs;class Dp{computeShader;visibleBuffer;texture;constructor(){this.computeShader=new Fe(zd),this.visibleBuffer=new ni(8192*2),this.computeShader.setStorageBuffer("visibleBuffer",this.visibleBuffer),this.texture=Mt.getTexture(Pa.zBufferTexture_NAME),this.computeShader.setSamplerTexture("zBufferTexture",this.texture),this.computeShader.workerSizeX=Math.ceil(this.texture.width/8),this.computeShader.workerSizeY=Math.ceil(this.texture.height/8),this.computeShader.workerSizeZ=1}compute(e,t){this.visibleBuffer.reset(!0,0),this.visibleBuffer.apply();let a=k.beginCommandEncoder();k.computeCommand(a,[this.computeShader]),this.visibleBuffer.readBuffer(),t.zVisibleList=this.visibleBuffer.outFloat32Array}}class _p extends Wt{RT_BloomUp;RT_BloomDown;RT_threshold;rendererPassState;thresholdCompute;downSampleComputes;upSampleComputes;postCompute;bloomSetting;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.bloom.enable=!0,this.createGUI()}onDetach(e){_.setting.render.postProcessing.bloom.enable=!1,this.removeGUI()}createGUI(){}removeGUI(){}get downSampleBlurSize(){return _.setting.render.postProcessing.bloom.downSampleBlurSize}set downSampleBlurSize(e){_.setting.render.postProcessing.bloom.downSampleBlurSize=e}get downSampleBlurSigma(){return _.setting.render.postProcessing.bloom.downSampleBlurSigma}set downSampleBlurSigma(e){_.setting.render.postProcessing.bloom.downSampleBlurSigma=e}get upSampleBlurSize(){return _.setting.render.postProcessing.bloom.upSampleBlurSize}set upSampleBlurSize(e){_.setting.render.postProcessing.bloom.upSampleBlurSize=e}get upSampleBlurSigma(){return _.setting.render.postProcessing.bloom.upSampleBlurSigma}set upSampleBlurSigma(e){_.setting.render.postProcessing.bloom.upSampleBlurSigma=e}get luminanceThreshole(){return _.setting.render.postProcessing.bloom.luminanceThreshole}set luminanceThreshole(e){_.setting.render.postProcessing.bloom.luminanceThreshole=e}get bloomIntensity(){return _.setting.render.postProcessing.bloom.bloomIntensity}set bloomIntensity(e){_.setting.render.postProcessing.bloom.bloomIntensity=e}get hdr(){return _.setting.render.postProcessing.bloom.hdr}set hdr(e){_.setting.render.postProcessing.bloom.hdr=e}createThreshouldCompute(){this.thresholdCompute=new Fe(Dd),this.autoSetColorTexture("inTex",this.thresholdCompute),this.thresholdCompute.setStorageTexture("outTex",this.RT_threshold),this.thresholdCompute.setUniformBuffer("bloomCfg",this.bloomSetting),this.thresholdCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.thresholdCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.thresholdCompute.workerSizeZ=1}createDownSampleComputes(){const t=_.setting.render.postProcessing.bloom.downSampleStep;this.downSampleComputes=[];for(let a=0;a<t;a++){let r=new Fe(_d),i=this.RT_BloomDown[a],n=a==0?this.RT_threshold:this.RT_BloomDown[a-1];r.setSamplerTexture("inTex",n),r.setStorageTexture("outTex",i),r.setUniformBuffer("bloomCfg",this.bloomSetting),r.workerSizeX=Math.ceil(i.width/8),r.workerSizeY=Math.ceil(i.height/8),r.workerSizeZ=1,this.downSampleComputes.push(r)}}createUpSampleComputes(){const t=_.setting.render.postProcessing.bloom.downSampleStep;this.upSampleComputes=[];{let a=new Fe(Vo),r=this.RT_BloomUp[0],i=this.RT_BloomDown[t-2];a.setSamplerTexture("_MainTex",i),a.setSamplerTexture("_PrevMip",this.RT_BloomDown[t-1]),a.setStorageTexture("outTex",r),a.setUniformBuffer("bloomCfg",this.bloomSetting),a.workerSizeX=Math.ceil(r.width/8),a.workerSizeY=Math.ceil(r.height/8),a.workerSizeZ=1,this.upSampleComputes.push(a)}for(let a=1;a<t-1;a++){let r=new Fe(Vo),i=this.RT_BloomUp[a],n=this.RT_BloomDown[t-2-a];r.setSamplerTexture("_MainTex",n),r.setSamplerTexture("_PrevMip",this.RT_BloomUp[a-1]),r.setStorageTexture("outTex",i),r.setUniformBuffer("bloomCfg",this.bloomSetting),r.workerSizeX=Math.ceil(i.width/8),r.workerSizeY=Math.ceil(i.height/8),r.workerSizeZ=1,this.upSampleComputes.push(r)}}createPostCompute(){const t=_.setting.render.postProcessing.bloom.downSampleStep;this.postCompute=new Fe(Bd),this.autoSetColorTexture("_MainTex",this.postCompute),this.postCompute.setSamplerTexture("_BloomTex",this.RT_BloomUp[t-2]),this.postCompute.setStorageTexture("outTex",this.RT_threshold),this.postCompute.setUniformBuffer("bloomCfg",this.bloomSetting),this.postCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.postCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.postCompute.workerSizeZ=1}createResource(){let e=_.setting.render.postProcessing.bloom;this.bloomSetting=new Ct(8);let[t,a]=I.presentationSize,r=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING;this.RT_threshold=new Te(t,a,oe.rgba16float,!1,r);const i=e.downSampleStep;{this.RT_BloomDown=[];let o=Math.ceil(t/4),l=Math.ceil(a/4);for(let c=0;c<i;c++)this.RT_BloomDown[c]=new Te(o,l,oe.rgba16float,!1,r),o=Math.ceil(o/2),l=Math.ceil(l/2)}{this.RT_BloomUp=[];for(let o=0;o<i-1;o++){let l=this.RT_BloomDown[i-2-o].width,c=this.RT_BloomDown[i-2-o].height;this.RT_BloomUp[o]=new Te(l,c,oe.rgba16float,!1,r)}}let n=new Je;n.loadOp="load",this.rtFrame=new ct([this.RT_threshold],[n])}render(e,t){this.thresholdCompute||(this.createResource(),this.createThreshouldCompute(),this.createDownSampleComputes(),this.createUpSampleComputes(),this.createPostCompute(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="Bloom");let a=_.setting.render.postProcessing.bloom;this.bloomSetting.setFloat("downSampleStep",a.downSampleStep),this.bloomSetting.setFloat("downSampleBlurSize",a.downSampleBlurSize),this.bloomSetting.setFloat("downSampleBlurSigma",a.downSampleBlurSigma),this.bloomSetting.setFloat("upSampleBlurSize",a.upSampleBlurSize),this.bloomSetting.setFloat("upSampleBlurSigma",a.upSampleBlurSigma),this.bloomSetting.setFloat("luminanceThreshole",a.luminanceThreshole),this.bloomSetting.setFloat("bloomIntensity",a.bloomIntensity),this.bloomSetting.setFloat("hdr",a.hdr),this.bloomSetting.apply(),k.computeCommand(t,[this.thresholdCompute,...this.downSampleComputes,...this.upSampleComputes,this.postCompute]),k.lastRenderPassState=this.rendererPassState}onResize(){let e=_.setting.render.postProcessing.bloom,[t,a]=I.presentationSize;this.RT_threshold.resize(t,a);const r=e.downSampleStep;let i=Math.ceil(t/4),n=Math.ceil(a/4);for(let o=0;o<r;o++)this.RT_BloomDown[o].resize(i,n),i=Math.ceil(i/2),n=Math.ceil(n/2);for(let o=0;o<r-1;o++){let l=this.RT_BloomDown[r-2-o].width,c=this.RT_BloomDown[r-2-o].height;this.RT_BloomUp[o].resize(l,c)}this.thresholdCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.thresholdCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.thresholdCompute.workerSizeZ=1;for(let o=0;o<r;o++){let l=this.downSampleComputes[o],c=this.RT_BloomDown[o];l.workerSizeX=Math.ceil(c.width/8),l.workerSizeY=Math.ceil(c.height/8),l.workerSizeZ=1}{let o=this.RT_BloomUp[0],l=this.upSampleComputes[0];l.workerSizeX=Math.ceil(o.width/8),l.workerSizeY=Math.ceil(o.height/8),l.workerSizeZ=1}for(let o=1;o<r-1;o++){let l=this.RT_BloomUp[o],c=this.upSampleComputes[o];c.workerSizeX=Math.ceil(l.width/8),c.workerSizeY=Math.ceil(l.height/8),c.workerSizeZ=1}this.postCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.postCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.postCompute.workerSizeZ=1}}class Bp extends Wt{blurTexture1;blurTexture2;rendererPassState;blurComputes;blurSettings;outTexture;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.depthOfView.enable=!0}onDetach(e){_.setting.render.postProcessing.depthOfView.enable=!1}get pixelOffset(){return _.setting.render.postProcessing.depthOfView.pixelOffset}set pixelOffset(e){e=Math.max(0,e);let t=_.setting.render.postProcessing.depthOfView;t.pixelOffset=e}get near(){return _.setting.render.postProcessing.depthOfView.near}set near(e){e=Math.max(0,e);let t=_.setting.render.postProcessing.depthOfView;t.near=e}get far(){return _.setting.render.postProcessing.depthOfView.far}set far(e){e=Math.max(0,e);let t=_.setting.render.postProcessing.depthOfView;t.far=e}createBlurCompute(){this.blurSettings=[],this.blurComputes=[];let e=_.setting.render.postProcessing.depthOfView;for(let t=0;t<e.iterationCount;t++){let a=new Ct(4),r=new Fe(vd);this.blurComputes.push(r),this.blurSettings.push(a),r.setUniformBuffer("blurSetting",a);let i=ve.getGBufferFrame(ve.colorPass_GBuffer);r.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture());let n=t%2==0?this.blurTexture1:this.blurTexture2,o=t%2==1?this.blurTexture1:this.blurTexture2;r.setSamplerTexture("inTex",n),r.setStorageTexture("outTex",o),r.workerSizeX=Math.ceil(this.blurTexture1.width/8),r.workerSizeY=Math.ceil(this.blurTexture1.height/8),r.workerSizeZ=1,this.outTexture=o}}createResource(){let e=I.presentationSize,t=e[0],a=e[1];this.blurTexture1=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture1.name="dof1";let r=new Je;r.clearValue=[0,0,0,1],r.loadOp="clear",this.blurTexture2=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture2.name="dof2";let i=new Je;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new ct([this.blurTexture1,this.blurTexture2],[r,i])}render(e,t){if(!this.blurComputes){this.createResource(),this.createBlurCompute();let r=xe.getCameraGroup(e.camera);for(let i=0;i<this.blurComputes.length;i++)this.blurComputes[i].setUniformBuffer("globalUniform",r.uniformGPUBuffer);this.rendererPassState=He.createRendererPassState(this.rtFrame,null)}this.autoSetColorTexture("inTex",this.blurComputes[0]);let a=_.setting.render.postProcessing.depthOfView;a.far=Math.max(a.near,a.far)+1e-4;for(let r=0;r<a.iterationCount;r++){let i=this.blurComputes[r],n=this.blurSettings[r];n.setFloat("near",a.near),n.setFloat("far",a.far),n.setFloat("pixelOffset",(r+1)*a.pixelOffset),n.apply(),i.setStorageBuffer("blurSetting",n)}k.computeCommand(t,this.blurComputes),k.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=_.setting.render.postProcessing.depthOfView;r.far=Math.max(r.near,r.far)+1e-4,this.blurTexture1.resize(t,a),this.blurTexture2.resize(t,a);for(let i=0;i<r.iterationCount;i++){let n=this.blurComputes[i];n.workerSizeX=Math.ceil(this.blurTexture1.width/8),n.workerSizeY=Math.ceil(this.blurTexture1.height/8),n.workerSizeZ=1}}}class vp extends Wt{outTexture;rendererPassState;rtFrame;view;gBufferTexture;testCompute;_state=0;_state1=256;_state2=256;uniformBuffer;currentRenderTexture;constructor(){super()}onAttach(e){this.view=e}onDetach(e){}set state(e){this._state=e,this.uniformBuffer.setInt32("state",e),this.uniformBuffer.apply()}get state(){return this._state}set size1(e){this._state1=e,this.uniformBuffer.setInt32("state1",e),this.uniformBuffer.apply()}get size1(){return this._state1}set size2(e){this._state2=e,this.uniformBuffer.setInt32("state2",e),this.uniformBuffer.apply()}get size2(){return this._state2}createResource(){let e=ve.getGBufferFrame("ColorPassGBuffer");this.currentRenderTexture=e.getColorTexture(),this.gBufferTexture=e.getCompressGBufferTexture();let[t,a]=I.presentationSize;this.outTexture=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let r=new Je;r.loadOp="load",this.rtFrame=new ct([this.outTexture],[r])}createCompute(){this.uniformBuffer=new Ct(4),this.uniformBuffer.setInt32("state",this._state);let e=xe.getCameraGroup(this.view.camera),a=ve.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture(),r=_.setting.reflectionSetting,n=ve.getGBufferFrame(ve.reflections_GBuffer,r.width,r.height).getCompressGBufferTexture(),o=_.renderJobs.get(this.view).reflectionRenderer.outTexture;this.testCompute=new Fe(Od),this.testCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.testCompute.setUniformBuffer("uniformData",this.uniformBuffer),this.testCompute.setSamplerTexture("gBufferTexture",a),this.testCompute.setSamplerTexture("currentRenderTexture",this.currentRenderTexture),this.testCompute.setSamplerTexture("reflectionsGBufferTexture",n),this.testCompute.setSamplerTexture("envMap",o),this.testCompute.setStorageTexture("outputTexture",this.outTexture),this.testCompute.workerSizeX=Math.ceil(this.outTexture.width/16),this.testCompute.workerSizeY=Math.ceil(this.outTexture.height/16),this.testCompute.workerSizeZ=1}render(e,t){}compute(e){this.testCompute||(this.createResource(),this.createCompute(),this.onResize(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="test");let t=k.beginCommandEncoder();k.computeCommand(t,[this.testCompute]),k.endCommandEncoder(t),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize;this.outTexture.resize(e,t),this.testCompute.workerSizeX=Math.ceil(this.outTexture.width/16),this.testCompute.workerSizeY=Math.ceil(this.outTexture.height/16)}}class xp extends Wt{gtaoTexture;rendererPassState;gtaoCompute;gtaoSetting;aoBuffer;directionsBuffer;directionsArray;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.gtao.enable=!0}Render;onDetach(e){_.setting.render.postProcessing.gtao.enable=!1}get maxDistance(){return _.setting.render.postProcessing.gtao.maxDistance}set maxDistance(e){e=Be(e,.1,50);let t=_.setting.render.postProcessing.gtao;t.maxDistance=e}get maxPixel(){return _.setting.render.postProcessing.gtao.maxPixel}set maxPixel(e){e=Be(e,5,100);let t=_.setting.render.postProcessing.gtao;t.maxPixel=e}get darkFactor(){return _.setting.render.postProcessing.gtao.darkFactor}set darkFactor(e){e=Be(e,.01,1);let t=_.setting.render.postProcessing.gtao;t.darkFactor=e}get rayMarchSegment(){return _.setting.render.postProcessing.gtao.rayMarchSegment}set rayMarchSegment(e){e=Be(e,4,10);let t=_.setting.render.postProcessing.gtao;t.rayMarchSegment=e}get multiBounce(){return _.setting.render.postProcessing.gtao.multiBounce}set multiBounce(e){let t=_.setting.render.postProcessing.gtao;t.multiBounce=e}get blendColor(){return _.setting.render.postProcessing.gtao.blendColor}set blendColor(e){let t=_.setting.render.postProcessing.gtao;t.blendColor=e}get usePosFloat32(){return _.setting.render.postProcessing.gtao.usePosFloat32}set usePosFloat32(e){let t=_.setting.render.postProcessing.gtao;t.usePosFloat32=e}createCompute(){this.gtaoCompute=new Fe(xd);let e=new Ct(8);this.gtaoCompute.setUniformBuffer("gtaoData",e),this.directionsArray=new Float32Array(16),this.directionsBuffer=new Pe(16),this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply(),this.gtaoCompute.setStorageBuffer("directions",this.directionsBuffer),this.aoBuffer=new Pe(this.gtaoTexture.width*this.gtaoTexture.height),this.gtaoCompute.setStorageBuffer("aoBuffer",this.aoBuffer);let t=ve.getGBufferFrame(ve.colorPass_GBuffer);this.gtaoCompute.setSamplerTexture("gBufferTexture",t.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",this.gtaoCompute),this.gtaoCompute.setStorageTexture("outTex",this.gtaoTexture),this.gtaoSetting=e}createResource(){let[e,t]=I.presentationSize;this.gtaoTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.gtaoTexture.name="gtaoTex";let a=new Je;a.loadOp="load",this.rtFrame=new ct([this.gtaoTexture],[a])}randomCount=0;randomDirection(){this.randomCount=0;let e=Math.PI*2*this.randomCount/16,t=Math.PI*2/8;for(let a=0;a<8;a++){let r=e+a*t;this.directionsArray[a*2]=Math.sin(r),this.directionsArray[a*2+1]=Math.cos(r)}return this.directionsArray}render(e,t){if(!this.gtaoCompute){this.createResource(),this.createCompute(),this.onResize(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GTAO";let l=xe.getCameraGroup(e.camera);this.gtaoCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=_.setting.render.postProcessing.gtao;this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply();let r=1-.2*(We.frame%2),i=a.maxDistance*r,n=a.maxPixel*r;this.gtaoSetting.setFloat("maxDistance",i),this.gtaoSetting.setFloat("maxPixel",n),this.gtaoSetting.setFloat("darkFactor",a.darkFactor),this.gtaoSetting.setFloat("rayMarchSegment",a.rayMarchSegment);let o=e.camera;this.gtaoSetting.setFloat("cameraNear",o.near),this.gtaoSetting.setFloat("cameraFar",o.far),this.gtaoSetting.setFloat("multiBounce",a.multiBounce?1:0),this.gtaoSetting.setFloat("blendColor",a.blendColor?1:0),this.gtaoSetting.apply(),k.computeCommand(t,[this.gtaoCompute]),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize;this.gtaoTexture.resize(e,t),this.gtaoCompute.workerSizeX=Math.ceil(this.gtaoTexture.width/8),this.gtaoCompute.workerSizeY=Math.ceil(this.gtaoTexture.height/8),this.gtaoCompute.workerSizeZ=1}}class Up extends Wt{fogSetting;fogOpTexture;fogCompute;fogUniform;rendererPassState;constructor(){super(),this.fogSetting=_.setting.render.postProcessing.globalFog}createCompute(e){Y.register("GlobalFog_shader",Oo),this.fogCompute=new Fe(Oo),this.fogUniform=new Ct(20),this.fogCompute.setUniformBuffer("fogUniform",this.fogUniform);let t=ve.getGBufferFrame(ve.colorPass_GBuffer);this.fogCompute.setSamplerTexture("gBufferTexture",t.getCompressGBufferTexture()),this.fogCompute.setSamplerTexture("inTex",t.getColorTexture()),this._lastSkyTexture=this.getSkyTexture(),this.fogCompute.setSamplerTexture("prefilterMap",this._lastSkyTexture),this.fogCompute.setStorageTexture("outTex",this.fogOpTexture),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="FOG";let a=xe.getLightEntries(e.scene);this.fogCompute.setStorageBuffer("lightBuffer",a.storageGPUBuffer)}uploadSetting(){let e=this.fogUniform,t=this.fogSetting;e.setColor("fogColor",t.fogColor),e.setFloat("fogType",t.fogType),e.setFloat("fogHeightScale",t.fogHeightScale),e.setFloat("start",t.start),e.setFloat("end",t.end),e.setFloat("density",t.density),e.setFloat("ins",t.ins),e.setFloat("falloff",t.falloff),e.setFloat("rayLength",t.rayLength),e.setFloat("scatteringExponent",t.scatteringExponent),e.setFloat("dirHeightLine",t.dirHeightLine),e.setFloat("skyFactor",t.skyFactor),e.setFloat("skyRoughness",t.skyRoughness),e.setFloat("overrideSkyFactor",t.overrideSkyFactor),e.setFloat("isSkyHDR",0),e.apply(),this.fogCompute.setUniformBuffer("fogUniform",this.fogUniform)}rtFrame;createResource(){let[e,t]=I.presentationSize;this.fogOpTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.fogOpTexture.name="fogTex";let a=new Je;a.loadOp="load",this.rtFrame=new ct([this.fogOpTexture],[a])}onAttach(e){_.setting.render.postProcessing.globalFog.enable=!0}onDetach(e){_.setting.render.postProcessing.globalFog.enable=!1}set fogType(e){this.fogSetting.fogType=e}get fogType(){return this.fogSetting.fogType}set fogHeightScale(e){this.fogSetting.fogHeightScale=e}get fogHeightScale(){return this.fogSetting.fogHeightScale}set start(e){this.fogSetting.start=e}get start(){return this.fogSetting.start}set end(e){this.fogSetting.end=e}get end(){return this.fogSetting.end}set ins(e){this.fogSetting.ins=e}get ins(){return this.fogSetting.ins}set density(e){this.fogSetting.density=e}get density(){return this.fogSetting.density}set skyRoughness(e){this.fogSetting.skyRoughness=e}get skyRoughness(){return this.fogSetting.skyRoughness}set skyFactor(e){this.fogSetting.skyFactor=e}get skyFactor(){return this.fogSetting.skyFactor}set overrideSkyFactor(e){this.fogSetting.overrideSkyFactor=e}get overrideSkyFactor(){return this.fogSetting.overrideSkyFactor}get fogColor(){return this.fogSetting.fogColor}set fogColor(e){this.fogSetting.fogColor.copyFrom(e)}set falloff(e){this.fogSetting.falloff=e}get falloff(){return this.fogSetting.falloff}set rayLength(e){this.fogSetting.rayLength=e}get rayLength(){return this.fogSetting.rayLength}set scatteringExponent(e){this.fogSetting.scatteringExponent=e}get scatteringExponent(){return this.fogSetting.scatteringExponent}set dirHeightLine(e){this.fogSetting.dirHeightLine=e}get dirHeightLine(){return this.fogSetting.dirHeightLine}_lastSkyTexture;getSkyTexture(){let e=_.res.defaultSky;return q.instance.sky instanceof Ws&&(e=q.instance.sky.map),e}render(e,t){if(!this.fogCompute){this.createResource(),this.createCompute(e),this.onResize();let r=xe.getCameraGroup(e.camera);this.fogCompute.setUniformBuffer("globalUniform",r.uniformGPUBuffer)}let a=this.getSkyTexture();a!=this._lastSkyTexture&&(this._lastSkyTexture=a,this.fogCompute.setSamplerTexture("prefilterMap",this._lastSkyTexture)),this.fogCompute.setUniformFloat("isSkyHDR",a.isHDRTexture?1:0),this.uploadSetting(),k.computeCommand(t,[this.fogCompute]),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize;this.fogOpTexture.resize(e,t),this.fogCompute.workerSizeX=Math.ceil(this.fogOpTexture.width/8),this.fogCompute.workerSizeY=Math.ceil(this.fogOpTexture.height/8),this.fogCompute.workerSizeZ=1}}class yp extends Wt{godRayTexture;rendererPassState;godRayCompute;historyGodRayData;godRaySetting;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.godRay.enable=!0,this.createGUI()}Render;onDetach(e){_.setting.render.postProcessing.godRay.enable=!1,this.removeGUI()}get blendColor(){return _.setting.render.postProcessing.godRay.blendColor}set blendColor(e){_.setting.render.postProcessing.godRay.blendColor=e}get rayMarchCount(){return _.setting.render.postProcessing.godRay.rayMarchCount}set rayMarchCount(e){e=Be(e,8,20),_.setting.render.postProcessing.godRay.rayMarchCount=e}get scatteringExponent(){return _.setting.render.postProcessing.godRay.scatteringExponent}set scatteringExponent(e){e=Be(e,1,40),_.setting.render.postProcessing.godRay.scatteringExponent=e}get intensity(){return _.setting.render.postProcessing.godRay.intensity}set intensity(e){e=Be(e,.01,5),_.setting.render.postProcessing.godRay.intensity=e}createGUI(){}removeGUI(){}createCompute(e){this.godRayCompute=new Fe(Ud);let t=new Ct(12);this.godRayCompute.setUniformBuffer("godRayUniform",t),this.historyGodRayData=new Pe(4*this.godRayTexture.width*this.godRayTexture.height),this.godRayCompute.setStorageBuffer("historyGodRayData",this.historyGodRayData);let a=ve.getGBufferFrame(ve.colorPass_GBuffer);this.godRayCompute.setSamplerTexture("gBufferTexture",a.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",this.godRayCompute),this.godRayCompute.setStorageTexture("outTex",this.godRayTexture);let r=_.getRenderJob(e).shadowMapPassRenderer;this.godRayCompute.setSamplerTexture("shadowMap",r.depth2DArrayTexture),this.godRaySetting=t,this.onResize()}createResource(){let e=I.presentationSize,[t,a]=e;this.godRayTexture=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.godRayTexture.name="godRayTexture";let r=new Je;r.loadOp="load",this.rtFrame=new ct([this.godRayTexture],[r])}onResize(){let e=I.presentationSize,[t,a]=e;this.godRayTexture.resize(t,a),this.historyGodRayData.resizeBuffer(4*this.godRayTexture.width*this.godRayTexture.height),this.godRayCompute.setStorageBuffer("historyGodRayData",this.historyGodRayData),this.godRayCompute.workerSizeX=Math.ceil(this.godRayTexture.width/8),this.godRayCompute.workerSizeY=Math.ceil(this.godRayTexture.height/8),this.godRayCompute.workerSizeZ=1}render(e,t){if(!this.godRayCompute){this.createResource(),this.createCompute(e);let o=xe.getLightEntries(e.scene);this.godRayCompute.setStorageBuffer("lightBuffer",o.storageGPUBuffer),this.godRayCompute.setStorageBuffer("models",xe.modelMatrixBindGroup.matrixBufferDst),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GodRay";let l=xe.getCameraGroup(e.camera);this.godRayCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=_.setting.render.postProcessing.godRay;this.godRaySetting.setFloat("intensity",a.intensity),this.godRaySetting.setFloat("rayMarchCount",a.rayMarchCount);let r=I.presentationSize,[i,n]=r;this.godRaySetting.setFloat("viewPortWidth",i),this.godRaySetting.setFloat("viewPortHeight",n),this.godRaySetting.setFloat("blendColor",a.blendColor?1:0),this.godRaySetting.setFloat("scatteringExponent",a.scatteringExponent),this.godRaySetting.apply(),k.computeCommand(t,[this.godRayCompute]),k.lastRenderPassState=this.rendererPassState}}class zh{indexList;color;count}class Wh{SlotCount=8;MaxEntities=16;defaultColor=new J(.2,1,1,1);slots=[];dataDirty=!0;constructor(){let e=_.setting.render.postProcessing.outline.groupCount;this.SlotCount=Math.max(1,Math.min(e,this.SlotCount));for(let t=0;t<this.SlotCount;t++){let a=this.slots[t]=new zh;a.indexList=new Float32Array(this.MaxEntities),a.color=this.defaultColor.clone(),a.count=0}}clear(){for(let e=0;e<this.SlotCount;e++)this.clearAt(e)}clearAt(e){this.dataDirty=!0;let t=this.slots[e];return t.color.copyFrom(this.defaultColor),t.indexList.fill(-1),t.count=0,this}fillDataAt(e,t,a){this.dataDirty=!0;let r=this.slots[e];if(r){r.indexList.fill(-1);for(let i=0,n=t.length;i<n;i++)r.indexList[i]=t[i];r.count=t.length,r.color.copyFrom(a)}return this}fetchData(e){return e.dirty=this.dataDirty,e.slots=this.slots,this.dataDirty=!1,this}}let Ua=new Wh;class Cp extends Wt{outlineTex;lowTex;rendererPassState;calcWeightCompute;outlineCompute;blendCompute;outlineSetting;slotsBuffer;slotsArray;entitiesArray;entitiesBuffer;weightBuffer;lowTexSize;oldOutlineColor;rtFrame;view;constructor(){super()}onAttach(e){this.view=e,_.setting.render.postProcessing.outline.enable=!0}onDetach(e){_.setting.render.postProcessing.outline.enable=!1}set outlinePixel(e){e=Be(e,0,8);let t=_.setting.render.postProcessing.outline;t.outlinePixel!=e&&(t.outlinePixel=e)}get outlinePixel(){return _.setting.render.postProcessing.outline.outlinePixel}set fadeOutlinePixel(e){let t=_.setting.render.postProcessing.outline;e=Be(e,0,8),t.fadeOutlinePixel!=e&&(t.fadeOutlinePixel=e)}get fadeOutlinePixel(){return _.setting.render.postProcessing.outline.fadeOutlinePixel}set strength(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.outline;t.strength!=e&&(t.strength=e)}get strength(){return _.setting.render.postProcessing.outline.strength}set useAddMode(e){_.setting.render.postProcessing.outline.useAddMode=e}get useAddMode(){return _.setting.render.postProcessing.outline.useAddMode}createGUI(){}createCompute(){let e=ve.getGBufferFrame(ve.colorPass_GBuffer);this.calcWeightCompute=new Fe(Sd);let t=xe.getCameraGroup(this.view.camera);this.calcWeightCompute.setUniformBuffer("globalUniform",t.uniformGPUBuffer),this.calcWeightCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.calcWeightCompute.setStorageBuffer("slotsBuffer",this.slotsBuffer),this.calcWeightCompute.setStorageBuffer("weightBuffer",this.weightBuffer),this.calcWeightCompute.setStorageBuffer("entitiesBuffer",this.entitiesBuffer),this.calcWeightCompute.setSamplerTexture("gBufferTexture",e.getCompressGBufferTexture()),this.calcWeightCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.calcWeightCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.calcWeightCompute.workerSizeZ=1,this.outlineCompute=new Fe(Fd),this.outlineCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.outlineCompute.setStorageBuffer("slotsBuffer",this.slotsBuffer),this.outlineCompute.setStorageBuffer("weightBuffer",this.weightBuffer),this.outlineCompute.setStorageBuffer("oldOutlineColor",this.oldOutlineColor),this.outlineCompute.setStorageTexture("lowTex",this.lowTex),this.outlineCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.outlineCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.outlineCompute.workerSizeZ=1,this.blendCompute=new Fe(Cd),this.blendCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.autoSetColorTexture("inTex",this.blendCompute),this.blendCompute.setSamplerTexture("lowTex",this.lowTex),this.blendCompute.setStorageTexture("outlineTex",this.outlineTex),this.blendCompute.workerSizeX=Math.ceil(this.outlineTex.width/8),this.blendCompute.workerSizeY=Math.ceil(this.outlineTex.height/8),this.blendCompute.workerSizeZ=1}createResource(){let e=I.presentationSize,t=e[0],a=e[1],r=_.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new de(Math.ceil(t*r),Math.ceil(a*r)),this.lowTex=new Te(this.lowTexSize.x,this.lowTexSize.y,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lowTex.name="lowTex";let i=new Je;i.clearValue=[0,0,0,1],i.loadOp="clear",this.outlineTex=new Te(t,a,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outlineTex.name="outlineTex";let n=new Je;n.clearValue=[0,0,0,1],n.loadOp="clear",this.rtFrame=new ct([this.outlineTex],[n]),this.outlineSetting=new Ct(8),this.weightBuffer=new Pe(this.lowTexSize.x*this.lowTexSize.y*4,GPUBufferUsage.COPY_SRC),this.oldOutlineColor=new Pe(this.lowTexSize.x*this.lowTexSize.y*4,GPUBufferUsage.COPY_SRC),this.slotsArray=new Float32Array(Ua.SlotCount*4),this.slotsBuffer=new Pe(this.slotsArray.length),this.slotsBuffer.setFloat32Array("slotsArray",this.slotsArray),this.slotsBuffer.apply(),this.entitiesArray=new Float32Array(Ua.SlotCount*Ua.MaxEntities),this.entitiesBuffer=new Pe(this.entitiesArray.length),this.entitiesBuffer.setFloat32Array("entitiesArray",this.entitiesArray),this.slotsBuffer.apply(),this.fetchData||={}}fetchData;fetchOutlineData(){if(Ua.fetchData(this.fetchData),this.fetchData.dirty){let e=Ua.SlotCount,t=Ua.MaxEntities;for(let a=0;a<e;a++){let r=4*a,i=this.fetchData.slots[a];this.slotsArray[r+0]=i.color.r,this.slotsArray[r+1]=i.color.g,this.slotsArray[r+2]=i.color.b,this.slotsArray[r+3]=i.count,r=t*a,this.entitiesArray.set(i.indexList,r)}this.slotsBuffer.setFloat32Array("slotsArray",this.slotsArray),this.slotsBuffer.apply(),this.entitiesBuffer.setFloat32Array("entitiesArray",this.entitiesArray),this.entitiesBuffer.apply()}}computeList;render(e,t){this.calcWeightCompute||(this.createResource(),this.createCompute(),this.createGUI(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null)),this.computeList||=[this.calcWeightCompute,this.outlineCompute,this.blendCompute];let a=_.setting.render.postProcessing.outline;this.outlineSetting.setFloat("strength",a.strength),this.outlineSetting.setFloat("useAddMode",a.useAddMode?1:0),this.outlineSetting.setFloat("outlinePixel",a.outlinePixel),this.outlineSetting.setFloat("fadeOutlinePixel",a.fadeOutlinePixel),this.outlineSetting.setFloat("lowTexWidth",this.lowTexSize.x),this.outlineSetting.setFloat("lowTexHeight",this.lowTexSize.y),this.outlineSetting.apply(),this.fetchOutlineData(),k.computeCommand(t,this.computeList),k.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=_.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new de(Math.ceil(t*r),Math.ceil(a*r)),this.lowTex.resize(this.lowTexSize.x,this.lowTexSize.y),this.outlineTex.resize(t,a),this.weightBuffer.resizeBuffer(this.lowTexSize.x*this.lowTexSize.y*4),this.oldOutlineColor.resizeBuffer(this.lowTexSize.x*this.lowTexSize.y*4),this.calcWeightCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.calcWeightCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.calcWeightCompute.workerSizeZ=1,this.outlineCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.outlineCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.outlineCompute.workerSizeZ=1,this.blendCompute.workerSizeX=Math.ceil(this.outlineTex.width/8),this.blendCompute.workerSizeY=Math.ceil(this.outlineTex.height/8),this.blendCompute.workerSizeZ=1}}class Sp extends Wt{outTexture;newTexture;oldTexture;combineTexture;rendererPassState;ssgiCompute;delayCompute;combineCompute;rtFrame;textureScaleSmallCompute;textureScaleBigCompute;view;colorTexture;posTexture;normalTexture;gBufferTexture;lastPosTexture;downSampleCofe=1;debugChanal="0";updateBuffer;constructor(){super(),this.updateBuffer=new Pe(32),this.updateBuffer.setFloat("frameCount",10),this.updateBuffer.setFloat("indirectIns",1.5),this.updateBuffer.setFloat("delay",.02),this.updateBuffer.setFloat("colorIns",1),this.updateBuffer.setFloat("d1",.03),this.updateBuffer.apply()}onAttach(e){this.view=e,e.camera.transform.onPositionChange=e.camera.transform.onPositionChange?Cs(e.camera.transform.onPositionChange,(t,a)=>this.onCameraChange(t,a)):(t,a)=>this.onCameraChange(t,a)}onCameraChange(e,t){console.log("a");let a=b.distance(e,t);a=Math.min(.45,a)+.01,this.updateBuffer.setFloat("delay",a)}Render;onDetach(e){}set ins(e){this.updateBuffer.setFloat("indirectIns",e),this.updateBuffer.apply()}get ins(){return this.updateBuffer.getFloat("indirectIns")}set delay(e){this.updateBuffer.setFloat("delay",e),this.updateBuffer.apply()}get delay(){return this.updateBuffer.getFloat("delay")}set colorIns(e){this.updateBuffer.setFloat("colorIns",e),this.updateBuffer.apply()}get colorIns(){return this.updateBuffer.getFloat("colorIns")}set frameCount(e){this.updateBuffer.setFloat("frameCount",e),this.updateBuffer.apply()}get frameCount(){return this.updateBuffer.getFloat("frameCount")}set d1(e){this.updateBuffer.setFloat("d1",e),this.updateBuffer.apply()}get d1(){return this.updateBuffer.getFloat("d1")}createResource(){let e=ve.getGBufferFrame("ColorPassGBuffer");this.gBufferTexture=e.getCompressGBufferTexture();let t=I.presentationSize,a=t[0],r=t[1];this.lastPosTexture=new Te(a,r,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lastPosTexture.name="lastPosTexture",this.outTexture=new Te(a,r,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let i=Math.floor(a*this.downSampleCofe),n=Math.floor(r*this.downSampleCofe);this.newTexture=new Te(i,n,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.newTexture.name="newTexture",this.oldTexture=new Te(i,n,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.oldTexture.name="oldTexture",this.combineTexture=new Te(i,n,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.combineTexture.name="combineTexture";let o=new Je;o.loadOp="load",this.rtFrame=new ct([this.outTexture],[o])}createCompute(){this.ssgiCompute=new Fe(wd),this.delayCompute=new Fe(Vd),this.combineCompute=new Fe(Pd);let e=xe.getCameraGroup(this.view.camera);this.ssgiCompute.setSamplerTexture("gBufferTexture",this.gBufferTexture),this.ssgiCompute.setSamplerTexture("combineTexture",this.combineTexture),this.ssgiCompute.setSamplerTexture("oldTexture",this.oldTexture),this.ssgiCompute.setStorageTexture("newTexture",this.newTexture),this.ssgiCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.ssgiCompute.setStorageBuffer("updateBuffer",this.updateBuffer),this.autoSetColorTexture("inTex",this.ssgiCompute),this.delayCompute.setSamplerTexture("newTexture",this.newTexture),this.delayCompute.setSamplerTexture("oldTexture",this.oldTexture),this.delayCompute.setStorageTexture("combineTexture",this.combineTexture),this.delayCompute.setStorageBuffer("updateBuffer",this.updateBuffer),this.combineCompute.setSamplerTexture("inputBTexture",this.combineTexture),this.combineCompute.setSamplerTexture("gBufferTexture",this.gBufferTexture),this.combineCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.combineCompute.setStorageTexture("outTexture",this.outTexture),this.combineCompute.setStorageBuffer("updateBuffer",this.updateBuffer),this.textureScaleBigCompute=new Nh,this.textureScaleBigCompute.setInputes(null,[this.combineTexture],[this.outTexture])}render(e,t){}frame=0;compute(e){this.ssgiCompute||(this.createResource(),this.createCompute(),this.onResize(),this.rendererPassState=He.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="SSGI"),this.frameCount=this.frame,this.frame++;let t=k.beginCommandEncoder();switch(parseInt(this.debugChanal)){case 0:k.copyTexture(t,this.combineTexture,this.oldTexture),k.computeCommand(t,[this.ssgiCompute,this.delayCompute,this.combineCompute]);break;case 1:k.copyTexture(t,this.posTexture,this.lastPosTexture),k.copyTexture(t,this.lastPosTexture,this.outTexture);break;case 2:k.copyTexture(t,this.normalTexture,this.outTexture);break;case 3:k.copyTexture(t,this.posTexture,this.outTexture);break;case 4:k.copyTexture(t,this.colorTexture,this.outTexture);break;case 5:k.copyTexture(t,this.gBufferTexture,this.outTexture);break}k.lastRenderPassState=this.rendererPassState,this.updateBuffer.setFloat("delay",.01)}onResize(){let e=I.presentationSize,t=e[0],a=e[1];this.outTexture.resize(t,a),this.ssgiCompute.workerSizeX=Math.ceil(this.newTexture.width/16),this.ssgiCompute.workerSizeY=Math.ceil(this.newTexture.height/16),this.ssgiCompute.workerSizeZ=1,this.delayCompute.workerSizeX=Math.ceil(this.combineTexture.width/16),this.delayCompute.workerSizeY=Math.ceil(this.combineTexture.height/16),this.delayCompute.workerSizeZ=1,this.combineCompute.workerSizeX=Math.ceil(this.outTexture.width/16),this.combineCompute.workerSizeY=Math.ceil(this.outTexture.height/16),this.combineCompute.workerSizeZ=1}}class Fp extends Wt{SSR_RayTraceCompute;SSR_IS_Compute;SSR_Blend_Compute;isRetTexture;finalTexture;rendererPassState;ssrUniformBuffer;rayTraceData;ssrColorData;rtFrame;historyPosition;view;onAttach(e){this.view=e,_.setting.render.postProcessing.ssr.enable=!0}onDetach(e){_.setting.render.postProcessing.ssr.enable=!1}reflectionRatio=.5;get fadeEdgeRatio(){return _.setting.render.postProcessing.ssr.fadeEdgeRatio}set fadeEdgeRatio(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.fadeEdgeRatio=e}get rayMarchRatio(){return _.setting.render.postProcessing.ssr.rayMarchRatio}set rayMarchRatio(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.rayMarchRatio=e}get roughnessThreshold(){return _.setting.render.postProcessing.ssr.roughnessThreshold}set roughnessThreshold(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.roughnessThreshold=e}get fadeDistanceMin(){return _.setting.render.postProcessing.ssr.fadeDistanceMin}set fadeDistanceMin(e){e=Be(e,0,1e4);let t=_.setting.render.postProcessing.ssr;t.fadeDistanceMin=e}get fadeDistanceMax(){return _.setting.render.postProcessing.ssr.fadeDistanceMax}set fadeDistanceMax(e){e=Be(e,0,1e4);let t=_.setting.render.postProcessing.ssr;t.fadeDistanceMax=e}get powDotRN(){return _.setting.render.postProcessing.ssr.powDotRN}set powDotRN(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.ssr;t.powDotRN=e}createRayTraceShader(){let e=xe.getCameraGroup(this.view.camera);this.SSR_RayTraceCompute=new Fe(Qd),this.SSR_RayTraceCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.SSR_RayTraceCompute.setUniformBuffer("ssrUniform",this.ssrUniformBuffer),this.SSR_RayTraceCompute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_RayTraceCompute.setStorageBuffer("historyPosition",this.historyPosition);let a=ve.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture();this.SSR_RayTraceCompute.setSamplerTexture("gBufferTexture",a),q.instance.sky instanceof Ws&&this.SSR_RayTraceCompute.setSamplerTexture("prefilterMap",q.instance.sky.map),this.SSR_RayTraceCompute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_RayTraceCompute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_RayTraceCompute.workerSizeZ=1}createISShader(){this.SSR_IS_Compute=new Fe(Rd),this.SSR_IS_Compute.setStorageBuffer("ssrUniform",this.ssrUniformBuffer),this.SSR_IS_Compute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_IS_Compute.setStorageBuffer("ssrColorData",this.ssrColorData),this.SSR_IS_Compute.setStorageBuffer("historyPosition",this.historyPosition),this.SSR_IS_Compute.setSamplerTexture("colorMap",this.getOutTexture()),this.SSR_IS_Compute.setStorageTexture("outTex",this.isRetTexture),this.SSR_IS_Compute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_IS_Compute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_IS_Compute.workerSizeZ=1}createBlendShader(e){let t=xe.getCameraGroup(this.view.camera);this.SSR_Blend_Compute=new Fe(Id),this.SSR_Blend_Compute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_Blend_Compute.setUniformBuffer("globalUniform",t.uniformGPUBuffer);let r=ve.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture();this.SSR_Blend_Compute.setSamplerTexture("gBufferTexture",r),this.SSR_Blend_Compute.setSamplerTexture("colorMap",this.getOutTexture()),this.SSR_Blend_Compute.setSamplerTexture("ssrMap",e),this.SSR_Blend_Compute.setStorageTexture("outTex",this.finalTexture),this.SSR_Blend_Compute.workerSizeX=Math.ceil(this.finalTexture.width/8),this.SSR_Blend_Compute.workerSizeY=Math.ceil(this.finalTexture.height/8),this.SSR_Blend_Compute.workerSizeZ=1}createResource(){let[e,t]=I.presentationSize;this.finalTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.finalTexture.name="ssrOutTex";let a=new Je;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=Math.ceil(e*_.setting.render.postProcessing.ssr.pixelRatio),i=Math.ceil(t*_.setting.render.postProcessing.ssr.pixelRatio);this.isRetTexture=new Te(r,i,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.isRetTexture.name="ssrTextureIn";let n=new Je;n.clearValue=[0,0,0,0],n.loadOp="clear",this.rtFrame=new ct([this.finalTexture,this.isRetTexture],[a,n]),this.rayTraceData=new Pe(r*i*8,GPUBufferUsage.COPY_SRC),this.ssrColorData=new Pe(r*i*4,GPUBufferUsage.COPY_SRC),this.historyPosition=new Pe(r*i*4,GPUBufferUsage.COPY_SRC),this.ssrUniformBuffer=new Ct(32),this.ssrUniformBuffer.setFloat("ssrBufferSizeX",this.isRetTexture.width),this.ssrUniformBuffer.setFloat("ssrBufferSizeY",this.isRetTexture.height),this.ssrUniformBuffer.setFloat("colorMapSizeX",this.finalTexture.width),this.ssrUniformBuffer.setFloat("colorMapSizeY",this.finalTexture.height),this.ssrUniformBuffer.apply()}render(e,t){if(!this.SSR_RayTraceCompute){this.createResource(),this.createISShader(),this.createRayTraceShader(),this.createBlendShader(this.isRetTexture),this.rendererPassState=He.createRendererPassState(this.rtFrame,null);let i=xe.getCameraGroup(e.camera);this.SSR_RayTraceCompute.setUniformBuffer("standUniform",i.uniformGPUBuffer)}let a=_.setting.render.postProcessing.ssr;this.ssrUniformBuffer.setFloat("fadeEdgeRatio",a.fadeEdgeRatio),this.ssrUniformBuffer.setFloat("rayMarchRatio",a.rayMarchRatio),this.ssrUniformBuffer.setFloat("fadeDistanceMin",a.fadeDistanceMin),this.ssrUniformBuffer.setFloat("fadeDistanceMax",a.fadeDistanceMax),this.ssrUniformBuffer.setFloat("mixThreshold",a.mixThreshold),this.ssrUniformBuffer.setFloat("roughnessThreshold",a.roughnessThreshold),this.ssrUniformBuffer.setFloat("reflectionRatio",this.reflectionRatio),this.ssrUniformBuffer.setFloat("powDotRN",a.powDotRN),this.ssrUniformBuffer.setFloat("randomSeedX",Math.random()),this.ssrUniformBuffer.setFloat("randomSeedY",Math.random()),this.ssrUniformBuffer.apply();let r=[this.SSR_RayTraceCompute,this.SSR_IS_Compute,this.SSR_Blend_Compute];k.computeCommand(t,r),k.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize,a=Math.ceil(e*_.setting.render.postProcessing.ssr.pixelRatio),r=Math.ceil(t*_.setting.render.postProcessing.ssr.pixelRatio);this.finalTexture.resize(e,t),this.isRetTexture.resize(a,r),this.rayTraceData.resizeBuffer(a*r*8),this.ssrColorData.resizeBuffer(a*r*4),this.historyPosition.resizeBuffer(a*r*4),this.ssrUniformBuffer.setFloat("ssrBufferSizeX",this.isRetTexture.width),this.ssrUniformBuffer.setFloat("ssrBufferSizeY",this.isRetTexture.height),this.ssrUniformBuffer.setFloat("colorMapSizeX",this.finalTexture.width),this.ssrUniformBuffer.setFloat("colorMapSizeY",this.finalTexture.height),this.SSR_RayTraceCompute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_RayTraceCompute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_RayTraceCompute.workerSizeZ=1,this.SSR_IS_Compute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_IS_Compute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_IS_Compute.workerSizeZ=1,this.SSR_Blend_Compute.workerSizeX=Math.ceil(this.finalTexture.width/8),this.SSR_Blend_Compute.workerSizeY=Math.ceil(this.finalTexture.height/8),this.SSR_Blend_Compute.workerSizeZ=1}}class kp{static createSeeds(){let e=20,t=32,a=[new b(0,0,e)],r=0,i=.02;for(let n=1;n<t;n++){let o=new b;a.push(o),r+=1-(1-.618)*n/t,i+=n*.01,o.x=Math.sin(r)*i,o.y=Math.cos(r)*i,o.z=1-n/t,o.multiplyScalar(e)}return a}}class Ep extends Wt{taaTexture;outTexture;rendererPassState;taaCompute;copyTexCompute;sharpCompute;taaSetting;preColorBuffer;preColorTex;preProjMatrix;preViewMatrix;rtFrame;constructor(){super()}onAttach(e){_.setting.render.postProcessing.taa.enable=!0,e.camera.enableJitterProjection(!0),this.createGUI()}onDetach(e){_.setting.render.postProcessing.taa.enable=!1,e.camera.enableJitterProjection(!1)}get jitterSeedCount(){return _.setting.render.postProcessing.taa.jitterSeedCount}set jitterSeedCount(e){e=Be(e,2,32),e=Math.round(e);let t=_.setting.render.postProcessing.taa;t.jitterSeedCount=e}get blendFactor(){return _.setting.render.postProcessing.taa.blendFactor}set blendFactor(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.taa;t.blendFactor=e}get sharpFactor(){return _.setting.render.postProcessing.taa.sharpFactor}set sharpFactor(e){e=Be(e,.1,.99);let t=_.setting.render.postProcessing.taa;t.sharpFactor=e}get sharpPreBlurFactor(){return _.setting.render.postProcessing.taa.sharpPreBlurFactor}set sharpPreBlurFactor(e){e=Be(e,.1,.99);let t=_.setting.render.postProcessing.taa;t.sharpPreBlurFactor=e}get temporalJitterScale(){return _.setting.render.postProcessing.taa.temporalJitterScale}set temporalJitterScale(e){e=Be(e,0,1);let t=_.setting.render.postProcessing.taa;t.temporalJitterScale=e}createGUI(){}createCompute(e){let t=new Fe(Nd),a=new Ct(44),r=xe.getCameraGroup(e.camera);t.setUniformBuffer("globalUniform",r.uniformGPUBuffer),t.setUniformBuffer("taaData",a),t.setStorageBuffer("preColorBuffer",this.preColorBuffer);let i=ve.getGBufferFrame(ve.colorPass_GBuffer);t.setSamplerTexture("preColorTex",this.preColorTex),t.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",t),t.setStorageTexture("outTex",this.taaTexture),t.workerSizeX=Math.ceil(this.taaTexture.width/8),t.workerSizeY=Math.ceil(this.taaTexture.height/8),t.workerSizeZ=1,this.taaCompute=t,this.taaSetting=a,this.copyTexCompute=new Fe(Td),this.copyTexCompute.setStorageBuffer("preColor",this.preColorBuffer),this.copyTexCompute.setStorageTexture("preColorTex",this.preColorTex),this.copyTexCompute.workerSizeX=Math.ceil(this.taaTexture.width/8),this.copyTexCompute.workerSizeY=Math.ceil(this.taaTexture.height/8),this.copyTexCompute.workerSizeZ=1,this.sharpCompute=new Fe(Md),this.sharpCompute.setUniformBuffer("taaData",a),this.sharpCompute.setSamplerTexture("inTex",this.taaTexture),this.sharpCompute.setStorageTexture("outTex",this.outTexture),this.sharpCompute.workerSizeX=Math.ceil(this.outTexture.width/8),this.sharpCompute.workerSizeY=Math.ceil(this.outTexture.height/8),this.sharpCompute.workerSizeZ=1}createResource(){this.preProjMatrix=new R().identity(),this.preViewMatrix=new R().identity();let[e,t]=I.presentationSize;this.preColorBuffer=new Pe(e*t*4,GPUBufferUsage.COPY_SRC),this.preColorTex=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.preColorTex.name="taaTex";let a=new Je;a.clearValue=[0,0,0,1],a.loadOp="clear",this.taaTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.taaTexture.name="taaTex";let r=new Je;r.clearValue=[0,0,0,1],r.loadOp="clear",this.outTexture=new Te(e,t,oe.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="sharpTaaTex";let i=new Je;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new ct([this.preColorTex,this.taaTexture,this.outTexture],[a,r,i])}render(e,t){this.taaCompute||(this.createResource(),this.createCompute(e),this.rendererPassState=He.createRendererPassState(this.rtFrame,null));let a=_.setting.render.postProcessing.taa;this.taaSetting.setMatrix("preProjMatrix",this.preProjMatrix),this.taaSetting.setMatrix("preViewMatrix",this.preViewMatrix),this.taaSetting.setFloat("jitterFrameIndex",e.camera.jitterFrameIndex),this.taaSetting.setFloat("blendFactor",a.blendFactor),this.taaSetting.setFloat("sharpFactor",a.sharpFactor),this.taaSetting.setFloat("sharpPreBlurFactor",a.sharpPreBlurFactor),this.taaSetting.setFloat("jitterX",e.camera.jitterX),this.taaSetting.setFloat("jitterY",e.camera.jitterY),this.taaSetting.apply(),k.computeCommand(t,[this.copyTexCompute,this.taaCompute,this.sharpCompute]),k.lastRenderPassState=this.rendererPassState,this.preProjMatrix.copyFrom(e.camera.projectionMatrix),this.preViewMatrix.copyFrom(e.camera.viewMatrix)}onResize(){let[e,t]=I.presentationSize;this.preColorBuffer.resizeBuffer(e*t*4),this.taaTexture.resize(e,t),this.outTexture.resize(e,t),this.preColorTex.resize(e,t),this.taaCompute.workerSizeX=Math.ceil(this.taaTexture.width/8),this.taaCompute.workerSizeY=Math.ceil(this.taaTexture.height/8),this.taaCompute.workerSizeZ=1,this.copyTexCompute.workerSizeX=Math.ceil(this.taaTexture.width/8),this.copyTexCompute.workerSizeY=Math.ceil(this.taaTexture.height/8),this.copyTexCompute.workerSizeZ=1,this.sharpCompute.workerSizeX=Math.ceil(this.outTexture.width/8),this.sharpCompute.workerSizeY=Math.ceil(this.outTexture.height/8),this.sharpCompute.workerSizeZ=1}}class Jh{_tempIndexArray=[];setOutline(e,t){this.setOutlineList([e],t?[t]:null)}setOutlineList(e,t){e||=[];let a=Ua.defaultColor,r=Ua.SlotCount;for(let i=0;i<r;i++){this._tempIndexArray.length=0;let n=e[i],o=(t?t[i]:null)||a;if(n)for(const l of n)this.getEntityIdList(l,this._tempIndexArray);Ua.fillDataAt(i,this._tempIndexArray,o)}}clearOutline(){return Ua.clear(),this}_rendererList=[];getEntityIdList(e,t){this._rendererList.length=0;let a=e.getComponents(he,this._rendererList);for(const r of a)t.push(r.object3D.transform._worldMatrix.index)}}let wp=new Jh;class jh{localPosition=new b;worldPosition=new b;uv=new de;faceIndex;isIn=!1;t=0;u=0;v=0;triangle;v0;v1;v2;pickList;color}class Bi{static EPS=1e-4;static FLT_MAX=3402823466e29;static distPtTri(e,t,a,r){let i=new b,n=new b,o=new b;r.subtract(t,i),a.subtract(t,n),e.subtract(t,o);let l=Ft(i,i),c=Ft(i,n),f=Ft(i,o),d=Ft(n,n),h=Ft(n,o),u=1/(l*d-c*c),m=(d*f-c*h)*u,g=(l*h-c*f)*u;if(m>=-Bi.EPS&&g>=-Bi.EPS&&m+g<=1+Bi.EPS){let p=t[1]+i[1]*m+n[1]*g;return Math.abs(p-e[1])}return Bi.FLT_MAX}static _info=new jh;static IntersectTriangle(e,t,a){let r=t.v1,i=t.v2,n=t.v3,o=i.subtract(r,b.HELP_3),l=n.subtract(r,b.HELP_4),c=e.direction.crossProduct(l,b.HELP_5),f=Ft(o,c),d;if(f>0){if(a)return null;d=e.origin.subtract(r,b.HELP_2)}else d=r.subtract(e.origin,b.HELP_2),f=-f;if(f<1e-4)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let h=Ft(d,c);if(h<0||h>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let u=d.crossProduct(o,b.HELP_1),m=Ft(e.direction,u);if(m<0||h+m>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let g=Ft(l,u),p=1/f;g*=p,h*=p,m*=p,this._info.isIn=!0,this._info.t=g,this._info.u=h,this._info.v=m;let D=1-h-m;return this._u0.copyFrom(t.u1),this._u0.scale(D),this._u1.copyFrom(t.u2),this._u1.scale(h),this._u2.copyFrom(t.u3),this._u2.scale(m),this._info.uv.copyFrom(this._u0),this._info.uv.add(this._u1,this._info.uv),this._info.uv.add(this._u2,this._info.uv),this._info.localPosition.copyFrom(e.direction).multiplyScalar(g),this._info.localPosition.add(e.origin,this._info.localPosition),this._info}static _u0=new de;static _u1=new de;static _u2=new de}class An extends Za{static _instance;_maxRetry=3;loadAll(e,t){return new Promise((a,r)=>{let i=e.length,n=[];e.forEach((o,l)=>{let c=new t;this.load(o,t).then(f=>{c.parse(f),n.push(c),i--,i===0&&a(n)})})})}constructor(){if(super(),An._instance)throw new Error("LoadManager is singleton class...")}static getInstance(){return this._instance||(this._instance=new An)}loadUrls(e,t){return new Promise((a,r)=>{let i=e.length,n=[];e.forEach((o,l)=>{this.load(o,t).then(c=>{n.push(c),i--,i===0&&a(n),i<0&&console.error(`loadUrls ${e} error`)})})})}get maxRetry(){return this._maxRetry}set maxRetry(e){this._maxRetry=e}load(e,t){return new Promise((a,r)=>{t.format})}}class Ip extends Er{async loadStream(e,t,a,r){if(t.format!==je.BIN)throw new Error("StreamLoader only supports BIN format parsers");return new Promise(async(i,n)=>{let o=!1,l=null,c=null;const f=()=>{o=!0,l&&(l.cancel().catch(()=>{}),l.releaseLock()),c&&c.abort(),d&&typeof d.cancel=="function"&&d.cancel()};let d=null;try{this.baseUrl=e.substring(0,e.lastIndexOf("/")+1),this.initUrl=e,c=new AbortController;const h=await fetch(e,{headers:a?.headers,signal:c.signal});if(!h.ok)throw new Error(`Request rejected with status ${h.status}`);l=h.body.getReader();const u=+h.headers.get("Content-Length")||0;if(d=new t,d.userData=r,d.baseUrl=this.baseUrl,d.initUrl=e,d.loaderFunctions=a,typeof d.initStream!="function")throw new Error(`Parser ${t.name} does not support streaming. Implement initStream() method.`);let m=!1;await d.initStream(u,()=>{!m&&!o&&d&&d.verification()&&(m=!0,i({parser:d,cancel:f}))});let g=0;for(;!o;){const{done:p,value:D}=await l.read();if(p||o){if(!o&&(typeof d.finalizeStream=="function"&&await d.finalizeStream(),!m&&d))if(d.verification())m=!0,i({parser:d,cancel:f});else throw new Error("Parser verification failed");break}if(o)break;g+=D.length,u>0&&a?.onProgress&&!o&&a.onProgress.call(this,g,u,e,d),!o&&typeof d.processChunk=="function"&&await d.processChunk(D,g,u),!m&&!o&&d&&d.verification()&&(m=!0,i({parser:d,cancel:f}))}!o&&a?.onComplete&&a.onComplete.call(this,e)}catch(h){if(o)return;a?.onError&&a.onError(h),n(h)}finally{if(l&&!o)try{l.releaseLock()}catch{}}})}}function Zo(s){const e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let a=0;a<s.length;a+=3){const r=s[a+0],i=s[a+1],n=s[a+2];r<e[0]&&(e[0]=r),i<e[1]&&(e[1]=i),n<e[2]&&(e[2]=n),r>t[0]&&(t[0]=r),i>t[1]&&(t[1]=i),n>t[2]&&(t[2]=n)}return{min:e,max:t}}var Ai=(s=>(s.PLY="ply",s.SPLAT="splat",s.KSPLAT="ksplat",s.UNKNOWN="unknown",s))(Ai||{});function Zh(s){if(s.byteLength<16)return"unknown";const e=new Uint8Array(s,0,Math.min(512,s.byteLength));return new TextDecoder("utf-8").decode(e).startsWith("ply")?"ply":"unknown"}var ya=(s=>(s[s.Splat=0]="Splat",s[s.PointCloud=1]="PointCloud",s[s.Mesh=2]="Mesh",s))(ya||{});const Xi=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],Yo=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"];function $t(s){switch(s){case"char":case"uchar":case"uint8":case"int8":return 1;case"short":case"ushort":case"int16":case"uint16":return 2;case"int":case"uint":case"int32":case"uint32":case"float":case"float32":return 4;case"double":case"float64":return 8;default:return 4}}function pe(s,e,t){switch(t){case"char":case"int8":return s.getInt8(e);case"uchar":case"uint8":return s.getUint8(e);case"short":case"int16":return s.getInt16(e,!0);case"ushort":case"uint16":return s.getUint16(e,!0);case"int":case"int32":return s.getInt32(e,!0);case"uint":case"uint32":return s.getUint32(e,!0);case"double":case"float64":return s.getFloat64(e,!0);case"float":case"float32":default:return s.getFloat32(e,!0)}}function Xo(s){const e=Math.round(Math.sqrt(s));return Math.max(0,e-1)}function Hi(s){const e=new TextDecoder("utf-8").decode(new Uint8Array(s,0,Math.min(4096,s.byteLength)));if(!e.startsWith("ply"))throw new Error("PLY: Unsupported format. Expecting PLY file.");const t=e.indexOf(`end_header
|
|
11816
11844
|
`);if(t<0)throw new Error("PLY: Invalid PLY header");const a=e.substring(0,t+11),r=a.split(/\r?\n/);let i="",n=0,o=0;const l=[],c=[],f=[];let d=!1,h=!1;for(const g of r)if(g.startsWith("format "))i=g.split(/\s+/)[1];else if(g.startsWith("comment TextureFile ")){const p=g.substring(20).trim();p&&f.push(p)}else if(g.startsWith("element ")){const p=g.split(/\s+/);d=p[1]==="vertex",h=p[1]==="face",d&&(n=parseInt(p[2]),h=!1),h&&(o=parseInt(p[2]),d=!1)}else if(d&&g.startsWith("property ")){const p=g.split(/\s+/),D=p[1],A=p[2];l.push({name:A,type:D})}else if(h&&g.startsWith("property ")){const p=g.split(/\s+/);if(p[1]==="list"){const D=p[2],A=p[3],B=p[4];c.push({name:B,type:`list ${D} ${A}`})}else{const D=p[1],A=p[2];c.push({name:A,type:D})}}if(i!=="binary_little_endian"&&i!=="ascii")throw new Error(`PLY: Unsupported format: ${i}. Only binary_little_endian and ascii are supported.`);let u=0,m=0;for(const g of l)Xi.includes(g.name)&&u++,Yo.includes(g.name)&&m++;return{format:i,vertexCount:n,faceCount:o,properties:l,faceProperties:c.length>0?c:void 0,textureFiles:f,headerByteLength:a.length,mode:o?ya.Mesh:u===Xi.length&&m===3?ya.Splat:ya.PointCloud}}function Ho(s){const e=Hi(s),{format:t}=e;return t==="ascii"?Qp(s,e):Rp(s,e)}function Rp(s,e){const{vertexCount:t,properties:a,headerByteLength:r}=e,i=new DataView(s,r),n=v=>a.find(U=>U.name===v)!=null,o=v=>a.findIndex(U=>U.name===v),l=new Float32Array(t*3),c=n("scale_0")?new Float32Array(t*3):void 0,f=n("rot_0")?new Float32Array(t*4):void 0,d=n("opacity")?new Float32Array(t):void 0,h=[o("f_dc_0"),o("f_dc_1"),o("f_dc_2")],u=[];for(let v=0;v<a.length;v++)a[v].name.startsWith("f_rest_")&&u.push(v);const m=h[0]>=0&&h[1]>=0&&h[2]>=0;let g,p=0;if(m){const v=1+u.length/3;p=Xo(v),g=new Float32Array(t*v*3)}const D=[];let A=0;for(const v of a)D.push(A),A+=$t(v.type);let B=0;for(let v=0;v<t;v++){const U=B,y=o("x"),S=o("y"),F=o("z");if(y<0||S<0||F<0)throw new Error("PLY: Missing x/y/z for vertex");if(l[v*3+0]=pe(i,U+D[y],a[y].type),l[v*3+1]=pe(i,U+D[S],a[S].type),l[v*3+2]=pe(i,U+D[F],a[F].type),c){const C=o("scale_0"),w=o("scale_1"),E=o("scale_2");c[v*3+0]=pe(i,U+D[C],a[C].type),c[v*3+1]=pe(i,U+D[w],a[w].type),c[v*3+2]=pe(i,U+D[E],a[E].type)}if(f){const C=o("rot_0"),w=o("rot_1"),E=o("rot_2"),Q=o("rot_3"),T=pe(i,U+D[C],a[C].type),j=pe(i,U+D[w],a[w].type),ue=pe(i,U+D[E],a[E].type),ee=pe(i,U+D[Q],a[Q].type);f[v*4+0]=j,f[v*4+1]=ue,f[v*4+2]=ee,f[v*4+3]=T}if(d){const C=o("opacity");d[v]=pe(i,U+D[C],a[C].type)}if(m&&g){const C=1+u.length/3,w=v*C*3;g[w+0]=pe(i,U+D[h[0]],a[h[0]].type),g[w+C+0]=pe(i,U+D[h[1]],a[h[1]].type),g[w+2*C+0]=pe(i,U+D[h[2]],a[h[2]].type);let E=1,Q=1,T=1;for(let j=0;j<u.length;j+=3){const ue=u[j+0],ee=u[j+1],N=u[j+2];g[w+E]=pe(i,U+D[ue],a[ue].type),g[w+C+Q]=pe(i,U+D[ee],a[ee].type),g[w+2*C+T]=pe(i,U+D[N],a[N].type),E++,Q++,T++}}B+=A}return{vertexCount:t,position:l,scale:c,rotation:f,opacity:d,sh:m&&g?{order:p,coeffs:g}:void 0}}function Qp(s,e){const{vertexCount:t,properties:a}=e,r=new TextDecoder("utf-8").decode(s),i=r.indexOf("end_header");if(i<0)throw new Error("PLY: Invalid PLY header");let n=i+10;for(;n<r.length&&(r[n]===" "||r[n]===`
|
|
11817
11845
|
`||r[n]==="\r");)n++;const l=r.substring(n).split(/\s+/).filter(N=>N.length>0);let c=0;const f=N=>a.find(M=>M.name===N)!=null,d=N=>a.findIndex(M=>M.name===N),h=N=>{if(c>=l.length)throw new Error("PLY: Unexpected end of file");const M=l[c++];switch(N){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(M);case"float":case"double":case"float32":case"float64":return parseFloat(M);default:return parseFloat(M)}},u=new Float32Array(t*3),m=f("scale_0")?new Float32Array(t*3):void 0,g=f("rot_0")?new Float32Array(t*4):void 0,p=f("opacity")?new Float32Array(t):void 0,D=[d("f_dc_0"),d("f_dc_1"),d("f_dc_2")],A=[];for(let N=0;N<a.length;N++)a[N].name.startsWith("f_rest_")&&A.push(N);const B=D[0]>=0&&D[1]>=0&&D[2]>=0;let v,U=0;if(B){const N=1+A.length/3;U=Xo(N),v=new Float32Array(t*N*3)}const y=d("x"),S=d("y"),F=d("z");if(y<0||S<0||F<0)throw new Error("PLY: Missing x/y/z for vertex");const C=m?d("scale_0"):-1,w=m?d("scale_1"):-1,E=m?d("scale_2"):-1,Q=g?d("rot_0"):-1,T=g?d("rot_1"):-1,j=g?d("rot_2"):-1,ue=g?d("rot_3"):-1,ee=p?d("opacity"):-1;for(let N=0;N<t;N++)for(let M=0;M<a.length;M++){const O=a[M],W=h(O.type);if(M===y?u[N*3+0]=W:M===S?u[N*3+1]=W:M===F&&(u[N*3+2]=W),m&&M===C?m[N*3+0]=W:m&&M===w?m[N*3+1]=W:m&&M===E&&(m[N*3+2]=W),g&&M===Q?g[N*4+3]=W:g&&M===T?g[N*4+0]=W:g&&M===j?g[N*4+1]=W:g&&M===ue&&(g[N*4+2]=W),p&&M===ee&&(p[N]=W),B&&v){const ae=1+A.length/3,z=N*ae*3;M===D[0]?v[z+0]=W:M===D[1]?v[z+ae+0]=W:M===D[2]&&(v[z+2*ae+0]=W);for(let K=0;K<A.length;K+=3){const $=A[K+0],re=A[K+1],ce=A[K+2];M===$?v[z+(K/3+1)]=W:M===re?v[z+ae+(K/3+1)]=W:M===ce&&(v[z+2*ae+(K/3+1)]=W)}}}return{vertexCount:t,position:u,scale:m,rotation:g,opacity:p,sh:B&&v?{order:U,coeffs:v}:void 0}}function Yh(s){const e=Hi(s),{format:t,vertexCount:a,faceCount:r,properties:i,faceProperties:n,textureFiles:o,headerByteLength:l}=e;return t==="ascii"?Mp(s,e):Tp(s,e)}function Tp(s,e){const{vertexCount:t,faceCount:a,properties:r,faceProperties:i,textureFiles:n,headerByteLength:o}=e,l=new DataView(s,o),c=N=>r.find(M=>M.name===N)!=null,f=N=>r.findIndex(M=>M.name===N),d=i?.some(N=>N.name==="texcoord")||!1,h=i?.some(N=>N.name==="texnumber")||!1;i?.find(N=>N.name==="texcoord"),i?.find(N=>N.name==="texnumber");const u=new Float32Array(t*3),m=c("nx")&&c("ny")&&c("nz"),g=m?new Float32Array(t*3):new Float32Array(t*3),p=(c("red")||c("r"))&&(c("green")||c("g"))&&(c("blue")||c("b"))?new Float32Array(t*3):void 0,D=(c("u")||c("s"))&&(c("v")||c("t")),A=D||d?new Float32Array(t*2):void 0,B=new Map,v=h?new Array(a):[],U=[];let y=0;for(const N of r)U.push(y),y+=$t(N.type);let S=0;for(let N=0;N<t;N++){const M=S,O=f("x"),W=f("y"),ae=f("z");if(O<0||W<0||ae<0)throw new Error("PLY: Missing x/y/z for vertex");if(u[N*3+0]=pe(l,M+U[O],r[O].type),u[N*3+1]=pe(l,M+U[W],r[W].type),u[N*3+2]=pe(l,M+U[ae],r[ae].type),m){const z=f("nx"),K=f("ny"),$=f("nz");g[N*3+0]=pe(l,M+U[z],r[z].type),g[N*3+1]=pe(l,M+U[K],r[K].type),g[N*3+2]=pe(l,M+U[$],r[$].type)}if(p){const z=f("red")>=0?f("red"):f("r"),K=f("green")>=0?f("green"):f("g"),$=f("blue")>=0?f("blue"):f("b");if(z>=0&&K>=0&&$>=0){let re=pe(l,M+U[z],r[z].type),ce=pe(l,M+U[K],r[K].type),Ae=pe(l,M+U[$],r[$].type);(r[z].type==="uchar"||r[z].type==="uint8")&&(re/=255,ce/=255,Ae/=255),p[N*3+0]=re,p[N*3+1]=ce,p[N*3+2]=Ae}}if(A){const z=f("u")>=0?f("u"):f("s"),K=f("v")>=0?f("v"):f("t");z>=0&&K>=0&&(A[N*2+0]=pe(l,M+U[z],r[z].type),A[N*2+1]=pe(l,M+U[K],r[K].type))}S+=y}const F=[],C=[],w=[];let E=S;A&&!D&&!d&&new Array(t).fill(!1);for(let N=0;N<a;N++){let M=E,O=[],W,ae=0,z=0;if(!i||i.length===0)throw new Error("PLY: Face element must have properties");for(const $ of i)if($.name==="vertex_indices"){const re=$.type.split(" ");if(re.length!==3||re[0]!=="list")throw new Error(`PLY: Invalid vertex_indices property type: ${$.type}`);const ce=re[1],Ae=re[2];if(z=pe(l,M,ce),M+=$t(ce),z<3)throw new Error(`PLY: Face ${N} has less than 3 vertices`);const Qe=$t(Ae);O=[];for(let Ve=0;Ve<z;Ve++){const H=pe(l,M,Ae);O.push(H),M+=Qe}}else if($.name==="texcoord"){const re=$.type.split(" ");if(re.length!==3||re[0]!=="list")throw new Error(`PLY: Invalid texcoord property type: ${$.type}`);const ce=re[1],Ae=re[2],Qe=pe(l,M,ce);M+=$t(ce);const Ve=$t(Ae);W=new Float32Array(Qe);for(let H=0;H<Qe;H++)W[H]=pe(l,M,Ae),M+=Ve;B.set(N,W)}else if($.name==="texnumber")ae=pe(l,M,$.type),M+=$t($.type),v[N]=ae;else if($.type.startsWith("list ")){const re=$.type.split(" ");if(re.length===3){const ce=re[1],Ae=re[2],Qe=pe(l,M,ce);M+=$t(ce);const Ve=$t(Ae);M+=Qe*Ve}}else M+=$t($.type);E=M;const K=h?v[N]??0:0;if(z===3)F.push(O[0],O[1],O[2]),h&&C.push(K),d&&W&&W.length>=6&&w.push(W[0],1-W[1],W[2],1-W[3],W[4],1-W[5]);else for(let $=1;$<z-1;$++)F.push(O[0],O[$],O[$+1]),h&&C.push(K),d&&W&&W.length>=z*2&&w.push(W[0],1-W[1],W[$*2+0],1-W[$*2+1],W[($+1)*2+0],1-W[($+1)*2+1])}if(!m){for(let N=0;N<t*3;N++)g[N]=0;for(let N=0;N<F.length;N+=3){const M=F[N],O=F[N+1],W=F[N+2],ae=u[M*3+0],z=u[M*3+1],K=u[M*3+2],$=u[O*3+0],re=u[O*3+1],ce=u[O*3+2],Ae=u[W*3+0],Qe=u[W*3+1],Ve=u[W*3+2],H=$-ae,ie=re-z,le=ce-K,ge=Ae-ae,Ie=Qe-z,me=Ve-K,ye=ie*me-le*Ie,Se=le*ge-H*me,Me=H*Ie-ie*ge;g[M*3+0]+=ye,g[M*3+1]+=Se,g[M*3+2]+=Me,g[O*3+0]+=ye,g[O*3+1]+=Se,g[O*3+2]+=Me,g[W*3+0]+=ye,g[W*3+1]+=Se,g[W*3+2]+=Me}for(let N=0;N<t;N++){const M=g[N*3+0],O=g[N*3+1],W=g[N*3+2],ae=Math.sqrt(M*M+O*O+W*W);ae>1e-5?(g[N*3+0]=M/ae,g[N*3+1]=O/ae,g[N*3+2]=W/ae):(g[N*3+0]=0,g[N*3+1]=1,g[N*3+2]=0)}}let Q=u,T=g,j=p,ue,ee;if(d&&w.length>0){const N=F.length/3,M=new Float32Array(N*3*3),O=new Float32Array(N*3*3),W=p?new Float32Array(N*3*3):void 0;ue=new Float32Array(w);for(let z=0;z<N;z++){const K=z*3,$=F[K+0],re=F[K+1],ce=F[K+2];M[z*9+0]=u[$*3+0],M[z*9+1]=u[$*3+1],M[z*9+2]=u[$*3+2],M[z*9+3]=u[re*3+0],M[z*9+4]=u[re*3+1],M[z*9+5]=u[re*3+2],M[z*9+6]=u[ce*3+0],M[z*9+7]=u[ce*3+1],M[z*9+8]=u[ce*3+2],O[z*9+0]=g[$*3+0],O[z*9+1]=g[$*3+1],O[z*9+2]=g[$*3+2],O[z*9+3]=g[re*3+0],O[z*9+4]=g[re*3+1],O[z*9+5]=g[re*3+2],O[z*9+6]=g[ce*3+0],O[z*9+7]=g[ce*3+1],O[z*9+8]=g[ce*3+2],W&&p&&(W[z*9+0]=p[$*3+0],W[z*9+1]=p[$*3+1],W[z*9+2]=p[$*3+2],W[z*9+3]=p[re*3+0],W[z*9+4]=p[re*3+1],W[z*9+5]=p[re*3+2],W[z*9+6]=p[ce*3+0],W[z*9+7]=p[ce*3+1],W[z*9+8]=p[ce*3+2])}Q=M,T=O,j=W;const ae=new Uint32Array(N*3);for(let z=0;z<N*3;z++)ae[z]=z;ee=ae}else ee=new Uint32Array(F),ue=A;return{vertexCount:d&&w.length>0?Q.length/3:t,faceCount:a,position:Q,normal:T,color:j,uv:ue,indices:ee,textureFiles:n.length>0?n:void 0,triangleTexnumbers:C.length>0?C:void 0}}function Mp(s,e){const{vertexCount:t,faceCount:a,properties:r,faceProperties:i,textureFiles:n,headerByteLength:o}=e,l=new TextDecoder("utf-8").decode(s),c=l.indexOf("end_header");if(c<0)throw new Error("PLY: Invalid PLY header");let f=c+10;for(;f<l.length&&(l[f]===" "||l[f]===`
|
|
11818
|
-
`||l[f]==="\r");)f++;const h=l.substring(f).split(/\s+/).filter(H=>H.length>0);let u=0;const m=H=>r.find(ie=>ie.name===H)!=null,g=H=>{if(u>=h.length)throw new Error("PLY: Unexpected end of file");const ie=h[u++];switch(H){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(ie);case"float":case"double":case"float32":case"float64":return parseFloat(ie);default:return parseFloat(ie)}},p=new Float32Array(t*3),D=m("nx")&&m("ny")&&m("nz"),A=D?new Float32Array(t*3):new Float32Array(t*3),B=(m("red")||m("r"))&&(m("green")||m("g"))&&(m("blue")||m("b"))?new Float32Array(t*3):void 0,v=(m("u")||m("s"))&&(m("v")||m("t")),U=i?.some(H=>H.name==="texcoord")||!1,y=v||U?new Float32Array(t*2):void 0,S=new Map,F=i?.some(H=>H.name==="texnumber")||!1,C=F?new Array(a):[],w=[],E=[],Q=[],T=H=>r.findIndex(ie=>ie.name===H),j=T("x"),ue=T("y"),ee=T("z"),N=D?T("nx"):-1,M=D?T("ny"):-1,O=D?T("nz"):-1,W=B?T("red")>=0?T("red"):T("r"):-1,ae=B?T("green")>=0?T("green"):T("g"):-1,z=B?T("blue")>=0?T("blue"):T("b"):-1,K=y&&v?T("u")>=0?T("u"):T("s"):-1,$=y&&v?T("v")>=0?T("v"):T("t"):-1;for(let H=0;H<t;H++)for(let ie=0;ie<r.length;ie++){const le=r[ie],ge=g(le.type);ie===j?p[H*3+0]=ge:ie===ue?p[H*3+1]=ge:ie===ee?p[H*3+2]=ge:ie===N?A[H*3+0]=ge:ie===M?A[H*3+1]=ge:ie===O?A[H*3+2]=ge:ie===W&&B?B[H*3+0]=le.type==="uchar"||le.type==="uint8"?ge/255:ge:ie===ae&&B?B[H*3+1]=le.type==="uchar"||le.type==="uint8"?ge/255:ge:ie===z&&B?B[H*3+2]=le.type==="uchar"||le.type==="uint8"?ge/255:ge:ie===K&&y?y[H*2+0]=ge:ie===$&&y&&(y[H*2+1]=ge)}for(let H=0;H<a;H++){let ie=[],le,ge=0;for(const ye of i||[])if(ye.name==="vertex_indices"){const Se=ye.type.split(" "),Me=Se[1],Ze=Se[2],$e=g(Me);ie=[];for(let
|
|
11846
|
+
`||l[f]==="\r");)f++;const h=l.substring(f).split(/\s+/).filter(H=>H.length>0);let u=0;const m=H=>r.find(ie=>ie.name===H)!=null,g=H=>{if(u>=h.length)throw new Error("PLY: Unexpected end of file");const ie=h[u++];switch(H){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(ie);case"float":case"double":case"float32":case"float64":return parseFloat(ie);default:return parseFloat(ie)}},p=new Float32Array(t*3),D=m("nx")&&m("ny")&&m("nz"),A=D?new Float32Array(t*3):new Float32Array(t*3),B=(m("red")||m("r"))&&(m("green")||m("g"))&&(m("blue")||m("b"))?new Float32Array(t*3):void 0,v=(m("u")||m("s"))&&(m("v")||m("t")),U=i?.some(H=>H.name==="texcoord")||!1,y=v||U?new Float32Array(t*2):void 0,S=new Map,F=i?.some(H=>H.name==="texnumber")||!1,C=F?new Array(a):[],w=[],E=[],Q=[],T=H=>r.findIndex(ie=>ie.name===H),j=T("x"),ue=T("y"),ee=T("z"),N=D?T("nx"):-1,M=D?T("ny"):-1,O=D?T("nz"):-1,W=B?T("red")>=0?T("red"):T("r"):-1,ae=B?T("green")>=0?T("green"):T("g"):-1,z=B?T("blue")>=0?T("blue"):T("b"):-1,K=y&&v?T("u")>=0?T("u"):T("s"):-1,$=y&&v?T("v")>=0?T("v"):T("t"):-1;for(let H=0;H<t;H++)for(let ie=0;ie<r.length;ie++){const le=r[ie],ge=g(le.type);ie===j?p[H*3+0]=ge:ie===ue?p[H*3+1]=ge:ie===ee?p[H*3+2]=ge:ie===N?A[H*3+0]=ge:ie===M?A[H*3+1]=ge:ie===O?A[H*3+2]=ge:ie===W&&B?B[H*3+0]=le.type==="uchar"||le.type==="uint8"?ge/255:ge:ie===ae&&B?B[H*3+1]=le.type==="uchar"||le.type==="uint8"?ge/255:ge:ie===z&&B?B[H*3+2]=le.type==="uchar"||le.type==="uint8"?ge/255:ge:ie===K&&y?y[H*2+0]=ge:ie===$&&y&&(y[H*2+1]=ge)}for(let H=0;H<a;H++){let ie=[],le,ge=0;for(const ye of i||[])if(ye.name==="vertex_indices"){const Se=ye.type.split(" "),Me=Se[1],Ze=Se[2],$e=g(Me);ie=[];for(let ft=0;ft<$e;ft++)ie.push(g(Ze))}else if(ye.name==="texcoord"){const Se=ye.type.split(" "),Me=Se[1],Ze=Se[2],$e=g(Me);le=new Float32Array($e);for(let ft=0;ft<$e;ft++)le[ft]=g(Ze);S.set(H,le)}else ye.name==="texnumber"&&(ge=g(ye.type),C[H]=ge);const Ie=ie.length,me=F?C[H]??0:0;if(Ie===3)w.push(ie[0],ie[1],ie[2]),F&&E.push(me),U&&le&&le.length>=6&&Q.push(le[0],1-le[1],le[2],1-le[3],le[4],1-le[5]);else for(let ye=1;ye<Ie-1;ye++)w.push(ie[0],ie[ye],ie[ye+1]),F&&E.push(me),U&&le&&le.length>=Ie*2&&Q.push(le[0],1-le[1],le[ye*2+0],1-le[ye*2+1],le[(ye+1)*2+0],1-le[(ye+1)*2+1])}if(!D){for(let H=0;H<t*3;H++)A[H]=0;for(let H=0;H<w.length;H+=3){const ie=w[H],le=w[H+1],ge=w[H+2],Ie=p[ie*3+0],me=p[ie*3+1],ye=p[ie*3+2],Se=p[le*3+0],Me=p[le*3+1],Ze=p[le*3+2],$e=p[ge*3+0],ft=p[ge*3+1],ja=p[ge*3+2],ba=Se-Ie,Ra=Me-me,Xt=Ze-ye,Qa=$e-Ie,Ta=ft-me,Pt=ja-ye,ga=Ra*Pt-Xt*Ta,pa=Xt*Qa-ba*Pt,ra=ba*Ta-Ra*Qa;A[ie*3+0]+=ga,A[ie*3+1]+=pa,A[ie*3+2]+=ra,A[le*3+0]+=ga,A[le*3+1]+=pa,A[le*3+2]+=ra,A[ge*3+0]+=ga,A[ge*3+1]+=pa,A[ge*3+2]+=ra}for(let H=0;H<t;H++){const ie=A[H*3+0],le=A[H*3+1],ge=A[H*3+2],Ie=Math.sqrt(ie*ie+le*le+ge*ge);Ie>1e-5?(A[H*3+0]=ie/Ie,A[H*3+1]=le/Ie,A[H*3+2]=ge/Ie):(A[H*3+0]=0,A[H*3+1]=1,A[H*3+2]=0)}}let re=p,ce=A,Ae=B,Qe,Ve;if(U&&Q.length>0){const H=w.length/3,ie=new Float32Array(H*3*3),le=new Float32Array(H*3*3),ge=B?new Float32Array(H*3*3):void 0;Qe=new Float32Array(Q);for(let me=0;me<H;me++){const ye=me*3,Se=w[ye+0],Me=w[ye+1],Ze=w[ye+2];ie[me*9+0]=p[Se*3+0],ie[me*9+1]=p[Se*3+1],ie[me*9+2]=p[Se*3+2],ie[me*9+3]=p[Me*3+0],ie[me*9+4]=p[Me*3+1],ie[me*9+5]=p[Me*3+2],ie[me*9+6]=p[Ze*3+0],ie[me*9+7]=p[Ze*3+1],ie[me*9+8]=p[Ze*3+2],le[me*9+0]=A[Se*3+0],le[me*9+1]=A[Se*3+1],le[me*9+2]=A[Se*3+2],le[me*9+3]=A[Me*3+0],le[me*9+4]=A[Me*3+1],le[me*9+5]=A[Me*3+2],le[me*9+6]=A[Ze*3+0],le[me*9+7]=A[Ze*3+1],le[me*9+8]=A[Ze*3+2],ge&&B&&(ge[me*9+0]=B[Se*3+0],ge[me*9+1]=B[Se*3+1],ge[me*9+2]=B[Se*3+2],ge[me*9+3]=B[Me*3+0],ge[me*9+4]=B[Me*3+1],ge[me*9+5]=B[Me*3+2],ge[me*9+6]=B[Ze*3+0],ge[me*9+7]=B[Ze*3+1],ge[me*9+8]=B[Ze*3+2])}re=ie,ce=le,Ae=ge;const Ie=new Uint32Array(H*3);for(let me=0;me<H*3;me++)Ie[me]=me;Ve=Ie}else Ve=new Uint32Array(w),Qe=y;return{vertexCount:U&&Q.length>0?re.length/3:t,faceCount:a,position:re,normal:ce,color:Ae,uv:Qe,indices:Ve,textureFiles:n.length>0?n:void 0,triangleTexnumbers:E.length>0?E:void 0}}function Xh(s){const e=Hi(s),{format:t}=e;return t==="ascii"?Pp(s,e):Np(s,e)}function Np(s,e){const{vertexCount:t,properties:a,headerByteLength:r}=e,i=new DataView(s,r),n=g=>a.find(p=>p.name===g)!=null,o=g=>a.findIndex(p=>p.name===g),l=new Float32Array(t*3),c=(n("red")||n("r"))&&(n("green")||n("g"))&&(n("blue")||n("b")),f=n("alpha")||n("a"),d=c?new Uint8Array(t*4):void 0,h=[];let u=0;for(const g of a)h.push(u),u+=$t(g.type);let m=0;for(let g=0;g<t;g++){const p=m,D=o("x"),A=o("y"),B=o("z");if(D<0||A<0||B<0)throw new Error("PLY: Missing x/y/z for vertex");if(l[g*3+0]=pe(i,p+h[D],a[D].type),l[g*3+1]=pe(i,p+h[A],a[A].type),l[g*3+2]=pe(i,p+h[B],a[B].type),d){const v=o("red")>=0?o("red"):o("r"),U=o("green")>=0?o("green"):o("g"),y=o("blue")>=0?o("blue"):o("b"),S=f?o("alpha")>=0?o("alpha"):o("a"):-1;if(v>=0&&U>=0&&y>=0){let F=pe(i,p+h[v],a[v].type),C=pe(i,p+h[U],a[U].type),w=pe(i,p+h[y],a[y].type),E=255;(a[v].type==="float"||a[v].type==="float32"||a[v].type==="double"||a[v].type==="float64")&&(F=Math.round(F*255),C=Math.round(C*255),w=Math.round(w*255)),S>=0&&(E=pe(i,p+h[S],a[S].type),(a[S].type==="float"||a[S].type==="float32"||a[S].type==="double"||a[S].type==="float64")&&(E=Math.round(E*255))),d[g*4+0]=Math.max(0,Math.min(255,F)),d[g*4+1]=Math.max(0,Math.min(255,C)),d[g*4+2]=Math.max(0,Math.min(255,w)),d[g*4+3]=Math.max(0,Math.min(255,E))}}m+=u}return{vertexCount:t,position:l,color:d}}function Pp(s,e){const{vertexCount:t,properties:a}=e,r=new TextDecoder("utf-8").decode(s),i=r.indexOf("end_header");if(i<0)throw new Error("PLY: Invalid PLY header");let n=i+10;for(;n<r.length&&(r[n]===" "||r[n]===`
|
|
11819
11847
|
`||r[n]==="\r");)n++;const l=r.substring(n).split(/\s+/).filter(F=>F.length>0);let c=0;const f=F=>a.find(C=>C.name===F)!=null,d=F=>{if(c>=l.length)throw new Error("PLY: Unexpected end of file");const C=l[c++];switch(F){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(C);case"float":case"double":case"float32":case"float64":return parseFloat(C);default:return parseFloat(C)}},h=new Float32Array(t*3),u=(f("red")||f("r"))&&(f("green")||f("g"))&&(f("blue")||f("b")),m=f("alpha")||f("a"),g=u?new Uint8Array(t*4):void 0,p=F=>a.findIndex(C=>C.name===F),D=p("x"),A=p("y"),B=p("z"),v=u?p("red")>=0?p("red"):p("r"):-1,U=u?p("green")>=0?p("green"):p("g"):-1,y=u?p("blue")>=0?p("blue"):p("b"):-1,S=m?p("alpha")>=0?p("alpha"):p("a"):-1;for(let F=0;F<t;F++){for(let C=0;C<a.length;C++){const w=a[C],E=d(w.type);if(C===D)h[F*3+0]=E;else if(C===A)h[F*3+1]=E;else if(C===B)h[F*3+2]=E;else if(C===v&&g){const Q=w.type==="uchar"||w.type==="uint8"?E:Math.round(E*255);g[F*4+0]=Math.max(0,Math.min(255,Q))}else if(C===U&&g){const Q=w.type==="uchar"||w.type==="uint8"?E:Math.round(E*255);g[F*4+1]=Math.max(0,Math.min(255,Q))}else if(C===y&&g){const Q=w.type==="uchar"||w.type==="uint8"?E:Math.round(E*255);g[F*4+2]=Math.max(0,Math.min(255,Q))}else if(C===S&&g){const Q=w.type==="uchar"||w.type==="uint8"?E:Math.round(E*255);g[F*4+3]=Math.max(0,Math.min(255,Q))}}g&&S<0&&(g[F*4+3]=255)}return{vertexCount:t,position:h,color:g}}class Hh{_header=null;_headerBuffer=new Uint8Array(4096);_headerLength=0;_headerParsed=!1;_dataBuffer=null;_dataOffset=0;_processedVertices=0;_vertexStride=0;_propOffsets=[];_properties=[];_onHeaderParsed=null;_onSplatParsed=null;_batchSize=1e3;_cancelled=!1;constructor(e,t,a=1e3){this._onHeaderParsed=e,this._onSplatParsed=t,this._batchSize=a}processChunk(e){this._cancelled||(this._headerParsed?this._processDataChunk(e):this._processHeaderChunk(e))}cancel(){this._cancelled=!0}isCancelled(){return this._cancelled}_processHeaderChunk(e){const t=this._headerLength+e.length;if(t>this._headerBuffer.length){const i=new Uint8Array(Math.max(t,this._headerBuffer.length*2));i.set(this._headerBuffer.subarray(0,this._headerLength)),this._headerBuffer=i}this._headerBuffer.set(e,this._headerLength),this._headerLength+=e.length;const r=new TextDecoder("utf-8").decode(this._headerBuffer.subarray(0,this._headerLength)).indexOf(`end_header
|
|
11820
11848
|
`);if(r>=0){const i=r+11,n=this._headerBuffer.subarray(0,i),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),l=this._parseHeader(o);this._header=l,this._headerParsed=!0,this._initializeDataParsing(l),this._onHeaderParsed&&this._onHeaderParsed(l);const c=this._headerLength-e.length,f=i-c;if(f>0&&f<e.length){const d=e.subarray(f);this._processDataChunk(d)}else f===0&&this._processDataChunk(e)}}_parseHeader(e){const t=new TextDecoder("utf-8").decode(new Uint8Array(e)),a=t.indexOf(`end_header
|
|
11821
11849
|
`);if(a<0)throw new Error("PLY: Invalid PLY header");const r=t.substring(0,a+11),i=r.split(/\r?\n/);let n="",o=0,l=0;const c=[],f=[],d=[];let h=!1,u=!1;for(const D of i)if(D.startsWith("format "))n=D.split(/\s+/)[1];else if(D.startsWith("comment TextureFile ")){const A=D.substring(20).trim();A&&d.push(A)}else if(D.startsWith("element ")){const A=D.split(/\s+/);h=A[1]==="vertex",u=A[1]==="face",h&&(o=parseInt(A[2]),u=!1),u&&(l=parseInt(A[2]),h=!1)}else if(h&&D.startsWith("property ")){const A=D.split(/\s+/),B=A[1],v=A[2];c.push({name:v,type:B})}else if(u&&D.startsWith("property ")){const A=D.split(/\s+/);if(A[1]==="list"){const B=A[2],v=A[3],U=A[4];f.push({name:U,type:`list ${B} ${v}`})}else{const B=A[1],v=A[2];f.push({name:v,type:B})}}if(n!=="binary_little_endian"&&n!=="ascii")throw new Error(`PLY: Unsupported format: ${n}`);let m=0,g=0;for(const D of c)Xi.includes(D.name)&&m++,Yo.includes(D.name)&&g++;let p;return l>0?p=ya.Mesh:m===Xi.length&&g===3?p=ya.Splat:p=ya.PointCloud,{format:n,vertexCount:o,faceCount:l,properties:c,faceProperties:f.length>0?f:void 0,textureFiles:d,headerByteLength:r.length,mode:p}}_initializeDataParsing(e){this._properties=e.properties,this._propOffsets=[],this._vertexStride=0;for(const a of this._properties)this._propOffsets.push(this._vertexStride),this._vertexStride+=$t(a.type);const t=e.vertexCount*this._vertexStride;this._dataBuffer=new Uint8Array(Math.min(t,1024*1024*10)),this._dataOffset=0,this._processedVertices=0}_processDataChunk(e){if(!this._header||!this._dataBuffer)return;const t=this._dataOffset+e.length;if(t>this._dataBuffer.length){const a=Math.max(t,this._dataBuffer.length*2),r=new Uint8Array(a);r.set(this._dataBuffer),this._dataBuffer=r}this._dataBuffer.set(e,this._dataOffset),this._dataOffset+=e.length,this._parseVertices()}_parseVertices(){if(!this._header||!this._dataBuffer)return;const e=new DataView(this._dataBuffer.buffer,this._dataBuffer.byteOffset,this._dataBuffer.byteLength),t=this._header.vertexCount,a=i=>this._properties.find(n=>n.name===i)!=null,r=i=>this._properties.findIndex(n=>n.name===i);for(;this._processedVertices<t&&!this._cancelled;){const i=this._processedVertices,n=i*this._vertexStride;if(n+this._vertexStride>this._dataOffset||this._cancelled)break;const o=r("x"),l=r("y"),c=r("z");if(o<0||l<0||c<0)throw new Error("PLY: Missing required x/y/z properties for vertex");const f={position:[pe(e,n+this._propOffsets[o],this._properties[o].type),pe(e,n+this._propOffsets[l],this._properties[l].type),pe(e,n+this._propOffsets[c],this._properties[c].type)]};if(a("scale_0")&&(f.scale=[pe(e,n+this._propOffsets[r("scale_0")],this._properties[r("scale_0")].type),pe(e,n+this._propOffsets[r("scale_1")],this._properties[r("scale_1")].type),pe(e,n+this._propOffsets[r("scale_2")],this._properties[r("scale_2")].type)]),a("rot_0")){const h=pe(e,n+this._propOffsets[r("rot_0")],this._properties[r("rot_0")].type),u=pe(e,n+this._propOffsets[r("rot_1")],this._properties[r("rot_1")].type),m=pe(e,n+this._propOffsets[r("rot_2")],this._properties[r("rot_2")].type),g=pe(e,n+this._propOffsets[r("rot_3")],this._properties[r("rot_3")].type);f.rotation=[u,m,g,h]}a("opacity")&&(f.opacity=pe(e,n+this._propOffsets[r("opacity")],this._properties[r("opacity")].type));const d=[r("f_dc_0"),r("f_dc_1"),r("f_dc_2")];if(d[0]>=0&&d[1]>=0&&d[2]>=0){const h=[];for(let A=0;A<this._properties.length;A++)this._properties[A].name.startsWith("f_rest_")&&h.push(A);const u=1+h.length/3,m=new Float32Array(u*3);m[0]=pe(e,n+this._propOffsets[d[0]],this._properties[d[0]].type),m[u+0]=pe(e,n+this._propOffsets[d[1]],this._properties[d[1]].type),m[2*u+0]=pe(e,n+this._propOffsets[d[2]],this._properties[d[2]].type);let g=1,p=1,D=1;for(let A=0;A<h.length;A+=3){const B=h[A+0],v=h[A+1],U=h[A+2];m[g]=pe(e,n+this._propOffsets[B],this._properties[B].type),m[u+p]=pe(e,n+this._propOffsets[v],this._properties[v].type),m[2*u+D]=pe(e,n+this._propOffsets[U],this._properties[U].type),g++,p++,D++}f.sh={order:Math.floor(Math.sqrt(u)),coeffs:m}}if(this._onSplatParsed&&this._onSplatParsed(f,i),this._processedVertices++,this._processedVertices%this._batchSize===0){setTimeout(()=>{this._parseVertices()},0);return}}}getProgress(){const e=this._header?.vertexCount||0;return{processed:this._processedVertices,total:e,percentage:e>0?this._processedVertices/e*100:0}}}class Vp extends it{static format=je.BIN;async parseBuffer(e){const t=Zh(e);let a;switch(t){case Ai.PLY:{const r=Ho(e);a={count:r.vertexCount,position:r.position,rotation:r.rotation,scale:r.scale,opacity:r.opacity,sh:r.sh},a.bbox=Zo(r.position);break}case Ai.SPLAT:throw new Error("SPLAT format is not yet supported");case Ai.KSPLAT:throw new Error("KSPLAT format is not yet supported");case Ai.UNKNOWN:default:throw new Error("Unknown or unsupported Gaussian Splatting file format")}return this.data=a,a}verification(){return!!this.data&&this.data.count>0}}class Op extends it{static format=je.BIN;_streamParser=null;_streamingRenderer=null;_rendererObject=null;_chunksPerBatch=1e3;_headerParsed=!1;_onHeaderParsed=null;_cancelled=!1;async initStream(e,t){this._onHeaderParsed=t||null,this._rendererObject=new ne,this._rendererObject.name="StreamingGaussianSplat",this._streamingRenderer=this._rendererObject.addComponent(Zi),this._streamParser=new Hh(a=>{this._streamingRenderer&&this._streamingRenderer.initCount(a.vertexCount),this._rendererObject&&(this.data=this._rendererObject),this._headerParsed=!0,this._onHeaderParsed&&this._onHeaderParsed()},(a,r)=>{this._streamingRenderer&&this._streamingRenderer.setSplatData(r,a)},this._chunksPerBatch)}async processChunk(e,t,a){this._cancelled||!this._streamParser||this._streamParser.processChunk(e)}cancel(){this._cancelled=!0,this._streamParser&&this._streamParser.cancel()}isCancelled(){return this._cancelled}async finalizeStream(){this._rendererObject&&(this.data=this._rendererObject)}getProgress(){return this._streamParser?this._streamParser.getProgress():{processed:0,total:0,percentage:0}}verification(){return this._headerParsed&&!!this.data&&!!this._streamingRenderer}}var Xs=(s=>(s.Point="Point",s.LineString="LineString",s.MultiPolygon="MultiPolygon",s))(Xs||{});class Lp extends it{static format=je.JSON;json;async parseString(e){this.json=e,this.data=JSON.parse(e)}}class Gp{static getPath(e){let t=[];for(let a=0;a<e.features.length;a++){const r=e.features[a];switch(r.geometry.type){case Xs.LineString:break;case Xs.MultiPolygon:let i=[];for(let n=0;n<r.geometry.coordinates.length;n++){const o=r.geometry.coordinates[n];for(const l of o)for(const c of l){let f=new b(c[0],0,c[1]);i.push(f)}}t.push(i);break}}return t}}class zp{name;defines;doubleSided;baseColorFactor;emissiveFactor;metallicFactor;roughnessFactor;alphaCutoff;enableBlend;baseColorTexture;metallicRoughnessTexture;normalTexture;occlusionTexture;emissiveTexture;extensions;baseMapOffsetSize;normalMapOffsetSize;emissiveMapOffsetSize;roughnessMapOffsetSize;metallicMapOffsetSize;aoMapOffsetSize}class Wp{}class Jp{}class Jt{static chunk(e,t){const a=[];let r=0;for(;r<e.length;)a.push(e.slice(r,r+t)),r+=t;return a}static removeComment(e){return e.split(`
|
|
@@ -11824,5 +11852,5 @@ fn frag(){
|
|
|
11824
11852
|
`).filter(Boolean);let i=2,n=!1;for(const o of r){const l=o.split(/\s{2,}|\s*:/).filter(Boolean);if(l.length>=2){const c=l[0].trim().toUpperCase(),f=l[1].trim().toUpperCase();if(c==="VERS"||c==="VERSION"){const d=f.match(/(\d+\.?\d*)/);d&&(i=+d[1])}else(c==="WRAP"||c==="WRAP.")&&(n=f==="YES"||f==="Y")}}return{version:i,wrap:n}}parseWellParams(e){const t=Jt.parseSection(e,"W");if(!t)return{};const r=Jt.removeComment(t).split(`
|
|
11825
11853
|
`).filter(Boolean),i={};for(const n of r){const o=Jt.parseParameterLine(n);o.mnemonic&&(i[o.mnemonic]={unit:o.unit,value:Jt.convertToValue(o.value),description:o.description})}return i}parseCurveParams(e){const t=Jt.parseSection(e,"C");if(!t)return{};const r=Jt.removeComment(t).split(`
|
|
11826
11854
|
`).filter(Boolean),i={};for(const n of r){const o=Jt.parseParameterLine(n);o.mnemonic&&(i[o.mnemonic]={unit:o.unit,value:o.value,description:o.description})}return i}parseHeaders(e){const t=Jt.parseSection(e,"C");if(!t)throw new Error("LASLoader: ~CURVE section not found");const r=Jt.removeComment(t).split(`
|
|
11827
|
-
`).filter(Boolean),i=[];for(const n of r){const o=Jt.parseParameterLine(n);o.mnemonic&&i.push(o.mnemonic)}if(i.length===0)throw new Error("LASLoader: No headers found in ~CURVE section");return i}parseData(e,t,a){const r=e.match(/~A(?:[\x20-\x7E])*(?:\r\n|\r|\n)([\s\S]*?)(?=~|$)/);if(!r||!r[1])throw new Error("LASLoader: ~A data section not found");const i=r[1].trim();if(!i)throw new Error("LASLoader: Data section is empty");const n=i.split(/\s+/).filter(c=>c.trim().length>0).map(c=>Jt.convertToValue(c.trim()));if(n.length===0)throw new Error("LASLoader: No data values found");const o=Math.floor(n.length/t.length);if(o===0)throw new Error("LASLoader: Insufficient data values");const l=[];for(let c=0;c<o;c++){const f=[];for(let d=0;d<t.length;d++){const h=c*t.length+d;h<n.length&&f.push(n[h])}f.length===t.length&&l.push(f)}return l}}var Di=(s=>(s.PointCloud="pointcloud",s.Curve="curve",s.WellTrajectory="trajectory",s))(Di||{}),jp=Object.getOwnPropertyDescriptor,Zp=(s,e,t,a)=>{for(var r=a>1?void 0:a?jp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ki=class extends At{constructor(){super();const s=new qe("FatLine_VS","FatLine_FS");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);const e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,e.cullMode=Lt.none,e.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new J(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new de(1920,1080));const s=new R;this.getDefaultColorShader().setUniform("modelMatrix",s.rawData)}};Ki=Zp([Na(Ki,"FatLineShader")],Ki);class qh extends vt{constructor(){super(),this.shader=new Ki,this.transparent=!0}setInstanceBuffer(e){this.shader.setStorageBuffer("instances",e)}setModelMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set lineWidth(e){this.shader.setUniformFloat("lineWidth",e)}get lineWidth(){return this.shader.getUniformFloat("lineWidth")}set opacity(e){this.shader.setUniformFloat("opacity",e)}get opacity(){return this.shader.getUniformFloat("opacity")}set resolution(e){this.shader.setUniformVector2("resolution",e)}get resolution(){return this.shader.getUniformVector2("resolution")}}class Yp extends it{static format=je.BIN;visualizationMode=Di.PointCloud;async parseBuffer(e){const a=await new Kh().parse(e);await this.createVisualization(a)}async createVisualization(e){if("format"in e&&e.format==="binary")this.data=this.createBinaryPointCloudVisualization(e);else{const t=e;let a;switch(this.visualizationMode){case Di.PointCloud:a=this.createPointCloudVisualization(t);break;case Di.Curve:a=this.createCurveVisualization(t);break;case Di.WellTrajectory:a=this.createWellTrajectoryVisualization(t);break;default:a=this.createPointCloudVisualization(t)}a.lasData=t,a.wellParams=t.wellParams,a.curveParams=t.curveParams,this.data=a}}createBinaryPointCloudVisualization(e){const t=new ne;t.name="LASPointCloud";const a=new ne;a.name="LASPointCloudRoot",t.addChild(a);const r=a.addComponent(qa);return r.initFromData(e.positions,e.colors,e.numPoints),r.setPointShape("circle"),r.setPointSize(4),t.lasFormat="binary",t.lasVersion=e.version,t.numPoints=e.numPoints,t.pointDataFormat=e.pointDataFormat,t.bbox=e.bbox,t}verification(){if(this.data)return!0;throw new Error("LASParser: Parse failed")}createPointCloudVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const n=t.map((D,A)=>A).filter(D=>D!==i).slice(0,2),o=a.filter(D=>!D.some(A=>A===r||A===+r));if(o.length===0)throw new Error("LASParser: No valid data points after filtering");const l=o.length,c=new Float32Array(l*3),f=new Uint8Array(l*4);let d=1/0,h=-1/0,u=1/0,m=-1/0;if(n.length>0){const D=o.map(A=>+A[n[0]]).filter(A=>!isNaN(A));if(d=Math.min(...D),h=Math.max(...D),n.length>1){const A=o.map(B=>+B[n[1]]).filter(B=>!isNaN(B));u=Math.min(...A),m=Math.max(...A)}}for(let D=0;D<o.length;D++){const A=o[D],B=D*3,v=D*4;if(c[B+2]=+A[i],n.length>0){const U=+A[n[0]],y=h!==d?(U-d)/(h-d):0;if(c[B+0]=y*10,n.length>1){const S=+A[n[1]],F=m!==u?(S-u)/(m-u):0;c[B+1]=F*10}else c[B+1]=0}else c[B+0]=0,c[B+1]=0;if(n.length>0){const U=+A[n[0]],y=h!==d?(U-d)/(h-d):0;this.mapValueToColor(y,f,v)}else f[v+0]=255,f[v+1]=255,f[v+2]=255,f[v+3]=255}const g=new ne;g.name="LASPointCloud";const p=g.addComponent(qa);return p.initFromData(c,f,l),p.setPointShape("circle"),p.setPointSize(4),g}createCurveVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const n=t.map((D,A)=>A).find(D=>D!==i);if(n===void 0)throw new Error("LASParser: No curve column found");const o=a.filter(D=>{const A=+D[i],B=+D[n];return!isNaN(A)&&!isNaN(B)&&B!==r&&B!==+r});if(o.length===0)throw new Error("LASParser: No valid data points");const l=o.map(D=>+D[n]),c=Math.min(...l),d=Math.max(...l)-c,h=new Float32Array(o.length*3);for(let D=0;D<o.length;D++){const A=o[D],B=D*3,v=+A[i],U=+A[n];h[B+2]=v;const y=d>0?(U-c)/d:0;h[B+0]=y*10,h[B+1]=0}const u=new wh;u.setPositions(h);const m=new qh;m.baseColor=new J(1,0,0,1),m.lineWidth=2;const g=new ne;g.name=`LASCurve_${t[n]}`;const p=g.addComponent(mi);return p.geometry=u,p.material=m,g}createWellTrajectoryVisualization(e){throw new Error("LASParser: Well trajectory visualization not yet implemented")}normalizeValue(e,t,a){const r=t.map(o=>+o[a]).filter(o=>!isNaN(o)),i=Math.min(...r),n=Math.max(...r);return n!==i?(e-i)/(n-i):0}mapValueToColor(e,t,a){const r=Math.floor(e*255),i=Math.floor((1-e)*255);t[a+0]=r,t[a+1]=0,t[a+2]=i,t[a+3]=255}}class Al extends it{static format=je.BIN;static cloudImageProcessParam="";async parseBuffer(e){switch(Hi(e).mode){case ya.Splat:{const a=Ho(e),r={count:a.vertexCount,position:a.position,rotation:a.rotation,scale:a.scale,opacity:a.opacity,sh:a.sh};r.bbox=Zo(a.position);const i=new ne;i.name="GaussianSplat",i.addComponent(ii).initAsset(r),this.data=i;break}case ya.PointCloud:{const a=Xh(e),r=new ne;r.name="PLYPointCloud";const i=new ne;i.name="PLYPointCloudRoot",r.addChild(i);const n=i.addComponent(qa);if(a.color)n.initFromData(a.position,a.color,a.vertexCount);else{const o=new Uint8Array(a.vertexCount*4);o.fill(255),n.initFromData(a.position,o,a.vertexCount)}n.setPointShape("circle"),n.setPointSize(4),this.data=r;break}case ya.Mesh:{const a=Yh(e),r=new ne;r.name="PLYMesh";const i=new Map;if(a.triangleTexnumbers&&a.triangleTexnumbers.length>0)for(let o=0;o<a.triangleTexnumbers.length;o++){const l=a.triangleTexnumbers[o];i.has(l)||i.set(l,[]),i.get(l).push(o)}else{const o=a.indices.length/3,l=[];for(let c=0;c<o;c++)l.push(c);i.set(0,l)}const n=new Map;if(a.textureFiles&&a.textureFiles.length>0){const o=[];for(let l=0;l<a.textureFiles.length;l++){const c=new ta,f=wt.normalizePath(this.baseUrl+a.textureFiles[l]);o.push(_.res.loadTexture(f+Al.cloudImageProcessParam).then(d=>{c.baseMap=d,n.set(l,c)}))}await Promise.all(o)}n.size===0&&n.set(0,new ta);for(const[o,l]of i){const c=[];for(const m of l){const g=m*3;c.push(a.indices[g+0],a.indices[g+1],a.indices[g+2])}const f=new Le;f.setAttribute(G.position,a.position),f.setAttribute(G.normal,a.normal),a.uv&&f.setAttribute(G.uv,a.uv),a.color&&f.setAttribute(G.color,a.color),f.setIndices(new Uint32Array(c)),f.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let d=n.get(o);d||(d=n.values().next().value||new ta);const h=new ne;h.name=`PLYMesh_Texture_${o}`;const u=h.addComponent(he);u.geometry=f,u.material=d,r.addChild(h)}this.data=r;break}}}verification(){return!!this.data}}class $h{async parse(e){const t=new DataView(e),a=li(t);console.assert(a==="pnts");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const n=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,d=new Mi(e,f,n,o),h=f+n+o,u=d.header.POINTS_LENGTH||0,m=new Ls(e,u,h,l,c);return{version:r,featureTable:d,batchTable:m}}}class eu extends $h{async parse(e){const t=await super.parse(e),{featureTable:a,batchTable:r}=t,i=a.header.POINTS_LENGTH;if(!i||i<=0)throw new Error("PNTSLoader: POINTS_LENGTH must be defined and greater than zero");const o=a.header.extensions?.["3DTILES_draco_point_compression"];let l,c;if(o){const u=await this.parseDraco(a,o,i);l=u.positions,c=u.colors,u.normals}else l=this.parsePositions(a,i),c=this.parseColors(a,i),this.parseNormals(a,i);const f=new ne,d=f.addComponent(qa);d.initFromData(l,c,i),d.setPointShape("circle"),d.setPointSize(4);const h=a.getData("RTC_CENTER",1,"FLOAT","VEC3");return h&&f.transform.localPosition.set(h[0],h[1],h[2]),f.batchTable=r,f.featureTable=a,f}parsePositions(e,t){let a=e.getData("POSITION",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("POSITION_QUANTIZED",t,"UNSIGNED_SHORT","VEC3");if(!r)throw new Error("PNTSLoader: Either POSITION or POSITION_QUANTIZED must be defined");const i=e.getData("QUANTIZED_VOLUME_SCALE",1,"FLOAT","VEC3"),n=e.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3");if(!i||!n)throw new Error("PNTSLoader: QUANTIZED_VOLUME_SCALE and QUANTIZED_VOLUME_OFFSET must be defined for quantized positions");const o=new Float32Array(t*3),l=65535;for(let c=0;c<t;c++){const f=c*3;o[f+0]=r[f+0]/l*i[0]+n[0],o[f+1]=r[f+1]/l*i[1]+n[1],o[f+2]=r[f+2]/l*i[2]+n[2]}return o}parseColors(e,t){let a=e.getData("RGBA",t,"UNSIGNED_BYTE","VEC4");if(a)return a;const r=e.getData("RGB",t,"UNSIGNED_BYTE","VEC3");if(r){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*3,d=c*4;l[d+0]=r[f+0],l[d+1]=r[f+1],l[d+2]=r[f+2],l[d+3]=255}return l}const i=e.getData("RGB565",t,"UNSIGNED_SHORT","SCALAR");if(i){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=this.decodeRGB565(i[c]),d=c*4;l[d+0]=f[0],l[d+1]=f[1],l[d+2]=f[2],l[d+3]=255}return l}const n=e.getData("CONSTANT_RGBA",1,"UNSIGNED_BYTE","VEC4");if(n){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*4;l[f+0]=n[0],l[f+1]=n[1],l[f+2]=n[2],l[f+3]=n[3]}return l}const o=new Uint8Array(t*4);return o.fill(255),o}parseNormals(e,t){let a=e.getData("NORMAL",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("NORMAL_OCT16P",t,"UNSIGNED_BYTE","VEC2");return r?this.decodeOctNormals(r,t):null}decodeRGB565(e){const t=(e>>11&31)<<3,a=(e>>5&63)<<2,r=(e&31)<<3;return[t,a,r]}decodeOctNormals(e,t){const a=new Float32Array(t*3);for(let r=0;r<t;r++){const i=r*2,n=e[i]/255,o=e[i+1]/255,l=n*2-1,c=o*2-1,f=1-Math.abs(l)-Math.abs(c);let d,h;f<0?(d=(l>=0?1:-1)*(1-Math.abs(c)),h=(c>=0?1:-1)*(1-Math.abs(l))):(d=l,h=c);const u=Math.sqrt(d*d+h*h+f*f),m=r*3;a[m+0]=d/u,a[m+1]=h/u,a[m+2]=f/u}return a}async parseDraco(e,t,a){throw new Error("Draco compression not yet implemented")}}class tu extends it{static format=je.BIN;async parseBuffer(e){const a=await new eu().parse(e),r=new ne;r.name="PNTS",r.addChild(a),this.data=r}verification(){if(this.data)return!0;throw new Error("PNTSParser: Parse failed")}}class Ko{boneName;bonePath;parentBoneName;boneID;parentBoneID;instanceID;parentInstanceID;t;q;s;formBytes(e){this.boneName=e.readUTF(),this.bonePath=e.readUTF(),this.parentBoneName=e.readUTF(),this.boneID=e.readInt32(),this.parentBoneID=e.readInt32(),this.instanceID=e.readUTF(),this.parentInstanceID=e.readUTF(),this.t=e.readVector3(),this.q=e.readQuaternion(),this.s=e.readVector3()}}class qo{name;count;boneData;boneMap;formBytes(e){this.boneData=[],this.boneMap=new Map,this.name=e.readUTF(),this.count=e.readInt32();for(let t=0;t<this.count;t++){let a=new Ko;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class au extends it{static format=je.BIN;static parser(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new qo;i.formBytes(e.readBytesArray()),_.res.addObj(i.name,i)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}G.position,G.normal,G.color,G.TANGENT,G.uv,G.TEXCOORD_1,G.TEXCOORD_2,G.TEXCOORD_2,G.TEXCOORD_4,G.TEXCOORD_5,G.TEXCOORD_6,G.TEXCOORD_7,G.joints0,G.weights0;var X=(s=>(s[s.single=0]="single",s[s.boolean=1]="boolean",s[s.int=2]="int",s[s.int16=3]="int16",s[s.int32=4]="int32",s[s.float=5]="float",s[s.long=6]="long",s[s.uint=7]="uint",s[s.uint32=8]="uint32",s[s.uint64=9]="uint64",s[s.double=10]="double",s[s.string=11]="string",s[s.singleArray=12]="singleArray",s[s.stringArray=13]="stringArray",s[s.floatArray=14]="floatArray",s[s.vector2=15]="vector2",s[s.vector3=16]="vector3",s[s.vector4=17]="vector4",s[s.color=18]="color",s[s.color32=19]="color32",s[s.animationCurve=20]="animationCurve",s[s.quaternion=21]="quaternion",s[s.matrix4x4=22]="matrix4x4",s[s.mesh=23]="mesh",s[s.texture=24]="texture",s[s.material=25]="material",s[s.materials=26]="materials",s[s.skeleton=27]="skeleton",s[s.animClip=28]="animClip",s[s.vector2Int=29]="vector2Int",s[s.int32List=30]="int32List",s[s.colorList=31]="colorList",s[s.color32List=32]="color32List",s))(X||{});class Hs{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=El(t);if(r){let i=new vt;return i.shader=new r,i}else throw new Error("not found shader, shader name is "+t)}static applyMaterialTexture(e,t){for(let a=0;a<t.length;a++){const r=t[a];r.property in e?e[r.property]=r.texture:r.property in e.shader?e.shader[r.property]=r.texture:e.setTexture(r.property,r.texture)}}static applyMaterialProperties(e,t){for(let a=0;a<t.length;a++){const r=t[a],i=r.key;switch(r.type){case X.color:case X.color32:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformColor(i,n)}break;case X.single:case X.float:case X.int:case X.int16:case X.int32:case X.uint:case X.uint32:case X.uint64:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case X.singleArray:{let n=r.getValue()[0];i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case X.vector2:case X.vector2Int:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector2(i,n)}break;case X.vector3:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector3(i,n)}break;case X.vector4:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector4(i,n)}break}}}}class Wa{static parser(e){switch(e.readInt32()){case X.single:return{t:X.single,v:e.readFloat32()};case X.boolean:return{t:X.boolean,v:e.readBoolean()};case X.int:return{t:X.int,v:e.readInt32()};case X.int16:return{t:X.int16,v:e.readInt16()};case X.int32:return{t:X.int32,v:e.readInt32()};case X.float:return{t:X.float,v:e.readFloat32()};case X.long:return{t:X.long,v:e.readFloat64()};case X.uint:return{t:X.uint,v:e.readUnit32()};case X.uint32:return{t:X.uint32,v:e.readUnit32()};case X.uint64:return{t:X.uint64,v:e.readUnit32()};case X.double:return{t:X.double,v:e.readFloat64()};case X.string:return{t:X.string,v:e.readUTF()};case X.singleArray:return{t:X.singleArray,v:e.readFloatArray()};case X.stringArray:return{t:X.stringArray,v:e.readStringArray()};case X.floatArray:return{t:X.floatArray,v:e.readFloatArray()};case X.vector2:return{t:X.vector2,v:e.readVector2()};case X.vector3:return{t:X.vector3,v:e.readVector3()};case X.vector4:return{t:X.vector4,v:e.readVector4()};case X.color:return{t:X.color,v:e.readColor()};case X.color32:return{t:X.color32,v:e.readColor()};case X.animationCurve:return{t:X.animationCurve,v:null};case X.quaternion:return{t:X.quaternion,v:e.readQuaternion()};case X.matrix4x4:return{t:X.matrix4x4,v:null};case X.mesh:{let o=e.readUTF(),l=_.res.getGeometry(o);return{t:X.mesh,v:l}}case X.texture:{let o=e.readUTF(),l=_.res.getTexture(o);return{t:X.texture,v:l}}case X.material:{let o=e.readUTF(),l=_.res.getMat(o);return{t:X.material,v:l}}case X.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let d=_.res.getMat(f);l.push(d)}return{t:X.materials,v:l}}case X.skeleton:break;case X.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new fl;f.formBytes(e),o.push(f)}return{t:X.animClip,v:o}}case X.vector2Int:return{t:X.vector2Int,v:e.readVector2int()};case X.int32List:return{t:X.int32List,v:e.readInt32List()};case X.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Wa.parser(e).v;r.push(l)}return{t:X.colorList,v:r};case X.color32List:let i=e.readInt32(),n=[];for(let o=0;o<i;o++){const l=Wa.parser(e).v;n.push(l)}return{t:X.color32List,v:n}}}}class $o{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Wa.parser(e);this.type=t,this._data=a}}class ru{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class iu extends it{static format=je.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),n=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],d=[],h=i.readInt32();for(let g=0;g<h;g++){let p=new $o;p.formBytes(i),f.push(p)}let u=i.readInt32();for(let g=0;g<u;g++){let p=i.readBytesArray(),D=new ru;D.property=p.readUTF(),D.name=p.readUTF(),D.texture=_.res.getTexture(D.name),D.texelSize=p.readVector2(),D.wrapModeU=p.readUnit32(),D.wrapModeV=p.readUnit32(),D.wrapModeW=p.readUnit32(),D.wrapMode=p.readUnit32(),D.anisoLevel=p.readUnit32(),D.dimension=p.readUnit32(),D.filterMode=p.readUnit32(),d.push(D)}let m=Hs.GetMaterial(c);m.name=n;for(let g=0;g<l.length;g++){const p=l[g];m.shader.setDefine(p,!0)}Hs.applyMaterialTexture(m,d),Hs.applyMaterialProperties(m,f),_.res.addMat(o,m)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class el{shapeName;shapeIndex;frameCount;blendPositionList=new Float32Array;blendNormalList=new Float32Array;formBytes(e){let t=e.readBytesArray();this.shapeName=t.readUTF(),this.shapeIndex=t.readInt32(),this.frameCount=t.readInt32();let a=t.readInt32();this.blendPositionList=t.readFloat32Array(a*3);let r=t.readInt32();this.blendNormalList=t.readFloat32Array(r*3)}}class tl{vertexCount;shapeNames;shapeIndexs;blendCount;blendShapePropertyDatas;blendShapeMap;formBytes(e){this.blendShapeMap=new Map,this.blendShapePropertyDatas=[];let t=e.readBytesArray();this.vertexCount=t.readInt32(),this.shapeNames=t.readStringArray(),this.shapeIndexs=t.readIntArray(),this.blendCount=t.readInt32();for(let a=0;a<this.blendCount;a++){let r=new el;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class su{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class nu extends it{static format=je.BIN;async parseBuffer(e){}static parserMeshs(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new su,n=e.readBytesArray();i.meshName=n.readUTF(),i.meshID=n.readUTF(),n.readFloat32()>0,n.readFloat32()>0,n.readFloat32()>0;let o=n.readFloat32()>0,l=n.readFloat32()>0;o&&(i.bones=n.readStringArray(),i.bindPose=n.readMatrix44Array()),l&&(i.blendShapeData=new tl,i.blendShapeData.formBytes(n));let c=n.readBytesArray(),f=n.readBytesArray(),d=c.readInt32(),h=0,u=[];for(let A=0;A<d;A++)u[A]={},u[A].att=Xp[c.readUTF()],u[A].dim=c.readInt32(),h+=u[A].dim,u[A].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let m=n.readInt32Array(),g=[],p=n.readInt32();for(let A=0;A<p;A++){let B=n.readInt32(),v=n.readInt32(),U=n.readInt32(),y=n.readInt32(),S=n.readInt32(),F=n.readInt32();n.readVector3(),n.readVector3();let C={indexStart:v,indexCount:U,vertexStart:y,vertexCount:F,firstStart:S,topology:B,index:A};g.push(C)}m.length>65535?i.indices=new Uint32Array(m):i.indices=new Uint16Array(m);let D=new Le;if(D.vertexDim=h,D.geometryType=kt.compose_bin,D.setIndices(i.indices),D.setAttribute(G.all,i.vertexBuffer),o&&(D.skinNames=i.bones,D.bindPose=i.bindPose),l){D.blendShapeData=i.blendShapeData,D.morphTargetsRelative=!0,D.morphTargetDictionary={};for(let A=0;A<i.blendShapeData.blendCount;A++){D.setAttribute("a_morphPositions_"+A,i.blendShapeData.blendShapePropertyDatas[A].blendPositionList),D.setAttribute("a_morphNormals_"+A,i.blendShapeData.blendShapePropertyDatas[A].blendNormalList);for(let B=0;B<i.blendShapeData.blendCount;B++){let v=i.blendShapeData.shapeNames[B],U=i.blendShapeData.shapeIndexs[B];D.morphTargetDictionary[v]=U}}}for(let A=0;A<u.length;A++){const B=u[A].att;D.setAttribute(B,null)}for(let A=0;A<g.length;A++){const B=g[A];D.addSubGeometry(B)}D.name=i.meshName,_.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let Xp={Position:G.position,Normal:G.normal,Color:G.color,Tangent:G.TANGENT,TexCoord0:G.uv,TexCoord1:G.TEXCOORD_1,TexCoord2:G.TEXCOORD_2,TexCoord3:G.TEXCOORD_2,TexCoord4:G.TEXCOORD_4,TexCoord5:G.TEXCOORD_5,TexCoord6:G.TEXCOORD_6,TexCoord7:G.vIndex,BlendIndices:G.joints0,BlendWeight:G.weights0};class Dn extends DataView{get buffer(){return super.buffer}get byteOffset(){return super.byteOffset}get byteLength(){return super.byteLength}getInt16(e,t){return super.getInt16(e,t)}getInt32(e,t){return super.getInt32(e,t)}getFloat32(e,t){return super.getFloat32(e,t)}getFloat64(e,t){return super.getFloat64(e,t)}getUint8(e){return super.getUint8(e)}getUint32(e,t){return super.getUint32(e,t)}getInt8(e){return super.getInt8(e)}getUint16(e,t){return super.getUint16(e,t)}position=0;littleEndian=!0;constructor(e,t,a){super(e,t,a),this.position=0,this.position+=this.byteOffset}readUTF(){let e=this.readInt32(),t=e%4;t>0&&t<4&&(t=4-t);let a="",r=new Int8Array(this.buffer,this.position,e);return this.position+=e*Int8Array.BYTES_PER_ELEMENT,a+=String.fromCharCode.apply(null,r),this.position+=t*Int8Array.BYTES_PER_ELEMENT,a}readStringArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readUTF());return e}readByte(){let e=this.buffer[this.position];return this.position+=1,e}readBoolean(){let e=this.readInt32();return this.position+=4,e==1}readBytes(e){let t=new DataView(this.buffer,this.position,e);return this.position+=e,t.buffer}readBytesArray(){let e=this.readInt32(),t=new Dn(this.buffer.slice(this.position,this.position+e));return this.position+=e,t}readUnit8(){let e=this.getUint8(this.position);return this.position+=Uint8Array.BYTES_PER_ELEMENT,e}readUnit16(){let e=this.getUint16(this.position);return this.position+=Uint16Array.BYTES_PER_ELEMENT,e}readUnit32(){let e=this.getUint32(this.position);return this.position+=Uint32Array.BYTES_PER_ELEMENT,e}readInt8(){let e=this.getInt8(this.position);return this.position+=Int8Array.BYTES_PER_ELEMENT,e}readInt16(){let e=this.getInt16(this.position,this.littleEndian);return this.position+=Int16Array.BYTES_PER_ELEMENT,e}readInt32(){let e=this.getInt32(this.position,this.littleEndian);return this.position+=Int32Array.BYTES_PER_ELEMENT,e}readFloat32(){let e=this.getFloat32(this.position,this.littleEndian);return this.position+=Float32Array.BYTES_PER_ELEMENT,e}readFloat64(){let e=this.getFloat64(this.position,this.littleEndian);return this.position+=Float64Array.BYTES_PER_ELEMENT,e}readInt32Array(){let e=this.readInt32(),t=new Int32Array(this.buffer,this.position,e);return t=t.slice(0,e),this.position+=t.byteLength,t}readInt32List(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++)t.push(this.readInt32());return t}readFloatArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readFloat32();t.push(r)}return t}readIntArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readInt32();t.push(r)}return t}readVector2int(){let e=new de;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new de;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new b;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e}readVector3Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector3());return e}readVector4(){let e=new be;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readVector4Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector4());return e}readColor(){let e=new J;return e.r=this.readFloat32(),e.g=this.readFloat32(),e.b=this.readFloat32(),e.a=this.readFloat32(),e}readColorArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readColor());return e}readQuaternion(){let e=new se;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readQuaternionArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readQuaternion());return e}readMatrix44(){let e=new R,t=e.rawData;return t[0]=this.readFloat32(),t[1]=this.readFloat32(),t[2]=this.readFloat32(),t[3]=this.readFloat32(),t[4]=this.readFloat32(),t[5]=this.readFloat32(),t[6]=this.readFloat32(),t[7]=this.readFloat32(),t[8]=this.readFloat32(),t[9]=this.readFloat32(),t[10]=this.readFloat32(),t[11]=this.readFloat32(),t[12]=this.readFloat32(),t[13]=this.readFloat32(),t[14]=this.readFloat32(),t[15]=this.readFloat32(),e}readMatrix44Array(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readMatrix44();t.push(r)}return t}readFloat32Array(e){let t=new DataView(this.buffer),a=new Float32Array(e);for(let r=0;r<e;r++)a[r]=t.getFloat32(this.position+r*Float32Array.BYTES_PER_ELEMENT,this.littleEndian);return this.position+=e*Float32Array.BYTES_PER_ELEMENT,a}getFloat32Array(){let e=new Float32Array(this.buffer,this.byteOffset,this.byteLength/Float32Array.BYTES_PER_ELEMENT);return e=e.slice(0,this.byteLength),e}}class ou extends it{static format=je.TEXT;static async parserTexture(e,t,a){let r=e.readInt32(),i=[];for(let o=0;o<r;o++){let l=e.readUTF();lu.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let n=await _.res.loadBitmapTextures(i,_.setting.loader.numConcurrent,a,!0);for(const o of n)_.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var Hp=Object.getOwnPropertyDescriptor,Kp=(s,e,t,a)=>{for(var r=a>1?void 0:a?Hp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ks=class extends At{constructor(){super(),Y.register("PBRLitSSSShader",Zd);let s=new qe("PBRLitSSSShader","PBRLitSSSShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefine("USE_CUSTOMUNIFORM",!0),this.setDefault(),this.computes=[new Vh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformColor("emissiveColor",new J(1,1,1)),this.setUniformVector4("materialF0",new be(.04,.04,.04,1)),this.setUniformColor("specularColor",new J(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new J(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new J(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _SSSMap(s){this.setTexture("sssMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SkinColor(s){this.setUniformColor("skinColor",s)}set _SkinPower(s){this.setUniformFloat("skinPower",s)}set _SkinColorIns(s){this.setUniformFloat("skinColorIns",s)}set curveFactor(s){this.setUniformFloat("curveFactor",s)}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Ks=Kp([Na(Ks,"LitSSSShader")],Ks);var qp=Object.getOwnPropertyDescriptor,$p=(s,e,t,a)=>{for(var r=a>1?void 0:a?qp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let qs=class extends At{constructor(){super();let s=new qe("PBRLItShader","PBRLItShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformColor("emissiveColor",new J(0,0,0)),this.setUniformVector4("materialF0",new be(.04,.04,.04,1)),this.setUniformColor("specularColor",new J(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new J(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=_.res.grayTexture,this._BumpMap=_.res.normalTexture,this._MaskTex=_.res.maskTexture}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};qs=$p([Na(qs,"LitShader")],qs);class _n{comName;data;static parser(e){let t=e.readBytesArray(),a=new _n;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let n=new $o;n.formBytes(t),a.data.push(n)}return a}}class xs{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new xs;a.name=t.readUTF(),a.parentName=t.readUTF(),a.position=t.readVector3(),a.rotation=t.readQuaternion(),a.scale=t.readVector3(),a.comDatas=[],a.child=[];let r=t.readInt32();for(let n=0;n<r;n++){const o=_n.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let n=0;n<i;n++){const o=xs.parser(t);a.child.push(o)}return a}}class lu extends it{static useWebp=!0;static format=je.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new Dn(e,0);await ou.parserTexture(t,this,this.loaderFunctions),au.parser(t,this),nu.parserMeshs(t,this),iu.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return xs.parser(e)}parserNodeTree(e){let t=new ne;if(t.localPosition=b.serialize(e.position),t.localQuaternion=se.serialize(e.rotation),t.localScale=b.serialize(e.scale),t.name=e.name,e.comDatas)for(let a=0;a<e.comDatas.length;a++){const r=e.comDatas[a];let i=null,n=kl(r.comName);if(n){i=t.getOrAddComponent(n);for(let o=0;o<r.data.length;o++){const l=r.data[o];l.key in i&&(i[l.key]=l.getValue())}}}if(e.child&&e.child.length>0)for(let a=0;a<e.child.length;a++){let r=this.parserNodeTree(e.child[a]);t.addChild(r)}return t}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class em{static getNumber(e){return parseFloat(e)}static getInt(e){return parseInt(e)}static getBoolean(e){return e=="true"}static getNumberArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(",");for(let r=0;r<a.length;r++)parseFloat(a[r]);return t}static getStringArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(","),r=[];for(let i=0;i<a.length;i++){const n=a[i];r.push(n)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var tm=Object.getOwnPropertyDescriptor,am=(s,e,t,a)=>{for(var r=a>1?void 0:a?tm(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let qi=class extends At{constructor(){super();let s=new qe("UnLit","UnLit");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};qi=am([Na(qi,"UnLitShader")],qi);var rm=Object.getOwnPropertyDescriptor,im=(s,e,t,a)=>{for(var r=a>1?void 0:a?rm(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let $i=class extends At{constructor(){super(),Y.register("VertexAttributeIndexShader",Wd),Y.register("UnLitTextureArray",Yd);let s=new qe("UnLitTextureArray","UnLitTextureArray");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};$i=im([Na($i,"UnLitTexArrayShader")],$i);const _r=-1,Br=0,al=1,cu=2,La=3,sm=6378137,nm=1/298.257223563,om=6356752314245179e-9,lm=Symbol("PLUGIN_REGISTERED");class rl{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=Br;used=!1;visible=!1;active=!1;inFrustum=!1;error=1/0;distanceFromCamera=1/0;depth=0;depthFromRenderedParent=0;lastFrameVisited=-1;isLeaf=!1;allChildrenReady=!1;hasContent=!1;hasRenderableContent=!1;hasUnrenderableContent=!1;childrenProcessed=0;usedLastFrame=!1;priority;canTraverse=!1;canTraverseFrame=-1;basePath="";cached={};constructor(e,t=null){if(this.boundingVolume=e.boundingVolume,this.geometricError=e.geometricError,this.refine=e.refine,this.content=e.content,this.contents=e.contents,this.transform=e.transform,this.extensions=e.extensions,this.extras=e.extras,this.parent=t,this.depth=t?t.depth+1:0,this.depthFromRenderedParent=t?.hasContent?0:t?t.depthFromRenderedParent+1:0,this.hasContent=!!(this.content||this.contents&&this.contents.length>0),this.content?.uri){const a=this.content.uri.toLowerCase();this.hasUnrenderableContent=a.endsWith("tileset.json"),this.hasRenderableContent=!this.hasUnrenderableContent}else this.contents&&this.contents.length>0&&(this.hasRenderableContent=!0)}addChild(e){e.parent=this,e.depth=this.depth+1,e.depthFromRenderedParent=this.hasContent?0:this.depthFromRenderedParent+1,this.children.push(e)}resetFrameState(e){this.lastFrameVisited!==e&&(this.lastFrameVisited=e,this.used=!1,this.inFrustum=!1,this.isLeaf=!1,this.visible=!1,this.active=!1,this.error=1/0,this.distanceFromCamera=1/0,this.allChildrenReady=!1)}}const fu=2**30;class du{minSize=6e3;maxSize=8e3;minBytesSize=.3*fu;maxBytesSize=.4*fu;unloadPercent=.05;autoMarkUnused=!0;_itemSet=new Map;_itemList=[];_usedSet=new Set;_callbacks=new Map;_unloadingHandle=-1;_cachedBytes=0;_bytesMap=new Map;_loadedSet=new Set;_unloadPriorityCallback=null;set unloadPriorityCallback(e){this._unloadPriorityCallback=e}get unloadPriorityCallback(){return this._unloadPriorityCallback}isFull(){return this._itemSet.size>=this.maxSize||this._cachedBytes>=this.maxBytesSize}getMemoryUsage(e){return this._bytesMap.get(e)||0}setMemoryUsage(e,t){if(!this._itemSet.has(e))return;const a=this._bytesMap.get(e)||0;this._cachedBytes-=a,this._bytesMap.set(e,t),this._cachedBytes+=t}add(e,t){return this._itemSet.has(e)||this.isFull()?!1:(this._itemList.push(e),this._usedSet.add(e),this._itemSet.set(e,Date.now()),this._callbacks.set(e,t),this._loadedSet.add(e),!0)}has(e){return this._itemSet.has(e)}remove(e){if(!this._itemSet.has(e))return!1;const t=this._bytesMap.get(e)||0;this._cachedBytes-=t,this._bytesMap.delete(e);const a=this._callbacks.get(e);a&&a(e);const r=this._itemList.indexOf(e);return r!==-1&&this._itemList.splice(r,1),this._usedSet.delete(e),this._itemSet.delete(e),this._callbacks.delete(e),this._loadedSet.delete(e),!0}markUsed(e){this._itemSet.has(e)&&(this._usedSet.add(e),this._itemSet.set(e,Date.now()))}markUnused(e){this._usedSet.delete(e)}scheduleUnload(){this._unloadingHandle===-1&&(this._unloadingHandle=requestAnimationFrame(()=>{this._unloadingHandle=-1,this._performUnload()}))}_performUnload(){if(!(this._itemSet.size>this.minSize||this._cachedBytes>this.minBytesSize))return;this.autoMarkUnused&&this._itemSet.forEach((o,l)=>{this._usedSet.has(l)||this.markUnused(l)});const t=[];this._itemList.forEach(o=>{this._usedSet.has(o)||t.push(o)}),this._unloadPriorityCallback&&t.sort(this._unloadPriorityCallback);const a=Math.floor(this._itemSet.size*(1-this.unloadPercent)),r=this._cachedBytes-(this._cachedBytes-this.minBytesSize);let i=0,n=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-n<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,n+=c)}}clear(){Array.from(this._itemSet.keys()).forEach(t=>this.remove(t))}getStats(){return{size:this._itemSet.size,bytes:this._cachedBytes,usedCount:this._usedSet.size}}}class il{maxJobs=6;priorityCallback=null;_items=[];_callbacks=new Map;_currJobs=0;get running(){return this._items.length!==0||this._currJobs!==0}sort(){this.priorityCallback&&this._items.sort(this.priorityCallback)}has(e){return this._callbacks.has(e)}add(e,t){if(this._callbacks.has(e))return this._callbacks.get(e).promise;let a,r;const i=new Promise((o,l)=>{a=o,r=l}),n={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,n),i}remove(e){const t=this._items.indexOf(e);if(t!==-1){const a=this._callbacks.get(e);a&&(a.promise.catch(()=>{}),a.reject(new Error("PriorityQueue: Item removed."))),this._items.splice(t,1),this._callbacks.delete(e)}}removeByFilter(e){const t=[];this._items.forEach(a=>{e(a)&&t.push(a)}),t.forEach(a=>this.remove(a))}update(){this._tryRunJobs()}_tryRunJobs(){this.sort();const e=this.maxJobs;let t=0;const a=()=>{this._currJobs--};for(;e>this._currJobs&&this._items.length>0&&t<e;){this._currJobs++,t++;const r=this._items.shift(),i=this._callbacks.get(r);this._callbacks.delete(r),Promise.resolve(i.callback(r)).then(()=>{i.resolve(),a()}).catch(n=>{i.reject(n),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function hu(s,e=null,t=null){const a=[];for(a.push(s),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),n=a.pop();if(e&&e(n,i,r)===!0){t&&t(n,i,r);return}const o=n.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(n),a.push(r+1);if(t&&t(n,i,r)===!0)return}}function cm(s,e){let t=s;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const $s={inView:!1,error:1/0,distanceFromCamera:1/0},uu=!0;function bu(s){return s===La||s===_r}function vr(s,e){return s.lastFrameVisited===e&&s.used}function gu(s){return s.childrenProcessed===s.children.length}function sl(s){return s.hasUnrenderableContent||s.parent!==null&&s.parent.geometricError<s.geometricError}function nl(s,e){s.lastFrameVisited!==e.frameCount&&(s.usedLastFrame=s.used,s.lastFrameVisited=e.frameCount,s.used=!1,s.inFrustum=!1,s.isLeaf=!1,s.visible=!1,s.active=!1,s.error=1/0,s.distanceFromCamera=1/0,s.allChildrenReady=!1,e.calculateTileViewError(s,$s),s.inFrustum=$s.inView,s.error=$s.error,s.distanceFromCamera=$s.distanceFromCamera)}function ol(s,e,t=!1){s.used||(t||(s.used=!0,e.stats.used++),e.markTileUsed(s),s.inFrustum===!0&&e.stats.inFrustum++)}function fm(s,e){if(s.canTraverse&&s.canTraverseFrame===e.frameCount)return s.canTraverse;let t=!1;return s.error<=e.errorTarget&&!sl(s)||s.depth>=e.maxDepth||!s.children||s.children.length===0?t=!1:t=!0,s.canTraverse=t,s.canTraverseFrame=e.frameCount,t}function ll(s,e,t=!1){if(e.ensureChildrenArePreprocessed(s),nl(s,e),ol(s,e,t),sl(s)&&gu(s)){const a=s.children;for(let r=0,i=a.length;r<i;r++)ll(a[r],e,t)}}function en(s,e){if(e.ensureChildrenArePreprocessed(s),nl(s,e),!s.inFrustum)return;if(!fm(s,e)){ol(s,e);const n=s.children;if(!s.hasContent&&n&&n.length>0)for(let o=0,l=n.length;o<l;o++){const c=n[o];en(c,e)}return}const a=s.children;let r=!1,i=!1;for(let n=0,o=a.length;n<o;n++){const l=a[n];en(l,e),r=r||vr(l,e.frameCount),i=i||l.inFrustum}if(s.refine==="REPLACE"&&!i&&a.length!==0){s.inFrustum=!1;for(let n=0,o=a.length;n<o;n++)ll(a[n],e,!0);return}if(ol(s,e),s.refine==="REPLACE"&&(r&&s.depth!==0||uu))for(let n=0,o=a.length;n<o;n++)ll(a[n],e)}function cl(s,e){const t=e.frameCount;if(!vr(s,t))return;const a=s.children;let r=!1;for(let i=0,n=a.length;i<n;i++){const o=a[i];r=r||vr(o,t)}if(!r)s.isLeaf=!0;else{let i=!0;for(let n=0,o=a.length;n<o;n++){const l=a[n];if(cl(l,e),vr(l,t)){const c=!sl(l);let f=!l.hasContent||l.hasRenderableContent&&bu(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===_r;f=c&&f||l.allChildrenReady,i=i&&f}}s.allChildrenReady=i}}function pu(s,e){if(e.ensureChildrenArePreprocessed(s),vr(s,e.frameCount)&&(s.hasContent&&e.queueTileForDownload(s),gu(s))){const t=s.children;for(let a=0,r=t.length;a<r;a++)pu(t[a],e)}}function tn(s,e){const t=e.stats;if(!vr(s,e.frameCount))return;if(s.isLeaf){s.loadingState===La?(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++):s.hasContent&&e.queueTileForDownload(s);return}const a=s.children,r=s.hasContent,i=bu(s.loadingState)&&r,n=(e.errorTarget+1)*(e.errorThreshold||1),o=s.error<=n,l=s.refine==="ADD",c=s.allChildrenReady||s.depth===0&&!uu;if(r&&(o||l)&&e.queueTileForDownload(s),(o&&i&&!c||i&&l)&&(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++),!l&&o&&!c)for(let f=0,d=a.length;f<d;f++){const h=a[f];vr(h,e.frameCount)&&pu(h,e)}else for(let f=0,d=a.length;f<d;f++)tn(a[f],e)}function an(s,e){const t=vr(s,e.frameCount);if(t||s.usedLastFrame){let a=!1,r=!1;if(t?(a=s.active,r=s.visible):nl(s,e),s.hasRenderableContent&&s.loadingState===La){const n=s.__wasSetVisible;s.__wasSetActive!==a&&(e.setTileDelayedActive(s,a),s.__wasSetActive=a),n!==r&&(e.setTileDelayedVisible(s,r),s.__wasSetVisible=r)}s.usedLastFrame=t;const i=s.children;for(let n=0,o=i.length;n<o;n++)an(i[n],e)}}class Xr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Xr.s_tmpMatrix||(Xr.s_tmpMatrix=new R),this._data=e,e.box)this._type="box",this._parseBox(e.box);else if(e.sphere)this._type="sphere",this._parseSphere(e.sphere);else if(e.region)this._type="region",this._parseRegion(e.region);else throw new Error("BoundingVolume: Invalid bounding volume data")}_parseBox(e){if(e.length!==12)throw new Error("BoundingVolume: Box must have 12 elements");const t=new b(e[0],e[1],e[2]),a=new b(e[3],e[4],e[5]),r=new b(e[6],e[7],e[8]),i=new b(e[9],e[10],e[11]),n=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),d=i.clone().normalize();this._matrix=new R;const h=this._matrix.rawData;h[0]=c.x,h[1]=c.y,h[2]=c.z,h[3]=0,h[4]=f.x,h[5]=f.y,h[6]=f.z,h[7]=0,h[8]=d.x,h[9]=d.y,h[10]=d.z,h[11]=0,h[12]=t.x,h[13]=t.y,h[14]=t.z,h[15]=1;const u=new b(n*2,o*2,l*2);this._box=new Ce(new b(0,0,0),u)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new b(e[0],e[1],e[2]),a=e[3];this._sphere=new Lr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,n,o]=e,l=new b((t+r)/2,(a+i)/2,(n+o)/2),c=new b(Math.abs(r-t),Math.abs(i-a),Math.abs(o-n));this._box=new Ce(l,c),this._matrix=new R,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new b(a.x-r,a.y-r,a.z-r),n=new b(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,n),t){const o=[new b(i.x,i.y,i.z),new b(n.x,i.y,i.z),new b(i.x,n.y,i.z),new b(n.x,n.y,i.z),new b(i.x,i.y,n.z),new b(n.x,i.y,n.z),new b(i.x,n.y,n.z),new b(n.x,n.y,n.z)];o.forEach(l=>{const c=new b;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Xr.s_tmpMatrix;if(a.identity(),this._matrix?t?a.multiplyMatrices(t,this._matrix):a.copyFrom(this._matrix):t&&a.copyFrom(t),a){const r=this._box,i=[new b(r.min.x,r.min.y,r.min.z),new b(r.max.x,r.min.y,r.min.z),new b(r.min.x,r.max.y,r.min.z),new b(r.max.x,r.max.y,r.min.z),new b(r.min.x,r.min.y,r.max.z),new b(r.max.x,r.min.y,r.max.z),new b(r.min.x,r.max.y,r.max.z),new b(r.max.x,r.max.y,r.max.z)];i.forEach(n=>{const o=new b;a.transformPoint(n,o),n.copyFrom(o)}),e.makeEmpty(),i.forEach(n=>{e.expandByPoint(n)})}else e.setFromMinMax(this._box.min,this._box.max);return e}throw new Error("BoundingVolume: Invalid state")}getOBB(e,t){this._type==="box"&&this._box&&this._matrix?(e.setFromMinMax(this._box.min,this._box.max),t.copyFrom(this._matrix)):(this.getAABB(e),t.identity())}getSphere(e){if(this._type==="sphere"&&this._sphere)return e.center.copyFrom(this._sphere.center),e.radius=this._sphere.radius,e;const t=new Ce;this.getAABB(t);const a=t.center,i=t.size.length*.5;return e.center.copyFrom(a),e.radius=i,e}get type(){return this._type}distanceToPoint(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center;let r=a;if(t){const o=new b;t.transformPoint(a,o),r=o}const i=this._sphere.radius,n=e.clone().subtract(r).length;return Math.max(0,n-i)}else if(this._box){const a=new Ce;this.getAABB(a,t);const r=a.center,i=a.size,n=Math.max(0,Math.abs(e.x-r.x)-i.x*.5),o=Math.max(0,Math.abs(e.y-r.y)-i.y*.5),l=Math.max(0,Math.abs(e.z-r.z)-i.z*.5);return Math.sqrt(n*n+o*o+l*l)}return 1/0}intersectsFrustum(e,t){if(this._type==="sphere"&&this._sphere){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}else if(this._box){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}return!1}}const mu=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.used!==e.used?s.used?1:-1:s.error!==e.error?s.error>e.error?1:-1:s.distanceFromCamera!==e.distanceFromCamera?s.distanceFromCamera>e.distanceFromCamera?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},Au=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.lastFrameVisited!==e.lastFrameVisited?s.lastFrameVisited>e.lastFrameVisited?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:s.loadingState!==e.loadingState?s.loadingState>e.loadingState?-1:1:s.hasUnrenderableContent!==e.hasUnrenderableContent?s.hasUnrenderableContent?-1:1:s.error!==e.error?s.error>e.error?-1:1:0};class dm{rootLoadingState=Br;rootTileSet=null;rootURL=null;fetchOptions={};frameCount=0;isLoading=!1;lruCache;loadQueue;processNodeQueue;plugins=[];_queuedTiles=[];_cachedSinceLoadComplete=new Set;_processedTiles=new WeakSet;_visibleTiles=new Set;_usedSet=new Set;_cacheHits=0;_cacheMisses=0;stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0,inCacheSinceLoad:0};errorTarget=16;errorThreshold=1;maxDepth=30;displayActiveTiles=!1;onRootTileLoaded;rtcOffset=null;_root=null;_activeTiles=new Set;_delayedHideTiles=new Set;_delayedVisibleTiles=new Set;_delayedActiveTiles=new Set;group;cameras=[];_cameraMap=new Map;_cameraInfo=[];_upRotationMatrix=new R;_ellipsoid;_bytesUsed=new WeakMap;_eventListeners=new Map;performanceStats={updateTime:0,traverseTime:0,markUsedTime:0,markVisibleTime:0,toggleTime:0,queueProcessTime:0};constructor(e=null){this.rootURL=e,this.lruCache=new du,this.lruCache.unloadPriorityCallback=Au,this.loadQueue=new il,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=mu,this.processNodeQueue=new il,this.processNodeQueue.maxJobs=25,this.group=new ne,this.group.name="TilesRendererGroup"}get root(){return this._root}get loadProgress(){const{stats:e,isLoading:t}=this,a=e.downloading,r=e.inCacheSinceLoad+(t?1:0);return r===0?1:1-a/r}update(){const{lruCache:e,_usedSet:t,stats:a,loadQueue:r,processNodeQueue:i}=this;this.rootLoadingState===Br&&(this.rootLoadingState=al,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=La,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),d=this.preprocessNode(c.root,f,null);this.queueTileForDownload(d),this._root=d;const h=new Xr(d.boundingVolume),u=new Lr;h.getSphere(u);const m=new Ce;if(h.getAABB(m),this.rtcOffset=new b(-u.center.x,-u.center.y,-u.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:u.center,radius:u.radius,boundingBox:m,rtcOffset:this.rtcOffset})}catch(g){console.warn("Failed to calculate bounding volume for root tile:",g)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=_r,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const n=this.root;if(!n)return;a.inFrustum=0,a.used=0,a.active=0,a.visible=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.updateCameraInfo(),this._checkDelayedHideTiles(),this._checkDelayedActiveTiles(),this._checkDelayedVisibleTiles(),en(n,this),cl(n,this),tn(n,this),an(n,this);const o=this._queuedTiles;e.unloadPriorityCallback&&o.sort(e.unloadPriorityCallback);for(let c=0,f=o.length;c<f&&!e.isFull();c++)this.requestTileContents(o[c]);o.length=0,r.update(),i.update(),e.scheduleUnload(),(r.running||i.running)===!1&&this.isLoading===!0&&(this._cachedSinceLoadComplete.clear(),a.inCacheSinceLoad=0,this.dispatchEvent({type:"tiles-load-end"}),this.isLoading=!1)}traverse(e,t,a=!0){this.root&&hu(this.root,(r,i,n)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,n):!1),t)}registerPlugin(e){if(this.plugins.includes(e))return;const t=e.priority||0;let a=this.plugins.length;for(let r=0;r<this.plugins.length;r++)if((this.plugins[r].priority||0)>t){a=r;break}this.plugins.splice(a,0,e),e.init&&e.init(this)}unregisterPlugin(e){const t=this.plugins;let a;if(typeof e=="string"?a=t.find(r=>r.name===e):a=e,a&&t.includes(a)){const r=t.indexOf(a);return t.splice(r,1),a.dispose&&a.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}calculateTileViewError(e,t){const a=e.cached,r=this.cameras,i=this._cameraInfo,n=a.boundingVolume;if(!n){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,d=1/0;const h=a.worldTransform;for(let u=0,m=r.length;u<m;u++){const g=i[u];let p,D;if(g.isOrthographic){const B=g.pixelSize;p=e.geometricError/B,D=1/0}else{const B=g.sseDenominator;D=n.distanceToPoint(g.position,h),p=D===0?1/0:e.geometricError/(D*B)}const A=i[u].frustum;n.intersectsFrustum(A,h)&&(o=!0,l=Math.max(l,p),c=Math.min(c,D)),f=Math.max(f,p),d=Math.min(d,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=d)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new b,frustum:new On,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],n=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(n.position.copyFrom(l),n.frustum=i.frustum,n.isOrthographic=i.type===nt.ortho,n.isOrthographic){const c=i.frustumSize;n.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;n.sseDenominator=2*Math.tan(f/2)/o.height}}}preprocessNode(e,t,a=null){if(this._processedTiles.has(e))return e;this._processedTiles.add(e);let r;if(e instanceof rl?r=e:r=new rl(e,a),r.content){const c=r.content;!("uri"in c)&&"url"in c&&(c.uri=c.url,delete c.url)}if(r.basePath=t,r.boundingVolume){const c=new Xr(r.boundingVolume);r.cached.boundingVolume=c}const i=new b(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),n=new R;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)n.rawData[f]=c[f]}if(!a){n.copyFrom(this._upRotationMatrix);const c=new b;c.copyFrom(i),c.applyMatrix4(n);const f=r.cached.boundingVolume.box,d=[new b(f.min.x,f.min.y,f.min.z),new b(f.max.x,f.min.y,f.min.z),new b(f.min.x,f.max.y,f.min.z),new b(f.max.x,f.max.y,f.min.z),new b(f.min.x,f.min.y,f.max.z),new b(f.max.x,f.min.y,f.max.z),new b(f.min.x,f.max.y,f.max.z),new b(f.max.x,f.max.y,f.max.z)];for(const m of d)m.applyMatrix4(n);const h=new Ce;d.forEach(m=>{h.expandByPoint(m)}),n.rawData[12]=-c.x,n.rawData[13]=-c.y,n.rawData[14]=-c.z;const u=h.min;n.rawData[13]-=u.y}const o=new R;o.copyFrom(n),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,n);const l=new R;if(l.copyFrom(o),l.invert(),r.cached.transfrom=n,r.cached.worldTransform=o,r.cached.transformInverse=l,e.children&&e.children.length>0){r.children=[];for(let c=0;c<e.children.length;c++){const f=e.children[c],d=this.preprocessNode(f,t,r);r.children.push(d)}r.childrenProcessed=r.children.length}return r}ensureChildrenArePreprocessed(e,t=!1){const a=e.children;for(let r=0,i=a.length;r<i;r++){const n=a[r];n.basePath!==void 0&&n.basePath!==""||n.cached.boundingVolume||(t?(this.processNodeQueue.remove(n),this.preprocessNode(n,e.basePath,e)):this.processNodeQueue.has(n)||this.processNodeQueue.add(n,o=>{this.preprocessNode(o,e.basePath,e)}))}}_recordCacheHit(){this._cacheHits++}_recordCacheMiss(){this._cacheMisses++}resetCacheStats(){this._cacheHits=0,this._cacheMisses=0}requestTileContents(e){if(e.loadingState!==Br){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=al,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=_r,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async n=>{try{await this.parseTileContent(n,r,i),this.stats.downloading--}catch(o){n.loadingState=_r,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=cu;const i=(c=>{const f=c.split(".");return f.length>1?f[f.length-1]:""})(t),n=a;let o=null;const l=new It;switch(i.toLowerCase()){case"b3dm":{o=(await l.load(n,So,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"i3dm":{o=(await l.load(n,Eo,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"glb":case"gltf":{o=(await l.load(n,xt,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"pnts":{o=(await l.load(n,tu,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"json":try{const c=await _.res.loadJSON(n);e.children.length=0,e.childrenProcessed=0;const f=this._getBasePath(n);if(c.root){const d=this.preprocessNode(c.root,f,e);e.children.push(d),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:c,url:n})}e.loadingState=La;return}catch(c){console.error("Failed to load external tileset:",c),e.loadingState=_r,this.stats.failed++;return}break;default:console.warn(`Unknown tile format: ${i}`);break}if(o){e.cached.scene=o;const c=this._estimateBytesUsed(o);this._bytesUsed.set(o,c),this.lruCache.setMemoryUsage(e,c),this.lruCache.has(e)||this.lruCache.add(e,f=>{if(f.cached.scene){const d=f.cached.scene;d.parent&&d.parent.object3D.removeChild(d),d.destroy(!0),f.cached.scene=null}f.loadingState=Br}),this.setTileImmediateActive(e),e.active=!0,e.__wasSetActive=!0,this.stats.active++,this.setTileImmediateVisible(e),e.visible=!0,e.__wasSetVisible=!0,this.stats.visible++,e.loadingState=La,e.usedLastFrame=!0,tn(e,this),an(e,this)}else e.loadingState=_r,this.stats.failed++}markTileUsed(e){this._usedSet.add(e),this.lruCache.markUsed(e)}setTileDelayedActive(e,t){t?(this._activeTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedActiveTiles.has(e)||this._delayedActiveTiles.add(e)):(this._activeTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedActiveTiles.has(e)&&this._delayedActiveTiles.delete(e))}setTileImmediateActive(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform))}}setTileImmediateVisible(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0)}}_checkDelayedHideTiles(){if(this.stats.downloading===0)for(const e of this._delayedHideTiles){const t=e.cached.scene;t&&(t.transform.enable=!1,this._delayedHideTiles.delete(e))}}_checkDelayedActiveTiles(){for(const e of this._delayedActiveTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform),this._delayedActiveTiles.delete(e))}else this._delayedActiveTiles.delete(e)}_checkDelayedVisibleTiles(){for(const e of this._delayedVisibleTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0,this._delayedVisibleTiles.delete(e))}else this._delayedVisibleTiles.delete(e)}setTileDelayedVisible(e,t){t?(this._visibleTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedVisibleTiles.has(e)||this._delayedVisibleTiles.add(e)):(this._visibleTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedVisibleTiles.has(e)&&this._delayedVisibleTiles.delete(e))}queueTileForDownload(e){e.loadingState!==Br||this.lruCache.isFull()||this._queuedTiles.push(e)}dispatchEvent(e){const t=this._eventListeners.get(e.type);t&&t.forEach(a=>{try{a(e)}catch(r){console.error("Error in event listener:",r)}})}async _loadRootTileSet(){if(!this.rootURL)throw new Error("Root URL is not set");const e=await _.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new R;switch(e.toLowerCase()){case"x":t.makeRotationAxis(b.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(b.X_AXIS,-Math.PI/2);break;default:console.warn(`Unknown gltfUpAxis: ${e}, using default`),t.identity();break}this._upRotationMatrix=t}_applyLocalTransform(e,t){const a=t.decompose(na.EULER_ANGLES);e.localPosition=a[0];const r=new se;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_applyWorldTransform(e,t){const a=t.decompose(na.EULER_ANGLES);e.localPosition=a[0];const r=new se;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_getBasePath(e){const t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}_resolveURL(e,t){return t.startsWith("http://")||t.startsWith("https://")?t:e+"/"+t}_getUrlExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}getMemoryStats(){const e=this.lruCache.getStats(),t=this.lruCache.maxBytesSize,a=e.bytes,r=t-a,i=this._cacheHits+this._cacheMisses,n=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:n}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===La&&e.push(t),!1),null),e}getVisibleTiles(){return Array.from(this._visibleTiles)}getActiveTiles(){return Array.from(this._activeTiles)}getTileTreeStats(){let e=0,t=0,a=0,r=0,i=0,n=0;return this.traverse(o=>(e++,o.loadingState===La&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),n+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?n/e:0}}printDebugInfo(){const e=this.stats,t=this.getMemoryStats(),a=this.getTileTreeStats(),r=this.performanceStats,i=this.lruCache.getStats();console.log("=== TilesRenderer Debug Info ==="),console.log("Stats:",e),console.log("Memory:",t),console.log("Tree:",a),console.log("Performance:",r),console.log("Cache:",i),console.log("Queues:",{load:this.loadQueue.getStats(),process:this.processNodeQueue.getStats()})}setPerformanceOptions(e){e.lruCacheMinSize!==void 0&&(this.lruCache.minSize=e.lruCacheMinSize),e.lruCacheMaxSize!==void 0&&(this.lruCache.maxSize=e.lruCacheMaxSize),e.lruCacheMinBytes!==void 0&&(this.lruCache.minBytesSize=e.lruCacheMinBytes),e.lruCacheMaxBytes!==void 0&&(this.lruCache.maxBytesSize=e.lruCacheMaxBytes),e.lruCacheUnloadPercent!==void 0&&(this.lruCache.unloadPercent=e.lruCacheUnloadPercent),e.downloadQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.downloadQueueMaxJobs),e.parseQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.parseQueueMaxJobs),e.processQueueMaxJobs!==void 0&&(this.processNodeQueue.maxJobs=e.processQueueMaxJobs),e.enablePerformanceStats!==void 0&&(this._enablePerformanceStats=e.enablePerformanceStats),e.enableCacheStats!==void 0&&(this._enableCacheStats=e.enableCacheStats)}dispose(e){[...this.plugins].forEach(a=>this.unregisterPlugin(a)),this.lruCache.clear(),this.loadQueue.clear(),this.processNodeQueue.clear(),this._root=null,this.rootTileSet=null,this.rootLoadingState=Br,this.frameCount=0,this.isLoading=!1,this.resetCacheStats(),this.group.destroy(e)}setCamera(e,t,a){this.cameras.includes(e)||this.cameras.push(e),this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}deleteCamera(e){const t=this.cameras.indexOf(e);t!==-1&&this.cameras.splice(t,1),this._cameraMap.delete(e),this._updateCameraInfo()}setResolution(e,t,a){const r=this._cameraMap.get(e);r?(r.width=t,r.height=a):this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}forEachLoadedModel(e){this.traverse(t=>(t.loadingState===La&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent(he);r&&r.geometry&&(t+=1024),r&&r.material&&(t+=512)}),t}addEventListener(e,t){this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.get(e).push(t)}removeEventListener(e,t){const a=this._eventListeners.get(e);if(a){const r=a.indexOf(t);r!==-1&&a.splice(r,1)}}async loadTileSet(e,t){const r=(e.endsWith("/")?e.slice(0,-1):e)+"/"+t;this.rootURL=r}get modelList(){const e=[];return this.forEachLoadedModel(t=>{e.push(t)}),e}}class hm{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class um{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class bm{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class gm{uri;group;metadata}class pm{class;properties}function mm(s,e){let t=0,a=null;return function(...r){const i=Date.now(),n=i-t;n>=e?(t=i,s.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),s.apply(this,r),a=null},e-n))}}class Am extends vt{static count=0;constructor(){super(),Y.register("ColorLitShader",Jd),this.shader=new At;let e=new qe("ColorLitShader","ColorLitShader");e.passType=fe.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new J),e.setUniformColor("emissiveColor",new J),e.setUniformFloat("envIntensity",1),e.setUniformFloat("normalScale",1),e.setUniformFloat("roughness",0),e.setUniformFloat("metallic",0),e.setUniformFloat("ao",1),e.setUniformFloat("alphaCutoff",0);let t=e.shaderState;t.acceptShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,e.setTexture("normalMap",_.res.normalTexture),e.setTexture("emissiveMap",_.res.blackTexture)}clone(){return null}debug(){}}class Dm extends vt{constructor(){super();let e=new qe("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=fe.COLOR,e.setUniformVector4("transformUV1",new be(0,0,1,1)),e.setUniformVector4("transformUV2",new be(0,0,1,1)),e.setUniformColor("baseColor",new J(1,1,1,1)),e.setUniformFloat("alphaCutoff",.5);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1;let a=new At;a.addRenderPass(e),this.shader=a,this.baseMap=_.res.grayTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}function _m(s,e){}class Bm extends vt{constructor(){super(),this.shader=new $i,this.baseMap=_.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set shadowMap(e){}}class fl{clipName;loopTime;startTime;stopTime;sampleRate;useSkeletonPos;useSkeletonScale;positionCurves=new Map;rotationCurves=new Map;scaleCurves=new Map;floatCurves=new Map;formBytes(e){if(this.clipName=e.readUTF(),this.loopTime=!e.readInt32(),this.startTime=e.readFloat32(),this.stopTime=e.readFloat32(),this.sampleRate=e.readInt32(),this.useSkeletonPos=e.readInt32()>0,this.useSkeletonScale=e.readInt32()>0,this.useSkeletonPos){let r=e.readInt32();for(let i=0;i<r;i++){let n=new xr;n.formBytes(e),this.positionCurves.set(n.path,n)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new xr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let n=new xr;n.formBytes(e),this.scaleCurves.set(n.path,n)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new xr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class xr{path;attribute;propertys;preInfinity;postInfinity;rotationOrder;m_curves;k=0;_cacheValue;_kValue;constructor(e=1){this.k=e,this.m_curves=[],this.check()}check(){for(let e=0;e<this.k;e++)this.m_curves[e]||=new Li;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new de;break;case 3:this._cacheValue=new b;break;case 4:this._cacheValue=new be;break}}get totalTime(){return this.m_curves[0].totalTime}addKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].addKeyFrame(e.getK(t))}removeKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].removeKeyFrame(e.getK(t))}getValue(e){switch(this.k){case 1:this._cacheValue=this.m_curves[0].getValue(e);break;case 2:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e);break;case 3:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e),this._cacheValue.z=this.m_curves[2].getValue(e);break;case 4:const t=this.m_curves[0].getCurveFramesExtent(e),a=t.lhsIndex,r=t.rhsIndex;e=t.time;let i=this.m_curves[0].getKey(a),n=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(n.time-i.time);se.HELP_0.set(this.m_curves[0].getKey(a).value,this.m_curves[1].getKey(a).value,this.m_curves[2].getKey(a).value,this.m_curves[3].getKey(a).value),se.HELP_1.set(this.m_curves[0].getKey(r).value,this.m_curves[1].getKey(r).value,this.m_curves[2].getKey(r).value,this.m_curves[3].getKey(r).value),se.HELP_2.slerp(se.HELP_0,se.HELP_1,o),this._cacheValue.x=se.HELP_2.x,this._cacheValue.y=se.HELP_2.y,this._cacheValue.z=se.HELP_2.z,this._cacheValue.w=se.HELP_2.w;break}return this._cacheValue}getKeyCount(){return this.m_curves[0].getKeyCount()}getKey(e){let t=[];for(let a=0;a<this.k;a++)t.push(this.m_curves[a].getKey(e));return t}formBytes(e){this.path=e.readUTF(),this.k=e.readInt32(),this.check(),this.attribute=e.readUTF(),this.propertys=this.attribute.split("."),this.preInfinity=e.readInt32(),this.postInfinity=e.readInt32(),this.rotationOrder=e.readInt32();let t=e.readInt32();for(let a=0;a<t;a++){let r=new as(0);r.formBytes(e),this.addKeyFrame(r)}}}class vm extends Map{negtive;constructor(e){if(super(e),this.negtive=new Map,e)for(let t of e)this.negtive.set(t[1],t[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.negtive.delete(t),super.delete(e)}return!1}getKey(e){return this.negtive.get(e)}deleteValue(e){let t=this.negtive.get(e);return t&&this.delete(t),this.negtive.delete(e)}set(e,t){return super.set(e,t),this.negtive.set(t,e),this}clear(){this.negtive.clear(),super.clear()}}class xm{colorArray;constructor(e){this.colorArray=e}getColor(e){let t=e*this.colorArray.length,a=Math.floor(t),r=Math.min(a+1,this.colorArray.length-1),i=this.colorArray[a],n=this.colorArray[r];return J.lerp(t-a,i,n)}}class rn{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return b.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,n=e*e*e;return this.controlVertices[0].mul(a).add(this.controlVertices[1].mul(r)).add(this.controlVertices[2].mul(i)).add(this.controlVertices[3].mul(n))}getTangent(e){if(!(e>=0&&e<=1))return b.ZERO;let t=this.controlVertices,a=t[0].add(t[1].add(t[0]).mul(e)),r=t[1].add(t[2].add(t[1]).mul(e)),i=t[2].add(t[3].add(t[2]).mul(e)),n=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(n)}getClosestParam(e,t=1e-6){return this.getClosestParamRec(e,0,1,t)}getClosestParamRec(e,t,a,r){let i=(t+a)/2;if(a-t<r)return i;let n=(t+i)/2,o=(i+a)/2,l=this.getPoint(n),c=this.getPoint(o),f=l.subtract(e).lengthSquared,d=c.subtract(e).lengthSquared;return f<d?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var Du=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(Du||{});class Um{type=0;numCurveSegments=0;numControlVertices=0;controlVertices=[];constructor(e,t=0){this.setControlVertices(e,t)}getPathType(){return this.type}isClosed(){return this.type==1}isValid(){return this.numCurveSegments>0}clear(){this.controlVertices.length=0,this.type=0,this.numCurveSegments=0,this.numControlVertices=0}computeApproxLength(){if(!this.isValid())return 0;let e=this.numCurveSegments+1;if(e<2)return 0;let t=0,a=this.controlVertices;for(let r=1;r<e;r++){let i=a[(r-1)*3],n=a[r*3];t+=i.subtract(n).lengthSquared}return t==0?0:t}computeApproxParamPerUnitLength(){let e=this.computeApproxLength();return this.numCurveSegments/e}computeApproxNormParamPerUnitLength(){return 1/this.computeApproxLength()}interpolatePoints(e,t){let a=e.length;a<2&&console.error("point count must great 1"),this.clear(),this.type=t;let r=this.controlVertices;switch(t){case 0:{this.numCurveSegments=a-1,this.numControlVertices=3*a-2,r.length=this.numControlVertices;for(let o=0;o<a;o++)r[o*3]=e[o];let i=e[1].subtract(e[0]).mul(.25);r[1]=e[0].add(i);let n=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(n);for(let o=1;o<this.numCurveSegments;o++){let l=e[o-1].subtract(e[o]),c=e[o+1].subtract(e[o]),f=l.lengthSquared,d=c.lengthSquared;if(f>0&&d>0){let h=(f+d)/8,u=c.div(d).subtract(l.div(f));u.normalize(),u=u.mul(h),r[o*3-1]=e[o].subtract(u),r[o*3+1]=e[o].add(u)}else r[o*3-1]=e[o],r[o*3+1]=e[o]}break}case 1:{this.numCurveSegments=a,this.numControlVertices=3*a+1,r.length=this.numControlVertices;for(let i=0;i<a;i++)r[i*3]=e[i];r[this.numControlVertices-1]=e[0];for(let i=1;i<=this.numCurveSegments;i++){let n=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[n].subtract(e[l]),f=e[o].subtract(e[l]),d=c.lengthSquared,h=f.lengthSquared,u=3*i-1,m=(3*i+1)%(this.numControlVertices-1);if(d>0&&h>0){let g=(d+h)/8,p=f.div(h).subtract(c.div(d));p.normalize(),p=p.mul(g),r[u]=e[l].subtract(p),r[m]=e[l].add(p)}else r[u]=e[l],r[m]=e[l]}break}}}setControlVertices(e,t){let a=e.length;a<=0||t==0&&a<4||t==1&&a<7||(a-1)%3==0&&(this.clear(),this.type=t,this.numControlVertices=a,this.numCurveSegments=(a-1)/3,this.controlVertices=e)}getPoint(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Gt.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=[],r=this.controlVertices;return a[0]=r[3*t+0],a[1]=r[3*t+1],a[2]=r[3*t+2],a[3]=r[3*t+3],new rn(a).getPoint(e-t)}getPointNorm(e){return this.getPoint(e*this.numCurveSegments)}getTangent(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Gt.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=this.controlVertices,r=[];return r[0]=a[3*t+0],r[1]=a[3*t+1],r[2]=a[3*t+2],r[3]=a[3*t+3],new rn(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],n=new rn(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let d=0;d<4;d++)i[d]=this.controlVertices[o+d];n.setControlVertices(i);let l=n.getClosestParam(e,t),f=n.getPoint(l).subtract(e).lengthSquared;f<a&&(a=f,r=o/3+l)}return r}computeClosestNormParam(e,t){return this.computeClosestParam(e,t*this.numCurveSegments)}}class ym extends Map{valueList;keyList;isChange=!0;constructor(e,t,a){if(super(e),t&&(this.keyList=[]),a&&(this.valueList=[]),e)for(let r of e)this.valueList?.push(r[1]),this.keyList?.push(r[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.valueList&&this.deleteValue(t),this.keyList&&this.deleteKey(e),this.isChange=!0,super.delete(e)}return!1}deleteValue(e){let t=this.valueList.indexOf(e);return t>=0&&this.valueList.splice(t,1),this}deleteKey(e){let t=this.keyList.indexOf(e);return t>=0&&this.keyList.splice(t,1),this}set(e,t){return this.delete(e),this.keyList?.push(e),this.valueList?.push(t),super.set(e,t),this.isChange=!0,this}clear(){this.valueList&&(this.valueList.length=0),this.keyList&&(this.keyList.length=0),this.isChange=!0,super.clear()}}var _u=(s=>(s[s.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",s[s.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",s[s.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",s[s.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",s[s.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",s[s.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",s[s.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",s[s.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",s[s.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",s[s.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",s[s.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",s[s.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",s[s.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",s))(_u||{});const Cm=3.141592653589793;class Sm{}function Bu(s,e,t){let a=.3333333333333333,r=.5,i=s*a,n=i*i,l=n*i-i*e*r+t*r,c=-n+e*a,f=c*c*c,d=f+l*l;if(d>=0){let m=Math.sqrt(d)-l;return m=m>0?Math.pow(m,a):-Math.pow(-m,a),-i-c/m+m}let h=Math.sqrt(-f),u=Math.acos(-l/h);return h=Math.pow(h,a),h=h-c/h,u=-i+h*Math.cos(u*a),u}function sn(s,e,t,a){let r=1e-5;if(Math.abs(s)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*s*t;if(i<0)return 0;let n=.5/s,o=Math.sqrt(i);return a.r0=(o-e)*n,a.r1=(-o-e)*n,2}function vu(s,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let n=t/e,o=a/e,l=r/e;s[0]=Bu(n,o,l),i++;let c=e,f=t+e*s[0],d=a+t*s[0]+e*s[0]*s[0];i+=sn(c,f,d,{r0:s[1],r1:s[2]})}else i+=sn(t,a,r,{r0:s[1],r1:s[2]});return i}class Ga{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class nr{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[nr.kMaxNumSegments]=new Ga,this.integrationCache[nr.kMaxNumSegments]=0,this.doubleIntegrationCache[nr.kMaxNumSegments]=0,this.times[nr.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=de.ZERO.clone(),t=20,a=1/t,r=a;for(let i=0;i<t;i++)this.calculateMinMax(e,this.evaluateDoubleIntegrated(r)),r+=a;return e}findMinMaxIntegrated(){let e=de.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],n=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=vu(c,i,n,o,l);for(let d=0;d<f;d++){let h=c[d]+t[r];h>=t[r]&&h<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(h))}this.calculateMinMax(e,this.evaluateIntegrated(a[r])),this.times[r]}return e}generateIntegrationCache(e){e.integrationCache[0]=0;let t=e.times[0],a=0;for(let r=1;r<e.segmentCount;r++){let i=e.segments[r-1].coeff;dl(i);let n=t-a;e.integrationCache[r]=e.integrationCache[r-1]+Ga.EvalSegment(n,i)*n,a=t,t=e.times[r]}}generateDoubleIntegrationCache(e){let t=0,a=0;for(let r=0;r<e.segmentCount;r++){e.doubleIntegrationCache[r]=t;let i=e.times[r]-a;i=Math.max(i,0),t+=Ga.EvalSegment(i,e.segments[r].coeff)*i*i+e.integrationCache[r]*i,a=e.times[r]}}integrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)dl(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)xu(this.segments[e].coeff);this.generateDoubleIntegrationCache(this)}static isValidCurve(e){let t=e.getKeyCount(),a=t-1;return e.getKey(0).time!=0&&a++,e.getKey(t-1).time!=1&&a++,a<=nr.kMaxNumSegments}evaluateDoubleIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.doubleIntegrationCache[a]+this.integrationCache[a]*r+Ga.EvalSegment(r,this.segments[a].coeff)*r*r}t=this.times[a]}return 1}evaluateIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.integrationCache[a]+Ga.EvalSegment(r,this.segments[a].coeff)*r}t=this.times[a]}return 1}evaluate(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a])return Ga.EvalSegment(e-t,this.segments[a].coeff);t=this.times[a]}return 1}buildCurve(e,t){let a=e.getKeyCount();this.segmentCount=1;let r=1.01;if(this.segments.length=0,this.integrationCache.length=0,this.doubleIntegrationCache.length=0,this.times.length=0,this.times[0]=r,a!=0)if(a==1)this.segments[0]=new Ga,this.segments[0].coeff[3]=e.getKey(0).value*t;else{this.segmentCount=a-1;let i=0;e.getKey(0).time!=0&&(this.segments[0].coeff[3]=e.getKey(0).value,this.times[0]=e.getKey(0).time,i=1);for(let n=0;n<this.segmentCount;n++){let o;e.calculateCacheData(o,n,n+1,0),this.segments[n+i].coeff=o.coeff.concat(),this.times[n+i]=e.getKey(n+1).time}this.segmentCount+=i,e.getKey(a-1).time!=1&&(this.segments[this.segmentCount].coeff[3]=e.getKey(a-1).value,this.segmentCount++),this.times[this.segmentCount-1]=r;for(let n=0;n<this.segmentCount;n++)this.segments[n].coeff[0]*=t,this.segments[n].coeff[1]*=t,this.segments[n].coeff[2]*=t,this.segments[n].coeff[3]*=t}return!0}}function xu(s){s[0]/=20,s[1]/=12,s[2]/=6,s[3]/=2}function dl(s){s[0]/=4,s[1]/=3,s[2]/=2,s[3]/=1}var Uu=(s=>(s[s.kEMScalar=0]="kEMScalar",s[s.kEMOptimized=1]="kEMOptimized",s[s.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",s[s.kEMSlow=3]="kEMSlow",s))(Uu||{}),yu=(s=>(s[s.kMMCScalar=0]="kMMCScalar",s[s.kMMCCurve=1]="kMMCCurve",s[s.kMMCTwoCurves=2]="kMMCTwoCurves",s[s.kMMCTwoConstants=3]="kMMCTwoConstants",s))(yu||{});class Fm{max;min}class km{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class Cu{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new Li,this.maxCurve=new Li}setScalar(e){this._scalar=e}getScalar(){return this._scalar}static evaluateSlow(e,t,a){let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==2?Mr(e.minCurve.getValue(t)*e.getScalar(),r,a):r}static evaluate(e,t,a=1){if(e.minMaxState==0)return e.getScalar();let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==1?Mr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?Mr(e._minScalar,e._scalar,a):e.minMaxState==2?Mr(e.minCurve.getValue(t)*e.getScalar(),r,1*Math.random()):this.evaluateSlow(e,t,1)}unSerialized(e){this.minMaxState=e.minMaxState,this._scalar=e.scalar,this._minScalar=e.minScalar,this.maxCurve.unSerialized(e.maxCurve),this.minCurve.unSerialized(e.minCurve)}}class Em{value=0;mode=0;spread=0;speed=new Cu;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function wm(s,e){let t=nr.isValidCurve(s.max);return e!=2&&e!=3?t:t&&nr.isValidCurve(s.min)}function Im(s,e,t,a){s.max.buildCurve(e.max,t),a!=2&&a!=3?s.min.buildCurve(e.max,t):s.min.buildCurve(e.min,t)}function Rm(s,e){let t=e.getKeyCount();if(t!=0)if(t==1)es(s,e.getKey(0).value);else{let a=t-1;es(s,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Lo;e.calculateCacheData(i,r,r+1,0);let n=3*i.coeff[0],o=2*i.coeff[1],l=1*i.coeff[2],c=e.getKey(r).time,f=e.getKey(r+1).time,d=[],h=sn(n,o,l,{r0:d[0],r1:d[1]});for(let u=0;u<h;u++)d[u]>=0&&d[u]+c<f&&es(s,Ga.EvalSegment(d[u],i.coeff));es(s,Ga.EvalSegment(f-c,i.coeff))}}}function es(s,e){s.x=Math.min(s.x,e),s.y=Math.max(s.y,e)}class Vr{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class Su{a;b;c;d;static ALIGN_ANY=0;static ALIGN_XY_AXIS=1;static ALIGN_YZ_AXIS=2;static ALIGN_XZ_AXIS=3;constructor(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}setTo(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}fromPoints(e,t,a){var r=t.x-e.x,i=t.y-e.y,n=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-n*l,this.b=n*o-r*c,this.c=r*l-i*o,this.d=-(this.a*e.x+this.b*e.y+this.c*e.z)}fromNormalAndPoint(e,t){this.a=e.x,this.b=e.y,this.c=e.z,this.d=-(this.a*t.x+this.b*t.y+this.c*t.z)}normalize(){var e=Math.sqrt(this.a*this.a+this.b*this.b+this.c*this.c);if(e>0){var t=1/e;this.a*=t,this.b*=t,this.c*=t,this.d*=t}return e}distance(e){return this.a*e.x+this.b*e.y+this.c*e.z+this.d}classifyPoint(e,t=.01){var a=this.distance(e);return a<-t?Vr.BACK:a>t?Vr.FRONT:Vr.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function Qm(s,e){return Math.random()*e+Math.random()*s+(e-s)*Math.random()}function Tm(s,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*s*a+(e-s)*Math.random()*a}function Fu(s,e,t){let a=0,r=0;for(;a===0;)a=Math.random();for(;r===0;)r=Math.random();let i=Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*r);return i=i/10+.5,(i>1||i<0)&&(i=Fu(s,e,t)),i=Math.pow(i,t),i*=e-s,i+=s,i}function Ca(s){return s>0?Math.floor(s):Math.floor(s)-1}let Ue=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];function hl(s,e){let t=s&15,a=1+(t&7);return t&8&&(a=-a),a*e}function nn(s,e,t){let a=s&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function ts(s,e,t,a){let r=s&15,i=r<8?e:t,n=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-n:n)}function _i(s,e,t,a,r){let i=s&31,n=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-n:n)+(i&2?-o:o)+(i&4?-l:l)}let ea=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]];function Mm(s){let e=Ca(s),t=e+1,a=s-e,r=a-1,i,n,o=1-a*a;o*=o,i=o*o*hl(Ue[e&255],a);let l=1-r*r;return l*=l,n=l*l*hl(Ue[t&255],r),.25*(i+n)}function Nm(s,e){const t=.366025403,a=.211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-Se*Se-Me*Me-Ze*Ze;Rr<0?l=0:(Rr*=Rr,l=Rr*Rr*_i(Ue[Pt+$+Ue[ga+re+Ue[pa+ce+Ue[ra+Ae]]]],ye,Se,Me,Ze));let Qr=.6-$e*$e-ct*ct-ja*ja-ba*ba;Qr<0?c=0:(Qr*=Qr,c=Qr*Qr*_i(Ue[Pt+Qe+Ue[ga+Ve+Ue[pa+H+Ue[ra+ie]]]],$e,ct,ja,ba));let Tr=.6-Ra*Ra-Xt*Xt-Qa*Qa-Ta*Ta;return Tr<0?f=0:(Tr*=Tr,f=Tr*Tr*_i(Ue[Pt+1+Ue[ga+1+Ue[pa+1+Ue[ra+1]]]],Ra,Xt,Qa,Ta)),27*(n+o+l+c+f)}class Dl extends de{static uv_0=new Dl;u=0;v=0;constructor(e=0,t=0){super(e,t),this.u=e,this.v=t}length(){return 0}static getUVSheet(e,t,a){let r=Math.floor(e%(t*a)),i=Math.floor(r/t),n=r%t;return new be(i/t,n/a,1/t,1/a)}}class as{serializedVersion="2";time;tangentMode=0;weightedMode=0;propertyKeyFrame;constructor(e=0){this.time=e,this.propertyKeyFrame={}}getK(e){return this.propertyKeyFrame[e]}split(e,t,a){switch(e){case X.single:{let r=this.getKeyFrame(0);r[a]=t}break;case X.float:{let r=this.getKeyFrame(0);r[a]=t}break;case X.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y}break;case X.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case X.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case X.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break}}getKeyFrame(e){let t=this.propertyKeyFrame[e];return t||(t=new Js,t.time=this.time,t.tangentMode=this.tangentMode,t.weightedMode=this.weightedMode,this.propertyKeyFrame[e]=t),t}formBytes(e){this.time=e.readFloat32();{let{t,v:a}=Wa.parser(e);this.split(t,a,"value")}{let{t,v:a}=Wa.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Wa.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Wa.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Wa.parser(e);this.split(t,a,"outWeight")}}}class Om{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new de(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new b(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new be(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}case"Quaternion":{let r=e,i=t;return new se(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}}}}class rs{_keys=new Array;_values=new Array;getIndexByKey(e){return this._keys.indexOf(e)}getValueByKey(e){var t=this.getIndexByKey(e);return t>-1?this._values[t]:null}put(e,t){if(e==null)return null;var a=this.remove(e);return this._keys.push(e),this._values.push(t),a}remove(e){var t=this._keys.indexOf(e),a;return t>-1&&(a=this._values[t],this._keys.splice(t,1),this._values.splice(t,1)),a}getValues(){return this._values}getKeys(){return this._keys}clear(){this._values.length=0,this._keys.length=0}}class Ur{static WalkAble=1}class is{static SetConst(e){this.EPSILON=e,this.POWER_EPSILON=e*e}static EPSILON=.1;static POWER_EPSILON=this.EPSILON*this.EPSILON}class Qt extends b{static CALC_VECTOR3D1=new b;static CALC_VECTOR3D2=new b;static CALC_VECTOR3D3=new b;static CALC_VECTOR3D4=new b;static CALC_VECTOR3D5=new b;_pointId=0;constructor(e,t,a,r){super(t,a,r,0),this._pointId=e}get id(){return this._pointId}static equalPoint(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)+(e.z-t.z)*(e.z-t.z)<is.POWER_EPSILON}static calcDistance(e,t){return Qt.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),Qt.CALC_VECTOR3D3.length}}class ku{_openedList;_closedList;_endNode;_startNode;_triangleChannel;_navMesh;_findIndex=0;constructor(){this._openedList=new Array,this._closedList=new Array}findPath(e,t,a){return this._findIndex++,this._navMesh=e,this._startNode=t,this._endNode=a,this._openedList.length=0,this._closedList.length=0,this._startNode&&this._endNode?(this._startNode.gg=0,this._startNode.h=0,this._startNode.f=0,this._startNode.parent=null,this.search()):!1}search(){for(var e=this._startNode,t=[],a;e!=this._endNode;){t=e.getNeibourTriangles(t,Ur.WalkAble,Ur.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+Qt.calcDistance(a,e)*a.costMultiplier,i=Qt.calcDistance(a,this._endNode),n=r+i;a.openId==this._findIndex?a.f>n&&(a.f=n,a.gg=r,a.h=i,a.parent=e):(a.f=n,a.gg=r,a.h=i,a.parent=e,a.openId=this._findIndex,this._openedList.push(a))}if(e.closeId=this._findIndex,this._closedList.push(e),this._openedList.length==0)return!1;this._openedList.sort(function(o,l){return o.f-l.f}),e=this._openedList.shift()}return this.buildPath(),!0}buildPath(){this._triangleChannel=[];var e=this._endNode;for(this._triangleChannel.push(e);e!=this._startNode;)e=e.parent,this._triangleChannel.unshift(e)}get channel(){return this._triangleChannel}}class Fa extends Qt{_ownerPoint;_ownerEdge;radius=0;constructor(e,t){super(e.id,0,0,0),this._ownerEdge=t,this._ownerPoint=e}get ownerPoint(){return this._ownerPoint}get ownerEdge(){return this._ownerEdge}scalePoint(e=.7){var t=new Fa(this._ownerPoint,this._ownerEdge);return t.copyFrom(this),t.decrementBy(this._ownerPoint),t.scaleBy(e),t.radius=t.length,t.incrementBy(this._ownerPoint),t}}class Ea{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new b;constructor(e,t){if(this._pointA=e,this._pointB=t,e.id>=t.id)throw new Error("edge point order error!!!");this._triangleOwners=new Array,this._centerPoint=new b,this._edgeMask=Ur.WalkAble,Qt.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=Qt.CALC_VECTOR3D1.length,this._centerPoint.setTo((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2)}get size(){return this._edgeSize}get triangleOwners(){return this._triangleOwners}get centerPoint(){return this._centerPoint}initFatPoints(e){this._edgeDirA2B=this._pointB.subtract(this._pointA),this._edgeDirA2B.normalize(),this.fatPointA=this.fatPointA||new Fa(this._pointA,this),this.fatPointB=this.fatPointB||new Fa(this._pointB,this),this.fatPointA.radius!=e&&(Ea.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),Ea.CALC_FAT_VECTOR.scaleBy(e),Ea.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(Ea.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(Ea.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),Ea.CALC_FAT_VECTOR.scaleBy(-e),Ea.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(Ea.CALC_FAT_VECTOR),this.fatPointB.radius=e)}getFatPoint(e){return e==this._pointA?this.fatPointA:this.fatPointB}getAnotherFatPoint(e){return e==this._pointA?this.fatPointB:this.fatPointA}getAnotherPoint(e){return e==this._pointA?this._pointB:this._pointA}containsPoint(e){return Qt.equalPoint(e,this._pointA)?this._pointA:Qt.equalPoint(e,this._pointB)?this._pointB:null}addTriangleOwners(e){if(e.edges.indexOf(this)==-1)throw new Error("the edge is not belong triangle!!!");this._triangleOwners.indexOf(e)==-1&&this._triangleOwners.push(e)}getPublicPoint(e){return this._pointA==e._pointA||this._pointA==e._pointB?this._pointA:this._pointB==e._pointA||this._pointB==e._pointB?this._pointB:null}getEqualPoint(e){return Qt.equalPoint(e,this._pointA)?this._pointA:Qt.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&Ur.WalkAble)==Ur.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class _e{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new b;static RAY_2=new b;static TEST_RAY=new b;static TEST_RAY_1=new b;static TEST_RAY_2=new b;static CALC_CROSS_POINT=new b;static CALC_CROSS_TEST=new b;cornerPoint;cornerEdge;continuePass(e,t,a){this.resetData(),this.curPoint=e,this.endPoint=t,this.cornerEdge=a}passEdge(e,t,a,r){if((this.rayA==null||this.rayB==null)&&(this.rayA=_e.RAY_1,this.rayB=_e.RAY_2,this.rayAPoint=e.pointA,this.rayBPoint=e.pointB,this.rayA.setTo(this.rayAPoint.x-this.curPoint.x,0,this.rayAPoint.z-this.curPoint.z),this.rayB.setTo(this.rayBPoint.x-this.curPoint.x,0,this.rayBPoint.z-this.curPoint.z)),r)return this.checkEndPoint(a);if(_e.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(_e.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(_e.TEST_RAY),a instanceof Qt?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(_e.TEST_RAY),a instanceof Qt?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);_e.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(_e.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var n;if(_e.TEST_RAY_1.copyFrom(t.pointA),_e.TEST_RAY_1.decrementBy(this.curPoint),_e.TEST_RAY_2.copyFrom(t.pointB),_e.TEST_RAY_2.decrementBy(this.curPoint),_e.TEST_RAY_1.y=0,_e.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,_e.TEST_RAY_1,_e.TEST_RAY_2)||this.isPointAtCenter(this.rayB,_e.TEST_RAY_1,_e.TEST_RAY_2)?n=!1:n=!0,n)return this.isPointAtCenter(this.rayA,_e.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return _e.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(_e.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,_e.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1)}calcCrossEdge(e,t,a){return this.calcCrossPoint(e.fatPointA,e.fatPointB,t,a)}calcCrossPoint(e,t,a,r){_e.CALC_CROSS_POINT.copyFrom(t),_e.CALC_CROSS_POINT.decrementBy(e);let i=_e.CALC_CROSS_POINT.x*r.z-r.x*_e.CALC_CROSS_POINT.z;var n=0;return i!=0&&(n=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),n>1?n=1:n<0&&(n=0),_e.CALC_CROSS_POINT.scaleBy(n),_e.CALC_CROSS_POINT.incrementBy(e),_e.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){_e.CALC_CROSS_POINT.copyFrom(t),_e.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(_e.CALC_CROSS_POINT.x*r.z-r.x*_e.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(_e.CALC_CROSS_POINT.scaleBy(i),_e.CALC_CROSS_POINT.incrementBy(e),_e.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){_e.CALC_CROSS_TEST.copyFrom(t),_e.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(_e.CALC_CROSS_TEST.x*r.z-r.x*_e.CALC_CROSS_TEST.z);return i<=1&&i>=0}isPointAtCenter(e,t,a){var r=t.crossProduct(e);if(r.length==0&&e.length<t.length)return!0;var i=a.crossProduct(e);return i.length==0&&e.length<a.length?!0:(r.normalize(),i.normalize(),r.incrementBy(i),r.length<.01)}resetData(){this.cornerEdge=null,this.cornerPoint=null,this.curPoint=null,this.rayA=this.rayB=null,this.rayAPoint=this.rayBPoint=null,_e.RAY_1.setTo(0,0,0),_e.RAY_2.setTo(0,0,0)}}class sr{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new b;constructor(){this._router=new _e}searchPath(e,t,a,r=0){return r<=0&&(r=1),this._aiRadius=r*1.5,this.searchEnable(e,t,a)?(this.search(e,t,a),!0):!1}get path(){return this._result}searchEnable(e,t,a){return!(e==null||t==null||a==null||a[0].plane.classifyPoint(e,is.EPSILON)!=Vr.INTERSECT||a[a.length-1].plane.classifyPoint(t,is.EPSILON)!=Vr.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,n,o,l,c;for(r=0;r<i;r++)o=a[r].getPublicEdge(a[r+1]),o.crossPoint=null,o.initFatPoints(this._aiRadius),this._tempPublicEdgeList.push(o),n=a[r],c=n.plane,n=a[r+1],l=n.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,is.EPSILON)==Vr.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,d,h,u;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],n=a[r+1],u=r==i-1,u?l=t:l=n.getEdgeAgainstPoint(o),h=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,u),h||(f=this._router.cornerPoint,d=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(d),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let m=[];for(let g of this._result)m.push(new b().copyFrom(g));this._result=m}optimusTerminusFat(){var e,t,a;a=this._result[1],a instanceof Fa&&(e=a),a=this._result[this._result.length-2],a instanceof Fa&&(t=a),e&&(this._result[1]=e.scalePoint()),t&&e!=t&&(this._result[this._result.length-2]=t.scalePoint())}pushAllPathPoint2(e,t){var a=this._tempPublicEdgeList.length,r,i;this._result=new Array,this._result.push(e);for(var n=e,o,l,c,f=0;f<a;f++)if(r=this._tempPublicEdgeList[f],l=null,r.crossPoint)l=this.getFatPoint(r,r.crossPoint),l?this._result.push(l):this._result.push(r.crossPoint),n=r.crossPoint;else{i=null,o=null;for(var d=f+1;d<a&&(i=this._tempPublicEdgeList[d],o=i.crossPoint,!o);d++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==n?c=o.clone():(sr.CROSS_TEST_DIRECTION.setTo(o.x-n.x,0,o.z-n.z),c=this._router.calcCrossEdge(r,n,sr.CROSS_TEST_DIRECTION)),this._result.push(c))}this._result.push(t)}optimusByRadius(){var e=new Array;e.length=this._result.length;var t=this._result.length-2,a,r,i,n,o,l,c,f,d,h,u,m,g;for(g=0;g<t;g++)c=f=d=null,n=o=l=null,u=!1,m=null,a=this._result[g],r=this._result[g+1],i=this._result[g+2],a instanceof Fa&&(n=a),r instanceof Fa&&(o=r),i instanceof Fa&&(l=i),n&&(c=n.ownerPoint),o&&(f=o.ownerPoint),l&&(d=l.ownerPoint),c&&f&&c==f&&f!=d&&(u=!0),d&&f&&d==f&&c!=f&&(u=!0),u&&(sr.CROSS_TEST_DIRECTION.copyFrom(a),sr.CROSS_TEST_DIRECTION.decrementBy(i),h=o.ownerEdge,u=this._router.hasCrossPoint(h.pointA,h.pointB,i,sr.CROSS_TEST_DIRECTION),u&&(m=this._router.calcCrossPointOut(f,r,i,sr.CROSS_TEST_DIRECTION)),m&&(e[g+1]=m))}getFatPoint(e,t){if(e==null)return null;var a;t instanceof Fa&&(a=t);var r;return a?r=a.ownerPoint:r=e.getEqualPoint(t),r==null?null:(a=e.getFatPoint(r),a)}}class Eu extends b{_id=0;_plane;_points=new Array;_edges=new Array;_neibourTriangles=new rs;_pointAgainstEdge=new rs;_edgeAgainstPoint=new rs;_mask=0;_aabbBox;f=0;gg=0;h=0;parent;costMultiplier=1;openId=0;closeId=0;get aabb(){return this._aabbBox}initAABB(){this._aabbBox=new Nt,this._aabbBox.addPoint(this._points[0]),this._aabbBox.addPoint(this._points[1]),this._aabbBox.addPoint(this._points[2])}calcGlobalQuadAABB(){}get isTriangle(){return!0}constructor(e,t,a,r){super(0,0,0,0),this._id=e,this._mask=Ur.WalkAble,this._edges.push(t,a,r);var i;for(i of this._edges)this._points.indexOf(i.pointA)==-1&&this._points.push(i.pointA),this._points.indexOf(i.pointB)==-1&&this._points.push(i.pointB);this.x=(this._points[0].x+this._points[1].x+this._points[2].x)/3,this.y=(this._points[0].y+this._points[1].y+this._points[2].y)/3,this.z=(this._points[0].z+this._points[1].z+this._points[2].z)/3,this._plane=new Su,this._plane.fromPoints(this._points[0],this._points[1],this._points[2]),this._plane.normalize(),this.genarateAgainstData(),this.initAABB()}genarateAgainstData(){var e,t;for(e of this._edges)for(t of this._points)e.pointA!=t&&e.pointB!=t&&(this._edgeAgainstPoint.put(e,t),this._pointAgainstEdge.put(t,e))}get id(){return this._id}get plane(){return this._plane}get points(){return this._points}addNeibour(e,t){if(this._edges.indexOf(e)>=0)this._neibourTriangles.put(e,t);else throw new Error("the edge is not in triangle!!!")}getNeibourTriangles(e=null,t=1,a=1){e=e||new Array,e.length=0;var r,i,n=this._neibourTriangles.getKeys(),o;for(o of n)i=o,i.testMask(t)&&(r=this._neibourTriangles.getValueByKey(i),r.testMask(a)&&e.push(r));return e}getEdges(e=null,t=1){e=e||new Array,e.length=0;var a;for(a of this._edges)a.testMask(t)&&e.push(a);return e}get walkAble(){return this.testMask(Ur.WalkAble)}get edges(){return this._edges}testMask(e){return(this._mask&e)==e}getEdgeAgainstPoint(e){return this._edgeAgainstPoint.getValueByKey(e)}getPointAgainstEdge(e){return this._pointAgainstEdge.getValueByKey(e)}getPublicEdge(e){if(e&&e!=this){var t=this._neibourTriangles.getKeys(),a;for(a of t)if(this._neibourTriangles.getValueByKey(a)==e)return a}return null}loopPublicEdge(e){var t,a;if(e&&e!=this){for(t of this._edges)for(a of e._edges)if(t==a)return t}return null}randomPoint(){var e=this._points[2].subtract(this._points[0]);e.scaleBy(Math.random()),e.incrementBy(this._points[0]);var t=this._points[1].subtract(e);return t.scaleBy(Math.random()),t.incrementBy(e),t}}class Lm{_nav3dPoints;_nav3dEdges;_nav3dTriangles;_path;_edgesDict;_nav3dAstar;_nav3dFunnel;_terrainQuad;_triangleList;get edges(){return this._nav3dEdges}get points(){return this._nav3dPoints}get path(){return this._path}get triangles(){return this._nav3dTriangles}constructor(e,t){this._nav3dPoints=new Array,this._nav3dEdges=new Array,this._nav3dTriangles=new Array,this._edgesDict=new rs,this.initPoints(e),this.initEdgesAndTriangles(t),this.createConnections(),this._nav3dAstar=new ku,this._nav3dFunnel=new sr,this._terrainQuad=new Mh(8,128),this._terrainQuad.createQuadTree(this._nav3dTriangles)}getTriangleAtPoint(e,t=5){return this._terrainQuad.getTriangleAtPoint(e,t)}findPath(e,t,a=5){this._path=null,this._triangleList=null;var r=this.getTriangleAtPoint(e,10),i=this.getTriangleAtPoint(t,10),n=this._nav3dAstar.findPath(this,r,i);return n?(this._triangleList=this._nav3dAstar.channel,n=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,n):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new Qt(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,n,o=e.length,l=0;l<o;l++)t=e[l],a=this.tryCreateEdge(t[0],t[1]),r=this.tryCreateEdge(t[1],t[2]),i=this.tryCreateEdge(t[2],t[0]),!(a==null||r==null||i==null)&&(n=new Eu(l,a,r,i),this._nav3dTriangles.push(n))}tryCreateEdge(e,t){if(e==t)throw new Error("edge point index error!!!");if(e>t){var a=e;e=t,t=a}var r=this._edgesDict.getValueByKey(e+"_"+t);return r==null&&(r=new Ea(this._nav3dPoints[e],this._nav3dPoints[t]),this._nav3dEdges.push(r),this._edgesDict.put(e+"_"+t,r)),r}createConnections(){for(var e=this._nav3dTriangles.length,t=this._nav3dTriangles.length,a,r,i,n,o=0;o<e;o++){a=this._nav3dTriangles[o];for(i of a.edges)i.addTriangleOwners(a);for(var l=0;l<t;l++)r=this._nav3dTriangles[l],a!=r&&(n=a.loopPublicEdge(r),n&&(a.addNeibour(n,r),r.addNeibour(n,a)))}}}class _l{x;y;setTo(e,t){this.x=e,this.y=t}equals(e,t){return e==this.x&&t==this.y}equalPoint(e){return this.equals(e.x,e.y)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y)}clone(){var e=new _l;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class za extends Le{width;height;depth;constructor(e=1,t=1,a=1){super(),this.width=e,this.height=t,this.depth=a,this.initVertex()}initVertex(){let e=this.width/2,t=this.height/2,a=this.depth/2;this.bounds=new Ce(b.ZERO.clone(),new b(this.width,this.height,this.depth));let r=new Float32Array([-e,t,a,e,t,a,e,t,-a,-e,t,-a,-e,t,a,e,t,-a,e,-t,a,-e,-t,a,-e,-t,-a,e,-t,-a,e,-t,a,-e,-t,-a,-e,-t,a,-e,t,a,-e,t,-a,-e,-t,-a,-e,-t,a,-e,t,-a,e,t,a,e,-t,a,e,-t,-a,e,t,-a,e,t,a,e,-t,-a,e,t,a,-e,t,a,-e,-t,a,-e,-t,a,e,-t,a,e,t,a,e,-t,-a,-e,-t,-a,-e,t,-a,e,t,-a,e,-t,-a,-e,t,-a]),i=new Float32Array([0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1]),n=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),o=[0,2,1,3,5,4,6,8,7,9,11,10,12,14,13,15,17,16,18,20,19,21,23,22,24,26,25,27,29,28,30,32,31,33,35,34],l=new Uint16Array(o.reverse());this.setIndices(l),this.setAttribute(G.position,r),this.setAttribute(G.normal,i),this.setAttribute(G.uv,n),this.setAttribute(G.TEXCOORD_1,n),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class wu extends Le{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,n=!1,o=0,l=Math.PI*2){super(),this.radiusTop=e,this.radiusBottom=t,this.height=a,this.radialSegments=r,this.heightSegments=i,this.openEnded=n,this.thetaStart=o,this.thetaLength=l,this.instanceID=zt(),this.buildGeometry()}addGroup(e,t,a){this.addSubGeometry({indexStart:e,indexCount:t,vertexStart:e,vertexCount:0,firstStart:0,index:a,topology:0})}buildGeometry(){const e=this;this.radialSegments=Math.floor(this.radialSegments),this.heightSegments=Math.floor(this.heightSegments);const t=[],a=[],r=[],i=[];let n=0;const o=[],l=this.height/2;let c=0;m(),this.openEnded===!1&&(this.radiusTop>0&&g(!0),this.radiusBottom>0&&g(!1));let f=new Float32Array(t),d=new Float32Array(a),h=new Float32Array(r),u=new Uint16Array(i);this.setAttribute(G.position,f),this.setAttribute(G.normal,d),this.setAttribute(G.uv,h),this.setAttribute(G.TEXCOORD_1,h),this.setIndices(u);function m(){const p=new b,D=new b;let A=0;const B=(e.radiusBottom-e.radiusTop)/e.height;for(let v=0;v<=e.heightSegments;v++){const U=[],y=v/e.heightSegments,S=y*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let F=0;F<=e.radialSegments;F++){const C=F/e.radialSegments;let w=C*e.thetaLength+e.thetaStart;F==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(w=0);const E=Math.sin(w),Q=Math.cos(w);D.x=S*E,D.y=-y*e.height+l,D.z=S*Q,t.push(D.x,D.y,D.z),p.set(E,B,Q).normalize(),a.push(p.x,p.y,p.z),r.push(C,1-y),U.push(n++)}o.push(U)}for(let v=0;v<e.radialSegments;v++)for(let U=0;U<e.heightSegments;U++){const y=o[U][v],S=o[U+1][v],F=o[U+1][v+1],C=o[U][v+1];i.push(y,S,C),i.push(S,F,C),A+=6}e.addGroup(c,A,0),c+=A}function g(p){const D=n,A=new de,B=new b;let v=0;const U=p===!0?e.radiusTop:e.radiusBottom,y=p===!0?1:-1;for(let F=1;F<=e.radialSegments;F++)t.push(0,l*y,0),a.push(0,y,0),r.push(.5,.5),n++;const S=n;for(let F=0;F<=e.radialSegments;F++){const w=F/e.radialSegments*e.thetaLength+e.thetaStart,E=Math.cos(w),Q=Math.sin(w);B.x=U*Q,B.y=l*y,B.z=U*E,t.push(B.x,B.y,B.z),a.push(0,y,0),A.x=E*.5+.5,A.y=Q*.5*y+.5,r.push(A.x,A.y),n++}for(let F=0;F<e.radialSegments;F++){const C=D+F,w=S+F;p===!0?i.push(w,w+1,C):i.push(w+1,w,C),v+=3}e.addGroup(c,v,p===!0?1:2),c+=v}}}class Iu extends Le{radius;tube;radialSegments;tubularSegments;constructor(e=.4,t=.1,a=32,r=32){super(),this.radius=e,this.tube=t,this.radialSegments=a,this.tubularSegments=r,this.initVertex()}initVertex(){const e=2*Math.PI,t=this.radius,a=this.tube,r=this.radialSegments,i=this.tubularSegments;this.bounds=new Ce(b.ZERO.clone(),new b(t*2,a*2,t*2));var n=(r+1)*(i+1);let o=new Float32Array(n*3),l=new Float32Array(n*3),c=new Float32Array(n*2),f=new Uint16Array(r*i*2*3),d=0,h=0,u=0,m=0;for(let g=0;g<=r;g++)for(let p=0;p<=i;p++){const D=p/i,A=g/r,B=D*e,v=A*Math.PI*2;if(o[d++]=(t+a*Math.cos(v))*Math.sin(B),o[d++]=a*Math.sin(v),o[d++]=(t+a*Math.cos(v))*Math.cos(B),l[h++]=Math.sin(B)*Math.cos(v),l[h++]=Math.sin(v),l[h++]=Math.cos(B)*Math.cos(v),c[u++]=D,c[u++]=A,p<i&&g<r){const U=i+1,y=U*g+p,S=U*(g+1)+p,F=U*(g+1)+p+1,C=U*g+p+1;f[m++]=y,f[m++]=C,f[m++]=S,f[m++]=C,f[m++]=F,f[m++]=S}}this.setIndices(f),this.setAttribute(G.position,o),this.setAttribute(G.normal,l),this.setAttribute(G.uv,c),this.setAttribute(G.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class Gm extends Le{segment;row=0;constructor(e){super(),this.segment=e,this.buildGeometry()}buildGeometry(){this.row=this.segment+1;let e=new Uint32Array(this.segment*6),t=new Float32Array(this.row*3*2),a=new Float32Array(this.row*3*2),r=new Float32Array(this.row*2*2);for(let i=0;i<this.row;i++){t[i*3*2+0]=0,t[i*3*2+1]=0,t[i*3*2+2]=0,t[i*3*2+3]=0,t[i*3*2+4]=0,t[i*3*2+5]=0,a[i*3*2+0]=0,a[i*3*2+1]=0,a[i*3*2+2]=1,a[i*3*2+3]=0,a[i*3*2+4]=0,a[i*3*2+5]=1,r[i*2*2+0]=0,r[i*2*2+1]=i/this.segment,r[i*2*2+2]=1,r[i*2*2+3]=i/this.segment;let n=i*2,o=n,l=n+1,c=n+2,f=n+3;e[i*6+0]=o,e[i*6+1]=l,e[i*6+2]=c,e[i*6+3]=l,e[i*6+4]=f,e[i*6+5]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class zm extends Le{faceCount=0;constructor(e){super(),this.faceCount=e,this.buildGeometry()}buildGeometry(){let e=new Uint32Array(this.faceCount*3),t=new Float32Array(this.faceCount*3*3),a=new Float32Array(this.faceCount*3*3),r=new Float32Array(this.faceCount*3*2),i=new Float32Array(this.faceCount*3*1);for(let n=0;n<this.faceCount;n++){let o=n*3+0,l=n*3+1,c=n*3+2;e[o]=o,e[l]=l,e[c]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.setAttribute(G.vIndex,i),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class Wm extends Gs{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new Ts;let t=[];return _.res.fillColor(t,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.create(this._minSize,this._minSize,t,!1),this.createFromTexture(this._minSize,this._internalTexture),this}changeColor(e){return this._skyColor=e,_.res.fillColor(this._internalTexture.floatArray,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.updateTexture(this._minSize,this._minSize,this._internalTexture.floatArray,!1),this._faceData.uploadTexture(0,this._internalTexture),this}get color(){return this._skyColor}set color(e){this.changeColor(e)}}class Jm extends ne{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new ne,t=new ne,a=new ne,r=new za(2,2,2),i=new za(2,2,2),n=new za(2,2,2),o=new Bt;o.baseColor=new J(1,0,0);let l=new Bt;l.baseColor=new J(0,1,0);let c=new Bt;c.baseColor=new J(0,0,1);let f=e.addComponent(he),d=t.addComponent(he),h=a.addComponent(he);f.geometry=r,f.material=o,f.castShadow=!1,d.geometry=i,d.material=l,d.castShadow=!1,h.geometry=n,h.material=c,h.castShadow=!1,e.localScale=new b(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new b(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new b(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class jm{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Le,i=e.getAttribute(G.position).data.length/3,n=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let d=f[1].attribute;if(d==G.indices)continue;let h=e.getAttribute(d).data,u=h.length,m=new Float32Array(u*t);for(let g=0;g<t;g++){m.set(h,u*g);for(let p=0;p<i;p++)n[i*g+p]=g}r.setAttribute(d,m)}r.setAttribute(G.vIndex,n);let o=e.getAttribute(G.indices).data,l=o.length,c=new Uint32Array(o.length*t);for(let f=0;f<t;f++)for(let d=0;d<l;d++){let h=f*i,u=f*l;const m=o[d]+h;c[u+d]=m}return r.setIndices(c),r.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,index:0,vertexCount:0,firstStart:0,topology:0}),r}static generateNormal(){}static generateTangent(){}static packUV(){}}class Zm extends ne{size=100;divisions=10;constructor(e=100,t=10){super(),this.size=e,this.divisions=t,this.buildGeometry(),this.addAxis()}buildGeometry(){const e=[],t=[],a=this.size/this.divisions,r=this.size/2,i=this.divisions/2;for(let c=0,f=-r;c<=this.divisions;c++,f+=a)c!==i&&(e.push(-r,0,f,r,0,f),e.push(f,0,-r,f,0,r));for(let c=0;c<e.length/3;c+=2)t.push(c,c+1);let n=new Le;n.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),n.setAttribute(G.position,new Float32Array(e)),n.addSubGeometry({indexStart:0,indexCount:t.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let o=new Bt;o.topology="line-list",o.baseColor=new J(1,1,1,.15),o.blendMode=De.ADD,o.castReflection=!1;let l=this.addComponent(he);l.geometry=n,l.material=o}addAxis(){const e=this.size/2;let t=new Float32Array([-e,0,0,e,0,0]),a=new Uint16Array([0,1,2,3]),r=new Le;r.setIndices(a),r.setAttribute(G.position,t),r.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});{let i=new ne,n=i.addComponent(he);n.geometry=r;let o=n.material=new Bt;o.baseColor=new J(1,0,0,.5),o.blendMode=De.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new ne;i.rotationY=90;let n=i.addComponent(he);n.geometry=r;let o=n.material=new Bt;o.baseColor=new J(0,1,0,.5),o.blendMode=De.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class Ym{static color_temperature_to_rgb(e){e<1e3?e=1e3:e>4e4&&(e=4e4);let t=e/100,a=this.get_red(t),r=this.get_green(t),i=this.get_blue(t);return new J(a/255,r/255,i/255,1)}static get_red(e){if(e<=66)return 255;let t=329.698727446*Math.pow(e-60,-.1332047592);return this.bound(t)}static get_green(e){let t=0;return e<=66?t=99.4708025861*Math.log(e)-161.1195681661:t=288.1221695283*Math.pow(e-60,-.0755148492),this.bound(t)}static get_blue(e){let t=0;return e>=66?255:e<=19?0:(t=138.5177312231*Math.log(e-10)-305.0447927307,this.bound(t))}static bound(e,t=0,a=255){let r=Math.max(e,t);return Math.min(r,a)}}class Xm{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new za),this.planeGeo||(this.planeGeo=new si(1,1,1,1,b.UP)),this.sphere||(this.sphere=new Nr(1,35,35)),this.material||(this.material=new ta),this.materialMap||(this.materialMap=new Map)}static get CubeMesh(){return this.initHeap(),this.boxGeo}static get SphereMesh(){return this.initHeap(),this.sphere}static GetCube(){this.initHeap();let e=new ne,t=e.addComponent(he);return t.geometry=this.boxGeo,t.material=this.material.clone(),t.castShadow=!0,e}static GetMaterial(e){let t=this.materialMap.get(e);return t||(t=new ta,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new ne,a=t.addComponent(he);a.geometry=this.planeGeo;let r=this.GetMaterial(e);return r.blendMode=De.ADD,r.castShadow=!1,a.material=r,a.castGI=!1,a.castReflection=!1,t}static GetSingleCube(e,t,a,r,i,n){this.initHeap();let o=new ta;o.roughness=.5,o.metallic=.1,o.baseColor=new J(r,i,n,1);let l=new ne,c=l.addComponent(he);return c.castGI=!0,c.geometry=new za(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new ta;i.baseColor=new J(t,a,r,1);let n=new ne,o=n.addComponent(he);return o.castGI=!0,o.geometry=new Nr(e,20,20),o.material=i,n}static get Sphere(){this.initHeap();let e=new ne,t=e.addComponent(he);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new ne,r=a.addComponent(he);return r.castShadow=!1,r.geometry=new za(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,n,o=1,l=!0){let c=new ne,f=c.addComponent(oi);f.lightColor=new J(r,i,n,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let d=this.GetSingleSphere(.1,1,1,1);return c.addChild(d),f}}var P=(s=>(s[s.X=0]="X",s[s.Y=1]="Y",s[s.Z=2]="Z",s[s.XY=3]="XY",s[s.XZ=4]="XZ",s[s.YZ=5]="YZ",s[s.XYZ=6]="XYZ",s[s.MAX=7]="MAX",s[s.NONE=8]="NONE",s))(P||{}),ha=(s=>(s[s.Local=0]="Local",s[s.Global=1]="Global",s))(ha||{});class on extends et{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(P.MAX),this.mAxisColor=new Array(P.MAX),this.mAxisMaterial=new Array(P.MAX),this.mAxisCollider=new Array(P.MAX)}get target(){return this.object3D.target}get mX(){return this.object3D.mXObj}get mY(){return this.object3D.mYObj}get mZ(){return this.object3D.mZObj}get transformSpaceMode(){return this.object3D.transformSpaceMode}init(e){this.mContainer=new ne;let t=new Bt;t.baseColor=new J(1,0,0),t.depthCompare=ft.always,this.mAxisColor[P.X]=t.baseColor,this.mAxisMaterial[P.X]=t;let a=new Bt;a.baseColor=new J(0,1,0),a.depthCompare=ft.always,this.mAxisColor[P.Y]=a.baseColor,this.mAxisMaterial[P.Y]=a;let r=new Bt;r.baseColor=new J(0,0,1),r.depthCompare=ft.always,this.mAxisColor[P.Z]=r.baseColor,this.mAxisMaterial[P.Z]=r;let i=this.createCustomAxis(P.X),n=this.createCustomAxis(P.Y),o=this.createCustomAxis(P.Z);this.mContainer.addChild(this.mAxis[P.X]=i),this.mContainer.addChild(this.mAxis[P.Y]=n),this.mContainer.addChild(this.mAxis[P.Z]=o),this.mAxisCollider[P.X]=i.getComponent(da),this.mAxisCollider[P.Y]=n.getComponent(da),this.mAxisCollider[P.Z]=o.getComponent(da)}start(){}onEnable(e){this.object3D.addChild(this.mContainer),this.reset()}onDisable(e){this.object3D.removeChild(this.mContainer)}reset(){switch(this.transformSpaceMode){case ha.Local:{let t=R.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).decompose();this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=t[1].x,this.object3D.rotationY=t[1].y,this.object3D.rotationZ=t[1].z,this.object3D.x=t[0].x,this.object3D.y=t[0].y,this.object3D.z=t[0].z}break;case ha.Global:{this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=0,this.object3D.rotationY=0,this.object3D.rotationZ=0;const e=this.mX.transform.worldPosition;this.object3D.x=e.x,this.object3D.y=e.y,this.object3D.z=e.z}break}}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY),r,i;for(let n=0;n<=P.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||n==P.XYZ)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},n==P.XYZ)))break}return i}currentAxis=P.NONE;beginPoint=new b;beginMousePos=new b;currentPoint=new b;onMouseDown(e){if(e.mouseCode!=Ys.MOUSE_LEFT)return;let t=this.pickAxis();if(!t)return;this.currentAxis=t.axis,e.stopImmediatePropagation();const r=this.object3D.transform.scene3D.view.camera;let i=r.worldToScreenPoint(this.mX.transform.worldPosition),n=r.screenPointToWorld(_.inputSystem.mouseX,_.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(n),this.beginMousePos.x=_.inputSystem.mouseX,this.beginMousePos.y=_.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==P.NONE){let t=this.lastMoveObj.getComponent(he).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==P.XYZ&&(this.mAxis[P.X].getComponent(he).material.setUniformColor("baseColor",this.mAxisColor[P.X]),this.mAxis[P.Y].getComponent(he).material.setUniformColor("baseColor",this.mAxisColor[P.Y]),this.mAxis[P.Z].getComponent(he).material.setUniformColor("baseColor",this.mAxisColor[P.Z])),this.lastMoveAxis=P.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new J(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==P.XYZ&&(this.mAxis[P.X].getComponent(he).material.setUniformColor("baseColor",new J(1,1,1)),this.mAxis[P.Y].getComponent(he).material.setUniformColor("baseColor",new J(1,1,1)),this.mAxis[P.Z].getComponent(he).material.setUniformColor("baseColor",new J(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(_.inputSystem.mouseX,_.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let n=i.subtract(this.beginPoint);b.HELP_0.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let o=b.distance(b.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(b.HELP_0),this.transformSpaceMode){case ha.Local:this.applyLocalTransform(this.currentAxis,n,o);break;case ha.Global:this.applyGlobalTransform(this.currentAxis,n,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Ys.MOUSE_LEFT&&(this.currentAxis=P.NONE,this.reset())}onUpdate(e){let a=b.distance(e.camera.transform.worldPosition,this.object3D.transform.worldPosition)/100;if(this.mContainer.scaleX=this.mContainer.scaleY=this.mContainer.scaleZ=a,this.mX){const r=this.mX.transform.worldPosition;this.object3D.x=r.x,this.object3D.y=r.y,this.object3D.z=r.z}}applyLocalTransform(e,t,a){console.warn("not imp")}applyGlobalTransform(e,t,a){console.warn("not imp")}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=0,a=0,r=0;switch(e){case P.X:t=1;break;case P.Y:a=1;break;case P.Z:r=1;break}let i=.4+t*20,n=.4+a*20,o=.4+r*20,l=new ne;l.x=i*.5,l.y=n*.5,l.z=o*.5;let c=l.addComponent(he);c.geometry=new za(i,n,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(da),d=new bi;return d.setFromCenterAndSize(new b(0,0,0),new b(i+1,n+1,o+1)),f.shape=d,l}}class Ru extends on{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new J(.9,.9,.9),t.depthCompare=ft.always,this.mAxisColor[P.XYZ]=t.baseColor,this.mAxisMaterial[P.XYZ]=t;let a=new ne,r=a.addComponent(he);r.geometry=new za(2,2,2),r.material=this.mAxisMaterial[P.XYZ];let i=a.addComponent(da),n=new bi;n.setFromCenterAndSize(new b(0,0,0),new b(2,2,2)),i.shape=n,this.mContainer.addChild(this.mAxis[P.XYZ]=a),this.mAxisCollider[P.XYZ]=a.getComponent(da)}applyLocalTransform(e,t,a){switch(this.currentAxis){case P.XYZ:{let r=0;Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?r=t.x:r=t.z:r=t.y,this.mX.scaleX+=r,this.mX.scaleY+=r,this.mX.scaleZ+=r}break;default:this.mX.transform.worldMatrix.transformVector(t,t),(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=b.HELP_0;r.set(0,0,0),(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ)&&(r.x=t.x),(this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ)&&(r.y=t.y),(this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,b.HELP_1),this.mX.scaleX+=b.HELP_1.x,this.mX.scaleY+=b.HELP_1.y,this.mX.scaleZ+=b.HELP_1.z}createCustomAxis(e){let t=super.createAxis(e),a=this.createBox(e);return t.addChild(a),t}createBox(e){let t=0,a=0,r=0,i=new ne;switch(e){case P.X:t=1,i.rotationZ=-90;break;case P.Y:a=1;break;case P.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(he);return c.geometry=new za(2,2,2),c.material=this.mAxisMaterial[e],i}}var mt=(s=>(s[s.Scale=0]="Scale",s[s.Rotation=1]="Rotation",s[s.Translation=2]="Translation",s[s.NONE=3]="NONE",s))(mt||{});class Qu extends on{applyLocalTransform(e,t,a){if(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ,this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ){R.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),R.help_matrix_1.identity(),R.help_matrix_1.createByRotation(1,b.Y_AXIS),R.help_matrix_2.multiplyMatrices(R.help_matrix_1,R.help_matrix_0),R.help_matrix_2.invert(),R.help_matrix_1.multiplyMatrices(R.help_matrix_2,R.help_matrix_0);let r=R.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY),this.currentAxis==P.X){let r=t.worldToScreenPoint(a);b.HELP_1.set(r.x,r.y,0),b.HELP_2.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let i=b.HELP_2.subtract(b.HELP_1),n=b.getAngle(b.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.x-a.x>0&&(n=360-n),n}if(this.currentAxis==P.Y){let r=t.worldToScreenPoint(a);b.HELP_1.set(r.x,r.y,0),b.HELP_2.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let i=b.HELP_2.subtract(b.HELP_1),n=b.getAngle(b.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.y-a.y>0&&(n=360-n),n}if(this.currentAxis==P.Z){let r=t.worldToScreenPoint(a);b.HELP_1.set(r.x,r.y,0),b.HELP_2.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let i=b.HELP_2.subtract(b.HELP_1),n=b.getAngle(b.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.z-a.z>0&&(n=360-n),n}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==P.X||this.currentAxis==P.Y||this.currentAxis==P.Z){let r=this.getAngle();switch(R.help_matrix_0.identity(),this.currentAxis){case P.X:R.help_matrix_0.createByRotation(this.mLastAngle-r,b.X_AXIS);break;case P.Y:R.help_matrix_0.createByRotation(this.mLastAngle-r,b.Y_AXIS);break;case P.Z:R.help_matrix_0.createByRotation(this.mLastAngle-r,b.Z_AXIS);break}R.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),R.help_matrix_1.append(R.help_matrix_0),this.mX.parent&&(R.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),R.help_matrix_2.invert(),R.help_matrix_1.multiply(R.help_matrix_2));let n=R.help_matrix_1.decompose(na.QUATERNION)[1];se.HELP_0.set(n.x,n.y,n.z,n.w),this.mLastAngle=r,this.mX.transform.localRotQuat=se.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=P.NONE&&(this.mAxis[P.X].getComponent(he).enable=!1,this.mAxis[P.Y].getComponent(he).enable=!1,this.mAxis[P.Z].getComponent(he).enable=!1,this.mAxis[this.currentAxis].getComponent(he).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==P.NONE&&(this.mAxis[P.X].getComponent(he).enable=!0,this.mAxis[P.Y].getComponent(he).enable=!0,this.mAxis[P.Z].getComponent(he).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new ne;switch(e){case P.X:t.rotationZ=90;break;case P.Y:break;case P.Z:t.rotationX=90;break}let a=t.addComponent(he);a.geometry=new Iu(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new bi;return i.setFromCenterAndSize(new b,new b(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY),r,i;for(let n=0;n<=P.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r)){let l=b.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class Tu extends on{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new J(0,0,1),t.depthCompare=ft.always,this.mAxisColor[P.XY]=t.baseColor,this.mAxisMaterial[P.XY]=t;let a=new Bt;a.doubleSide=!0,a.baseColor=new J(0,1,0),a.depthCompare=ft.always,this.mAxisColor[P.XZ]=a.baseColor,this.mAxisMaterial[P.XZ]=a;let r=new Bt;r.doubleSide=!0,r.baseColor=new J(1,0,0),r.depthCompare=ft.always,this.mAxisColor[P.YZ]=r.baseColor,this.mAxisMaterial[P.YZ]=r;let i=this.createPlane(P.XY),n=this.createPlane(P.XZ),o=this.createPlane(P.YZ);this.mContainer.addChild(this.mAxis[P.XY]=i),this.mContainer.addChild(this.mAxis[P.XZ]=n),this.mContainer.addChild(this.mAxis[P.YZ]=o),this.mAxisCollider[P.XY]=i.getComponent(da),this.mAxisCollider[P.XZ]=n.getComponent(da),this.mAxisCollider[P.YZ]=o.getComponent(da)}applyLocalTransform(e,t,a){R.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),R.help_matrix_0.transformVector(t,b.HELP_0),this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ||(b.HELP_0.x=0),this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ||(b.HELP_0.y=0),this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ||(b.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(b.HELP_0,b.HELP_1),this.mX.x+=b.HELP_1.x,this.mX.y+=b.HELP_1.y,this.mX.z+=b.HELP_1.z}applyGlobalTransform(e,t,a){R.help_matrix_0.identity(),(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ)&&R.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ)&&R.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ)&&R.help_matrix_0.appendTranslation(0,0,t.z),R.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),R.help_matrix_1.append(R.help_matrix_0),this.mX.parent&&(R.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),R.help_matrix_2.invert(),R.help_matrix_1.multiply(R.help_matrix_2));let r=R.help_matrix_1.decompose(na.QUATERNION);this.mX.transform.localPosition=r[0],console.log(this.target.localPosition)}createCustomAxis(e){let t=super.createAxis(e),a=this.createArrows(e);return t.addChild(a),t}createArrows(e){let t=0,a=0,r=0,i=new ne;switch(e){case P.X:t=1,i.rotationZ=-90;break;case P.Y:a=1,i.rotationY=-90;break;case P.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(he);return c.geometry=new wu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new ne,a=t.addComponent(he);a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new bi;switch(r.shape=i,e){case P.XY:a.geometry=new si(4,4,1,1,b.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new b(0,0,0),new b(4,4,.1));break;case P.XZ:a.geometry=new si(4,4,1,1,b.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new b(0,0,0),new b(4,.1,4));break;case P.YZ:a.geometry=new si(4,4,1,1,b.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new b(0,0,0),new b(.1,4,4));break}return t}}class Bl extends ne{static _instance;static get instance(){return this._instance||(this._instance=new Bl),this._instance}mTarget;mTransformMode=mt.NONE;mTransformSpaceType=ha.Global;mControllers;mXObj;mYObj;mZObj;constructor(){super(),this.mControllers=[null,null,null],this.mControllers[mt.Scale]=this.addComponent(Ru),this.mControllers[mt.Rotation]=this.addComponent(Qu),this.mControllers[mt.Translation]=this.addComponent(Tu),this.mControllers[mt.Scale].enable=!1,this.mControllers[mt.Rotation].enable=!1,this.mControllers[mt.Translation].enable=!1,this.mXObj=new ne,this.mYObj=new ne,this.mZObj=new ne,this.mXObj.addChild(this.mYObj),this.mYObj.addChild(this.mZObj)}get transformMode(){return this.mTransformMode}get transformSpaceMode(){return this.mTransformSpaceType}active(e){e.addChild(this),e.addChild(this.mXObj)}unActive(e){e.removeChild(this)}get target(){return this.mTarget}selectObject(e,t,a){this.mTarget!=e&&(e?this.activate():this.unactivate(),this.mTarget=e,this.mXObj.localPosition=e.transform.worldPosition.clone()),t!=null&&this.selectTransformMode(t),a!=null&&this.selectTransformSpaceMode(a)}selectTransformMode(e){this.mTransformMode!=e&&(this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!1),this.mTransformMode=e,this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!0))}selectTransformSpaceMode(e){this.mTransformSpaceType!=e&&(this.mTransformSpaceType=e,this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].reset())}activate(){_.inputSystem.addEventListener(Ma.KEY_DOWN,this.onKeyDown,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onMouseDown,this,null,99999),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onMouseMove,this,null,99999),_.inputSystem.addEventListener(Z.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){_.inputSystem.removeEventListener(Ma.KEY_DOWN,this.onKeyDown,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.onMouseDown,this),_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.onMouseMove,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.onMouseUp,this)}onKeyDown(e){switch(e.keyCode){case tt.Key_R:this.selectTransformMode(mt.Scale),this.selectTransformSpaceMode(ha.Local);break;case tt.Key_E:this.selectTransformMode(mt.Rotation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_W:this.selectTransformMode(mt.Translation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_A:this.selectTransformSpaceMode(ha.Local);break;case tt.Key_S:this.selectTransformSpaceMode(ha.Global);break}}onMouseDown(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseDown(e)}onMouseMove(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseMove(e)}onMouseUp(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseUp(e)}}const Hm=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{mf as AccelerateDecelerateInterpolator,gf as AccelerateInterpolator,Li as AnimationCurve,xr as AnimationCurveT,Yr as AnimationMonitor,er as AnimatorComponent,xg as AnimatorEventKeyframe,_f as AnticipateInterpolator,As as AnticipateOvershootInterpolator,Ju as ArrayHas,ju as ArrayItemIndex,od as AtlasParser,gg as AtmosphericComponent,Kd as AtmosphericScatteringSky,Hd as AtmosphericScatteringSkySetting,Xd as AtmosphericScatteringSky_shader,sh as AttributeAnimCurve,Jm as AxisObject,rr as B3DMLoader,Yf as B3DMLoaderBase,ko as B3DMParseUtil,So as B3DMParser,ed as BRDFLUT,td as BRDFLUTGenerate,rc as BRDF_frag,Ls as BatchTable,vm as BiMap,fs as BillboardComponent,pr as BillboardType,Ec as BitUtil,$a as BitmapTexture2D,Kc as BitmapTexture2DArray,Bo as BitmapTextureCube,Xc as Blend,Hc as BlendFactor,De as BlendMode,tl as BlendShapeData,el as BlendShapePropertyData,_p as BloomPost,Vf as BlurEffectCreatorBlur_cs,Pf as BlurEffectCreatorSample_cs,Of as BlurTexture2DBufferCreator,aa as BounceInterpolator,qn as BoundUtil,Ce as BoundingBox,Lr as BoundingSphere,Xr as BoundingVolume,bi as BoxColliderShape,za as BoxGeometry,Zl as BrdfLut_frag,sc as BsDF_frag,ic as BxDF_frag,cc as BxdfDebug_frag,Dn as BytesArray,pt as CEvent,Za as CEventDispatcher,ys as CEventListener,lr as CResizeEvent,sa as CSM,ti as Camera3D,Ig as CameraControllerBase,nt as CameraType,bt as CameraUtil,$g as CapsuleColliderShape,d0 as CastPointShadowMaterialPass,f0 as CastShadowMaterialPass,nc as Clearcoat_frag,z0 as ClusterBoundsSource_cs,Et as ClusterConfig,Tl as ClusterDebug_frag,mc as ClusterLight,G0 as ClusterLightingBuffer,J0 as ClusterLightingRender,W0 as ClusterLighting_cs,g0 as CollectInfo,da as ColliderComponent,gt as ColliderShape,ui as ColliderShapeType,J as Color,xm as ColorGradient,Am as ColorLitMaterial,Jd as ColorLitShader,ng as ColorPassFragmentOutput,L0 as ColorPassRenderer,Fs as ColorUtil,_n as ComData,Pd as Combine_cs,Jl as Common_frag,jl as Common_vert,et as ComponentBase,Oe as ComponentCollect,ni as ComputeGPUBuffer,Fe as ComputeShader,Fl as Context3D,io as CubeCamera,Lf as CubeMapFaceEnum,Sn as CubeSky_Shader,rn as CubicBezierCurve,Um as CubicBezierPath,Du as CubicBezierType,Bf as CycleInterpolator,wu as CylinderGeometry,of as DDGIIrradianceComputePass,vs as DDGIIrradianceGPUBufferReader,R0 as DDGIIrradianceVolume,nf as DDGIIrradiance_shader,df as DDGILightingPass,ff as DDGILighting_shader,cf as DDGIMultiBouncePass,hf as DDGIProbeRenderer,Dt as DEGREES_TO_RADIANS,Uf as DRACO_DECODER_GLTF_JS,pf as DecelerateInterpolator,Vd as Denoising_cs,X0 as Depth2DTextureArray,Z0 as DepthCubeArrayTexture,h0 as DepthMaterialPass,Bp as DepthOfFieldPost,vd as DepthOfView_cs,Qi as DirectLight,rs as DoubleArray,Kr as EditorInspector,_ as Engine3D,I0 as Entity,p0 as EntityBatchCollect,q as EntityCollect,Yl as EnvMap_frag,Yt as ErpImage2CubeMap,Gf as ErpImage2CubeMapCreateCube_cs,zf as ErpImage2CubeMapRgbe2rgba_cs,ip as ExtrudeGeometry,_r as FAILED,Ca as FASTFLOOR,so as FXAAPost,af as FXAAShader,Hl as FastMathShader,wh as FatLineGeometry,qh as FatLineMaterial,mi as FatLineRenderer,Ki as FatLineShader,Mc as FatLine_FS,Tc as FatLine_VS,Mi as FeatureTable,It as FileLoader,Rg as FirstPersonCameraController,Ts as Float16ArrayTexture,w0 as Float32ArrayTexture,Qg as FlyCameraController,id as FontChar,ad as FontInfo,rd as FontPage,ir as FontParser,bf as ForwardRenderJob,En as FragmentOutput,ql as FragmentVarying,Lo as FrameCache,On as Frustum,Yc as FrustumCSM,sg as FrustumCulling_cs,fc as FullQuad_vert_wgsl,ve as GBufferFrame,c0 as GBufferPass,vp as GBufferPost,wc as GBufferStand,wn as GBuffer_pass,Do as GILighting,Fh as GIProbeMaterial,jo as GIProbeMaterialType,jd as GIProbeShader,no as GIRenderCompleteEvent,Ms as GIRenderStartEvent,Mf as GLBChunk,Tf as GLBHeader,_o as GLBParser,qc as GLSLLexer,Ui as GLSLLexerToken,$c as GLSLPreprocessor,r0 as GLSLSyntax,Kf as GLTFBinaryExtension,zp as GLTFMaterial,xt as GLTFParser,Ps as GLTFSubParser,yf as GLTFSubParserCamera,Qf as GLTFSubParserConverter,Sf as GLTFSubParserMaterial,Cf as GLTFSubParserMesh,Ao as GLTFSubParserSkeleton,Ff as GLTFSubParserSkin,oa as GLTFType,fb as GLTF_Accessors,Ns as GLTF_Info,nb as GLTF_Light,cb as GLTF_Mesh,ob as GLTF_Node,lb as GLTF_Primitives,sb as GLTF_Scene,Kt as GPUAddressMode,Zu as GPUBlendFactor,Ya as GPUBufferBase,Aa as GPUBufferType,ft as GPUCompareFunction,k as GPUContext,Lt as GPUCullMode,hr as GPUFilterMode,Ss as GPUPrimitiveTopology,oe as GPUTextureFormat,xi as GPUVertexFormat,Hu as GPUVertexStepMode,Ai as GSplatFormat,Xn as GSplatGeometry,Yn as GSplatMaterial,ii as GSplatRenderer,Si as GSplatShader,Zi as GSplatStreamRenderer,_0 as GSplat_FS,D0 as GSplat_VS,xp as GTAOPost,xd as GTAO_cs,nd as GUIAtlasTexture,ds as GUICanvas,Pr as GUIConfig,dh as GUIGeometry,uh as GUIGeometryRebuild,Wo as GUIMaterial,uf as GUIPassRenderer,mh as GUIPick,_h as GUIPickHelper,Ja as GUIQuad,ot as GUIQuadAttrEnum,bh as GUIRenderer,zo as GUIShader,fa as GUISpace,ci as GUISprite,Fr as GUITexture,Vp as GaussianSplatParser,gc as GenerayRandomDir,Lp as GeoJsonParser,Gp as GeoJsonUtil,Xs as GeoType,Le as GeometryBase,x0 as GeometryIndicesBuffer,jm as GeometryUtil,B0 as GeometryVertexBuffer,kt as GeometryVertexType,kl as GetComponentClass,yn as GetCountInstanceID,s2 as GetRepeat,El as GetShader,og as GlassShader,xe as GlobalBindGroup,Ln as GlobalBindGroupLayout,Up as GlobalFog,Oo as GlobalFog_shader,Zg as GlobalIlluminationComponent,Fn as GlobalUniform,$n as GlobalUniformGroup,yp as GodRayPost,Ud as GodRay_cs,Zm as GridObject,xo as HDRTexture,Os as HDRTextureCube,Ac as Hair_frag,lg as Hair_shader_op,cg as Hair_shader_tr,Is as HaltonSeq,xh as Horizontal,Tg as HoverCameraController,ka as I3DMLoader,qf as I3DMLoaderBase,Eo as I3DMParser,jf as IBLEnvMapCreator,Jf as IBLEnvMapCreator_cs,Ia as IESProfiles,ec as IESProfiles_frag,op as IKDTreeUserData,hi as ImageType,v0 as IndicesGPUBuffer,Wl as Inline_vert,Sl as InputSystem,Yg as InstanceDrawComponent,Xl as InstanceUniform,$f as InstancedMesh,Sr as Interpolator,oo as InterpolatorEnum,Gh as IrradianceDataReaderCompleteEvent,zl as IrradianceVolumeData_frag,ac as Irradiance_frag,zu as IsEditorInspector,xn as IsNonSerialize,kf as Joint,mo as JointPose,Df as JumperInterpolator,cp as KDTreeEntity,yr as KDTreeNode,Rh as KDTreeRange,Qh as KDTreeSpace,gs as KDTreeUUID,po as KHR_draco_mesh_compression,Wp as KHR_lights_punctual,wf as KHR_materials_clearcoat,If as KHR_materials_emissive_strength,Jp as KHR_materials_ior,Rf as KHR_materials_unlit,gd as KMZParser,$o as KV,Ym as KelvinUtil,tt as KeyCode,Ma as KeyEvent,Js as Keyframe,as as KeyframeT,Kh as LASLoader,Yp as LASParser,Jt as LASUtils,Di as LASVisualizationMode,Gs as LDRTextureCube,La as LOADED,al as LOADING,du as LRUCache,Dm as LambertMaterial,_c as Lambert_shader,js as Light,Ri as LightBase,ws as LightData,Q0 as LightEntries,ht as LightType,Ml as LightingFunction_frag,Ut as Line,Ah as LineClassification,Af as LinearInterpolator,ta as LitMaterial,Ks as LitSSSShader,qs as LitShader,oc as Lit_shader,Er as LoaderBase,fp as LoaderEvent,An as LoaderManager,e2 as MAX_VALUE,t2 as MIN_VALUE,vt as Material,o0 as MaterialDataUniformGPUBuffer,Hs as MaterialUtilities,Nl as MathShader,Gt as MathUtil,Gr as Matrix3,R as Matrix4,N0 as MatrixBindGroup,M0 as MatrixGPUBuffer,pc as MatrixShader,cr as MemoryDO,Il as MemoryInfo,up as MergeRGBACreator,yd as MergeRGBA_cs,mn as MeshColliderShape,Zs as MeshFilter,he as MeshRenderer,Fm as MinMaxAnimationCurves,Cu as MinMaxCurve,yu as MinMaxCurveState,km as MinMaxPolyCurves,mp as MorePassParser,Oh as MorePassShader,Cg as MorphTargetBlender,V0 as MorphTargetData,Sg as MorphTargetFrame,lh as MorphTargetTransformKey,Ht as MorphTarget_shader,Ys as MouseCode,lf as MultiBouncePass_cs,ku as Navi3DAstar,is as Navi3DConst,Ea as Navi3DEdge,sr as Navi3DFunnel,Ur as Navi3DMaskType,Lm as Navi3DMesh,Qt as Navi3DPoint,_l as Navi3DPoint2D,Fa as Navi3DPointFat,_e as Navi3DRouter,Eu as Navi3DTriangle,vn as NonSerialize,Kl as NormalMap_frag,Ef as OAnimationEvent,Ds as OBJParser,ne as Object3D,dp as Object3DEvent,Bl as Object3DTransformTools,Xm as Object3DUtil,nh as ObjectAnimClip,ro as OcclusionSystem,Cr as Octree,A0 as OctreeEntity,Mg as OrbitController,ym as OrderMap,na as Orientation3D,Cd as OutLineBlendColor_cs,Sd as OutlineCalcOutline_cs,fg as OutlinePass,Cp as OutlinePost,Wh as OutlinePostData,Jh as OutlinePostManager,zh as OutlinePostSlot,Fd as Outline_cs,vf as OvershootInterpolator,cu as PARSING,lc as PBRLItShader,Zd as PBRLitSSSShader,lm as PLUGIN_REGISTERED,eu as PNTSLoader,$h as PNTSLoaderBase,tu as PNTSParser,it as ParserBase,je as ParserFormat,Uu as ParticleSystemCurveEvalMode,_u as ParticleSystemRandomnessIds,yi as PassGenerate,Lh as PassShader,fe as PassType,Pl as PhysicMaterialUniform_frag,kh as PickCompute,Eh as PickFire,yt as PickGUIEvent3D,jh as PickResult,kd as Picker_cs,In as PingPong,Jn as PipelinePool,Su as Plane3D,Vr as PlaneClassification,si as PlaneGeometry,ya as PlyMode,Al as PlyParser,Hh as PlyStreamParser,Dh as PointClassification,Kn as PointCloudGeometry,E0 as PointCloudMaterial,qa as PointCloudRenderer,ki as PointCloudShader,k0 as PointCloud_FS,F0 as PointCloud_VS,oi as PointLight,Y0 as PointLightShadowRenderer,j0 as PointShadowCubeCamera,Z as PointerEvent3D,Ga as Polynomial,nr as PolynomialCurve,Sm as Polynomials,gh as PoolNode,Wt as PostBase,md as PostProcessingComponent,$0 as PostRenderer,K0 as PreDepthPassRenderer,ef as PreFilteredEnvironment_cs,qb as PreFilteredEnvironment_cs2,Ed as PreIntegratedLut,Vh as PreIntegratedLutCompute,qo as PrefabAvatarData,au as PrefabAvatarParser,Ko as PrefabBoneData,iu as PrefabMaterialParser,su as PrefabMeshData,nu as PrefabMeshParser,xs as PrefabNode,lu as PrefabParser,em as PrefabStringUtil,ru as PrefabTextureData,ou as PrefabTextureParser,Da as Preprocessor,il as PriorityQueue,Sh as Probe,bp as ProbeEntries,sf as ProbeGBufferFrame,dt as ProfilerUtil,vg as PropertyAnimClip,oh as PropertyAnimTag,ul as PropertyAnimation,fl as PropertyAnimationClip,ih as PropertyAnimationClipState,zi as PropertyAnimationEvent,Gi as PropertyHelp,Nt as QuadAABB,vc as QuadGlsl_fs,Bc as QuadGlsl_vs,Mh as QuadRoot,Ei as QuadShader,Th as QuadTree,kr as QuadTreeCell,Ku as Quad_depth2dArray_frag_wgsl,uc as Quad_depth2d_frag_wgsl,bc as Quad_depthCube_frag_wgsl,hc as Quad_frag_wgsl,dc as Quad_vert_wgsl,se as Quaternion,Qs as R32UintTexture,$r as RADIANS_TO_DEGREES,Wf as RGBEErrorCode,Uo as RGBEHeader,yo as RGBEParser,Je as RTDescriptor,lt as RTFrame,Pa as RTResourceConfig,Mt as RTResourceMap,ns as Rand,n2 as RandomSeed,ua as Ray,Bi as RayCastMeshDetail,ai as Reader,ps as Rect,ke as Reference,$d as Reflection,Rc as ReflectionCG,T0 as ReflectionEntries,th as ReflectionMaterial,tf as ReflectionRenderer,eh as ReflectionShader,Ic as ReflectionShader_shader,Ot as RegisterComponent,Na as RegisterShader,ao as RenderContext,Ci as RenderLayer,jn as RenderLayerUtil,Ba as RenderNode,m0 as RenderShaderCollect,Ph as RenderShaderCompute,qe as RenderShaderPass,Rt as RenderTexture,Va as RendererBase,rf as RendererJob,q0 as RendererMap,Ne as RendererMask,ia as RendererMaskUtil,O0 as RendererPassState,Rn as RepeatSE,pd as Res,Qu as RotationControlComponents,Qc as SHCommon_frag,ms as SN_ArrayConstant,br as SN_BinaryOperation,N2 as SN_Break,Sa as SN_CodeBlock,ar as SN_Constant,fn as SN_Continue,rt as SN_Declaration,P2 as SN_Discard,M2 as SN_DoWhileLoop,we as SN_Expression,Jr as SN_ForLoop,ln as SN_Function,cn as SN_FunctionArgs,Wr as SN_FunctionCall,Or as SN_IFBranch,Xa as SN_Identifier,Zr as SN_IndexOperation,cs as SN_Layout,t0 as SN_ParenExpression,dn as SN_Precision,os as SN_Return,ls as SN_SelectOperation,tr as SN_Struct,a0 as SN_TernaryOperation,ri as SN_UnaryOperation,jr as SN_WhileLoop,$b as SSAO_cs,wd as SSGI2_cs,Sp as SSGIPost,Fp as SSRPost,Id as SSR_BlendColor_cs,kp as SSR_IS_Kernel,Rd as SSR_IS_cs,Qd as SSR_RayTrace_cs,Ru as ScaleControlComponents,tp as Scene3D,At as Shader,Wn as ShaderAttributeInfo,i0 as ShaderConverter,s0 as ShaderConverterResult,Y as ShaderLib,Cn as ShaderPassBase,Tt as ShaderReflection,_a as ShaderStage,n0 as ShaderState,zn as ShaderUniformInfo,Ha as ShaderUtil,$l as ShadingInput,jt as ShadowLightsCollect,H0 as ShadowMapPassRenderer,tc as ShadowMapping_frag,Fg as Skeleton,hn as SkeletonAnimationClip,rh as SkeletonAnimationClipState,mr as SkeletonAnimationComponent,kg as SkeletonAnimationCompute,qr as SkeletonAnimation_shader,Eg as SkeletonBlendComputeArgs,Ii as SkeletonPose,wg as SkeletonTransformComputeArgs,Yi as SkinnedMeshRenderer,Dr as SkinnedMeshRenderer2,l0 as SkyGBufferPass,xc as SkyGBuffer_pass,qd as SkyMaterial,Ws as SkyRenderer,Oi as SkyShader,Wm as SolidColorSky,ep as SphereColliderShape,Nr as SphereGeometry,ah as SphereReflection,Ti as SpotLight,Nf as StandShader,Ge as StatementNode,Pe as StorageGPUBuffer,Ip as StreamLoader,Op as StreamingGaussianSplatParser,wt as StringUtil,vi as Struct,gp as StructStorageGPUBuffer,U0 as SubGeometry,Td as TAACopyTex_cs,Ep as TAAPost,Md as TAASharpTex_cs,Nd as TAA_cs,Od as TestComputeLoadBuffer,Bh as TextAnchor,yh as TextFieldLayout,Uh as TextFieldLine,ut as Texture,Vs as TextureCube,Co as TextureCubeFaceData,un as TextureCubeStdCreator,vo as TextureCubeUtils,pp as TextureMipmapCompute,wa as TextureMipmapGenerator,Nh as TextureScaleCompute,Pg as ThirdPersonCameraController,rl as Tile,hm as TileSet,bm as TileSetChild,gm as TileSetChildContent,pm as TileSetChildContentMetaData,um as TileSetRoot,dm as TilesRenderer,We as Time,x as TokenType,Iu as TorusGeometry,Cl as TouchData,Gm as TrailGeometry,Zt as Transform,P as TransformAxisEnum,on as TransformControllerBaseComponent,mt as TransformMode,ha as TransformSpaceMode,Tu as TranslationControlComponents,Gn as TranslatorContext,zm as TriGeometry,us as Triangle,bl as UIButton,Ch as UIButtonTransition,Jo as UIComponentBase,hp as UIEvent,zr as UIImage,gl as UIImageGroup,pn as UIInteractive,at as UIInteractiveStyle,hs as UIPanel,ji as UIRenderAble,pl as UIShadow,ml as UITextField,or as UITransform,Br as UNLOADED,zt as UUID,Dl as UV,Hn as Uint32ArrayTexture,Fi as Uint8ArrayTexture,Dc as UnLit,Bt as UnLitMaterial,Vl as UnLitMaterialUniform_frag,qi as UnLitShader,Bm as UnLitTexArrayMaterial,$i as UnLitTexArrayShader,Yd as UnLitTextureArray,Ol as UnLit_frag,Ct as UniformGPUBuffer,fr as UniformNode,St as UniformType,X as ValueEnumType,Om as ValueOp,Wa as ValueParser,Em as ValueSpread,de as Vector2,b as Vector3,Wi as Vector3Ex,be as Vector4,np as VertexAttribute,Wd as VertexAttributeIndexShader,G as VertexAttributeName,dr as VertexAttributeSize,Ih as VertexAttributeStride,Ll as VertexAttributes_vert,sp as VertexBufferLayout,Ql as VertexFormat,Rs as VertexGPUBuffer,vh as Vertical,Gl as VideoUniform_frag,ap as View3D,bn as ViewPanel,to as ViewQuad,Te as VirtualTexture,nm as WGS84_FLATTENING,om as WGS84_HEIGHT,sm as WGS84_RADIUS,e0 as WGSLTranslator,Bs as WayLines3D,_s as WayPoint3D,He as WebGPUDescriptorCreator,kn as WorldMatrixUniform,gn as WorldPanel,gi as WrapMode,Ar as WrapTimeMode,Dp as ZCullingCompute,zd as ZPassShader_cs,kc as ZPassShader_fs,Fc as ZPassShader_vs,u0 as ZSorterUtil,Zc as append,Zf as arrayToString,Yu as blendComponent,Im as buildCurves,$t as byteSizeOfType,Rm as calculateCurveRangesValue,es as calculateMinMax,yc as castPointShadowMap_vert,Be as clamp,F2 as clampRepeat,Zo as computeAABBFromPositions,D2 as cos,y2 as crossProduct,Bu as cubicPolynomialRoot,vu as cubicPolynomialRootsGeneric,wm as curvesSupportProcedural,p2 as deg2Rad,Zh as detectGSplatFormat,Sc as directionShadowCastMap_frag,Ft as dot,xu as doubleIntegrateSegment,_d as downSample,Jc as fastInvSqrt,Wc as floorfToIntPos,fi as fonts,C2 as generateRandom,S2 as generateRandom3,Oc as getFloatFromInt,vb as getGLTypeFromTypedArray,Bb as getGLTypeFromTypedArrayType,_2 as getGlobalRandomSeed,xb as getTypedArray,go as getTypedArrayTypeFromGLType,hl as grad1,nn as grad2,ts as grad3,_i as grad4,Xo as inferSHOrder,dl as integrateSegment,Ap as irradianceDataReader,Cm as kPI,Mr as lerp,i2 as lerpByte,r2 as lerpColor,a2 as lerpVector3,Au as lruPriorityCallback,Tn as magnitude,Ib as makeAloneSprite,sd as makeGUISprite,Es as makeMatrix44,cl as markUsedSetLeaves,en as markUsedTiles,tn as markVisibleTiles,Vn as matrixMultiply,I2 as matrixRotate,w2 as matrixRotateY,Cs as mergeFunctions,jc as multiplyMatrices4x4REF,Fu as normal_distribution,U2 as normalizeFast,Vc as normalizeSafe,x2 as normalizedToByte,v2 as normalizedToWord,Ua as outlinePostData,wp as outlinePostManager,Ho as parsePlyGaussianSplat,Hi as parsePlyHeader,Yh as parsePlyMesh,Xh as parsePlyPointCloud,Ue as perm,Bd as post,mu as priorityCallback,sn as quadraticPolynomialRootsGeneric,m2 as rad2Deg,ei as random01,g2 as randomBarycentricCoord,b2 as randomPointBetweenEllipsoid,h2 as randomPointBetweenSphere,f2 as randomPointInsideCube,d2 as randomPointInsideEllipsoid,u2 as randomPointInsideUnitCircle,Gc as randomPointInsideUnitSphere,l2 as randomQuaternion,c2 as randomQuaternionUniformDistribution,zc as randomSeed,ks as randomUnitVector,Lc as randomUnitVector2,_t as rangedRandomFloat,o2 as rangedRandomInt,pe as readByType,li as readMagicBytes,_m as registerMaterial,Pn as repeat,E2 as rotMatrix,$u as rotateVectorByQuat,Mn as roundfToIntPos,Qn as scale,Cc as shadowCastMap_frag,Uc as shadowCastMap_vert,ea as simplex,A2 as sin,Mm as snoise1,Nm as snoise2,Pm as snoise3,Vm as snoise4,Yo as splatColorProperties,Xi as splatProperties,Nn as sqrMagnitude,Pc as sqrtImpl,Xu as stencilStateFace,B2 as swap,Ld as textureCompress,Dd as threshold,mm as throttle,Ka as toHalfFloat,an as toggleTiles,cm as traverseAncestors,hu as traverseSet,ig as tw,Qm as uniform_real_distribution,Tm as uniform_real_distribution2,Vo as upSample,I as webGPUContext,b0 as zSorterUtil};
|
|
11855
|
+
`).filter(Boolean),i=[];for(const n of r){const o=Jt.parseParameterLine(n);o.mnemonic&&i.push(o.mnemonic)}if(i.length===0)throw new Error("LASLoader: No headers found in ~CURVE section");return i}parseData(e,t,a){const r=e.match(/~A(?:[\x20-\x7E])*(?:\r\n|\r|\n)([\s\S]*?)(?=~|$)/);if(!r||!r[1])throw new Error("LASLoader: ~A data section not found");const i=r[1].trim();if(!i)throw new Error("LASLoader: Data section is empty");const n=i.split(/\s+/).filter(c=>c.trim().length>0).map(c=>Jt.convertToValue(c.trim()));if(n.length===0)throw new Error("LASLoader: No data values found");const o=Math.floor(n.length/t.length);if(o===0)throw new Error("LASLoader: Insufficient data values");const l=[];for(let c=0;c<o;c++){const f=[];for(let d=0;d<t.length;d++){const h=c*t.length+d;h<n.length&&f.push(n[h])}f.length===t.length&&l.push(f)}return l}}var Di=(s=>(s.PointCloud="pointcloud",s.Curve="curve",s.WellTrajectory="trajectory",s))(Di||{}),jp=Object.getOwnPropertyDescriptor,Zp=(s,e,t,a)=>{for(var r=a>1?void 0:a?jp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ki=class extends At{constructor(){super();const s=new qe("FatLine_VS","FatLine_FS");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);const e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,e.cullMode=Lt.none,e.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new J(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new de(1920,1080));const s=new R;this.getDefaultColorShader().setUniform("modelMatrix",s.rawData)}};Ki=Zp([Na(Ki,"FatLineShader")],Ki);class qh extends vt{constructor(){super(),this.shader=new Ki,this.transparent=!0}setInstanceBuffer(e){this.shader.setStorageBuffer("instances",e)}setModelMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set lineWidth(e){this.shader.setUniformFloat("lineWidth",e)}get lineWidth(){return this.shader.getUniformFloat("lineWidth")}set opacity(e){this.shader.setUniformFloat("opacity",e)}get opacity(){return this.shader.getUniformFloat("opacity")}set resolution(e){this.shader.setUniformVector2("resolution",e)}get resolution(){return this.shader.getUniformVector2("resolution")}}class Yp extends it{static format=je.BIN;visualizationMode=Di.PointCloud;async parseBuffer(e){const a=await new Kh().parse(e);await this.createVisualization(a)}async createVisualization(e){if("format"in e&&e.format==="binary")this.data=this.createBinaryPointCloudVisualization(e);else{const t=e;let a;switch(this.visualizationMode){case Di.PointCloud:a=this.createPointCloudVisualization(t);break;case Di.Curve:a=this.createCurveVisualization(t);break;case Di.WellTrajectory:a=this.createWellTrajectoryVisualization(t);break;default:a=this.createPointCloudVisualization(t)}a.lasData=t,a.wellParams=t.wellParams,a.curveParams=t.curveParams,this.data=a}}createBinaryPointCloudVisualization(e){const t=new ne;t.name="LASPointCloud";const a=new ne;a.name="LASPointCloudRoot",t.addChild(a);const r=a.addComponent(qa);return r.initFromData(e.positions,e.colors,e.numPoints),r.setPointShape("circle"),r.setPointSize(4),t.lasFormat="binary",t.lasVersion=e.version,t.numPoints=e.numPoints,t.pointDataFormat=e.pointDataFormat,t.bbox=e.bbox,t}verification(){if(this.data)return!0;throw new Error("LASParser: Parse failed")}createPointCloudVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const n=t.map((D,A)=>A).filter(D=>D!==i).slice(0,2),o=a.filter(D=>!D.some(A=>A===r||A===+r));if(o.length===0)throw new Error("LASParser: No valid data points after filtering");const l=o.length,c=new Float32Array(l*3),f=new Uint8Array(l*4);let d=1/0,h=-1/0,u=1/0,m=-1/0;if(n.length>0){const D=o.map(A=>+A[n[0]]).filter(A=>!isNaN(A));if(d=Math.min(...D),h=Math.max(...D),n.length>1){const A=o.map(B=>+B[n[1]]).filter(B=>!isNaN(B));u=Math.min(...A),m=Math.max(...A)}}for(let D=0;D<o.length;D++){const A=o[D],B=D*3,v=D*4;if(c[B+2]=+A[i],n.length>0){const U=+A[n[0]],y=h!==d?(U-d)/(h-d):0;if(c[B+0]=y*10,n.length>1){const S=+A[n[1]],F=m!==u?(S-u)/(m-u):0;c[B+1]=F*10}else c[B+1]=0}else c[B+0]=0,c[B+1]=0;if(n.length>0){const U=+A[n[0]],y=h!==d?(U-d)/(h-d):0;this.mapValueToColor(y,f,v)}else f[v+0]=255,f[v+1]=255,f[v+2]=255,f[v+3]=255}const g=new ne;g.name="LASPointCloud";const p=g.addComponent(qa);return p.initFromData(c,f,l),p.setPointShape("circle"),p.setPointSize(4),g}createCurveVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const n=t.map((D,A)=>A).find(D=>D!==i);if(n===void 0)throw new Error("LASParser: No curve column found");const o=a.filter(D=>{const A=+D[i],B=+D[n];return!isNaN(A)&&!isNaN(B)&&B!==r&&B!==+r});if(o.length===0)throw new Error("LASParser: No valid data points");const l=o.map(D=>+D[n]),c=Math.min(...l),d=Math.max(...l)-c,h=new Float32Array(o.length*3);for(let D=0;D<o.length;D++){const A=o[D],B=D*3,v=+A[i],U=+A[n];h[B+2]=v;const y=d>0?(U-c)/d:0;h[B+0]=y*10,h[B+1]=0}const u=new wh;u.setPositions(h);const m=new qh;m.baseColor=new J(1,0,0,1),m.lineWidth=2;const g=new ne;g.name=`LASCurve_${t[n]}`;const p=g.addComponent(mi);return p.geometry=u,p.material=m,g}createWellTrajectoryVisualization(e){throw new Error("LASParser: Well trajectory visualization not yet implemented")}normalizeValue(e,t,a){const r=t.map(o=>+o[a]).filter(o=>!isNaN(o)),i=Math.min(...r),n=Math.max(...r);return n!==i?(e-i)/(n-i):0}mapValueToColor(e,t,a){const r=Math.floor(e*255),i=Math.floor((1-e)*255);t[a+0]=r,t[a+1]=0,t[a+2]=i,t[a+3]=255}}class Al extends it{static format=je.BIN;static cloudImageProcessParam="";async parseBuffer(e){switch(Hi(e).mode){case ya.Splat:{const a=Ho(e),r={count:a.vertexCount,position:a.position,rotation:a.rotation,scale:a.scale,opacity:a.opacity,sh:a.sh};r.bbox=Zo(a.position);const i=new ne;i.name="GaussianSplat",i.addComponent(ii).initAsset(r),this.data=i;break}case ya.PointCloud:{const a=Xh(e),r=new ne;r.name="PLYPointCloud";const i=new ne;i.name="PLYPointCloudRoot",r.addChild(i);const n=i.addComponent(qa);if(a.color)n.initFromData(a.position,a.color,a.vertexCount);else{const o=new Uint8Array(a.vertexCount*4);o.fill(255),n.initFromData(a.position,o,a.vertexCount)}n.setPointShape("circle"),n.setPointSize(4),this.data=r;break}case ya.Mesh:{const a=Yh(e),r=new ne;r.name="PLYMesh";const i=new Map;if(a.triangleTexnumbers&&a.triangleTexnumbers.length>0)for(let o=0;o<a.triangleTexnumbers.length;o++){const l=a.triangleTexnumbers[o];i.has(l)||i.set(l,[]),i.get(l).push(o)}else{const o=a.indices.length/3,l=[];for(let c=0;c<o;c++)l.push(c);i.set(0,l)}const n=new Map;if(a.textureFiles&&a.textureFiles.length>0){const o=[];for(let l=0;l<a.textureFiles.length;l++){const c=new ta,f=wt.normalizePath(this.baseUrl+a.textureFiles[l]);o.push(_.res.loadTexture(f+Al.cloudImageProcessParam).then(d=>{c.baseMap=d,n.set(l,c)}))}await Promise.all(o)}n.size===0&&n.set(0,new ta);for(const[o,l]of i){const c=[];for(const m of l){const g=m*3;c.push(a.indices[g+0],a.indices[g+1],a.indices[g+2])}const f=new Le;f.setAttribute(G.position,a.position),f.setAttribute(G.normal,a.normal),a.uv&&f.setAttribute(G.uv,a.uv),a.color&&f.setAttribute(G.color,a.color),f.setIndices(new Uint32Array(c)),f.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let d=n.get(o);d||(d=n.values().next().value||new ta);const h=new ne;h.name=`PLYMesh_Texture_${o}`;const u=h.addComponent(he);u.geometry=f,u.material=d,r.addChild(h)}this.data=r;break}}}verification(){return!!this.data}}class $h{async parse(e){const t=new DataView(e),a=li(t);console.assert(a==="pnts");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const n=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,d=new Mi(e,f,n,o),h=f+n+o,u=d.header.POINTS_LENGTH||0,m=new Ls(e,u,h,l,c);return{version:r,featureTable:d,batchTable:m}}}class eu extends $h{async parse(e){const t=await super.parse(e),{featureTable:a,batchTable:r}=t,i=a.header.POINTS_LENGTH;if(!i||i<=0)throw new Error("PNTSLoader: POINTS_LENGTH must be defined and greater than zero");const o=a.header.extensions?.["3DTILES_draco_point_compression"];let l,c;if(o){const u=await this.parseDraco(a,o,i);l=u.positions,c=u.colors,u.normals}else l=this.parsePositions(a,i),c=this.parseColors(a,i),this.parseNormals(a,i);const f=new ne,d=f.addComponent(qa);d.initFromData(l,c,i),d.setPointShape("circle"),d.setPointSize(4);const h=a.getData("RTC_CENTER",1,"FLOAT","VEC3");return h&&f.transform.localPosition.set(h[0],h[1],h[2]),f.batchTable=r,f.featureTable=a,f}parsePositions(e,t){let a=e.getData("POSITION",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("POSITION_QUANTIZED",t,"UNSIGNED_SHORT","VEC3");if(!r)throw new Error("PNTSLoader: Either POSITION or POSITION_QUANTIZED must be defined");const i=e.getData("QUANTIZED_VOLUME_SCALE",1,"FLOAT","VEC3"),n=e.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3");if(!i||!n)throw new Error("PNTSLoader: QUANTIZED_VOLUME_SCALE and QUANTIZED_VOLUME_OFFSET must be defined for quantized positions");const o=new Float32Array(t*3),l=65535;for(let c=0;c<t;c++){const f=c*3;o[f+0]=r[f+0]/l*i[0]+n[0],o[f+1]=r[f+1]/l*i[1]+n[1],o[f+2]=r[f+2]/l*i[2]+n[2]}return o}parseColors(e,t){let a=e.getData("RGBA",t,"UNSIGNED_BYTE","VEC4");if(a)return a;const r=e.getData("RGB",t,"UNSIGNED_BYTE","VEC3");if(r){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*3,d=c*4;l[d+0]=r[f+0],l[d+1]=r[f+1],l[d+2]=r[f+2],l[d+3]=255}return l}const i=e.getData("RGB565",t,"UNSIGNED_SHORT","SCALAR");if(i){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=this.decodeRGB565(i[c]),d=c*4;l[d+0]=f[0],l[d+1]=f[1],l[d+2]=f[2],l[d+3]=255}return l}const n=e.getData("CONSTANT_RGBA",1,"UNSIGNED_BYTE","VEC4");if(n){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*4;l[f+0]=n[0],l[f+1]=n[1],l[f+2]=n[2],l[f+3]=n[3]}return l}const o=new Uint8Array(t*4);return o.fill(255),o}parseNormals(e,t){let a=e.getData("NORMAL",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("NORMAL_OCT16P",t,"UNSIGNED_BYTE","VEC2");return r?this.decodeOctNormals(r,t):null}decodeRGB565(e){const t=(e>>11&31)<<3,a=(e>>5&63)<<2,r=(e&31)<<3;return[t,a,r]}decodeOctNormals(e,t){const a=new Float32Array(t*3);for(let r=0;r<t;r++){const i=r*2,n=e[i]/255,o=e[i+1]/255,l=n*2-1,c=o*2-1,f=1-Math.abs(l)-Math.abs(c);let d,h;f<0?(d=(l>=0?1:-1)*(1-Math.abs(c)),h=(c>=0?1:-1)*(1-Math.abs(l))):(d=l,h=c);const u=Math.sqrt(d*d+h*h+f*f),m=r*3;a[m+0]=d/u,a[m+1]=h/u,a[m+2]=f/u}return a}async parseDraco(e,t,a){throw new Error("Draco compression not yet implemented")}}class tu extends it{static format=je.BIN;async parseBuffer(e){const a=await new eu().parse(e),r=new ne;r.name="PNTS",r.addChild(a),this.data=r}verification(){if(this.data)return!0;throw new Error("PNTSParser: Parse failed")}}class Ko{boneName;bonePath;parentBoneName;boneID;parentBoneID;instanceID;parentInstanceID;t;q;s;formBytes(e){this.boneName=e.readUTF(),this.bonePath=e.readUTF(),this.parentBoneName=e.readUTF(),this.boneID=e.readInt32(),this.parentBoneID=e.readInt32(),this.instanceID=e.readUTF(),this.parentInstanceID=e.readUTF(),this.t=e.readVector3(),this.q=e.readQuaternion(),this.s=e.readVector3()}}class qo{name;count;boneData;boneMap;formBytes(e){this.boneData=[],this.boneMap=new Map,this.name=e.readUTF(),this.count=e.readInt32();for(let t=0;t<this.count;t++){let a=new Ko;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class au extends it{static format=je.BIN;static parser(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new qo;i.formBytes(e.readBytesArray()),_.res.addObj(i.name,i)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}G.position,G.normal,G.color,G.TANGENT,G.uv,G.TEXCOORD_1,G.TEXCOORD_2,G.TEXCOORD_2,G.TEXCOORD_4,G.TEXCOORD_5,G.TEXCOORD_6,G.TEXCOORD_7,G.joints0,G.weights0;var X=(s=>(s[s.single=0]="single",s[s.boolean=1]="boolean",s[s.int=2]="int",s[s.int16=3]="int16",s[s.int32=4]="int32",s[s.float=5]="float",s[s.long=6]="long",s[s.uint=7]="uint",s[s.uint32=8]="uint32",s[s.uint64=9]="uint64",s[s.double=10]="double",s[s.string=11]="string",s[s.singleArray=12]="singleArray",s[s.stringArray=13]="stringArray",s[s.floatArray=14]="floatArray",s[s.vector2=15]="vector2",s[s.vector3=16]="vector3",s[s.vector4=17]="vector4",s[s.color=18]="color",s[s.color32=19]="color32",s[s.animationCurve=20]="animationCurve",s[s.quaternion=21]="quaternion",s[s.matrix4x4=22]="matrix4x4",s[s.mesh=23]="mesh",s[s.texture=24]="texture",s[s.material=25]="material",s[s.materials=26]="materials",s[s.skeleton=27]="skeleton",s[s.animClip=28]="animClip",s[s.vector2Int=29]="vector2Int",s[s.int32List=30]="int32List",s[s.colorList=31]="colorList",s[s.color32List=32]="color32List",s))(X||{});class Hs{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=El(t);if(r){let i=new vt;return i.shader=new r,i}else throw new Error("not found shader, shader name is "+t)}static applyMaterialTexture(e,t){for(let a=0;a<t.length;a++){const r=t[a];r.property in e?e[r.property]=r.texture:r.property in e.shader?e.shader[r.property]=r.texture:e.setTexture(r.property,r.texture)}}static applyMaterialProperties(e,t){for(let a=0;a<t.length;a++){const r=t[a],i=r.key;switch(r.type){case X.color:case X.color32:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformColor(i,n)}break;case X.single:case X.float:case X.int:case X.int16:case X.int32:case X.uint:case X.uint32:case X.uint64:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case X.singleArray:{let n=r.getValue()[0];i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case X.vector2:case X.vector2Int:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector2(i,n)}break;case X.vector3:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector3(i,n)}break;case X.vector4:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector4(i,n)}break}}}}class Wa{static parser(e){switch(e.readInt32()){case X.single:return{t:X.single,v:e.readFloat32()};case X.boolean:return{t:X.boolean,v:e.readBoolean()};case X.int:return{t:X.int,v:e.readInt32()};case X.int16:return{t:X.int16,v:e.readInt16()};case X.int32:return{t:X.int32,v:e.readInt32()};case X.float:return{t:X.float,v:e.readFloat32()};case X.long:return{t:X.long,v:e.readFloat64()};case X.uint:return{t:X.uint,v:e.readUnit32()};case X.uint32:return{t:X.uint32,v:e.readUnit32()};case X.uint64:return{t:X.uint64,v:e.readUnit32()};case X.double:return{t:X.double,v:e.readFloat64()};case X.string:return{t:X.string,v:e.readUTF()};case X.singleArray:return{t:X.singleArray,v:e.readFloatArray()};case X.stringArray:return{t:X.stringArray,v:e.readStringArray()};case X.floatArray:return{t:X.floatArray,v:e.readFloatArray()};case X.vector2:return{t:X.vector2,v:e.readVector2()};case X.vector3:return{t:X.vector3,v:e.readVector3()};case X.vector4:return{t:X.vector4,v:e.readVector4()};case X.color:return{t:X.color,v:e.readColor()};case X.color32:return{t:X.color32,v:e.readColor()};case X.animationCurve:return{t:X.animationCurve,v:null};case X.quaternion:return{t:X.quaternion,v:e.readQuaternion()};case X.matrix4x4:return{t:X.matrix4x4,v:null};case X.mesh:{let o=e.readUTF(),l=_.res.getGeometry(o);return{t:X.mesh,v:l}}case X.texture:{let o=e.readUTF(),l=_.res.getTexture(o);return{t:X.texture,v:l}}case X.material:{let o=e.readUTF(),l=_.res.getMat(o);return{t:X.material,v:l}}case X.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let d=_.res.getMat(f);l.push(d)}return{t:X.materials,v:l}}case X.skeleton:break;case X.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new fl;f.formBytes(e),o.push(f)}return{t:X.animClip,v:o}}case X.vector2Int:return{t:X.vector2Int,v:e.readVector2int()};case X.int32List:return{t:X.int32List,v:e.readInt32List()};case X.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Wa.parser(e).v;r.push(l)}return{t:X.colorList,v:r};case X.color32List:let i=e.readInt32(),n=[];for(let o=0;o<i;o++){const l=Wa.parser(e).v;n.push(l)}return{t:X.color32List,v:n}}}}class $o{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Wa.parser(e);this.type=t,this._data=a}}class ru{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class iu extends it{static format=je.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),n=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],d=[],h=i.readInt32();for(let g=0;g<h;g++){let p=new $o;p.formBytes(i),f.push(p)}let u=i.readInt32();for(let g=0;g<u;g++){let p=i.readBytesArray(),D=new ru;D.property=p.readUTF(),D.name=p.readUTF(),D.texture=_.res.getTexture(D.name),D.texelSize=p.readVector2(),D.wrapModeU=p.readUnit32(),D.wrapModeV=p.readUnit32(),D.wrapModeW=p.readUnit32(),D.wrapMode=p.readUnit32(),D.anisoLevel=p.readUnit32(),D.dimension=p.readUnit32(),D.filterMode=p.readUnit32(),d.push(D)}let m=Hs.GetMaterial(c);m.name=n;for(let g=0;g<l.length;g++){const p=l[g];m.shader.setDefine(p,!0)}Hs.applyMaterialTexture(m,d),Hs.applyMaterialProperties(m,f),_.res.addMat(o,m)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class el{shapeName;shapeIndex;frameCount;blendPositionList=new Float32Array;blendNormalList=new Float32Array;formBytes(e){let t=e.readBytesArray();this.shapeName=t.readUTF(),this.shapeIndex=t.readInt32(),this.frameCount=t.readInt32();let a=t.readInt32();this.blendPositionList=t.readFloat32Array(a*3);let r=t.readInt32();this.blendNormalList=t.readFloat32Array(r*3)}}class tl{vertexCount;shapeNames;shapeIndexs;blendCount;blendShapePropertyDatas;blendShapeMap;formBytes(e){this.blendShapeMap=new Map,this.blendShapePropertyDatas=[];let t=e.readBytesArray();this.vertexCount=t.readInt32(),this.shapeNames=t.readStringArray(),this.shapeIndexs=t.readIntArray(),this.blendCount=t.readInt32();for(let a=0;a<this.blendCount;a++){let r=new el;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class su{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class nu extends it{static format=je.BIN;async parseBuffer(e){}static parserMeshs(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new su,n=e.readBytesArray();i.meshName=n.readUTF(),i.meshID=n.readUTF(),n.readFloat32()>0,n.readFloat32()>0,n.readFloat32()>0;let o=n.readFloat32()>0,l=n.readFloat32()>0;o&&(i.bones=n.readStringArray(),i.bindPose=n.readMatrix44Array()),l&&(i.blendShapeData=new tl,i.blendShapeData.formBytes(n));let c=n.readBytesArray(),f=n.readBytesArray(),d=c.readInt32(),h=0,u=[];for(let A=0;A<d;A++)u[A]={},u[A].att=Xp[c.readUTF()],u[A].dim=c.readInt32(),h+=u[A].dim,u[A].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let m=n.readInt32Array(),g=[],p=n.readInt32();for(let A=0;A<p;A++){let B=n.readInt32(),v=n.readInt32(),U=n.readInt32(),y=n.readInt32(),S=n.readInt32(),F=n.readInt32();n.readVector3(),n.readVector3();let C={indexStart:v,indexCount:U,vertexStart:y,vertexCount:F,firstStart:S,topology:B,index:A};g.push(C)}m.length>65535?i.indices=new Uint32Array(m):i.indices=new Uint16Array(m);let D=new Le;if(D.vertexDim=h,D.geometryType=kt.compose_bin,D.setIndices(i.indices),D.setAttribute(G.all,i.vertexBuffer),o&&(D.skinNames=i.bones,D.bindPose=i.bindPose),l){D.blendShapeData=i.blendShapeData,D.morphTargetsRelative=!0,D.morphTargetDictionary={};for(let A=0;A<i.blendShapeData.blendCount;A++){D.setAttribute("a_morphPositions_"+A,i.blendShapeData.blendShapePropertyDatas[A].blendPositionList),D.setAttribute("a_morphNormals_"+A,i.blendShapeData.blendShapePropertyDatas[A].blendNormalList);for(let B=0;B<i.blendShapeData.blendCount;B++){let v=i.blendShapeData.shapeNames[B],U=i.blendShapeData.shapeIndexs[B];D.morphTargetDictionary[v]=U}}}for(let A=0;A<u.length;A++){const B=u[A].att;D.setAttribute(B,null)}for(let A=0;A<g.length;A++){const B=g[A];D.addSubGeometry(B)}D.name=i.meshName,_.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let Xp={Position:G.position,Normal:G.normal,Color:G.color,Tangent:G.TANGENT,TexCoord0:G.uv,TexCoord1:G.TEXCOORD_1,TexCoord2:G.TEXCOORD_2,TexCoord3:G.TEXCOORD_2,TexCoord4:G.TEXCOORD_4,TexCoord5:G.TEXCOORD_5,TexCoord6:G.TEXCOORD_6,TexCoord7:G.vIndex,BlendIndices:G.joints0,BlendWeight:G.weights0};class Dn extends DataView{get buffer(){return super.buffer}get byteOffset(){return super.byteOffset}get byteLength(){return super.byteLength}getInt16(e,t){return super.getInt16(e,t)}getInt32(e,t){return super.getInt32(e,t)}getFloat32(e,t){return super.getFloat32(e,t)}getFloat64(e,t){return super.getFloat64(e,t)}getUint8(e){return super.getUint8(e)}getUint32(e,t){return super.getUint32(e,t)}getInt8(e){return super.getInt8(e)}getUint16(e,t){return super.getUint16(e,t)}position=0;littleEndian=!0;constructor(e,t,a){super(e,t,a),this.position=0,this.position+=this.byteOffset}readUTF(){let e=this.readInt32(),t=e%4;t>0&&t<4&&(t=4-t);let a="",r=new Int8Array(this.buffer,this.position,e);return this.position+=e*Int8Array.BYTES_PER_ELEMENT,a+=String.fromCharCode.apply(null,r),this.position+=t*Int8Array.BYTES_PER_ELEMENT,a}readStringArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readUTF());return e}readByte(){let e=this.buffer[this.position];return this.position+=1,e}readBoolean(){let e=this.readInt32();return this.position+=4,e==1}readBytes(e){let t=new DataView(this.buffer,this.position,e);return this.position+=e,t.buffer}readBytesArray(){let e=this.readInt32(),t=new Dn(this.buffer.slice(this.position,this.position+e));return this.position+=e,t}readUnit8(){let e=this.getUint8(this.position);return this.position+=Uint8Array.BYTES_PER_ELEMENT,e}readUnit16(){let e=this.getUint16(this.position);return this.position+=Uint16Array.BYTES_PER_ELEMENT,e}readUnit32(){let e=this.getUint32(this.position);return this.position+=Uint32Array.BYTES_PER_ELEMENT,e}readInt8(){let e=this.getInt8(this.position);return this.position+=Int8Array.BYTES_PER_ELEMENT,e}readInt16(){let e=this.getInt16(this.position,this.littleEndian);return this.position+=Int16Array.BYTES_PER_ELEMENT,e}readInt32(){let e=this.getInt32(this.position,this.littleEndian);return this.position+=Int32Array.BYTES_PER_ELEMENT,e}readFloat32(){let e=this.getFloat32(this.position,this.littleEndian);return this.position+=Float32Array.BYTES_PER_ELEMENT,e}readFloat64(){let e=this.getFloat64(this.position,this.littleEndian);return this.position+=Float64Array.BYTES_PER_ELEMENT,e}readInt32Array(){let e=this.readInt32(),t=new Int32Array(this.buffer,this.position,e);return t=t.slice(0,e),this.position+=t.byteLength,t}readInt32List(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++)t.push(this.readInt32());return t}readFloatArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readFloat32();t.push(r)}return t}readIntArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readInt32();t.push(r)}return t}readVector2int(){let e=new de;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new de;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new b;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e}readVector3Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector3());return e}readVector4(){let e=new be;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readVector4Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector4());return e}readColor(){let e=new J;return e.r=this.readFloat32(),e.g=this.readFloat32(),e.b=this.readFloat32(),e.a=this.readFloat32(),e}readColorArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readColor());return e}readQuaternion(){let e=new se;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readQuaternionArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readQuaternion());return e}readMatrix44(){let e=new R,t=e.rawData;return t[0]=this.readFloat32(),t[1]=this.readFloat32(),t[2]=this.readFloat32(),t[3]=this.readFloat32(),t[4]=this.readFloat32(),t[5]=this.readFloat32(),t[6]=this.readFloat32(),t[7]=this.readFloat32(),t[8]=this.readFloat32(),t[9]=this.readFloat32(),t[10]=this.readFloat32(),t[11]=this.readFloat32(),t[12]=this.readFloat32(),t[13]=this.readFloat32(),t[14]=this.readFloat32(),t[15]=this.readFloat32(),e}readMatrix44Array(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readMatrix44();t.push(r)}return t}readFloat32Array(e){let t=new DataView(this.buffer),a=new Float32Array(e);for(let r=0;r<e;r++)a[r]=t.getFloat32(this.position+r*Float32Array.BYTES_PER_ELEMENT,this.littleEndian);return this.position+=e*Float32Array.BYTES_PER_ELEMENT,a}getFloat32Array(){let e=new Float32Array(this.buffer,this.byteOffset,this.byteLength/Float32Array.BYTES_PER_ELEMENT);return e=e.slice(0,this.byteLength),e}}class ou extends it{static format=je.TEXT;static async parserTexture(e,t,a){let r=e.readInt32(),i=[];for(let o=0;o<r;o++){let l=e.readUTF();lu.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let n=await _.res.loadBitmapTextures(i,_.setting.loader.numConcurrent,a,!0);for(const o of n)_.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var Hp=Object.getOwnPropertyDescriptor,Kp=(s,e,t,a)=>{for(var r=a>1?void 0:a?Hp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ks=class extends At{constructor(){super(),Y.register("PBRLitSSSShader",Zd);let s=new qe("PBRLitSSSShader","PBRLitSSSShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefine("USE_CUSTOMUNIFORM",!0),this.setDefault(),this.computes=[new Vh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformColor("emissiveColor",new J(1,1,1)),this.setUniformVector4("materialF0",new be(.04,.04,.04,1)),this.setUniformColor("specularColor",new J(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new J(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new J(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _SSSMap(s){this.setTexture("sssMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SkinColor(s){this.setUniformColor("skinColor",s)}set _SkinPower(s){this.setUniformFloat("skinPower",s)}set _SkinColorIns(s){this.setUniformFloat("skinColorIns",s)}set curveFactor(s){this.setUniformFloat("curveFactor",s)}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Ks=Kp([Na(Ks,"LitSSSShader")],Ks);var qp=Object.getOwnPropertyDescriptor,$p=(s,e,t,a)=>{for(var r=a>1?void 0:a?qp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let qs=class extends At{constructor(){super();let s=new qe("PBRLItShader","PBRLItShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformColor("emissiveColor",new J(0,0,0)),this.setUniformVector4("materialF0",new be(.04,.04,.04,1)),this.setUniformColor("specularColor",new J(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new J(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=_.res.grayTexture,this._BumpMap=_.res.normalTexture,this._MaskTex=_.res.maskTexture}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};qs=$p([Na(qs,"LitShader")],qs);class _n{comName;data;static parser(e){let t=e.readBytesArray(),a=new _n;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let n=new $o;n.formBytes(t),a.data.push(n)}return a}}class xs{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new xs;a.name=t.readUTF(),a.parentName=t.readUTF(),a.position=t.readVector3(),a.rotation=t.readQuaternion(),a.scale=t.readVector3(),a.comDatas=[],a.child=[];let r=t.readInt32();for(let n=0;n<r;n++){const o=_n.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let n=0;n<i;n++){const o=xs.parser(t);a.child.push(o)}return a}}class lu extends it{static useWebp=!0;static format=je.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new Dn(e,0);await ou.parserTexture(t,this,this.loaderFunctions),au.parser(t,this),nu.parserMeshs(t,this),iu.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return xs.parser(e)}parserNodeTree(e){let t=new ne;if(t.localPosition=b.serialize(e.position),t.localQuaternion=se.serialize(e.rotation),t.localScale=b.serialize(e.scale),t.name=e.name,e.comDatas)for(let a=0;a<e.comDatas.length;a++){const r=e.comDatas[a];let i=null,n=kl(r.comName);if(n){i=t.getOrAddComponent(n);for(let o=0;o<r.data.length;o++){const l=r.data[o];l.key in i&&(i[l.key]=l.getValue())}}}if(e.child&&e.child.length>0)for(let a=0;a<e.child.length;a++){let r=this.parserNodeTree(e.child[a]);t.addChild(r)}return t}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class em{static getNumber(e){return parseFloat(e)}static getInt(e){return parseInt(e)}static getBoolean(e){return e=="true"}static getNumberArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(",");for(let r=0;r<a.length;r++)parseFloat(a[r]);return t}static getStringArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(","),r=[];for(let i=0;i<a.length;i++){const n=a[i];r.push(n)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var tm=Object.getOwnPropertyDescriptor,am=(s,e,t,a)=>{for(var r=a>1?void 0:a?tm(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let qi=class extends At{constructor(){super();let s=new qe("UnLit","UnLit");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};qi=am([Na(qi,"UnLitShader")],qi);var rm=Object.getOwnPropertyDescriptor,im=(s,e,t,a)=>{for(var r=a>1?void 0:a?rm(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let $i=class extends At{constructor(){super(),Y.register("VertexAttributeIndexShader",Wd),Y.register("UnLitTextureArray",Yd);let s=new qe("UnLitTextureArray","UnLitTextureArray");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new be(0,0,1,1)),this.setUniformVector4("transformUV2",new be(0,0,1,1)),this.setUniformColor("baseColor",new J),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?Lt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=De.NONE:e.blendMode=De.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};$i=im([Na($i,"UnLitTexArrayShader")],$i);const _r=-1,Br=0,al=1,cu=2,La=3,sm=6378137,nm=1/298.257223563,om=6356752314245179e-9,lm=Symbol("PLUGIN_REGISTERED");class rl{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=Br;used=!1;visible=!1;active=!1;inFrustum=!1;error=1/0;distanceFromCamera=1/0;depth=0;depthFromRenderedParent=0;lastFrameVisited=-1;isLeaf=!1;allChildrenReady=!1;hasContent=!1;hasRenderableContent=!1;hasUnrenderableContent=!1;childrenProcessed=0;usedLastFrame=!1;priority;canTraverse=!1;canTraverseFrame=-1;basePath="";cached={};constructor(e,t=null){if(this.boundingVolume=e.boundingVolume,this.geometricError=e.geometricError,this.refine=e.refine,this.content=e.content,this.contents=e.contents,this.transform=e.transform,this.extensions=e.extensions,this.extras=e.extras,this.parent=t,this.depth=t?t.depth+1:0,this.depthFromRenderedParent=t?.hasContent?0:t?t.depthFromRenderedParent+1:0,this.hasContent=!!(this.content||this.contents&&this.contents.length>0),this.content?.uri){const a=this.content.uri.toLowerCase();this.hasUnrenderableContent=a.endsWith("tileset.json"),this.hasRenderableContent=!this.hasUnrenderableContent}else this.contents&&this.contents.length>0&&(this.hasRenderableContent=!0)}addChild(e){e.parent=this,e.depth=this.depth+1,e.depthFromRenderedParent=this.hasContent?0:this.depthFromRenderedParent+1,this.children.push(e)}resetFrameState(e){this.lastFrameVisited!==e&&(this.lastFrameVisited=e,this.used=!1,this.inFrustum=!1,this.isLeaf=!1,this.visible=!1,this.active=!1,this.error=1/0,this.distanceFromCamera=1/0,this.allChildrenReady=!1)}}const fu=2**30;class du{minSize=6e3;maxSize=8e3;minBytesSize=.3*fu;maxBytesSize=.4*fu;unloadPercent=.05;autoMarkUnused=!0;_itemSet=new Map;_itemList=[];_usedSet=new Set;_callbacks=new Map;_unloadingHandle=-1;_cachedBytes=0;_bytesMap=new Map;_loadedSet=new Set;_unloadPriorityCallback=null;set unloadPriorityCallback(e){this._unloadPriorityCallback=e}get unloadPriorityCallback(){return this._unloadPriorityCallback}isFull(){return this._itemSet.size>=this.maxSize||this._cachedBytes>=this.maxBytesSize}getMemoryUsage(e){return this._bytesMap.get(e)||0}setMemoryUsage(e,t){if(!this._itemSet.has(e))return;const a=this._bytesMap.get(e)||0;this._cachedBytes-=a,this._bytesMap.set(e,t),this._cachedBytes+=t}add(e,t){return this._itemSet.has(e)||this.isFull()?!1:(this._itemList.push(e),this._usedSet.add(e),this._itemSet.set(e,Date.now()),this._callbacks.set(e,t),this._loadedSet.add(e),!0)}has(e){return this._itemSet.has(e)}remove(e){if(!this._itemSet.has(e))return!1;const t=this._bytesMap.get(e)||0;this._cachedBytes-=t,this._bytesMap.delete(e);const a=this._callbacks.get(e);a&&a(e);const r=this._itemList.indexOf(e);return r!==-1&&this._itemList.splice(r,1),this._usedSet.delete(e),this._itemSet.delete(e),this._callbacks.delete(e),this._loadedSet.delete(e),!0}markUsed(e){this._itemSet.has(e)&&(this._usedSet.add(e),this._itemSet.set(e,Date.now()))}markUnused(e){this._usedSet.delete(e)}scheduleUnload(){this._unloadingHandle===-1&&(this._unloadingHandle=requestAnimationFrame(()=>{this._unloadingHandle=-1,this._performUnload()}))}_performUnload(){if(!(this._itemSet.size>this.minSize||this._cachedBytes>this.minBytesSize))return;this.autoMarkUnused&&this._itemSet.forEach((o,l)=>{this._usedSet.has(l)||this.markUnused(l)});const t=[];this._itemList.forEach(o=>{this._usedSet.has(o)||t.push(o)}),this._unloadPriorityCallback&&t.sort(this._unloadPriorityCallback);const a=Math.floor(this._itemSet.size*(1-this.unloadPercent)),r=this._cachedBytes-(this._cachedBytes-this.minBytesSize);let i=0,n=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-n<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,n+=c)}}clear(){Array.from(this._itemSet.keys()).forEach(t=>this.remove(t))}getStats(){return{size:this._itemSet.size,bytes:this._cachedBytes,usedCount:this._usedSet.size}}}class il{maxJobs=6;priorityCallback=null;_items=[];_callbacks=new Map;_currJobs=0;get running(){return this._items.length!==0||this._currJobs!==0}sort(){this.priorityCallback&&this._items.sort(this.priorityCallback)}has(e){return this._callbacks.has(e)}add(e,t){if(this._callbacks.has(e))return this._callbacks.get(e).promise;let a,r;const i=new Promise((o,l)=>{a=o,r=l}),n={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,n),i}remove(e){const t=this._items.indexOf(e);if(t!==-1){const a=this._callbacks.get(e);a&&(a.promise.catch(()=>{}),a.reject(new Error("PriorityQueue: Item removed."))),this._items.splice(t,1),this._callbacks.delete(e)}}removeByFilter(e){const t=[];this._items.forEach(a=>{e(a)&&t.push(a)}),t.forEach(a=>this.remove(a))}update(){this._tryRunJobs()}_tryRunJobs(){this.sort();const e=this.maxJobs;let t=0;const a=()=>{this._currJobs--};for(;e>this._currJobs&&this._items.length>0&&t<e;){this._currJobs++,t++;const r=this._items.shift(),i=this._callbacks.get(r);this._callbacks.delete(r),Promise.resolve(i.callback(r)).then(()=>{i.resolve(),a()}).catch(n=>{i.reject(n),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function hu(s,e=null,t=null){const a=[];for(a.push(s),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),n=a.pop();if(e&&e(n,i,r)===!0){t&&t(n,i,r);return}const o=n.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(n),a.push(r+1);if(t&&t(n,i,r)===!0)return}}function cm(s,e){let t=s;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const $s={inView:!1,error:1/0,distanceFromCamera:1/0},uu=!0;function bu(s){return s===La||s===_r}function vr(s,e){return s.lastFrameVisited===e&&s.used}function gu(s){return s.childrenProcessed===s.children.length}function sl(s){return s.hasUnrenderableContent||s.parent!==null&&s.parent.geometricError<s.geometricError}function nl(s,e){s.lastFrameVisited!==e.frameCount&&(s.usedLastFrame=s.used,s.lastFrameVisited=e.frameCount,s.used=!1,s.inFrustum=!1,s.isLeaf=!1,s.visible=!1,s.active=!1,s.error=1/0,s.distanceFromCamera=1/0,s.allChildrenReady=!1,e.calculateTileViewError(s,$s),s.inFrustum=$s.inView,s.error=$s.error,s.distanceFromCamera=$s.distanceFromCamera)}function ol(s,e,t=!1){s.used||(t||(s.used=!0,e.stats.used++),e.markTileUsed(s),s.inFrustum===!0&&e.stats.inFrustum++)}function fm(s,e){if(s.canTraverse&&s.canTraverseFrame===e.frameCount)return s.canTraverse;let t=!1;return s.error<=e.errorTarget&&!sl(s)||s.depth>=e.maxDepth||!s.children||s.children.length===0?t=!1:t=!0,s.canTraverse=t,s.canTraverseFrame=e.frameCount,t}function ll(s,e,t=!1){if(e.ensureChildrenArePreprocessed(s),nl(s,e),ol(s,e,t),sl(s)&&gu(s)){const a=s.children;for(let r=0,i=a.length;r<i;r++)ll(a[r],e,t)}}function en(s,e){if(e.ensureChildrenArePreprocessed(s),nl(s,e),!s.inFrustum)return;if(!fm(s,e)){ol(s,e);const n=s.children;if(!s.hasContent&&n&&n.length>0)for(let o=0,l=n.length;o<l;o++){const c=n[o];en(c,e)}return}const a=s.children;let r=!1,i=!1;for(let n=0,o=a.length;n<o;n++){const l=a[n];en(l,e),r=r||vr(l,e.frameCount),i=i||l.inFrustum}if(s.refine==="REPLACE"&&!i&&a.length!==0){s.inFrustum=!1;for(let n=0,o=a.length;n<o;n++)ll(a[n],e,!0);return}if(ol(s,e),s.refine==="REPLACE"&&(r&&s.depth!==0||uu))for(let n=0,o=a.length;n<o;n++)ll(a[n],e)}function cl(s,e){const t=e.frameCount;if(!vr(s,t))return;const a=s.children;let r=!1;for(let i=0,n=a.length;i<n;i++){const o=a[i];r=r||vr(o,t)}if(!r)s.isLeaf=!0;else{let i=!0;for(let n=0,o=a.length;n<o;n++){const l=a[n];if(cl(l,e),vr(l,t)){const c=!sl(l);let f=!l.hasContent||l.hasRenderableContent&&bu(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===_r;f=c&&f||l.allChildrenReady,i=i&&f}}s.allChildrenReady=i}}function pu(s,e){if(e.ensureChildrenArePreprocessed(s),vr(s,e.frameCount)&&(s.hasContent&&e.queueTileForDownload(s),gu(s))){const t=s.children;for(let a=0,r=t.length;a<r;a++)pu(t[a],e)}}function tn(s,e){const t=e.stats;if(!vr(s,e.frameCount))return;if(s.isLeaf){s.loadingState===La?(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++):s.hasContent&&e.queueTileForDownload(s);return}const a=s.children,r=s.hasContent,i=bu(s.loadingState)&&r,n=(e.errorTarget+1)*(e.errorThreshold||1),o=s.error<=n,l=s.refine==="ADD",c=s.allChildrenReady||s.depth===0&&!uu;if(r&&(o||l)&&e.queueTileForDownload(s),(o&&i&&!c||i&&l)&&(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++),!l&&o&&!c)for(let f=0,d=a.length;f<d;f++){const h=a[f];vr(h,e.frameCount)&&pu(h,e)}else for(let f=0,d=a.length;f<d;f++)tn(a[f],e)}function an(s,e){const t=vr(s,e.frameCount);if(t||s.usedLastFrame){let a=!1,r=!1;if(t?(a=s.active,r=s.visible):nl(s,e),s.hasRenderableContent&&s.loadingState===La){const n=s.__wasSetVisible;s.__wasSetActive!==a&&(e.setTileDelayedActive(s,a),s.__wasSetActive=a),n!==r&&(e.setTileDelayedVisible(s,r),s.__wasSetVisible=r)}s.usedLastFrame=t;const i=s.children;for(let n=0,o=i.length;n<o;n++)an(i[n],e)}}class Xr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Xr.s_tmpMatrix||(Xr.s_tmpMatrix=new R),this._data=e,e.box)this._type="box",this._parseBox(e.box);else if(e.sphere)this._type="sphere",this._parseSphere(e.sphere);else if(e.region)this._type="region",this._parseRegion(e.region);else throw new Error("BoundingVolume: Invalid bounding volume data")}_parseBox(e){if(e.length!==12)throw new Error("BoundingVolume: Box must have 12 elements");const t=new b(e[0],e[1],e[2]),a=new b(e[3],e[4],e[5]),r=new b(e[6],e[7],e[8]),i=new b(e[9],e[10],e[11]),n=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),d=i.clone().normalize();this._matrix=new R;const h=this._matrix.rawData;h[0]=c.x,h[1]=c.y,h[2]=c.z,h[3]=0,h[4]=f.x,h[5]=f.y,h[6]=f.z,h[7]=0,h[8]=d.x,h[9]=d.y,h[10]=d.z,h[11]=0,h[12]=t.x,h[13]=t.y,h[14]=t.z,h[15]=1;const u=new b(n*2,o*2,l*2);this._box=new Ce(new b(0,0,0),u)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new b(e[0],e[1],e[2]),a=e[3];this._sphere=new Lr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,n,o]=e,l=new b((t+r)/2,(a+i)/2,(n+o)/2),c=new b(Math.abs(r-t),Math.abs(i-a),Math.abs(o-n));this._box=new Ce(l,c),this._matrix=new R,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new b(a.x-r,a.y-r,a.z-r),n=new b(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,n),t){const o=[new b(i.x,i.y,i.z),new b(n.x,i.y,i.z),new b(i.x,n.y,i.z),new b(n.x,n.y,i.z),new b(i.x,i.y,n.z),new b(n.x,i.y,n.z),new b(i.x,n.y,n.z),new b(n.x,n.y,n.z)];o.forEach(l=>{const c=new b;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Xr.s_tmpMatrix;if(a.identity(),this._matrix?t?a.multiplyMatrices(t,this._matrix):a.copyFrom(this._matrix):t&&a.copyFrom(t),a){const r=this._box,i=[new b(r.min.x,r.min.y,r.min.z),new b(r.max.x,r.min.y,r.min.z),new b(r.min.x,r.max.y,r.min.z),new b(r.max.x,r.max.y,r.min.z),new b(r.min.x,r.min.y,r.max.z),new b(r.max.x,r.min.y,r.max.z),new b(r.min.x,r.max.y,r.max.z),new b(r.max.x,r.max.y,r.max.z)];i.forEach(n=>{const o=new b;a.transformPoint(n,o),n.copyFrom(o)}),e.makeEmpty(),i.forEach(n=>{e.expandByPoint(n)})}else e.setFromMinMax(this._box.min,this._box.max);return e}throw new Error("BoundingVolume: Invalid state")}getOBB(e,t){this._type==="box"&&this._box&&this._matrix?(e.setFromMinMax(this._box.min,this._box.max),t.copyFrom(this._matrix)):(this.getAABB(e),t.identity())}getSphere(e){if(this._type==="sphere"&&this._sphere)return e.center.copyFrom(this._sphere.center),e.radius=this._sphere.radius,e;const t=new Ce;this.getAABB(t);const a=t.center,i=t.size.length*.5;return e.center.copyFrom(a),e.radius=i,e}get type(){return this._type}distanceToPoint(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center;let r=a;if(t){const o=new b;t.transformPoint(a,o),r=o}const i=this._sphere.radius,n=e.clone().subtract(r).length;return Math.max(0,n-i)}else if(this._box){const a=new Ce;this.getAABB(a,t);const r=a.center,i=a.size,n=Math.max(0,Math.abs(e.x-r.x)-i.x*.5),o=Math.max(0,Math.abs(e.y-r.y)-i.y*.5),l=Math.max(0,Math.abs(e.z-r.z)-i.z*.5);return Math.sqrt(n*n+o*o+l*l)}return 1/0}intersectsFrustum(e,t){if(this._type==="sphere"&&this._sphere){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}else if(this._box){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}return!1}}const mu=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.used!==e.used?s.used?1:-1:s.error!==e.error?s.error>e.error?1:-1:s.distanceFromCamera!==e.distanceFromCamera?s.distanceFromCamera>e.distanceFromCamera?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},Au=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.lastFrameVisited!==e.lastFrameVisited?s.lastFrameVisited>e.lastFrameVisited?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:s.loadingState!==e.loadingState?s.loadingState>e.loadingState?-1:1:s.hasUnrenderableContent!==e.hasUnrenderableContent?s.hasUnrenderableContent?-1:1:s.error!==e.error?s.error>e.error?-1:1:0};class dm{rootLoadingState=Br;rootTileSet=null;rootURL=null;fetchOptions={};frameCount=0;isLoading=!1;lruCache;loadQueue;processNodeQueue;plugins=[];_queuedTiles=[];_cachedSinceLoadComplete=new Set;_processedTiles=new WeakSet;_visibleTiles=new Set;_usedSet=new Set;_cacheHits=0;_cacheMisses=0;stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0,sceneCount:0,inCacheSinceLoad:0};errorTarget=16;errorThreshold=1;maxDepth=30;displayActiveTiles=!1;onRootTileLoaded;rtcOffset=null;_root=null;_activeTiles=new Set;_delayedHideTiles=new Set;_delayedVisibleTiles=new Set;_delayedActiveTiles=new Set;group;cameras=[];_cameraMap=new Map;_cameraInfo=[];_upRotationMatrix=new R;_ellipsoid;_bytesUsed=new WeakMap;_eventListeners=new Map;performanceStats={updateTime:0,traverseTime:0,markUsedTime:0,markVisibleTime:0,toggleTime:0,queueProcessTime:0};constructor(e=null){this.rootURL=e,this.lruCache=new du,this.lruCache.unloadPriorityCallback=Au,this.loadQueue=new il,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=mu,this.processNodeQueue=new il,this.processNodeQueue.maxJobs=25,this.group=new ne,this.group.name="TilesRendererGroup"}get root(){return this._root}get loadProgress(){const{stats:e,isLoading:t}=this,a=e.downloading,r=e.inCacheSinceLoad+(t?1:0);return r===0?1:1-a/r}update(){const{lruCache:e,_usedSet:t,stats:a,loadQueue:r,processNodeQueue:i}=this;this.rootLoadingState===Br&&(this.rootLoadingState=al,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=La,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),d=this.preprocessNode(c.root,f,null);this.queueTileForDownload(d),this._root=d;const h=new Xr(d.boundingVolume),u=new Lr;h.getSphere(u);const m=new Ce;if(h.getAABB(m),this.rtcOffset=new b(-u.center.x,-u.center.y,-u.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:u.center,radius:u.radius,boundingBox:m,rtcOffset:this.rtcOffset})}catch(g){console.warn("Failed to calculate bounding volume for root tile:",g)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=_r,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const n=this.root;if(!n)return;a.inFrustum=0,a.used=0,a.active=0,a.visible=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.updateCameraInfo(),this._checkDelayedHideTiles(),this._checkDelayedActiveTiles(),this._checkDelayedVisibleTiles(),en(n,this),cl(n,this),tn(n,this),an(n,this);const o=this._queuedTiles;e.unloadPriorityCallback&&o.sort(e.unloadPriorityCallback);for(let c=0,f=o.length;c<f&&!e.isFull();c++)this.requestTileContents(o[c]);o.length=0,r.update(),i.update(),e.scheduleUnload(),(r.running||i.running)===!1&&this.isLoading===!0&&(this._cachedSinceLoadComplete.clear(),a.inCacheSinceLoad=0,this.dispatchEvent({type:"tiles-load-end"}),this.isLoading=!1)}traverse(e,t,a=!0){this.root&&hu(this.root,(r,i,n)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,n):!1),t)}registerPlugin(e){if(this.plugins.includes(e))return;const t=e.priority||0;let a=this.plugins.length;for(let r=0;r<this.plugins.length;r++)if((this.plugins[r].priority||0)>t){a=r;break}this.plugins.splice(a,0,e),e.init&&e.init(this)}unregisterPlugin(e){const t=this.plugins;let a;if(typeof e=="string"?a=t.find(r=>r.name===e):a=e,a&&t.includes(a)){const r=t.indexOf(a);return t.splice(r,1),a.dispose&&a.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}calculateTileViewError(e,t){const a=e.cached,r=this.cameras,i=this._cameraInfo,n=a.boundingVolume;if(!n){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,d=1/0;const h=a.worldTransform;for(let u=0,m=r.length;u<m;u++){const g=i[u];let p,D;if(g.isOrthographic){const B=g.pixelSize;p=e.geometricError/B,D=1/0}else{const B=g.sseDenominator;D=n.distanceToPoint(g.position,h),p=D===0?1/0:e.geometricError/(D*B)}const A=i[u].frustum;n.intersectsFrustum(A,h)&&(o=!0,l=Math.max(l,p),c=Math.min(c,D)),f=Math.max(f,p),d=Math.min(d,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=d)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new b,frustum:new On,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],n=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(n.position.copyFrom(l),n.frustum=i.frustum,n.isOrthographic=i.type===ot.ortho,n.isOrthographic){const c=i.frustumSize;n.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;n.sseDenominator=2*Math.tan(f/2)/o.height}}}preprocessNode(e,t,a=null){if(this._processedTiles.has(e))return e;this._processedTiles.add(e);let r;if(e instanceof rl?r=e:r=new rl(e,a),r.content){const c=r.content;!("uri"in c)&&"url"in c&&(c.uri=c.url,delete c.url)}if(r.basePath=t,r.boundingVolume){const c=new Xr(r.boundingVolume);r.cached.boundingVolume=c}const i=new b(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),n=new R;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)n.rawData[f]=c[f]}if(!a){n.copyFrom(this._upRotationMatrix);const c=new b;c.copyFrom(i),c.applyMatrix4(n);const f=r.cached.boundingVolume.box,d=[new b(f.min.x,f.min.y,f.min.z),new b(f.max.x,f.min.y,f.min.z),new b(f.min.x,f.max.y,f.min.z),new b(f.max.x,f.max.y,f.min.z),new b(f.min.x,f.min.y,f.max.z),new b(f.max.x,f.min.y,f.max.z),new b(f.min.x,f.max.y,f.max.z),new b(f.max.x,f.max.y,f.max.z)];for(const m of d)m.applyMatrix4(n);const h=new Ce;d.forEach(m=>{h.expandByPoint(m)}),n.rawData[12]=-c.x,n.rawData[13]=-c.y,n.rawData[14]=-c.z;const u=h.min;n.rawData[13]-=u.y}const o=new R;o.copyFrom(n),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,n);const l=new R;if(l.copyFrom(o),l.invert(),r.cached.transfrom=n,r.cached.worldTransform=o,r.cached.transformInverse=l,e.children&&e.children.length>0){r.children=[];for(let c=0;c<e.children.length;c++){const f=e.children[c],d=this.preprocessNode(f,t,r);r.children.push(d)}r.childrenProcessed=r.children.length}return r}ensureChildrenArePreprocessed(e,t=!1){const a=e.children;for(let r=0,i=a.length;r<i;r++){const n=a[r];n.basePath!==void 0&&n.basePath!==""||n.cached.boundingVolume||(t?(this.processNodeQueue.remove(n),this.preprocessNode(n,e.basePath,e)):this.processNodeQueue.has(n)||this.processNodeQueue.add(n,o=>{this.preprocessNode(o,e.basePath,e)}))}}_recordCacheHit(){this._cacheHits++}_recordCacheMiss(){this._cacheMisses++}resetCacheStats(){this._cacheHits=0,this._cacheMisses=0}requestTileContents(e){if(e.loadingState!==Br){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=al,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=_r,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async n=>{try{await this.parseTileContent(n,r,i),this.stats.downloading--}catch(o){n.loadingState=_r,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=cu;const i=(c=>{const f=c.split(".");return f.length>1?f[f.length-1]:""})(t),n=a;let o=null;const l=new It;switch(i.toLowerCase()){case"b3dm":{o=(await l.load(n,So,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"i3dm":{o=(await l.load(n,Eo,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"glb":case"gltf":{o=(await l.load(n,xt,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"pnts":{o=(await l.load(n,tu,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"json":try{const c=await _.res.loadJSON(n);e.children.length=0,e.childrenProcessed=0;const f=this._getBasePath(n);if(c.root){const d=this.preprocessNode(c.root,f,e);e.children.push(d),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:c,url:n})}e.loadingState=La;return}catch(c){console.error("Failed to load external tileset:",c),e.loadingState=_r,this.stats.failed++;return}break;default:console.warn(`Unknown tile format: ${i}`);break}if(o){e.cached.scene=o;const c=this._estimateBytesUsed(o);this._bytesUsed.set(o,c),this.lruCache.setMemoryUsage(e,c),this.lruCache.has(e)||this.lruCache.add(e,f=>{if(f.cached.scene){const d=f.cached.scene;d.parent&&d.parent.object3D.removeChild(d),d.destroy(!0),f.cached.scene=null}f.loadingState=Br}),this.setTileImmediateActive(e),e.active=!0,e.__wasSetActive=!0,this.stats.active++,this.setTileImmediateVisible(e),e.visible=!0,e.__wasSetVisible=!0,this.stats.visible++,this.stats.sceneCount++,e.loadingState=La,e.usedLastFrame=!0,tn(e,this),an(e,this)}else e.loadingState=_r,this.stats.failed++}markTileUsed(e){this._usedSet.add(e),this.lruCache.markUsed(e)}setTileDelayedActive(e,t){t?(this._activeTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedActiveTiles.has(e)||this._delayedActiveTiles.add(e)):(this._activeTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedActiveTiles.has(e)&&this._delayedActiveTiles.delete(e))}setTileImmediateActive(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform))}}setTileImmediateVisible(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0)}}_checkDelayedHideTiles(){if(this.stats.downloading===0)for(const e of this._delayedHideTiles){const t=e.cached.scene;t&&(t.transform.enable=!1,this._delayedHideTiles.delete(e))}}_checkDelayedActiveTiles(){for(const e of this._delayedActiveTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform),this._delayedActiveTiles.delete(e))}else this._delayedActiveTiles.delete(e)}_checkDelayedVisibleTiles(){for(const e of this._delayedVisibleTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0,this._delayedVisibleTiles.delete(e))}else this._delayedVisibleTiles.delete(e)}setTileDelayedVisible(e,t){t?(this._visibleTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedVisibleTiles.has(e)||this._delayedVisibleTiles.add(e)):(this._visibleTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedVisibleTiles.has(e)&&this._delayedVisibleTiles.delete(e))}queueTileForDownload(e){e.loadingState!==Br||this.lruCache.isFull()||this._queuedTiles.push(e)}dispatchEvent(e){const t=this._eventListeners.get(e.type);t&&t.forEach(a=>{try{a(e)}catch(r){console.error("Error in event listener:",r)}})}async _loadRootTileSet(){if(!this.rootURL)throw new Error("Root URL is not set");const e=await _.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new R;switch(e.toLowerCase()){case"x":t.makeRotationAxis(b.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(b.X_AXIS,-Math.PI/2);break;default:console.warn(`Unknown gltfUpAxis: ${e}, using default`),t.identity();break}this._upRotationMatrix=t}_applyLocalTransform(e,t){const a=t.decompose(na.EULER_ANGLES);e.localPosition=a[0];const r=new se;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_applyWorldTransform(e,t){const a=t.decompose(na.EULER_ANGLES);e.localPosition=a[0];const r=new se;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_getBasePath(e){const t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}_resolveURL(e,t){return t.startsWith("http://")||t.startsWith("https://")?t:e+"/"+t}_getUrlExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}getMemoryStats(){const e=this.lruCache.getStats(),t=this.lruCache.maxBytesSize,a=e.bytes,r=t-a,i=this._cacheHits+this._cacheMisses,n=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:n}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===La&&e.push(t),!1),null),e}getVisibleTiles(){return Array.from(this._visibleTiles)}getActiveTiles(){return Array.from(this._activeTiles)}getTileTreeStats(){let e=0,t=0,a=0,r=0,i=0,n=0;return this.traverse(o=>(e++,o.loadingState===La&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),n+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?n/e:0}}printDebugInfo(){const e=this.stats,t=this.getMemoryStats(),a=this.getTileTreeStats(),r=this.performanceStats,i=this.lruCache.getStats();console.log("=== TilesRenderer Debug Info ==="),console.log("Stats:",e),console.log("Memory:",t),console.log("Tree:",a),console.log("Performance:",r),console.log("Cache:",i),console.log("Queues:",{load:this.loadQueue.getStats(),process:this.processNodeQueue.getStats()})}setPerformanceOptions(e){e.lruCacheMinSize!==void 0&&(this.lruCache.minSize=e.lruCacheMinSize),e.lruCacheMaxSize!==void 0&&(this.lruCache.maxSize=e.lruCacheMaxSize),e.lruCacheMinBytes!==void 0&&(this.lruCache.minBytesSize=e.lruCacheMinBytes),e.lruCacheMaxBytes!==void 0&&(this.lruCache.maxBytesSize=e.lruCacheMaxBytes),e.lruCacheUnloadPercent!==void 0&&(this.lruCache.unloadPercent=e.lruCacheUnloadPercent),e.downloadQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.downloadQueueMaxJobs),e.parseQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.parseQueueMaxJobs),e.processQueueMaxJobs!==void 0&&(this.processNodeQueue.maxJobs=e.processQueueMaxJobs),e.enablePerformanceStats!==void 0&&(this._enablePerformanceStats=e.enablePerformanceStats),e.enableCacheStats!==void 0&&(this._enableCacheStats=e.enableCacheStats)}dispose(e){[...this.plugins].forEach(a=>this.unregisterPlugin(a)),this.lruCache.clear(),this.loadQueue.clear(),this.processNodeQueue.clear(),this._root=null,this.rootTileSet=null,this.rootLoadingState=Br,this.frameCount=0,this.isLoading=!1,this.resetCacheStats(),this.group.destroy(e)}setCamera(e,t,a){this.cameras.includes(e)||this.cameras.push(e),this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}deleteCamera(e){const t=this.cameras.indexOf(e);t!==-1&&this.cameras.splice(t,1),this._cameraMap.delete(e),this._updateCameraInfo()}setResolution(e,t,a){const r=this._cameraMap.get(e);r?(r.width=t,r.height=a):this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}forEachLoadedModel(e){this.traverse(t=>(t.loadingState===La&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent(he);r&&r.geometry&&(t+=1024),r&&r.material&&(t+=512)}),t}addEventListener(e,t){this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.get(e).push(t)}removeEventListener(e,t){const a=this._eventListeners.get(e);if(a){const r=a.indexOf(t);r!==-1&&a.splice(r,1)}}async loadTileSet(e,t){const r=(e.endsWith("/")?e.slice(0,-1):e)+"/"+t;this.rootURL=r}get modelList(){const e=[];return this.forEachLoadedModel(t=>{e.push(t)}),e}}class hm{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class um{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class bm{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class gm{uri;group;metadata}class pm{class;properties}function mm(s,e){let t=0,a=null;return function(...r){const i=Date.now(),n=i-t;n>=e?(t=i,s.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),s.apply(this,r),a=null},e-n))}}class Am extends vt{static count=0;constructor(){super(),Y.register("ColorLitShader",Jd),this.shader=new At;let e=new qe("ColorLitShader","ColorLitShader");e.passType=fe.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new J),e.setUniformColor("emissiveColor",new J),e.setUniformFloat("envIntensity",1),e.setUniformFloat("normalScale",1),e.setUniformFloat("roughness",0),e.setUniformFloat("metallic",0),e.setUniformFloat("ao",1),e.setUniformFloat("alphaCutoff",0);let t=e.shaderState;t.acceptShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,e.setTexture("normalMap",_.res.normalTexture),e.setTexture("emissiveMap",_.res.blackTexture)}clone(){return null}debug(){}}class Dm extends vt{constructor(){super();let e=new qe("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=fe.COLOR,e.setUniformVector4("transformUV1",new be(0,0,1,1)),e.setUniformVector4("transformUV2",new be(0,0,1,1)),e.setUniformColor("baseColor",new J(1,1,1,1)),e.setUniformFloat("alphaCutoff",.5);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1;let a=new At;a.addRenderPass(e),this.shader=a,this.baseMap=_.res.grayTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}function _m(s,e){}class Bm extends vt{constructor(){super(),this.shader=new $i,this.baseMap=_.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set shadowMap(e){}}class fl{clipName;loopTime;startTime;stopTime;sampleRate;useSkeletonPos;useSkeletonScale;positionCurves=new Map;rotationCurves=new Map;scaleCurves=new Map;floatCurves=new Map;formBytes(e){if(this.clipName=e.readUTF(),this.loopTime=!e.readInt32(),this.startTime=e.readFloat32(),this.stopTime=e.readFloat32(),this.sampleRate=e.readInt32(),this.useSkeletonPos=e.readInt32()>0,this.useSkeletonScale=e.readInt32()>0,this.useSkeletonPos){let r=e.readInt32();for(let i=0;i<r;i++){let n=new xr;n.formBytes(e),this.positionCurves.set(n.path,n)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new xr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let n=new xr;n.formBytes(e),this.scaleCurves.set(n.path,n)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new xr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class xr{path;attribute;propertys;preInfinity;postInfinity;rotationOrder;m_curves;k=0;_cacheValue;_kValue;constructor(e=1){this.k=e,this.m_curves=[],this.check()}check(){for(let e=0;e<this.k;e++)this.m_curves[e]||=new Li;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new de;break;case 3:this._cacheValue=new b;break;case 4:this._cacheValue=new be;break}}get totalTime(){return this.m_curves[0].totalTime}addKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].addKeyFrame(e.getK(t))}removeKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].removeKeyFrame(e.getK(t))}getValue(e){switch(this.k){case 1:this._cacheValue=this.m_curves[0].getValue(e);break;case 2:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e);break;case 3:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e),this._cacheValue.z=this.m_curves[2].getValue(e);break;case 4:const t=this.m_curves[0].getCurveFramesExtent(e),a=t.lhsIndex,r=t.rhsIndex;e=t.time;let i=this.m_curves[0].getKey(a),n=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(n.time-i.time);se.HELP_0.set(this.m_curves[0].getKey(a).value,this.m_curves[1].getKey(a).value,this.m_curves[2].getKey(a).value,this.m_curves[3].getKey(a).value),se.HELP_1.set(this.m_curves[0].getKey(r).value,this.m_curves[1].getKey(r).value,this.m_curves[2].getKey(r).value,this.m_curves[3].getKey(r).value),se.HELP_2.slerp(se.HELP_0,se.HELP_1,o),this._cacheValue.x=se.HELP_2.x,this._cacheValue.y=se.HELP_2.y,this._cacheValue.z=se.HELP_2.z,this._cacheValue.w=se.HELP_2.w;break}return this._cacheValue}getKeyCount(){return this.m_curves[0].getKeyCount()}getKey(e){let t=[];for(let a=0;a<this.k;a++)t.push(this.m_curves[a].getKey(e));return t}formBytes(e){this.path=e.readUTF(),this.k=e.readInt32(),this.check(),this.attribute=e.readUTF(),this.propertys=this.attribute.split("."),this.preInfinity=e.readInt32(),this.postInfinity=e.readInt32(),this.rotationOrder=e.readInt32();let t=e.readInt32();for(let a=0;a<t;a++){let r=new as(0);r.formBytes(e),this.addKeyFrame(r)}}}class vm extends Map{negtive;constructor(e){if(super(e),this.negtive=new Map,e)for(let t of e)this.negtive.set(t[1],t[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.negtive.delete(t),super.delete(e)}return!1}getKey(e){return this.negtive.get(e)}deleteValue(e){let t=this.negtive.get(e);return t&&this.delete(t),this.negtive.delete(e)}set(e,t){return super.set(e,t),this.negtive.set(t,e),this}clear(){this.negtive.clear(),super.clear()}}class xm{colorArray;constructor(e){this.colorArray=e}getColor(e){let t=e*this.colorArray.length,a=Math.floor(t),r=Math.min(a+1,this.colorArray.length-1),i=this.colorArray[a],n=this.colorArray[r];return J.lerp(t-a,i,n)}}class rn{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return b.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,n=e*e*e;return this.controlVertices[0].mul(a).add(this.controlVertices[1].mul(r)).add(this.controlVertices[2].mul(i)).add(this.controlVertices[3].mul(n))}getTangent(e){if(!(e>=0&&e<=1))return b.ZERO;let t=this.controlVertices,a=t[0].add(t[1].add(t[0]).mul(e)),r=t[1].add(t[2].add(t[1]).mul(e)),i=t[2].add(t[3].add(t[2]).mul(e)),n=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(n)}getClosestParam(e,t=1e-6){return this.getClosestParamRec(e,0,1,t)}getClosestParamRec(e,t,a,r){let i=(t+a)/2;if(a-t<r)return i;let n=(t+i)/2,o=(i+a)/2,l=this.getPoint(n),c=this.getPoint(o),f=l.subtract(e).lengthSquared,d=c.subtract(e).lengthSquared;return f<d?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var Du=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(Du||{});class Um{type=0;numCurveSegments=0;numControlVertices=0;controlVertices=[];constructor(e,t=0){this.setControlVertices(e,t)}getPathType(){return this.type}isClosed(){return this.type==1}isValid(){return this.numCurveSegments>0}clear(){this.controlVertices.length=0,this.type=0,this.numCurveSegments=0,this.numControlVertices=0}computeApproxLength(){if(!this.isValid())return 0;let e=this.numCurveSegments+1;if(e<2)return 0;let t=0,a=this.controlVertices;for(let r=1;r<e;r++){let i=a[(r-1)*3],n=a[r*3];t+=i.subtract(n).lengthSquared}return t==0?0:t}computeApproxParamPerUnitLength(){let e=this.computeApproxLength();return this.numCurveSegments/e}computeApproxNormParamPerUnitLength(){return 1/this.computeApproxLength()}interpolatePoints(e,t){let a=e.length;a<2&&console.error("point count must great 1"),this.clear(),this.type=t;let r=this.controlVertices;switch(t){case 0:{this.numCurveSegments=a-1,this.numControlVertices=3*a-2,r.length=this.numControlVertices;for(let o=0;o<a;o++)r[o*3]=e[o];let i=e[1].subtract(e[0]).mul(.25);r[1]=e[0].add(i);let n=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(n);for(let o=1;o<this.numCurveSegments;o++){let l=e[o-1].subtract(e[o]),c=e[o+1].subtract(e[o]),f=l.lengthSquared,d=c.lengthSquared;if(f>0&&d>0){let h=(f+d)/8,u=c.div(d).subtract(l.div(f));u.normalize(),u=u.mul(h),r[o*3-1]=e[o].subtract(u),r[o*3+1]=e[o].add(u)}else r[o*3-1]=e[o],r[o*3+1]=e[o]}break}case 1:{this.numCurveSegments=a,this.numControlVertices=3*a+1,r.length=this.numControlVertices;for(let i=0;i<a;i++)r[i*3]=e[i];r[this.numControlVertices-1]=e[0];for(let i=1;i<=this.numCurveSegments;i++){let n=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[n].subtract(e[l]),f=e[o].subtract(e[l]),d=c.lengthSquared,h=f.lengthSquared,u=3*i-1,m=(3*i+1)%(this.numControlVertices-1);if(d>0&&h>0){let g=(d+h)/8,p=f.div(h).subtract(c.div(d));p.normalize(),p=p.mul(g),r[u]=e[l].subtract(p),r[m]=e[l].add(p)}else r[u]=e[l],r[m]=e[l]}break}}}setControlVertices(e,t){let a=e.length;a<=0||t==0&&a<4||t==1&&a<7||(a-1)%3==0&&(this.clear(),this.type=t,this.numControlVertices=a,this.numCurveSegments=(a-1)/3,this.controlVertices=e)}getPoint(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Gt.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=[],r=this.controlVertices;return a[0]=r[3*t+0],a[1]=r[3*t+1],a[2]=r[3*t+2],a[3]=r[3*t+3],new rn(a).getPoint(e-t)}getPointNorm(e){return this.getPoint(e*this.numCurveSegments)}getTangent(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Gt.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=this.controlVertices,r=[];return r[0]=a[3*t+0],r[1]=a[3*t+1],r[2]=a[3*t+2],r[3]=a[3*t+3],new rn(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],n=new rn(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let d=0;d<4;d++)i[d]=this.controlVertices[o+d];n.setControlVertices(i);let l=n.getClosestParam(e,t),f=n.getPoint(l).subtract(e).lengthSquared;f<a&&(a=f,r=o/3+l)}return r}computeClosestNormParam(e,t){return this.computeClosestParam(e,t*this.numCurveSegments)}}class ym extends Map{valueList;keyList;isChange=!0;constructor(e,t,a){if(super(e),t&&(this.keyList=[]),a&&(this.valueList=[]),e)for(let r of e)this.valueList?.push(r[1]),this.keyList?.push(r[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.valueList&&this.deleteValue(t),this.keyList&&this.deleteKey(e),this.isChange=!0,super.delete(e)}return!1}deleteValue(e){let t=this.valueList.indexOf(e);return t>=0&&this.valueList.splice(t,1),this}deleteKey(e){let t=this.keyList.indexOf(e);return t>=0&&this.keyList.splice(t,1),this}set(e,t){return this.delete(e),this.keyList?.push(e),this.valueList?.push(t),super.set(e,t),this.isChange=!0,this}clear(){this.valueList&&(this.valueList.length=0),this.keyList&&(this.keyList.length=0),this.isChange=!0,super.clear()}}var _u=(s=>(s[s.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",s[s.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",s[s.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",s[s.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",s[s.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",s[s.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",s[s.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",s[s.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",s[s.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",s[s.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",s[s.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",s[s.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",s[s.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",s))(_u||{});const Cm=3.141592653589793;class Sm{}function Bu(s,e,t){let a=.3333333333333333,r=.5,i=s*a,n=i*i,l=n*i-i*e*r+t*r,c=-n+e*a,f=c*c*c,d=f+l*l;if(d>=0){let m=Math.sqrt(d)-l;return m=m>0?Math.pow(m,a):-Math.pow(-m,a),-i-c/m+m}let h=Math.sqrt(-f),u=Math.acos(-l/h);return h=Math.pow(h,a),h=h-c/h,u=-i+h*Math.cos(u*a),u}function sn(s,e,t,a){let r=1e-5;if(Math.abs(s)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*s*t;if(i<0)return 0;let n=.5/s,o=Math.sqrt(i);return a.r0=(o-e)*n,a.r1=(-o-e)*n,2}function vu(s,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let n=t/e,o=a/e,l=r/e;s[0]=Bu(n,o,l),i++;let c=e,f=t+e*s[0],d=a+t*s[0]+e*s[0]*s[0];i+=sn(c,f,d,{r0:s[1],r1:s[2]})}else i+=sn(t,a,r,{r0:s[1],r1:s[2]});return i}class Ga{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class nr{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[nr.kMaxNumSegments]=new Ga,this.integrationCache[nr.kMaxNumSegments]=0,this.doubleIntegrationCache[nr.kMaxNumSegments]=0,this.times[nr.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=de.ZERO.clone(),t=20,a=1/t,r=a;for(let i=0;i<t;i++)this.calculateMinMax(e,this.evaluateDoubleIntegrated(r)),r+=a;return e}findMinMaxIntegrated(){let e=de.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],n=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=vu(c,i,n,o,l);for(let d=0;d<f;d++){let h=c[d]+t[r];h>=t[r]&&h<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(h))}this.calculateMinMax(e,this.evaluateIntegrated(a[r])),this.times[r]}return e}generateIntegrationCache(e){e.integrationCache[0]=0;let t=e.times[0],a=0;for(let r=1;r<e.segmentCount;r++){let i=e.segments[r-1].coeff;dl(i);let n=t-a;e.integrationCache[r]=e.integrationCache[r-1]+Ga.EvalSegment(n,i)*n,a=t,t=e.times[r]}}generateDoubleIntegrationCache(e){let t=0,a=0;for(let r=0;r<e.segmentCount;r++){e.doubleIntegrationCache[r]=t;let i=e.times[r]-a;i=Math.max(i,0),t+=Ga.EvalSegment(i,e.segments[r].coeff)*i*i+e.integrationCache[r]*i,a=e.times[r]}}integrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)dl(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)xu(this.segments[e].coeff);this.generateDoubleIntegrationCache(this)}static isValidCurve(e){let t=e.getKeyCount(),a=t-1;return e.getKey(0).time!=0&&a++,e.getKey(t-1).time!=1&&a++,a<=nr.kMaxNumSegments}evaluateDoubleIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.doubleIntegrationCache[a]+this.integrationCache[a]*r+Ga.EvalSegment(r,this.segments[a].coeff)*r*r}t=this.times[a]}return 1}evaluateIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.integrationCache[a]+Ga.EvalSegment(r,this.segments[a].coeff)*r}t=this.times[a]}return 1}evaluate(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a])return Ga.EvalSegment(e-t,this.segments[a].coeff);t=this.times[a]}return 1}buildCurve(e,t){let a=e.getKeyCount();this.segmentCount=1;let r=1.01;if(this.segments.length=0,this.integrationCache.length=0,this.doubleIntegrationCache.length=0,this.times.length=0,this.times[0]=r,a!=0)if(a==1)this.segments[0]=new Ga,this.segments[0].coeff[3]=e.getKey(0).value*t;else{this.segmentCount=a-1;let i=0;e.getKey(0).time!=0&&(this.segments[0].coeff[3]=e.getKey(0).value,this.times[0]=e.getKey(0).time,i=1);for(let n=0;n<this.segmentCount;n++){let o;e.calculateCacheData(o,n,n+1,0),this.segments[n+i].coeff=o.coeff.concat(),this.times[n+i]=e.getKey(n+1).time}this.segmentCount+=i,e.getKey(a-1).time!=1&&(this.segments[this.segmentCount].coeff[3]=e.getKey(a-1).value,this.segmentCount++),this.times[this.segmentCount-1]=r;for(let n=0;n<this.segmentCount;n++)this.segments[n].coeff[0]*=t,this.segments[n].coeff[1]*=t,this.segments[n].coeff[2]*=t,this.segments[n].coeff[3]*=t}return!0}}function xu(s){s[0]/=20,s[1]/=12,s[2]/=6,s[3]/=2}function dl(s){s[0]/=4,s[1]/=3,s[2]/=2,s[3]/=1}var Uu=(s=>(s[s.kEMScalar=0]="kEMScalar",s[s.kEMOptimized=1]="kEMOptimized",s[s.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",s[s.kEMSlow=3]="kEMSlow",s))(Uu||{}),yu=(s=>(s[s.kMMCScalar=0]="kMMCScalar",s[s.kMMCCurve=1]="kMMCCurve",s[s.kMMCTwoCurves=2]="kMMCTwoCurves",s[s.kMMCTwoConstants=3]="kMMCTwoConstants",s))(yu||{});class Fm{max;min}class km{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class Cu{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new Li,this.maxCurve=new Li}setScalar(e){this._scalar=e}getScalar(){return this._scalar}static evaluateSlow(e,t,a){let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==2?Mr(e.minCurve.getValue(t)*e.getScalar(),r,a):r}static evaluate(e,t,a=1){if(e.minMaxState==0)return e.getScalar();let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==1?Mr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?Mr(e._minScalar,e._scalar,a):e.minMaxState==2?Mr(e.minCurve.getValue(t)*e.getScalar(),r,1*Math.random()):this.evaluateSlow(e,t,1)}unSerialized(e){this.minMaxState=e.minMaxState,this._scalar=e.scalar,this._minScalar=e.minScalar,this.maxCurve.unSerialized(e.maxCurve),this.minCurve.unSerialized(e.minCurve)}}class Em{value=0;mode=0;spread=0;speed=new Cu;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function wm(s,e){let t=nr.isValidCurve(s.max);return e!=2&&e!=3?t:t&&nr.isValidCurve(s.min)}function Im(s,e,t,a){s.max.buildCurve(e.max,t),a!=2&&a!=3?s.min.buildCurve(e.max,t):s.min.buildCurve(e.min,t)}function Rm(s,e){let t=e.getKeyCount();if(t!=0)if(t==1)es(s,e.getKey(0).value);else{let a=t-1;es(s,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Lo;e.calculateCacheData(i,r,r+1,0);let n=3*i.coeff[0],o=2*i.coeff[1],l=1*i.coeff[2],c=e.getKey(r).time,f=e.getKey(r+1).time,d=[],h=sn(n,o,l,{r0:d[0],r1:d[1]});for(let u=0;u<h;u++)d[u]>=0&&d[u]+c<f&&es(s,Ga.EvalSegment(d[u],i.coeff));es(s,Ga.EvalSegment(f-c,i.coeff))}}}function es(s,e){s.x=Math.min(s.x,e),s.y=Math.max(s.y,e)}class Vr{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class Su{a;b;c;d;static ALIGN_ANY=0;static ALIGN_XY_AXIS=1;static ALIGN_YZ_AXIS=2;static ALIGN_XZ_AXIS=3;constructor(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}setTo(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}fromPoints(e,t,a){var r=t.x-e.x,i=t.y-e.y,n=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-n*l,this.b=n*o-r*c,this.c=r*l-i*o,this.d=-(this.a*e.x+this.b*e.y+this.c*e.z)}fromNormalAndPoint(e,t){this.a=e.x,this.b=e.y,this.c=e.z,this.d=-(this.a*t.x+this.b*t.y+this.c*t.z)}normalize(){var e=Math.sqrt(this.a*this.a+this.b*this.b+this.c*this.c);if(e>0){var t=1/e;this.a*=t,this.b*=t,this.c*=t,this.d*=t}return e}distance(e){return this.a*e.x+this.b*e.y+this.c*e.z+this.d}classifyPoint(e,t=.01){var a=this.distance(e);return a<-t?Vr.BACK:a>t?Vr.FRONT:Vr.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function Qm(s,e){return Math.random()*e+Math.random()*s+(e-s)*Math.random()}function Tm(s,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*s*a+(e-s)*Math.random()*a}function Fu(s,e,t){let a=0,r=0;for(;a===0;)a=Math.random();for(;r===0;)r=Math.random();let i=Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*r);return i=i/10+.5,(i>1||i<0)&&(i=Fu(s,e,t)),i=Math.pow(i,t),i*=e-s,i+=s,i}function Ca(s){return s>0?Math.floor(s):Math.floor(s)-1}let Ue=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];function hl(s,e){let t=s&15,a=1+(t&7);return t&8&&(a=-a),a*e}function nn(s,e,t){let a=s&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function ts(s,e,t,a){let r=s&15,i=r<8?e:t,n=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-n:n)}function _i(s,e,t,a,r){let i=s&31,n=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-n:n)+(i&2?-o:o)+(i&4?-l:l)}let ea=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]];function Mm(s){let e=Ca(s),t=e+1,a=s-e,r=a-1,i,n,o=1-a*a;o*=o,i=o*o*hl(Ue[e&255],a);let l=1-r*r;return l*=l,n=l*l*hl(Ue[t&255],r),.25*(i+n)}function Nm(s,e){const t=.366025403,a=.211324865;let r,i,n,o=(s+e)*t,l=s+o,c=e+o,f=Ca(l),d=Ca(c),h=(f+d)*a,u=f-h,m=d-h,g=s-u,p=e-m,D,A;g>p?(D=1,A=0):(D=0,A=1);let B=g-D+a,v=p-A+a,U=g-1+2*a,y=p-1+2*a,S=f&255,F=d&255,C=.5-g*g-p*p;C<0?r=0:(C*=C,r=C*C*nn(Ue[S+Ue[F]],g,p));let w=.5-B*B-v*v;w<0?i=0:(w*=w,i=w*w*nn(Ue[S+D+Ue[F+A]],B,v));let E=.5-U*U-y*y;return E<0?n=0:(E*=E,n=E*E*nn(Ue[S+1+Ue[F+1]],U,y)),40*(r+i+n)}function Pm(s,e,t){const a=.333333333,r=.166666667;let i,n,o,l,c=(s+e+t)*a,f=s+c,d=e+c,h=t+c,u=Ca(f),m=Ca(d),g=Ca(h),p=(u+m+g)*r,D=u-p,A=m-p,B=g-p,v=s-D,U=e-A,y=t-B,S,F,C,w,E,Q;v>=U?U>=y?(S=1,F=0,C=0,w=1,E=1,Q=0):v>=y?(S=1,F=0,C=0,w=1,E=0,Q=1):(S=0,F=0,C=1,w=1,E=0,Q=1):U<y?(S=0,F=0,C=1,w=0,E=1,Q=1):v<y?(S=0,F=1,C=0,w=0,E=1,Q=1):(S=0,F=1,C=0,w=1,E=1,Q=0);let T=v-S+r,j=U-F+r,ue=y-C+r,ee=v-w+2*r,N=U-E+2*r,M=y-Q+2*r,O=v-1+3*r,W=U-1+3*r,ae=y-1+3*r,z=u&255,K=m&255,$=g&255,re=.6-v*v-U*U-y*y;re<0?i=0:(re*=re,i=re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-C*C-w*w-E*E-Q*Q;wr<0?n=0:(wr*=wr,n=wr*wr*_i(Ue[Pt+Ue[ga+Ue[pa+Ue[ra]]]],C,w,E,Q));let Ir=.6-le*le-ge*ge-Ie*Ie-me*me;Ir<0?o=0:(Ir*=Ir,o=Ir*Ir*_i(Ue[Pt+W+Ue[ga+ae+Ue[pa+z+Ue[ra+K]]]],le,ge,Ie,me));let Rr=.6-ye*ye-Se*Se-Me*Me-Ze*Ze;Rr<0?l=0:(Rr*=Rr,l=Rr*Rr*_i(Ue[Pt+$+Ue[ga+re+Ue[pa+ce+Ue[ra+Ae]]]],ye,Se,Me,Ze));let Qr=.6-$e*$e-ft*ft-ja*ja-ba*ba;Qr<0?c=0:(Qr*=Qr,c=Qr*Qr*_i(Ue[Pt+Qe+Ue[ga+Ve+Ue[pa+H+Ue[ra+ie]]]],$e,ft,ja,ba));let Tr=.6-Ra*Ra-Xt*Xt-Qa*Qa-Ta*Ta;return Tr<0?f=0:(Tr*=Tr,f=Tr*Tr*_i(Ue[Pt+1+Ue[ga+1+Ue[pa+1+Ue[ra+1]]]],Ra,Xt,Qa,Ta)),27*(n+o+l+c+f)}class Dl extends de{static uv_0=new Dl;u=0;v=0;constructor(e=0,t=0){super(e,t),this.u=e,this.v=t}length(){return 0}static getUVSheet(e,t,a){let r=Math.floor(e%(t*a)),i=Math.floor(r/t),n=r%t;return new be(i/t,n/a,1/t,1/a)}}class as{serializedVersion="2";time;tangentMode=0;weightedMode=0;propertyKeyFrame;constructor(e=0){this.time=e,this.propertyKeyFrame={}}getK(e){return this.propertyKeyFrame[e]}split(e,t,a){switch(e){case X.single:{let r=this.getKeyFrame(0);r[a]=t}break;case X.float:{let r=this.getKeyFrame(0);r[a]=t}break;case X.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y}break;case X.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case X.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case X.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break}}getKeyFrame(e){let t=this.propertyKeyFrame[e];return t||(t=new Js,t.time=this.time,t.tangentMode=this.tangentMode,t.weightedMode=this.weightedMode,this.propertyKeyFrame[e]=t),t}formBytes(e){this.time=e.readFloat32();{let{t,v:a}=Wa.parser(e);this.split(t,a,"value")}{let{t,v:a}=Wa.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Wa.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Wa.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Wa.parser(e);this.split(t,a,"outWeight")}}}class Om{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new de(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new b(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new be(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}case"Quaternion":{let r=e,i=t;return new se(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}}}}class rs{_keys=new Array;_values=new Array;getIndexByKey(e){return this._keys.indexOf(e)}getValueByKey(e){var t=this.getIndexByKey(e);return t>-1?this._values[t]:null}put(e,t){if(e==null)return null;var a=this.remove(e);return this._keys.push(e),this._values.push(t),a}remove(e){var t=this._keys.indexOf(e),a;return t>-1&&(a=this._values[t],this._keys.splice(t,1),this._values.splice(t,1)),a}getValues(){return this._values}getKeys(){return this._keys}clear(){this._values.length=0,this._keys.length=0}}class Ur{static WalkAble=1}class is{static SetConst(e){this.EPSILON=e,this.POWER_EPSILON=e*e}static EPSILON=.1;static POWER_EPSILON=this.EPSILON*this.EPSILON}class Qt extends b{static CALC_VECTOR3D1=new b;static CALC_VECTOR3D2=new b;static CALC_VECTOR3D3=new b;static CALC_VECTOR3D4=new b;static CALC_VECTOR3D5=new b;_pointId=0;constructor(e,t,a,r){super(t,a,r,0),this._pointId=e}get id(){return this._pointId}static equalPoint(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)+(e.z-t.z)*(e.z-t.z)<is.POWER_EPSILON}static calcDistance(e,t){return Qt.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),Qt.CALC_VECTOR3D3.length}}class ku{_openedList;_closedList;_endNode;_startNode;_triangleChannel;_navMesh;_findIndex=0;constructor(){this._openedList=new Array,this._closedList=new Array}findPath(e,t,a){return this._findIndex++,this._navMesh=e,this._startNode=t,this._endNode=a,this._openedList.length=0,this._closedList.length=0,this._startNode&&this._endNode?(this._startNode.gg=0,this._startNode.h=0,this._startNode.f=0,this._startNode.parent=null,this.search()):!1}search(){for(var e=this._startNode,t=[],a;e!=this._endNode;){t=e.getNeibourTriangles(t,Ur.WalkAble,Ur.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+Qt.calcDistance(a,e)*a.costMultiplier,i=Qt.calcDistance(a,this._endNode),n=r+i;a.openId==this._findIndex?a.f>n&&(a.f=n,a.gg=r,a.h=i,a.parent=e):(a.f=n,a.gg=r,a.h=i,a.parent=e,a.openId=this._findIndex,this._openedList.push(a))}if(e.closeId=this._findIndex,this._closedList.push(e),this._openedList.length==0)return!1;this._openedList.sort(function(o,l){return o.f-l.f}),e=this._openedList.shift()}return this.buildPath(),!0}buildPath(){this._triangleChannel=[];var e=this._endNode;for(this._triangleChannel.push(e);e!=this._startNode;)e=e.parent,this._triangleChannel.unshift(e)}get channel(){return this._triangleChannel}}class Fa extends Qt{_ownerPoint;_ownerEdge;radius=0;constructor(e,t){super(e.id,0,0,0),this._ownerEdge=t,this._ownerPoint=e}get ownerPoint(){return this._ownerPoint}get ownerEdge(){return this._ownerEdge}scalePoint(e=.7){var t=new Fa(this._ownerPoint,this._ownerEdge);return t.copyFrom(this),t.decrementBy(this._ownerPoint),t.scaleBy(e),t.radius=t.length,t.incrementBy(this._ownerPoint),t}}class Ea{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new b;constructor(e,t){if(this._pointA=e,this._pointB=t,e.id>=t.id)throw new Error("edge point order error!!!");this._triangleOwners=new Array,this._centerPoint=new b,this._edgeMask=Ur.WalkAble,Qt.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=Qt.CALC_VECTOR3D1.length,this._centerPoint.setTo((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2)}get size(){return this._edgeSize}get triangleOwners(){return this._triangleOwners}get centerPoint(){return this._centerPoint}initFatPoints(e){this._edgeDirA2B=this._pointB.subtract(this._pointA),this._edgeDirA2B.normalize(),this.fatPointA=this.fatPointA||new Fa(this._pointA,this),this.fatPointB=this.fatPointB||new Fa(this._pointB,this),this.fatPointA.radius!=e&&(Ea.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),Ea.CALC_FAT_VECTOR.scaleBy(e),Ea.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(Ea.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(Ea.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),Ea.CALC_FAT_VECTOR.scaleBy(-e),Ea.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(Ea.CALC_FAT_VECTOR),this.fatPointB.radius=e)}getFatPoint(e){return e==this._pointA?this.fatPointA:this.fatPointB}getAnotherFatPoint(e){return e==this._pointA?this.fatPointB:this.fatPointA}getAnotherPoint(e){return e==this._pointA?this._pointB:this._pointA}containsPoint(e){return Qt.equalPoint(e,this._pointA)?this._pointA:Qt.equalPoint(e,this._pointB)?this._pointB:null}addTriangleOwners(e){if(e.edges.indexOf(this)==-1)throw new Error("the edge is not belong triangle!!!");this._triangleOwners.indexOf(e)==-1&&this._triangleOwners.push(e)}getPublicPoint(e){return this._pointA==e._pointA||this._pointA==e._pointB?this._pointA:this._pointB==e._pointA||this._pointB==e._pointB?this._pointB:null}getEqualPoint(e){return Qt.equalPoint(e,this._pointA)?this._pointA:Qt.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&Ur.WalkAble)==Ur.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class _e{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new b;static RAY_2=new b;static TEST_RAY=new b;static TEST_RAY_1=new b;static TEST_RAY_2=new b;static CALC_CROSS_POINT=new b;static CALC_CROSS_TEST=new b;cornerPoint;cornerEdge;continuePass(e,t,a){this.resetData(),this.curPoint=e,this.endPoint=t,this.cornerEdge=a}passEdge(e,t,a,r){if((this.rayA==null||this.rayB==null)&&(this.rayA=_e.RAY_1,this.rayB=_e.RAY_2,this.rayAPoint=e.pointA,this.rayBPoint=e.pointB,this.rayA.setTo(this.rayAPoint.x-this.curPoint.x,0,this.rayAPoint.z-this.curPoint.z),this.rayB.setTo(this.rayBPoint.x-this.curPoint.x,0,this.rayBPoint.z-this.curPoint.z)),r)return this.checkEndPoint(a);if(_e.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(_e.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(_e.TEST_RAY),a instanceof Qt?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(_e.TEST_RAY),a instanceof Qt?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);_e.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(_e.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var n;if(_e.TEST_RAY_1.copyFrom(t.pointA),_e.TEST_RAY_1.decrementBy(this.curPoint),_e.TEST_RAY_2.copyFrom(t.pointB),_e.TEST_RAY_2.decrementBy(this.curPoint),_e.TEST_RAY_1.y=0,_e.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,_e.TEST_RAY_1,_e.TEST_RAY_2)||this.isPointAtCenter(this.rayB,_e.TEST_RAY_1,_e.TEST_RAY_2)?n=!1:n=!0,n)return this.isPointAtCenter(this.rayA,_e.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return _e.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(_e.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,_e.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1)}calcCrossEdge(e,t,a){return this.calcCrossPoint(e.fatPointA,e.fatPointB,t,a)}calcCrossPoint(e,t,a,r){_e.CALC_CROSS_POINT.copyFrom(t),_e.CALC_CROSS_POINT.decrementBy(e);let i=_e.CALC_CROSS_POINT.x*r.z-r.x*_e.CALC_CROSS_POINT.z;var n=0;return i!=0&&(n=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),n>1?n=1:n<0&&(n=0),_e.CALC_CROSS_POINT.scaleBy(n),_e.CALC_CROSS_POINT.incrementBy(e),_e.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){_e.CALC_CROSS_POINT.copyFrom(t),_e.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(_e.CALC_CROSS_POINT.x*r.z-r.x*_e.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(_e.CALC_CROSS_POINT.scaleBy(i),_e.CALC_CROSS_POINT.incrementBy(e),_e.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){_e.CALC_CROSS_TEST.copyFrom(t),_e.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(_e.CALC_CROSS_TEST.x*r.z-r.x*_e.CALC_CROSS_TEST.z);return i<=1&&i>=0}isPointAtCenter(e,t,a){var r=t.crossProduct(e);if(r.length==0&&e.length<t.length)return!0;var i=a.crossProduct(e);return i.length==0&&e.length<a.length?!0:(r.normalize(),i.normalize(),r.incrementBy(i),r.length<.01)}resetData(){this.cornerEdge=null,this.cornerPoint=null,this.curPoint=null,this.rayA=this.rayB=null,this.rayAPoint=this.rayBPoint=null,_e.RAY_1.setTo(0,0,0),_e.RAY_2.setTo(0,0,0)}}class sr{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new b;constructor(){this._router=new _e}searchPath(e,t,a,r=0){return r<=0&&(r=1),this._aiRadius=r*1.5,this.searchEnable(e,t,a)?(this.search(e,t,a),!0):!1}get path(){return this._result}searchEnable(e,t,a){return!(e==null||t==null||a==null||a[0].plane.classifyPoint(e,is.EPSILON)!=Vr.INTERSECT||a[a.length-1].plane.classifyPoint(t,is.EPSILON)!=Vr.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,n,o,l,c;for(r=0;r<i;r++)o=a[r].getPublicEdge(a[r+1]),o.crossPoint=null,o.initFatPoints(this._aiRadius),this._tempPublicEdgeList.push(o),n=a[r],c=n.plane,n=a[r+1],l=n.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,is.EPSILON)==Vr.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,d,h,u;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],n=a[r+1],u=r==i-1,u?l=t:l=n.getEdgeAgainstPoint(o),h=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,u),h||(f=this._router.cornerPoint,d=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(d),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let m=[];for(let g of this._result)m.push(new b().copyFrom(g));this._result=m}optimusTerminusFat(){var e,t,a;a=this._result[1],a instanceof Fa&&(e=a),a=this._result[this._result.length-2],a instanceof Fa&&(t=a),e&&(this._result[1]=e.scalePoint()),t&&e!=t&&(this._result[this._result.length-2]=t.scalePoint())}pushAllPathPoint2(e,t){var a=this._tempPublicEdgeList.length,r,i;this._result=new Array,this._result.push(e);for(var n=e,o,l,c,f=0;f<a;f++)if(r=this._tempPublicEdgeList[f],l=null,r.crossPoint)l=this.getFatPoint(r,r.crossPoint),l?this._result.push(l):this._result.push(r.crossPoint),n=r.crossPoint;else{i=null,o=null;for(var d=f+1;d<a&&(i=this._tempPublicEdgeList[d],o=i.crossPoint,!o);d++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==n?c=o.clone():(sr.CROSS_TEST_DIRECTION.setTo(o.x-n.x,0,o.z-n.z),c=this._router.calcCrossEdge(r,n,sr.CROSS_TEST_DIRECTION)),this._result.push(c))}this._result.push(t)}optimusByRadius(){var e=new Array;e.length=this._result.length;var t=this._result.length-2,a,r,i,n,o,l,c,f,d,h,u,m,g;for(g=0;g<t;g++)c=f=d=null,n=o=l=null,u=!1,m=null,a=this._result[g],r=this._result[g+1],i=this._result[g+2],a instanceof Fa&&(n=a),r instanceof Fa&&(o=r),i instanceof Fa&&(l=i),n&&(c=n.ownerPoint),o&&(f=o.ownerPoint),l&&(d=l.ownerPoint),c&&f&&c==f&&f!=d&&(u=!0),d&&f&&d==f&&c!=f&&(u=!0),u&&(sr.CROSS_TEST_DIRECTION.copyFrom(a),sr.CROSS_TEST_DIRECTION.decrementBy(i),h=o.ownerEdge,u=this._router.hasCrossPoint(h.pointA,h.pointB,i,sr.CROSS_TEST_DIRECTION),u&&(m=this._router.calcCrossPointOut(f,r,i,sr.CROSS_TEST_DIRECTION)),m&&(e[g+1]=m))}getFatPoint(e,t){if(e==null)return null;var a;t instanceof Fa&&(a=t);var r;return a?r=a.ownerPoint:r=e.getEqualPoint(t),r==null?null:(a=e.getFatPoint(r),a)}}class Eu extends b{_id=0;_plane;_points=new Array;_edges=new Array;_neibourTriangles=new rs;_pointAgainstEdge=new rs;_edgeAgainstPoint=new rs;_mask=0;_aabbBox;f=0;gg=0;h=0;parent;costMultiplier=1;openId=0;closeId=0;get aabb(){return this._aabbBox}initAABB(){this._aabbBox=new Nt,this._aabbBox.addPoint(this._points[0]),this._aabbBox.addPoint(this._points[1]),this._aabbBox.addPoint(this._points[2])}calcGlobalQuadAABB(){}get isTriangle(){return!0}constructor(e,t,a,r){super(0,0,0,0),this._id=e,this._mask=Ur.WalkAble,this._edges.push(t,a,r);var i;for(i of this._edges)this._points.indexOf(i.pointA)==-1&&this._points.push(i.pointA),this._points.indexOf(i.pointB)==-1&&this._points.push(i.pointB);this.x=(this._points[0].x+this._points[1].x+this._points[2].x)/3,this.y=(this._points[0].y+this._points[1].y+this._points[2].y)/3,this.z=(this._points[0].z+this._points[1].z+this._points[2].z)/3,this._plane=new Su,this._plane.fromPoints(this._points[0],this._points[1],this._points[2]),this._plane.normalize(),this.genarateAgainstData(),this.initAABB()}genarateAgainstData(){var e,t;for(e of this._edges)for(t of this._points)e.pointA!=t&&e.pointB!=t&&(this._edgeAgainstPoint.put(e,t),this._pointAgainstEdge.put(t,e))}get id(){return this._id}get plane(){return this._plane}get points(){return this._points}addNeibour(e,t){if(this._edges.indexOf(e)>=0)this._neibourTriangles.put(e,t);else throw new Error("the edge is not in triangle!!!")}getNeibourTriangles(e=null,t=1,a=1){e=e||new Array,e.length=0;var r,i,n=this._neibourTriangles.getKeys(),o;for(o of n)i=o,i.testMask(t)&&(r=this._neibourTriangles.getValueByKey(i),r.testMask(a)&&e.push(r));return e}getEdges(e=null,t=1){e=e||new Array,e.length=0;var a;for(a of this._edges)a.testMask(t)&&e.push(a);return e}get walkAble(){return this.testMask(Ur.WalkAble)}get edges(){return this._edges}testMask(e){return(this._mask&e)==e}getEdgeAgainstPoint(e){return this._edgeAgainstPoint.getValueByKey(e)}getPointAgainstEdge(e){return this._pointAgainstEdge.getValueByKey(e)}getPublicEdge(e){if(e&&e!=this){var t=this._neibourTriangles.getKeys(),a;for(a of t)if(this._neibourTriangles.getValueByKey(a)==e)return a}return null}loopPublicEdge(e){var t,a;if(e&&e!=this){for(t of this._edges)for(a of e._edges)if(t==a)return t}return null}randomPoint(){var e=this._points[2].subtract(this._points[0]);e.scaleBy(Math.random()),e.incrementBy(this._points[0]);var t=this._points[1].subtract(e);return t.scaleBy(Math.random()),t.incrementBy(e),t}}class Lm{_nav3dPoints;_nav3dEdges;_nav3dTriangles;_path;_edgesDict;_nav3dAstar;_nav3dFunnel;_terrainQuad;_triangleList;get edges(){return this._nav3dEdges}get points(){return this._nav3dPoints}get path(){return this._path}get triangles(){return this._nav3dTriangles}constructor(e,t){this._nav3dPoints=new Array,this._nav3dEdges=new Array,this._nav3dTriangles=new Array,this._edgesDict=new rs,this.initPoints(e),this.initEdgesAndTriangles(t),this.createConnections(),this._nav3dAstar=new ku,this._nav3dFunnel=new sr,this._terrainQuad=new Mh(8,128),this._terrainQuad.createQuadTree(this._nav3dTriangles)}getTriangleAtPoint(e,t=5){return this._terrainQuad.getTriangleAtPoint(e,t)}findPath(e,t,a=5){this._path=null,this._triangleList=null;var r=this.getTriangleAtPoint(e,10),i=this.getTriangleAtPoint(t,10),n=this._nav3dAstar.findPath(this,r,i);return n?(this._triangleList=this._nav3dAstar.channel,n=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,n):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new Qt(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,n,o=e.length,l=0;l<o;l++)t=e[l],a=this.tryCreateEdge(t[0],t[1]),r=this.tryCreateEdge(t[1],t[2]),i=this.tryCreateEdge(t[2],t[0]),!(a==null||r==null||i==null)&&(n=new Eu(l,a,r,i),this._nav3dTriangles.push(n))}tryCreateEdge(e,t){if(e==t)throw new Error("edge point index error!!!");if(e>t){var a=e;e=t,t=a}var r=this._edgesDict.getValueByKey(e+"_"+t);return r==null&&(r=new Ea(this._nav3dPoints[e],this._nav3dPoints[t]),this._nav3dEdges.push(r),this._edgesDict.put(e+"_"+t,r)),r}createConnections(){for(var e=this._nav3dTriangles.length,t=this._nav3dTriangles.length,a,r,i,n,o=0;o<e;o++){a=this._nav3dTriangles[o];for(i of a.edges)i.addTriangleOwners(a);for(var l=0;l<t;l++)r=this._nav3dTriangles[l],a!=r&&(n=a.loopPublicEdge(r),n&&(a.addNeibour(n,r),r.addNeibour(n,a)))}}}class _l{x;y;setTo(e,t){this.x=e,this.y=t}equals(e,t){return e==this.x&&t==this.y}equalPoint(e){return this.equals(e.x,e.y)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y)}clone(){var e=new _l;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class za extends Le{width;height;depth;constructor(e=1,t=1,a=1){super(),this.width=e,this.height=t,this.depth=a,this.initVertex()}initVertex(){let e=this.width/2,t=this.height/2,a=this.depth/2;this.bounds=new Ce(b.ZERO.clone(),new b(this.width,this.height,this.depth));let r=new Float32Array([-e,t,a,e,t,a,e,t,-a,-e,t,-a,-e,t,a,e,t,-a,e,-t,a,-e,-t,a,-e,-t,-a,e,-t,-a,e,-t,a,-e,-t,-a,-e,-t,a,-e,t,a,-e,t,-a,-e,-t,-a,-e,-t,a,-e,t,-a,e,t,a,e,-t,a,e,-t,-a,e,t,-a,e,t,a,e,-t,-a,e,t,a,-e,t,a,-e,-t,a,-e,-t,a,e,-t,a,e,t,a,e,-t,-a,-e,-t,-a,-e,t,-a,e,t,-a,e,-t,-a,-e,t,-a]),i=new Float32Array([0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1]),n=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),o=[0,2,1,3,5,4,6,8,7,9,11,10,12,14,13,15,17,16,18,20,19,21,23,22,24,26,25,27,29,28,30,32,31,33,35,34],l=new Uint16Array(o.reverse());this.setIndices(l),this.setAttribute(G.position,r),this.setAttribute(G.normal,i),this.setAttribute(G.uv,n),this.setAttribute(G.TEXCOORD_1,n),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class wu extends Le{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,n=!1,o=0,l=Math.PI*2){super(),this.radiusTop=e,this.radiusBottom=t,this.height=a,this.radialSegments=r,this.heightSegments=i,this.openEnded=n,this.thetaStart=o,this.thetaLength=l,this.instanceID=zt(),this.buildGeometry()}addGroup(e,t,a){this.addSubGeometry({indexStart:e,indexCount:t,vertexStart:e,vertexCount:0,firstStart:0,index:a,topology:0})}buildGeometry(){const e=this;this.radialSegments=Math.floor(this.radialSegments),this.heightSegments=Math.floor(this.heightSegments);const t=[],a=[],r=[],i=[];let n=0;const o=[],l=this.height/2;let c=0;m(),this.openEnded===!1&&(this.radiusTop>0&&g(!0),this.radiusBottom>0&&g(!1));let f=new Float32Array(t),d=new Float32Array(a),h=new Float32Array(r),u=new Uint16Array(i);this.setAttribute(G.position,f),this.setAttribute(G.normal,d),this.setAttribute(G.uv,h),this.setAttribute(G.TEXCOORD_1,h),this.setIndices(u);function m(){const p=new b,D=new b;let A=0;const B=(e.radiusBottom-e.radiusTop)/e.height;for(let v=0;v<=e.heightSegments;v++){const U=[],y=v/e.heightSegments,S=y*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let F=0;F<=e.radialSegments;F++){const C=F/e.radialSegments;let w=C*e.thetaLength+e.thetaStart;F==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(w=0);const E=Math.sin(w),Q=Math.cos(w);D.x=S*E,D.y=-y*e.height+l,D.z=S*Q,t.push(D.x,D.y,D.z),p.set(E,B,Q).normalize(),a.push(p.x,p.y,p.z),r.push(C,1-y),U.push(n++)}o.push(U)}for(let v=0;v<e.radialSegments;v++)for(let U=0;U<e.heightSegments;U++){const y=o[U][v],S=o[U+1][v],F=o[U+1][v+1],C=o[U][v+1];i.push(y,S,C),i.push(S,F,C),A+=6}e.addGroup(c,A,0),c+=A}function g(p){const D=n,A=new de,B=new b;let v=0;const U=p===!0?e.radiusTop:e.radiusBottom,y=p===!0?1:-1;for(let F=1;F<=e.radialSegments;F++)t.push(0,l*y,0),a.push(0,y,0),r.push(.5,.5),n++;const S=n;for(let F=0;F<=e.radialSegments;F++){const w=F/e.radialSegments*e.thetaLength+e.thetaStart,E=Math.cos(w),Q=Math.sin(w);B.x=U*Q,B.y=l*y,B.z=U*E,t.push(B.x,B.y,B.z),a.push(0,y,0),A.x=E*.5+.5,A.y=Q*.5*y+.5,r.push(A.x,A.y),n++}for(let F=0;F<e.radialSegments;F++){const C=D+F,w=S+F;p===!0?i.push(w,w+1,C):i.push(w+1,w,C),v+=3}e.addGroup(c,v,p===!0?1:2),c+=v}}}class Iu extends Le{radius;tube;radialSegments;tubularSegments;constructor(e=.4,t=.1,a=32,r=32){super(),this.radius=e,this.tube=t,this.radialSegments=a,this.tubularSegments=r,this.initVertex()}initVertex(){const e=2*Math.PI,t=this.radius,a=this.tube,r=this.radialSegments,i=this.tubularSegments;this.bounds=new Ce(b.ZERO.clone(),new b(t*2,a*2,t*2));var n=(r+1)*(i+1);let o=new Float32Array(n*3),l=new Float32Array(n*3),c=new Float32Array(n*2),f=new Uint16Array(r*i*2*3),d=0,h=0,u=0,m=0;for(let g=0;g<=r;g++)for(let p=0;p<=i;p++){const D=p/i,A=g/r,B=D*e,v=A*Math.PI*2;if(o[d++]=(t+a*Math.cos(v))*Math.sin(B),o[d++]=a*Math.sin(v),o[d++]=(t+a*Math.cos(v))*Math.cos(B),l[h++]=Math.sin(B)*Math.cos(v),l[h++]=Math.sin(v),l[h++]=Math.cos(B)*Math.cos(v),c[u++]=D,c[u++]=A,p<i&&g<r){const U=i+1,y=U*g+p,S=U*(g+1)+p,F=U*(g+1)+p+1,C=U*g+p+1;f[m++]=y,f[m++]=C,f[m++]=S,f[m++]=C,f[m++]=F,f[m++]=S}}this.setIndices(f),this.setAttribute(G.position,o),this.setAttribute(G.normal,l),this.setAttribute(G.uv,c),this.setAttribute(G.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class Gm extends Le{segment;row=0;constructor(e){super(),this.segment=e,this.buildGeometry()}buildGeometry(){this.row=this.segment+1;let e=new Uint32Array(this.segment*6),t=new Float32Array(this.row*3*2),a=new Float32Array(this.row*3*2),r=new Float32Array(this.row*2*2);for(let i=0;i<this.row;i++){t[i*3*2+0]=0,t[i*3*2+1]=0,t[i*3*2+2]=0,t[i*3*2+3]=0,t[i*3*2+4]=0,t[i*3*2+5]=0,a[i*3*2+0]=0,a[i*3*2+1]=0,a[i*3*2+2]=1,a[i*3*2+3]=0,a[i*3*2+4]=0,a[i*3*2+5]=1,r[i*2*2+0]=0,r[i*2*2+1]=i/this.segment,r[i*2*2+2]=1,r[i*2*2+3]=i/this.segment;let n=i*2,o=n,l=n+1,c=n+2,f=n+3;e[i*6+0]=o,e[i*6+1]=l,e[i*6+2]=c,e[i*6+3]=l,e[i*6+4]=f,e[i*6+5]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class zm extends Le{faceCount=0;constructor(e){super(),this.faceCount=e,this.buildGeometry()}buildGeometry(){let e=new Uint32Array(this.faceCount*3),t=new Float32Array(this.faceCount*3*3),a=new Float32Array(this.faceCount*3*3),r=new Float32Array(this.faceCount*3*2),i=new Float32Array(this.faceCount*3*1);for(let n=0;n<this.faceCount;n++){let o=n*3+0,l=n*3+1,c=n*3+2;e[o]=o,e[l]=l,e[c]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.setAttribute(G.vIndex,i),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class Wm extends Gs{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new Ts;let t=[];return _.res.fillColor(t,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.create(this._minSize,this._minSize,t,!1),this.createFromTexture(this._minSize,this._internalTexture),this}changeColor(e){return this._skyColor=e,_.res.fillColor(this._internalTexture.floatArray,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.updateTexture(this._minSize,this._minSize,this._internalTexture.floatArray,!1),this._faceData.uploadTexture(0,this._internalTexture),this}get color(){return this._skyColor}set color(e){this.changeColor(e)}}class Jm extends ne{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new ne,t=new ne,a=new ne,r=new za(2,2,2),i=new za(2,2,2),n=new za(2,2,2),o=new Bt;o.baseColor=new J(1,0,0);let l=new Bt;l.baseColor=new J(0,1,0);let c=new Bt;c.baseColor=new J(0,0,1);let f=e.addComponent(he),d=t.addComponent(he),h=a.addComponent(he);f.geometry=r,f.material=o,f.castShadow=!1,d.geometry=i,d.material=l,d.castShadow=!1,h.geometry=n,h.material=c,h.castShadow=!1,e.localScale=new b(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new b(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new b(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class jm{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Le,i=e.getAttribute(G.position).data.length/3,n=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let d=f[1].attribute;if(d==G.indices)continue;let h=e.getAttribute(d).data,u=h.length,m=new Float32Array(u*t);for(let g=0;g<t;g++){m.set(h,u*g);for(let p=0;p<i;p++)n[i*g+p]=g}r.setAttribute(d,m)}r.setAttribute(G.vIndex,n);let o=e.getAttribute(G.indices).data,l=o.length,c=new Uint32Array(o.length*t);for(let f=0;f<t;f++)for(let d=0;d<l;d++){let h=f*i,u=f*l;const m=o[d]+h;c[u+d]=m}return r.setIndices(c),r.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,index:0,vertexCount:0,firstStart:0,topology:0}),r}static generateNormal(){}static generateTangent(){}static packUV(){}}class Zm extends ne{size=100;divisions=10;constructor(e=100,t=10){super(),this.size=e,this.divisions=t,this.buildGeometry(),this.addAxis()}buildGeometry(){const e=[],t=[],a=this.size/this.divisions,r=this.size/2,i=this.divisions/2;for(let c=0,f=-r;c<=this.divisions;c++,f+=a)c!==i&&(e.push(-r,0,f,r,0,f),e.push(f,0,-r,f,0,r));for(let c=0;c<e.length/3;c+=2)t.push(c,c+1);let n=new Le;n.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),n.setAttribute(G.position,new Float32Array(e)),n.addSubGeometry({indexStart:0,indexCount:t.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let o=new Bt;o.topology="line-list",o.baseColor=new J(1,1,1,.15),o.blendMode=De.ADD,o.castReflection=!1;let l=this.addComponent(he);l.geometry=n,l.material=o}addAxis(){const e=this.size/2;let t=new Float32Array([-e,0,0,e,0,0]),a=new Uint16Array([0,1,2,3]),r=new Le;r.setIndices(a),r.setAttribute(G.position,t),r.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});{let i=new ne,n=i.addComponent(he);n.geometry=r;let o=n.material=new Bt;o.baseColor=new J(1,0,0,.5),o.blendMode=De.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new ne;i.rotationY=90;let n=i.addComponent(he);n.geometry=r;let o=n.material=new Bt;o.baseColor=new J(0,1,0,.5),o.blendMode=De.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class Ym{static color_temperature_to_rgb(e){e<1e3?e=1e3:e>4e4&&(e=4e4);let t=e/100,a=this.get_red(t),r=this.get_green(t),i=this.get_blue(t);return new J(a/255,r/255,i/255,1)}static get_red(e){if(e<=66)return 255;let t=329.698727446*Math.pow(e-60,-.1332047592);return this.bound(t)}static get_green(e){let t=0;return e<=66?t=99.4708025861*Math.log(e)-161.1195681661:t=288.1221695283*Math.pow(e-60,-.0755148492),this.bound(t)}static get_blue(e){let t=0;return e>=66?255:e<=19?0:(t=138.5177312231*Math.log(e-10)-305.0447927307,this.bound(t))}static bound(e,t=0,a=255){let r=Math.max(e,t);return Math.min(r,a)}}class Xm{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new za),this.planeGeo||(this.planeGeo=new si(1,1,1,1,b.UP)),this.sphere||(this.sphere=new Nr(1,35,35)),this.material||(this.material=new ta),this.materialMap||(this.materialMap=new Map)}static get CubeMesh(){return this.initHeap(),this.boxGeo}static get SphereMesh(){return this.initHeap(),this.sphere}static GetCube(){this.initHeap();let e=new ne,t=e.addComponent(he);return t.geometry=this.boxGeo,t.material=this.material.clone(),t.castShadow=!0,e}static GetMaterial(e){let t=this.materialMap.get(e);return t||(t=new ta,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new ne,a=t.addComponent(he);a.geometry=this.planeGeo;let r=this.GetMaterial(e);return r.blendMode=De.ADD,r.castShadow=!1,a.material=r,a.castGI=!1,a.castReflection=!1,t}static GetSingleCube(e,t,a,r,i,n){this.initHeap();let o=new ta;o.roughness=.5,o.metallic=.1,o.baseColor=new J(r,i,n,1);let l=new ne,c=l.addComponent(he);return c.castGI=!0,c.geometry=new za(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new ta;i.baseColor=new J(t,a,r,1);let n=new ne,o=n.addComponent(he);return o.castGI=!0,o.geometry=new Nr(e,20,20),o.material=i,n}static get Sphere(){this.initHeap();let e=new ne,t=e.addComponent(he);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new ne,r=a.addComponent(he);return r.castShadow=!1,r.geometry=new za(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,n,o=1,l=!0){let c=new ne,f=c.addComponent(oi);f.lightColor=new J(r,i,n,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let d=this.GetSingleSphere(.1,1,1,1);return c.addChild(d),f}}var P=(s=>(s[s.X=0]="X",s[s.Y=1]="Y",s[s.Z=2]="Z",s[s.XY=3]="XY",s[s.XZ=4]="XZ",s[s.YZ=5]="YZ",s[s.XYZ=6]="XYZ",s[s.MAX=7]="MAX",s[s.NONE=8]="NONE",s))(P||{}),ha=(s=>(s[s.Local=0]="Local",s[s.Global=1]="Global",s))(ha||{});class on extends et{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(P.MAX),this.mAxisColor=new Array(P.MAX),this.mAxisMaterial=new Array(P.MAX),this.mAxisCollider=new Array(P.MAX)}get target(){return this.object3D.target}get mX(){return this.object3D.mXObj}get mY(){return this.object3D.mYObj}get mZ(){return this.object3D.mZObj}get transformSpaceMode(){return this.object3D.transformSpaceMode}init(e){this.mContainer=new ne;let t=new Bt;t.baseColor=new J(1,0,0),t.depthCompare=nt.always,this.mAxisColor[P.X]=t.baseColor,this.mAxisMaterial[P.X]=t;let a=new Bt;a.baseColor=new J(0,1,0),a.depthCompare=nt.always,this.mAxisColor[P.Y]=a.baseColor,this.mAxisMaterial[P.Y]=a;let r=new Bt;r.baseColor=new J(0,0,1),r.depthCompare=nt.always,this.mAxisColor[P.Z]=r.baseColor,this.mAxisMaterial[P.Z]=r;let i=this.createCustomAxis(P.X),n=this.createCustomAxis(P.Y),o=this.createCustomAxis(P.Z);this.mContainer.addChild(this.mAxis[P.X]=i),this.mContainer.addChild(this.mAxis[P.Y]=n),this.mContainer.addChild(this.mAxis[P.Z]=o),this.mAxisCollider[P.X]=i.getComponent(da),this.mAxisCollider[P.Y]=n.getComponent(da),this.mAxisCollider[P.Z]=o.getComponent(da)}start(){}onEnable(e){this.object3D.addChild(this.mContainer),this.reset()}onDisable(e){this.object3D.removeChild(this.mContainer)}reset(){switch(this.transformSpaceMode){case ha.Local:{let t=R.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).decompose();this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=t[1].x,this.object3D.rotationY=t[1].y,this.object3D.rotationZ=t[1].z,this.object3D.x=t[0].x,this.object3D.y=t[0].y,this.object3D.z=t[0].z}break;case ha.Global:{this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=0,this.object3D.rotationY=0,this.object3D.rotationZ=0;const e=this.mX.transform.worldPosition;this.object3D.x=e.x,this.object3D.y=e.y,this.object3D.z=e.z}break}}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY),r,i;for(let n=0;n<=P.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||n==P.XYZ)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},n==P.XYZ)))break}return i}currentAxis=P.NONE;beginPoint=new b;beginMousePos=new b;currentPoint=new b;onMouseDown(e){if(e.mouseCode!=Ys.MOUSE_LEFT)return;let t=this.pickAxis();if(!t)return;this.currentAxis=t.axis,e.stopImmediatePropagation();const r=this.object3D.transform.scene3D.view.camera;let i=r.worldToScreenPoint(this.mX.transform.worldPosition),n=r.screenPointToWorld(_.inputSystem.mouseX,_.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(n),this.beginMousePos.x=_.inputSystem.mouseX,this.beginMousePos.y=_.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==P.NONE){let t=this.lastMoveObj.getComponent(he).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==P.XYZ&&(this.mAxis[P.X].getComponent(he).material.setUniformColor("baseColor",this.mAxisColor[P.X]),this.mAxis[P.Y].getComponent(he).material.setUniformColor("baseColor",this.mAxisColor[P.Y]),this.mAxis[P.Z].getComponent(he).material.setUniformColor("baseColor",this.mAxisColor[P.Z])),this.lastMoveAxis=P.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new J(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==P.XYZ&&(this.mAxis[P.X].getComponent(he).material.setUniformColor("baseColor",new J(1,1,1)),this.mAxis[P.Y].getComponent(he).material.setUniformColor("baseColor",new J(1,1,1)),this.mAxis[P.Z].getComponent(he).material.setUniformColor("baseColor",new J(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(_.inputSystem.mouseX,_.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let n=i.subtract(this.beginPoint);b.HELP_0.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let o=b.distance(b.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(b.HELP_0),this.transformSpaceMode){case ha.Local:this.applyLocalTransform(this.currentAxis,n,o);break;case ha.Global:this.applyGlobalTransform(this.currentAxis,n,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Ys.MOUSE_LEFT&&(this.currentAxis=P.NONE,this.reset())}onUpdate(e){let a=b.distance(e.camera.transform.worldPosition,this.object3D.transform.worldPosition)/100;if(this.mContainer.scaleX=this.mContainer.scaleY=this.mContainer.scaleZ=a,this.mX){const r=this.mX.transform.worldPosition;this.object3D.x=r.x,this.object3D.y=r.y,this.object3D.z=r.z}}applyLocalTransform(e,t,a){console.warn("not imp")}applyGlobalTransform(e,t,a){console.warn("not imp")}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=0,a=0,r=0;switch(e){case P.X:t=1;break;case P.Y:a=1;break;case P.Z:r=1;break}let i=.4+t*20,n=.4+a*20,o=.4+r*20,l=new ne;l.x=i*.5,l.y=n*.5,l.z=o*.5;let c=l.addComponent(he);c.geometry=new za(i,n,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(da),d=new bi;return d.setFromCenterAndSize(new b(0,0,0),new b(i+1,n+1,o+1)),f.shape=d,l}}class Ru extends on{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new J(.9,.9,.9),t.depthCompare=nt.always,this.mAxisColor[P.XYZ]=t.baseColor,this.mAxisMaterial[P.XYZ]=t;let a=new ne,r=a.addComponent(he);r.geometry=new za(2,2,2),r.material=this.mAxisMaterial[P.XYZ];let i=a.addComponent(da),n=new bi;n.setFromCenterAndSize(new b(0,0,0),new b(2,2,2)),i.shape=n,this.mContainer.addChild(this.mAxis[P.XYZ]=a),this.mAxisCollider[P.XYZ]=a.getComponent(da)}applyLocalTransform(e,t,a){switch(this.currentAxis){case P.XYZ:{let r=0;Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?r=t.x:r=t.z:r=t.y,this.mX.scaleX+=r,this.mX.scaleY+=r,this.mX.scaleZ+=r}break;default:this.mX.transform.worldMatrix.transformVector(t,t),(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=b.HELP_0;r.set(0,0,0),(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ)&&(r.x=t.x),(this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ)&&(r.y=t.y),(this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,b.HELP_1),this.mX.scaleX+=b.HELP_1.x,this.mX.scaleY+=b.HELP_1.y,this.mX.scaleZ+=b.HELP_1.z}createCustomAxis(e){let t=super.createAxis(e),a=this.createBox(e);return t.addChild(a),t}createBox(e){let t=0,a=0,r=0,i=new ne;switch(e){case P.X:t=1,i.rotationZ=-90;break;case P.Y:a=1;break;case P.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(he);return c.geometry=new za(2,2,2),c.material=this.mAxisMaterial[e],i}}var mt=(s=>(s[s.Scale=0]="Scale",s[s.Rotation=1]="Rotation",s[s.Translation=2]="Translation",s[s.NONE=3]="NONE",s))(mt||{});class Qu extends on{applyLocalTransform(e,t,a){if(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ,this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ){R.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),R.help_matrix_1.identity(),R.help_matrix_1.createByRotation(1,b.Y_AXIS),R.help_matrix_2.multiplyMatrices(R.help_matrix_1,R.help_matrix_0),R.help_matrix_2.invert(),R.help_matrix_1.multiplyMatrices(R.help_matrix_2,R.help_matrix_0);let r=R.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY),this.currentAxis==P.X){let r=t.worldToScreenPoint(a);b.HELP_1.set(r.x,r.y,0),b.HELP_2.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let i=b.HELP_2.subtract(b.HELP_1),n=b.getAngle(b.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.x-a.x>0&&(n=360-n),n}if(this.currentAxis==P.Y){let r=t.worldToScreenPoint(a);b.HELP_1.set(r.x,r.y,0),b.HELP_2.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let i=b.HELP_2.subtract(b.HELP_1),n=b.getAngle(b.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.y-a.y>0&&(n=360-n),n}if(this.currentAxis==P.Z){let r=t.worldToScreenPoint(a);b.HELP_1.set(r.x,r.y,0),b.HELP_2.set(_.inputSystem.mouseX,_.inputSystem.mouseY,0);let i=b.HELP_2.subtract(b.HELP_1),n=b.getAngle(b.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.z-a.z>0&&(n=360-n),n}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==P.X||this.currentAxis==P.Y||this.currentAxis==P.Z){let r=this.getAngle();switch(R.help_matrix_0.identity(),this.currentAxis){case P.X:R.help_matrix_0.createByRotation(this.mLastAngle-r,b.X_AXIS);break;case P.Y:R.help_matrix_0.createByRotation(this.mLastAngle-r,b.Y_AXIS);break;case P.Z:R.help_matrix_0.createByRotation(this.mLastAngle-r,b.Z_AXIS);break}R.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),R.help_matrix_1.append(R.help_matrix_0),this.mX.parent&&(R.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),R.help_matrix_2.invert(),R.help_matrix_1.multiply(R.help_matrix_2));let n=R.help_matrix_1.decompose(na.QUATERNION)[1];se.HELP_0.set(n.x,n.y,n.z,n.w),this.mLastAngle=r,this.mX.transform.localRotQuat=se.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=P.NONE&&(this.mAxis[P.X].getComponent(he).enable=!1,this.mAxis[P.Y].getComponent(he).enable=!1,this.mAxis[P.Z].getComponent(he).enable=!1,this.mAxis[this.currentAxis].getComponent(he).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==P.NONE&&(this.mAxis[P.X].getComponent(he).enable=!0,this.mAxis[P.Y].getComponent(he).enable=!0,this.mAxis[P.Z].getComponent(he).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new ne;switch(e){case P.X:t.rotationZ=90;break;case P.Y:break;case P.Z:t.rotationX=90;break}let a=t.addComponent(he);a.geometry=new Iu(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new bi;return i.setFromCenterAndSize(new b,new b(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(_.inputSystem.mouseX,_.inputSystem.mouseY),r,i;for(let n=0;n<=P.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r)){let l=b.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class Tu extends on{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new J(0,0,1),t.depthCompare=nt.always,this.mAxisColor[P.XY]=t.baseColor,this.mAxisMaterial[P.XY]=t;let a=new Bt;a.doubleSide=!0,a.baseColor=new J(0,1,0),a.depthCompare=nt.always,this.mAxisColor[P.XZ]=a.baseColor,this.mAxisMaterial[P.XZ]=a;let r=new Bt;r.doubleSide=!0,r.baseColor=new J(1,0,0),r.depthCompare=nt.always,this.mAxisColor[P.YZ]=r.baseColor,this.mAxisMaterial[P.YZ]=r;let i=this.createPlane(P.XY),n=this.createPlane(P.XZ),o=this.createPlane(P.YZ);this.mContainer.addChild(this.mAxis[P.XY]=i),this.mContainer.addChild(this.mAxis[P.XZ]=n),this.mContainer.addChild(this.mAxis[P.YZ]=o),this.mAxisCollider[P.XY]=i.getComponent(da),this.mAxisCollider[P.XZ]=n.getComponent(da),this.mAxisCollider[P.YZ]=o.getComponent(da)}applyLocalTransform(e,t,a){R.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),R.help_matrix_0.transformVector(t,b.HELP_0),this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ||(b.HELP_0.x=0),this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ||(b.HELP_0.y=0),this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ||(b.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(b.HELP_0,b.HELP_1),this.mX.x+=b.HELP_1.x,this.mX.y+=b.HELP_1.y,this.mX.z+=b.HELP_1.z}applyGlobalTransform(e,t,a){R.help_matrix_0.identity(),(this.currentAxis==P.X||this.currentAxis==P.XY||this.currentAxis==P.XZ)&&R.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==P.Y||this.currentAxis==P.XY||this.currentAxis==P.YZ)&&R.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==P.Z||this.currentAxis==P.XZ||this.currentAxis==P.YZ)&&R.help_matrix_0.appendTranslation(0,0,t.z),R.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),R.help_matrix_1.append(R.help_matrix_0),this.mX.parent&&(R.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),R.help_matrix_2.invert(),R.help_matrix_1.multiply(R.help_matrix_2));let r=R.help_matrix_1.decompose(na.QUATERNION);this.mX.transform.localPosition=r[0],console.log(this.target.localPosition)}createCustomAxis(e){let t=super.createAxis(e),a=this.createArrows(e);return t.addChild(a),t}createArrows(e){let t=0,a=0,r=0,i=new ne;switch(e){case P.X:t=1,i.rotationZ=-90;break;case P.Y:a=1,i.rotationY=-90;break;case P.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(he);return c.geometry=new wu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new ne,a=t.addComponent(he);a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new bi;switch(r.shape=i,e){case P.XY:a.geometry=new si(4,4,1,1,b.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new b(0,0,0),new b(4,4,.1));break;case P.XZ:a.geometry=new si(4,4,1,1,b.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new b(0,0,0),new b(4,.1,4));break;case P.YZ:a.geometry=new si(4,4,1,1,b.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new b(0,0,0),new b(.1,4,4));break}return t}}class Bl extends ne{static _instance;static get instance(){return this._instance||(this._instance=new Bl),this._instance}mTarget;mTransformMode=mt.NONE;mTransformSpaceType=ha.Global;mControllers;mXObj;mYObj;mZObj;constructor(){super(),this.mControllers=[null,null,null],this.mControllers[mt.Scale]=this.addComponent(Ru),this.mControllers[mt.Rotation]=this.addComponent(Qu),this.mControllers[mt.Translation]=this.addComponent(Tu),this.mControllers[mt.Scale].enable=!1,this.mControllers[mt.Rotation].enable=!1,this.mControllers[mt.Translation].enable=!1,this.mXObj=new ne,this.mYObj=new ne,this.mZObj=new ne,this.mXObj.addChild(this.mYObj),this.mYObj.addChild(this.mZObj)}get transformMode(){return this.mTransformMode}get transformSpaceMode(){return this.mTransformSpaceType}active(e){e.addChild(this),e.addChild(this.mXObj)}unActive(e){e.removeChild(this)}get target(){return this.mTarget}selectObject(e,t,a){this.mTarget!=e&&(e?this.activate():this.unactivate(),this.mTarget=e,this.mXObj.localPosition=e.transform.worldPosition.clone()),t!=null&&this.selectTransformMode(t),a!=null&&this.selectTransformSpaceMode(a)}selectTransformMode(e){this.mTransformMode!=e&&(this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!1),this.mTransformMode=e,this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!0))}selectTransformSpaceMode(e){this.mTransformSpaceType!=e&&(this.mTransformSpaceType=e,this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].reset())}activate(){_.inputSystem.addEventListener(Ma.KEY_DOWN,this.onKeyDown,this),_.inputSystem.addEventListener(Z.POINTER_DOWN,this.onMouseDown,this,null,99999),_.inputSystem.addEventListener(Z.POINTER_MOVE,this.onMouseMove,this,null,99999),_.inputSystem.addEventListener(Z.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){_.inputSystem.removeEventListener(Ma.KEY_DOWN,this.onKeyDown,this),_.inputSystem.removeEventListener(Z.POINTER_DOWN,this.onMouseDown,this),_.inputSystem.removeEventListener(Z.POINTER_MOVE,this.onMouseMove,this),_.inputSystem.removeEventListener(Z.POINTER_UP,this.onMouseUp,this)}onKeyDown(e){switch(e.keyCode){case tt.Key_R:this.selectTransformMode(mt.Scale),this.selectTransformSpaceMode(ha.Local);break;case tt.Key_E:this.selectTransformMode(mt.Rotation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_W:this.selectTransformMode(mt.Translation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_A:this.selectTransformSpaceMode(ha.Local);break;case tt.Key_S:this.selectTransformSpaceMode(ha.Global);break}}onMouseDown(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseDown(e)}onMouseMove(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseMove(e)}onMouseUp(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseUp(e)}}const Hm=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{mf as AccelerateDecelerateInterpolator,gf as AccelerateInterpolator,Li as AnimationCurve,xr as AnimationCurveT,Yr as AnimationMonitor,er as AnimatorComponent,xg as AnimatorEventKeyframe,_f as AnticipateInterpolator,As as AnticipateOvershootInterpolator,Ju as ArrayHas,ju as ArrayItemIndex,od as AtlasParser,gg as AtmosphericComponent,Kd as AtmosphericScatteringSky,Hd as AtmosphericScatteringSkySetting,Xd as AtmosphericScatteringSky_shader,sh as AttributeAnimCurve,Jm as AxisObject,rr as B3DMLoader,Yf as B3DMLoaderBase,ko as B3DMParseUtil,So as B3DMParser,ed as BRDFLUT,td as BRDFLUTGenerate,rc as BRDF_frag,Ls as BatchTable,vm as BiMap,fs as BillboardComponent,pr as BillboardType,Ec as BitUtil,$a as BitmapTexture2D,Kc as BitmapTexture2DArray,Bo as BitmapTextureCube,Xc as Blend,Hc as BlendFactor,De as BlendMode,tl as BlendShapeData,el as BlendShapePropertyData,_p as BloomPost,Vf as BlurEffectCreatorBlur_cs,Pf as BlurEffectCreatorSample_cs,Of as BlurTexture2DBufferCreator,aa as BounceInterpolator,qn as BoundUtil,Ce as BoundingBox,Lr as BoundingSphere,Xr as BoundingVolume,bi as BoxColliderShape,za as BoxGeometry,Zl as BrdfLut_frag,sc as BsDF_frag,ic as BxDF_frag,cc as BxdfDebug_frag,Dn as BytesArray,pt as CEvent,Za as CEventDispatcher,ys as CEventListener,lr as CResizeEvent,sa as CSM,ti as Camera3D,Ig as CameraControllerBase,ot as CameraType,bt as CameraUtil,$g as CapsuleColliderShape,d0 as CastPointShadowMaterialPass,f0 as CastShadowMaterialPass,nc as Clearcoat_frag,z0 as ClusterBoundsSource_cs,Et as ClusterConfig,Tl as ClusterDebug_frag,mc as ClusterLight,G0 as ClusterLightingBuffer,J0 as ClusterLightingRender,W0 as ClusterLighting_cs,g0 as CollectInfo,da as ColliderComponent,gt as ColliderShape,ui as ColliderShapeType,J as Color,xm as ColorGradient,Am as ColorLitMaterial,Jd as ColorLitShader,ng as ColorPassFragmentOutput,L0 as ColorPassRenderer,Fs as ColorUtil,_n as ComData,Pd as Combine_cs,Jl as Common_frag,jl as Common_vert,et as ComponentBase,Oe as ComponentCollect,ni as ComputeGPUBuffer,Fe as ComputeShader,Fl as Context3D,io as CubeCamera,Lf as CubeMapFaceEnum,Sn as CubeSky_Shader,rn as CubicBezierCurve,Um as CubicBezierPath,Du as CubicBezierType,Bf as CycleInterpolator,wu as CylinderGeometry,of as DDGIIrradianceComputePass,vs as DDGIIrradianceGPUBufferReader,R0 as DDGIIrradianceVolume,nf as DDGIIrradiance_shader,df as DDGILightingPass,ff as DDGILighting_shader,cf as DDGIMultiBouncePass,hf as DDGIProbeRenderer,Dt as DEGREES_TO_RADIANS,Uf as DRACO_DECODER_GLTF_JS,pf as DecelerateInterpolator,Vd as Denoising_cs,X0 as Depth2DTextureArray,Z0 as DepthCubeArrayTexture,h0 as DepthMaterialPass,Bp as DepthOfFieldPost,vd as DepthOfView_cs,Qi as DirectLight,rs as DoubleArray,Kr as EditorInspector,_ as Engine3D,I0 as Entity,p0 as EntityBatchCollect,q as EntityCollect,Yl as EnvMap_frag,Yt as ErpImage2CubeMap,Gf as ErpImage2CubeMapCreateCube_cs,zf as ErpImage2CubeMapRgbe2rgba_cs,ip as ExtrudeGeometry,_r as FAILED,Ca as FASTFLOOR,so as FXAAPost,af as FXAAShader,Hl as FastMathShader,wh as FatLineGeometry,qh as FatLineMaterial,mi as FatLineRenderer,Ki as FatLineShader,Mc as FatLine_FS,Tc as FatLine_VS,Mi as FeatureTable,It as FileLoader,Rg as FirstPersonCameraController,Ts as Float16ArrayTexture,w0 as Float32ArrayTexture,Qg as FlyCameraController,id as FontChar,ad as FontInfo,rd as FontPage,ir as FontParser,bf as ForwardRenderJob,En as FragmentOutput,ql as FragmentVarying,Lo as FrameCache,On as Frustum,Yc as FrustumCSM,sg as FrustumCulling_cs,fc as FullQuad_vert_wgsl,ve as GBufferFrame,c0 as GBufferPass,vp as GBufferPost,wc as GBufferStand,wn as GBuffer_pass,Do as GILighting,Fh as GIProbeMaterial,jo as GIProbeMaterialType,jd as GIProbeShader,no as GIRenderCompleteEvent,Ms as GIRenderStartEvent,Mf as GLBChunk,Tf as GLBHeader,_o as GLBParser,qc as GLSLLexer,Ui as GLSLLexerToken,$c as GLSLPreprocessor,r0 as GLSLSyntax,Kf as GLTFBinaryExtension,zp as GLTFMaterial,xt as GLTFParser,Ps as GLTFSubParser,yf as GLTFSubParserCamera,Qf as GLTFSubParserConverter,Sf as GLTFSubParserMaterial,Cf as GLTFSubParserMesh,Ao as GLTFSubParserSkeleton,Ff as GLTFSubParserSkin,oa as GLTFType,fb as GLTF_Accessors,Ns as GLTF_Info,nb as GLTF_Light,cb as GLTF_Mesh,ob as GLTF_Node,lb as GLTF_Primitives,sb as GLTF_Scene,Kt as GPUAddressMode,Zu as GPUBlendFactor,Ya as GPUBufferBase,Aa as GPUBufferType,nt as GPUCompareFunction,k as GPUContext,Lt as GPUCullMode,hr as GPUFilterMode,Ss as GPUPrimitiveTopology,oe as GPUTextureFormat,xi as GPUVertexFormat,Hu as GPUVertexStepMode,Ai as GSplatFormat,Xn as GSplatGeometry,Yn as GSplatMaterial,ii as GSplatRenderer,Si as GSplatShader,Zi as GSplatStreamRenderer,_0 as GSplat_FS,D0 as GSplat_VS,xp as GTAOPost,xd as GTAO_cs,nd as GUIAtlasTexture,ds as GUICanvas,Pr as GUIConfig,dh as GUIGeometry,uh as GUIGeometryRebuild,Wo as GUIMaterial,uf as GUIPassRenderer,mh as GUIPick,_h as GUIPickHelper,Ja as GUIQuad,lt as GUIQuadAttrEnum,bh as GUIRenderer,zo as GUIShader,fa as GUISpace,ci as GUISprite,Fr as GUITexture,Vp as GaussianSplatParser,gc as GenerayRandomDir,Lp as GeoJsonParser,Gp as GeoJsonUtil,Xs as GeoType,Le as GeometryBase,x0 as GeometryIndicesBuffer,jm as GeometryUtil,B0 as GeometryVertexBuffer,kt as GeometryVertexType,kl as GetComponentClass,yn as GetCountInstanceID,s2 as GetRepeat,El as GetShader,og as GlassShader,xe as GlobalBindGroup,Ln as GlobalBindGroupLayout,Up as GlobalFog,Oo as GlobalFog_shader,Zg as GlobalIlluminationComponent,Fn as GlobalUniform,$n as GlobalUniformGroup,yp as GodRayPost,Ud as GodRay_cs,Zm as GridObject,xo as HDRTexture,Os as HDRTextureCube,Ac as Hair_frag,lg as Hair_shader_op,cg as Hair_shader_tr,Is as HaltonSeq,xh as Horizontal,Tg as HoverCameraController,ka as I3DMLoader,qf as I3DMLoaderBase,Eo as I3DMParser,jf as IBLEnvMapCreator,Jf as IBLEnvMapCreator_cs,Ia as IESProfiles,ec as IESProfiles_frag,op as IKDTreeUserData,hi as ImageType,v0 as IndicesGPUBuffer,Wl as Inline_vert,Sl as InputSystem,Yg as InstanceDrawComponent,Xl as InstanceUniform,$f as InstancedMesh,Sr as Interpolator,oo as InterpolatorEnum,Gh as IrradianceDataReaderCompleteEvent,zl as IrradianceVolumeData_frag,ac as Irradiance_frag,zu as IsEditorInspector,xn as IsNonSerialize,kf as Joint,mo as JointPose,Df as JumperInterpolator,cp as KDTreeEntity,yr as KDTreeNode,Rh as KDTreeRange,Qh as KDTreeSpace,gs as KDTreeUUID,po as KHR_draco_mesh_compression,Wp as KHR_lights_punctual,wf as KHR_materials_clearcoat,If as KHR_materials_emissive_strength,Jp as KHR_materials_ior,Rf as KHR_materials_unlit,gd as KMZParser,$o as KV,Ym as KelvinUtil,tt as KeyCode,Ma as KeyEvent,Js as Keyframe,as as KeyframeT,Kh as LASLoader,Yp as LASParser,Jt as LASUtils,Di as LASVisualizationMode,Gs as LDRTextureCube,La as LOADED,al as LOADING,du as LRUCache,Dm as LambertMaterial,_c as Lambert_shader,js as Light,Ri as LightBase,ws as LightData,Q0 as LightEntries,ht as LightType,Ml as LightingFunction_frag,Ut as Line,Ah as LineClassification,Af as LinearInterpolator,ta as LitMaterial,Ks as LitSSSShader,qs as LitShader,oc as Lit_shader,Er as LoaderBase,fp as LoaderEvent,An as LoaderManager,e2 as MAX_VALUE,t2 as MIN_VALUE,vt as Material,o0 as MaterialDataUniformGPUBuffer,Hs as MaterialUtilities,Nl as MathShader,Gt as MathUtil,Gr as Matrix3,R as Matrix4,N0 as MatrixBindGroup,M0 as MatrixGPUBuffer,pc as MatrixShader,cr as MemoryDO,Il as MemoryInfo,up as MergeRGBACreator,yd as MergeRGBA_cs,mn as MeshColliderShape,Zs as MeshFilter,he as MeshRenderer,Fm as MinMaxAnimationCurves,Cu as MinMaxCurve,yu as MinMaxCurveState,km as MinMaxPolyCurves,mp as MorePassParser,Oh as MorePassShader,Cg as MorphTargetBlender,V0 as MorphTargetData,Sg as MorphTargetFrame,lh as MorphTargetTransformKey,Ht as MorphTarget_shader,Ys as MouseCode,lf as MultiBouncePass_cs,ku as Navi3DAstar,is as Navi3DConst,Ea as Navi3DEdge,sr as Navi3DFunnel,Ur as Navi3DMaskType,Lm as Navi3DMesh,Qt as Navi3DPoint,_l as Navi3DPoint2D,Fa as Navi3DPointFat,_e as Navi3DRouter,Eu as Navi3DTriangle,vn as NonSerialize,Kl as NormalMap_frag,Ef as OAnimationEvent,Ds as OBJParser,ne as Object3D,dp as Object3DEvent,Bl as Object3DTransformTools,Xm as Object3DUtil,nh as ObjectAnimClip,ro as OcclusionSystem,Cr as Octree,A0 as OctreeEntity,Mg as OrbitController,ym as OrderMap,na as Orientation3D,Cd as OutLineBlendColor_cs,Sd as OutlineCalcOutline_cs,fg as OutlinePass,Cp as OutlinePost,Wh as OutlinePostData,Jh as OutlinePostManager,zh as OutlinePostSlot,Fd as Outline_cs,vf as OvershootInterpolator,cu as PARSING,lc as PBRLItShader,Zd as PBRLitSSSShader,lm as PLUGIN_REGISTERED,eu as PNTSLoader,$h as PNTSLoaderBase,tu as PNTSParser,it as ParserBase,je as ParserFormat,Uu as ParticleSystemCurveEvalMode,_u as ParticleSystemRandomnessIds,yi as PassGenerate,Lh as PassShader,fe as PassType,Pl as PhysicMaterialUniform_frag,kh as PickCompute,Eh as PickFire,yt as PickGUIEvent3D,jh as PickResult,kd as Picker_cs,In as PingPong,Jn as PipelinePool,Su as Plane3D,Vr as PlaneClassification,si as PlaneGeometry,ya as PlyMode,Al as PlyParser,Hh as PlyStreamParser,Dh as PointClassification,Kn as PointCloudGeometry,E0 as PointCloudMaterial,qa as PointCloudRenderer,ki as PointCloudShader,k0 as PointCloud_FS,F0 as PointCloud_VS,oi as PointLight,Y0 as PointLightShadowRenderer,j0 as PointShadowCubeCamera,Z as PointerEvent3D,Ga as Polynomial,nr as PolynomialCurve,Sm as Polynomials,gh as PoolNode,Wt as PostBase,md as PostProcessingComponent,$0 as PostRenderer,K0 as PreDepthPassRenderer,ef as PreFilteredEnvironment_cs,qb as PreFilteredEnvironment_cs2,Ed as PreIntegratedLut,Vh as PreIntegratedLutCompute,qo as PrefabAvatarData,au as PrefabAvatarParser,Ko as PrefabBoneData,iu as PrefabMaterialParser,su as PrefabMeshData,nu as PrefabMeshParser,xs as PrefabNode,lu as PrefabParser,em as PrefabStringUtil,ru as PrefabTextureData,ou as PrefabTextureParser,Da as Preprocessor,il as PriorityQueue,Sh as Probe,bp as ProbeEntries,sf as ProbeGBufferFrame,dt as ProfilerUtil,vg as PropertyAnimClip,oh as PropertyAnimTag,ul as PropertyAnimation,fl as PropertyAnimationClip,ih as PropertyAnimationClipState,zi as PropertyAnimationEvent,Gi as PropertyHelp,Nt as QuadAABB,vc as QuadGlsl_fs,Bc as QuadGlsl_vs,Mh as QuadRoot,Ei as QuadShader,Th as QuadTree,kr as QuadTreeCell,Ku as Quad_depth2dArray_frag_wgsl,uc as Quad_depth2d_frag_wgsl,bc as Quad_depthCube_frag_wgsl,hc as Quad_frag_wgsl,dc as Quad_vert_wgsl,se as Quaternion,Qs as R32UintTexture,$r as RADIANS_TO_DEGREES,Wf as RGBEErrorCode,Uo as RGBEHeader,yo as RGBEParser,Je as RTDescriptor,ct as RTFrame,Pa as RTResourceConfig,Mt as RTResourceMap,ns as Rand,n2 as RandomSeed,ua as Ray,Bi as RayCastMeshDetail,ai as Reader,ps as Rect,ke as Reference,$d as Reflection,Rc as ReflectionCG,T0 as ReflectionEntries,th as ReflectionMaterial,tf as ReflectionRenderer,eh as ReflectionShader,Ic as ReflectionShader_shader,Ot as RegisterComponent,Na as RegisterShader,ao as RenderContext,Ci as RenderLayer,jn as RenderLayerUtil,Ba as RenderNode,m0 as RenderShaderCollect,Ph as RenderShaderCompute,qe as RenderShaderPass,Rt as RenderTexture,Va as RendererBase,rf as RendererJob,q0 as RendererMap,Ne as RendererMask,ia as RendererMaskUtil,O0 as RendererPassState,Rn as RepeatSE,pd as Res,Qu as RotationControlComponents,Qc as SHCommon_frag,ms as SN_ArrayConstant,br as SN_BinaryOperation,N2 as SN_Break,Sa as SN_CodeBlock,ar as SN_Constant,fn as SN_Continue,rt as SN_Declaration,P2 as SN_Discard,M2 as SN_DoWhileLoop,we as SN_Expression,Jr as SN_ForLoop,ln as SN_Function,cn as SN_FunctionArgs,Wr as SN_FunctionCall,Or as SN_IFBranch,Xa as SN_Identifier,Zr as SN_IndexOperation,cs as SN_Layout,t0 as SN_ParenExpression,dn as SN_Precision,os as SN_Return,ls as SN_SelectOperation,tr as SN_Struct,a0 as SN_TernaryOperation,ri as SN_UnaryOperation,jr as SN_WhileLoop,$b as SSAO_cs,wd as SSGI2_cs,Sp as SSGIPost,Fp as SSRPost,Id as SSR_BlendColor_cs,kp as SSR_IS_Kernel,Rd as SSR_IS_cs,Qd as SSR_RayTrace_cs,Ru as ScaleControlComponents,tp as Scene3D,At as Shader,Wn as ShaderAttributeInfo,i0 as ShaderConverter,s0 as ShaderConverterResult,Y as ShaderLib,Cn as ShaderPassBase,Tt as ShaderReflection,_a as ShaderStage,n0 as ShaderState,zn as ShaderUniformInfo,Ha as ShaderUtil,$l as ShadingInput,jt as ShadowLightsCollect,H0 as ShadowMapPassRenderer,tc as ShadowMapping_frag,Fg as Skeleton,hn as SkeletonAnimationClip,rh as SkeletonAnimationClipState,mr as SkeletonAnimationComponent,kg as SkeletonAnimationCompute,qr as SkeletonAnimation_shader,Eg as SkeletonBlendComputeArgs,Ii as SkeletonPose,wg as SkeletonTransformComputeArgs,Yi as SkinnedMeshRenderer,Dr as SkinnedMeshRenderer2,l0 as SkyGBufferPass,xc as SkyGBuffer_pass,qd as SkyMaterial,Ws as SkyRenderer,Oi as SkyShader,Wm as SolidColorSky,ep as SphereColliderShape,Nr as SphereGeometry,ah as SphereReflection,Ti as SpotLight,Nf as StandShader,Ge as StatementNode,Pe as StorageGPUBuffer,Ip as StreamLoader,Op as StreamingGaussianSplatParser,wt as StringUtil,vi as Struct,gp as StructStorageGPUBuffer,U0 as SubGeometry,Td as TAACopyTex_cs,Ep as TAAPost,Md as TAASharpTex_cs,Nd as TAA_cs,Od as TestComputeLoadBuffer,Bh as TextAnchor,yh as TextFieldLayout,Uh as TextFieldLine,ut as Texture,Vs as TextureCube,Co as TextureCubeFaceData,un as TextureCubeStdCreator,vo as TextureCubeUtils,pp as TextureMipmapCompute,wa as TextureMipmapGenerator,Nh as TextureScaleCompute,Pg as ThirdPersonCameraController,rl as Tile,hm as TileSet,bm as TileSetChild,gm as TileSetChildContent,pm as TileSetChildContentMetaData,um as TileSetRoot,dm as TilesRenderer,We as Time,x as TokenType,Iu as TorusGeometry,Cl as TouchData,Gm as TrailGeometry,Zt as Transform,P as TransformAxisEnum,on as TransformControllerBaseComponent,mt as TransformMode,ha as TransformSpaceMode,Tu as TranslationControlComponents,Gn as TranslatorContext,zm as TriGeometry,us as Triangle,bl as UIButton,Ch as UIButtonTransition,Jo as UIComponentBase,hp as UIEvent,zr as UIImage,gl as UIImageGroup,pn as UIInteractive,at as UIInteractiveStyle,hs as UIPanel,ji as UIRenderAble,pl as UIShadow,ml as UITextField,or as UITransform,Br as UNLOADED,zt as UUID,Dl as UV,Hn as Uint32ArrayTexture,Fi as Uint8ArrayTexture,Dc as UnLit,Bt as UnLitMaterial,Vl as UnLitMaterialUniform_frag,qi as UnLitShader,Bm as UnLitTexArrayMaterial,$i as UnLitTexArrayShader,Yd as UnLitTextureArray,Ol as UnLit_frag,Ct as UniformGPUBuffer,fr as UniformNode,St as UniformType,X as ValueEnumType,Om as ValueOp,Wa as ValueParser,Em as ValueSpread,de as Vector2,b as Vector3,Wi as Vector3Ex,be as Vector4,np as VertexAttribute,Wd as VertexAttributeIndexShader,G as VertexAttributeName,dr as VertexAttributeSize,Ih as VertexAttributeStride,Ll as VertexAttributes_vert,sp as VertexBufferLayout,Ql as VertexFormat,Rs as VertexGPUBuffer,vh as Vertical,Gl as VideoUniform_frag,ap as View3D,bn as ViewPanel,to as ViewQuad,Te as VirtualTexture,nm as WGS84_FLATTENING,om as WGS84_HEIGHT,sm as WGS84_RADIUS,e0 as WGSLTranslator,Bs as WayLines3D,_s as WayPoint3D,He as WebGPUDescriptorCreator,kn as WorldMatrixUniform,gn as WorldPanel,gi as WrapMode,Ar as WrapTimeMode,Dp as ZCullingCompute,zd as ZPassShader_cs,kc as ZPassShader_fs,Fc as ZPassShader_vs,u0 as ZSorterUtil,Zc as append,Zf as arrayToString,Yu as blendComponent,Im as buildCurves,$t as byteSizeOfType,Rm as calculateCurveRangesValue,es as calculateMinMax,yc as castPointShadowMap_vert,Be as clamp,F2 as clampRepeat,Zo as computeAABBFromPositions,D2 as cos,y2 as crossProduct,Bu as cubicPolynomialRoot,vu as cubicPolynomialRootsGeneric,wm as curvesSupportProcedural,p2 as deg2Rad,Zh as detectGSplatFormat,Sc as directionShadowCastMap_frag,Ft as dot,xu as doubleIntegrateSegment,_d as downSample,Jc as fastInvSqrt,Wc as floorfToIntPos,fi as fonts,C2 as generateRandom,S2 as generateRandom3,Oc as getFloatFromInt,vb as getGLTypeFromTypedArray,Bb as getGLTypeFromTypedArrayType,_2 as getGlobalRandomSeed,xb as getTypedArray,go as getTypedArrayTypeFromGLType,hl as grad1,nn as grad2,ts as grad3,_i as grad4,Xo as inferSHOrder,dl as integrateSegment,Ap as irradianceDataReader,Cm as kPI,Mr as lerp,i2 as lerpByte,r2 as lerpColor,a2 as lerpVector3,Au as lruPriorityCallback,Tn as magnitude,Ib as makeAloneSprite,sd as makeGUISprite,Es as makeMatrix44,cl as markUsedSetLeaves,en as markUsedTiles,tn as markVisibleTiles,Vn as matrixMultiply,I2 as matrixRotate,w2 as matrixRotateY,Cs as mergeFunctions,jc as multiplyMatrices4x4REF,Fu as normal_distribution,U2 as normalizeFast,Vc as normalizeSafe,x2 as normalizedToByte,v2 as normalizedToWord,Ua as outlinePostData,wp as outlinePostManager,Ho as parsePlyGaussianSplat,Hi as parsePlyHeader,Yh as parsePlyMesh,Xh as parsePlyPointCloud,Ue as perm,Bd as post,mu as priorityCallback,sn as quadraticPolynomialRootsGeneric,m2 as rad2Deg,ei as random01,g2 as randomBarycentricCoord,b2 as randomPointBetweenEllipsoid,h2 as randomPointBetweenSphere,f2 as randomPointInsideCube,d2 as randomPointInsideEllipsoid,u2 as randomPointInsideUnitCircle,Gc as randomPointInsideUnitSphere,l2 as randomQuaternion,c2 as randomQuaternionUniformDistribution,zc as randomSeed,ks as randomUnitVector,Lc as randomUnitVector2,_t as rangedRandomFloat,o2 as rangedRandomInt,pe as readByType,li as readMagicBytes,_m as registerMaterial,Pn as repeat,E2 as rotMatrix,$u as rotateVectorByQuat,Mn as roundfToIntPos,Qn as scale,Cc as shadowCastMap_frag,Uc as shadowCastMap_vert,ea as simplex,A2 as sin,Mm as snoise1,Nm as snoise2,Pm as snoise3,Vm as snoise4,Yo as splatColorProperties,Xi as splatProperties,Nn as sqrMagnitude,Pc as sqrtImpl,Xu as stencilStateFace,B2 as swap,Ld as textureCompress,Dd as threshold,mm as throttle,Ka as toHalfFloat,an as toggleTiles,cm as traverseAncestors,hu as traverseSet,ig as tw,Qm as uniform_real_distribution,Tm as uniform_real_distribution2,Vo as upSample,I as webGPUContext,b0 as zSorterUtil};
|
|
11828
11856
|
//# sourceMappingURL=rings.es.js.map
|