@rings-webgpu/core 1.0.42 → 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.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(d,Yt){typeof exports=="object"&&typeof module<"u"?Yt(exports):typeof define=="function"&&define.amd?define(["exports"],Yt):(d=typeof globalThis<"u"?globalThis:d||self,Yt(d.rings={}))})(void 0,(function(d){"use strict";var Yt=typeof document<"u"?document.currentScript:null;class Z{static COLOR_RED=new Z(1,0,0,1);static COLOR_GREEN=new Z(0,1,0,1);static COLOR_BLUE=new Z(0,0,1,1);static COLOR_WHITE=new Z(1,1,1,1);static COLOR_0=new Z;static COLOR_1=new Z;static COLOR_2=new Z;static HEX_CHARACTERS="a-f\\d";static MATCH_3OR4_HEX=`#?[${Z.HEX_CHARACTERS}]{3}[${Z.HEX_CHARACTERS}]?`;static MATCH_6OR8_HEX=`#?[${Z.HEX_CHARACTERS}]{6}([${Z.HEX_CHARACTERS}]{2})?`;static NON_HEX_CHARS=new RegExp(`[^#${Z.HEX_CHARACTERS}]`,"gi");static VALID_HEX_SIZE=new RegExp(`^${Z.MATCH_3OR4_HEX}$|^${Z.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 Z;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,s=.5){let o=new Z;return o.a=1,o.r=r+e*Math.random(),o.g=i+t*Math.random(),o.b=s+a*Math.random(),o}static randomGray(e=.5,t=.5){let a=Math.random()*t+e,r=new Z;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"||Z.NON_HEX_CHARS.test(e)||!Z.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,s=a&255,o=t;this.a=o,this.r=r/255,this.g=i/255,this.b=s/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 Z().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 Z,t.hexToRGB(e),t}static lerp(e,t,a,r){let i=r||new Z;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 ze{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 bt{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 ns{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 ja{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 s=new ns(e,a,t,r,i);return s.id=++ns.event_id_count,s.current=this,this.listeners[e].push(s),this.listeners[e].sort(function(o,l){return l.priority-o.priority}),s.id}for(let s=0;s<this.listeners[e].length;s++){let o=this.listeners[e][s];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 Ia extends bt{static KEY_DOWN="onKeyDown";static KEY_UP="onKeyUp";keyCode=0}class Y extends bt{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 bt{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 g{static MAX=new g(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);static MIN=new g(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE);static SAFE_MAX=new g(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new g(Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);static X_AXIS=new g(1,0,0);static neg_X_AXIS=new g(-1,0,0);static Y_AXIS=new g(0,1,0);static Z_AXIS=new g(0,0,1);static HELP_0=new g;static HELP_1=new g;static HELP_2=new g;static EPSILON=1e-5;static HELP_3=new g;static HELP_4=new g;static HELP_5=new g;static HELP_6=new g;static get ZERO(){return new g(0,0,0)}static get ONE(){return new g(1,1,1)}static get LEFT(){return new g(-1,0,0)}static get RIGHT(){return new g(1,0,0)}static get UP(){return new g(0,1,0)}static get DOWN(){return new g(0,-1,0)}static get BACK(){return new g(0,0,-1)}static get FORWARD(){return new g(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=g._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==g.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==g.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,s,o;if(i=g.distance(e,t),s=g.distance(e,a),o=g.distance(t,a),o<=1e-6||s<=1e-6)return r=0,r;if(i<=1e-6||o*o>=i*i+s*s)return r=s,r;if(s*s>=i*i+o*o)return r=o,r;let l=(i+s+o)/2;return r=2*Math.sqrt(l*(l-i)*(l-s)*(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 g(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 g,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 g,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,s){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 g;let a=this.x,r=this.y,i=this.z,s=this.w,o=e.x,l=e.y,c=e.z,f=e.w;return t.setTo(a+o,r+l,i+c,s+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 g;let s=this.x,o=this.y,l=this.z,c=this.w,f=e,h=t,u=a,b=r;return i.setTo(s+f,o+h,l+u,c+b),i}clone(){return new g(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 g?new g(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,s=e.y,o=e.z,l=e.w,c=l*t+s*r-o*a,f=l*a+o*t-i*r,h=l*r+i*a-s*t,u=-i*t-s*a-o*r;return this.x=c*l+u*-i+f*-o-h*-s,this.y=f*l+u*-s+h*-i-c*-o,this.z=h*l+u*-o+c*-s-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 g;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 g),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 g),t.setTo(this.x-e.x,this.y-e.y,this.z-e.z),t}multiply(e,t=null){t||(t=new g);let a=this.x,r=this.y,i=this.z,s=e.x,o=e.y,l=e.z;return t.setTo(a*s,r*o,i*l),t}divided(e,t=null){t||(t=new g);let a=this.x,r=this.y,i=this.z,s=e.x,o=e.y,l=e.z;return t.setTo(a/s,r/o,i/l),t}div(e,t){t||(t=new g);let a=this.x,r=this.y,i=this.z,s=this.w;return t.setTo(a/e,r/e,i/e,s/e),t}lerp(e,t,a){let r=e.x,i=e.y,s=e.z,o=e.w,l=t.x,c=t.y,f=t.z,h=t.w;this.x=(l-r)*a+r,this.y=(c-i)*a+i,this.z=(f-s)*a+s,this.w=(h-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(g.RIGHT):this.copyFrom(g.LEFT):this.y>0?this.copyFrom(g.DOWN):this.copyFrom(g.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 g,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 s=Math.acos(i)*180/Math.PI;return a<e&&(s=-s),s;function o(c,f,h,u){let b=[c-h,f-u];return l(b,[0,-1])}function l(c,f){let h=c[0]*f[0]+c[1]*f[1],u=Math.sqrt(c[0]*c[0]+c[1]*c[1])*Math.sqrt(f[0]*f[0]+f[1]*f[1]);return h/u}}static pointInsideTriangle(e,t,a,r){return g.HELP_0.setTo(e.x,e.z,0),g.HELP_1.setTo(t.x,t.z,0),g.HELP_2.setTo(a.x,a.z,0),g.HELP_3.setTo(r.x,r.z,0),g.pointInsideTriangle2d()}static pointInsideTriangle2d(){return g.productXY(g.HELP_1,g.HELP_2,g.HELP_3)>=0?g.productXY(g.HELP_1,g.HELP_2,g.HELP_0)>=0&&g.productXY(g.HELP_2,g.HELP_3,g.HELP_0)>=0&&g.productXY(g.HELP_3,g.HELP_1,g.HELP_0)>=0:g.productXY(g.HELP_1,g.HELP_2,g.HELP_0)<=0&&g.productXY(g.HELP_2,g.HELP_3,g.HELP_0)<=0&&g.productXY(g.HELP_3,g.HELP_1,g.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 g(e.x,e.y,e.z,e.w)}}class el{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 tl extends ja{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 s=this.canvas.getBoundingClientRect();this.canvasX=s.left,this.canvasY=s.top,this._keyStatus={},this._mouseStatus={},this._isTouchStart=!1,this._keyEvent3d=new Ia,this._pointerEvent3D=new Y,this._windowsEvent3d=new bt}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=Y.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 g(e,t),this._oldPosition2=new g(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 el(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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Ia.KEY_DOWN,this.dispatchEvent(this._keyEvent3d))}keyUp(e){this._keyEvent3d.reset(),this._keyEvent3d.keyCode=e.keyCode,this._keyStatus[e.keyCode]=!1,this._keyEvent3d.type=Ia.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,s=a-e,o=0;if(Math.abs(s)<2&&Math.abs(i)<2)return o;var l=this.GetSlideAngle(s,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 nr extends bt{static RESIZE="resize"}class al extends ja{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 nr(nr.RESIZE,{width:this.windowWidth,height:this.windowHeight}),new ResizeObserver(()=>{this.updateSize(),dt.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 al;var Me=(n=>(n[n.Default=1]="Default",n[n.IgnoreDepthPass=2]="IgnoreDepthPass",n[n.Sky=6]="Sky",n[n.Particle=10]="Particle",n[n.SkinnedMesh=16]="SkinnedMesh",n[n.MorphTarget=32]="MorphTarget",n[n.Terrain=64]="Terrain",n[n.UI=128]="UI",n[n.Reflection=256]="Reflection",n[n.ReflectionDebug=512]="ReflectionDebug",n[n.Graphic3D=1024]="Graphic3D",n))(Me||{});class ra{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)==t}}class fe{static HELP_0=new fe;static HELP_1=new fe;static HELP_2=new fe;static ZERO=new fe(0,0);static SAFE_MAX=new fe(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new fe(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 fe,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 s=Math.acos(i),o=Math.sin(s),l=Math.sin((1-a)*s)/o,c=Math.sin(a*s)/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 fe.HELP_0.copyFrom(e),fe.HELP_1.copyFrom(t),fe.HELP_0.scale(a),fe.HELP_1.scale(1-a),new fe(fe.HELP_0.x+fe.HELP_1.x,fe.HELP_0.y+fe.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 fe,t.x=this.x+e.x,t.y=this.y+e.y,t}sub(e,t){return t=t||new fe,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 fe,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 fe,t.x=this.x/e,t.y=this.y/e,t}neg(e){return e||(e=new fe),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 fe;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 fe(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 ue{static X_AXIS=new ue(1,0,0);static Y_AXIS=new ue(0,1,0);static Z_AXIS=new ue(0,0,1);static HELP_0=new ue;static HELP_1=new ue;static HELP_2=new ue;static EPSILON=1e-5;static HELP_3=new ue;static HELP_4=new ue;static HELP_5=new ue;static HELP_6=new ue;static ZERO=new ue;static ONE=new ue(1,1,1,1);static LEFT=new ue(-1,0,0);static RIGHT=new ue(1,0,0);static UP=new ue(0,-1,0);static DOWN=new ue(0,1,0);static BACK=new ue(0,0,-1);static FORWARD=new ue(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 ue;var r=e.x,i=e.y,s=e.z,o=t.x,l=t.y,c=t.z;return a.x=i*c-s*l,a.y=s*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,s=e.w-t.w;return Math.sqrt(a*a+r*r+i*i+s*s)}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 ue(this.x,this.y,this.z,this.w)}}function qs(n,e){let t=n.__NonSerialize__;t||(t=n.__NonSerialize__={},t.__NonSerialize__=!0),t[e]=!0}function $s(n,e){let t;for(;n&&(n=n.__proto__,n&&(t=n.__NonSerialize__),!t););return t&&t[e]}function jr(n,e,t,a,r){let i=n.__EditorInspector__;i||(i=n.__EditorInspector__=new Map);let s=i.get(n.constructor.name);s||(s=new Map,i.set(n.constructor.name,s)),s.set(e,{p1:t,p2:a,p3:r})}function uu(n){let e,t=n,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=n;t&&(t=t.__proto__,t&&(e=t.__EditorInspector__),!e););let r=new Map;if(e)for(let i=0;i<a.length;i++){const s=a[i];let o=e.get(s);o&&o.forEach((l,c)=>{r.set(c,l)})}return r}function Nt(n,e,t,a,r){let i=window.__Component__;i||(i=window.__Component__={}),i[e]=n}function rl(n){let e=window.__Component__;return e[n]?e[n]:null}function Ta(n,e,t,a,r){let i=window.__shader__;i||(i=window.__shader__={}),i[e]=n}function il(n){let e=window.__shader__;return e[n]?e[n]:null}var bu=Object.defineProperty,sl=(n,e,t,a)=>{for(var r=void 0,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(e,t,r)||r);return r&&bu(e,t,r),r};const en=class ss{__refection;__size=0;getValueType(){if(!this.__refection){let e=this;this.__refection=[];for(const t in e)if(!$s(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(!$s(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}};sl([qs],en.prototype,"__refection"),sl([qs],en.prototype,"__size");let gi=en;class nl{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 or{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 nl;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 Za{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 fe(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 g(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 ue(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 Z(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=gi.Ref(e);gi.GetSize(e);let s=t,o=this.memoryNodes.get(s);o.reset();let l=a;r&&(l=l[r]);for(let c=0;c<i.length;c++){const f=i[c];let h=l[f.name];this.writeValue(o,f,h)}}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 s=t[i];this.setStruct(e,i,s,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 s=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(s),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 or,this.memoryNodes=new Map,this._dataView=new Float32Array(this.memory.shareDataBuffer),this.memory.allocation(this.byteSize),a){let s=this.memory.allocation_node(a.length*4);const o=a.buffer instanceof ArrayBuffer?a.buffer:new Uint8Array(a.buffer).buffer;s.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=gi.GetSize(t),i=r*a,s=I.device;this.buffer=s.createBuffer({label:"StructStorageGPUBuffer",size:i,usage:e,mappedAtCreation:!1}),this.memory=new or,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 ga=(n=>(n[n.IndicesGPUBuffer=0]="IndicesGPUBuffer",n[n.VertexGPUBuffer=1]="VertexGPUBuffer",n[n.UniformGPUBuffer=2]="UniformGPUBuffer",n[n.StorageGPUBuffer=3]="StorageGPUBuffer",n[n.ComputeGPUBuffer=4]="ComputeGPUBuffer",n[n.MaterialDataUniformGPUBuffer=5]="MaterialDataUniformGPUBuffer",n[n.StructStorageGPUBuffer=6]="StructStorageGPUBuffer",n))(ga||{});class Pe extends Za{constructor(e,t=0,a){super(),this.bufferType=ga.StorageGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"StorageGPUBuffer")}}class Ct extends Za{constructor(e,t){super(),this.bufferType=ga.UniformGPUBuffer,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,e,t,"UniformGPUBuffer")}genUniformNodes(){}}class Xt{static getMorphTargetShaderBinding(e,t){return`
1
+ (function(d,Yt){typeof exports=="object"&&typeof module<"u"?Yt(exports):typeof define=="function"&&define.amd?define(["exports"],Yt):(d=typeof globalThis<"u"?globalThis:d||self,Yt(d.rings={}))})(void 0,(function(d){"use strict";var Yt=typeof document<"u"?document.currentScript:null;class Z{static COLOR_RED=new Z(1,0,0,1);static COLOR_GREEN=new Z(0,1,0,1);static COLOR_BLUE=new Z(0,0,1,1);static COLOR_WHITE=new Z(1,1,1,1);static COLOR_0=new Z;static COLOR_1=new Z;static COLOR_2=new Z;static HEX_CHARACTERS="a-f\\d";static MATCH_3OR4_HEX=`#?[${Z.HEX_CHARACTERS}]{3}[${Z.HEX_CHARACTERS}]?`;static MATCH_6OR8_HEX=`#?[${Z.HEX_CHARACTERS}]{6}([${Z.HEX_CHARACTERS}]{2})?`;static NON_HEX_CHARS=new RegExp(`[^#${Z.HEX_CHARACTERS}]`,"gi");static VALID_HEX_SIZE=new RegExp(`^${Z.MATCH_3OR4_HEX}$|^${Z.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 Z;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,s=.5){let o=new Z;return o.a=1,o.r=r+e*Math.random(),o.g=i+t*Math.random(),o.b=s+a*Math.random(),o}static randomGray(e=.5,t=.5){let a=Math.random()*t+e,r=new Z;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"||Z.NON_HEX_CHARS.test(e)||!Z.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,s=a&255,o=t;this.a=o,this.r=r/255,this.g=i/255,this.b=s/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 Z().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 Z,t.hexToRGB(e),t}static lerp(e,t,a,r){let i=r||new Z;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 ze{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 bt{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 ns{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 ja{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 s=new ns(e,a,t,r,i);return s.id=++ns.event_id_count,s.current=this,this.listeners[e].push(s),this.listeners[e].sort(function(o,l){return l.priority-o.priority}),s.id}for(let s=0;s<this.listeners[e].length;s++){let o=this.listeners[e][s];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 Ia extends bt{static KEY_DOWN="onKeyDown";static KEY_UP="onKeyUp";keyCode=0}class Y extends bt{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 bt{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 g{static MAX=new g(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);static MIN=new g(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE);static SAFE_MAX=new g(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new g(Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);static X_AXIS=new g(1,0,0);static neg_X_AXIS=new g(-1,0,0);static Y_AXIS=new g(0,1,0);static Z_AXIS=new g(0,0,1);static HELP_0=new g;static HELP_1=new g;static HELP_2=new g;static EPSILON=1e-5;static HELP_3=new g;static HELP_4=new g;static HELP_5=new g;static HELP_6=new g;static get ZERO(){return new g(0,0,0)}static get ONE(){return new g(1,1,1)}static get LEFT(){return new g(-1,0,0)}static get RIGHT(){return new g(1,0,0)}static get UP(){return new g(0,1,0)}static get DOWN(){return new g(0,-1,0)}static get BACK(){return new g(0,0,-1)}static get FORWARD(){return new g(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=g._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==g.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==g.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,s,o;if(i=g.distance(e,t),s=g.distance(e,a),o=g.distance(t,a),o<=1e-6||s<=1e-6)return r=0,r;if(i<=1e-6||o*o>=i*i+s*s)return r=s,r;if(s*s>=i*i+o*o)return r=o,r;let l=(i+s+o)/2;return r=2*Math.sqrt(l*(l-i)*(l-s)*(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 g(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 g,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 g,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,s){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 g;let a=this.x,r=this.y,i=this.z,s=this.w,o=e.x,l=e.y,c=e.z,f=e.w;return t.setTo(a+o,r+l,i+c,s+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 g;let s=this.x,o=this.y,l=this.z,c=this.w,f=e,h=t,u=a,b=r;return i.setTo(s+f,o+h,l+u,c+b),i}clone(){return new g(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 g?new g(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,s=e.y,o=e.z,l=e.w,c=l*t+s*r-o*a,f=l*a+o*t-i*r,h=l*r+i*a-s*t,u=-i*t-s*a-o*r;return this.x=c*l+u*-i+f*-o-h*-s,this.y=f*l+u*-s+h*-i-c*-o,this.z=h*l+u*-o+c*-s-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 g;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 g),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 g),t.setTo(this.x-e.x,this.y-e.y,this.z-e.z),t}multiply(e,t=null){t||(t=new g);let a=this.x,r=this.y,i=this.z,s=e.x,o=e.y,l=e.z;return t.setTo(a*s,r*o,i*l),t}divided(e,t=null){t||(t=new g);let a=this.x,r=this.y,i=this.z,s=e.x,o=e.y,l=e.z;return t.setTo(a/s,r/o,i/l),t}div(e,t){t||(t=new g);let a=this.x,r=this.y,i=this.z,s=this.w;return t.setTo(a/e,r/e,i/e,s/e),t}lerp(e,t,a){let r=e.x,i=e.y,s=e.z,o=e.w,l=t.x,c=t.y,f=t.z,h=t.w;this.x=(l-r)*a+r,this.y=(c-i)*a+i,this.z=(f-s)*a+s,this.w=(h-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(g.RIGHT):this.copyFrom(g.LEFT):this.y>0?this.copyFrom(g.DOWN):this.copyFrom(g.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 g,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 s=Math.acos(i)*180/Math.PI;return a<e&&(s=-s),s;function o(c,f,h,u){let b=[c-h,f-u];return l(b,[0,-1])}function l(c,f){let h=c[0]*f[0]+c[1]*f[1],u=Math.sqrt(c[0]*c[0]+c[1]*c[1])*Math.sqrt(f[0]*f[0]+f[1]*f[1]);return h/u}}static pointInsideTriangle(e,t,a,r){return g.HELP_0.setTo(e.x,e.z,0),g.HELP_1.setTo(t.x,t.z,0),g.HELP_2.setTo(a.x,a.z,0),g.HELP_3.setTo(r.x,r.z,0),g.pointInsideTriangle2d()}static pointInsideTriangle2d(){return g.productXY(g.HELP_1,g.HELP_2,g.HELP_3)>=0?g.productXY(g.HELP_1,g.HELP_2,g.HELP_0)>=0&&g.productXY(g.HELP_2,g.HELP_3,g.HELP_0)>=0&&g.productXY(g.HELP_3,g.HELP_1,g.HELP_0)>=0:g.productXY(g.HELP_1,g.HELP_2,g.HELP_0)<=0&&g.productXY(g.HELP_2,g.HELP_3,g.HELP_0)<=0&&g.productXY(g.HELP_3,g.HELP_1,g.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 g(e.x,e.y,e.z,e.w)}}class el{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 tl extends ja{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 s=this.canvas.getBoundingClientRect();this.canvasX=s.left,this.canvasY=s.top,this._keyStatus={},this._mouseStatus={},this._isTouchStart=!1,this._keyEvent3d=new Ia,this._pointerEvent3D=new Y,this._windowsEvent3d=new bt}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=Y.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 g(e,t),this._oldPosition2=new g(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 el(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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Y.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=Ia.KEY_DOWN,this.dispatchEvent(this._keyEvent3d))}keyUp(e){this._keyEvent3d.reset(),this._keyEvent3d.keyCode=e.keyCode,this._keyStatus[e.keyCode]=!1,this._keyEvent3d.type=Ia.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,s=a-e,o=0;if(Math.abs(s)<2&&Math.abs(i)<2)return o;var l=this.GetSlideAngle(s,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 nr extends bt{static RESIZE="resize"}class al extends ja{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 nr(nr.RESIZE,{width:this.windowWidth,height:this.windowHeight}),new ResizeObserver(()=>{this.updateSize(),dt.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 al;var Me=(n=>(n[n.Default=1]="Default",n[n.IgnoreDepthPass=2]="IgnoreDepthPass",n[n.Sky=6]="Sky",n[n.Particle=10]="Particle",n[n.SkinnedMesh=16]="SkinnedMesh",n[n.MorphTarget=32]="MorphTarget",n[n.Terrain=64]="Terrain",n[n.UI=128]="UI",n[n.Reflection=256]="Reflection",n[n.ReflectionDebug=512]="ReflectionDebug",n[n.Graphic3D=1024]="Graphic3D",n))(Me||{});class ra{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)==t}}class fe{static HELP_0=new fe;static HELP_1=new fe;static HELP_2=new fe;static ZERO=new fe(0,0);static SAFE_MAX=new fe(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);static SAFE_MIN=new fe(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 fe,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 s=Math.acos(i),o=Math.sin(s),l=Math.sin((1-a)*s)/o,c=Math.sin(a*s)/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 fe.HELP_0.copyFrom(e),fe.HELP_1.copyFrom(t),fe.HELP_0.scale(a),fe.HELP_1.scale(1-a),new fe(fe.HELP_0.x+fe.HELP_1.x,fe.HELP_0.y+fe.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 fe,t.x=this.x+e.x,t.y=this.y+e.y,t}sub(e,t){return t=t||new fe,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 fe,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 fe,t.x=this.x/e,t.y=this.y/e,t}neg(e){return e||(e=new fe),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 fe;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 fe(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 ue{static X_AXIS=new ue(1,0,0);static Y_AXIS=new ue(0,1,0);static Z_AXIS=new ue(0,0,1);static HELP_0=new ue;static HELP_1=new ue;static HELP_2=new ue;static EPSILON=1e-5;static HELP_3=new ue;static HELP_4=new ue;static HELP_5=new ue;static HELP_6=new ue;static ZERO=new ue;static ONE=new ue(1,1,1,1);static LEFT=new ue(-1,0,0);static RIGHT=new ue(1,0,0);static UP=new ue(0,-1,0);static DOWN=new ue(0,1,0);static BACK=new ue(0,0,-1);static FORWARD=new ue(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 ue;var r=e.x,i=e.y,s=e.z,o=t.x,l=t.y,c=t.z;return a.x=i*c-s*l,a.y=s*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,s=e.w-t.w;return Math.sqrt(a*a+r*r+i*i+s*s)}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 ue(this.x,this.y,this.z,this.w)}}function qs(n,e){let t=n.__NonSerialize__;t||(t=n.__NonSerialize__={},t.__NonSerialize__=!0),t[e]=!0}function $s(n,e){let t;for(;n&&(n=n.__proto__,n&&(t=n.__NonSerialize__),!t););return t&&t[e]}function jr(n,e,t,a,r){let i=n.__EditorInspector__;i||(i=n.__EditorInspector__=new Map);let s=i.get(n.constructor.name);s||(s=new Map,i.set(n.constructor.name,s)),s.set(e,{p1:t,p2:a,p3:r})}function uu(n){let e,t=n,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=n;t&&(t=t.__proto__,t&&(e=t.__EditorInspector__),!e););let r=new Map;if(e)for(let i=0;i<a.length;i++){const s=a[i];let o=e.get(s);o&&o.forEach((l,c)=>{r.set(c,l)})}return r}function Nt(n,e,t,a,r){let i=window.__Component__;i||(i=window.__Component__={}),i[e]=n}function rl(n){let e=window.__Component__;return e[n]?e[n]:null}function Ta(n,e,t,a,r){let i=window.__shader__;i||(i=window.__shader__={}),i[e]=n}function il(n){let e=window.__shader__;return e[n]?e[n]:null}var bu=Object.defineProperty,sl=(n,e,t,a)=>{for(var r=void 0,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(e,t,r)||r);return r&&bu(e,t,r),r};const en=class ss{__refection;__size=0;getValueType(){if(!this.__refection){let e=this;this.__refection=[];for(const t in e)if(!$s(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(!$s(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}};sl([qs],en.prototype,"__refection"),sl([qs],en.prototype,"__size");let gi=en;class nl{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 or{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 nl;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 Za{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 fe(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 g(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 ue(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 Z(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=gi.Ref(e);gi.GetSize(e);let s=t,o=this.memoryNodes.get(s);o.reset();let l=a;r&&(l=l[r]);for(let c=0;c<i.length;c++){const f=i[c];let h=l[f.name];this.writeValue(o,f,h)}}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 s=t[i];this.setStruct(e,i,s,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 s=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(s),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 or,this.memoryNodes=new Map,this._dataView=new Float32Array(this.memory.shareDataBuffer),this.memory.allocation(this.byteSize),a){let s=this.memory.allocation_node(a.length*4);const o=a.buffer instanceof ArrayBuffer?a.buffer:new Uint8Array(a.buffer).buffer;s.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=gi.GetSize(t),i=r*a,s=I.device;this.buffer=s.createBuffer({label:"StructStorageGPUBuffer",size:i,usage:e,mappedAtCreation:!1}),this.memory=new or,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 ga=(n=>(n[n.IndicesGPUBuffer=0]="IndicesGPUBuffer",n[n.VertexGPUBuffer=1]="VertexGPUBuffer",n[n.UniformGPUBuffer=2]="UniformGPUBuffer",n[n.StorageGPUBuffer=3]="StorageGPUBuffer",n[n.ComputeGPUBuffer=4]="ComputeGPUBuffer",n[n.MaterialDataUniformGPUBuffer=5]="MaterialDataUniformGPUBuffer",n[n.StructStorageGPUBuffer=6]="StructStorageGPUBuffer",n))(ga||{});class Pe extends Za{constructor(e,t=0,a){super(),this.bufferType=ga.StorageGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"StorageGPUBuffer")}}class Ct extends Za{constructor(e,t){super(),this.bufferType=ga.UniformGPUBuffer,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,e,t,"UniformGPUBuffer")}genUniformNodes(){}}class Xt{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 @@
87
87
  #endif
88
88
  }
89
89
  }
90
- `}let Gt=function(n=16,e=16){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[],r;if(e=e||t.length,n)for(r=0;r<n;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("")},ol=1e6,tn=function(){return ol++,ol},gu=function(n,e){let t=0,a=n.length;for(t=0;t<a;t++)if(n[t]==e)return!0;return!1},mu=function(n,e){let t=0,a=n.length;for(t=0;t<a;t++)if(n[t]==e)return t;return-1},os=(...n)=>function(...e){n.forEach(t=>t.apply(this,e))};var St=(n=>(n[n.Number=0]="Number",n[n.Vector2=1]="Vector2",n[n.Vector3=2]="Vector3",n[n.Vector4=3]="Vector4",n[n.Color=4]="Color",n[n.Float32Array=5]="Float32Array",n))(St||{});class lr{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 fe?(this.size=2,this._x=e.x,this._y=e.y,this._type=St.Vector2):e instanceof g?(this.size=3,this._x=e.x,this._y=e.y,this._z=e.z,this._type=St.Vector3):e instanceof ue?(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 Z?(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 Z(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 an{instanceID;shaderVariant;vsEntryPoint="main";fsEntryPoint="main";bindGroups;shaderReflection;defineValue;constValues;uniforms;materialDataUniformBuffer;_bufferDic;_shaderChange=!0;_valueChange=!1;constructor(){this.instanceID=Gt(),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 lr(t),this.noticeValueChange())}setUniformVector2(e,t){this.uniforms[e]?this.uniforms[e].vector2=t:(this.uniforms[e]=new lr(t),this.noticeValueChange())}setUniformVector3(e,t){this.uniforms[e]?this.uniforms[e].vector3=t:this.uniforms[e]=new lr(t)}setUniformVector4(e,t){this.uniforms[e]?this.uniforms[e].vector4=t:this.uniforms[e]=new lr(t)}setUniformColor(e,t){this.uniforms[e]?this.uniforms[e].color=t:this.uniforms[e]=new lr(t)}setUniformArray(e,t){this.uniforms[e]?this.uniforms[e].float32Array(t):this.uniforms[e]=new lr(t)}setUniform(e,t){this.uniforms[e]?this.uniforms[e].data=t:this.uniforms[e]=new lr(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 cr=(n=>(n[n.u32=1]="u32",n[n.f32=1]="f32",n[n["vec2<f32>"]=2]="vec2<f32>",n[n["vec3<f32>"]=3]="vec3<f32>",n[n["vec4<f32>"]=4]="vec4<f32>",n[n.float32=1]="float32",n[n.float32x2=2]="float32x2",n[n.float32x3=3]="float32x3",n[n.float32x4=4]="float32x4",n))(cr||{});let Ht={clamp_to_edge:"clamp-to-edge",repeat:"repeat",mirror_repeat:"mirror-repeat"},pu={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 Au={srcFactor:"one",dstFactor:"zero",operation:"add"},Du={compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"};let lt={never:"never",less:"less",equal:"equal",less_equal:"less-equal",greater:"greater",not_equal:"not-equal",greater_equal:"greater-equal",always:"always"},Vt={none:"none",front:"front",back:"back"},fr={nearest:"nearest",linear:"linear"},ls={point_list:"point-list",line_list:"line-list",line_strip:"line-strip",triangle_list:"triangle-list",triangle_strip:"triangle-strip"},le={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"},mi={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"},_u={vertex:"vertex",instance:"instance"},ll=[null,mi.float32,mi.float32x2,mi.float32x3,mi.float32x4],cl=`
90
+ `}let Gt=function(n=16,e=16){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[],r;if(e=e||t.length,n)for(r=0;r<n;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("")},ol=1e6,tn=function(){return ol++,ol},gu=function(n,e){let t=0,a=n.length;for(t=0;t<a;t++)if(n[t]==e)return!0;return!1},mu=function(n,e){let t=0,a=n.length;for(t=0;t<a;t++)if(n[t]==e)return t;return-1},os=(...n)=>function(...e){n.forEach(t=>t.apply(this,e))};var St=(n=>(n[n.Number=0]="Number",n[n.Vector2=1]="Vector2",n[n.Vector3=2]="Vector3",n[n.Vector4=3]="Vector4",n[n.Color=4]="Color",n[n.Float32Array=5]="Float32Array",n))(St||{});class lr{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 fe?(this.size=2,this._x=e.x,this._y=e.y,this._type=St.Vector2):e instanceof g?(this.size=3,this._x=e.x,this._y=e.y,this._z=e.z,this._type=St.Vector3):e instanceof ue?(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 Z?(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 Z(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 an{instanceID;shaderVariant;vsEntryPoint="main";fsEntryPoint="main";bindGroups;shaderReflection;defineValue;constValues;uniforms;materialDataUniformBuffer;_bufferDic;_shaderChange=!0;_valueChange=!1;constructor(){this.instanceID=Gt(),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 lr(t),this.noticeValueChange())}setUniformVector2(e,t){this.uniforms[e]?this.uniforms[e].vector2=t:(this.uniforms[e]=new lr(t),this.noticeValueChange())}setUniformVector3(e,t){this.uniforms[e]?this.uniforms[e].vector3=t:this.uniforms[e]=new lr(t)}setUniformVector4(e,t){this.uniforms[e]?this.uniforms[e].vector4=t:this.uniforms[e]=new lr(t)}setUniformColor(e,t){this.uniforms[e]?this.uniforms[e].color=t:this.uniforms[e]=new lr(t)}setUniformArray(e,t){this.uniforms[e]?this.uniforms[e].float32Array(t):this.uniforms[e]=new lr(t)}setUniform(e,t){this.uniforms[e]?this.uniforms[e].data=t:this.uniforms[e]=new lr(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 cr=(n=>(n[n.u32=1]="u32",n[n.f32=1]="f32",n[n["vec2<f32>"]=2]="vec2<f32>",n[n["vec3<f32>"]=3]="vec3<f32>",n[n["vec4<f32>"]=4]="vec4<f32>",n[n.float32=1]="float32",n[n.float32x2=2]="float32x2",n[n.float32x3=3]="float32x3",n[n.float32x4=4]="float32x4",n))(cr||{});let Ht={clamp_to_edge:"clamp-to-edge",repeat:"repeat",mirror_repeat:"mirror-repeat"},pu={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 Au={srcFactor:"one",dstFactor:"zero",operation:"add"},Du={compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"};let it={never:"never",less:"less",equal:"equal",less_equal:"less-equal",greater:"greater",not_equal:"not-equal",greater_equal:"greater-equal",always:"always"},Vt={none:"none",front:"front",back:"back"},fr={nearest:"nearest",linear:"linear"},ls={point_list:"point-list",line_list:"line-list",line_strip:"line-strip",triangle_list:"triangle-list",triangle_strip:"triangle-strip"},le={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"},mi={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"},_u={vertex:"vertex",instance:"instance"},ll=[null,mi.float32,mi.float32x2,mi.float32x3,mi.float32x4],cl=`
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 s=r.split(":")[1];s=s.replaceAll(" ",""),s=s.replaceAll(" ",""),s=s.replaceAll(")",""),s=e.split(`struct ${s}`)[1];let l=s.indexOf("{"),c=s.indexOf("}");s=s.slice(l,c),i=s.split("@");for(let f=1;f<i.length;f++){let u=i[f].replace(/\s*$/g,"");u=u.replaceAll(`
5667
5667
  `,""),u=u.split(",")[0],u=u.replaceAll(" "," "),this.parserAttribute(u,t)}}return t}static parserVertex(e,t){let a=[],i=t.split(`fn ${e}(`)[1].split("->")[0],s=i.split("@");if(s&&s.length>1)for(let l=1;l<s.length;l++){let f=s[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),s=o.split("@");for(let h=1;h<s.length;h++){let b=s[h].replace(/\s*$/g,"");b=b.replaceAll(`
5669
- `,""),b=b.split(",")[0],b=b.replaceAll(" "," "),this.parserAttribute(b,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=cr[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 s=e.split(":");a.name=s[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=s[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=cr[a.valueType],t.push(a)}a.format=ll[cr[a.valueType]]}}class Se extends an{entryPoint="CsMain";workerSizeX=1;workerSizeY=0;workerSizeZ=0;_computePipeline;_csShaderModule;_destCS;_sourceCS;_storageTextureDic;_sampleTextureDic;_groupsShaderReflectionVarInfos;_groupCache={};constructor(e){super(),this._sourceCS=e,xt.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 s={binding:a,resource:{buffer:i.buffer,offset:0,size:i.memory.shareDataBuffer.byteLength}};r.push(s)}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 h={binding:l.binding,resource:f.gpuSampler};i.push(h)}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 h={binding:l.binding,resource:f.gpuSampler_comparison};i.push(h)}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),xe.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),xe.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 s=I.device.createBindGroup({layout:this._computePipeline.getBindGroupLayout(e),entries:i});this.bindGroups[e]=s}}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(nr.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=ma.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+=xt.genComputeShaderVariant(this);let e=xt.poolGetReflection(this.shaderVariant);e?this.shaderReflection=e:(xt.getShaderReflection2(this._destCS,this),xt.combineShaderReflectionVarInfo(this.shaderReflection,this.shaderReflection.cs_variables))}}var de=(n=>(n[n.COLOR=1]="COLOR",n[n.REFLECTION=2]="REFLECTION",n[n.POSITION=4]="POSITION",n[n.GRAPHIC=8]="GRAPHIC",n[n.GI=16]="GI",n[n.Cluster=32]="Cluster",n[n.SHADOW=64]="SHADOW",n[n.POINT_SHADOW=128]="POINT_SHADOW",n[n.POST=256]="POST",n[n.DEPTH=512]="DEPTH",n[n.UI=1024]="UI",n))(de||{});class ct{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 de)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 de)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 vu=(()=>{var n=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Yt&&Yt.tagName.toUpperCase()==="SCRIPT"&&Yt.src||new URL("rings.umd.max.js",document.baseURI).href;return(async function(e={}){var t=e,a,r;t.ready=new Promise((O,L)=>{a=O,r=L});var i=Object.assign({},t),s=[],o="./this.program",l=(O,L)=>{throw L},c=typeof window=="object",f=typeof importScripts=="function",h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",u="";function b(O){return t.locateFile?t.locateFile(O,u):u+O}var A,m;if(h){const{createRequire:O}=await Promise.resolve().then(()=>Dp);var p=O(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Yt&&Yt.tagName.toUpperCase()==="SCRIPT"&&Yt.src||new URL("rings.umd.max.js",document.baseURI).href),D=p("fs"),_=p("path");f?u=_.dirname(u)+"/":u=p("url").fileURLToPath(new URL("data:text/javascript;base64,DQp2YXIgTW9kdWxlID0gKCgpID0+IHsNCiAgdmFyIF9zY3JpcHREaXIgPSBpbXBvcnQubWV0YS51cmw7DQogIA0KICByZXR1cm4gKA0KYXN5bmMgZnVuY3Rpb24obW9kdWxlQXJnID0ge30pIHsNCg0KdmFyIE1vZHVsZT1tb2R1bGVBcmc7dmFyIHJlYWR5UHJvbWlzZVJlc29sdmUscmVhZHlQcm9taXNlUmVqZWN0O01vZHVsZVsicmVhZHkiXT1uZXcgUHJvbWlzZSgocmVzb2x2ZSxyZWplY3QpPT57cmVhZHlQcm9taXNlUmVzb2x2Z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dW5Ob3cpY2FsbE1haW4oYXJncyk7cG9zdFJ1bigpfWlmKE1vZHVsZVsic2V0U3RhdHVzIl0pe01vZHVsZVsic2V0U3RhdHVzIl0oIlJ1bm5pbmcuLi4iKTtzZXRUaW1lb3V0KGZ1bmN0aW9uKCl7c2V0VGltZW91dChmdW5jdGlvbigpe01vZHVsZVsic2V0U3RhdHVzIl0oIiIpfSwxKTtkb1J1bigpfSwxKX1lbHNle2RvUnVuKCl9fWlmKE1vZHVsZVsicHJlSW5pdCJdKXtpZih0eXBlb2YgTW9kdWxlWyJwcmVJbml0Il09PSJmdW5jdGlvbiIpTW9kdWxlWyJwcmVJbml0Il09W01vZHVsZVsicHJlSW5pdCJdXTt3aGlsZShNb2R1bGVbInByZUluaXQiXS5sZW5ndGg+MCl7TW9kdWxlWyJwcmVJbml0Il0ucG9wKCkoKX19dmFyIHNob3VsZFJ1bk5vdz10cnVlO2lmKE1vZHVsZVsibm9Jbml0aWFsUnVuIl0pc2hvdWxkUnVuTm93PWZhbHNlO3J1bigpOw0KDQoNCiAgcmV0dXJuIG1vZHVsZUFyZy5yZWFkeQ0KfQ0KKTsNCn0pKCk7DQpleHBvcnQgZGVmYXVsdCBNb2R1bGU7",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Yt&&Yt.tagName.toUpperCase()==="SCRIPT"&&Yt.src||new URL("rings.umd.max.js",document.baseURI).href)),A=(L,se)=>(L=ge(L)?new URL(L):_.normalize(L),D.readFileSync(L,se?void 0:"utf8")),m=L=>{var se=A(L,!0);return se.buffer||(se=new Uint8Array(se)),se},!t.thisProgram&&process.argv.length>1&&(o=process.argv[1].replace(/\\/g,"/")),s=process.argv.slice(2),l=(L,se)=>{throw process.exitCode=L,se}}else(c||f)&&(f?u=self.location.href:typeof document<"u"&&document.currentScript&&(u=document.currentScript.src),n&&(u=n),u.startsWith("blob:")?u="":u=u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1),A=O=>{var L=new XMLHttpRequest;return L.open("GET",O,!1),L.send(null),L.responseText},f&&(m=O=>{var L=new XMLHttpRequest;return L.open("GET",O,!1),L.responseType="arraybuffer",L.send(null),new Uint8Array(L.response)}));var v=t.print||console.log.bind(console),U=t.printErr||console.error.bind(console);Object.assign(t,i),i=null,t.arguments&&(s=t.arguments),t.thisProgram&&(o=t.thisProgram),t.quit&&(l=t.quit);var y;t.wasmBinary&&(y=t.wasmBinary);function S(O){if(typeof h<"u"&&h){var L=Buffer.from(O,"base64");return new Uint8Array(L.buffer,L.byteOffset,L.length)}for(var se=atob(O),ke=new Uint8Array(se.length),He=0;He<se.length;++He)ke[He]=se.charCodeAt(He);return ke}function F(O){if(ce(O))return S(O.slice(ie.length))}var k,x=!1,w,R,Q,M;function j(){var O=k.buffer;t.HEAP8=R=new Int8Array(O),t.HEAP16=new Int16Array(O),t.HEAPU8=Q=new Uint8Array(O),t.HEAPU16=new Uint16Array(O),t.HEAP32=new Int32Array(O),t.HEAPU32=M=new Uint32Array(O),t.HEAPF32=new Float32Array(O),t.HEAPF64=new Float64Array(O)}var he=[],ae=[],P=[],z=[];function W(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)K(t.preRun.shift());je(he)}function V(){je(ae)}function te(){je(P)}function J(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)re(t.postRun.shift());je(z)}function K(O){he.unshift(O)}function ee(O){ae.unshift(O)}function re(O){z.unshift(O)}var oe=0,pe=null;function Te(O){oe++,t.monitorRunDependencies?.(oe)}function Oe(O){if(oe--,t.monitorRunDependencies?.(oe),oe==0&&pe){var L=pe;pe=null,L()}}function q(O){t.onAbort?.(O),O="Aborted("+O+")",U(O),x=!0,w=1,O+=". Build with -sASSERTIONS for more info.";var L=new WebAssembly.RuntimeError(O);throw r(L),L}var ie="data:application/octet-stream;base64,",ce=O=>O.startsWith(ie),ge=O=>O.startsWith("file://"),we;we="data:application/octet-st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qCgoDkDSCADICEgHaIgIiAeoiAjIB+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/QsDACACQQhrIANBCGsrAwA5AwAgBSECIAEiAyAGRw0ACwsgACAHNgIIIAAgCDYCBCAAIAU2AgAgBgRAIAYQDAsPCxATAAsQEgALGQEBf0GgKygCACIBIAAgASgCACgCGBEBAAsQACMAIABrQXBxIgAkACAACwcAIAAoAgQLBQBBowkLBQBBzQkLBQBBkAkLFwEBf0GgKygCACIAIAAoAgAoAhQRAAALFQAgAEUEQEEADwsgAEHkJhAiQQBHCxoAIAAgASgCCCAFEAoEQCABIAIgAyAEECALCzcAIAAgASgCCCAFEAoEQCABIAIgAyAEECAPCyAAKAIIIgAgASACIAMgBCAFIAAoAgAoAhQRCQALpwEAIAAgASgCCCAEEAoEQAJAIAEoAgQgAkcNACABKAIcQQFGDQAgASADNgIcCw8LAkAgACABKAIAIAQQCkUNAAJAIAIgASgCEEcEQCABKAIUIAJHDQELIANBAUcNASABQQE2AiAPCyABIAI2AhQgASADNgIgIAEgASgCKEEBajYCKAJAIAEoAiRBAUcNACABKAIYQQJHDQAgAUEBOgA2CyABQQQ2AiwLC4gCACAAIAEoAgggBBAKBEACQCABKAIEIAJHDQAgASgCHEEBRg0AIAEgAzYCHAsPCwJAIAAgASgCACAEEAoEQAJAIAIgASgCEEcEQCABKAIUIAJHDQELIANBAUcNAiABQQE2AiAPCyABIAM2AiACQCABKAIsQQRGDQAgAUEAOwE0IAAoAggiACABIAIgAkEBIAQgACgCACgCFBEJACABLQA1BEAgAUEDNgIsIAEtADRFDQEMAwsgAUEENgIsCyABIAI2AhQgASABKAIoQQFqNgIoIAEoAiRBAUcNASABKAIYQQJHDQEgAUE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AAAAGwAAACAAAAAhAAAAIgAAAE4xMF9fY3h4YWJpdjEyMF9fc2lfY2xhc3NfdHlwZV9pbmZvRQAAAACgEwAAwBMAAAQTAAAAAAAAWBQAAAEAAAAjAAAAJAAAAAAAAACAFAAAAQAAACUAAAAmAAAAAAAAAEAUAAABAAAAJwAAACgAAABTdDlleGNlcHRpb24AAAAAeBMAADAUAABTdDliYWRfYWxsb2MAAAAAoBMAAEgUAABAFAAAU3QyMGJhZF9hcnJheV9uZXdfbGVuZ3RoAAAAAKATAABkFAAAWBQAAAAAAACwFAAAAgAAACkAAAAqAAAAU3QxMWxvZ2ljX2Vycm9yAKATAACgFAAAQBQAAAAAAADkFAAAAgAAACsAAAAqAAAAU3QxMmxlbmd0aF9lcnJvcgAAAACgEwAA0BQAALAUAABTdDl0eXBlX2luZm8AAAAAeBMAAPAUAEGIKgsBBQBBlCoLARMAQawqCw4UAAAAFQAAALgVAAAABABBxCoLAQEAQdQqCwX/////CgBBmCsLA3AcAQ==",ce(we)||(we=b(we));function me(O){if(O==we&&y)return new Uint8Array(y);var L=F(O);if(L)return L;if(m)return m(O);throw"both async and sync fetching of the wasm failed"}function ye(O){return Promise.resolve().then(()=>me(O))}function Qe(O,L,se){return ye(O).then(ke=>WebAssembly.instantiate(ke,L)).then(se,ke=>{U(`failed to asynchronously prepare wasm: ${ke}`),q(ke)})}function Re(O,L,se,ke){return Qe(L,se,ke)}function Le(){var O={a:Cp};function L(ke,He){return Lt=ke.exports,k=Lt.f,j(),ee(Lt.g),Oe(),Lt}Te();function se(ke){L(ke.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(O,L)}catch(ke){U(`Module.instantiateWasm callback failed with error: ${ke}`),r(ke)}return Re(y,we,O,se).catch(r),{}}function Ut(O){this.name="ExitStatus",this.message=`Program terminated with exit(${O})`,this.status=O}var je=O=>{for(;O.length>0;)O.shift()(t)};t.noExitRuntime;class sr{constructor(L){this.excPtr=L,this.ptr=L-24}set_type(L){M[this.ptr+4>>2]=L}get_type(){return M[this.ptr+4>>2]}set_destructor(L){M[this.ptr+8>>2]=L}get_destructor(){return M[this.ptr+8>>2]}set_caught(L){L=L?1:0,R[this.ptr+12]=L}get_caught(){return R[this.ptr+12]!=0}set_rethrown(L){L=L?1:0,R[this.ptr+13]=L}get_rethrown(){return R[this.ptr+13]!=0}init(L,se){this.set_adjusted_ptr(0),this.set_type(L),this.set_destructor(se)}set_adjusted_ptr(L){M[this.ptr+16>>2]=L}get_adjusted_ptr(){return M[this.ptr+16>>2]}get_exception_ptr(){var L=fu(this.get_type());if(L)return M[this.excPtr>>2];var se=this.get_adjusted_ptr();return se!==0?se:this.excPtr}}var Ea=0,za=(O,L,se)=>{var ke=new sr(O);throw ke.init(L,se),Ea=O,Ea},Wa=()=>{q("")},aa=(O,L,se)=>Q.copyWithin(O,L,L+se),Ja=()=>2147483648,ua=O=>{var L=k.buffer,se=(O-L.byteLength+65535)/65536;try{return k.grow(se),j(),1}catch{}},Pt=O=>{var L=Q.length;O>>>=0;var se=Ja();if(O>se)return!1;for(var ke=(Ra,bi)=>Ra+(bi-Ra%bi)%bi,He=1;He<=4;He*=2){var ot=L*(1+.2/He);ot=Math.min(ot,O+100663296);var Ke=Math.min(se,ke(Math.max(O,ot),65536)),Ze=ua(Ke);if(Ze)return!0}return!1},wa=[null,[],[]],ba=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Lr=(O,L,se)=>{for(var ke=L+se,He=L;O[He]&&!(He>=ke);)++He;if(He-L>16&&O.buffer&&ba)return ba.decode(O.subarray(L,He));for(var ot="";L<He;){var Ke=O[L++];if(!(Ke&128)){ot+=String.fromCharCode(Ke);continue}var Ze=O[L++]&63;if((Ke&224)==192){ot+=String.fromCharCode((Ke&31)<<6|Ze);continue}var Ra=O[L++]&63;if((Ke&240)==224?Ke=(Ke&15)<<12|Ze<<6|Ra:Ke=(Ke&7)<<18|Ze<<12|Ra<<6|O[L++]&63,Ke<65536)ot+=String.fromCharCode(Ke);else{var bi=Ke-65536;ot+=String.fromCharCode(55296|bi>>10,56320|bi&1023)}}return ot},Gr=(O,L)=>{var se=wa[O];L===0||L===10?((O===1?v:U)(Lr(se,0)),se.length=0):se.push(L)},zr=(O,L,se,ke)=>{for(var He=0,ot=0;ot<se;ot++){var Ke=M[L>>2],Ze=M[L+4>>2];L+=8;for(var Ra=0;Ra<Ze;Ra++)Gr(O,Q[Ke+Ra]);He+=Ze}return M[ke>>2]=He,0},Wr=O=>{w=O,l(O,new Ut(O))},Jr=(O,L)=>{w=O,Wr(O)},_p=O=>{if(O instanceof Ut||O=="unwind")return w;l(1,O)},Bp=O=>{for(var L=0,se=0;se<O.length;++se){var ke=O.charCodeAt(se);ke<=127?L++:ke<=2047?L+=2:ke>=55296&&ke<=57343?(L+=4,++se):L+=3}return L},vp=(O,L,se,ke)=>{if(!(ke>0))return 0;for(var He=se,ot=se+ke-1,Ke=0;Ke<O.length;++Ke){var Ze=O.charCodeAt(Ke);if(Ze>=55296&&Ze<=57343){var Ra=O.charCodeAt(++Ke);Ze=65536+((Ze&1023)<<10)|Ra&1023}if(Ze<=127){if(se>=ot)break;L[se++]=Ze}else if(Ze<=2047){if(se+1>=ot)break;L[se++]=192|Ze>>6,L[se++]=128|Ze&63}else if(Ze<=65535){if(se+2>=ot)break;L[se++]=224|Ze>>12,L[se++]=128|Ze>>6&63,L[se++]=128|Ze&63}else{if(se+3>=ot)break;L[se++]=240|Ze>>18,L[se++]=128|Ze>>12&63,L[se++]=128|Ze>>6&63,L[se++]=128|Ze&63}}return L[se]=0,se-He},Up=(O,L,se)=>vp(O,Q,L,se),yp=O=>{var L=Bp(O)+1,se=$o(L);return Up(O,se,L),se},Cp={b:za,c:Wa,e:aa,d:Pt,a:zr},Lt=Le();t._initialize=(O,L,se)=>(t._initialize=Lt.h)(O,L,se),t._allocMatrix=O=>(t._allocMatrix=Lt.i)(O),t._getMatrixBufferPtr=()=>(t._getMatrixBufferPtr=Lt.j)(),t._getSRTPtr=()=>(t._getSRTPtr=Lt.k)(),t._getInfoPtr=()=>(t._getInfoPtr=Lt.l)(),t._getContinuedSRTPtr=()=>(t._getContinuedSRTPtr=Lt.m)(),t._printMatrix=O=>(t._printMatrix=Lt.n)(O),t._updateAllMatrixContinueTransform=(O,L,se)=>(t._updateAllMatrixContinueTransform=Lt.o)(O,L,se);var cu=t._main=(O,L)=>(cu=t._main=Lt.p)(O,L),$o=O=>($o=Lt.r)(O),fu=O=>(fu=Lt.s)(O),Ks;pe=function O(){Ks||du(),Ks||(pe=O)};function Sp(O=[]){var L=cu;O.unshift(o);var se=O.length,ke=$o((se+1)*4),He=ke;O.forEach(Ke=>{M[He>>2]=yp(Ke),He+=4}),M[He>>2]=0;try{var ot=L(se,ke);return Jr(ot,!0),ot}catch(Ke){return _p(Ke)}}function du(O=s){if(oe>0||(W(),oe>0))return;function L(){Ks||(Ks=!0,t.calledRun=!0,!x&&(V(),te(),a(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),hu&&Sp(O),J()))}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 hu=!0;return t.noInitialRun&&(hu=!1),du(),e.ready})})();function dr(n,e,t){return B.setting.doublePrecision?new Float64Array(n,e,t):new Float32Array(n,e,t)}class Ee{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 vu(),this.useDoublePrecision=t,this.wasm._initialize(e,t,0),this.allocMatrix(e)}static allocMatrix(e){e>T.maxCount&&console.error(`The maximum allocation size is exceeded! current:${e}, limit:${T.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=dr(this.wasm.HEAPF64.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=dr(this.wasm.HEAPF64.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=dr(this.wasm.HEAPF64.buffer,this.matrixContinuedSRTBufferPtr,9*e),T.blockBytes=T.block*8):(this.matrixBuffer=dr(this.wasm.HEAPF32.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=dr(this.wasm.HEAPF32.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=dr(this.wasm.HEAPF32.buffer,this.matrixContinuedSRTBufferPtr,9*e),T.blockBytes=T.block*4),this.matrixStateBuffer=new Int32Array(this.wasm.HEAP32.buffer,this.matrixStateBufferPtr,Ee.stateStruct*e),T.allocMatrix(e)}static updateAllContinueTransform(e,t,a){this.wasm._updateAllMatrixContinueTransform(e,t,a)}static setParent(e,t,a){this.matrixStateBuffer[e*Ee.stateStruct+2]=t>=0?t:-1,this.matrixStateBuffer[e*Ee.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*Ee.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*Ee.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*Ee.stateStruct+1]=1)}}class sa{static AXIS_ANGLE="axisAngle";static EULER_ANGLES="eulerAngles";static QUATERNION="quaternion"}class ne{static HELP_0=new ne(0,0,0,1);static HELP_1=new ne(0,0,0,1);static HELP_2=new ne(0,0,0,1);static _zero=new ne(0,0,0,1);static CALCULATION_QUATERNION=new ne;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 ne._zero}static quaternionToMatrix(e,t){let a=e.x*2,r=e.y*2,i=e.z*2,s=e.x*a,o=e.y*r,l=e.z*i,c=e.x*r,f=e.x*i,h=e.y*i,u=e.w*a,b=e.w*r,A=e.w*i;t.rawData[0]=1-(o+l),t.rawData[1]=c+A,t.rawData[2]=f-b,t.rawData[3]=0,t.rawData[4]=c-A,t.rawData[5]=1-(s+l),t.rawData[6]=h+u,t.rawData[7]=0,t.rawData[8]=f+b,t.rawData[9]=h-u,t.rawData[10]=1-(s+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 ne?new ne(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,s=e.z,o=t.w,l=t.x,c=t.y,f=t.z;this.w=a*o-r*l-i*c-s*f,this.x=a*l+r*o+i*f-s*c,this.y=a*c-r*f+i*o+s*l,this.z=a*f+r*c-i*l+s*o}multiplyVector(e,t=null){t||=new ne;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,s=e.y,o=e.z,l=t.w,c=t.x,f=t.y,h=t.z,u=r*l+i*c+s*f+o*h;if(u<0&&(u=-u,l=-l,c=-c,f=-f,h=-h),u<.95){var b=Math.acos(u),A=1/Math.sin(b),m=Math.sin(b*(1-a))*A,p=Math.sin(b*a)*A;this.w=r*m+l*p,this.x=i*m+c*p,this.y=s*m+f*p,this.z=o*m+h*p}else{this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=s+a*(f-s),this.z=o+a*(h-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,s=e.y,o=e.z,l=t.w,c=t.x,f=t.y,h=t.z,u;r*l+i*c+s*f+o*h<0&&(l=-l,c=-c,f=-f,h=-h),this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=s+a*(f-s),this.z=o+a*(h-o),u=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=u,this.x*=u,this.y*=u,this.z*=u}fromEulerAngles(e,t,a){e*=pt,t*=pt,a*=pt;var r=e*.5,i=t*.5,s=a*.5,o=Math.cos(r),l=Math.sin(r),c=Math.cos(i),f=Math.sin(i),h=Math.cos(s),u=Math.sin(s);return this.w=o*c*h+l*f*u,this.x=l*c*h-o*f*u,this.y=o*f*h+l*c*u,this.z=o*c*u-l*f*h,this}setFromRotationMatrix(e){const t=e.rawData,a=t[0],r=t[4],i=t[8],s=t[1],o=t[5],l=t[9],c=t[2],f=t[6],h=t[10],u=a+o+h;if(u>0){const b=.5/Math.sqrt(u+1);this.w=.25/b,this.x=(f-l)*b,this.y=(i-c)*b,this.z=(s-r)*b}else if(a>o&&a>h){const b=2*Math.sqrt(1+a-o-h);this.w=(f-l)/b,this.x=.25*b,this.y=(r+s)/b,this.z=(i+c)/b}else if(o>h){const b=2*Math.sqrt(1+o-a-h);this.w=(i-c)/b,this.x=(r+s)/b,this.y=.25*b,this.z=(l+f)/b}else{const b=2*Math.sqrt(1+h-a-o);this.w=(s-r)/b,this.x=(i+c)/b,this.y=(l+f)/b,this.z=.25*b}return this}getEulerAngles(e){var t,a,r,i,s,o,l,c;return e||=new g,i=this.x,s=this.y,o=this.z,l=this.w,c=2*(l*s-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+s*o),1-2*(i*i+s*s)),a=Math.asin(c),r=Math.atan2(2*(l*o+i*s),1-2*(s*s+o*o))),e.set(t,a,r).scaleBy(Yr)}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(sa.QUATERNION)[1];this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}inverse(e=null){e||=new ne;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 ne(this.x,this.y,this.z,this.w)}transformVector(e,t=null){var a,r,i,s,o=e.x,l=e.y,c=e.z;return t||=new g,s=-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=-s*this.x+a*this.w-r*this.z+i*this.y,t.y=-s*this.y+a*this.z+r*this.w-i*this.x,t.z=-s*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 ne;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 ne(e.x,e.y,e.z,e.w)}}function Uu(n,e,t){let a=n.x*2,r=n.y*2,i=n.z*2,s=n.x*a,o=n.y*r,l=n.z*i,c=n.x*r,f=n.x*i,h=n.y*i,u=n.w*a,b=n.w*r,A=n.w*i,m=t||new g;return m.x=(1-(o+l))*e.x+(c-A)*e.y+(f+b)*e.z,m.y=(c+A)*e.x+(1-(s+l))*e.y+(h-u)*e.z,m.z=(f-b)*e.x+(h+u)*e.y+(1-(s+o))*e.z,m}class pi{_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 pi;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 bc(this.get())}getSignedFloat(){return this.getFloat()*2-1}}let Yr=180/Math.PI,pt=Math.PI/180,yu=2147483647,Cu=-2147483647;function _e(n,e,t){return Math.max(e,Math.min(t,n))}class Ot{static gaussFunction(e,t,a,r){let i=Math.pow(e-a,2),s=2*Math.pow(r,2),o=-1*(i/s),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),s=i,o=i*(t-1)*a,l=i*(t+1)*a,c=-i*r,f=2*a,h=-r,u=(s+o)/(1-f-h),b=(l+c)/(1-f-h);return new Float32Array([s,o,l,c,f,h,u,b])}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()*pt,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()*pt,r=Math.cos(a)*t,i=Math.tan(a)*t,s=Math.sin(a)*t;return new g(r,i,s)}static getCycleXYZ(e){let t=e*Math.random(),a=360*Math.random()*pt,r=Math.cos(a)*t,i=e*Math.random()-e*.5,s=Math.sin(a)*t;return new g(r,i,s)}static angle(e,t){let a=fe.HELP_0,r=fe.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=g.HELP_0;return e.crossProduct(t,a),a.z>0?Ot.angle(e,t):360-Ot.angle(e,t)}getRotationY(e){return Ot.normalizeAngle(Math.atan2(e.z,e.x)*Yr)}static fromToRotation(e,t,a=null){a||=new ne;let r=T.help_matrix_2;return T.fromToRotation(e,t,r),a.fromMatrix(r),a}static getEularDir_yUp(e){let t=ne.HELP_0;return t.fromEulerAngles(0,e,0),t.transformVector(g.Z_AXIS,g.HELP_5),g.HELP_5}static transformVector(e,t,a=null){a||=new g;let r=e.rawData,i=r[0],s=r[1],o=r[2],l=r[3],c=r[4],f=r[5],h=r[6],u=r[7],b=r[8],A=r[9],m=r[10],p=r[11],D=r[12],_=r[13],v=r[14],U=r[15],y=t.x,S=t.y,F=t.z;return a.x=i*y+c*S+b*F+D,a.y=s*y+f*S+A*F+_,a.z=o*y+h*S+m*F+v,a.w=l*y+u*S+p*F+U,a}}let xr=function(n,e,t){return n*(1-t)+e*t};function Su(n,e,t){let a=new g,r=n.x,i=n.y,s=n.z,o=n.w,l=e.x,c=e.y,f=e.z,h=e.w;return a.x=(l-r)*t+r,a.y=(c-i)*t+i,a.z=(f-s)*t+s,a.w=(h-o)*t+o,a}function xu(n,e,t){let a=new Z;return a.r=(1-t)*n.r+t*e.r,a.g=(1-t)*n.g+t*e.g,a.b=(1-t)*n.b+t*e.b,a.a=(1-t)*n.a+t*e.a,a}function Fu(n,e,t){return n+((e-n)*t>>8)&255}let cn=function(n,e,t){let a=t-e;return Math.floor(n/a)%2==0?n%a+e:t-n%a+e},fn=function(n,e,t){let a=t-e;return n%a+e},ku=function(n,e){let t=0;for(let a in n)a==e&&t++;return t};class Eu{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(n,e){return n instanceof g&&e instanceof g||n instanceof ne&&e instanceof ne?n.x*e.x+n.y*e.y+n.z*e.z:n.x*e.x+n.y*e.y}function dn(n,e){return new g(n.x*e.x,n.y*e.y,n.z*e.z)}function hc(n){return Math.sqrt(n)}function hn(n){return hc(Ft(n,n))}function uc(n,e){if(hn(n)>g.EPSILON)return n.divide(hn(n));if(n instanceof fe)return new fe;if(n instanceof g)return new g;if(n instanceof ne)return new ne}function bc(n){return(n&8388607)*(1/8388607)}function Xr(n){return n.getFloat()}function At(n,e,t){let a=n.getFloat();return a=e*a+(1-a)*t,a}function wu(n,e,t){let a;if(e<t){a=t-e;let r=n.get()%a;return r+=e,r}else if(e>t){a=e-t;let r=n.get()%a;return r=e-r,r}else return e}function fs(n){let e=At(n,-1,1),t=At(n,0,2*Math.PI),a=Math.sqrt(1-e*e),r=a*Math.cos(t),i=a*Math.sin(t);return new g(r,i,e)}function gc(n){let e=At(n,0,2*Math.PI),t=Math.cos(e),a=Math.sin(e);return new fe(t,a)}function Ru(n){let e=new ne;return e.x=At(n,-1,1),e.y=At(n,-1,1),e.z=At(n,-1,1),e.w=At(n,-1,1),e=uc(e),Ft(e,ne.identity())<0?-e:e}function Iu(n){const e=2*Math.PI;let t=At(n,0,1),a=At(n,0,e),r=At(n,0,e),i=Math.sqrt(1-t),s=Math.sqrt(t),o=new ne(i*Math.sin(a),i*Math.cos(a),s*Math.sin(r),s*Math.cos(r));return Ft(o,ne.identity())<0?-o:o}function Tu(n,e){return new g(At(n,-e.x,e.x),At(n,-e.y,e.y),At(n,-e.z,e.z))}function mc(n){let e=fs(n);return e.scaleBy(Math.pow(Xr(n),1/3)),e}function Qu(n,e){return dn(mc(n),e)}function Mu(n,e,t){let a=fs(n),r=Math.pow(At(n,0,1),1/3);return a.scaleBy(e+(t-e)*r),a}function Pu(n){let e=gc(n);return e.multiply(Math.pow(At(n,0,1),1/2),e),e}function Nu(n,e,t){let a=dn(fs(n),e),r=Math.pow(At(n,t,1),1/3);return a.scaleBy(r),a}function Vu(n){let e=n.getFloat(),t=n.getFloat();e+t>1&&(e=1-e,t=1-t);let a=1-e-t;return new g(e,t,a)}function Ou(n){return n/360*2*Math.PI}function Lu(n){return 180*n/Math.PI}function Gu(n){return Math.sin(n)}function zu(n){return Math.cos(n)}d.randomSeed=4919;function Wu(){return++d.randomSeed}function Ju(n,e,t){let a=n[e],r=n[t];n[e]=r,n[t]=a}function pc(n){return Math.floor(n)}function un(n){return pc(n+.5)}function ju(n){return n=Math.max(n,0),n=Math.min(n,1),un(n*65535)}function Zu(n){return n=Math.max(n,0),n=Math.min(n,1),un(n*255)}function Ac(n){return Math.abs(n)==0?n:1/Math.sqrt(n)}function Yu(n){let e=bn(n);return n.scaleBy(Ac(e))}function Xu(n,e){return n.crossProduct(e)}function bn(n){return Ft(n,n)}function Hu(n){let e=new pi(n);return Xr(e)}function Ku(n,e){let t=new pi(e);n.x=Xr(t),n.y=Xr(t),n.z=Xr(t)}function qu(n,e,t){return n<e?t:n>t?e:n}function gn(n,e){return n-Math.floor(n/e)*e}const $u=1e-6;class T{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 g(0,0,0);static _one=new g(1,1,1);static _prs=[new g,new g,new g];index=0;offset=0;rawData;_position;static allocMatrix(e){this.allocCount=e,T.dynamicMatrixBytes=Ee.matrixBuffer,T.buffer=T.dynamicMatrixBytes.buffer,T.wasmMatrixPtr=Ee.matrixBufferPtr,this.dynamicGlobalMatrixRef||=[],this.dynamicGlobalMatrixRef.forEach(t=>{t.offset=T.wasmMatrixPtr+t.index*T.blockBytes,t.rawData=dr(T.dynamicMatrixBytes.buffer,t.offset,16)}),T.help_matrix_0||=new T,T.help_matrix_1||=new T,T.help_matrix_2||=new T,T.helpMatrix||=new T,T.helpMatrix2||=new T,T._getEulerMatrix||=new T,T._getEulerMatrix.identity()}static fromToRotation(e,t,a){return a||=new T,a.transformDir(e,t),a}static fromArray(e){if(e.length!==16)throw new Error("Array must contain exactly 16 elements");const t=new T;for(let a=0;a<16;a++)t.rawData[a]=e[a];return t}static getAxisRotation(e,t,a,r){let i=new T,s=r*(Math.PI/180),o=Math.cos(s),l=Math.sin(s),c=1-o,f,h;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,h=a*l,i.rawData[1]=f+h,i.rawData[4]=f-h,f=e*a*c,h=t*l,i.rawData[8]=f+h,i.rawData[2]=f-h,f=t*a*c,h=e*l,i.rawData[9]=f-h,i.rawData[6]=f+h,i}static sanitizeEuler(e){T.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)),T.sanitizeEuler(t),!0):(t.x=Math.PI*.5,t.y=Math.atan2(e.get(0,1),e.get(0,0)),t.z=0,T.sanitizeEuler(t),!1):(t.x=-Math.PI*.5,t.y=Math.atan2(-e.get(0,1),e.get(0,0)),t.z=0,T.sanitizeEuler(t),!1)}static matrixMultiply(e,t,a){T.wasm.Matrix_Multiply(e.index,t.index,a.index)}static matrixAppend(e,t,a){T.wasm.Matrix_Append(e.index,t.index,a.index)}static matrixRotateY(e,t){T.wasm.Matrix_Append(e,t.index)}static matrixRotate(e,t,a){T.wasm.Matrix_Rotate(e,t,a.index)}constructor(e=!1){if(T.useCount>=T.allocCount){let t=T.allocCount+T.allocOnceCount;Ee.allocMatrix(t)}this.index=T.useCount,this.offset=T.wasmMatrixPtr+this.index*T.blockBytes,T.dynamicGlobalMatrixRef[this.index]=this,T.useCount++,this.rawData=dr(T.dynamicMatrixBytes.buffer,this.offset,16),this._position=new g,this.identity()}lookAt(e,t,a=g.Y_AXIS){let r=this.rawData,i=t.subtract(e,g.HELP_0);i.length===0&&(i.z=1),i.normalize();let s=a.crossProduct(i,g.HELP_1);s.length===0&&(Math.abs(a.z)===1?i.x+=1e-4:i.z-=1e-4,i.normalize(),s=a.crossProduct(i,g.HELP_1)),s.normalize();let o=i.crossProduct(s,g.HELP_2);r[0]=s.x,r[1]=o.x,r[2]=i.x,r[3]=0,r[4]=s.y,r[5]=o.y,r[6]=i.y,r[7]=0,r[8]=s.z,r[9]=o.z,r[10]=i.z,r[11]=0,r[12]=-s.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=T.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,s=a[0],o=a[4],l=a[8],c=a[12],f=a[1],h=a[5],u=a[9],b=a[13],A=a[2],m=a[6],p=a[10],D=a[14],_=a[3],v=a[7],U=a[11],y=a[15],S=r[0],F=r[4],k=r[8],x=r[12],w=r[1],R=r[5],Q=r[9],M=r[13],j=r[2],he=r[6],ae=r[10],P=r[14],z=r[3],W=r[7],V=r[11],te=r[15];return i[0]=s*S+o*w+l*j+c*z,i[4]=s*F+o*R+l*he+c*W,i[8]=s*k+o*Q+l*ae+c*V,i[12]=s*x+o*M+l*P+c*te,i[1]=f*S+h*w+u*j+b*z,i[5]=f*F+h*R+u*he+b*W,i[9]=f*k+h*Q+u*ae+b*V,i[13]=f*x+h*M+u*P+b*te,i[2]=A*S+m*w+p*j+D*z,i[6]=A*F+m*R+p*he+D*W,i[10]=A*k+m*Q+p*ae+D*V,i[14]=A*x+m*M+p*P+D*te,i[3]=_*S+v*w+U*j+y*z,i[7]=_*F+v*R+U*he+y*W,i[11]=_*k+v*Q+U*ae+y*V,i[15]=_*x+v*M+U*P+y*te,this}multiplyPoint3(e,t){t||=new g;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 g;let a=this.rawData,r=e.x,i=e.y,s=e.z,o=a[3]*r+a[7]*i+a[11]*s+a[15];return o=o||1,t.x=(a[0]*r+a[4]*i+a[8]*s+a[12])/o,t.y=(a[1]*r+a[5]*i+a[9]*s+a[13])/o,t.z=(a[2]*r+a[6]*i+a[10]*s+a[14])/o,t.w=1,t}transformVector4(e,t){let a=this.rawData;t||=new g;let r=e.x,i=e.y,s=e.z,o=e.w;return t.x=r*a[0]+i*a[4]+s*a[8]+o*a[12],t.y=r*a[1]+i*a[5]+s*a[9]+o*a[13],t.z=r*a[2]+i*a[6]+s*a[10]+o*a[14],t.w=r*a[3]+i*a[7]+s*a[11]+o*a[15],t}perspectiveMultiplyPoint3(e,t){let a=g.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 s=1/r;return t.x=a.x*s,t.y=a.y*s,t.z=a.z*s,!0}else return t.x=0,t.y=0,t.z=0,!1}perspective(e,t,a,r){let i=this.rawData,s=e*pt/2,o=Math.cos(s)/Math.sin(s);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,s=i*t;this.frustum(-s,s,-i,i,a,r)}frustum(e,t,a,r,i,s){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]=s/(s-i),o[11]=1,o[12]=0,o[13]=0,o[14]=-s*i/(s-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,s){let o=this.rawData,l=1/(e-t),c=1/(a-r),f=1/(i-s);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,s){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/(s-i),o[11]=0,o[12]=(e+t)/(e-t),o[13]=(r+a)/(a-r),o[14]=i/(i-s),o[15]=1}transformDir(e,t){let a=this.rawData,r=1e-6,i=g.ZERO;t.crossProduct(e,i);let s=t.dotProduct(e);if(s>1-r)this.identity();else if(s<-1+r){let o=g.HELP_1,l=g.HELP_2,c=0,f,h,u,b,A,m,p,D,_,v,U,y,S,F,k,x,w,R;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,h=-e.y*e.y,u=-e.z*e.z,b=-e.x*e.y,A=-e.x*e.z,m=-e.y*e.z,p=o.x*o.x,D=o.y*o.y,_=o.z*o.z,v=o.x*o.y,U=o.x*o.z,y=o.y*o.z,S=-l.x*l.x,F=-l.y*l.y,k=-l.z*l.z,x=-l.x*l.y,w=-l.x*l.z,R=-l.y*l.z,a[0]=f+p+S,a[1]=b+v+x,a[2]=A+U+w,a[4]=a[1],a[5]=h+D+F,a[6]=m+y+R,a[8]=a[2],a[9]=a[6],a[10]=u+_+k,a[3]=0,a[7]=0,a[11]=0,a[15]=1}else{let o,l,c,f,h,u=i.dotProduct(i),b=(1-s)/u;o=b*i.x,l=b*i.z,c=o*i.y,f=o*i.z,h=l*i.y,a[0]=s+o*i.x,a[1]=c-i.z,a[2]=f+i.y,a[4]=c+i.z,a[5]=s+b*i.y*i.y,a[6]=h-i.x,a[8]=f-i.y,a[9]=h+i.x,a[10]=s+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],s=t[12],o=t[1],l=t[5],c=t[9],f=t[13],h=t[2],u=t[6],b=t[10],A=t[14],m=t[3],p=t[7],D=t[11],_=t[15];t[0]=a*e.rawData[0]+o*e.rawData[4]+h*e.rawData[8]+m*e.rawData[12],t[1]=a*e.rawData[1]+o*e.rawData[5]+h*e.rawData[9]+m*e.rawData[13],t[2]=a*e.rawData[2]+o*e.rawData[6]+h*e.rawData[10]+m*e.rawData[14],t[3]=a*e.rawData[3]+o*e.rawData[7]+h*e.rawData[11]+m*e.rawData[15],t[4]=r*e.rawData[0]+l*e.rawData[4]+u*e.rawData[8]+p*e.rawData[12],t[5]=r*e.rawData[1]+l*e.rawData[5]+u*e.rawData[9]+p*e.rawData[13],t[6]=r*e.rawData[2]+l*e.rawData[6]+u*e.rawData[10]+p*e.rawData[14],t[7]=r*e.rawData[3]+l*e.rawData[7]+u*e.rawData[11]+p*e.rawData[15],t[8]=i*e.rawData[0]+c*e.rawData[4]+b*e.rawData[8]+D*e.rawData[12],t[9]=i*e.rawData[1]+c*e.rawData[5]+b*e.rawData[9]+D*e.rawData[13],t[10]=i*e.rawData[2]+c*e.rawData[6]+b*e.rawData[10]+D*e.rawData[14],t[11]=i*e.rawData[3]+c*e.rawData[7]+b*e.rawData[11]+D*e.rawData[15],t[12]=s*e.rawData[0]+f*e.rawData[4]+A*e.rawData[8]+_*e.rawData[12],t[13]=s*e.rawData[1]+f*e.rawData[5]+A*e.rawData[9]+_*e.rawData[13],t[14]=s*e.rawData[2]+f*e.rawData[6]+A*e.rawData[10]+_*e.rawData[14],t[15]=s*e.rawData[3]+f*e.rawData[7]+A*e.rawData[11]+_*e.rawData[15]}add(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],s=t[12],o=t[1],l=t[5],c=t[9],f=t[13],h=t[2],u=t[6],b=t[10],A=t[14],m=t[3],p=t[7],D=t[11],_=t[15],v=e.rawData[0],U=e.rawData[4],y=e.rawData[8],S=e.rawData[12],F=e.rawData[1],k=e.rawData[5],x=e.rawData[9],w=e.rawData[13],R=e.rawData[2],Q=e.rawData[6],M=e.rawData[10],j=e.rawData[14],he=e.rawData[3],ae=e.rawData[7],P=e.rawData[11],z=e.rawData[15];return t[0]=a+v,t[1]=o+F,t[2]=h+R,t[3]=m+he,t[4]=r+U,t[5]=l+k,t[6]=u+Q,t[7]=p+ae,t[8]=i+y,t[9]=c+x,t[10]=b+M,t[11]=D+P,t[12]=s+S,t[13]=f+w,t[14]=A+j,t[15]=_+z,this}sub(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],s=t[12],o=t[1],l=t[5],c=t[9],f=t[13],h=t[2],u=t[6],b=t[10],A=t[14],m=t[3],p=t[7],D=t[11],_=t[15],v=e.rawData[0],U=e.rawData[4],y=e.rawData[8],S=e.rawData[12],F=e.rawData[1],k=e.rawData[5],x=e.rawData[9],w=e.rawData[13],R=e.rawData[2],Q=e.rawData[6],M=e.rawData[10],j=e.rawData[14],he=e.rawData[3],ae=e.rawData[7],P=e.rawData[11],z=e.rawData[15];return t[0]=a-v,t[1]=o-F,t[2]=h-R,t[3]=m-he,t[4]=r-U,t[5]=l-k,t[6]=u-Q,t[7]=p-ae,t[8]=i-y,t[9]=c-x,t[10]=b-M,t[11]=D-P,t[12]=s-S,t[13]=f-w,t[14]=A-j,t[15]=_-z,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=T.getAxisRotation(t.x,t.y,t.z,e);this.append(a)}createByRotation(e,t){let a=T.helpMatrix,r,i,s=e*pt;return r=Math.sin(s),i=Math.cos(s),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){T.helpMatrix.createByScale(e,t,a),this.append(T.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 T;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(T._zero,e,T._one),this}static decomposeRawData=new Float64Array(16).fill(0);decompose(e="eulerAngles",t){let a=ne.CALCULATION_QUATERNION,r=t||T._prs;this.copyRawDataTo(T.decomposeRawData);let i=T.decomposeRawData,s=r[0];s.x=i[12],s.y=i[13],s.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 sa.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 sa.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 sa.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]=s,r[1]=l,r[2]=o,r}static getEuler(e,t,a=!0,r){return e||=new g,T._getEulerMatrix.makeRotationFromQuaternion(t).makeEuler(e,a,r),e}compose(e,t,a){const r=this.rawData,i=t.x,s=t.y,o=t.z,l=t.w,c=i+i,f=s+s,h=o+o,u=i*c,b=i*f,A=i*h,m=s*f,p=s*h,D=o*h,_=l*c,v=l*f,U=l*h,y=a.x,S=a.y,F=a.z;return r[0]=(1-(m+D))*y,r[1]=(b+U)*y,r[2]=(A-v)*y,r[3]=0,r[4]=(b-U)*S,r[5]=(1-(u+D))*S,r[6]=(p+_)*S,r[7]=0,r[8]=(A+v)*F,r[9]=(p-_)*F,r[10]=(1-(u+m))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}deltaTransformVector(e,t){t||=new g;let a=this.rawData,r=e.x,i=e.y,s=e.z;return t.x=r*a[0]+i*a[4]+s*a[8],t.y=r*a[1]+i*a[5]+s*a[9],t.z=r*a[2]+i*a[6]+s*a[10],t.w=r*a[3]+i*a[7]+s*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],s=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],h=e[0]*t+e[4]*i+e[8]*l;if(Math.abs(h)>1e-11){let u=1/h;e[0]=u*t,e[4]=u*a,e[8]=u*r,e[1]=u*i,e[5]=u*s,e[9]=u*o,e[2]=u*l,e[6]=u*c,e[10]=u*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],s=a[8],o=a[12],l=a[1],c=a[5],f=a[9],h=a[13],u=a[2],b=a[6],A=a[10],m=a[14],p=a[3],D=a[7],_=a[11],v=a[15];a[0]=e*(c*(A*v-m*_)-f*(b*v-m*D)+h*(b*_-A*D)),a[1]=-e*(l*(A*v-m*_)-f*(u*v-m*p)+h*(u*_-A*p)),a[2]=e*(l*(b*v-m*D)-c*(u*v-m*p)+h*(u*D-b*p)),a[3]=-e*(l*(b*_-A*D)-c*(u*_-A*p)+f*(u*D-b*p)),a[4]=-e*(i*(A*v-m*_)-s*(b*v-m*D)+o*(b*_-A*D)),a[5]=e*(r*(A*v-m*_)-s*(u*v-m*p)+o*(u*_-A*p)),a[6]=-e*(r*(b*v-m*D)-i*(u*v-m*p)+o*(u*D-b*p)),a[7]=e*(r*(b*_-A*D)-i*(u*_-A*p)+s*(u*D-b*p)),a[8]=e*(i*(f*v-h*_)-s*(c*v-h*D)+o*(c*_-f*D)),a[9]=-e*(r*(f*v-h*_)-s*(l*v-h*p)+o*(l*_-f*p)),a[10]=e*(r*(c*v-h*D)-i*(l*v-h*p)+o*(l*D-c*p)),a[11]=-e*(r*(c*_-f*D)-i*(l*_-f*p)+s*(l*D-c*p)),a[12]=-e*(i*(f*m-h*A)-s*(c*m-h*b)+o*(c*A-f*b)),a[13]=e*(r*(f*m-h*A)-s*(l*m-h*u)+o*(l*A-f*u)),a[14]=-e*(r*(c*m-h*b)-i*(l*m-h*u)+o*(l*b-c*u)),a[15]=e*(r*(c*A-f*b)-i*(l*A-f*u)+s*(l*b-c*u))}return t}transformPoint(e,t){let a=this.rawData;t||=new g;let r=e.x,i=e.y,s=e.z;return t.x=r*a[0]+i*a[4]+s*a[8]+a[12],t.y=r*a[1]+i*a[5]+s*a[9]+a[13],t.z=r*a[2]+i*a[6]+s*a[10]+a[14],t}transformVector(e,t){let a=this.rawData;t||=new g;let r=e.x,i=e.y,s=e.z;return t.x=r*a[0]+i*a[4]+s*a[8],t.y=r*a[1]+i*a[5]+s*a[9],t.z=r*a[2]+i*a[6]+s*a[10],t}transpose(){let e=this.rawData;for(let t=0;t<T.helpMatrix.rawData.length;t++)T.helpMatrix.rawData[t]=e[t];e[1]=T.helpMatrix.rawData[4],e[2]=T.helpMatrix.rawData[8],e[3]=T.helpMatrix.rawData[12],e[4]=T.helpMatrix.rawData[1],e[6]=T.helpMatrix.rawData[9],e[7]=T.helpMatrix.rawData[13],e[8]=T.helpMatrix.rawData[2],e[9]=T.helpMatrix.rawData[6],e[11]=T.helpMatrix.rawData[14],e[12]=T.helpMatrix.rawData[3],e[13]=T.helpMatrix.rawData[7],e[14]=T.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 g;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 g(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(),ne.quaternionToMatrix(t,this),this.translate(new g(-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,s=e.x,o=e.y,l=e.z,c=i*s,f=i*o;return this.setElements(c*s+a,c*o-r*l,c*l+r*o,0,c*o+r*l,f*o+a,f*l-r*s,0,c*l-r*o,f*l+r*s,i*l*l+a,0,0,0,0,1),this}static transpose(e,t){t||=new T;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 T;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 s=0;s<16;s++)r[s]/=i;return t}makeEuler(e,t,a="XYZ"){const r=this.rawData,i=r[0],s=r[4],o=r[8],l=r[1],c=r[5],f=r[9],h=r[2],u=r[6],b=r[10];switch(a){case"XYZ":e.y=Math.asin(_e(o,-1,1)),Math.abs(o)<.9999999?(e.x=Math.atan2(-f,b),e.z=Math.atan2(-s,i)):(e.x=Math.atan2(u,c),e.z=0);break;case"YXZ":e.x=Math.asin(-_e(f,-1,1)),Math.abs(f)<.9999999?(e.y=Math.atan2(o,b),e.z=Math.atan2(l,c)):(e.y=Math.atan2(-h,i),e.z=0);break;case"ZXY":e.x=Math.asin(_e(u,-1,1)),Math.abs(u)<.9999999?(e.y=Math.atan2(-h,b),e.z=Math.atan2(-s,c)):(e.y=0,e.z=Math.atan2(l,i));break;case"ZYX":e.y=Math.asin(-_e(h,-1,1)),Math.abs(h)<.9999999?(e.x=Math.atan2(u,b),e.z=Math.atan2(l,i)):(e.x=0,e.z=Math.atan2(-s,c));break;case"YZX":e.z=Math.asin(_e(l,-1,1)),Math.abs(l)<.9999999?(e.x=Math.atan2(-f,c),e.y=Math.atan2(-h,i)):(e.x=0,e.y=Math.atan2(o,b));break;case"XZY":e.z=Math.asin(-_e(s,-1,1)),Math.abs(s)<.9999999?(e.x=Math.atan2(u,c),e.y=Math.atan2(o,i)):(e.x=Math.atan2(-f,b),e.y=0);break}return t&&e.multiplyScalar(Yr),e}setElements(e,t,a,r,i,s,o,l,c,f,h,u,b,A,m,p){const D=this.rawData;return D[0]=e,D[4]=t,D[8]=a,D[12]=r,D[1]=i,D[5]=s,D[9]=o,D[13]=l,D[2]=c,D[6]=f,D[10]=h,D[14]=u,D[3]=b,D[7]=A,D[11]=m,D[15]=p,this}makeMatrix44ByQuaternion(e,t,a){this.identity(),ne.quaternionToMatrix(a,this),this.appendTranslation(e.x,e.y,e.z),this.appendScale(t.x,t.y,t.z)}}function Dc(n,e,t){for(let a=0;a<4;a++)t.rawData[a]=n.rawData[a]*e.rawData[0]+n.rawData[a+4]*e.rawData[1]+n.rawData[a+8]*e.rawData[2]+n.rawData[a+12]*e.rawData[3],t.rawData[a+4]=n.rawData[a]*e.rawData[4]+n.rawData[a+4]*e.rawData[5]+n.rawData[a+8]*e.rawData[6]+n.rawData[a+12]*e.rawData[7],t.rawData[a+8]=n.rawData[a]*e.rawData[8]+n.rawData[a+4]*e.rawData[9]+n.rawData[a+8]*e.rawData[10]+n.rawData[a+12]*e.rawData[11],t.rawData[a+12]=n.rawData[a]*e.rawData[12]+n.rawData[a+4]*e.rawData[13]+n.rawData[a+8]*e.rawData[14]+n.rawData[a+12]*e.rawData[15]}function ds(n,e,t,a){let r=a.rawData,i=n.x*pt,s=n.y*pt,o=n.z*pt,l=0,c=i*.5,f=s*.5,h=o*.5,u=Math.cos(c),b=Math.sin(c),A=Math.cos(f),m=Math.sin(f),p=Math.cos(h),D=Math.sin(h);l=u*A*p+b*m*D,i=b*A*p-u*m*D,s=u*m*p+b*A*D,o=u*A*D-b*m*p;let _=i+i,v=s+s,U=o+o,y=i*_,S=i*v,F=i*U,k=s*v,x=s*U,w=o*U,R=l*_,Q=l*v,M=l*U,j=t.x,he=t.y,ae=t.z;r[0]=(1-(k+w))*j,r[1]=(S+M)*j,r[2]=(F-Q)*j,r[3]=0,r[4]=(S-M)*he,r[5]=(1-(y+w))*he,r[6]=(x+R)*he,r[7]=0,r[8]=(F+Q)*ae,r[9]=(x-R)*ae,r[10]=(1-(y+k))*ae,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1}function _c(n,e,t){let a=n.rawData,r=t.rawData,i=a[0],s=a[4],o=a[8],l=a[12],c=a[1],f=a[5],h=a[9],u=a[13],b=a[2],A=a[6],m=a[10],p=a[14],D=a[3],_=a[7],v=a[11],U=a[15];r[0]=i*e.rawData[0]+c*e.rawData[4]+b*e.rawData[8]+D*e.rawData[12],r[1]=i*e.rawData[1]+c*e.rawData[5]+b*e.rawData[9]+D*e.rawData[13],r[2]=i*e.rawData[2]+c*e.rawData[6]+b*e.rawData[10]+D*e.rawData[14],r[3]=i*e.rawData[3]+c*e.rawData[7]+b*e.rawData[11]+D*e.rawData[15],r[4]=s*e.rawData[0]+f*e.rawData[4]+A*e.rawData[8]+_*e.rawData[12],r[5]=s*e.rawData[1]+f*e.rawData[5]+A*e.rawData[9]+_*e.rawData[13],r[6]=s*e.rawData[2]+f*e.rawData[6]+A*e.rawData[10]+_*e.rawData[14],r[7]=s*e.rawData[3]+f*e.rawData[7]+A*e.rawData[11]+_*e.rawData[15],r[8]=o*e.rawData[0]+h*e.rawData[4]+m*e.rawData[8]+v*e.rawData[12],r[9]=o*e.rawData[1]+h*e.rawData[5]+m*e.rawData[9]+v*e.rawData[13],r[10]=o*e.rawData[2]+h*e.rawData[6]+m*e.rawData[10]+v*e.rawData[14],r[11]=o*e.rawData[3]+h*e.rawData[7]+m*e.rawData[11]+v*e.rawData[15],r[12]=l*e.rawData[0]+u*e.rawData[4]+p*e.rawData[8]+U*e.rawData[12],r[13]=l*e.rawData[1]+u*e.rawData[5]+p*e.rawData[9]+U*e.rawData[13],r[14]=l*e.rawData[2]+u*e.rawData[6]+p*e.rawData[10]+U*e.rawData[14],r[15]=l*e.rawData[3]+u*e.rawData[7]+p*e.rawData[11]+U*e.rawData[15]}function e2(n,e){let t=e.x,a=e.y,r=e.z,i=e.w,s=n.rawData,o=2*t*a,l=2*t*r,c=2*t*i,f=2*a*r,h=2*a*i,u=2*r*i,b=t*t,A=a*a,m=r*r,p=i*i;return s[0]=b-A-m+p,s[4]=o-u,s[8]=l+h,s[12]=0,s[1]=o+u,s[5]=-b+A-m+p,s[9]=f-c,s[13]=0,s[2]=l-h,s[6]=f+c,s[10]=-b-A+m+p,s[14]=0,s[3]=0,s[7]=0,s[11]=0,s[15]=1,n}function t2(n,e){let t=e.rawData,a=Math.sin(n),r=Math.cos(n);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 a2(n,e,t){let a=e.x,r=e.y,i=e.z,s=Math.hypot(a,r,i),o,l,c,f,h,u,b,A,m,p,D,_;if(s<$u)return null;s=1/s,a*=s,r*=s,i*=s,o=Math.sin(n),l=Math.cos(n),c=1-l,f=a*a*c+l,h=r*a*c+i*o,u=i*a*c-r*o,b=a*r*c-i*o,A=r*r*c+l,m=i*r*c+a*o,p=a*i*c+r*o,D=r*i*c-a*o,_=i*i*c+l;let v=t.rawData;return v[0]=f,v[1]=h,v[2]=u,v[3]=0,v[4]=b,v[5]=A,v[6]=m,v[7]=0,v[8]=p,v[9]=D,v[10]=_,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,v}function mn(n,e,t){let a=n.rawData,r=a[0],i=a[1],s=a[2],o=a[3],l=a[4],c=a[5],f=a[6],h=a[7],u=a[8],b=a[9],A=a[10],m=a[11],p=a[12],D=a[13],_=a[14],v=a[15],U=e.rawData,y=t.rawData,S=U[0],F=U[1],k=U[2],x=U[3];return y[0]=S*r+F*l+k*u+x*p,y[1]=S*i+F*c+k*b+x*D,y[2]=S*s+F*f+k*A+x*_,y[3]=S*o+F*h+k*m+x*v,S=U[4],F=U[5],k=U[6],x=U[7],y[4]=S*r+F*l+k*u+x*p,y[5]=S*i+F*c+k*b+x*D,y[6]=S*s+F*f+k*A+x*_,y[7]=S*o+F*h+k*m+x*v,S=U[8],F=U[9],k=U[10],x=U[11],y[8]=S*r+F*l+k*u+x*p,y[9]=S*i+F*c+k*b+x*D,y[10]=S*s+F*f+k*A+x*_,y[11]=S*o+F*h+k*m+x*v,S=U[12],F=U[13],k=U[14],x=U[15],y[12]=S*r+F*l+k*u+x*p,y[13]=S*i+F*c+k*b+x*D,y[14]=S*s+F*f+k*A+x*_,y[15]=S*o+F*h+k*m+x*v,y}var ft=(n=>(n[n.None=0]="None",n[n.PointLight=1]="PointLight",n[n.DirectionLight=2]="DirectionLight",n[n.SpotLight=3]="SpotLight",n[n.SkyLight=4]="SkyLight",n))(ft||{});class hs extends gi{static lightSize=24;index=-1;lightType=-1;radius=.001;linear=8;lightPosition=new g;lightMatrixIndex=-1;direction=new g;quadratic=.032;lightColor=new Z(1,1,1,1);intensity=1;innerAngle=0;outerAngle=1;range=100;castShadowIndex=-1;lightTangent=g.FORWARD;iesIndex=-1}class Ne{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=Ne.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 $e{object3D=null;_eventDispatcher;get eventDispatcher(){return this._eventDispatcher||=new ja,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?Ne.bindUpdate(this.transform.view3D,this,e):Ne.unBindUpdate(this.transform.view3D,this)}_onLateUpdate(e){e!=null?Ne.bindLateUpdate(this.transform.view3D,this,e):Ne.unBindLateUpdate(this.transform.view3D,this)}_onBeforeUpdate(e){e!=null?Ne.bindBeforeUpdate(this.transform.view3D,this,e):Ne.unBindBeforeUpdate(this.transform.view3D,this)}_onCompute(e){e!=null?Ne.bindCompute(this.transform.view3D,this,e):Ne.unBindCompute(this.transform.view3D,this)}_onGraphic(e){e!=null?Ne.bindGraphic(this.transform.view3D,this,e):Ne.unBindGraphic(this.transform.view3D,this)}beforeDestroy(e){Ne.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 us{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 na{origin=new g;length=Number.MAX_VALUE;static _rayl=1e9;static _smallnum=1e-8;_vector=new g;_dir=new g;constructor(e,t){this.origin.copyFrom(e||new g),this._dir.copyFrom(t||new g),this._dir.normalize()}get direction(){return this._dir}set direction(e){this._dir.copyFrom(e),this._dir.normalize()}clone(){return new na(this.origin,this.direction)}intersectBox(e,t){let a=this.direction,r=this.origin,i,s,o,l,c,f;const h=1/a.x,u=1/a.y,b=1/a.z,A=e.min,m=e.max;return i=((h>=0?A.x:m.x)-r.x)*h,s=((h>=0?m.x:A.x)-r.x)*h,o=((u>=0?A.y:m.y)-r.y)*u,l=((u>=0?m.y:A.y)-r.y)*u,i>l||o>s||(o>i&&(i=o),l<s&&(s=l),c=((b>=0?A.z:m.z)-r.z)*b,f=((b>=0?m.z:A.z)-r.z)*b,i>f||c>s)||(c>i&&(i=c),f<s&&(s=f),s<0)?null:(t||=new g,this.pointAt(i>=0?i:s,t))}pointAt(e,t){return t||=new g,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),s=r/i,o=this.getPoint(s);return bn(e.subtract(o))}applyMatrix(e){this.origin=e.transformPoint(this.origin),this._dir=e.transformVector(this._dir)}_v0=new g;_v1=new g;_v2=new g;pointInTriangle(e,t,a,r){let i=this._v0,s=this._v1,o=this._v2;r.subtract(t,i),a.subtract(t,s),e.subtract(t,o);let l=g.dot(i,i),c=g.dot(i,s),f=g.dot(i,o),h=g.dot(s,s),u=g.dot(s,o),b=1/(l*h-c*c),A=(h*f-c*u)*b,m=(l*u-c*f)*b;return A>=0&&m>=0&&A+m<1}_E1=new g;_E2=new g;_P=new g;_T=new g;_Q=new g;intersectTriangle(e,t,a){let r=a.v1,i=a.v2,s=a.v3;i.subtract(r,this._E1),s.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 g;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),s=g.dot(t,t),o=2*g.dot(i,t),l=g.dot(i,i)-r*r,c=o*o-4*s*l,f=g.HELP_3;if(c<0)return null;{let h=(-o-Math.sqrt(c))/(s*2);return h<0?null:(f.x=e.x+h*t.x,f.y=e.y+h*t.y,f.z=e.z+h*t.z,f)}}intersectionSegment(e,t,a){const r=this.origin,i=g.HELP_0,s=g.HELP_1,o=g.HELP_2,l=g.HELP_3;t.subtract(e,i),this._dir.scaleToRef(na._rayl,o),r.add(o,s),e.subtract(r,l);var c=g.dot(i,i),f=g.dot(i,o),h=g.dot(o,o),u=g.dot(i,l),b=g.dot(o,l),A=c*h-f*f,m,p,D=A,_,v,U=A;A<na._smallnum?(p=0,D=1,v=b,U=h):(p=f*b-h*u,v=c*b-f*u,p<0?(p=0,v=b,U=h):p>D&&(p=D,v=b+f,U=h)),v<0?(v=0,-u<0?p=0:-u>c?p=D:(p=-u,D=c)):v>U&&(v=U,-u+f<0?p=0:-u+f>c?p=D:(p=-u+f,D=c)),m=Math.abs(p)<na._smallnum?0:p/D,_=Math.abs(v)<na._smallnum?0:v/U;const y=g.HELP_4;o.scaleToRef(_,y);const S=g.HELP_5;i.scaleToRef(m,S),S.add(l,S);const F=g.HELP_6;S.subtract(y,F);var k=_>0&&_<=this._dir.length&&F.lengthSquared<a*a;if(k){let x=new g;return x.copyFrom(t.subtract(e)),x.scaleBy(m),x.add(e,x),{out:x,length:S.length}}return{out:null,length:-1}}get_vec(e,t){let a=g.HELP_1;return a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}}class Ai{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,s){return!(e<a||e>i||t<r||t>s)}clone(){return new Ai(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,s=e.x,o=e.y,l=e.x+e.width,c=e.y+e.height;return Math.max(t,s)<=Math.min(r,l)&&Math.max(a,o)<=Math.min(i,c)}innerArea(e,t){t=t||new Ai;var a=this.x,r=this.y,i=this.x+this.width,s=this.y+this.height,o=e.x,l=e.y,c=e.x+e.width,f=e.y+e.height,h=Math.max(r,l),u=Math.min(s,f),b=Math.max(a,o),A=Math.min(c,i);return h>=0&&u>=0&&u-h>=0&&A-b>0?(t.x=b,t.y=h,t.width=A-b,t.height=u-h):(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 g(1,1,1).multiplyScalar(Number.MAX_VALUE*.1);static minVector3=new g(1,1,1).multiplyScalar(-Number.MAX_VALUE*.1);constructor(e,t){e||=g.ZERO.clone(),t||=g.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 g,this.max||=new g,this.size||=new g,this.center||=new g,this.extents||=new g,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 g,new g),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 pn{planes;corners;boundingBox=new Ce;constructor(){this.planes=[],this.corners=[];for(var e=0;e<6;e++)this.planes[e]=new g;for(var e=0;e<8;e++)this.corners[e]=new g}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 s=0;s<2;++s)for(let o=0;o<2;++o){let l=this.corners[r];r++,l.set(2*i-1,2*s-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 s=this.corners[t];s.set(2*a-1,2*r-1,i,1),e.transformVector4(s,s),s.div(s.w,s),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,s=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<=-s)return 0;r>s&&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,s=e.center.x,o=e.center.y,l=e.center.z;for(let c of this.planes){if(a=c.x*s+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 g(e.min.x,e.min.y,e.min.z),new g(e.max.x,e.min.y,e.min.z),new g(e.min.x,e.max.y,e.min.z),new g(e.max.x,e.max.y,e.min.z),new g(e.min.x,e.min.y,e.max.z),new g(e.max.x,e.min.y,e.max.z),new g(e.min.x,e.max.y,e.max.z),new g(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 s=-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;s=Math.max(s,f),o=Math.min(o,f)}if(s<0)return 0;o>0&&a++}return a===6?2:1}}var it=(n=>(n[n.ortho=0]="ortho",n[n.perspective=1]="perspective",n[n.shadow=2]="shadow",n))(it||{});class r2{corners;index;constructor(e){this.index=e,this.corners=[];for(let t=0;t<4;t++)this.corners.push(new g)}}class i2{bound;twoSections;name;color;shadowCamera;index;constructor(e,t,a){this.bound=new Ce,this.shadowCamera=ht.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 Z(1,0,0,1):a==1?this.color=new Z(0,1,0,1):a==2?this.color=new Z(0,0,1,1):a==3&&(this.color=new Z(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 Bc{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 i2(this.sections[a],this.sections[a+1],a))}update(e,t,a,r,i){let s=this.sections.length-1;for(let o=0;o<=s;++o){let l=this.sections[o],c=0,f=this.logSplit(a,r,o,this.sections.length);{let u=(f-a)/r;u=u**i.csmScatteringExp,f=(r-a)*u+a}f*=i.csmAreaScale;let h=(e.rawData[10]*f+e.rawData[14])/f;for(let u=0;u<2;++u)for(let b=0;b<2;++b){let A=l.corners[c];c++,A.set(2*u-1,2*b-1,h,1),t.transformVector4(A,A),A.div(A.w,A)}}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 Hr extends $e{fov=60;name;aspect=1;near=1;far=5e3;left=-100;right=100;top=100;bottom=-100;frustumSize=100;viewPort=new Ai;frustum;sh=new Float32Array(36);isShadowCamera=!1;_projectionMatrixInv=new T;_projectionMatrix=new T;_viewMatrix=new T;_viewMatrixInv=new T;_unprojection=new T;_pvMatrixInv=new T;_pvMatrix=new T;_halfw;_halfh;_ray;_enableCSM=!1;mainCamera;get projectionMatrix(){return this._projectionMatrix}lookTarget;type=it.perspective;csm;cubeShadowCameras=[];get enableCSM(){return this._enableCSM}set enableCSM(e){e&&!this.csm&&(this.csm=new Bc(ia.Cascades)),this._enableCSM=e}constructor(){super()}init(){super.init(),this._ray=new na,this.frustum=new pn,this.lookTarget=new g(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(nr.RESIZE,this.updateProjection,this)}updateProjection(){this.aspect=I.aspect,this.type==it.perspective?this.perspective(this.fov,this.aspect,this.near,this.far):this.type==it.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-B.setting.shadow.shadowBias*.01}getShadowWorldExtents(){let e=B.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=it.perspective}ortho(e,t,a){this.frustumSize=e;let r=e*.5*this.aspect,i=e*.5,s=-r/2,o=r/2,l=i/2,c=-i/2;this.orthoOffCenter(s,o,c,l,t,a)}orthoOffCenter(e,t,a,r,i,s){this.near=i,this.far=s,this.left=e,this.right=t,this.top=r,this.bottom=a,this.type=it.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 g(0,0,0,1)),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5,Ot.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 g),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 mn(this._projectionMatrix,this.viewMatrix,this._pvMatrix),this._pvMatrix}get pvMatrix2(){mn(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=T.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e.multiply(this.vMatrixInv),e}get ndcToView(){let e=T.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 g),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(),Ot.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=ht.UnProjection(e,t,.01,this),i=ht.UnProjection(e,t,1,this);return i=i.subtract(r).normalize(),a.origin.copyFrom(r),a.direction=i,a}screenPointToWorld(e,t,a){return ht.UnProjection(e,t,a,this)}worldToScreenPoint(e,t){return ht.Projection(e,this,t)}lookAt(e,t,a=g.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=B.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 us,this._jitterOffsetList=[];for(let t=0;t<32;t++){let a=this.generateRandomOffset();this._jitterOffsetList.push(a)}this._jitterOffsetList.reverse()}generateRandomOffset(){let e=new fe(us.get((this._sampleIndex&1023)+1,2)-.5,us.get((this._sampleIndex&1023)+1,3)-.5);return++this._sampleIndex>=32&&(this._sampleIndex=0),e}getJitteredProjectionMatrix(){let e=B.setting.render.postProcessing.taa,t=this._projectionMatrix,a=e.temporalJitterScale,r=this._jitterFrameIndex%e.jitterSeedCount,i=this._jitterOffsetList[r].x*a,s=this._jitterOffsetList[r].y*a,o=t.get(0,2),l=t.get(1,2);this._jitterX=i/this.viewPort.width,this._jitterY=s/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 g;const t=this.transform._worldMatrix.rawData;return e.set(-t[8],-t[9],-t[10]).normalize()}}class zt extends $e{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 bt(zt.POSITION_ONCHANGE);eventRotationChange=new bt(zt.ROTATION_ONCHANGE);eventScaleChange=new bt(zt.SCALE_ONCHANGE);eventLocalChange=new bt(zt.LOCAL_ONCHANGE);onPositionChange;onRotationChange;onScaleChange;_scene3d;_parent;_localPos;_localRot;_localRotQuat;_localScale;_localDetailPos;_localDetailRot;_localDetailScale;index;index2;_forward=new g;_back=new g;_right=new g;_left=new g;_up=new g;_down=new g;_worldMatrix;_targetPos;static=!1;depthOrder=0;get localChange(){return Ee.matrixStateBuffer[this.index2]!=0}set localChange(e){Ee.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,Ee.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=>{Ne.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 T(!0),this.index=this._worldMatrix.index,this.index2=this._worldMatrix.index*Ee.stateStruct,this._localPos=new g,this._localRot=new g,this._localRotQuat=new ne,this._localScale=new g(1,1,1),Ee.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),Ee.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),Ee.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(g.UP,this._up),this._up}set up(e){this._up.copyFrom(e),Ot.fromToRotation(g.UP,this._up,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0}get down(){return this.worldMatrix.transformVector(g.DOWN,this._down),this._down}set down(e){this._down.copyFrom(e),Ot.fromToRotation(g.DOWN,this._down,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get forward(){return this.worldMatrix.transformVector(g.FORWARD,this._forward),this._forward}set forward(e){this._forward.copyFrom(e),Ot.fromToRotation(g.FORWARD,this._forward,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get back(){return this.worldMatrix.transformVector(g.BACK,this._back),this._back}set back(e){this._back.copyFrom(e),Ot.fromToRotation(g.BACK,this._back,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0}get left(){return this.worldMatrix.transformVector(g.neg_X_AXIS,this._left),this._left}set left(e){this._left.copyFrom(e),Ot.fromToRotation(g.LEFT,this._left,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0}get right(){return this.worldMatrix.transformVector(g.X_AXIS,this._right),this._right}set right(e){this._right.copyFrom(e),Ot.fromToRotation(g.RIGHT,this._right,ne.HELP_0),this.transform.localRotQuat=ne.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),Ee.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?(ds(this._localRot,this._localPos,this._localScale,this._worldMatrix),_c(this._worldMatrix,this.parent.worldMatrix,this._worldMatrix)):ds(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=g.UP){this.lookAt(this.transform.worldPosition,e,t)}lookAt(e,t,a=g.UP){this._targetPos||=new g,this._targetPos.copyFrom(t),this.localPosition=e,T.helpMatrix.lookAt(e,t,a),T.helpMatrix.invert();var r=T.helpMatrix.decompose(sa.QUATERNION);this.localRotQuat=ne.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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),Ee.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),Ee.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){Ee.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,Ee.setContinueScale(this.index,e.x,e.y,e.z)}get localDetailRot(){return this._localDetailRot}set localDetailRot(e){this._localDetailRot=e,Ee.setContinueRotation(this.index,e.x,e.y,e.z)}get localDetailPos(){return this._localDetailPos}set localDetailPos(e){this._localDetailPos=e,Ee.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=(n=>(n.position="position",n.normal="normal",n.uv="uv",n.TANGENT="TANGENT",n.TEXCOORD_1="TEXCOORD_1",n.TEXCOORD_2="TEXCOORD_2",n.TEXCOORD_3="TEXCOORD_3",n.TEXCOORD_4="TEXCOORD_4",n.TEXCOORD_5="TEXCOORD_5",n.TEXCOORD_6="TEXCOORD_6",n.TEXCOORD_7="TEXCOORD_7",n.color="color",n.joints0="joints0",n.joints1="joints1",n.weights0="weights0",n.weights1="weights1",n.weight="weight",n.indices="indices",n.vIndex="vIndex",n.a_morphPositions_0="a_morphPositions_0",n.all="all",n))(G||{}),Ae=(n=>(n[n.NONE=0]="NONE",n[n.ABOVE=1]="ABOVE",n[n.ALPHA=2]="ALPHA",n[n.NORMAL=3]="NORMAL",n[n.ADD=4]="ADD",n[n.BELOW=5]="BELOW",n[n.ERASE=6]="ERASE",n[n.MUL=7]="MUL",n[n.SCREEN=8]="SCREEN",n[n.DIVD=9]="DIVD",n[n.SOFT_ADD=10]="SOFT_ADD",n))(Ae||{}),vc=(n=>(n[n.src_a=0]="src_a",n[n.dest_a=1]="dest_a",n))(vc||{});class Uc{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 pa{static mipmapShader=`
5669
+ `,""),b=b.split(",")[0],b=b.replaceAll(" "," "),this.parserAttribute(b,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=cr[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 s=e.split(":");a.name=s[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=s[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=cr[a.valueType],t.push(a)}a.format=ll[cr[a.valueType]]}}class Se extends an{entryPoint="CsMain";workerSizeX=1;workerSizeY=0;workerSizeZ=0;_computePipeline;_csShaderModule;_destCS;_sourceCS;_storageTextureDic;_sampleTextureDic;_groupsShaderReflectionVarInfos;_groupCache={};constructor(e){super(),this._sourceCS=e,xt.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 s={binding:a,resource:{buffer:i.buffer,offset:0,size:i.memory.shareDataBuffer.byteLength}};r.push(s)}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 h={binding:l.binding,resource:f.gpuSampler};i.push(h)}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 h={binding:l.binding,resource:f.gpuSampler_comparison};i.push(h)}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),xe.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),xe.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 s=I.device.createBindGroup({layout:this._computePipeline.getBindGroupLayout(e),entries:i});this.bindGroups[e]=s}}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(nr.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=ma.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+=xt.genComputeShaderVariant(this);let e=xt.poolGetReflection(this.shaderVariant);e?this.shaderReflection=e:(xt.getShaderReflection2(this._destCS,this),xt.combineShaderReflectionVarInfo(this.shaderReflection,this.shaderReflection.cs_variables))}}var de=(n=>(n[n.COLOR=1]="COLOR",n[n.REFLECTION=2]="REFLECTION",n[n.POSITION=4]="POSITION",n[n.GRAPHIC=8]="GRAPHIC",n[n.GI=16]="GI",n[n.Cluster=32]="Cluster",n[n.SHADOW=64]="SHADOW",n[n.POINT_SHADOW=128]="POINT_SHADOW",n[n.POST=256]="POST",n[n.DEPTH=512]="DEPTH",n[n.UI=1024]="UI",n))(de||{});class ct{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 de)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 de)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 vu=(()=>{var n=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Yt&&Yt.tagName.toUpperCase()==="SCRIPT"&&Yt.src||new URL("rings.umd.max.js",document.baseURI).href;return(async function(e={}){var t=e,a,r;t.ready=new Promise((O,L)=>{a=O,r=L});var i=Object.assign({},t),s=[],o="./this.program",l=(O,L)=>{throw L},c=typeof window=="object",f=typeof importScripts=="function",h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",u="";function b(O){return t.locateFile?t.locateFile(O,u):u+O}var A,m;if(h){const{createRequire:O}=await Promise.resolve().then(()=>Dp);var p=O(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Yt&&Yt.tagName.toUpperCase()==="SCRIPT"&&Yt.src||new URL("rings.umd.max.js",document.baseURI).href),D=p("fs"),_=p("path");f?u=_.dirname(u)+"/":u=p("url").fileURLToPath(new URL("data:text/javascript;base64,DQp2YXIgTW9kdWxlID0gKCgpID0+IHsNCiAgdmFyIF9zY3JpcHREaXIgPSBpbXBvcnQubWV0YS51cmw7DQogIA0KICByZXR1cm4gKA0KYXN5bmMgZnVuY3Rpb24obW9kdWxlQXJnID0ge30pIHsNCg0KdmFyIE1vZHVsZT1tb2R1bGVBcmc7dmFyIHJlYWR5UHJvbWlzZVJlc29sdmUscmVhZHlQcm9taXNlUmVqZWN0O01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Vsib25SdW50aW1lSW5pdGlhbGl6ZWQiXSlNb2R1bGVbIm9uUnVudGltZUluaXRpYWxpemVkIl0oKTtpZihzaG91bGRSdW5Ob3cpY2FsbE1haW4oYXJncyk7cG9zdFJ1bigpfWlmKE1vZHVsZVsic2V0U3RhdHVzIl0pe01vZHVsZVsic2V0U3RhdHVzIl0oIlJ1bm5pbmcuLi4iKTtzZXRUaW1lb3V0KGZ1bmN0aW9uKCl7c2V0VGltZW91dChmdW5jdGlvbigpe01vZHVsZVsic2V0U3RhdHVzIl0oIiIpfSwxKTtkb1J1bigpfSwxKX1lbHNle2RvUnVuKCl9fWlmKE1vZHVsZVsicHJlSW5pdCJdKXtpZih0eXBlb2YgTW9kdWxlWyJwcmVJbml0Il09PSJmdW5jdGlvbiIpTW9kdWxlWyJwcmVJbml0Il09W01vZHVsZVsicHJlSW5pdCJdXTt3aGlsZShNb2R1bGVbInByZUluaXQiXS5sZW5ndGg+MCl7TW9kdWxlWyJwcmVJbml0Il0ucG9wKCkoKX19dmFyIHNob3VsZFJ1bk5vdz10cnVlO2lmKE1vZHVsZVsibm9Jbml0aWFsUnVuIl0pc2hvdWxkUnVuTm93PWZhbHNlO3J1bigpOw0KDQoNCiAgcmV0dXJuIG1vZHVsZUFyZy5yZWFkeQ0KfQ0KKTsNCn0pKCk7DQpleHBvcnQgZGVmYXVsdCBNb2R1bGU7",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Yt&&Yt.tagName.toUpperCase()==="SCRIPT"&&Yt.src||new URL("rings.umd.max.js",document.baseURI).href)),A=(L,se)=>(L=ge(L)?new URL(L):_.normalize(L),D.readFileSync(L,se?void 0:"utf8")),m=L=>{var se=A(L,!0);return se.buffer||(se=new Uint8Array(se)),se},!t.thisProgram&&process.argv.length>1&&(o=process.argv[1].replace(/\\/g,"/")),s=process.argv.slice(2),l=(L,se)=>{throw process.exitCode=L,se}}else(c||f)&&(f?u=self.location.href:typeof document<"u"&&document.currentScript&&(u=document.currentScript.src),n&&(u=n),u.startsWith("blob:")?u="":u=u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1),A=O=>{var L=new XMLHttpRequest;return L.open("GET",O,!1),L.send(null),L.responseText},f&&(m=O=>{var L=new XMLHttpRequest;return L.open("GET",O,!1),L.responseType="arraybuffer",L.send(null),new Uint8Array(L.response)}));var v=t.print||console.log.bind(console),U=t.printErr||console.error.bind(console);Object.assign(t,i),i=null,t.arguments&&(s=t.arguments),t.thisProgram&&(o=t.thisProgram),t.quit&&(l=t.quit);var y;t.wasmBinary&&(y=t.wasmBinary);function S(O){if(typeof h<"u"&&h){var L=Buffer.from(O,"base64");return new Uint8Array(L.buffer,L.byteOffset,L.length)}for(var se=atob(O),ke=new Uint8Array(se.length),He=0;He<se.length;++He)ke[He]=se.charCodeAt(He);return ke}function F(O){if(ce(O))return S(O.slice(ie.length))}var k,x=!1,w,R,Q,M;function j(){var O=k.buffer;t.HEAP8=R=new Int8Array(O),t.HEAP16=new Int16Array(O),t.HEAPU8=Q=new Uint8Array(O),t.HEAPU16=new Uint16Array(O),t.HEAP32=new Int32Array(O),t.HEAPU32=M=new Uint32Array(O),t.HEAPF32=new Float32Array(O),t.HEAPF64=new Float64Array(O)}var he=[],ae=[],P=[],z=[];function W(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)K(t.preRun.shift());je(he)}function V(){je(ae)}function te(){je(P)}function J(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)re(t.postRun.shift());je(z)}function K(O){he.unshift(O)}function ee(O){ae.unshift(O)}function re(O){z.unshift(O)}var oe=0,pe=null;function Te(O){oe++,t.monitorRunDependencies?.(oe)}function Oe(O){if(oe--,t.monitorRunDependencies?.(oe),oe==0&&pe){var L=pe;pe=null,L()}}function q(O){t.onAbort?.(O),O="Aborted("+O+")",U(O),x=!0,w=1,O+=". Build with -sASSERTIONS for more info.";var L=new WebAssembly.RuntimeError(O);throw r(L),L}var ie="data:application/octet-stream;base64,",ce=O=>O.startsWith(ie),ge=O=>O.startsWith("file://"),we;we="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/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQQRrIAE2AgAgBEEJSQ0A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iAKIB+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/0AAgD9CwIAIAEgA0cNAAsgACgCACEDCyAAIAggBkEEdGo2AgggACAFNgIEIAAgBDYCACADBEAgAxAMCw8LEBMACxASAAuLAwEHfyABIAAoAggiAiAAKAIEIgNrQcgAbU0EQCAAIAEEfyADQQAgAUHIAGxByABrIgAgAEHIAHBrQcgAaiIAEAcgAGoFIAMLNgIEDwsCQCADIAAoAgAiBmtByABtIgggAWoiBEHk8bgcSQRAQePxuBwgAiAGa0HIAG0iB0EBdCICIAQgAiAESxsgB0HxuJwOTxsiBARAIARB5PG4HE8NAiAEQcgAbBALIQULIAUgCEHIAGxqIgJBACABQcgAbEHIAGsiASABQcgAcGtByABqIgcQByIBIAdqIQggBSAEQcgAbGohBwJAIAMgBkYEQCABIQUMAQsDQCACQcgAayIFIANByABrIgH9AAMA/QsDACACQThrIANBOGv9AAMA/QsDACACQShrIANBKGv9AAMA/QsDACACQRhrIANBGGv9AAMA/QsDACACQQhrIANBCGsrAwA5AwAgBSECIAEiAyAGRw0ACwsgACAHNgIIIAAgCDYCBCAAIAU2AgAgBgRAIAYQDAsPCxATAAsQEgALGQEBf0GgKygCACIBIAAgASgCACgCGBEBAAsQACMAIABrQXBxIgAkACAACwcAIAAoAgQLBQBBowkLBQBBzQkLBQBBkAkLFwEBf0GgKygCACIAIAAoAgAoAhQRAAALFQAgAEUEQEEADwsgAEHkJhAiQQBHCxoAIAAgASgCCCAFEAoEQCABIAIgAyAEECALCzcAIAAgASgCCCAFEAoEQCABIAIgAyAEECAPCyAAKAIIIgAgASACIAMgBCAFIAAoAgAoAhQRCQALpwEAIAAgASgCCCAEEAoEQAJAIAEoAgQgAkcNACABKAIcQQFGDQAgASADNgIcCw8LAkAgACABKAIAIAQQCkUNAAJAIAIgASgCEEcEQCABKAIUIAJHDQELIANBAUcNASABQQE2AiAPCyABIAI2AhQgASADNgIgIAEgASgCKEEBajYCKAJAIAEoAiRBAUcNACABKAIYQQJHDQAgAUEBOgA2CyABQQQ2AiwLC4gCACAAIAEoAgggBBAKBEACQCABKAIEIAJHDQAgASgCHEEBRg0AIAEgAzYCHAsPCwJAIAAgASgCACAEEAoEQAJAIAIgASgCEEcEQCABKAIUIAJHDQELIANBAUcNAiABQQE2AiAPCyABIAM2AiACQCABKAIsQQRGDQAgAUEAOwE0IAAoAggiACABIAIgAkEBIAQgACgCACgCFBEJACABLQA1BEAgA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ADQTAAAAAAAABBMAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAAAAAAOgTAAAXAAAAHwAAABkAAAAaAAAAGwAAACAAAAAhAAAAIgAAAE4xMF9fY3h4YWJpdjEyMF9fc2lfY2xhc3NfdHlwZV9pbmZvRQAAAACgEwAAwBMAAAQTAAAAAAAAWBQAAAEAAAAjAAAAJAAAAAAAAACAFAAAAQAAACUAAAAmAAAAAAAAAEAUAAABAAAAJwAAACgAAABTdDlleGNlcHRpb24AAAAAeBMAADAUAABTdDliYWRfYWxsb2MAAAAAoBMAAEgUAABAFAAAU3QyMGJhZF9hcnJheV9uZXdfbGVuZ3RoAAAAAKATAABkFAAAWBQAAAAAAACwFAAAAgAAACkAAAAqAAAAU3QxMWxvZ2ljX2Vycm9yAKATAACgFAAAQBQAAAAAAADkFAAAAgAAACsAAAAqAAAAU3QxMmxlbmd0aF9lcnJvcgAAAACgEwAA0BQAALAUAABTdDl0eXBlX2luZm8AAAAAeBMAAPAUAEGIKgsBBQBBlCoLARMAQawqCw4UAAAAFQAAALgVAAAABABBxCoLAQEAQdQqCwX/////CgBBmCsLA3AcAQ==",ce(we)||(we=b(we));function me(O){if(O==we&&y)return new Uint8Array(y);var L=F(O);if(L)return L;if(m)return m(O);throw"both async and sync fetching of the wasm failed"}function ye(O){return Promise.resolve().then(()=>me(O))}function Qe(O,L,se){return ye(O).then(ke=>WebAssembly.instantiate(ke,L)).then(se,ke=>{U(`failed to asynchronously prepare wasm: ${ke}`),q(ke)})}function Re(O,L,se,ke){return Qe(L,se,ke)}function Le(){var O={a:Cp};function L(ke,He){return Lt=ke.exports,k=Lt.f,j(),ee(Lt.g),Oe(),Lt}Te();function se(ke){L(ke.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(O,L)}catch(ke){U(`Module.instantiateWasm callback failed with error: ${ke}`),r(ke)}return Re(y,we,O,se).catch(r),{}}function Ut(O){this.name="ExitStatus",this.message=`Program terminated with exit(${O})`,this.status=O}var je=O=>{for(;O.length>0;)O.shift()(t)};t.noExitRuntime;class sr{constructor(L){this.excPtr=L,this.ptr=L-24}set_type(L){M[this.ptr+4>>2]=L}get_type(){return M[this.ptr+4>>2]}set_destructor(L){M[this.ptr+8>>2]=L}get_destructor(){return M[this.ptr+8>>2]}set_caught(L){L=L?1:0,R[this.ptr+12]=L}get_caught(){return R[this.ptr+12]!=0}set_rethrown(L){L=L?1:0,R[this.ptr+13]=L}get_rethrown(){return R[this.ptr+13]!=0}init(L,se){this.set_adjusted_ptr(0),this.set_type(L),this.set_destructor(se)}set_adjusted_ptr(L){M[this.ptr+16>>2]=L}get_adjusted_ptr(){return M[this.ptr+16>>2]}get_exception_ptr(){var L=fu(this.get_type());if(L)return M[this.excPtr>>2];var se=this.get_adjusted_ptr();return se!==0?se:this.excPtr}}var Ea=0,za=(O,L,se)=>{var ke=new sr(O);throw ke.init(L,se),Ea=O,Ea},Wa=()=>{q("")},aa=(O,L,se)=>Q.copyWithin(O,L,L+se),Ja=()=>2147483648,ua=O=>{var L=k.buffer,se=(O-L.byteLength+65535)/65536;try{return k.grow(se),j(),1}catch{}},Pt=O=>{var L=Q.length;O>>>=0;var se=Ja();if(O>se)return!1;for(var ke=(Ra,bi)=>Ra+(bi-Ra%bi)%bi,He=1;He<=4;He*=2){var lt=L*(1+.2/He);lt=Math.min(lt,O+100663296);var Ke=Math.min(se,ke(Math.max(O,lt),65536)),Ze=ua(Ke);if(Ze)return!0}return!1},wa=[null,[],[]],ba=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Lr=(O,L,se)=>{for(var ke=L+se,He=L;O[He]&&!(He>=ke);)++He;if(He-L>16&&O.buffer&&ba)return ba.decode(O.subarray(L,He));for(var lt="";L<He;){var Ke=O[L++];if(!(Ke&128)){lt+=String.fromCharCode(Ke);continue}var Ze=O[L++]&63;if((Ke&224)==192){lt+=String.fromCharCode((Ke&31)<<6|Ze);continue}var Ra=O[L++]&63;if((Ke&240)==224?Ke=(Ke&15)<<12|Ze<<6|Ra:Ke=(Ke&7)<<18|Ze<<12|Ra<<6|O[L++]&63,Ke<65536)lt+=String.fromCharCode(Ke);else{var bi=Ke-65536;lt+=String.fromCharCode(55296|bi>>10,56320|bi&1023)}}return lt},Gr=(O,L)=>{var se=wa[O];L===0||L===10?((O===1?v:U)(Lr(se,0)),se.length=0):se.push(L)},zr=(O,L,se,ke)=>{for(var He=0,lt=0;lt<se;lt++){var Ke=M[L>>2],Ze=M[L+4>>2];L+=8;for(var Ra=0;Ra<Ze;Ra++)Gr(O,Q[Ke+Ra]);He+=Ze}return M[ke>>2]=He,0},Wr=O=>{w=O,l(O,new Ut(O))},Jr=(O,L)=>{w=O,Wr(O)},_p=O=>{if(O instanceof Ut||O=="unwind")return w;l(1,O)},Bp=O=>{for(var L=0,se=0;se<O.length;++se){var ke=O.charCodeAt(se);ke<=127?L++:ke<=2047?L+=2:ke>=55296&&ke<=57343?(L+=4,++se):L+=3}return L},vp=(O,L,se,ke)=>{if(!(ke>0))return 0;for(var He=se,lt=se+ke-1,Ke=0;Ke<O.length;++Ke){var Ze=O.charCodeAt(Ke);if(Ze>=55296&&Ze<=57343){var Ra=O.charCodeAt(++Ke);Ze=65536+((Ze&1023)<<10)|Ra&1023}if(Ze<=127){if(se>=lt)break;L[se++]=Ze}else if(Ze<=2047){if(se+1>=lt)break;L[se++]=192|Ze>>6,L[se++]=128|Ze&63}else if(Ze<=65535){if(se+2>=lt)break;L[se++]=224|Ze>>12,L[se++]=128|Ze>>6&63,L[se++]=128|Ze&63}else{if(se+3>=lt)break;L[se++]=240|Ze>>18,L[se++]=128|Ze>>12&63,L[se++]=128|Ze>>6&63,L[se++]=128|Ze&63}}return L[se]=0,se-He},Up=(O,L,se)=>vp(O,Q,L,se),yp=O=>{var L=Bp(O)+1,se=$o(L);return Up(O,se,L),se},Cp={b:za,c:Wa,e:aa,d:Pt,a:zr},Lt=Le();t._initialize=(O,L,se)=>(t._initialize=Lt.h)(O,L,se),t._allocMatrix=O=>(t._allocMatrix=Lt.i)(O),t._getMatrixBufferPtr=()=>(t._getMatrixBufferPtr=Lt.j)(),t._getSRTPtr=()=>(t._getSRTPtr=Lt.k)(),t._getInfoPtr=()=>(t._getInfoPtr=Lt.l)(),t._getContinuedSRTPtr=()=>(t._getContinuedSRTPtr=Lt.m)(),t._printMatrix=O=>(t._printMatrix=Lt.n)(O),t._updateAllMatrixContinueTransform=(O,L,se)=>(t._updateAllMatrixContinueTransform=Lt.o)(O,L,se);var cu=t._main=(O,L)=>(cu=t._main=Lt.p)(O,L),$o=O=>($o=Lt.r)(O),fu=O=>(fu=Lt.s)(O),Ks;pe=function O(){Ks||du(),Ks||(pe=O)};function Sp(O=[]){var L=cu;O.unshift(o);var se=O.length,ke=$o((se+1)*4),He=ke;O.forEach(Ke=>{M[He>>2]=yp(Ke),He+=4}),M[He>>2]=0;try{var lt=L(se,ke);return Jr(lt,!0),lt}catch(Ke){return _p(Ke)}}function du(O=s){if(oe>0||(W(),oe>0))return;function L(){Ks||(Ks=!0,t.calledRun=!0,!x&&(V(),te(),a(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),hu&&Sp(O),J()))}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 hu=!0;return t.noInitialRun&&(hu=!1),du(),e.ready})})();function dr(n,e,t){return B.setting.doublePrecision?new Float64Array(n,e,t):new Float32Array(n,e,t)}class Ee{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 vu(),this.useDoublePrecision=t,this.wasm._initialize(e,t,0),this.allocMatrix(e)}static allocMatrix(e){e>T.maxCount&&console.error(`The maximum allocation size is exceeded! current:${e}, limit:${T.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=dr(this.wasm.HEAPF64.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=dr(this.wasm.HEAPF64.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=dr(this.wasm.HEAPF64.buffer,this.matrixContinuedSRTBufferPtr,9*e),T.blockBytes=T.block*8):(this.matrixBuffer=dr(this.wasm.HEAPF32.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=dr(this.wasm.HEAPF32.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=dr(this.wasm.HEAPF32.buffer,this.matrixContinuedSRTBufferPtr,9*e),T.blockBytes=T.block*4),this.matrixStateBuffer=new Int32Array(this.wasm.HEAP32.buffer,this.matrixStateBufferPtr,Ee.stateStruct*e),T.allocMatrix(e)}static updateAllContinueTransform(e,t,a){this.wasm._updateAllMatrixContinueTransform(e,t,a)}static setParent(e,t,a){this.matrixStateBuffer[e*Ee.stateStruct+2]=t>=0?t:-1,this.matrixStateBuffer[e*Ee.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*Ee.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*Ee.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*Ee.stateStruct+1]=1)}}class sa{static AXIS_ANGLE="axisAngle";static EULER_ANGLES="eulerAngles";static QUATERNION="quaternion"}class ne{static HELP_0=new ne(0,0,0,1);static HELP_1=new ne(0,0,0,1);static HELP_2=new ne(0,0,0,1);static _zero=new ne(0,0,0,1);static CALCULATION_QUATERNION=new ne;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 ne._zero}static quaternionToMatrix(e,t){let a=e.x*2,r=e.y*2,i=e.z*2,s=e.x*a,o=e.y*r,l=e.z*i,c=e.x*r,f=e.x*i,h=e.y*i,u=e.w*a,b=e.w*r,A=e.w*i;t.rawData[0]=1-(o+l),t.rawData[1]=c+A,t.rawData[2]=f-b,t.rawData[3]=0,t.rawData[4]=c-A,t.rawData[5]=1-(s+l),t.rawData[6]=h+u,t.rawData[7]=0,t.rawData[8]=f+b,t.rawData[9]=h-u,t.rawData[10]=1-(s+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 ne?new ne(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,s=e.z,o=t.w,l=t.x,c=t.y,f=t.z;this.w=a*o-r*l-i*c-s*f,this.x=a*l+r*o+i*f-s*c,this.y=a*c-r*f+i*o+s*l,this.z=a*f+r*c-i*l+s*o}multiplyVector(e,t=null){t||=new ne;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,s=e.y,o=e.z,l=t.w,c=t.x,f=t.y,h=t.z,u=r*l+i*c+s*f+o*h;if(u<0&&(u=-u,l=-l,c=-c,f=-f,h=-h),u<.95){var b=Math.acos(u),A=1/Math.sin(b),m=Math.sin(b*(1-a))*A,p=Math.sin(b*a)*A;this.w=r*m+l*p,this.x=i*m+c*p,this.y=s*m+f*p,this.z=o*m+h*p}else{this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=s+a*(f-s),this.z=o+a*(h-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,s=e.y,o=e.z,l=t.w,c=t.x,f=t.y,h=t.z,u;r*l+i*c+s*f+o*h<0&&(l=-l,c=-c,f=-f,h=-h),this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=s+a*(f-s),this.z=o+a*(h-o),u=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=u,this.x*=u,this.y*=u,this.z*=u}fromEulerAngles(e,t,a){e*=pt,t*=pt,a*=pt;var r=e*.5,i=t*.5,s=a*.5,o=Math.cos(r),l=Math.sin(r),c=Math.cos(i),f=Math.sin(i),h=Math.cos(s),u=Math.sin(s);return this.w=o*c*h+l*f*u,this.x=l*c*h-o*f*u,this.y=o*f*h+l*c*u,this.z=o*c*u-l*f*h,this}setFromRotationMatrix(e){const t=e.rawData,a=t[0],r=t[4],i=t[8],s=t[1],o=t[5],l=t[9],c=t[2],f=t[6],h=t[10],u=a+o+h;if(u>0){const b=.5/Math.sqrt(u+1);this.w=.25/b,this.x=(f-l)*b,this.y=(i-c)*b,this.z=(s-r)*b}else if(a>o&&a>h){const b=2*Math.sqrt(1+a-o-h);this.w=(f-l)/b,this.x=.25*b,this.y=(r+s)/b,this.z=(i+c)/b}else if(o>h){const b=2*Math.sqrt(1+o-a-h);this.w=(i-c)/b,this.x=(r+s)/b,this.y=.25*b,this.z=(l+f)/b}else{const b=2*Math.sqrt(1+h-a-o);this.w=(s-r)/b,this.x=(i+c)/b,this.y=(l+f)/b,this.z=.25*b}return this}getEulerAngles(e){var t,a,r,i,s,o,l,c;return e||=new g,i=this.x,s=this.y,o=this.z,l=this.w,c=2*(l*s-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+s*o),1-2*(i*i+s*s)),a=Math.asin(c),r=Math.atan2(2*(l*o+i*s),1-2*(s*s+o*o))),e.set(t,a,r).scaleBy(Yr)}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(sa.QUATERNION)[1];this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}inverse(e=null){e||=new ne;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 ne(this.x,this.y,this.z,this.w)}transformVector(e,t=null){var a,r,i,s,o=e.x,l=e.y,c=e.z;return t||=new g,s=-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=-s*this.x+a*this.w-r*this.z+i*this.y,t.y=-s*this.y+a*this.z+r*this.w-i*this.x,t.z=-s*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 ne;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 ne(e.x,e.y,e.z,e.w)}}function Uu(n,e,t){let a=n.x*2,r=n.y*2,i=n.z*2,s=n.x*a,o=n.y*r,l=n.z*i,c=n.x*r,f=n.x*i,h=n.y*i,u=n.w*a,b=n.w*r,A=n.w*i,m=t||new g;return m.x=(1-(o+l))*e.x+(c-A)*e.y+(f+b)*e.z,m.y=(c+A)*e.x+(1-(s+l))*e.y+(h-u)*e.z,m.z=(f-b)*e.x+(h+u)*e.y+(1-(s+o))*e.z,m}class pi{_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 pi;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 bc(this.get())}getSignedFloat(){return this.getFloat()*2-1}}let Yr=180/Math.PI,pt=Math.PI/180,yu=2147483647,Cu=-2147483647;function _e(n,e,t){return Math.max(e,Math.min(t,n))}class Ot{static gaussFunction(e,t,a,r){let i=Math.pow(e-a,2),s=2*Math.pow(r,2),o=-1*(i/s),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),s=i,o=i*(t-1)*a,l=i*(t+1)*a,c=-i*r,f=2*a,h=-r,u=(s+o)/(1-f-h),b=(l+c)/(1-f-h);return new Float32Array([s,o,l,c,f,h,u,b])}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()*pt,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()*pt,r=Math.cos(a)*t,i=Math.tan(a)*t,s=Math.sin(a)*t;return new g(r,i,s)}static getCycleXYZ(e){let t=e*Math.random(),a=360*Math.random()*pt,r=Math.cos(a)*t,i=e*Math.random()-e*.5,s=Math.sin(a)*t;return new g(r,i,s)}static angle(e,t){let a=fe.HELP_0,r=fe.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=g.HELP_0;return e.crossProduct(t,a),a.z>0?Ot.angle(e,t):360-Ot.angle(e,t)}getRotationY(e){return Ot.normalizeAngle(Math.atan2(e.z,e.x)*Yr)}static fromToRotation(e,t,a=null){a||=new ne;let r=T.help_matrix_2;return T.fromToRotation(e,t,r),a.fromMatrix(r),a}static getEularDir_yUp(e){let t=ne.HELP_0;return t.fromEulerAngles(0,e,0),t.transformVector(g.Z_AXIS,g.HELP_5),g.HELP_5}static transformVector(e,t,a=null){a||=new g;let r=e.rawData,i=r[0],s=r[1],o=r[2],l=r[3],c=r[4],f=r[5],h=r[6],u=r[7],b=r[8],A=r[9],m=r[10],p=r[11],D=r[12],_=r[13],v=r[14],U=r[15],y=t.x,S=t.y,F=t.z;return a.x=i*y+c*S+b*F+D,a.y=s*y+f*S+A*F+_,a.z=o*y+h*S+m*F+v,a.w=l*y+u*S+p*F+U,a}}let xr=function(n,e,t){return n*(1-t)+e*t};function Su(n,e,t){let a=new g,r=n.x,i=n.y,s=n.z,o=n.w,l=e.x,c=e.y,f=e.z,h=e.w;return a.x=(l-r)*t+r,a.y=(c-i)*t+i,a.z=(f-s)*t+s,a.w=(h-o)*t+o,a}function xu(n,e,t){let a=new Z;return a.r=(1-t)*n.r+t*e.r,a.g=(1-t)*n.g+t*e.g,a.b=(1-t)*n.b+t*e.b,a.a=(1-t)*n.a+t*e.a,a}function Fu(n,e,t){return n+((e-n)*t>>8)&255}let cn=function(n,e,t){let a=t-e;return Math.floor(n/a)%2==0?n%a+e:t-n%a+e},fn=function(n,e,t){let a=t-e;return n%a+e},ku=function(n,e){let t=0;for(let a in n)a==e&&t++;return t};class Eu{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(n,e){return n instanceof g&&e instanceof g||n instanceof ne&&e instanceof ne?n.x*e.x+n.y*e.y+n.z*e.z:n.x*e.x+n.y*e.y}function dn(n,e){return new g(n.x*e.x,n.y*e.y,n.z*e.z)}function hc(n){return Math.sqrt(n)}function hn(n){return hc(Ft(n,n))}function uc(n,e){if(hn(n)>g.EPSILON)return n.divide(hn(n));if(n instanceof fe)return new fe;if(n instanceof g)return new g;if(n instanceof ne)return new ne}function bc(n){return(n&8388607)*(1/8388607)}function Xr(n){return n.getFloat()}function At(n,e,t){let a=n.getFloat();return a=e*a+(1-a)*t,a}function wu(n,e,t){let a;if(e<t){a=t-e;let r=n.get()%a;return r+=e,r}else if(e>t){a=e-t;let r=n.get()%a;return r=e-r,r}else return e}function fs(n){let e=At(n,-1,1),t=At(n,0,2*Math.PI),a=Math.sqrt(1-e*e),r=a*Math.cos(t),i=a*Math.sin(t);return new g(r,i,e)}function gc(n){let e=At(n,0,2*Math.PI),t=Math.cos(e),a=Math.sin(e);return new fe(t,a)}function Ru(n){let e=new ne;return e.x=At(n,-1,1),e.y=At(n,-1,1),e.z=At(n,-1,1),e.w=At(n,-1,1),e=uc(e),Ft(e,ne.identity())<0?-e:e}function Iu(n){const e=2*Math.PI;let t=At(n,0,1),a=At(n,0,e),r=At(n,0,e),i=Math.sqrt(1-t),s=Math.sqrt(t),o=new ne(i*Math.sin(a),i*Math.cos(a),s*Math.sin(r),s*Math.cos(r));return Ft(o,ne.identity())<0?-o:o}function Tu(n,e){return new g(At(n,-e.x,e.x),At(n,-e.y,e.y),At(n,-e.z,e.z))}function mc(n){let e=fs(n);return e.scaleBy(Math.pow(Xr(n),1/3)),e}function Qu(n,e){return dn(mc(n),e)}function Mu(n,e,t){let a=fs(n),r=Math.pow(At(n,0,1),1/3);return a.scaleBy(e+(t-e)*r),a}function Pu(n){let e=gc(n);return e.multiply(Math.pow(At(n,0,1),1/2),e),e}function Nu(n,e,t){let a=dn(fs(n),e),r=Math.pow(At(n,t,1),1/3);return a.scaleBy(r),a}function Vu(n){let e=n.getFloat(),t=n.getFloat();e+t>1&&(e=1-e,t=1-t);let a=1-e-t;return new g(e,t,a)}function Ou(n){return n/360*2*Math.PI}function Lu(n){return 180*n/Math.PI}function Gu(n){return Math.sin(n)}function zu(n){return Math.cos(n)}d.randomSeed=4919;function Wu(){return++d.randomSeed}function Ju(n,e,t){let a=n[e],r=n[t];n[e]=r,n[t]=a}function pc(n){return Math.floor(n)}function un(n){return pc(n+.5)}function ju(n){return n=Math.max(n,0),n=Math.min(n,1),un(n*65535)}function Zu(n){return n=Math.max(n,0),n=Math.min(n,1),un(n*255)}function Ac(n){return Math.abs(n)==0?n:1/Math.sqrt(n)}function Yu(n){let e=bn(n);return n.scaleBy(Ac(e))}function Xu(n,e){return n.crossProduct(e)}function bn(n){return Ft(n,n)}function Hu(n){let e=new pi(n);return Xr(e)}function Ku(n,e){let t=new pi(e);n.x=Xr(t),n.y=Xr(t),n.z=Xr(t)}function qu(n,e,t){return n<e?t:n>t?e:n}function gn(n,e){return n-Math.floor(n/e)*e}const $u=1e-6;class T{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 g(0,0,0);static _one=new g(1,1,1);static _prs=[new g,new g,new g];index=0;offset=0;rawData;_position;static allocMatrix(e){this.allocCount=e,T.dynamicMatrixBytes=Ee.matrixBuffer,T.buffer=T.dynamicMatrixBytes.buffer,T.wasmMatrixPtr=Ee.matrixBufferPtr,this.dynamicGlobalMatrixRef||=[],this.dynamicGlobalMatrixRef.forEach(t=>{t.offset=T.wasmMatrixPtr+t.index*T.blockBytes,t.rawData=dr(T.dynamicMatrixBytes.buffer,t.offset,16)}),T.help_matrix_0||=new T,T.help_matrix_1||=new T,T.help_matrix_2||=new T,T.helpMatrix||=new T,T.helpMatrix2||=new T,T._getEulerMatrix||=new T,T._getEulerMatrix.identity()}static fromToRotation(e,t,a){return a||=new T,a.transformDir(e,t),a}static fromArray(e){if(e.length!==16)throw new Error("Array must contain exactly 16 elements");const t=new T;for(let a=0;a<16;a++)t.rawData[a]=e[a];return t}static getAxisRotation(e,t,a,r){let i=new T,s=r*(Math.PI/180),o=Math.cos(s),l=Math.sin(s),c=1-o,f,h;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,h=a*l,i.rawData[1]=f+h,i.rawData[4]=f-h,f=e*a*c,h=t*l,i.rawData[8]=f+h,i.rawData[2]=f-h,f=t*a*c,h=e*l,i.rawData[9]=f-h,i.rawData[6]=f+h,i}static sanitizeEuler(e){T.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)),T.sanitizeEuler(t),!0):(t.x=Math.PI*.5,t.y=Math.atan2(e.get(0,1),e.get(0,0)),t.z=0,T.sanitizeEuler(t),!1):(t.x=-Math.PI*.5,t.y=Math.atan2(-e.get(0,1),e.get(0,0)),t.z=0,T.sanitizeEuler(t),!1)}static matrixMultiply(e,t,a){T.wasm.Matrix_Multiply(e.index,t.index,a.index)}static matrixAppend(e,t,a){T.wasm.Matrix_Append(e.index,t.index,a.index)}static matrixRotateY(e,t){T.wasm.Matrix_Append(e,t.index)}static matrixRotate(e,t,a){T.wasm.Matrix_Rotate(e,t,a.index)}constructor(e=!1){if(T.useCount>=T.allocCount){let t=T.allocCount+T.allocOnceCount;Ee.allocMatrix(t)}this.index=T.useCount,this.offset=T.wasmMatrixPtr+this.index*T.blockBytes,T.dynamicGlobalMatrixRef[this.index]=this,T.useCount++,this.rawData=dr(T.dynamicMatrixBytes.buffer,this.offset,16),this._position=new g,this.identity()}lookAt(e,t,a=g.Y_AXIS){let r=this.rawData,i=t.subtract(e,g.HELP_0);i.length===0&&(i.z=1),i.normalize();let s=a.crossProduct(i,g.HELP_1);s.length===0&&(Math.abs(a.z)===1?i.x+=1e-4:i.z-=1e-4,i.normalize(),s=a.crossProduct(i,g.HELP_1)),s.normalize();let o=i.crossProduct(s,g.HELP_2);r[0]=s.x,r[1]=o.x,r[2]=i.x,r[3]=0,r[4]=s.y,r[5]=o.y,r[6]=i.y,r[7]=0,r[8]=s.z,r[9]=o.z,r[10]=i.z,r[11]=0,r[12]=-s.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=T.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,s=a[0],o=a[4],l=a[8],c=a[12],f=a[1],h=a[5],u=a[9],b=a[13],A=a[2],m=a[6],p=a[10],D=a[14],_=a[3],v=a[7],U=a[11],y=a[15],S=r[0],F=r[4],k=r[8],x=r[12],w=r[1],R=r[5],Q=r[9],M=r[13],j=r[2],he=r[6],ae=r[10],P=r[14],z=r[3],W=r[7],V=r[11],te=r[15];return i[0]=s*S+o*w+l*j+c*z,i[4]=s*F+o*R+l*he+c*W,i[8]=s*k+o*Q+l*ae+c*V,i[12]=s*x+o*M+l*P+c*te,i[1]=f*S+h*w+u*j+b*z,i[5]=f*F+h*R+u*he+b*W,i[9]=f*k+h*Q+u*ae+b*V,i[13]=f*x+h*M+u*P+b*te,i[2]=A*S+m*w+p*j+D*z,i[6]=A*F+m*R+p*he+D*W,i[10]=A*k+m*Q+p*ae+D*V,i[14]=A*x+m*M+p*P+D*te,i[3]=_*S+v*w+U*j+y*z,i[7]=_*F+v*R+U*he+y*W,i[11]=_*k+v*Q+U*ae+y*V,i[15]=_*x+v*M+U*P+y*te,this}multiplyPoint3(e,t){t||=new g;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 g;let a=this.rawData,r=e.x,i=e.y,s=e.z,o=a[3]*r+a[7]*i+a[11]*s+a[15];return o=o||1,t.x=(a[0]*r+a[4]*i+a[8]*s+a[12])/o,t.y=(a[1]*r+a[5]*i+a[9]*s+a[13])/o,t.z=(a[2]*r+a[6]*i+a[10]*s+a[14])/o,t.w=1,t}transformVector4(e,t){let a=this.rawData;t||=new g;let r=e.x,i=e.y,s=e.z,o=e.w;return t.x=r*a[0]+i*a[4]+s*a[8]+o*a[12],t.y=r*a[1]+i*a[5]+s*a[9]+o*a[13],t.z=r*a[2]+i*a[6]+s*a[10]+o*a[14],t.w=r*a[3]+i*a[7]+s*a[11]+o*a[15],t}perspectiveMultiplyPoint3(e,t){let a=g.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 s=1/r;return t.x=a.x*s,t.y=a.y*s,t.z=a.z*s,!0}else return t.x=0,t.y=0,t.z=0,!1}perspective(e,t,a,r){let i=this.rawData,s=e*pt/2,o=Math.cos(s)/Math.sin(s);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,s=i*t;this.frustum(-s,s,-i,i,a,r)}frustum(e,t,a,r,i,s){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]=s/(s-i),o[11]=1,o[12]=0,o[13]=0,o[14]=-s*i/(s-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,s){let o=this.rawData,l=1/(e-t),c=1/(a-r),f=1/(i-s);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,s){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/(s-i),o[11]=0,o[12]=(e+t)/(e-t),o[13]=(r+a)/(a-r),o[14]=i/(i-s),o[15]=1}transformDir(e,t){let a=this.rawData,r=1e-6,i=g.ZERO;t.crossProduct(e,i);let s=t.dotProduct(e);if(s>1-r)this.identity();else if(s<-1+r){let o=g.HELP_1,l=g.HELP_2,c=0,f,h,u,b,A,m,p,D,_,v,U,y,S,F,k,x,w,R;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,h=-e.y*e.y,u=-e.z*e.z,b=-e.x*e.y,A=-e.x*e.z,m=-e.y*e.z,p=o.x*o.x,D=o.y*o.y,_=o.z*o.z,v=o.x*o.y,U=o.x*o.z,y=o.y*o.z,S=-l.x*l.x,F=-l.y*l.y,k=-l.z*l.z,x=-l.x*l.y,w=-l.x*l.z,R=-l.y*l.z,a[0]=f+p+S,a[1]=b+v+x,a[2]=A+U+w,a[4]=a[1],a[5]=h+D+F,a[6]=m+y+R,a[8]=a[2],a[9]=a[6],a[10]=u+_+k,a[3]=0,a[7]=0,a[11]=0,a[15]=1}else{let o,l,c,f,h,u=i.dotProduct(i),b=(1-s)/u;o=b*i.x,l=b*i.z,c=o*i.y,f=o*i.z,h=l*i.y,a[0]=s+o*i.x,a[1]=c-i.z,a[2]=f+i.y,a[4]=c+i.z,a[5]=s+b*i.y*i.y,a[6]=h-i.x,a[8]=f-i.y,a[9]=h+i.x,a[10]=s+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],s=t[12],o=t[1],l=t[5],c=t[9],f=t[13],h=t[2],u=t[6],b=t[10],A=t[14],m=t[3],p=t[7],D=t[11],_=t[15];t[0]=a*e.rawData[0]+o*e.rawData[4]+h*e.rawData[8]+m*e.rawData[12],t[1]=a*e.rawData[1]+o*e.rawData[5]+h*e.rawData[9]+m*e.rawData[13],t[2]=a*e.rawData[2]+o*e.rawData[6]+h*e.rawData[10]+m*e.rawData[14],t[3]=a*e.rawData[3]+o*e.rawData[7]+h*e.rawData[11]+m*e.rawData[15],t[4]=r*e.rawData[0]+l*e.rawData[4]+u*e.rawData[8]+p*e.rawData[12],t[5]=r*e.rawData[1]+l*e.rawData[5]+u*e.rawData[9]+p*e.rawData[13],t[6]=r*e.rawData[2]+l*e.rawData[6]+u*e.rawData[10]+p*e.rawData[14],t[7]=r*e.rawData[3]+l*e.rawData[7]+u*e.rawData[11]+p*e.rawData[15],t[8]=i*e.rawData[0]+c*e.rawData[4]+b*e.rawData[8]+D*e.rawData[12],t[9]=i*e.rawData[1]+c*e.rawData[5]+b*e.rawData[9]+D*e.rawData[13],t[10]=i*e.rawData[2]+c*e.rawData[6]+b*e.rawData[10]+D*e.rawData[14],t[11]=i*e.rawData[3]+c*e.rawData[7]+b*e.rawData[11]+D*e.rawData[15],t[12]=s*e.rawData[0]+f*e.rawData[4]+A*e.rawData[8]+_*e.rawData[12],t[13]=s*e.rawData[1]+f*e.rawData[5]+A*e.rawData[9]+_*e.rawData[13],t[14]=s*e.rawData[2]+f*e.rawData[6]+A*e.rawData[10]+_*e.rawData[14],t[15]=s*e.rawData[3]+f*e.rawData[7]+A*e.rawData[11]+_*e.rawData[15]}add(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],s=t[12],o=t[1],l=t[5],c=t[9],f=t[13],h=t[2],u=t[6],b=t[10],A=t[14],m=t[3],p=t[7],D=t[11],_=t[15],v=e.rawData[0],U=e.rawData[4],y=e.rawData[8],S=e.rawData[12],F=e.rawData[1],k=e.rawData[5],x=e.rawData[9],w=e.rawData[13],R=e.rawData[2],Q=e.rawData[6],M=e.rawData[10],j=e.rawData[14],he=e.rawData[3],ae=e.rawData[7],P=e.rawData[11],z=e.rawData[15];return t[0]=a+v,t[1]=o+F,t[2]=h+R,t[3]=m+he,t[4]=r+U,t[5]=l+k,t[6]=u+Q,t[7]=p+ae,t[8]=i+y,t[9]=c+x,t[10]=b+M,t[11]=D+P,t[12]=s+S,t[13]=f+w,t[14]=A+j,t[15]=_+z,this}sub(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],s=t[12],o=t[1],l=t[5],c=t[9],f=t[13],h=t[2],u=t[6],b=t[10],A=t[14],m=t[3],p=t[7],D=t[11],_=t[15],v=e.rawData[0],U=e.rawData[4],y=e.rawData[8],S=e.rawData[12],F=e.rawData[1],k=e.rawData[5],x=e.rawData[9],w=e.rawData[13],R=e.rawData[2],Q=e.rawData[6],M=e.rawData[10],j=e.rawData[14],he=e.rawData[3],ae=e.rawData[7],P=e.rawData[11],z=e.rawData[15];return t[0]=a-v,t[1]=o-F,t[2]=h-R,t[3]=m-he,t[4]=r-U,t[5]=l-k,t[6]=u-Q,t[7]=p-ae,t[8]=i-y,t[9]=c-x,t[10]=b-M,t[11]=D-P,t[12]=s-S,t[13]=f-w,t[14]=A-j,t[15]=_-z,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=T.getAxisRotation(t.x,t.y,t.z,e);this.append(a)}createByRotation(e,t){let a=T.helpMatrix,r,i,s=e*pt;return r=Math.sin(s),i=Math.cos(s),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){T.helpMatrix.createByScale(e,t,a),this.append(T.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 T;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(T._zero,e,T._one),this}static decomposeRawData=new Float64Array(16).fill(0);decompose(e="eulerAngles",t){let a=ne.CALCULATION_QUATERNION,r=t||T._prs;this.copyRawDataTo(T.decomposeRawData);let i=T.decomposeRawData,s=r[0];s.x=i[12],s.y=i[13],s.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 sa.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 sa.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 sa.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]=s,r[1]=l,r[2]=o,r}static getEuler(e,t,a=!0,r){return e||=new g,T._getEulerMatrix.makeRotationFromQuaternion(t).makeEuler(e,a,r),e}compose(e,t,a){const r=this.rawData,i=t.x,s=t.y,o=t.z,l=t.w,c=i+i,f=s+s,h=o+o,u=i*c,b=i*f,A=i*h,m=s*f,p=s*h,D=o*h,_=l*c,v=l*f,U=l*h,y=a.x,S=a.y,F=a.z;return r[0]=(1-(m+D))*y,r[1]=(b+U)*y,r[2]=(A-v)*y,r[3]=0,r[4]=(b-U)*S,r[5]=(1-(u+D))*S,r[6]=(p+_)*S,r[7]=0,r[8]=(A+v)*F,r[9]=(p-_)*F,r[10]=(1-(u+m))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}deltaTransformVector(e,t){t||=new g;let a=this.rawData,r=e.x,i=e.y,s=e.z;return t.x=r*a[0]+i*a[4]+s*a[8],t.y=r*a[1]+i*a[5]+s*a[9],t.z=r*a[2]+i*a[6]+s*a[10],t.w=r*a[3]+i*a[7]+s*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],s=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],h=e[0]*t+e[4]*i+e[8]*l;if(Math.abs(h)>1e-11){let u=1/h;e[0]=u*t,e[4]=u*a,e[8]=u*r,e[1]=u*i,e[5]=u*s,e[9]=u*o,e[2]=u*l,e[6]=u*c,e[10]=u*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],s=a[8],o=a[12],l=a[1],c=a[5],f=a[9],h=a[13],u=a[2],b=a[6],A=a[10],m=a[14],p=a[3],D=a[7],_=a[11],v=a[15];a[0]=e*(c*(A*v-m*_)-f*(b*v-m*D)+h*(b*_-A*D)),a[1]=-e*(l*(A*v-m*_)-f*(u*v-m*p)+h*(u*_-A*p)),a[2]=e*(l*(b*v-m*D)-c*(u*v-m*p)+h*(u*D-b*p)),a[3]=-e*(l*(b*_-A*D)-c*(u*_-A*p)+f*(u*D-b*p)),a[4]=-e*(i*(A*v-m*_)-s*(b*v-m*D)+o*(b*_-A*D)),a[5]=e*(r*(A*v-m*_)-s*(u*v-m*p)+o*(u*_-A*p)),a[6]=-e*(r*(b*v-m*D)-i*(u*v-m*p)+o*(u*D-b*p)),a[7]=e*(r*(b*_-A*D)-i*(u*_-A*p)+s*(u*D-b*p)),a[8]=e*(i*(f*v-h*_)-s*(c*v-h*D)+o*(c*_-f*D)),a[9]=-e*(r*(f*v-h*_)-s*(l*v-h*p)+o*(l*_-f*p)),a[10]=e*(r*(c*v-h*D)-i*(l*v-h*p)+o*(l*D-c*p)),a[11]=-e*(r*(c*_-f*D)-i*(l*_-f*p)+s*(l*D-c*p)),a[12]=-e*(i*(f*m-h*A)-s*(c*m-h*b)+o*(c*A-f*b)),a[13]=e*(r*(f*m-h*A)-s*(l*m-h*u)+o*(l*A-f*u)),a[14]=-e*(r*(c*m-h*b)-i*(l*m-h*u)+o*(l*b-c*u)),a[15]=e*(r*(c*A-f*b)-i*(l*A-f*u)+s*(l*b-c*u))}return t}transformPoint(e,t){let a=this.rawData;t||=new g;let r=e.x,i=e.y,s=e.z;return t.x=r*a[0]+i*a[4]+s*a[8]+a[12],t.y=r*a[1]+i*a[5]+s*a[9]+a[13],t.z=r*a[2]+i*a[6]+s*a[10]+a[14],t}transformVector(e,t){let a=this.rawData;t||=new g;let r=e.x,i=e.y,s=e.z;return t.x=r*a[0]+i*a[4]+s*a[8],t.y=r*a[1]+i*a[5]+s*a[9],t.z=r*a[2]+i*a[6]+s*a[10],t}transpose(){let e=this.rawData;for(let t=0;t<T.helpMatrix.rawData.length;t++)T.helpMatrix.rawData[t]=e[t];e[1]=T.helpMatrix.rawData[4],e[2]=T.helpMatrix.rawData[8],e[3]=T.helpMatrix.rawData[12],e[4]=T.helpMatrix.rawData[1],e[6]=T.helpMatrix.rawData[9],e[7]=T.helpMatrix.rawData[13],e[8]=T.helpMatrix.rawData[2],e[9]=T.helpMatrix.rawData[6],e[11]=T.helpMatrix.rawData[14],e[12]=T.helpMatrix.rawData[3],e[13]=T.helpMatrix.rawData[7],e[14]=T.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 g;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 g(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(),ne.quaternionToMatrix(t,this),this.translate(new g(-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,s=e.x,o=e.y,l=e.z,c=i*s,f=i*o;return this.setElements(c*s+a,c*o-r*l,c*l+r*o,0,c*o+r*l,f*o+a,f*l-r*s,0,c*l-r*o,f*l+r*s,i*l*l+a,0,0,0,0,1),this}static transpose(e,t){t||=new T;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 T;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 s=0;s<16;s++)r[s]/=i;return t}makeEuler(e,t,a="XYZ"){const r=this.rawData,i=r[0],s=r[4],o=r[8],l=r[1],c=r[5],f=r[9],h=r[2],u=r[6],b=r[10];switch(a){case"XYZ":e.y=Math.asin(_e(o,-1,1)),Math.abs(o)<.9999999?(e.x=Math.atan2(-f,b),e.z=Math.atan2(-s,i)):(e.x=Math.atan2(u,c),e.z=0);break;case"YXZ":e.x=Math.asin(-_e(f,-1,1)),Math.abs(f)<.9999999?(e.y=Math.atan2(o,b),e.z=Math.atan2(l,c)):(e.y=Math.atan2(-h,i),e.z=0);break;case"ZXY":e.x=Math.asin(_e(u,-1,1)),Math.abs(u)<.9999999?(e.y=Math.atan2(-h,b),e.z=Math.atan2(-s,c)):(e.y=0,e.z=Math.atan2(l,i));break;case"ZYX":e.y=Math.asin(-_e(h,-1,1)),Math.abs(h)<.9999999?(e.x=Math.atan2(u,b),e.z=Math.atan2(l,i)):(e.x=0,e.z=Math.atan2(-s,c));break;case"YZX":e.z=Math.asin(_e(l,-1,1)),Math.abs(l)<.9999999?(e.x=Math.atan2(-f,c),e.y=Math.atan2(-h,i)):(e.x=0,e.y=Math.atan2(o,b));break;case"XZY":e.z=Math.asin(-_e(s,-1,1)),Math.abs(s)<.9999999?(e.x=Math.atan2(u,c),e.y=Math.atan2(o,i)):(e.x=Math.atan2(-f,b),e.y=0);break}return t&&e.multiplyScalar(Yr),e}setElements(e,t,a,r,i,s,o,l,c,f,h,u,b,A,m,p){const D=this.rawData;return D[0]=e,D[4]=t,D[8]=a,D[12]=r,D[1]=i,D[5]=s,D[9]=o,D[13]=l,D[2]=c,D[6]=f,D[10]=h,D[14]=u,D[3]=b,D[7]=A,D[11]=m,D[15]=p,this}makeMatrix44ByQuaternion(e,t,a){this.identity(),ne.quaternionToMatrix(a,this),this.appendTranslation(e.x,e.y,e.z),this.appendScale(t.x,t.y,t.z)}}function Dc(n,e,t){for(let a=0;a<4;a++)t.rawData[a]=n.rawData[a]*e.rawData[0]+n.rawData[a+4]*e.rawData[1]+n.rawData[a+8]*e.rawData[2]+n.rawData[a+12]*e.rawData[3],t.rawData[a+4]=n.rawData[a]*e.rawData[4]+n.rawData[a+4]*e.rawData[5]+n.rawData[a+8]*e.rawData[6]+n.rawData[a+12]*e.rawData[7],t.rawData[a+8]=n.rawData[a]*e.rawData[8]+n.rawData[a+4]*e.rawData[9]+n.rawData[a+8]*e.rawData[10]+n.rawData[a+12]*e.rawData[11],t.rawData[a+12]=n.rawData[a]*e.rawData[12]+n.rawData[a+4]*e.rawData[13]+n.rawData[a+8]*e.rawData[14]+n.rawData[a+12]*e.rawData[15]}function ds(n,e,t,a){let r=a.rawData,i=n.x*pt,s=n.y*pt,o=n.z*pt,l=0,c=i*.5,f=s*.5,h=o*.5,u=Math.cos(c),b=Math.sin(c),A=Math.cos(f),m=Math.sin(f),p=Math.cos(h),D=Math.sin(h);l=u*A*p+b*m*D,i=b*A*p-u*m*D,s=u*m*p+b*A*D,o=u*A*D-b*m*p;let _=i+i,v=s+s,U=o+o,y=i*_,S=i*v,F=i*U,k=s*v,x=s*U,w=o*U,R=l*_,Q=l*v,M=l*U,j=t.x,he=t.y,ae=t.z;r[0]=(1-(k+w))*j,r[1]=(S+M)*j,r[2]=(F-Q)*j,r[3]=0,r[4]=(S-M)*he,r[5]=(1-(y+w))*he,r[6]=(x+R)*he,r[7]=0,r[8]=(F+Q)*ae,r[9]=(x-R)*ae,r[10]=(1-(y+k))*ae,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1}function _c(n,e,t){let a=n.rawData,r=t.rawData,i=a[0],s=a[4],o=a[8],l=a[12],c=a[1],f=a[5],h=a[9],u=a[13],b=a[2],A=a[6],m=a[10],p=a[14],D=a[3],_=a[7],v=a[11],U=a[15];r[0]=i*e.rawData[0]+c*e.rawData[4]+b*e.rawData[8]+D*e.rawData[12],r[1]=i*e.rawData[1]+c*e.rawData[5]+b*e.rawData[9]+D*e.rawData[13],r[2]=i*e.rawData[2]+c*e.rawData[6]+b*e.rawData[10]+D*e.rawData[14],r[3]=i*e.rawData[3]+c*e.rawData[7]+b*e.rawData[11]+D*e.rawData[15],r[4]=s*e.rawData[0]+f*e.rawData[4]+A*e.rawData[8]+_*e.rawData[12],r[5]=s*e.rawData[1]+f*e.rawData[5]+A*e.rawData[9]+_*e.rawData[13],r[6]=s*e.rawData[2]+f*e.rawData[6]+A*e.rawData[10]+_*e.rawData[14],r[7]=s*e.rawData[3]+f*e.rawData[7]+A*e.rawData[11]+_*e.rawData[15],r[8]=o*e.rawData[0]+h*e.rawData[4]+m*e.rawData[8]+v*e.rawData[12],r[9]=o*e.rawData[1]+h*e.rawData[5]+m*e.rawData[9]+v*e.rawData[13],r[10]=o*e.rawData[2]+h*e.rawData[6]+m*e.rawData[10]+v*e.rawData[14],r[11]=o*e.rawData[3]+h*e.rawData[7]+m*e.rawData[11]+v*e.rawData[15],r[12]=l*e.rawData[0]+u*e.rawData[4]+p*e.rawData[8]+U*e.rawData[12],r[13]=l*e.rawData[1]+u*e.rawData[5]+p*e.rawData[9]+U*e.rawData[13],r[14]=l*e.rawData[2]+u*e.rawData[6]+p*e.rawData[10]+U*e.rawData[14],r[15]=l*e.rawData[3]+u*e.rawData[7]+p*e.rawData[11]+U*e.rawData[15]}function e2(n,e){let t=e.x,a=e.y,r=e.z,i=e.w,s=n.rawData,o=2*t*a,l=2*t*r,c=2*t*i,f=2*a*r,h=2*a*i,u=2*r*i,b=t*t,A=a*a,m=r*r,p=i*i;return s[0]=b-A-m+p,s[4]=o-u,s[8]=l+h,s[12]=0,s[1]=o+u,s[5]=-b+A-m+p,s[9]=f-c,s[13]=0,s[2]=l-h,s[6]=f+c,s[10]=-b-A+m+p,s[14]=0,s[3]=0,s[7]=0,s[11]=0,s[15]=1,n}function t2(n,e){let t=e.rawData,a=Math.sin(n),r=Math.cos(n);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 a2(n,e,t){let a=e.x,r=e.y,i=e.z,s=Math.hypot(a,r,i),o,l,c,f,h,u,b,A,m,p,D,_;if(s<$u)return null;s=1/s,a*=s,r*=s,i*=s,o=Math.sin(n),l=Math.cos(n),c=1-l,f=a*a*c+l,h=r*a*c+i*o,u=i*a*c-r*o,b=a*r*c-i*o,A=r*r*c+l,m=i*r*c+a*o,p=a*i*c+r*o,D=r*i*c-a*o,_=i*i*c+l;let v=t.rawData;return v[0]=f,v[1]=h,v[2]=u,v[3]=0,v[4]=b,v[5]=A,v[6]=m,v[7]=0,v[8]=p,v[9]=D,v[10]=_,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,v}function mn(n,e,t){let a=n.rawData,r=a[0],i=a[1],s=a[2],o=a[3],l=a[4],c=a[5],f=a[6],h=a[7],u=a[8],b=a[9],A=a[10],m=a[11],p=a[12],D=a[13],_=a[14],v=a[15],U=e.rawData,y=t.rawData,S=U[0],F=U[1],k=U[2],x=U[3];return y[0]=S*r+F*l+k*u+x*p,y[1]=S*i+F*c+k*b+x*D,y[2]=S*s+F*f+k*A+x*_,y[3]=S*o+F*h+k*m+x*v,S=U[4],F=U[5],k=U[6],x=U[7],y[4]=S*r+F*l+k*u+x*p,y[5]=S*i+F*c+k*b+x*D,y[6]=S*s+F*f+k*A+x*_,y[7]=S*o+F*h+k*m+x*v,S=U[8],F=U[9],k=U[10],x=U[11],y[8]=S*r+F*l+k*u+x*p,y[9]=S*i+F*c+k*b+x*D,y[10]=S*s+F*f+k*A+x*_,y[11]=S*o+F*h+k*m+x*v,S=U[12],F=U[13],k=U[14],x=U[15],y[12]=S*r+F*l+k*u+x*p,y[13]=S*i+F*c+k*b+x*D,y[14]=S*s+F*f+k*A+x*_,y[15]=S*o+F*h+k*m+x*v,y}var ft=(n=>(n[n.None=0]="None",n[n.PointLight=1]="PointLight",n[n.DirectionLight=2]="DirectionLight",n[n.SpotLight=3]="SpotLight",n[n.SkyLight=4]="SkyLight",n))(ft||{});class hs extends gi{static lightSize=24;index=-1;lightType=-1;radius=.001;linear=8;lightPosition=new g;lightMatrixIndex=-1;direction=new g;quadratic=.032;lightColor=new Z(1,1,1,1);intensity=1;innerAngle=0;outerAngle=1;range=100;castShadowIndex=-1;lightTangent=g.FORWARD;iesIndex=-1}class Ne{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=Ne.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 $e{object3D=null;_eventDispatcher;get eventDispatcher(){return this._eventDispatcher||=new ja,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?Ne.bindUpdate(this.transform.view3D,this,e):Ne.unBindUpdate(this.transform.view3D,this)}_onLateUpdate(e){e!=null?Ne.bindLateUpdate(this.transform.view3D,this,e):Ne.unBindLateUpdate(this.transform.view3D,this)}_onBeforeUpdate(e){e!=null?Ne.bindBeforeUpdate(this.transform.view3D,this,e):Ne.unBindBeforeUpdate(this.transform.view3D,this)}_onCompute(e){e!=null?Ne.bindCompute(this.transform.view3D,this,e):Ne.unBindCompute(this.transform.view3D,this)}_onGraphic(e){e!=null?Ne.bindGraphic(this.transform.view3D,this,e):Ne.unBindGraphic(this.transform.view3D,this)}beforeDestroy(e){Ne.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 us{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 na{origin=new g;length=Number.MAX_VALUE;static _rayl=1e9;static _smallnum=1e-8;_vector=new g;_dir=new g;constructor(e,t){this.origin.copyFrom(e||new g),this._dir.copyFrom(t||new g),this._dir.normalize()}get direction(){return this._dir}set direction(e){this._dir.copyFrom(e),this._dir.normalize()}clone(){return new na(this.origin,this.direction)}intersectBox(e,t){let a=this.direction,r=this.origin,i,s,o,l,c,f;const h=1/a.x,u=1/a.y,b=1/a.z,A=e.min,m=e.max;return i=((h>=0?A.x:m.x)-r.x)*h,s=((h>=0?m.x:A.x)-r.x)*h,o=((u>=0?A.y:m.y)-r.y)*u,l=((u>=0?m.y:A.y)-r.y)*u,i>l||o>s||(o>i&&(i=o),l<s&&(s=l),c=((b>=0?A.z:m.z)-r.z)*b,f=((b>=0?m.z:A.z)-r.z)*b,i>f||c>s)||(c>i&&(i=c),f<s&&(s=f),s<0)?null:(t||=new g,this.pointAt(i>=0?i:s,t))}pointAt(e,t){return t||=new g,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),s=r/i,o=this.getPoint(s);return bn(e.subtract(o))}applyMatrix(e){this.origin=e.transformPoint(this.origin),this._dir=e.transformVector(this._dir)}_v0=new g;_v1=new g;_v2=new g;pointInTriangle(e,t,a,r){let i=this._v0,s=this._v1,o=this._v2;r.subtract(t,i),a.subtract(t,s),e.subtract(t,o);let l=g.dot(i,i),c=g.dot(i,s),f=g.dot(i,o),h=g.dot(s,s),u=g.dot(s,o),b=1/(l*h-c*c),A=(h*f-c*u)*b,m=(l*u-c*f)*b;return A>=0&&m>=0&&A+m<1}_E1=new g;_E2=new g;_P=new g;_T=new g;_Q=new g;intersectTriangle(e,t,a){let r=a.v1,i=a.v2,s=a.v3;i.subtract(r,this._E1),s.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 g;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),s=g.dot(t,t),o=2*g.dot(i,t),l=g.dot(i,i)-r*r,c=o*o-4*s*l,f=g.HELP_3;if(c<0)return null;{let h=(-o-Math.sqrt(c))/(s*2);return h<0?null:(f.x=e.x+h*t.x,f.y=e.y+h*t.y,f.z=e.z+h*t.z,f)}}intersectionSegment(e,t,a){const r=this.origin,i=g.HELP_0,s=g.HELP_1,o=g.HELP_2,l=g.HELP_3;t.subtract(e,i),this._dir.scaleToRef(na._rayl,o),r.add(o,s),e.subtract(r,l);var c=g.dot(i,i),f=g.dot(i,o),h=g.dot(o,o),u=g.dot(i,l),b=g.dot(o,l),A=c*h-f*f,m,p,D=A,_,v,U=A;A<na._smallnum?(p=0,D=1,v=b,U=h):(p=f*b-h*u,v=c*b-f*u,p<0?(p=0,v=b,U=h):p>D&&(p=D,v=b+f,U=h)),v<0?(v=0,-u<0?p=0:-u>c?p=D:(p=-u,D=c)):v>U&&(v=U,-u+f<0?p=0:-u+f>c?p=D:(p=-u+f,D=c)),m=Math.abs(p)<na._smallnum?0:p/D,_=Math.abs(v)<na._smallnum?0:v/U;const y=g.HELP_4;o.scaleToRef(_,y);const S=g.HELP_5;i.scaleToRef(m,S),S.add(l,S);const F=g.HELP_6;S.subtract(y,F);var k=_>0&&_<=this._dir.length&&F.lengthSquared<a*a;if(k){let x=new g;return x.copyFrom(t.subtract(e)),x.scaleBy(m),x.add(e,x),{out:x,length:S.length}}return{out:null,length:-1}}get_vec(e,t){let a=g.HELP_1;return a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}}class Ai{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,s){return!(e<a||e>i||t<r||t>s)}clone(){return new Ai(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,s=e.x,o=e.y,l=e.x+e.width,c=e.y+e.height;return Math.max(t,s)<=Math.min(r,l)&&Math.max(a,o)<=Math.min(i,c)}innerArea(e,t){t=t||new Ai;var a=this.x,r=this.y,i=this.x+this.width,s=this.y+this.height,o=e.x,l=e.y,c=e.x+e.width,f=e.y+e.height,h=Math.max(r,l),u=Math.min(s,f),b=Math.max(a,o),A=Math.min(c,i);return h>=0&&u>=0&&u-h>=0&&A-b>0?(t.x=b,t.y=h,t.width=A-b,t.height=u-h):(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 g(1,1,1).multiplyScalar(Number.MAX_VALUE*.1);static minVector3=new g(1,1,1).multiplyScalar(-Number.MAX_VALUE*.1);constructor(e,t){e||=g.ZERO.clone(),t||=g.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 g,this.max||=new g,this.size||=new g,this.center||=new g,this.extents||=new g,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 g,new g),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 pn{planes;corners;boundingBox=new Ce;constructor(){this.planes=[],this.corners=[];for(var e=0;e<6;e++)this.planes[e]=new g;for(var e=0;e<8;e++)this.corners[e]=new g}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 s=0;s<2;++s)for(let o=0;o<2;++o){let l=this.corners[r];r++,l.set(2*i-1,2*s-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 s=this.corners[t];s.set(2*a-1,2*r-1,i,1),e.transformVector4(s,s),s.div(s.w,s),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,s=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<=-s)return 0;r>s&&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,s=e.center.x,o=e.center.y,l=e.center.z;for(let c of this.planes){if(a=c.x*s+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 g(e.min.x,e.min.y,e.min.z),new g(e.max.x,e.min.y,e.min.z),new g(e.min.x,e.max.y,e.min.z),new g(e.max.x,e.max.y,e.min.z),new g(e.min.x,e.min.y,e.max.z),new g(e.max.x,e.min.y,e.max.z),new g(e.min.x,e.max.y,e.max.z),new g(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 s=-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;s=Math.max(s,f),o=Math.min(o,f)}if(s<0)return 0;o>0&&a++}return a===6?2:1}}var st=(n=>(n[n.ortho=0]="ortho",n[n.perspective=1]="perspective",n[n.shadow=2]="shadow",n))(st||{});class r2{corners;index;constructor(e){this.index=e,this.corners=[];for(let t=0;t<4;t++)this.corners.push(new g)}}class i2{bound;twoSections;name;color;shadowCamera;index;constructor(e,t,a){this.bound=new Ce,this.shadowCamera=ht.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 Z(1,0,0,1):a==1?this.color=new Z(0,1,0,1):a==2?this.color=new Z(0,0,1,1):a==3&&(this.color=new Z(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 Bc{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 i2(this.sections[a],this.sections[a+1],a))}update(e,t,a,r,i){let s=this.sections.length-1;for(let o=0;o<=s;++o){let l=this.sections[o],c=0,f=this.logSplit(a,r,o,this.sections.length);{let u=(f-a)/r;u=u**i.csmScatteringExp,f=(r-a)*u+a}f*=i.csmAreaScale;let h=(e.rawData[10]*f+e.rawData[14])/f;for(let u=0;u<2;++u)for(let b=0;b<2;++b){let A=l.corners[c];c++,A.set(2*u-1,2*b-1,h,1),t.transformVector4(A,A),A.div(A.w,A)}}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 Hr extends $e{fov=60;name;aspect=1;near=1;far=5e3;left=-100;right=100;top=100;bottom=-100;frustumSize=100;viewPort=new Ai;frustum;sh=new Float32Array(36);isShadowCamera=!1;_projectionMatrixInv=new T;_projectionMatrix=new T;_viewMatrix=new T;_viewMatrixInv=new T;_unprojection=new T;_pvMatrixInv=new T;_pvMatrix=new T;_halfw;_halfh;_ray;_enableCSM=!1;mainCamera;get projectionMatrix(){return this._projectionMatrix}lookTarget;type=st.perspective;csm;cubeShadowCameras=[];get enableCSM(){return this._enableCSM}set enableCSM(e){e&&!this.csm&&(this.csm=new Bc(ia.Cascades)),this._enableCSM=e}constructor(){super()}init(){super.init(),this._ray=new na,this.frustum=new pn,this.lookTarget=new g(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(nr.RESIZE,this.updateProjection,this)}updateProjection(){this.aspect=I.aspect,this.type==st.perspective?this.perspective(this.fov,this.aspect,this.near,this.far):this.type==st.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-B.setting.shadow.shadowBias*.01}getShadowWorldExtents(){let e=B.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=st.perspective}ortho(e,t,a){this.frustumSize=e;let r=e*.5*this.aspect,i=e*.5,s=-r/2,o=r/2,l=i/2,c=-i/2;this.orthoOffCenter(s,o,c,l,t,a)}orthoOffCenter(e,t,a,r,i,s){this.near=i,this.far=s,this.left=e,this.right=t,this.top=r,this.bottom=a,this.type=st.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 g(0,0,0,1)),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5,Ot.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 g),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 mn(this._projectionMatrix,this.viewMatrix,this._pvMatrix),this._pvMatrix}get pvMatrix2(){mn(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=T.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e.multiply(this.vMatrixInv),e}get ndcToView(){let e=T.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 g),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(),Ot.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=ht.UnProjection(e,t,.01,this),i=ht.UnProjection(e,t,1,this);return i=i.subtract(r).normalize(),a.origin.copyFrom(r),a.direction=i,a}screenPointToWorld(e,t,a){return ht.UnProjection(e,t,a,this)}worldToScreenPoint(e,t){return ht.Projection(e,this,t)}lookAt(e,t,a=g.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=B.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 us,this._jitterOffsetList=[];for(let t=0;t<32;t++){let a=this.generateRandomOffset();this._jitterOffsetList.push(a)}this._jitterOffsetList.reverse()}generateRandomOffset(){let e=new fe(us.get((this._sampleIndex&1023)+1,2)-.5,us.get((this._sampleIndex&1023)+1,3)-.5);return++this._sampleIndex>=32&&(this._sampleIndex=0),e}getJitteredProjectionMatrix(){let e=B.setting.render.postProcessing.taa,t=this._projectionMatrix,a=e.temporalJitterScale,r=this._jitterFrameIndex%e.jitterSeedCount,i=this._jitterOffsetList[r].x*a,s=this._jitterOffsetList[r].y*a,o=t.get(0,2),l=t.get(1,2);this._jitterX=i/this.viewPort.width,this._jitterY=s/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 g;const t=this.transform._worldMatrix.rawData;return e.set(-t[8],-t[9],-t[10]).normalize()}}class zt extends $e{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 bt(zt.POSITION_ONCHANGE);eventRotationChange=new bt(zt.ROTATION_ONCHANGE);eventScaleChange=new bt(zt.SCALE_ONCHANGE);eventLocalChange=new bt(zt.LOCAL_ONCHANGE);onPositionChange;onRotationChange;onScaleChange;_scene3d;_parent;_localPos;_localRot;_localRotQuat;_localScale;_localDetailPos;_localDetailRot;_localDetailScale;index;index2;_forward=new g;_back=new g;_right=new g;_left=new g;_up=new g;_down=new g;_worldMatrix;_targetPos;static=!1;depthOrder=0;get localChange(){return Ee.matrixStateBuffer[this.index2]!=0}set localChange(e){Ee.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,Ee.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=>{Ne.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 T(!0),this.index=this._worldMatrix.index,this.index2=this._worldMatrix.index*Ee.stateStruct,this._localPos=new g,this._localRot=new g,this._localRotQuat=new ne,this._localScale=new g(1,1,1),Ee.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),Ee.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),Ee.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(g.UP,this._up),this._up}set up(e){this._up.copyFrom(e),Ot.fromToRotation(g.UP,this._up,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0}get down(){return this.worldMatrix.transformVector(g.DOWN,this._down),this._down}set down(e){this._down.copyFrom(e),Ot.fromToRotation(g.DOWN,this._down,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get forward(){return this.worldMatrix.transformVector(g.FORWARD,this._forward),this._forward}set forward(e){this._forward.copyFrom(e),Ot.fromToRotation(g.FORWARD,this._forward,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get back(){return this.worldMatrix.transformVector(g.BACK,this._back),this._back}set back(e){this._back.copyFrom(e),Ot.fromToRotation(g.BACK,this._back,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0}get left(){return this.worldMatrix.transformVector(g.neg_X_AXIS,this._left),this._left}set left(e){this._left.copyFrom(e),Ot.fromToRotation(g.LEFT,this._left,ne.HELP_0),this.transform.localRotQuat=ne.HELP_0}get right(){return this.worldMatrix.transformVector(g.X_AXIS,this._right),this._right}set right(e){this._right.copyFrom(e),Ot.fromToRotation(g.RIGHT,this._right,ne.HELP_0),this.transform.localRotQuat=ne.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),Ee.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?(ds(this._localRot,this._localPos,this._localScale,this._worldMatrix),_c(this._worldMatrix,this.parent.worldMatrix,this._worldMatrix)):ds(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=g.UP){this.lookAt(this.transform.worldPosition,e,t)}lookAt(e,t,a=g.UP){this._targetPos||=new g,this._targetPos.copyFrom(t),this.localPosition=e,T.helpMatrix.lookAt(e,t,a),T.helpMatrix.invert();var r=T.helpMatrix.decompose(sa.QUATERNION);this.localRotQuat=ne.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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,Ee.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),Ee.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),Ee.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){Ee.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,Ee.setContinueScale(this.index,e.x,e.y,e.z)}get localDetailRot(){return this._localDetailRot}set localDetailRot(e){this._localDetailRot=e,Ee.setContinueRotation(this.index,e.x,e.y,e.z)}get localDetailPos(){return this._localDetailPos}set localDetailPos(e){this._localDetailPos=e,Ee.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=(n=>(n.position="position",n.normal="normal",n.uv="uv",n.TANGENT="TANGENT",n.TEXCOORD_1="TEXCOORD_1",n.TEXCOORD_2="TEXCOORD_2",n.TEXCOORD_3="TEXCOORD_3",n.TEXCOORD_4="TEXCOORD_4",n.TEXCOORD_5="TEXCOORD_5",n.TEXCOORD_6="TEXCOORD_6",n.TEXCOORD_7="TEXCOORD_7",n.color="color",n.joints0="joints0",n.joints1="joints1",n.weights0="weights0",n.weights1="weights1",n.weight="weight",n.indices="indices",n.vIndex="vIndex",n.a_morphPositions_0="a_morphPositions_0",n.all="all",n))(G||{}),Ae=(n=>(n[n.NONE=0]="NONE",n[n.ABOVE=1]="ABOVE",n[n.ALPHA=2]="ALPHA",n[n.NORMAL=3]="NORMAL",n[n.ADD=4]="ADD",n[n.BELOW=5]="BELOW",n[n.ERASE=6]="ERASE",n[n.MUL=7]="MUL",n[n.SCREEN=8]="SCREEN",n[n.DIVD=9]="DIVD",n[n.SOFT_ADD=10]="SOFT_ADD",n))(Ae||{}),vc=(n=>(n[n.src_a=0]="src_a",n[n.dest_a=1]="dest_a",n))(vc||{});class Uc{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 pa{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 Fe extends Ge{constructor(){super()}static parse(e){let t=new Array,a=new Array,r=0;for(;e.peekToken(0).Type!=C.EOF;){let i=e.peekToken(0);if(i.Type==C.SEMICOLON||i.Type==C.RIGHTMEDI||i.Type==C.COMMA||i.Type==C.COLON||i.Type==C.RIGHTBIG)break;if(i.isOperation()){if(i.isOperation()){if(i.Type==C.INC||i.Type==C.DEC){let s=i;e.skipToken(1);let o=Fe.parse(e);a.push(new qr(s,void 0,o));continue}else if(t.length>0){if(t[t.length-1].nOperationPriorityLevel<=i.nOperationPriorityLevel)Fe.unionOperation(t,a);else if(t.length>0&&t[t.length-1].Literal=="-"){let o=t.pop(),l=a.pop();a.push(new qr(o,void 0,l))}}t.push(i),e.skipToken(1)}}else if(i.Type==C.LITERAL){a.push(new Ha(i.Literal)),e.skipToken(1);continue}else if(i.Type==C.LEFTSAMLL){r++,t.push(i),e.skipToken(1);continue}else if(i.Type==C.RIGHTSAMLL){if(r<=0)break;for(r--;Fe.unionOperation(t,a););if(t[t.length-1].Type==C.LEFTSAMLL){t.pop();let s=new Fc;s.addNode(a.pop()),a.push(s)}e.skipToken(1);continue}else if(i.Type==C.IDENT){if(e.peekToken(1).Type==C.INC||e.peekToken(1).Type==C.DEC){let s=e.peekToken(1),o=new Xa(i.Literal);a.push(new qr(s,o,void 0)),e.skipToken(2);continue}else if(e.peekToken(1).Type==C.LEFTSAMLL){a.push(Fr.parse(e));continue}else if(e.peekToken(1).Type==C.DOT){a.push(vi.parse(e));continue}else if(e.peekToken(1).Type==C.LEFTMEDI){a.push(Rr.parse(e));continue}a.push(new Xa(i.Literal)),e.skipToken(1);continue}else{if(i.isBuiltinType()&&e.peekToken(1).Type==C.LEFTSAMLL){a.push(Fr.parse(e));continue}if(i.isAssignOperation()){let s=i;e.skipToken(1);let o=a.pop(),l=Fe.parse(e);a.push(new hr(s,o,l));continue}if(i.Type==C.LEFTBIG&&(e.peekToken(1).Type==C.LITERAL||e.peekToken(1).Type==C.SUB&&e.peekToken(2).Type==C.LITERAL)){a.push(_i.parse(e));continue}if(i.Type==C.QUEMARK){t.length>0&&t[t.length-1].nOperationPriorityLevel<=i.nOperationPriorityLevel&&Fe.unionOperation(t,a),e.skipToken(1);let s=a.pop(),o=Fe.parse(e);e.peekToken(0).Type==C.COLON&&e.skipToken(1);let l=Fe.parse(e);if(a.push(new kc(s,o,l)),e.peekToken(-1).Type==C.SEMICOLON)break;continue}if(i.Type==C.LEFTMEDI){e.skipToken(1);let s=Fe.parse(e);e.peekToken(0).Type==C.RIGHTMEDI&&e.skipToken(1);let o=a.pop();a.push(new Rr(o,s));continue}throw"An unexpected character"}}for(;t.length>0&&Fe.unionOperation(t,a););if(t.length<=0&&a.length==1){let i=new Fe;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 qr(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==C.DOT?t.push(new vi(i,a)):t.push(new hr(r,i,a)),!0}return!1}}class Fc 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 Ha extends Ge{value;constructor(e){super(),this.value=e}static parse(e){let t=e.peekToken(0);if(t.Type==C.SUB&&e.peekToken(1).Type==C.LITERAL){let a=new Ha("-"+e.peekToken(1).Literal);return e.skipToken(2),a}else if(t.Type==C.LITERAL){let a=new Ha(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 _i extends Ha{arrayValue;constructor(e){super(""),this.arrayValue=e}static parse(e){if(e.peekToken(0).Type==C.LEFTBIG&&e.peekToken(1).Type==C.LITERAL||e.peekToken(0).Type==C.LEFTBIG&&e.peekToken(1).Type==C.SUB&&e.peekToken(2).Type==C.LITERAL){e.skipToken(1);let t=[];for(;e.peekToken(0).Type!=C.RIGHTBIG;){if(e.peekToken(0).Type==C.LEFTSAMLL){t.push(_i.parse(e));continue}if(t.push(Ha.parse(e)),e.peekToken(0).Type==C.COMMA){e.skipToken(1);continue}else if(e.peekToken(0).Type==C.RIGHTBIG){e.skipToken(1);break}else throw"Error parsing array constants: Unexpected characters"}return new _i(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 o2 extends Ge{constructor(){super()}}class l2 extends Ge{constructor(){super()}}class ms extends Ge{constructor(){super()}static parse(e){if(e.peekToken(0).Type==C.CONTINUE&&e.peekToken(1).Type==C.SEMICOLON)return e.skipToken(2),new ms;throw"Error parsing continue: Unexpected character"}formatToWGSL(e,t){let a="",r=t<=0?"":" ".repeat(t);return a+=r+"continue",a}}class Bi extends Ge{value;constructor(e){super(),this.value=e}static parse(e){if(e.peekToken(0).Type==C.RETURN){e.skipToken(1);let t=Fe.parse(e);return e.peekToken(0).Type==C.SEMICOLON&&e.skipToken(1),new Bi(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 qr 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 hr 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 kc 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 vi extends Ge{leftValue;rightValue;constructor(e,t){super(),this.leftValue=e,this.rightValue=t}static parse(e){if(e.peekToken(0).Type==C.IDENT&&e.peekToken(1).Type==C.DOT&&e.peekToken(2).Type==C.IDENT){let t=new Xa(e.peekToken(0).Literal),a=new Xa(e.peekToken(2).Literal);return e.skipToken(3),new vi(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 Rr extends Ge{leftValue;indexValue;constructor(e,t){super(),this.leftValue=e,this.indexValue=t}static parse(e){if(e.peekToken(0).Type==C.IDENT&&e.peekToken(1).Type==C.LEFTMEDI){let t=new Xa(e.peekToken(0).Literal);e.skipToken(2);let a=Fe.parse(e);e.peekToken(0).Type==C.RIGHTMEDI&&e.skipToken(1);let r=new Rr(t,a);for(;e.peekToken(0).Type==C.LEFTMEDI;)e.skipToken(1),a=Fe.parse(e),e.peekToken(0).Type==C.RIGHTMEDI&&e.skipToken(1),r=new Rr(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 Da extends Ge{constructor(){super()}static parse(e){if(e.peekToken(0).Type==C.LEFTBIG){e.skipToken(1);let t=new Da;for(let a=1;a>0&&e.peekToken(0).Type!=C.EOF;){let r=e.peekToken(0);if(r.Type==C.LEFTBIG){a++,e.skipToken(1);continue}if(r.Type==C.RIGHTBIG){a--,e.skipToken(1);continue}if(r.Type==C.SEMICOLON){e.skipToken(1);continue}if(r.isDataType()&&e.peekToken(1).Type==C.IDENT){t.addNode(et.parse(e));continue}if(r.Type==C.CONST&&e.peekToken(1).isDataType()&&e.peekToken(2).Type==C.IDENT){t.addNode(et.parse(e));continue}else if(r.Type==C.IDENT&&e.peekToken(1).Type==C.ASSIGN){t.addNode(Fe.parse(e)),e.peekToken(0).Type==C.SEMICOLON&&e.skipToken(1);continue}else if(r.Type==C.IDENT&&e.peekToken(1).Type==C.LEFTMEDI){let i=Rr.parse(e);if(e.peekToken(0).Type==C.ASSIGN){let s=e.peekToken(0);e.skipToken(1);let o=Fe.parse(e);e.peekToken(0).Type==C.RIGHTMEDI&&e.skipToken(1),t.addNode(new hr(s,i,o));continue}t.addNode(i);continue}else if(r.Type==C.IDENT&&e.peekToken(1).Type==C.DOT){let i=Fe.parse(e);t.addNode(i);continue}else if(r.Type==C.IDENT&&e.peekToken(1).isAssignOperation()){let i=e.peekToken(1),s=new Xa(r.Literal);e.skipToken(2);let o=Fe.parse(e);e.peekToken(0).Type==C.SEMICOLON&&e.skipToken(1),t.addNode(new hr(i,s,o));continue}else if(r.Type==C.IDENT&&(e.peekToken(1).Type==C.INC||e.peekToken(1).Type==C.DEC)&&e.peekToken(2).Type==C.SEMICOLON){let i=e.peekToken(1);t.addNode(new qr(i,new Xa(r.Literal),void 0)),e.skipToken(3);continue}else if(r.Type==C.RETURN){t.addNode(Bi.parse(e));continue}else if(r.Type==C.CONTINUE){t.addNode(ms.parse(e));continue}else if(r.Type==C.WHILE){t.addNode(Er.parse(e));continue}else if(r.Type==C.FOR){t.addNode(kr.parse(e));continue}else if(r.Type==C.IF){t.addNode(wr.parse(e));continue}else if(r.Type==C.IDENT&&e.peekToken(1).Type==C.LEFTSAMLL){t.addNode(Fr.parse(e)),e.peekToken(0).Type==C.SEMICOLON&&e.skipToken(0);continue}throw"Error parsing block: Unexpected symbol("+r.Literal+")"}return t}throw"Error parsing block: Unexpected symbol"}}class ps extends Ge{type;qualifier;constructor(e,t){super(),this.type=t,this.qualifier=e}static parse(e){if(e.peekToken(0).Type==C.PRECISION&&e.peekToken(1).Type==C.IDENT&&e.peekToken(2).isBuiltinType()){let t=new ps(e.peekToken(1).Literal,e.peekToken(2).Literal);return e.skipToken(3),e.peekToken(0).Type==C.SEMICOLON&&e.skipToken(1),t}throw"Error parsing precision qualifier: Unexpected character"}formatToWGSL(e,t){return""}}class Ui extends Ge{scope="";qualifier=new Map;constructor(){super()}addQualifier(e,t=""){this.qualifier.set(e,t)}static parse(e){if(e.peekToken(0).Type==C.LAYOUT&&e.peekToken(1).Type==C.LEFTSAMLL){let t=new Ui;e.skipToken(2);do if(e.peekToken(0).Type==C.IDENT){if(e.peekToken(1).Type==C.ASSIGN&&e.peekToken(2).Type==C.LITERAL){let r=e.peekToken(0).Literal,i=e.peekToken(2).Literal;if(t.addQualifier(r,i),e.skipToken(3),e.peekToken(0).Type==C.COMMA){e.skipToken(1);continue}let s=e.peekToken(0);s.Line=0}else if(e.peekToken(1).Type==C.RIGHTSAMLL){let r=e.peekToken(0).Literal;t.addQualifier(r,""),e.skipToken(1);break}else if(e.peekToken(1).Type==C.COMMA){let r=e.peekToken(0).Literal;t.addQualifier(r,""),e.skipToken(2);continue}}while(e.peekToken(0).Type!=C.RIGHTSAMLL);if(e.peekToken(0).Type==C.RIGHTSAMLL&&e.skipToken(1),t.scope=e.peekToken(0).Literal,e.skipToken(1),e.peekToken(0).Type==C.SEMICOLON)return e.skipToken(1),t;if(e.peekToken(0).isBuiltinType()&&e.peekToken(1).Type==C.IDENT&&e.peekToken(2).Type==C.SEMICOLON){let a=new et(e.peekToken(0).Literal,e.peekToken(1).Literal);return t.addNode(a),e.skipToken(3),t}else if(e.peekToken(0).Type==C.IDENT&&e.peekToken(1).Type==C.LEFTBIG){let a=Ya.parse(e);return t.addNode(a),e.peekToken(0).Type==C.IDENT&&e.peekToken(1).Type==C.SEMICOLON&&(a.addNode(new et(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 et){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 Ya){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 s of r.fields)e.addIdentifier(s.name,i+"."+s.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(n){switch(n){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 n}class Ec{_lexer;_rootNode;constructor(e){this._lexer=e,this._rootNode=new Ge,this.parse()}get lexer(){return this._lexer}parse(){for(;this.peekToken(0).Type!==C.EOF;){if(this.peekToken(0).Type==C.SEMICOLON){this.skipToken(1);continue}let e=this.parseStatement();e!==null&&this._rootNode.addNode(e)}}parseStatement(){let e=this.peekToken();if(e.Type==C.LAYOUT&&this.peekToken(1).Type==C.LEFTSAMLL)return Ui.parse(this._lexer);if(e.Type==C.STRUCT)return this.skipToken(1),Ya.parse(this._lexer);if((e.isBuiltinType()||e.Type==C.VOID)&&this.peekToken(1).Type==C.IDENT&&this.peekToken(2).Type==C.LEFTSAMLL)return bs.parse(this._lexer);if(e.Type==C.CONST&&this.peekToken(1).isDataType())return et.parse(this._lexer);if(e.isDataType()&&this.peekToken(1).Type==C.IDENT)return et.parse(this._lexer);if(e.Type==C.OUT&&this.peekToken(1).isDataType()&&this.peekToken(2).Type==C.IDENT)return et.parse(this._lexer);if(e.Type==C.PRECISION)return ps.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 wc{static VertexShader="VertexShader";static FragmentShader="FragmentShader";static convertGLSL(e){var t=new Sc(e),a=new Cc(t),r=new Ec(a),i=new xc(r);return i.generateWGSL()}}class _n{setID=0;bindingID=0;name="";type=""}class Bn{name="";type="";locationID=0;builtinName="";isBuiltinAttribute(){return this.builtinName!=""}}class Rc{uniformInfo=[];inputAttribute=[];outputAttribute=[];sourceCode=""}var _a=(n=>(n[n.vertex=0]="vertex",n[n.fragment=1]="fragment",n[n.computer=2]="computer",n))(_a||{});class Ic{blendMode=Ae.NONE;depthCompare=lt.less_equal;depthWriteEnabled=!0;frontFace="ccw";cullMode=Vt.back;topology=ls.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 Ae.ABOVE;case"ALPHA":return Ae.ALPHA;case"NORMAL":return Ae.NORMAL;case"ADD":return Ae.ADD;case"BELOW":return Ae.BELOW;case"ERASE":return Ae.ERASE;case"MUL":return Ae.MUL;case"SCREEN":return Ae.SCREEN;case"DIVD":return Ae.DIVD;case"SOFT_ADD":return Ae.SOFT_ADD}return Ae.NONE}}class Tc extends Za{uniformNodes=[];_onChange=!0;constructor(){super(),this.bufferType=ga.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 Ka{static renderShaderModulePool;static renderShader;static init(){this.renderShaderModulePool=new Map,this.renderShader=new Map}}class xe{reference;static _ins;static getInstance(){return this._ins||=new xe,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 vn{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 an{passType=de.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 X||console.error("Shader Not Register, Please Register Shader!",this.vsName),this.fsName in X||console.error("Shader Not Register, Please Register Shader!",this.fsName),X[this.vsName]&&(this._sourceVS=X[this.vsName]),X[this.fsName]&&(this._sourceFS=X[this.fsName]),this.textures={},this.bindGroups=[],this.shaderState=new Ic,this.materialDataUniformBuffer=new Tc,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==Vt.none}set doubleSide(e){let t=e?Vt.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!=Ae.NORMAL&&e!=Ae.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=xt.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),B.setting.render.useCompressGBuffer?this.defineValue.USE_COMPRESSGBUFFER=!0:this.defineValue.USE_COMPRESSGBUFFER=!1,ma.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=wc.convertGLSL(r);r=i.sourceCode}for(const s in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,s)){const o=this.constValues[s];r=r.replaceAll(`&${s}`,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 s=Ka.renderShaderModulePool.get(i);switch(s||(r=this.applyPostDefine(r,a),s=I.device.createShaderModule({label:e==_a.vertex?this.vsName:this.fsName,code:r}),s.getCompilationInfo().then(o=>{o.messages.length>0&&(console.log(r),console.log(o))}),Ka.renderShaderModulePool.set(i,s)),e){case _a.vertex:this._vsShaderModule=s,this._destVS=r;break;case _a.fragment:this._fsShaderModule=s,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 s=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:s,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 s=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:s,buffer:{type:"read-only-storage"}};a.push(o)}else if(i.varType=="var")switch(i.dataType){case"sampler":{let s=i.varName.replace("Sampler",""),o=this.textures[s]?this.textures[s]:B.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.samplerBindingLayout};a.push(l),this._textureGroup=e}break;case"sampler_comparison":{let s=i.varName.replace("Sampler",""),o=this.textures[s]?this.textures[s]:B.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 s=this.textures[i.varName]?this.textures[i.varName]:B.res.redTexture,o={binding:i.binding,visibility:s.visibility,texture:s.textureBindingLayout};a.push(o),this._textureGroup=e,xe.getInstance().attached(s,this)}break;case"texture_external":{let s=this.textures[i.varName]?this.textures[i.varName]:B.res.redTexture,o={binding:i.binding,visibility:s.visibility,externalTexture:{}};a.push(o),this._textureGroup=e,xe.getInstance().attached(s,this)}break;default:{let s=this.textures[i.varName]?this.textures[i.varName]:B.res.redTexture,o={binding:i.binding,visibility:s.visibility,texture:s.textureBindingLayout};a.push(o),this._textureGroup=e,xe.getInstance().attached(s,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==ga.MaterialDataUniformGPUBuffer){let h=[];if(l.dataFields)for(let u=0;u<l.dataFields.length;u++){const b=l.dataFields[u];this.uniforms[b.name]?h.push(this.uniforms[b.name]):console.error(`shader-${this.vsName}:${this.fsName} ${b.name}is empty`)}h.length>0&&this.materialDataUniformBuffer.initDataUniform(h)}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=B.res.blackTexture,this.setTexture(c,f)),f){let h={binding:l.binding,resource:f.gpuSampler};i.push(h)}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 h={binding:l.binding,resource:f.gpuSampler_comparison};i.push(h)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else{let c=this.textures[l.varName];if(c||(c=B.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 s=I.device.createBindGroup({layout:this.bindGroupLayouts[e],entries:i});this.bindGroups[e]=s}}createPipeline(e,t,a){let r=e,i=this.shaderState,s=[];for(const c of t.renderTargetTextures)s.push({format:c.format});for(let c=0;c<s.length;c++){const f=s[c];i.writeMasks&&i.writeMasks.length>0&&(f.writeMask=i.writeMasks[c])}if(t.outColor!=-1){let c=s[t.outColor];i.blendMode!=Ae.NONE?c.blend=Uc.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:s}),i.multisample>0&&(o.multisample={count:i.multisample}),(t.zPreTexture||t.depthTexture)&&(i.blendMode!=Ae.NONE,B.setting.render.zPrePass&&t.zPreTexture&&i.useZ?o.depthStencil={depthWriteEnabled:!1,depthCompare:lt.less,format:t.zPreTexture.format}:o.depthStencil={depthWriteEnabled:i.depthWriteEnabled,depthCompare:i.depthCompare,format:t.depthTexture.format});let l=vn.getSharePipeline(this.shaderVariant);l?this.pipeline=l:(this.pipeline=E.createPipeline(o),vn.setSharePipeline(this.shaderVariant,this.pipeline))}createGroupLayouts(){this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroupLayouts=[An.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 s=I.device.createBindGroupLayout({entries:i,label:`vs${this.vsName} fs${this.fsName} ${r.length}`});this.bindGroupLayouts[a]=s}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),s=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=s,B.setting.pick.mode=="pixel"&&(this.defineValue.USE_WORLDPOS=!0),B.setting.gi.enable?this.defineValue.USEGI=!0:this.defineValue.USEGI=!1,B.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,B.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=B.setting.shadow.type=="PCF",this.defineValue.USE_HARD_SHADOW=B.setting.shadow.type=="HARD",this.defineValue.USE_SOFT_SHADOW=B.setting.shadow.type=="SOFT",this.defineValue.USE_CSM=ia.Cascades>1,this.defineValue.USE_IES_PROFILE=Aa.use}genReflection(){this.shaderVariant=xt.genRenderShaderVariant(this);let e=xt.poolGetReflection(this.shaderVariant);if(e)this.shaderReflection=e;else{let t=ma.parse(this._destVS,this.defineValue);t=ma.parse(t,this.defineValue),xt.getShaderReflection2(t,this);let a=ma.parse(this._destFS,this.defineValue);a=ma.parse(a,this.defineValue),xt.getShaderReflection2(a,this),xt.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(xe.getInstance().detached(a,this),e&&!xe.getInstance().hasReference(a))a.destroy(e);else{a.destroy(!1);let r=xe.getInstance().getReference(a);if(r){let i=[];r.forEach((s,o)=>{"name"in s?i.push(s.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){Ka.renderShader.has(e)&&(Ka.renderShader.get(e).destroy(),Ka.renderShader.delete(e))}static getShader(e){return Ka.renderShader.get(e)}static createShader(e,t){let a=new qe(e,t);return Ka.renderShader.set(a.instanceID,a),a.instanceID}}class Qc extends qe{constructor(){super("sky_vs_frag_wgsl","SkyGBuffer_fs"),this.passType=de.GI,this.setUniformVector3("eyesPos",new g),this.setUniformFloat("exposure",1),this.setUniformFloat("roughness",0);let e=this.shaderState;e.frontFace="ccw",e.cullMode=Vt.front,e.depthWriteEnabled=!1,e.depthCompare=lt.less}}class Mc extends qe{transparency;constructor(){super("gbuffer_vs","gbuffer_fs"),this.setShaderEntry("VertMain","FragMain"),this.passType=de.GI,this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z),this.setUniformFloat("emissiveIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("alphaCutoff",1),this.blendMode=Ae.NONE,this.setTexture("normalMap",B.res.normalTexture)}}class Pc extends qe{constructor(){super("shadowCastMap_vert","directionShadowCastMap_frag"),this.passType=de.SHADOW,this.setShaderEntry("main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",g.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Nc extends qe{constructor(){super("castPointShadowMap_vert","shadowCastMap_frag"),this.passType=de.POINT_SHADOW,this.setShaderEntry("main","main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",g.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Vc extends qe{constructor(){super("ZPass_shader_vs","ZPass_shader_vs"),this.passType=de.DEPTH,this.setShaderEntry("main"),this.useRz=!1;let e=this.shaderState;e.receiveEnv=!1}}class yi{static createGIPass(e,t){if(ra.hasMask(e.rendererMask,Me.Sky)){if(!t.passShader.get(de.GI)){let r=t.getSubShaders(de.COLOR)[0],i=new Qc;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 s=t.getSubShaders(de.GI);if(!s||s.length==0||s.length<r){let o=new Mc;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=ra.hasMask(e.rendererMask,Me.SkinnedMesh),r=e.geometry.hasAttribute(G.TANGENT),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),s=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=t.getSubShaders(de.COLOR);for(let l=0;l<o.length;l++){const c=o[l];let f=t.getSubShaders(de.SHADOW);if(!f||f.length<l+1){let u=new Pc;u.setTexture("baseMap",c.getTexture("baseMap")),u.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),r&&u.setDefine("USE_TANGENT",r),a&&u.setDefine("USE_SKELETON",a),i&&u.setDefine("USE_MORPHTARGETS",i),s&&u.setDefine("USE_MORPHNORMALS",s),c.cullMode=="none"?u.shaderState.cullMode="none":c.cullMode=="back"?u.shaderState.cullMode="front":c.cullMode=="front"&&(u.shaderState.cullMode="back"),u.preCompile(e.geometry),t.addRenderPass(u)}let h=t.getSubShaders(de.POINT_SHADOW);if(!h||h.length<l+1){let u=new Nc;u.setTexture("baseMap",c.getTexture("baseMap")),u.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),u.setDefine("USE_ALPHACUT",1);for(let b=0;b<1;b++)r&&u.setDefine("USE_TANGENT",r),a&&u.setDefine("USE_SKELETON",a),i&&u.setDefine("USE_MORPHTARGETS",i),s&&u.setDefine("USE_MORPHNORMALS",s),u.shaderState.cullMode="front",u.preCompile(e.geometry);t.addRenderPass(u)}}}static createDepthPass(e,t){let a=t.getSubShaders(de.COLOR),r=e.geometry.hasAttribute("TANGENT"),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),s=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=ra.hasMask(e.rendererMask,Me.SkinnedMesh);for(let l=0;l<a.length;l++){const c=a[l];let f=t.getSubShaders(de.DEPTH);if(!f&&c.shaderState.useZ&&(!f||f.length<l)){let h=new Vc;h.setTexture("baseMap",c.getTexture("baseMap")),r||h.setDefine("USE_TANGENT",r),o&&h.setDefine("USE_SKELETON",o),i&&h.setDefine("USE_MORPHTARGETS",i),s&&h.setDefine("USE_MORPHNORMALS",s),h.cullMode=c.cullMode,h.frontFace=c.frontFace,h.preCompile(e.geometry),t.addRenderPass(h)}}}static createReflectionPass(e,t){let a=t.getDefaultShaders();for(let o=0;o<a.length;o++){const l=a[o];let c=t.getSubShaders(de.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=de.REFLECTION;for(const h in l.shaderState){var r=l.shaderState[h];f.shaderState[h]=r}for(const h in l.textures){var i=l.getTexture(h);f.setTexture(h,i)}for(const h in l.uniforms){var s=l.getUniform(h);f.setUniform(h,s)}for(const h in l.defineValue){var s=l.defineValue[h];f.setDefine(h,s)}f.setDefine("USE_CASTREFLECTION",!0),f.preCompile(e.geometry),t.addRenderPass(f)}}}}class ur{static _v1=new g;static _v2=new g;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<ur.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=ur._v1,t=this.box.extents.clone();let a=this.level+1,r=0;for(let i=0;i<2;i++)for(let s=0;s<2;s++)for(let o=0;o<2;o++){const l=new Ce;this.box.min.add(e.set(i,s,o).multiply(t),l.min),l.min.add(t,l.max),l.setFromMinMax(l.min,l.max);let c=new ur(l,r++,this,a);this.subTrees.push(c)}}}__rayCastTempVector=new g;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>ur.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>ur.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 Oc{_pool=[];_worldPosition=new g;_viewPosition=new g;_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 s=this.pop();s.userData=i,s.obj3d=a(i),s.z=this.worldToCameraDepth(s.obj3d,e),this._zSortList.push(s)}this._zSortList.sort((i,s)=>i.z-s.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 Lc=new Oc;var Ci=(n=>(n[n.None=2]="None",n[n.StaticBatch=4]="StaticBatch",n[n.DynamicBatch=8]="DynamicBatch",n[n.Hiden=16]="Hiden",n))(Ci||{});class Un{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)!=0}}class Gc{opaqueList=[];transparentList=[];sky;clean(){this.opaqueList.length=0,this.transparentList.length=0}}class zc{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 s=e.materials[i];a+=s.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 Wc{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 s=a.getAllPass();for(let o=0;o<s.length;o++){const l=s[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 s=0;s<i.length;s++){const o=i[s];let l=`${e.geometry.instanceID+o.instanceID}`;a.delete(l)}})}}}class ${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 $),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 Gc,this._renderShaderCollect=new Wc,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(Me.Sky))this.sky=t;else if(t.hasMask(Me.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(Me.Graphic3D))this._graphics.indexOf(t)==-1&&this._graphics.push(t);else if(Un.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),B.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 zc),r.get(e).collect_add(t)}t.object3D.renderNode=t,this._renderShaderCollect.collect_add(t)}getOctree(e){let t,a=B.setting.occlusionQuery.octree;if(a&&(t=this._octreeRenderNodes.get(e),!t)){let r=new g(a.x,a.y,a.z),i=new g(a.width,a.height,a.depth),s=new Ce(r,i);t=new ur(s),this._octreeRenderNodes.set(e,t)}return t}removeRenderNode(e,t){if(t.detachSceneOctree(),t.hasMask(Me.Sky))this.sky=null;else if(t.hasMask(Me.Reflection)){let a=this._reflections.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}else if(Un.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>=B.setting.light.maxLight){console.warn("Alreay meet maxmium light number:",B.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 s=Lc.worldToCameraDepth(r.object3D);s=1-Math.max(0,Math.min(1,s)),i+=s}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,B.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 Jc{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 c2=Object.defineProperty,f2=Object.getOwnPropertyDescriptor,yn=(n,e,t,a)=>{for(var r=f2(e,t),i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(e,t,r)||r);return r&&c2(e,t,r),r};class Ba extends $e{instanceCount=0;lodLevel=0;alwaysRender=!1;instanceID;drawType=0;_geometry;_materials=[];_castShadow=!0;_castReflection=!0;_castGI=!1;_rendererMask=Me.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=Me.Default,this.instanceID=tn().toString(),this._computes=[]}attachSceneOctree(e){this._octreeBinder={octree:e,entity:new Jc(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&&xe.getInstance().detached(this._geometry,this),e&&xe.getInstance().attached(e,this)),this._geometry=e}addMask(e){this._rendererMask=ra.addMask(this.rendererMask,e)}removeMask(e){this._rendererMask=ra.removeMask(this.rendererMask,e)}hasMask(e){return ra.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];xe.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];xe.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 s=e[a].getPass(de.COLOR)[0];s.shaderState.transparent&&(t=t>s.renderOrder?t:s.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=ra.addMask(this._rendererMask,e)}removeRendererMask(e){this._rendererMask=ra.removeMask(this._rendererMask,e)}onEnable(){this._readyPipeline||this.initPipeline(),$.instance.addRenderNode(this.transform.scene3D,this),this.updateOctreeEntity()}onDisable(){this._enable=!1,$.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(de.COLOR);for(let i=0;i<r.length;i++){const s=r[i];s.shaderReflection||s.preCompile(this._geometry),this._geometry.generate(s.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(de.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&&$.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(!ra.hasMask(this.rendererMask,Me.IgnoreDepthPass)&&B.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(de.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 s=Math.max(r.materials.length,r._geometry.subGeometries.length);for(let o=0;o<s;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)){E.bindGeometryBuffer(a.encoder,r._geometry),ct.viewCount_vertex(e,de[t],r._geometry.vertexCount);for(let f=0;f<c.length;f++){if(!c||c.length==0)continue;const u=c[f];if(u.pipeline){u.shaderState.splitTexture&&(a.endRenderPass(),wt.WriteSplitColorTexture(r.instanceID),a.beginOpaqueRenderPass(),E.bindCamera(a.encoder,e.camera),E.bindGeometryBuffer(a.encoder,r._geometry)),E.bindPipeline(a.encoder,u)&&ct.viewCount_pipeline(e,de[t]);let p=(o>=r._geometry.subGeometries.length?r._geometry.subGeometries[0]:r._geometry.subGeometries[o]).lodLevels[r.lodLevel];r.instanceCount>0?(ct.viewCount_instance(e,de[t],r.instanceCount),ct.viewCount_indices(e,de[t],p.indexCount),ct.viewCount_tri(e,de[t],p.indexCount/3*r.instanceCount),E.drawIndexed(a.encoder,p.indexCount,r.instanceCount,p.indexStart,0,0)):(ct.viewCount_indices(e,de[t],p.indexCount),ct.viewCount_tri(e,de[t],p.indexCount/3),E.drawIndexed(a.encoder,p.indexCount,1,p.indexStart,0,i.index)),ct.viewCount_draw(e,de[t])}}}}}renderPass2(e,t,a,r,i,s=!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==de.SHADOW)continue;let h=f.getPass(t);if(!h||h.length==0)return;if(this.drawType==2)for(let u of h)u.pipeline&&(E.bindPipeline(i,u),E.draw(i,6,1,0,l.index));else{E.bindGeometryBuffer(i,o._geometry);for(let u of h)if(u.pipeline){E.bindPipeline(i,u);let p=o._geometry.subGeometries[c].lodLevels[o.lodLevel];E.drawIndexed(i,p.indexCount,1,p.indexStart,0,l.index)}}}}recordRenderPass2(e,t,a,r,i,s=!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 h=o.object3D.transform._worldMatrix;for(let u=0;u<f.length;u++){const b=f[u];E.bindPipeline(i,b);let D=o._geometry.subGeometries[l].lodLevels[o.lodLevel];E.drawIndexed(i,D.indexCount,1,D.indexStart,0,h.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,s=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 u=c[f];if(u.shaderState.splitTexture){let v=wt.CreateSplitTexture(i.instanceID);u.setTexture("splitTexture_Map",v)}!i._ignoreEnvMap&&u.envMap!=s&&u.setTexture("envMap",s),u.prefilterMap||u.setTexture("prefilterMap",s);let b=ve.getReflectionEntries(e.scene);if(!u.reflectionMap&&b&&b.reflectionMap&&(u.setTexture("reflectionMap",b.reflectionMap),u.setStorageBuffer("reflectionBuffer",b.storageGPUBuffer)),u.pipeline){u.apply(i._geometry,a,()=>i.noticeShaderChange());continue}let A=B.res.getTexture("BRDFLUT");u.setTexture("brdflutMap",A);let m=B.getRenderJob(e).shadowMapPassRenderer;m&&m.depth2DArrayTexture&&u.setTexture("shadowMap",B.getRenderJob(e).shadowMapPassRenderer.depth2DArrayTexture);let p=B.getRenderJob(e).pointLightShadowRenderer;p&&p.cubeArrayTexture&&u.setTexture("pointShadowMap",p.cubeArrayTexture);let D=Aa.iesTexture;D&&u.setTexture("iesTextureArrayMap",D),a.irradianceBuffer&&a.irradianceBuffer.length>0&&(u.setTexture("irradianceMap",a.irradianceBuffer[0]),u.setTexture("irradianceDepthMap",a.irradianceBuffer[1]));let _=ve.getLightEntries(e.scene);_&&(u.setStorageBuffer("lightBuffer",_.storageGPUBuffer),_.irradianceVolume&&u.setUniformBuffer("irradianceData",_.irradianceVolume.irradianceVolumeBuffer)),r&&(u.setStorageBuffer("clustersUniform",r.clustersUniformBuffer),u.setStorageBuffer("lightAssignBuffer",r.lightAssignBuffer),u.setStorageBuffer("assignTable",r.assignTableBuffer),u.setStorageBuffer("clusterBuffer",r.clusterBuffer)),u.apply(i._geometry,a),this._passInit.set(t,!0)}}}beforeDestroy(e){this._geometry&&(xe.getInstance().detached(this._geometry,this),xe.getInstance().hasReference(this._geometry)||this._geometry.destroy(e));for(let t=0;t<this._materials.length;t++){const a=this._materials[t];a&&(xe.getInstance().detached(a,this),xe.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}}yn([jr],Ba.prototype,"materials"),yn([jr],Ba.prototype,"castShadow"),yn([jr],Ba.prototype,"castGI");class Dt{instanceID;name;enable=!0;_defaultSubShader;_shader;_isDestroyed=!1;constructor(){this.instanceID=Gt()}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(de.COLOR)}clone(){let e=new Dt;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 jc=`
5745
+ `}return a}return a}}function la(n){switch(n){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 n}class Ec{_lexer;_rootNode;constructor(e){this._lexer=e,this._rootNode=new Ge,this.parse()}get lexer(){return this._lexer}parse(){for(;this.peekToken(0).Type!==C.EOF;){if(this.peekToken(0).Type==C.SEMICOLON){this.skipToken(1);continue}let e=this.parseStatement();e!==null&&this._rootNode.addNode(e)}}parseStatement(){let e=this.peekToken();if(e.Type==C.LAYOUT&&this.peekToken(1).Type==C.LEFTSAMLL)return Ui.parse(this._lexer);if(e.Type==C.STRUCT)return this.skipToken(1),Ya.parse(this._lexer);if((e.isBuiltinType()||e.Type==C.VOID)&&this.peekToken(1).Type==C.IDENT&&this.peekToken(2).Type==C.LEFTSAMLL)return bs.parse(this._lexer);if(e.Type==C.CONST&&this.peekToken(1).isDataType())return et.parse(this._lexer);if(e.isDataType()&&this.peekToken(1).Type==C.IDENT)return et.parse(this._lexer);if(e.Type==C.OUT&&this.peekToken(1).isDataType()&&this.peekToken(2).Type==C.IDENT)return et.parse(this._lexer);if(e.Type==C.PRECISION)return ps.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 wc{static VertexShader="VertexShader";static FragmentShader="FragmentShader";static convertGLSL(e){var t=new Sc(e),a=new Cc(t),r=new Ec(a),i=new xc(r);return i.generateWGSL()}}class _n{setID=0;bindingID=0;name="";type=""}class Bn{name="";type="";locationID=0;builtinName="";isBuiltinAttribute(){return this.builtinName!=""}}class Rc{uniformInfo=[];inputAttribute=[];outputAttribute=[];sourceCode=""}var _a=(n=>(n[n.vertex=0]="vertex",n[n.fragment=1]="fragment",n[n.computer=2]="computer",n))(_a||{});class Ic{blendMode=Ae.NONE;depthCompare=it.less_equal;depthWriteEnabled=!0;frontFace="ccw";cullMode=Vt.back;topology=ls.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 Ae.ABOVE;case"ALPHA":return Ae.ALPHA;case"NORMAL":return Ae.NORMAL;case"ADD":return Ae.ADD;case"BELOW":return Ae.BELOW;case"ERASE":return Ae.ERASE;case"MUL":return Ae.MUL;case"SCREEN":return Ae.SCREEN;case"DIVD":return Ae.DIVD;case"SOFT_ADD":return Ae.SOFT_ADD}return Ae.NONE}}class Tc extends Za{uniformNodes=[];_onChange=!0;constructor(){super(),this.bufferType=ga.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 Ka{static renderShaderModulePool;static renderShader;static init(){this.renderShaderModulePool=new Map,this.renderShader=new Map}}class xe{reference;static _ins;static getInstance(){return this._ins||=new xe,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 vn{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 an{passType=de.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 X||console.error("Shader Not Register, Please Register Shader!",this.vsName),this.fsName in X||console.error("Shader Not Register, Please Register Shader!",this.fsName),X[this.vsName]&&(this._sourceVS=X[this.vsName]),X[this.fsName]&&(this._sourceFS=X[this.fsName]),this.textures={},this.bindGroups=[],this.shaderState=new Ic,this.materialDataUniformBuffer=new Tc,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==Vt.none}set doubleSide(e){let t=e?Vt.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!=Ae.NORMAL&&e!=Ae.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=xt.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),B.setting.render.useCompressGBuffer?this.defineValue.USE_COMPRESSGBUFFER=!0:this.defineValue.USE_COMPRESSGBUFFER=!1,ma.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=wc.convertGLSL(r);r=i.sourceCode}for(const s in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,s)){const o=this.constValues[s];r=r.replaceAll(`&${s}`,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 s=Ka.renderShaderModulePool.get(i);switch(s||(r=this.applyPostDefine(r,a),s=I.device.createShaderModule({label:e==_a.vertex?this.vsName:this.fsName,code:r}),s.getCompilationInfo().then(o=>{o.messages.length>0&&(console.log(r),console.log(o))}),Ka.renderShaderModulePool.set(i,s)),e){case _a.vertex:this._vsShaderModule=s,this._destVS=r;break;case _a.fragment:this._fsShaderModule=s,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 s=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:s,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 s=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:s,buffer:{type:"read-only-storage"}};a.push(o)}else if(i.varType=="var")switch(i.dataType){case"sampler":{let s=i.varName.replace("Sampler",""),o=this.textures[s]?this.textures[s]:B.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.samplerBindingLayout};a.push(l),this._textureGroup=e}break;case"sampler_comparison":{let s=i.varName.replace("Sampler",""),o=this.textures[s]?this.textures[s]:B.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 s=this.textures[i.varName]?this.textures[i.varName]:B.res.redTexture,o={binding:i.binding,visibility:s.visibility,texture:s.textureBindingLayout};a.push(o),this._textureGroup=e,xe.getInstance().attached(s,this)}break;case"texture_external":{let s=this.textures[i.varName]?this.textures[i.varName]:B.res.redTexture,o={binding:i.binding,visibility:s.visibility,externalTexture:{}};a.push(o),this._textureGroup=e,xe.getInstance().attached(s,this)}break;default:{let s=this.textures[i.varName]?this.textures[i.varName]:B.res.redTexture,o={binding:i.binding,visibility:s.visibility,texture:s.textureBindingLayout};a.push(o),this._textureGroup=e,xe.getInstance().attached(s,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==ga.MaterialDataUniformGPUBuffer){let h=[];if(l.dataFields)for(let u=0;u<l.dataFields.length;u++){const b=l.dataFields[u];this.uniforms[b.name]?h.push(this.uniforms[b.name]):console.error(`shader-${this.vsName}:${this.fsName} ${b.name}is empty`)}h.length>0&&this.materialDataUniformBuffer.initDataUniform(h)}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=B.res.blackTexture,this.setTexture(c,f)),f){let h={binding:l.binding,resource:f.gpuSampler};i.push(h)}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 h={binding:l.binding,resource:f.gpuSampler_comparison};i.push(h)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else{let c=this.textures[l.varName];if(c||(c=B.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 s=I.device.createBindGroup({layout:this.bindGroupLayouts[e],entries:i});this.bindGroups[e]=s}}createPipeline(e,t,a){let r=e,i=this.shaderState,s=[];for(const c of t.renderTargetTextures)s.push({format:c.format});for(let c=0;c<s.length;c++){const f=s[c];i.writeMasks&&i.writeMasks.length>0&&(f.writeMask=i.writeMasks[c])}if(t.outColor!=-1){let c=s[t.outColor];i.blendMode!=Ae.NONE?c.blend=Uc.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:s}),i.multisample>0&&(o.multisample={count:i.multisample}),(t.zPreTexture||t.depthTexture)&&(i.blendMode!=Ae.NONE,B.setting.render.zPrePass&&t.zPreTexture&&i.useZ?o.depthStencil={depthWriteEnabled:!1,depthCompare:it.less,format:t.zPreTexture.format}:o.depthStencil={depthWriteEnabled:i.depthWriteEnabled,depthCompare:i.depthCompare,format:t.depthTexture.format});let l=vn.getSharePipeline(this.shaderVariant);l?this.pipeline=l:(this.pipeline=E.createPipeline(o),vn.setSharePipeline(this.shaderVariant,this.pipeline))}createGroupLayouts(){this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroupLayouts=[An.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 s=I.device.createBindGroupLayout({entries:i,label:`vs${this.vsName} fs${this.fsName} ${r.length}`});this.bindGroupLayouts[a]=s}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),s=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=s,B.setting.pick.mode=="pixel"&&(this.defineValue.USE_WORLDPOS=!0),B.setting.gi.enable?this.defineValue.USEGI=!0:this.defineValue.USEGI=!1,B.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,B.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=B.setting.shadow.type=="PCF",this.defineValue.USE_HARD_SHADOW=B.setting.shadow.type=="HARD",this.defineValue.USE_SOFT_SHADOW=B.setting.shadow.type=="SOFT",this.defineValue.USE_CSM=ia.Cascades>1,this.defineValue.USE_IES_PROFILE=Aa.use}genReflection(){this.shaderVariant=xt.genRenderShaderVariant(this);let e=xt.poolGetReflection(this.shaderVariant);if(e)this.shaderReflection=e;else{let t=ma.parse(this._destVS,this.defineValue);t=ma.parse(t,this.defineValue),xt.getShaderReflection2(t,this);let a=ma.parse(this._destFS,this.defineValue);a=ma.parse(a,this.defineValue),xt.getShaderReflection2(a,this),xt.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(xe.getInstance().detached(a,this),e&&!xe.getInstance().hasReference(a))a.destroy(e);else{a.destroy(!1);let r=xe.getInstance().getReference(a);if(r){let i=[];r.forEach((s,o)=>{"name"in s?i.push(s.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){Ka.renderShader.has(e)&&(Ka.renderShader.get(e).destroy(),Ka.renderShader.delete(e))}static getShader(e){return Ka.renderShader.get(e)}static createShader(e,t){let a=new qe(e,t);return Ka.renderShader.set(a.instanceID,a),a.instanceID}}class Qc extends qe{constructor(){super("sky_vs_frag_wgsl","SkyGBuffer_fs"),this.passType=de.GI,this.setUniformVector3("eyesPos",new g),this.setUniformFloat("exposure",1),this.setUniformFloat("roughness",0);let e=this.shaderState;e.frontFace="ccw",e.cullMode=Vt.front,e.depthWriteEnabled=!1,e.depthCompare=it.less}}class Mc extends qe{transparency;constructor(){super("gbuffer_vs","gbuffer_fs"),this.setShaderEntry("VertMain","FragMain"),this.passType=de.GI,this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z),this.setUniformFloat("emissiveIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("alphaCutoff",1),this.blendMode=Ae.NONE,this.setTexture("normalMap",B.res.normalTexture)}}class Pc extends qe{constructor(){super("shadowCastMap_vert","directionShadowCastMap_frag"),this.passType=de.SHADOW,this.setShaderEntry("main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",g.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Nc extends qe{constructor(){super("castPointShadowMap_vert","shadowCastMap_frag"),this.passType=de.POINT_SHADOW,this.setShaderEntry("main","main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",g.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Vc extends qe{constructor(){super("ZPass_shader_vs","ZPass_shader_vs"),this.passType=de.DEPTH,this.setShaderEntry("main"),this.useRz=!1;let e=this.shaderState;e.receiveEnv=!1}}class yi{static createGIPass(e,t){if(ra.hasMask(e.rendererMask,Me.Sky)){if(!t.passShader.get(de.GI)){let r=t.getSubShaders(de.COLOR)[0],i=new Qc;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 s=t.getSubShaders(de.GI);if(!s||s.length==0||s.length<r){let o=new Mc;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=ra.hasMask(e.rendererMask,Me.SkinnedMesh),r=e.geometry.hasAttribute(G.TANGENT),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),s=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=t.getSubShaders(de.COLOR);for(let l=0;l<o.length;l++){const c=o[l];let f=t.getSubShaders(de.SHADOW);if(!f||f.length<l+1){let u=new Pc;u.setTexture("baseMap",c.getTexture("baseMap")),u.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),r&&u.setDefine("USE_TANGENT",r),a&&u.setDefine("USE_SKELETON",a),i&&u.setDefine("USE_MORPHTARGETS",i),s&&u.setDefine("USE_MORPHNORMALS",s),c.cullMode=="none"?u.shaderState.cullMode="none":c.cullMode=="back"?u.shaderState.cullMode="front":c.cullMode=="front"&&(u.shaderState.cullMode="back"),u.preCompile(e.geometry),t.addRenderPass(u)}let h=t.getSubShaders(de.POINT_SHADOW);if(!h||h.length<l+1){let u=new Nc;u.setTexture("baseMap",c.getTexture("baseMap")),u.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),u.setDefine("USE_ALPHACUT",1);for(let b=0;b<1;b++)r&&u.setDefine("USE_TANGENT",r),a&&u.setDefine("USE_SKELETON",a),i&&u.setDefine("USE_MORPHTARGETS",i),s&&u.setDefine("USE_MORPHNORMALS",s),u.shaderState.cullMode="front",u.preCompile(e.geometry);t.addRenderPass(u)}}}static createDepthPass(e,t){let a=t.getSubShaders(de.COLOR),r=e.geometry.hasAttribute("TANGENT"),i=e.geometry.hasAttribute(oa.MORPH_POSITION_PREFIX+"0"),s=e.geometry.hasAttribute(oa.MORPH_NORMAL_PREFIX+"0"),o=ra.hasMask(e.rendererMask,Me.SkinnedMesh);for(let l=0;l<a.length;l++){const c=a[l];let f=t.getSubShaders(de.DEPTH);if(!f&&c.shaderState.useZ&&(!f||f.length<l)){let h=new Vc;h.setTexture("baseMap",c.getTexture("baseMap")),r||h.setDefine("USE_TANGENT",r),o&&h.setDefine("USE_SKELETON",o),i&&h.setDefine("USE_MORPHTARGETS",i),s&&h.setDefine("USE_MORPHNORMALS",s),h.cullMode=c.cullMode,h.frontFace=c.frontFace,h.preCompile(e.geometry),t.addRenderPass(h)}}}static createReflectionPass(e,t){let a=t.getDefaultShaders();for(let o=0;o<a.length;o++){const l=a[o];let c=t.getSubShaders(de.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=de.REFLECTION;for(const h in l.shaderState){var r=l.shaderState[h];f.shaderState[h]=r}for(const h in l.textures){var i=l.getTexture(h);f.setTexture(h,i)}for(const h in l.uniforms){var s=l.getUniform(h);f.setUniform(h,s)}for(const h in l.defineValue){var s=l.defineValue[h];f.setDefine(h,s)}f.setDefine("USE_CASTREFLECTION",!0),f.preCompile(e.geometry),t.addRenderPass(f)}}}}class ur{static _v1=new g;static _v2=new g;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<ur.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=ur._v1,t=this.box.extents.clone();let a=this.level+1,r=0;for(let i=0;i<2;i++)for(let s=0;s<2;s++)for(let o=0;o<2;o++){const l=new Ce;this.box.min.add(e.set(i,s,o).multiply(t),l.min),l.min.add(t,l.max),l.setFromMinMax(l.min,l.max);let c=new ur(l,r++,this,a);this.subTrees.push(c)}}}__rayCastTempVector=new g;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>ur.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>ur.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 Oc{_pool=[];_worldPosition=new g;_viewPosition=new g;_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 s=this.pop();s.userData=i,s.obj3d=a(i),s.z=this.worldToCameraDepth(s.obj3d,e),this._zSortList.push(s)}this._zSortList.sort((i,s)=>i.z-s.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 Lc=new Oc;var Ci=(n=>(n[n.None=2]="None",n[n.StaticBatch=4]="StaticBatch",n[n.DynamicBatch=8]="DynamicBatch",n[n.Hiden=16]="Hiden",n))(Ci||{});class Un{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)!=0}}class Gc{opaqueList=[];transparentList=[];sky;clean(){this.opaqueList.length=0,this.transparentList.length=0}}class zc{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 s=e.materials[i];a+=s.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 Wc{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 s=a.getAllPass();for(let o=0;o<s.length;o++){const l=s[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 s=0;s<i.length;s++){const o=i[s];let l=`${e.geometry.instanceID+o.instanceID}`;a.delete(l)}})}}}class ${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 $),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 Gc,this._renderShaderCollect=new Wc,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(Me.Sky))this.sky=t;else if(t.hasMask(Me.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(Me.Graphic3D))this._graphics.indexOf(t)==-1&&this._graphics.push(t);else if(Un.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),B.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 zc),r.get(e).collect_add(t)}t.object3D.renderNode=t,this._renderShaderCollect.collect_add(t)}getOctree(e){let t,a=B.setting.occlusionQuery.octree;if(a&&(t=this._octreeRenderNodes.get(e),!t)){let r=new g(a.x,a.y,a.z),i=new g(a.width,a.height,a.depth),s=new Ce(r,i);t=new ur(s),this._octreeRenderNodes.set(e,t)}return t}removeRenderNode(e,t){if(t.detachSceneOctree(),t.hasMask(Me.Sky))this.sky=null;else if(t.hasMask(Me.Reflection)){let a=this._reflections.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}else if(Un.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>=B.setting.light.maxLight){console.warn("Alreay meet maxmium light number:",B.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 s=Lc.worldToCameraDepth(r.object3D);s=1-Math.max(0,Math.min(1,s)),i+=s}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,B.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 Jc{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 c2=Object.defineProperty,f2=Object.getOwnPropertyDescriptor,yn=(n,e,t,a)=>{for(var r=f2(e,t),i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(e,t,r)||r);return r&&c2(e,t,r),r};class Ba extends $e{instanceCount=0;lodLevel=0;alwaysRender=!1;instanceID;drawType=0;_geometry;_materials=[];_castShadow=!0;_castReflection=!0;_castGI=!1;_rendererMask=Me.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=Me.Default,this.instanceID=tn().toString(),this._computes=[]}attachSceneOctree(e){this._octreeBinder={octree:e,entity:new Jc(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&&xe.getInstance().detached(this._geometry,this),e&&xe.getInstance().attached(e,this)),this._geometry=e}addMask(e){this._rendererMask=ra.addMask(this.rendererMask,e)}removeMask(e){this._rendererMask=ra.removeMask(this.rendererMask,e)}hasMask(e){return ra.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];xe.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];xe.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 s=e[a].getPass(de.COLOR)[0];s.shaderState.transparent&&(t=t>s.renderOrder?t:s.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=ra.addMask(this._rendererMask,e)}removeRendererMask(e){this._rendererMask=ra.removeMask(this._rendererMask,e)}onEnable(){this._readyPipeline||this.initPipeline(),$.instance.addRenderNode(this.transform.scene3D,this),this.updateOctreeEntity()}onDisable(){this._enable=!1,$.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(de.COLOR);for(let i=0;i<r.length;i++){const s=r[i];s.shaderReflection||s.preCompile(this._geometry),this._geometry.generate(s.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(de.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&&$.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(!ra.hasMask(this.rendererMask,Me.IgnoreDepthPass)&&B.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(de.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 s=Math.max(r.materials.length,r._geometry.subGeometries.length);for(let o=0;o<s;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)){E.bindGeometryBuffer(a.encoder,r._geometry),ct.viewCount_vertex(e,de[t],r._geometry.vertexCount);for(let f=0;f<c.length;f++){if(!c||c.length==0)continue;const u=c[f];if(u.pipeline){u.shaderState.splitTexture&&(a.endRenderPass(),wt.WriteSplitColorTexture(r.instanceID),a.beginOpaqueRenderPass(),E.bindCamera(a.encoder,e.camera),E.bindGeometryBuffer(a.encoder,r._geometry)),E.bindPipeline(a.encoder,u)&&ct.viewCount_pipeline(e,de[t]);let p=(o>=r._geometry.subGeometries.length?r._geometry.subGeometries[0]:r._geometry.subGeometries[o]).lodLevels[r.lodLevel];r.instanceCount>0?(ct.viewCount_instance(e,de[t],r.instanceCount),ct.viewCount_indices(e,de[t],p.indexCount),ct.viewCount_tri(e,de[t],p.indexCount/3*r.instanceCount),E.drawIndexed(a.encoder,p.indexCount,r.instanceCount,p.indexStart,0,0)):(ct.viewCount_indices(e,de[t],p.indexCount),ct.viewCount_tri(e,de[t],p.indexCount/3),E.drawIndexed(a.encoder,p.indexCount,1,p.indexStart,0,i.index)),ct.viewCount_draw(e,de[t])}}}}}renderPass2(e,t,a,r,i,s=!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==de.SHADOW)continue;let h=f.getPass(t);if(!h||h.length==0)return;if(this.drawType==2)for(let u of h)u.pipeline&&(E.bindPipeline(i,u),E.draw(i,6,1,0,l.index));else{E.bindGeometryBuffer(i,o._geometry);for(let u of h)if(u.pipeline){E.bindPipeline(i,u);let p=o._geometry.subGeometries[c].lodLevels[o.lodLevel];E.drawIndexed(i,p.indexCount,1,p.indexStart,0,l.index)}}}}recordRenderPass2(e,t,a,r,i,s=!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 h=o.object3D.transform._worldMatrix;for(let u=0;u<f.length;u++){const b=f[u];E.bindPipeline(i,b);let D=o._geometry.subGeometries[l].lodLevels[o.lodLevel];E.drawIndexed(i,D.indexCount,1,D.indexStart,0,h.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,s=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 u=c[f];if(u.shaderState.splitTexture){let v=wt.CreateSplitTexture(i.instanceID);u.setTexture("splitTexture_Map",v)}!i._ignoreEnvMap&&u.envMap!=s&&u.setTexture("envMap",s),u.prefilterMap||u.setTexture("prefilterMap",s);let b=ve.getReflectionEntries(e.scene);if(!u.reflectionMap&&b&&b.reflectionMap&&(u.setTexture("reflectionMap",b.reflectionMap),u.setStorageBuffer("reflectionBuffer",b.storageGPUBuffer)),u.pipeline){u.apply(i._geometry,a,()=>i.noticeShaderChange());continue}let A=B.res.getTexture("BRDFLUT");u.setTexture("brdflutMap",A);let m=B.getRenderJob(e).shadowMapPassRenderer;m&&m.depth2DArrayTexture&&u.setTexture("shadowMap",B.getRenderJob(e).shadowMapPassRenderer.depth2DArrayTexture);let p=B.getRenderJob(e).pointLightShadowRenderer;p&&p.cubeArrayTexture&&u.setTexture("pointShadowMap",p.cubeArrayTexture);let D=Aa.iesTexture;D&&u.setTexture("iesTextureArrayMap",D),a.irradianceBuffer&&a.irradianceBuffer.length>0&&(u.setTexture("irradianceMap",a.irradianceBuffer[0]),u.setTexture("irradianceDepthMap",a.irradianceBuffer[1]));let _=ve.getLightEntries(e.scene);_&&(u.setStorageBuffer("lightBuffer",_.storageGPUBuffer),_.irradianceVolume&&u.setUniformBuffer("irradianceData",_.irradianceVolume.irradianceVolumeBuffer)),r&&(u.setStorageBuffer("clustersUniform",r.clustersUniformBuffer),u.setStorageBuffer("lightAssignBuffer",r.lightAssignBuffer),u.setStorageBuffer("assignTable",r.assignTableBuffer),u.setStorageBuffer("clusterBuffer",r.clusterBuffer)),u.apply(i._geometry,a),this._passInit.set(t,!0)}}}beforeDestroy(e){this._geometry&&(xe.getInstance().detached(this._geometry,this),xe.getInstance().hasReference(this._geometry)||this._geometry.destroy(e));for(let t=0;t<this._materials.length;t++){const a=this._materials[t];a&&(xe.getInstance().detached(a,this),xe.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}}yn([jr],Ba.prototype,"materials"),yn([jr],Ba.prototype,"castShadow"),yn([jr],Ba.prototype,"castGI");class Dt{instanceID;name;enable=!0;_defaultSubShader;_shader;_isDestroyed=!1;constructor(){this.instanceID=Gt()}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(de.COLOR)}clone(){let e=new Dt;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 jc=`
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 = min(sqrt(2.0 * lambda1), MAX_SPLAT_SIZE) * diagonalVector;
5859
- let v2 = min(sqrt(2.0 * lambda2), MAX_SPLAT_SIZE) * vec2f(diagonalVector.y, -diagonalVector.x);
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 scale = min(1.0, sqrt(LOG_255 + log(color.a)) * 0.5);
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 v1v2_scaled = v1v2 * (scale * visBoost);
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 * 0.5);
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
- let gaussian = exp(-A * GAUSSIAN_SCALE) * color.a;
5981
- let alpha = select(gaussian, 0.0, A > 1.0 || gaussian < ALPHA_THRESHOLD);
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 gt{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(de.COLOR)}getDefaultColorShader(){return this.passShader.get(de.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 gt,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 d2=Object.getOwnPropertyDescriptor,h2=(n,e,t,a)=>{for(var r=a>1?void 0:a?d2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.GSplatShader=class extends gt{constructor(){super();const e=new qe("gsplat_vs_dc","gsplat_fs_dc");e.passType=de.COLOR,e.setShaderEntry("VertMain","FragMain"),e.topology=ls.triangle_list,e.depthWriteEnabled=!1,e.cullMode=Vt.none,e.shaderState.transparent=!0,e.shaderState.blendMode=Ae.NORMAL,e.shaderState.writeMasks=[15,15],e.shaderState.castReflection=!1,this.addRenderPass(e),this.setDefault()}setDefault(){const e=this.getDefaultColorShader(),t=new T;e.setUniform("modelMatrix",t.rawData),e.setUniform("pixelCull",new Float32Array([2,0,0,0]))}},d.GSplatShader=h2([Ta(d.GSplatShader,"GSplatShader")],d.GSplatShader);class Cn extends Dt{_pixelCullArray=new Float32Array(4);constructor(){super(),X.register("gsplat_vs_dc",jc),X.register("gsplat_fs_dc",Zc),this.shader=new d.GSplatShader}setSplatTextures(e,t,a,r,i){const s=this.shader.getDefaultColorShader();s.setTexture("splatColor",e),s.setTexture("transformA",t),s.setTexture("transformB",a),s.setUniformArray("tex_params",r),i&&s.setTexture("splatOrder",i),s.shaderState.depthCompare=lt.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 As extends Za{node;constructor(e){super(),this.bufferType=ga.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 or,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),this.node=this.memory.allocation_node(this.byteSize)}}var kt=(n=>(n[n.split=0]="split",n[n.compose=1]="compose",n[n.compose_bin=2]="compose_bin",n))(kt||{});class Yc{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 s={name:i.name,format:i.format,offset:0,shaderLocation:i.location,stride:cr[i.format]};this._attributeSlotLayouts[i.location]=[s];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/s.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 As(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 s={name:i.name,format:i.format,offset:a*4,shaderLocation:i.location,stride:cr[i.format]};this._attributeSlotLayouts[0][i.location]=s;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/s.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 As(this.vertexCount*a)}createComposBinVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let s=0;s<t.attributes.length;s++){const o=t.attributes[s];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:cr[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 As(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 s=t.data[a*r.stride+i],o=a*(this._vertexBufferLayouts[0].arrayStride/4)+r.offset/4+i;this.vertexGPUBuffer.node.setFloat(s,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 s=e.get(i.name);for(let o=0;o<i.stride;o++){let l=s.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 Xc extends Za{indicesNode;constructor(e){super(),this.bufferType=ga.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 or,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 Hc{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 Xc(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 Kc{lodLevels}class Ve{instanceID;name;subGeometries=[];morphTargetsRelative;morphTargetDictionary;skinNames;bindPose;blendShapeData;vertexDim;vertexCount=0;_bounds;_attributeMap;_attributes;_indicesBuffer;_vertexBuffer;_onChange=!0;_wireframeLines;_isDestroyed=!1;constructor(){this.instanceID=Gt(),this._attributeMap=new Map,this._attributes=[],this._vertexBuffer=new Yc}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 g,new g(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 Kc;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 Hc,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 s=t.data[i*3+0],o=t.data[i*3+1],l=t.data[i*3+2];let c=new g(a[s*3+0],a[s*3+1],a[s*3+2]),f=new g(a[o*3+0],a[o*3+1],a[o*3+2]),h=new g(a[l*3+0],a[l*3+1],a[l*3+2]);r.push(c,f),r.push(f,h),r.push(h,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 s=0;s<a.data.length/3;s++){const o=a.data[s*3+0],l=a.data[s*3+1],c=a.data[s*3+2];let f=new g(r[o*t+0],r[o*t+1],r[o*t+2]),h=new g(r[l*t+0],r[l*t+1],r[l*t+2]),u=new g(r[c*t+0],r[c*t+1],r[c*t+2]);i.push(f,h),i.push(h,u),i.push(u,f)}return this._wireframeLines=i,i}}return null}compute(){this._indicesBuffer&&this._indicesBuffer.compute(),this._vertexBuffer&&this._vertexBuffer.compute()}static crossA=g.UP.clone();static crossB=g.UP.clone();static crossRet=g.UP.clone();static point1=g.UP.clone();static point2=g.UP.clone();static point3=g.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=Ve.point1,s=Ve.point2,o=Ve.point3,l=Ve.crossA,c=Ve.crossB,f=Ve.crossRet;for(let h=0;h<r;h++){let u=a.data[h*3],b=a.data[h*3+1],A=a.data[h*3+2];i.set(e.data[u*3],e.data[u*3+1],e.data[u*3+2]),s.set(e.data[b*3],e.data[b*3+1],e.data[b*3+2]),o.set(e.data[A*3],e.data[A*3+1],e.data[A*3+2]),g.sub(i,s,l).normalize(),g.sub(i,o,c).normalize();let m=l.crossProduct(c,f).normalize();t.data[u*3]=t.data[b*3]=t.data[A*3]=m.x,t.data[u*3+1]=t.data[b*3+1]=t.data[A*3+1]=m.y,t.data[u*3+2]=t.data[b*3+2]=t.data[A*3+2]=m.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 Sn extends Ve{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 Si extends dt{_dataBuffer;create(e,t,a,r=!1){let i=I.device;const s=Math.ceil(e*4/256)*256;this.format=le.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=E.beginCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:s},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(l),r&&pa.webGPUGenerateMipmap(this),this}updateTexture(e,t,a,r,i){let s=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,h=r*e*4,u=a.subarray(h,h+f*e*4),b=u.byteLength;(!this._dataBuffer||this._dataBuffer.size<b)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=s.createBuffer({size:b,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),s.queue.writeBuffer(this._dataBuffer,0,u.buffer,u.byteOffset,u.byteLength);const A=E.beginCommandEncoder();A.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:o,offset:0},{texture:this.getGPUTexture(),origin:[0,r,0]},{width:e,height:f,depthOrArrayLayers:1}),E.endCommandEncoder(A);return}this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null;const l=this._dataBuffer=s.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});s.queue.writeBuffer(l,0,a.buffer);const c=E.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:o},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(c),this.gpuSampler=s.createSampler(this),this.mipmapCount>1&&pa.webGPUGenerateMipmap(this)}}class xn extends dt{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4*4;this.format=le.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 s=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);s.queue.writeTexture({texture:this.getGPUTexture(),origin:[0,r,0]},f.buffer,{bytesPerRow:o,offset:f.byteOffset},{width:e,height:l,depthOrArrayLayers:1});return}s.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:o},{width:e,height:t,depthOrArrayLayers:1})}}class Ds extends dt{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4;this.format=le.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 qc=new Float32Array(1),u2=new Int32Array(qc.buffer);function $c(n,e,t,a){for(let r=0;r<a;r++){const i=n[t+r];qc[0]=i;const s=u2[0];let o=s>>16&32768,l=s>>12&2047;const c=s>>23&255;if(c<103){e[t+r]=o;continue}if(c>142){o|=31744,o|=(c==255?1:0)&&s&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 _s extends dt{uint16Array;floatArray;_dataBuffer;create(e,t,a=null,r=!0){if(a==null){a=[];for(let i=0,s=e*t*4;i<s;i++)a[i]=0}return this.updateTexture(e,t,a,r),this}updateTexture(e,t,a,r=!0,i,s){(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=le.rgba16float,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format),i!==void 0&&s!==void 0&&s<t){const u=s,b=i*e*4,A=u*e*4;(!this.uint16Array||this.uint16Array.length<b+A)&&(!this.uint16Array||this.uint16Array.length<a.length)&&(this.uint16Array=new Uint16Array(a.length));const m=this.uint16Array;$c(a,m,b,A);const p=m.subarray(b,b+A),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 _=E.beginCommandEncoder();_.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:l,offset:0},{texture:this.getGPUTexture(),origin:[0,i,0]},{width:e,height:u,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),E.endCommandEncoder(_);return}(!this.uint16Array||this.uint16Array.length!=a.length)&&(this.uint16Array=new Uint16Array(a.length));const c=this.uint16Array;$c(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 h=E.beginCommandEncoder();h.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"),E.endCommandEncoder(h),this.gpuSampler=o.createSampler(this),this.gpuTexture=this.getGPUTexture(),this.mipmapCount>1&&pa.webGPUGenerateMipmap(this)}}const e0=new Float32Array(1),b2=new Int32Array(e0.buffer);let qa=function(n){e0[0]=n;const e=b2[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 g2=Object.getOwnPropertyDescriptor,m2=(n,e,t,a)=>{for(var r=a>1?void 0:a?g2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.GSplatRenderer=class extends Ba{count=0;size=new fe;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(e){this.count=e.count,this._fullCount=e.count,this.size=this.evalTextureSize(e.count),this.buildColor(e),this.buildTransform(e),this.texParams=new Float32Array([this.count,this.size.x,this.count,1]),this._positions=e.position;const t=this.size.x*this.size.y;this._orderData=new Uint32Array(t);for(let a=0;a<t;a++)this._orderData[a]=a<this.count?a:this.count>0?this.count-1:0;this.splatOrder=new Ds().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 Cn,this.geometry=new Sn(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}onBeforeUpdate(e){this.count>0&&e?.camera&&(this._lodEnabled&&this.updateLOD(e),e.camera.viewMatrix&&this.scheduleOrder(e.camera.viewMatrix))}updateLOD(e){if(!this._worldPositions||this._fullCount===0)return;const a=e.camera.viewMatrix.rawData,r=-(a[0]*a[12]+a[1]*a[13]+a[2]*a[14]),i=-(a[4]*a[12]+a[5]*a[13]+a[6]*a[14]),s=-(a[8]*a[12]+a[9]*a[13]+a[10]*a[14]);let o=0,l=0,c=0;const f=Math.min(100,this._fullCount);for(let p=0;p<f;p++){const D=Math.floor(p/f*this._fullCount)*3;o+=this._worldPositions[D+0],l+=this._worldPositions[D+1],c+=this._worldPositions[D+2]}o/=f,l/=f,c/=f;const h=r-o,u=i-l,b=s-c,A=Math.sqrt(h*h+u*u+b*b);let m=this._lodDistances.length;for(let p=0;p<this._lodDistances.length;p++)if(A<this._lodDistances[p]){m=p;break}if(m!==this._currentLodLevel){this._currentLodLevel=m;const p=this._lodRatios[m],D=Math.floor(this._fullCount*p);if(this._mapping){const _=this._mapping;this._mapping=new Uint32Array(Math.min(D,_.length));for(let v=0;v<this._mapping.length;v++)this._mapping[v]=_[v];this.setMapping(this._mapping)}else this.count=D,this.texParams[0]=this.count,this.texParams[2]=this.count}}setMapping(e){this._mapping=e&&e.length>0?e: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 t=this.size.x*this.size.y;for(let a=0;a<t;a++)this._orderData[a]=a<this.count?a:this.count>0?this.count-1:0;if(this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData),this._sortWorker){const a=this._worldPositions||this._positions,r=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(a);if(this._mapping)for(let i=0;i<this._mapping.length;++i){const s=this._mapping[i]*3,o=i*3;r[o+0]=a[s+0],r[o+1]=a[s+1],r[o+2]=a[s+2]}this._sortWorker.postMessage({type:"centers",centers:r.buffer,mapping:this._mapping?this._mapping:null},[r.buffer]),this._centersSent=!0}else this._centersSent=!1;this.instanceCount=0}setVisBoost(e){this.texParams[3]=Math.max(0,e)}setSortThrottle(e){this._minIntervalMs=Math.max(0,e|0)}setAdaptiveSorting(e){this._adaptiveSorting=e}setLOD(e,t,a){this._lodEnabled=e,t&&(this._lodDistances=t),a&&(this._lodRatios=a)}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(e,t=0,a=0){this._minPixelCoverage=Math.max(0,e),this._maxPixelCoverage=Math.max(0,t),this._maxPixelCullDistance=Math.max(0,a)}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(e){let t=Math.ceil(Math.sqrt(e));const a=64;t=Math.ceil(t/a)*a;const r=Math.ceil(e/t);return new fe(t,r)}buildColor(e){const t=this.size.x|0,a=this.size.y|0,r=new Uint8Array(t*a*4),i=.28209479177387814,s=e.count,o=e.sh?.coeffs,l=o?o.length/(3*s):1;for(let c=0;c<s;c++){let f=.5,h=.5,u=.5;if(o&&l>=1){const m=c*l*3;f=.5+o[m+0]*i,h=.5+o[m+l+0]*i,u=.5+o[m+2*l+0]*i}const b=e.opacity?1/(1+Math.exp(-e.opacity[c])):1,A=c*4;r[A+0]=Math.max(0,Math.min(255,Math.floor(f*255))),r[A+1]=Math.max(0,Math.min(255,Math.floor(h*255))),r[A+2]=Math.max(0,Math.min(255,Math.floor(u*255))),r[A+3]=Math.max(0,Math.min(255,Math.floor(b*255)))}this.splatColor=new Si().create(t,a,r,!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(e){const t=this.size.x|0,a=this.size.y|0,r=e.count,i=new Uint32Array(t*a*4),s=new Array(t*a*4).fill(0),o=new ArrayBuffer(4),l=new Float32Array(o),c=new Uint32Array(o),f=A=>(l[0]=A,c[0]),h=e.position,u=e.rotation,b=e.scale;for(let A=0;A<r;A++){const m=A*4,p=h[A*3+0],D=h[A*3+1],_=h[A*3+2];i[m+0]=f(p),i[m+1]=f(D),i[m+2]=f(_);let v=0,U=0,y=0,S=1;if(u){v=u[A*4+0],U=u[A*4+1],y=u[A*4+2],S=u[A*4+3];const Pt=1/Math.hypot(v,U,y,S);v*=Pt,U*=Pt,y*=Pt,S*=Pt}let F=1,k=1,x=1;b&&(F=Math.exp(b[A*3+0]),k=Math.exp(b[A*3+1]),x=Math.exp(b[A*3+2]));const w=v+v,R=U+U,Q=y+y,M=v*w,j=v*R,he=v*Q,ae=U*R,P=U*Q,z=y*Q,W=S*w,V=S*R,te=S*Q,J=1-(ae+z),K=j+te,ee=he-V,re=j-te,oe=1-(M+z),pe=P+W,Te=he+V,Oe=P-W,q=1-(M+ae),ie=J*F,ce=K*F,ge=ee*F,we=re*k,me=oe*k,ye=pe*k,Qe=Te*x,Re=Oe*x,Le=q*x,Ut=ie*ie+we*we+Qe*Qe,je=ie*ce+we*me+Qe*Re,sr=ie*ge+we*ye+Qe*Le,Ea=ce*ce+me*me+Re*Re,za=ce*ge+me*ye+Re*Le,Wa=ge*ge+ye*ye+Le*Le,aa=m;s[aa+0]=Ut,s[aa+1]=je,s[aa+2]=sr,s[aa+3]=Wa;const Ja=qa(Ea)&65535,ua=qa(za)&65535;i[m+3]=Ja|ua<<16}this.transformA=new xn().create(t,a,i),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 _s().create(t,a,s,!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 e=this.object3D.transform.worldMatrix,t=this._positions,a=this._fullCount;this._worldPositions||(this._worldPositions=new Float32Array(t.length));const r=e.rawData;for(let i=0;i<a;i++){const s=i*3,o=t[s+0],l=t[s+1],c=t[s+2];this._worldPositions[s+0]=r[0]*o+r[4]*l+r[8]*c+r[12],this._worldPositions[s+1]=r[1]*o+r[5]*l+r[9]*c+r[13],this._worldPositions[s+2]=r[2]*o+r[6]*l+r[10]*c+r[14]}this._centersSent=!1}scheduleOrder(e){if(this.count===0)return;const t=this.object3D.transform.localChange;(t||!this._worldPositions)&&this.updateWorldPositions();const a=e.rawData,r=a[2],i=a[6],s=a[10],o=-(a[0]*a[12]+a[1]*a[13]+a[2]*a[14]),l=-(a[4]*a[12]+a[5]*a[13]+a[6]*a[14]),c=-(a[8]*a[12]+a[9]*a[13]+a[10]*a[14]),f=performance.now(),h=(f-this._lastSentTime)/1e3,u=Math.floor(o*1e3)^Math.floor(l*1e3)^Math.floor(c*1e3),b=Math.floor(r*1e3)^Math.floor(i*1e3)^Math.floor(s*1e3),A=u^b;if(A===this._lastViewMatrixHash&&!t)return;let m=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const D=Math.abs(A-this._lastViewMatrixHash)/Math.max(h,.001);D<1e3?m=this._minIntervalMs:D<1e4?m=this._minIntervalMs*.5:m=this._minIntervalMs*.2,this._lastCameraSpeed=D}if(!(f-this._lastSentTime<m)){if(this._lastViewMatrixHash=A,this._lastSentTime=f,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=v=>{const U=v.data.order,y=this._orderData.buffer;this._sortWorker.postMessage({order:y},[y]);const S=new Uint32Array(U),F=this.size.x*this.size.y,k=this.count;(!this._orderData||this._orderData.length!==F)&&(this._orderData=new Uint32Array(F));const x=Math.min(k,S.length);if(this._orderData.set(S.subarray(0,x),0),x<F){const Q=k>0?k-1:0;this._orderData.fill(Q,x,F)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const w=Math.max(0,Math.min(this.count,v.data.count|0));this.texParams[2]=w;const R=Math.ceil(w/this._batchSize);this.instanceCount=R};const p=this._worldPositions||this._positions,D=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(p);if(this._mapping)for(let v=0;v<this._mapping.length;++v){const U=this._mapping[v]*3,y=v*3;D[y+0]=p[U+0],D[y+1]=p[U+1],D[y+2]=p[U+2]}const _=new Uint32Array(this.count);for(let v=0;v<this.count;v++)_[v]=v;this._sortWorker.postMessage({order:_.buffer,centers:D.buffer,mapping:this._mapping},[_.buffer,D.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const p=this._worldPositions||this._positions,D=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(p);if(this._mapping)for(let _=0;_<this._mapping.length;++_){const v=this._mapping[_]*3,U=_*3;D[U+0]=p[v+0],D[U+1]=p[v+1],D[U+2]=p[v+2]}this._sortWorker.postMessage({type:"centers",centers:D.buffer,mapping:this._mapping?this._mapping:null},[D.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:o,y:l,z:c},cameraDirection:{x:-r,y:-i,z:-s}})}}createSortWorker(){function e(){let o,l,c,f,h,u=!1;const b={x:0,y:0,z:0},A={x:0,y:0,z:0},m={x:0,y:0,z:0},p={x:0,y:0,z:0};let D,_;const v=(y,S,F)=>{for(;y<=S;){const k=S+y>>1,x=F(k);if(x>0)y=k+1;else if(x<0)S=k-1;else return k}return~y},U=()=>{if(!o||!l||!f||!h)return;const y=f.x,S=f.y,F=f.z,k=h.x,x=h.y,w=h.z,R=.001;if(!u&&Math.abs(y-b.x)<R&&Math.abs(S-b.y)<R&&Math.abs(F-b.z)<R&&Math.abs(k-A.x)<R&&Math.abs(x-A.y)<R&&Math.abs(w-A.z)<R)return;u=!1,b.x=y,b.y=S,b.z=F,A.x=k,A.y=x,A.z=w;const Q=l.length/3;D?.length!==Q&&(D=new Uint32Array(Q));let M,j;for(let V=0;V<8;++V){const te=(V&1?m.x:p.x)-y,J=(V&2?m.y:p.y)-S,K=(V&4?m.z:p.z)-F,ee=te*k+J*x+K*w;V===0?M=j=ee:(M=Math.min(M,ee),j=Math.max(j,ee))}_?_.fill(0):_=new Uint32Array(65537);const he=j-M,ae=he<1e-6?0:1/he*2**16;for(let V=0;V<Q;++V){const te=V*3,J=l[te+0]-y,K=l[te+1]-S,ee=l[te+2]-F,re=J*k+K*x+ee*w,oe=Math.floor((re-M)*ae);D[V]=oe,_[oe]++}for(let V=1;V<65537;V++)_[V]+=_[V-1];for(let V=0;V<Q;V++){const te=D[V],J=--_[te];o[J]=V}const P=V=>D[o[V]]/ae+M,z=()=>{const V=v(0,Q-1,te=>-P(te));return Math.min(Q,Math.abs(V))},W=P(Q-1)>=0?z():Q;if(c)for(let V=0;V<Q;++V)o[V]=c[o[V]];self.postMessage({order:o.buffer,count:W},[o.buffer]),o=null};self.onmessage=y=>{if(y.data.order&&(o=new Uint32Array(y.data.order)),y.data.centers){l=new Float32Array(y.data.centers),m.x=p.x=l[0],m.y=p.y=l[1],m.z=p.z=l[2];const S=l.length/3;for(let F=1;F<S;++F){const k=l[F*3+0],x=l[F*3+1],w=l[F*3+2];m.x=Math.min(m.x,k),m.y=Math.min(m.y,x),m.z=Math.min(m.z,w),p.x=Math.max(p.x,k),p.y=Math.max(p.y,x),p.z=Math.max(p.z,w)}u=!0}y.data.hasOwnProperty("mapping")&&(c=y.data.mapping?new Uint32Array(y.data.mapping):null,u=!0),y.data.cameraPosition&&(f=y.data.cameraPosition),y.data.cameraDirection&&(h=y.data.cameraDirection),U()}}const t=`(${e.toString()})()`,a=new Blob([t],{type:"application/javascript"}),r=URL.createObjectURL(a);return new Worker(r)}nodeUpdate(e,t,a,r){const i=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(i);const s=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;s!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=s),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(e,t,a,r)}renderPass(e,t,a){const r=a.encoder;for(let i of this.materials){const s=i.getPass(t);if(!(!s||s.length===0))for(const o of s){if(!o.pipeline)continue;o.apply(this.geometry,a.rendererPassState||a),E.bindPipeline(r,o),E.bindGeometryBuffer(r,this.geometry);const c=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?E.drawIndexed(r,c.indexCount,this.instanceCount,c.indexStart,0,0):E.drawIndexed(r,c.indexCount,1,c.indexStart,0,0)}}}destroy(e){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(e),this.splatColor=null),this.transformA&&(this.transformA.destroy(e),this.transformA=null),this.transformB&&(this.transformB.destroy(e),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(e),this.splatOrder=null),this._positions=null,this._worldPositions=null,this._orderData=null,this.texParams=null,this._mapping=null,super.destroy(e)}},d.GSplatRenderer=m2([Nt(d.GSplatRenderer,"GSplatRenderer")],d.GSplatRenderer);const t0=`
6023
+ `;class gt{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(de.COLOR)}getDefaultColorShader(){return this.passShader.get(de.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 gt,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 d2=Object.getOwnPropertyDescriptor,h2=(n,e,t,a)=>{for(var r=a>1?void 0:a?d2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.GSplatShader=class extends gt{constructor(){super();const e=new qe("gsplat_vs_dc","gsplat_fs_dc");e.passType=de.COLOR,e.setShaderEntry("VertMain","FragMain"),e.topology=ls.triangle_list,e.depthWriteEnabled=!1,e.cullMode=Vt.none,e.shaderState.transparent=!0,e.shaderState.blendMode=Ae.NORMAL,e.shaderState.writeMasks=[15,0],e.shaderState.castReflection=!1,e.shaderState.depthCompare=it.less,this.addRenderPass(e),this.setDefault()}setDefault(){const e=this.getDefaultColorShader(),t=new T;e.setUniform("modelMatrix",t.rawData),e.setUniform("pixelCull",new Float32Array([2,0,0,0]))}},d.GSplatShader=h2([Ta(d.GSplatShader,"GSplatShader")],d.GSplatShader);class Cn extends Dt{_pixelCullArray=new Float32Array(4);constructor(){super(),X.register("gsplat_vs_dc",jc),X.register("gsplat_fs_dc",Zc),this.shader=new d.GSplatShader}setSplatTextures(e,t,a,r,i){const s=this.shader.getDefaultColorShader();s.setTexture("splatColor",e),s.setTexture("transformA",t),s.setTexture("transformB",a),s.setUniformArray("tex_params",r),i&&s.setTexture("splatOrder",i),s.shaderState.depthCompare=it.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 As extends Za{node;constructor(e){super(),this.bufferType=ga.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 or,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),this.node=this.memory.allocation_node(this.byteSize)}}var kt=(n=>(n[n.split=0]="split",n[n.compose=1]="compose",n[n.compose_bin=2]="compose_bin",n))(kt||{});class Yc{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 s={name:i.name,format:i.format,offset:0,shaderLocation:i.location,stride:cr[i.format]};this._attributeSlotLayouts[i.location]=[s];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/s.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 As(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 s={name:i.name,format:i.format,offset:a*4,shaderLocation:i.location,stride:cr[i.format]};this._attributeSlotLayouts[0][i.location]=s;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/s.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 As(this.vertexCount*a)}createComposBinVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let s=0;s<t.attributes.length;s++){const o=t.attributes[s];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:cr[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 As(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 s=t.data[a*r.stride+i],o=a*(this._vertexBufferLayouts[0].arrayStride/4)+r.offset/4+i;this.vertexGPUBuffer.node.setFloat(s,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 s=e.get(i.name);for(let o=0;o<i.stride;o++){let l=s.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 Xc extends Za{indicesNode;constructor(e){super(),this.bufferType=ga.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 or,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 Hc{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 Xc(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 Kc{lodLevels}class Ve{instanceID;name;subGeometries=[];morphTargetsRelative;morphTargetDictionary;skinNames;bindPose;blendShapeData;vertexDim;vertexCount=0;_bounds;_attributeMap;_attributes;_indicesBuffer;_vertexBuffer;_onChange=!0;_wireframeLines;_isDestroyed=!1;constructor(){this.instanceID=Gt(),this._attributeMap=new Map,this._attributes=[],this._vertexBuffer=new Yc}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 g,new g(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 Kc;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 Hc,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 s=t.data[i*3+0],o=t.data[i*3+1],l=t.data[i*3+2];let c=new g(a[s*3+0],a[s*3+1],a[s*3+2]),f=new g(a[o*3+0],a[o*3+1],a[o*3+2]),h=new g(a[l*3+0],a[l*3+1],a[l*3+2]);r.push(c,f),r.push(f,h),r.push(h,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 s=0;s<a.data.length/3;s++){const o=a.data[s*3+0],l=a.data[s*3+1],c=a.data[s*3+2];let f=new g(r[o*t+0],r[o*t+1],r[o*t+2]),h=new g(r[l*t+0],r[l*t+1],r[l*t+2]),u=new g(r[c*t+0],r[c*t+1],r[c*t+2]);i.push(f,h),i.push(h,u),i.push(u,f)}return this._wireframeLines=i,i}}return null}compute(){this._indicesBuffer&&this._indicesBuffer.compute(),this._vertexBuffer&&this._vertexBuffer.compute()}static crossA=g.UP.clone();static crossB=g.UP.clone();static crossRet=g.UP.clone();static point1=g.UP.clone();static point2=g.UP.clone();static point3=g.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=Ve.point1,s=Ve.point2,o=Ve.point3,l=Ve.crossA,c=Ve.crossB,f=Ve.crossRet;for(let h=0;h<r;h++){let u=a.data[h*3],b=a.data[h*3+1],A=a.data[h*3+2];i.set(e.data[u*3],e.data[u*3+1],e.data[u*3+2]),s.set(e.data[b*3],e.data[b*3+1],e.data[b*3+2]),o.set(e.data[A*3],e.data[A*3+1],e.data[A*3+2]),g.sub(i,s,l).normalize(),g.sub(i,o,c).normalize();let m=l.crossProduct(c,f).normalize();t.data[u*3]=t.data[b*3]=t.data[A*3]=m.x,t.data[u*3+1]=t.data[b*3+1]=t.data[A*3+1]=m.y,t.data[u*3+2]=t.data[b*3+2]=t.data[A*3+2]=m.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 Sn extends Ve{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 Si extends dt{_dataBuffer;create(e,t,a,r=!1){let i=I.device;const s=Math.ceil(e*4/256)*256;this.format=le.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=E.beginCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:s},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(l),r&&pa.webGPUGenerateMipmap(this),this}updateTexture(e,t,a,r,i){let s=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,h=r*e*4,u=a.subarray(h,h+f*e*4),b=u.byteLength;(!this._dataBuffer||this._dataBuffer.size<b)&&(this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=s.createBuffer({size:b,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC})),s.queue.writeBuffer(this._dataBuffer,0,u.buffer,u.byteOffset,u.byteLength);const A=E.beginCommandEncoder();A.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:o,offset:0},{texture:this.getGPUTexture(),origin:[0,r,0]},{width:e,height:f,depthOrArrayLayers:1}),E.endCommandEncoder(A);return}this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null;const l=this._dataBuffer=s.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});s.queue.writeBuffer(l,0,a.buffer);const c=E.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:o},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(c),this.gpuSampler=s.createSampler(this),this.mipmapCount>1&&pa.webGPUGenerateMipmap(this)}}class xn extends dt{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4*4;this.format=le.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 s=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);s.queue.writeTexture({texture:this.getGPUTexture(),origin:[0,r,0]},f.buffer,{bytesPerRow:o,offset:f.byteOffset},{width:e,height:l,depthOrArrayLayers:1});return}s.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:o},{width:e,height:t,depthOrArrayLayers:1})}}class Ds extends dt{_dataBuffer;create(e,t,a){let r=I.device;const i=e*4;this.format=le.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 qc=new Float32Array(1),u2=new Int32Array(qc.buffer);function $c(n,e,t,a){for(let r=0;r<a;r++){const i=n[t+r];qc[0]=i;const s=u2[0];let o=s>>16&32768,l=s>>12&2047;const c=s>>23&255;if(c<103){e[t+r]=o;continue}if(c>142){o|=31744,o|=(c==255?1:0)&&s&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 _s extends dt{uint16Array;floatArray;_dataBuffer;create(e,t,a=null,r=!0){if(a==null){a=[];for(let i=0,s=e*t*4;i<s;i++)a[i]=0}return this.updateTexture(e,t,a,r),this}updateTexture(e,t,a,r=!0,i,s){(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=le.rgba16float,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format),i!==void 0&&s!==void 0&&s<t){const u=s,b=i*e*4,A=u*e*4;(!this.uint16Array||this.uint16Array.length<b+A)&&(!this.uint16Array||this.uint16Array.length<a.length)&&(this.uint16Array=new Uint16Array(a.length));const m=this.uint16Array;$c(a,m,b,A);const p=m.subarray(b,b+A),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 _=E.beginCommandEncoder();_.copyBufferToTexture({buffer:this._dataBuffer,bytesPerRow:l,offset:0},{texture:this.getGPUTexture(),origin:[0,i,0]},{width:e,height:u,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),E.endCommandEncoder(_);return}(!this.uint16Array||this.uint16Array.length!=a.length)&&(this.uint16Array=new Uint16Array(a.length));const c=this.uint16Array;$c(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 h=E.beginCommandEncoder();h.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"),E.endCommandEncoder(h),this.gpuSampler=o.createSampler(this),this.gpuTexture=this.getGPUTexture(),this.mipmapCount>1&&pa.webGPUGenerateMipmap(this)}}const e0=new Float32Array(1),b2=new Int32Array(e0.buffer);let qa=function(n){e0[0]=n;const e=b2[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 g2=Object.getOwnPropertyDescriptor,m2=(n,e,t,a)=>{for(var r=a>1?void 0:a?g2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.GSplatRenderer=class extends Ba{count=0;size=new fe;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(e){this.count=e.count,this._fullCount=e.count,this.size=this.evalTextureSize(e.count),this.buildColor(e),this.buildTransform(e),this.texParams=new Float32Array([this.count,this.size.x,this.count,1]),this._positions=e.position;const t=this.size.x*this.size.y;this._orderData=new Uint32Array(t);for(let a=0;a<t;a++)this._orderData[a]=a<this.count?a:this.count>0?this.count-1:0;this.splatOrder=new Ds().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 Cn,this.geometry=new Sn(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}onBeforeUpdate(e){this.count>0&&e?.camera&&(this._lodEnabled&&this.updateLOD(e),e.camera.viewMatrix&&this.scheduleOrder(e.camera.viewMatrix))}updateLOD(e){if(!this._worldPositions||this._fullCount===0)return;const a=e.camera.viewMatrix.rawData,r=-(a[0]*a[12]+a[1]*a[13]+a[2]*a[14]),i=-(a[4]*a[12]+a[5]*a[13]+a[6]*a[14]),s=-(a[8]*a[12]+a[9]*a[13]+a[10]*a[14]);let o=0,l=0,c=0;const f=Math.min(100,this._fullCount);for(let p=0;p<f;p++){const D=Math.floor(p/f*this._fullCount)*3;o+=this._worldPositions[D+0],l+=this._worldPositions[D+1],c+=this._worldPositions[D+2]}o/=f,l/=f,c/=f;const h=r-o,u=i-l,b=s-c,A=Math.sqrt(h*h+u*u+b*b);let m=this._lodDistances.length;for(let p=0;p<this._lodDistances.length;p++)if(A<this._lodDistances[p]){m=p;break}if(m!==this._currentLodLevel){this._currentLodLevel=m;const p=this._lodRatios[m],D=Math.floor(this._fullCount*p);if(this._mapping){const _=this._mapping;this._mapping=new Uint32Array(Math.min(D,_.length));for(let v=0;v<this._mapping.length;v++)this._mapping[v]=_[v];this.setMapping(this._mapping)}else this.count=D,this.texParams[0]=this.count,this.texParams[2]=this.count}}setMapping(e){this._mapping=e&&e.length>0?e: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 t=this.size.x*this.size.y;for(let a=0;a<t;a++)this._orderData[a]=a<this.count?a:this.count>0?this.count-1:0;if(this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData),this._sortWorker){const a=this._worldPositions||this._positions,r=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(a);if(this._mapping)for(let i=0;i<this._mapping.length;++i){const s=this._mapping[i]*3,o=i*3;r[o+0]=a[s+0],r[o+1]=a[s+1],r[o+2]=a[s+2]}this._sortWorker.postMessage({type:"centers",centers:r.buffer,mapping:this._mapping?this._mapping:null},[r.buffer]),this._centersSent=!0}else this._centersSent=!1;this.instanceCount=0}setVisBoost(e){this.texParams[3]=Math.max(0,e)}setSortThrottle(e){this._minIntervalMs=Math.max(0,e|0)}setAdaptiveSorting(e){this._adaptiveSorting=e}setLOD(e,t,a){this._lodEnabled=e,t&&(this._lodDistances=t),a&&(this._lodRatios=a)}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(e,t=0,a=0){this._minPixelCoverage=Math.max(0,e),this._maxPixelCoverage=Math.max(0,t),this._maxPixelCullDistance=Math.max(0,a)}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(e){let t=Math.ceil(Math.sqrt(e));const a=64;t=Math.ceil(t/a)*a;const r=Math.ceil(e/t);return new fe(t,r)}buildColor(e){const t=this.size.x|0,a=this.size.y|0,r=new Uint8Array(t*a*4),i=.28209479177387814,s=e.count,o=e.sh?.coeffs,l=o?o.length/(3*s):1;for(let c=0;c<s;c++){let f=.5,h=.5,u=.5;if(o&&l>=1){const m=c*l*3;f=.5+o[m+0]*i,h=.5+o[m+l+0]*i,u=.5+o[m+2*l+0]*i}const b=e.opacity?1/(1+Math.exp(-e.opacity[c])):1,A=c*4;r[A+0]=Math.max(0,Math.min(255,Math.floor(f*255))),r[A+1]=Math.max(0,Math.min(255,Math.floor(h*255))),r[A+2]=Math.max(0,Math.min(255,Math.floor(u*255))),r[A+3]=Math.max(0,Math.min(255,Math.floor(b*255)))}this.splatColor=new Si().create(t,a,r,!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(e){const t=this.size.x|0,a=this.size.y|0,r=e.count,i=new Uint32Array(t*a*4),s=new Array(t*a*4).fill(0),o=new ArrayBuffer(4),l=new Float32Array(o),c=new Uint32Array(o),f=A=>(l[0]=A,c[0]),h=e.position,u=e.rotation,b=e.scale;for(let A=0;A<r;A++){const m=A*4,p=h[A*3+0],D=h[A*3+1],_=h[A*3+2];i[m+0]=f(p),i[m+1]=f(D),i[m+2]=f(_);let v=0,U=0,y=0,S=1;if(u){v=u[A*4+0],U=u[A*4+1],y=u[A*4+2],S=u[A*4+3];const Pt=1/Math.hypot(v,U,y,S);v*=Pt,U*=Pt,y*=Pt,S*=Pt}let F=1,k=1,x=1;b&&(F=Math.exp(b[A*3+0]),k=Math.exp(b[A*3+1]),x=Math.exp(b[A*3+2]));const w=v+v,R=U+U,Q=y+y,M=v*w,j=v*R,he=v*Q,ae=U*R,P=U*Q,z=y*Q,W=S*w,V=S*R,te=S*Q,J=1-(ae+z),K=j+te,ee=he-V,re=j-te,oe=1-(M+z),pe=P+W,Te=he+V,Oe=P-W,q=1-(M+ae),ie=J*F,ce=K*F,ge=ee*F,we=re*k,me=oe*k,ye=pe*k,Qe=Te*x,Re=Oe*x,Le=q*x,Ut=ie*ie+we*we+Qe*Qe,je=ie*ce+we*me+Qe*Re,sr=ie*ge+we*ye+Qe*Le,Ea=ce*ce+me*me+Re*Re,za=ce*ge+me*ye+Re*Le,Wa=ge*ge+ye*ye+Le*Le,aa=m;s[aa+0]=Ut,s[aa+1]=je,s[aa+2]=sr,s[aa+3]=Wa;const Ja=qa(Ea)&65535,ua=qa(za)&65535;i[m+3]=Ja|ua<<16}this.transformA=new xn().create(t,a,i),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 _s().create(t,a,s,!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 e=this.object3D.transform.worldMatrix,t=this._positions,a=this._fullCount;this._worldPositions||(this._worldPositions=new Float32Array(t.length));const r=e.rawData;for(let i=0;i<a;i++){const s=i*3,o=t[s+0],l=t[s+1],c=t[s+2];this._worldPositions[s+0]=r[0]*o+r[4]*l+r[8]*c+r[12],this._worldPositions[s+1]=r[1]*o+r[5]*l+r[9]*c+r[13],this._worldPositions[s+2]=r[2]*o+r[6]*l+r[10]*c+r[14]}this._centersSent=!1}scheduleOrder(e){if(this.count===0)return;const t=this.object3D.transform.localChange;(t||!this._worldPositions)&&this.updateWorldPositions();const a=e.rawData,r=a[2],i=a[6],s=a[10],o=-(a[0]*a[12]+a[1]*a[13]+a[2]*a[14]),l=-(a[4]*a[12]+a[5]*a[13]+a[6]*a[14]),c=-(a[8]*a[12]+a[9]*a[13]+a[10]*a[14]),f=performance.now(),h=(f-this._lastSentTime)/1e3,u=Math.floor(o*1e3)^Math.floor(l*1e3)^Math.floor(c*1e3),b=Math.floor(r*1e3)^Math.floor(i*1e3)^Math.floor(s*1e3),A=u^b;if(A===this._lastViewMatrixHash&&!t)return;let m=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const D=Math.abs(A-this._lastViewMatrixHash)/Math.max(h,.001);D<1e3?m=this._minIntervalMs:D<1e4?m=this._minIntervalMs*.5:m=this._minIntervalMs*.2,this._lastCameraSpeed=D}if(!(f-this._lastSentTime<m)){if(this._lastViewMatrixHash=A,this._lastSentTime=f,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=v=>{const U=v.data.order,y=this._orderData.buffer;this._sortWorker.postMessage({order:y},[y]);const S=new Uint32Array(U),F=this.size.x*this.size.y,k=this.count;(!this._orderData||this._orderData.length!==F)&&(this._orderData=new Uint32Array(F));const x=Math.min(k,S.length);if(this._orderData.set(S.subarray(0,x),0),x<F){const Q=k>0?k-1:0;this._orderData.fill(Q,x,F)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const w=Math.max(0,Math.min(this.count,v.data.count|0));this.texParams[2]=w;const R=Math.ceil(w/this._batchSize);this.instanceCount=R};const p=this._worldPositions||this._positions,D=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(p);if(this._mapping)for(let v=0;v<this._mapping.length;++v){const U=this._mapping[v]*3,y=v*3;D[y+0]=p[U+0],D[y+1]=p[U+1],D[y+2]=p[U+2]}const _=new Uint32Array(this.count);for(let v=0;v<this.count;v++)_[v]=v;this._sortWorker.postMessage({order:_.buffer,centers:D.buffer,mapping:this._mapping},[_.buffer,D.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const p=this._worldPositions||this._positions,D=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(p);if(this._mapping)for(let _=0;_<this._mapping.length;++_){const v=this._mapping[_]*3,U=_*3;D[U+0]=p[v+0],D[U+1]=p[v+1],D[U+2]=p[v+2]}this._sortWorker.postMessage({type:"centers",centers:D.buffer,mapping:this._mapping?this._mapping:null},[D.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:o,y:l,z:c},cameraDirection:{x:-r,y:-i,z:-s}})}}createSortWorker(){function e(){let o,l,c,f,h,u=!1;const b={x:0,y:0,z:0},A={x:0,y:0,z:0},m={x:0,y:0,z:0},p={x:0,y:0,z:0};let D,_;const v=(y,S,F)=>{for(;y<=S;){const k=S+y>>1,x=F(k);if(x>0)y=k+1;else if(x<0)S=k-1;else return k}return~y},U=()=>{if(!o||!l||!f||!h)return;const y=f.x,S=f.y,F=f.z,k=h.x,x=h.y,w=h.z,R=.001;if(!u&&Math.abs(y-b.x)<R&&Math.abs(S-b.y)<R&&Math.abs(F-b.z)<R&&Math.abs(k-A.x)<R&&Math.abs(x-A.y)<R&&Math.abs(w-A.z)<R)return;u=!1,b.x=y,b.y=S,b.z=F,A.x=k,A.y=x,A.z=w;const Q=l.length/3;D?.length!==Q&&(D=new Uint32Array(Q));let M,j;for(let V=0;V<8;++V){const te=(V&1?m.x:p.x)-y,J=(V&2?m.y:p.y)-S,K=(V&4?m.z:p.z)-F,ee=te*k+J*x+K*w;V===0?M=j=ee:(M=Math.min(M,ee),j=Math.max(j,ee))}_?_.fill(0):_=new Uint32Array(65537);const he=j-M,ae=he<1e-6?0:1/he*2**16;for(let V=0;V<Q;++V){const te=V*3,J=l[te+0]-y,K=l[te+1]-S,ee=l[te+2]-F,re=J*k+K*x+ee*w,oe=Math.floor((re-M)*ae);D[V]=oe,_[oe]++}for(let V=1;V<65537;V++)_[V]+=_[V-1];for(let V=0;V<Q;V++){const te=D[V],J=--_[te];o[J]=V}const P=V=>D[o[V]]/ae+M,z=()=>{const V=v(0,Q-1,te=>-P(te));return Math.min(Q,Math.abs(V))},W=P(Q-1)>=0?z():Q;if(c)for(let V=0;V<Q;++V)o[V]=c[o[V]];self.postMessage({order:o.buffer,count:W},[o.buffer]),o=null};self.onmessage=y=>{if(y.data.order&&(o=new Uint32Array(y.data.order)),y.data.centers){l=new Float32Array(y.data.centers),m.x=p.x=l[0],m.y=p.y=l[1],m.z=p.z=l[2];const S=l.length/3;for(let F=1;F<S;++F){const k=l[F*3+0],x=l[F*3+1],w=l[F*3+2];m.x=Math.min(m.x,k),m.y=Math.min(m.y,x),m.z=Math.min(m.z,w),p.x=Math.max(p.x,k),p.y=Math.max(p.y,x),p.z=Math.max(p.z,w)}u=!0}y.data.hasOwnProperty("mapping")&&(c=y.data.mapping?new Uint32Array(y.data.mapping):null,u=!0),y.data.cameraPosition&&(f=y.data.cameraPosition),y.data.cameraDirection&&(h=y.data.cameraDirection),U()}}const t=`(${e.toString()})()`,a=new Blob([t],{type:"application/javascript"}),r=URL.createObjectURL(a);return new Worker(r)}nodeUpdate(e,t,a,r){const i=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(i);const s=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;s!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=s),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(e,t,a,r)}renderPass(e,t,a){const r=a.encoder;for(let i of this.materials){const s=i.getPass(t);if(!(!s||s.length===0))for(const o of s){if(!o.pipeline)continue;o.apply(this.geometry,a.rendererPassState||a),E.bindPipeline(r,o),E.bindGeometryBuffer(r,this.geometry);const c=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?E.drawIndexed(r,c.indexCount,this.instanceCount,c.indexStart,0,0):E.drawIndexed(r,c.indexCount,1,c.indexStart,0,0)}}}destroy(e){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(e),this.splatColor=null),this.transformA&&(this.transformA.destroy(e),this.transformA=null),this.transformB&&(this.transformB.destroy(e),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(e),this.splatOrder=null),this._positions=null,this._worldPositions=null,this._orderData=null,this.texParams=null,this._mapping=null,super.destroy(e)}},d.GSplatRenderer=m2([Nt(d.GSplatRenderer,"GSplatRenderer")],d.GSplatRenderer);const t0=`
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 p2=Object.getOwnPropertyDescriptor,A2=(n,e,t,a)=>{for(var r=a>1?void 0:a?p2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.PointCloudShader=class extends gt{constructor(){super(),X.register("pointcloud_vs_dc",t0),X.register("pointcloud_fs_dc",a0);const e=new qe("pointcloud_vs_dc","pointcloud_fs_dc");e.passType=de.COLOR,e.setShaderEntry("VertMain","FragMain"),e.topology=ls.triangle_list,e.depthWriteEnabled=!0,e.cullMode=Vt.none,e.shaderState.transparent=!1,e.shaderState.blendMode=Ae.NORMAL,e.shaderState.writeMasks=[15,15],e.shaderState.castReflection=!1,this.addRenderPass(e),this.setDefault()}setDefault(){const e=this.getDefaultColorShader(),t=new T;e.setUniform("modelMatrix",t.rawData),e.setUniformArray("tex_params",new Float32Array([0,0,0,4])),e.setUniformArray("pointParams",new Float32Array([0,0,0,128]))}},d.PointCloudShader=A2([Ta(d.PointCloudShader,"PointCloudShader")],d.PointCloudShader);class r0 extends Dt{_texParams=new Float32Array([0,0,0,4]);_pointParamsArray=new Float32Array([0,0,0,128]);constructor(){super(),this.shader=new d.PointCloudShader}setPointTextures(e,t,a,r){const i=this.shader.getDefaultColorShader();if(!i.getUniform("modelMatrix")){const s=new T;i.setUniform("modelMatrix",s.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=lt.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 Fn extends Ve{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,s=r*6;a.set([0+i,1+i,2+i,0+i,2+i,3+i],s)}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 i0 extends dt{create(e,t,a,r=!0){let i=I.device;const s=e*4*4;this.format=le.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=E.beginCommandEncoder();return c.copyBufferToTexture({buffer:l,bytesPerRow:s},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.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=le.rgba32float,this.mipmapCount=1,this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const s=E.beginCommandEncoder();return s.copyBufferToTexture({buffer:a,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(s),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=r.createSampler({}),this}}var D2=Object.getOwnPropertyDescriptor,_2=(n,e,t,a)=>{for(var r=a>1?void 0:a?D2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.PointCloudRenderer=class extends Ba{count=0;size=new fe;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 g;get centerOffset(){return this._centerOffset}constructor(){super()}initFromData(e,t,a){if(!e||!t||a<=0){console.error("PointCloudRenderer: Invalid input data");return}if(e.length<a*3){console.error("PointCloudRenderer: Positions array too small");return}if(t.length<a*4){console.error("PointCloudRenderer: Colors array too small");return}this.count=a,this._fullCount=a,this.size=this.evalTextureSize(a),this._positions=e,this._colors=t,this.centerizePositions(),this.buildPositionTexture(),this.buildColorTexture(),this.texParams=new Float32Array([this.count,this.size.x,this.count,4]),this.buildOrderTexture(),this.pointCloudMaterial=new r0,this.geometry=new Fn(this._batchSize),this.materials=[this.pointCloudMaterial],this.instanceCount=Math.ceil(this.count/this._batchSize)}evalTextureSize(e){let t=Math.ceil(Math.sqrt(e));const a=64;t=Math.ceil(t/a)*a;const r=Math.ceil(e/t);return new fe(t,r)}centerizePositions(){if(this.count===0)return;let e=0,t=0,a=0;for(let o=0;o<this.count;o++){const l=o*3;e+=this._positions[l+0],t+=this._positions[l+1],a+=this._positions[l+2]}const r=e/this.count,i=t/this.count,s=a/this.count;this._centerOffset.set(r,i,s);for(let o=0;o<this.count;o++){const l=o*3;this._positions[l+0]-=r,this._positions[l+1]-=i,this._positions[l+2]-=s}this.object3D.localPosition=this._centerOffset}buildPositionTexture(){const e=this.size.x|0,t=this.size.y|0,a=this.count,r=new Float32Array(e*t*4);for(let i=0;i<a;i++){const s=i*4,o=i*3;r[s+0]=this._positions[o+0],r[s+1]=this._positions[o+1],r[s+2]=this._positions[o+2],r[s+3]=0}if(a<e*t){const i=(a-1)*4;for(let s=a;s<e*t;s++){const o=s*4;r[o+0]=r[i+0],r[o+1]=r[i+1],r[o+2]=r[i+2],r[o+3]=0}}this.pointPosition=new i0().create(e,t,r),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 e=this.size.x|0,t=this.size.y|0,a=this.count,r=new Uint8Array(e*t*4);for(let i=0;i<a;i++){const s=i*4,o=i*4;r[s+0]=this._colors[o+0],r[s+1]=this._colors[o+1],r[s+2]=this._colors[o+2],r[s+3]=this._colors[o+3]}if(a<e*t){const i=(a-1)*4;for(let s=a;s<e*t;s++){const o=s*4;r[o+0]=r[i+0],r[o+1]=r[i+1],r[o+2]=r[i+2],r[o+3]=r[i+3]}}this.pointColor=new Si().create(e,t,r,!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 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.pointOrder=new Ds().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(e,t,a,r){const i=this.object3D.transform.worldMatrix;this.pointCloudMaterial.setTransformMatrix(i),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(e,t,a,r)}renderPass(e,t,a){const r=a.encoder;for(let i of this.materials){const s=i.getPass(t);if(!(!s||s.length===0))for(const o of s){if(!o.pipeline)continue;o.apply(this.geometry,a.rendererPassState||a),E.bindPipeline(r,o),E.bindGeometryBuffer(r,this.geometry);const c=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?E.drawIndexed(r,c.indexCount,this.instanceCount,c.indexStart,0,0):E.drawIndexed(r,c.indexCount,1,c.indexStart,0,0)}}}setPointSize(e){this.texParams[3]=Math.max(.1,e),this.pointCloudMaterial&&this.pointCloudMaterial.setPointSize(e)}setPointShape(e){this.pointCloudMaterial&&this.pointCloudMaterial.setPointShape(e)}enableDebugFullScreen(e){this._debugFullScreen=e,this.pointCloudMaterial&&this.pointCloudMaterial.enableDebugFullScreen(e)}setBatchSize(e){if(this._batchSize=Math.max(1,e|0),this.geometry){const t=this.geometry;xe.getInstance().detached(t,this),xe.getInstance().hasReference(t)||t.destroy(),this.geometry=new Fn(this._batchSize)}this.pointCloudMaterial&&(this.pointCloudMaterial.setBatchSize(this._batchSize),this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen)),this.instanceCount=Math.ceil(this.count/this._batchSize)}destroy(e){this.pointColor&&(this.pointColor.destroy(e),this.pointColor=null),this.pointPosition&&(this.pointPosition.destroy(e),this.pointPosition=null),this.pointOrder&&(this.pointOrder.destroy(e),this.pointOrder=null),this._positions=null,this._colors=null,this._orderData=null,this.texParams=null,super.destroy(e)}},d.PointCloudRenderer=_2([Nt(d.PointCloudRenderer,"PointCloudRenderer")],d.PointCloudRenderer);class kn{static maxVector=new g(Number.MAX_VALUE*.1,Number.MAX_VALUE*.1,Number.MAX_VALUE*.1);static minVector=this.maxVector.clone().multiplyScalar(-1);static genMeshMaxVector=g.ZERO.clone();static genMeshMinVector=g.ZERO.clone();static genMeshVectorList8=[new g,new g,new g,new g,new g,new g,new g,new g];static genPointCloudBounds(e,t){t||=new Ce(g.ZERO,g.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(d.PointCloudRenderer);if(!a)return console.warn("genPointCloudBounds: No PointCloudRenderer found on object"),t;for(const r of a){const i=r.positions,s=r.fullCount;if(!i||s===0){console.warn("genPointCloudBounds: No position data available");continue}const o=r.object3D.transform.worldMatrix,l=new g;for(let c=0;c<s;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(g.ZERO,g.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(d.GSplatRenderer);if(!a)return console.warn("genGSplatBounds: No GSplatRenderer found on object"),t;for(const r of a){const i=r.positions,s=r.fullCount;if(!i||s===0)return console.warn("genGSplatBounds: No position data available"),t;const o=r.object3D.transform.worldMatrix,l=new g;for(let c=0;c<s;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(g.ZERO,g.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let s=e.getComponents(d.MeshRenderer);for(const o of s)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),s=this.genMeshVectorList8;a||=new Ce(g.ZERO,g.ZERO),a.setFromMinMax(this.maxVector,this.minVector),s[0].set(r.x,r.y,r.z),s[1].set(r.x,r.y,i.z),s[2].set(r.x,i.y,r.z),s[3].set(r.x,i.y,i.z),s[4].set(i.x,r.y,r.z),s[5].set(i.x,r.y,i.z),s[6].set(i.x,i.y,r.z),s[7].set(i.x,i.y,i.z);for(const o of s)e.transformPoint(o,o),a.expandByPoint(o);return i.copyFrom(a.max),r.copyFrom(a.min),a.setFromMinMax(r,i),a}}class s0 extends ja{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=tn().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&&(kn.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()):Ne.waitStartComponent.forEach((e,t)=>{for(;e.length>0;){const a=e.shift();a.__start(),Ne.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 B2=Object.getOwnPropertyDescriptor,v2=(n,e,t,a)=>{for(var r=a>1?void 0:a?B2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.Object3D=class extends s0{_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(e){this.entityChildren.forEach(t=>{e(t),t.forChild(e)})}addComponent(e,t){if(!this.components.has(e)){let a=new e;return a.object3D=this,this.components.set(e,a),a.__init(t),Ne.appendWaitStart(a),a}return this.components.get(e)}getOrAddComponent(e){let t=this.components.get(e);return t||(t=this.addComponent(e)),t}removeComponent(e){if(this.components.has(e)){let t=this.components.get(e);Ne.removeWaitStart(this,t),this.components.delete(e),t.__stop(),t.beforeDestroy(),t.destroy()}}hasComponent(e){return this.components.has(e)}getComponent(e){return this.components.get(e)}getComponentFromParent(e){if(!this.parent)return null;let t=this.parent.object3D.getComponent(e);return t||this.parent.object3D.getComponentFromParent(e)}getComponentsInChild(e){let t=[],a=this.components.get(e);a&&t.push(a);for(let r=0;r<this.entityChildren.length;r++){let s=this.entityChildren[r].getComponentsInChild(e);t.push(...s)}return t}getComponents(e,t,a){t||=[];let r=this.getComponent(e);r&&(r.enable||a)&&t.push(r);for(let i=0,s=this.entityChildren.length;i<s;i++){let o=this.entityChildren[i];o&&o instanceof d.Object3D&&o.getComponents(e,t,a)}return t}getComponentsExt(e,t,a){t||=[];let r=this.components.get(e);if(r&&(r.enable||a))t.push(r);else for(const i of this.entityChildren)i instanceof d.Object3D&&i.getComponentsExt(e,t,a);return t}getComponentsByProperty(e,t,a=!0,r,i){r||=[];let s;for(const o of this.components.values())o&&(o.enable||i)&&o[e]===t&&(r.push(o),s=!0);if(!(s&&a))for(const o of this.entityChildren)o instanceof d.Object3D&&o.getComponentsByProperty(e,t,a,r,i);return r}clone(){return this.instantiate()}instantiate(){let e=new d.Object3D;return e.name=this.name,e.serializeTag=this.serializeTag,e.prefabRef=this.prefabRef,this.entityChildren.forEach((t,a)=>{let r=t.instantiate();e.addChild(r)}),this.components.forEach((t,a)=>{t.cloneTo(e)}),e}get localPosition(){return this.transform.localPosition}set localPosition(e){this.transform.localPosition=e}get localRotation(){return this.transform.localRotation}set localRotation(e){this.transform.localRotation=e}get localScale(){return this.transform.localScale}set localScale(e){this.transform.localScale=e}get localQuaternion(){return this.transform.localRotQuat}set localQuaternion(e){this.transform.localRotQuat=e}notifyChange(){this.transform.notifyChange()}get parent(){return this.transform.parent}get parentObject(){return this.transform.parent.object3D}set x(e){this.transform.x=e}get x(){return this.transform.x}set y(e){this.transform.y=e}get y(){return this.transform.y}set z(e){this.transform.z=e}get z(){return this.transform.z}set scaleX(e){this.transform.scaleX=e}get scaleX(){return this.transform.scaleX}set scaleY(e){this.transform.scaleY=e}get scaleY(){return this.transform.scaleY}set scaleZ(e){this.transform.scaleZ=e}get scaleZ(){return this.transform.scaleZ}set rotationX(e){this.transform.rotationX=e}get rotationX(){return this.transform.rotationX}set rotationY(e){this.transform.rotationY=e}get rotationY(){return this.transform.rotationY}set rotationZ(e){this.transform.rotationZ=e}get rotationZ(){return this.transform.rotationZ}fixedUpdate(){}lateUpdate(){}traverse(e){e(this);for(let t=0,a=this.entityChildren.length;t<a;t++){let r=this.entityChildren[t];r instanceof d.Object3D&&r.traverse(e)}}destroy(e){this.transform.eventDispatcher.removeEventListener(zt.LOCAL_ONCHANGE,this.onTransformLocalChange,this);const t=this.batchTable;t&&typeof t.destroy=="function"&&(t.destroy(),this.batchTable=null);const a=this.featureTable;a&&typeof a.destroy=="function"&&(a.destroy(),this.featureTable=null),super.destroy(e)}},d.Object3D=v2([U2],d.Object3D);function U2(n,e){return class extends d.Object3D{set active(t){this.transform.enable=t>0}get active(){return this.transform.enable?1:0}get materialColor(){return this.getComponent(d.MeshRenderer)?.material?.shader.getDefaultColorShader().baseColor}set materialColor(t){let a=this.getComponent(d.MeshRenderer)?.material;a&&(a.shader.getDefaultColorShader().baseColor=t)}notifyMaterialColorChange(t,a){this.getComponent(d.MeshRenderer).materials?.[t]?.shader.getDefaultColorShader().uniforms[a].onChange()}}}class ht{static createCamera3DObject(e,t){return this.createCamera3D(null,e,t)}static createCamera3D(e,t,a){return e||=new d.Object3D,t&&t.addChild(e),a&&(e.name=a),e.getOrAddComponent(Hr)}static UnProjection(e,t,a=1,r){let i=new g(e,t,0),s=1,o=g.HELP_0,l=I.canvas.offsetLeft,c=I.canvas.offsetTop,f=I.canvas.clientWidth,h=I.canvas.clientHeight;o.x=((i.x-l)*s/f-.5)*2,o.y=-((i.y-c)*s/h-.5)*2,o.z=a;let u=new g(0,0,0),b=T.helpMatrix2;b.copyFrom(r.projectionMatrix),b.invert();let A=T.helpMatrix;return A.identity(),A.multiply(b),A.multiply(r.transform.worldMatrix),A.perspectiveMultiplyPoint3(o,u),u}static Projection(e,t,a){let r=a||new g(0,0,0),i=T.helpMatrix;i.copyFrom(t.viewMatrix),i.multiply(t.projectionMatrix),i.perspectiveMultiplyPoint3(e,r);let s=I.canvas.clientWidth/2,o=I.canvas.clientHeight/2;return r.x=r.x*s+s,r.y=o-r.y*o,r}static UnProjection2(e,t,a,r,i){let s=i||new g(0,0,0),o=T.helpMatrix;o.copyFrom(r.pvMatrixInv);let l=I.canvas.clientWidth/2,c=I.canvas.clientHeight/2;return s.x=(e-l)/l,s.y=(c-t)/c,s.z=a,o.perspectiveMultiplyPoint3(s,s),s}}class Wt{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==ft.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==ft.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==ft.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==ft.DirectionLight){let a=this.directionLightList.get(e);return a||(a=[],this.directionLightList.set(e,a)),a}else if(t==ft.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==ft.DirectionLight){let a=this.directionLightList.get(t);if(a||(a=[],this.directionLightList.set(t,a)),!e.shadowCamera){e.shadowCamera=ht.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==ft.PointLight||e.lightData.lightType==ft.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==ft.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==ft.PointLight||e.lightData.lightType==ft.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=Wt.directionLightList.get(e.scene),r=Wt.pointLightList.get(e.scene),i=0,s=0,o=0,l=0;if(t.fill(0),a){let f=0;for(let h=0;h<a.length;h++){const u=a[h];t[h]=u.lightData.index,u.lightData.castShadowIndex=f++}s=a.length}if(r){o=s;let f=0;for(let h=o;h<r.length;h++){const u=r[h];t[h]=u.lightData.index,u.lightData.castShadowIndex=f++}l=o+r.length}ve.getAllCameraGroup().forEach(f=>{f.dirShadowStart=i,f.dirShadowEnd=s,f.pointShadowStart=o,f.pointShadowEnd=l,f.shadowLights.set(new Float32Array(t))})}}class En{uuid;usage;globalBindGroup;uniformGPUBuffer;matrixBindGroup;uniformByteLength;matrixesByteLength;shadowMatrixRaw=new Float32Array(128);csmMatrixRaw=new Float32Array(ia.Cascades*16);csmShadowBias=new Float32Array(4);shadowLights=new Float32Array(16);dirShadowStart=0;dirShadowEnd=0;pointShadowStart=0;pointShadowEnd=0;constructor(e){this.uuid=Gt(),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=T.block*4*T.maxCount,this.globalBindGroup=I.device.createBindGroup({label:"global_bindGroupLayout",layout:An.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=Wt.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=B.setting.shadow.shadowSize;if(ia.Cascades>1&&e.enableCSM&&t[0])for(let l=0;l<ia.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=B.setting.reflectionSetting,i=$.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",ct.testObj.testValue2),this.uniformGPUBuffer.setFloat("test3",ct.testObj.testValue3),this.uniformGPUBuffer.setFloat("test4",ct.testObj.testValue4),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",ze.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",ze.time),this.uniformGPUBuffer.setFloat("delta",ze.delta),this.uniformGPUBuffer.setFloat("shadowBias",e.getShadowBias(a)),this.uniformGPUBuffer.setFloat("skyExposure",B.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",B.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",B.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",B.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",B.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",B.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",B.setting.render.renderState_split);let s=B.inputSystem.mouseX*I.pixelRatio,o=B.inputSystem.mouseY*I.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",s),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",B.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",a),this.uniformGPUBuffer.setFloat("shadowSoft",B.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",e.enableCSM?1:0),this.uniformGPUBuffer.setFloat("csmMargin",B.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",ze.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",ze.time),this.uniformGPUBuffer.setFloat("delta",ze.delta),this.uniformGPUBuffer.setFloat("shadowBias",B.setting.shadow.shadowBias),this.uniformGPUBuffer.setFloat("skyExposure",B.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",B.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",B.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",B.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",B.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",B.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",B.setting.render.renderState_split);let t=B.inputSystem.mouseX*I.pixelRatio,a=B.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",B.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",B.setting.shadow.shadowSize),this.uniformGPUBuffer.setFloat("shadowSoft",B.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",0),this.uniformGPUBuffer.setFloat("csmMargin",B.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 n0{setting;probesBufferData;probesBuffer;isVolumeFrameChange=!0;randomOrientation;startPosition=new g;isVolumeChange=!0;irradianceVolumeBuffer;directionDistance=20;randomSeedCount=3;useRandomIndex=0;centerDirection=new g(0,0,this.directionDistance).normalize(1);arroundPositions=[];updateOrientation(){return this.useRandomIndex++,this.useRandomIndex>=this.arroundPositions.length&&(this.useRandomIndex=0),T.fromToRotation(this.centerDirection,this.arroundPositions[this.useRandomIndex],this.randomOrientation),this.randomOrientation}init(e){this.setting=e,this.randomOrientation=new T(!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 g(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,s=this.setting.probeSpace;return r=r||new g,r.x=e*s-s*(i.probeXCount-1)*.5+i.offsetX,r.y=t*s-s*(i.probeYCount-1)*.5+i.offsetY,r.z=a*s-s*(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 o0{storageGPUBuffer;irradianceVolume;_lightList=[];constructor(){this.storageGPUBuffer=new Pe(hs.lightSize*B.setting.light.maxLight,GPUBufferUsage.COPY_SRC),this.irradianceVolume=new n0,this.irradianceVolume.init(B.setting.gi);for(let e=0;e<B.setting.light.maxLight;e++){let t=this.storageGPUBuffer.memory.allocation_node(hs.lightSize*4);this._lightList.push(t)}this.storageGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e){this.storageGPUBuffer.clean();let t=$.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 l0{storageGPUBuffer;reflectionMap;sourceReflectionMap;count;constructor(){this.storageGPUBuffer=new Pe(768)}update(e){this.storageGPUBuffer.clean();let t=$.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 c0 extends Za{size;constructor(e,t=0,a){super(),this.bufferType=ga.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 s=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(s),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 f0{uuid;index;usage;groupBufferSize;matrixBufferDst;constructor(){this.uuid=Gt(),this.groupBufferSize=0,this.usage=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.cacheWorldMatrix()}cacheWorldMatrix(){this.groupBufferSize=T.maxCount*T.blockBytes,this.matrixBufferDst=new c0(this.groupBufferSize/4),this.matrixBufferDst.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBufferDst.buffer.label=this.groupBufferSize.toString()}writeBuffer(e){const t=T.dynamicMatrixBytes;this.matrixBufferDst.mapAsyncWrite(t,e)}}class ve{static _cameraBindGroups;static _lightEntriesMap;static _reflectionEntriesMap;static modelMatrixBindGroup;static init(){this.modelMatrixBindGroup=new f0,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 En(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 En(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 o0,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 l0,this._reflectionEntriesMap.set(e,t)),this._reflectionEntriesMap.get(e)}}class E{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(E.lastShader!=t)E.lastShader=t;else return!1;E.lastPipeline!=t.pipeline&&(E.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=ve.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 s=r[i];e.setVertexBuffer(i,a.buffer,s.offset,s.size)}}}static cleanCache(){this.lastGeometry=null,this.lastPipeline=null,this.lastShader=null}static createPipeline(e){return ct.countStart("GPUContext","pipeline"),I.device.createRenderPipeline(e)}static beginCommandEncoder(){return ct.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,ct.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,s){e.drawIndexed(t,a,r,i,s),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 d0{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 h0{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 d0,this._normalAttrDataGroup=new d0}initMorphTarget(e){this._collectMorphTargetData=this.collectMorphTargetList(e),this._computeShader&&this._computeShader.destroy();let t=Xt.CsMain;this._computeShader=new Se(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,E.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("."),h=f[f.length-1];this._blendTarget[h]=u=>this.updateInfluence(c,u)}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 s=this.collectAttribute("a_morphNormals_",e),o;if(s&&s.length>0){let l=0;o=new Float32Array(r*a*3);for(let c=0;c<a;c++){let f=s[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,s=t.getAttribute(i);if(s)a[r]=s;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 y2=Object.defineProperty,C2=Object.getOwnPropertyDescriptor,wn=(n,e,t,a)=>{for(var r=a>1?void 0:a?C2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=(a?s(e,t,r):s(r))||r);return a&&r&&y2(e,t,r),r};d.MeshRenderer=class extends Ba{receiveShadow;morphData;constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(e){e.addComponent(d.MeshRenderer).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.receiveShadow=e.receiveShadow,this}get geometry(){return this._geometry}set geometry(e){if(super.geometry=e,e){let t=e.morphTargetDictionary!=null;t&&(this.morphData||=new h0,this.morphData.morphTargetsRelative=e.morphTargetsRelative,this.morphData.initMorphTarget(e)),this.morphData&&(this.morphData.enable=t),this.morphData?.enable?this.addRendererMask(Me.MorphTarget):this.removeRendererMask(Me.MorphTarget),this.object3D.bound=this._geometry.bounds.clone()}else this.morphData&&(this.morphData.enable=!1),this.removeRendererMask(Me.MorphTarget);this._readyPipeline||(this.initPipeline(),this._computes&&(this.onCompute=os(this.onCompute,()=>{for(let t=0;t<this._computes.length;t++)this._computes[t].onUpdate()})))}get material(){return this._materials[0]}set material(e){this.materials=[e]}setMorphInfluence(e,t){if(this.morphData&&this.morphData.enable){let a=this._geometry.morphTargetDictionary[e];a>=0&&this.morphData.updateInfluence(a,t)}}setMorphInfluenceIndex(e,t){this.morphData&&this.morphData.enable&&e>=0&&this.morphData.updateInfluence(e,t)}onCompute(e,t){this.morphData&&this.morphData.enable&&this.morphData.computeMorphTarget(t)}nodeUpdate(e,t,a,r){if(this.morphData&&this.morphData.enable)for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t);if(o)for(let l=0;l<o.length;l++)this.morphData.applyRenderShader(o[l])}super.nodeUpdate(e,t,a,r)}destroy(e){this.morphData&&(this.morphData.destroy(e),this.morphData=null),super.destroy(e)}},wn([jr],d.MeshRenderer.prototype,"geometry",1),wn([jr],d.MeshRenderer.prototype,"material",1),d.MeshRenderer=wn([Nt(d.MeshRenderer,"MeshRenderer")],d.MeshRenderer);class Qa{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 u0{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]:B.res.redTexture}}class Et extends dt{resolveTarget;sampleCount;autoResize;clear;constructor(e,t,a=le.rgba8unorm,r=!1,i,s=1,o=0,l=!0,c=!0){super(e,t,s),this.name=Gt(),this.autoResize=c,this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=s,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(nr.RESIZE,f=>{let{width:h,height:u}=f.data;this.resize(h,u),this._textureChange=!0},this)}resize(e,t){let a=I.device;this.gpuTexture&&(dt.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==le.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==le.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==le.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=Ht.clamp_to_edge,this.addressModeV=Ht.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 s=new Float32Array(e*t*4);const o=r.createBuffer({size:s.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,s);const l=E.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(l)}clone(){let e=new Et(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 E.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class We{storeOp="store";loadOp="clear";clearValue=[0,0,0,0]}class st{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 We;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 st([],[]);return this.clone2Frame(e),e}}class Be extends st{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,s){let o=this.renderTargets,l=this.rtDescriptors;if(i){let f=new We;f.loadOp="clear",this._colorBufferTex=wt.createRTTexture(e+Qa.colorBufferTex_NAME,t,a,le.rgba16float,!0),o.push(this._colorBufferTex),l.push(f)}this._compressGBufferTex=new Et(t,a,le.rgba32float,!1,void 0,1,0,!0,!0),o.push(this._compressGBufferTex),s?this.depthTexture=s:(this.depthTexture=new Et(t,a,le.depth24plus,!1,void 0,1,0,!0,!0),this.depthTexture.name=e+"_depthTexture");let c;c=new We,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 s;if(Be.gBufferMap.has(e))s=Be.gBufferMap.get(e);else{s=new Be;let o=I.presentationSize;s.createGBuffer(e,t==0?o[0]:t,a==0?o[1]:a,t!=0&&a!=0,r,i),Be.gBufferMap.set(e,s)}return s}static getGUIBufferFrame(){let e=this.getGBufferFrame(this.colorPass_GBuffer);return Be.getGBufferFrame(Be.gui_GBuffer,0,0,!0,e.depthTexture)}clone(){let e=new Be;return this.clone2Frame(e),e}}class Ye{static rendererPassState=new Map;static createRendererPassState(e,t=null){let a=Ye.rendererPassState.get(e);if(a||(a=new u0,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,Ye.rendererPassState.set(e,a)),e&&e.renderTargets.length>0){a.renderTargets=e.renderTargets,a.rtTextureDescriptors=e.rtDescriptors,a.renderPassDescriptor=Ye.getRenderPassDescriptor(a),a.renderPassDescriptor.depthStencilAttachment&&(a.renderPassDescriptor.depthStencilAttachment.depthLoadOp=e.depthLoadOp),t=="load"&&e?.renderTargets[0]&&e.renderTargets[0].name.startsWith(Be.gui_GBuffer)&&(a.renderPassDescriptor.colorAttachments[0].loadOp="load"),a.depthLoadOp=e.depthLoadOp,a.renderBundleEncoderDescriptor=Ye.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(Qa.colorBufferTex_NAME)!=-1&&(a.outColor=r)}}else a.renderPassDescriptor=Ye.getRenderPassDescriptor(a,t),a.renderBundleEncoderDescriptor=Ye.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 s=e.renderTargets[i],o=e.rtTextureDescriptors[i];a.push({view:s.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 $r extends Ve{width;height;segmentW;segmentH;up;constructor(e,t,a=1,r=1,i=g.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,s=this.segmentW+1;(this.segmentH+1)*s,this.bounds=new Ce(g.ZERO.clone(),new g(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),h;this.segmentW*this.segmentH*2*3>=Uint16Array.length?h=new Uint32Array(this.segmentW*this.segmentH*2*3):h=new Uint16Array(this.segmentW*this.segmentH*2*3),r=0;for(var b=0,A=0,m=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 g.Y_AXIS:l[b++]=t,l[b++]=0,l[b++]=a,c[A++]=0,c[A++]=1,c[A++]=0;break;case g.Z_AXIS:l[b++]=t,l[b++]=-a,l[b++]=0,c[A++]=0,c[A++]=0,c[A++]=1;break;case g.X_AXIS:l[b++]=0,l[b++]=t,l[b++]=a,c[A++]=1,c[A++]=0,c[A++]=0;break;default:l[b++]=t,l[b++]=0,l[b++]=a,c[A++]=0,c[A++]=1,c[A++]=0;break}f[m++]=D/this.segmentW,f[m++]=p/this.segmentH,D!=this.segmentW&&p!=this.segmentH&&(i=D+p*s,h[r++]=i+1,h[r++]=i,h[r++]=i+s,h[r++]=i+1,h[r++]=i+s,h[r++]=i+s+1)}this.setIndices(h),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:h.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}var S2=Object.getOwnPropertyDescriptor,x2=(n,e,t,a)=>{for(var r=a>1?void 0:a?S2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.QuadShader=class extends gt{constructor(e="QuadGlsl_vs",t="QuadGlsl_fs"){super();let a=new qe(e,t);this.addRenderPass(a);let r=a.shaderState;a.blendMode=Ae.NONE,r.frontFace="cw",r.depthWriteEnabled=!1,r.depthCompare=lt.always,r.multisample=0,this.setTexture("baseMap",B.res.blackTexture),this.setUniformFloat("x",0),this.setUniformFloat("y",0),this.setUniformFloat("width",100),this.setUniformFloat("height",100)}},d.QuadShader=x2([Ta(d.QuadShader,"QuadShader")],d.QuadShader);class Rn extends d.Object3D{width=128;height=128;quadRenderer;material;rendererPassState;quadShader;constructor(e="QuadGlsl_vs",t="QuadGlsl_fs",a,r=0,i=!1){super();let s=a?a.renderTargets:[];this.material=new Dt,this.quadShader=new d.QuadShader(e,t),this.material.shader=this.quadShader,this.quadRenderer=this.addComponent(d.MeshRenderer),this.quadRenderer.material=this.material,this.quadRenderer.castGI=!1,this.quadRenderer.castShadow=!1,this.quadRenderer.drawType=i?2:0,this.quadRenderer.geometry=new $r(100,100,1,1),this.quadRenderer.material=this.material,this.quadRenderer.__start(),this.quadRenderer._enable=!0,this.quadRenderer.onEnable(),this.rendererPassState=Ye.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:s.length>0?s[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT})),I.addEventListener(nr.RESIZE,o=>{this.rendererPassState=Ye.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:s.length>0?s[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT}))},this)}renderTarget(e,t,a){let r=e.camera,i=E.beginRenderPass(a,t.rendererPassState);E.bindCamera(i,r),t.quadRenderer.nodeUpdate(e,de.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,de.COLOR,t.rendererPassState,null,i),E.endPass(i)}renderToViewQuad(e,t,a,r){let i=e.camera;t.quadShader.setTexture("baseMap",r);let s=E.beginRenderPass(a,t.rendererPassState);E.bindCamera(s,i),t.quadRenderer.nodeUpdate(e,de.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,de.COLOR,t.rendererPassState,null,s),E.endPass(s)}}class wt{static rtTextureMap;static rtViewQuad;static init(){this.rtTextureMap=new Map,this.rtViewQuad=new Map}static createRTTexture(e,t,a,r,i=!1,s=0){let o=this.rtTextureMap.get(e);return o||(e==Qa.colorBufferTex_NAME?o=new Et(t,a,r,i,void 0,1,s,!1):o=new Et(t,a,r,i,void 0,1,s,!0),o.name=e,wt.rtTextureMap.set(e,o)),o}static createRTTextureArray(e,t,a,r,i=1,s=!1,o=0){let l=this.rtTextureMap.get(e);return l||(l=new Et(t,a,r,s,void 0,i,o),l.name=e,wt.rtTextureMap.set(e,l)),l}static createViewQuad(e,t,a,r,i=0){let s=new st([r],[new We]),o=new Rn(t,a,s,i);return wt.rtViewQuad.set(e,o),o}static getTexture(e){return this.rtTextureMap.get(e)}static CreateSplitTexture(e){let t=this.getTexture(Qa.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(Qa.colorBufferTex_NAME),a=this.getTexture(e+"_split");const r=E.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}),E.endCommandEncoder(r)}}class In{command;encoder;rendererPassStates;rtFrame;constructor(e){this.rtFrame=e,this.rendererPassStates=[]}clean(){this.rendererPassStates.length=0,E.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=Ye.createRendererPassState(a,e);return this.rendererPassStates.push(r),r}else{this.rtFrame.depthLoadOp=t;let a=Ye.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=E.beginCommandEncoder(),this.command}endCommand(){E.endCommandEncoder(this.command),this.command=null}beginNewEncoder(){return this.encoder=E.beginRenderPass(this.command,this.rendererPassState),this.encoder}endEncoder(){E.endPass(this.encoder),this.encoder=null}}class Ma extends ja{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=Ye.createRendererPassState(e);let t=e.clone();t.depthLoadOp="load";for(const a of t.rtDescriptors)a.loadOp="load";this.splitRendererPassState=Ye.createRendererPassState(t)}this.renderContext=new In(e)}getRenderContext(e){return this._rtFrame=e,new In(e)}setIrradiance(e,t){this.rendererPassState.irradianceBuffer=[e,t]}compute(e,t){}render(e,t,a,r=!1){E.cleanCache();let i=e.camera,s=e.scene;this.rendererPassState.camera3D=i;let o=$.instance.getRenderNodes(s,i),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{let f=E.beginCommandEncoder(),h=E.beginRenderPass(f,this.rendererPassState);l.length>0&&h.executeBundles(l),!r&&$.instance.sky&&(E.bindCamera(h,i),$.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,h)),this.drawRenderNodes(e,h,f,o.opaqueList,t),E.endPass(h),E.endCommandEncoder(f)}{let f=E.beginCommandEncoder(),h=E.beginRenderPass(f,this.rendererPassState);c.length>0&&h.executeBundles(c),r||(E.bindCamera(h,i),this.drawRenderNodes(e,h,f,o.transparentList,t)),E.endPass(h),E.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=$.instance.getOpRenderGroup(e.scene);if(i){let s=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))s.push(o.bundleMap.get(this._rendererType));else{let l=E.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),s.push(c)}}),s}return[]}renderBundleTr(e,t,a,r){let i=$.instance.getTrRenderGroup(e.scene);if(i){let s=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))s.push(o.bundleMap.get(this._rendererType));else{let l=E.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),s.push(c)}}),s}return[]}recordRenderBundleNode(e,t,a,r){E.bindCamera(t,e.camera),E.bindGeometryBuffer(t,a[0].geometry);for(let i=0;i<a.length;++i){let s=a[i];s.transform.worldMatrix.index,s.transform.enable&&s.recordRenderPass2(e,this._rendererType,this.rendererPassState,r,t)}}drawRenderNodes(e,t,a,r,i,s){E.bindCamera(t,e.camera);for(let o=B.setting.render.drawOpMin;o<Math.min(r.length,B.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&l.renderPass2(e,this._rendererType,this.rendererPassState,s,t)}}}class b0 extends Ma{constructor(){super(),this.passType=de.COLOR}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,s=e.camera;ve.updateCameraGroup(s),this.rendererPassState.camera3D=s;let o=$.instance.getRenderNodes(i,s),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&&($.instance.getOpRenderGroup(i),f.executeBundles(l)),!r&&$.instance.sky&&(E.bindCamera(f,s),$.instance.sky.preInit(this._rendererType)||$.instance.sky.nodeUpdate(e,this._rendererType,this.rendererPassState,a),$.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,f)),o.opaqueList&&(E.bindCamera(f,s),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let f=this.renderContext.encoder;c.length>0&&f.executeBundles(c),!r&&o.transparentList&&(E.bindCamera(f,s),this.drawNodes(e,this.renderContext,o.transparentList,t,a));let h=$.instance.getGraphicList();for(let u=0;u<h.length;u++){const b=h[u];b.nodeUpdate(e,this._rendererType,this.splitRendererPassState,a),b.renderPass2(e,this._rendererType,this.splitRendererPassState,a,f)}this.renderContext.endRenderPass(),ct.end("ColorPass Draw Transparent")}}drawNodes(e,t,a,r,i){let s=$.instance.getRenderShaderCollect(e);if(s){for(const o of s){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=B.setting.render.drawOpMin;o<Math.min(a.length,B.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(l.hasMask(Me.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 Tn{frustumCullingList;zVisibleList;_renderList;static enable=!0;constructor(){this._renderList=new Map}occlusionRenderNodeTest(e){return B.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 ei extends Za{constructor(e,t){super(),this.bufferType=ga.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 ei(e*2*4),this.clustersUniformBuffer=new Ct(10),this.clustersUniformBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.lightAssignBuffer=new ei(e*t),this.lightAssignBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.assignTableBuffer=new ei(e*4),this.assignTableBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e,t,a,r,i,s,o,l,c,f){this.clustersUniformBuffer.setFloat("clusterTileX",r),this.clustersUniformBuffer.setFloat("clusterTileY",i),this.clustersUniformBuffer.setFloat("clusterTileZ",s),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 Rt{static clusterTileX=16;static clusterTileY=16;static clusterTileZ=32}let m0=`
6149
+ `;var p2=Object.getOwnPropertyDescriptor,A2=(n,e,t,a)=>{for(var r=a>1?void 0:a?p2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.PointCloudShader=class extends gt{constructor(){super(),X.register("pointcloud_vs_dc",t0),X.register("pointcloud_fs_dc",a0);const e=new qe("pointcloud_vs_dc","pointcloud_fs_dc");e.passType=de.COLOR,e.setShaderEntry("VertMain","FragMain"),e.topology=ls.triangle_list,e.depthWriteEnabled=!0,e.cullMode=Vt.none,e.shaderState.transparent=!1,e.shaderState.blendMode=Ae.NORMAL,e.shaderState.writeMasks=[15,15],e.shaderState.castReflection=!1,this.addRenderPass(e),this.setDefault()}setDefault(){const e=this.getDefaultColorShader(),t=new T;e.setUniform("modelMatrix",t.rawData),e.setUniformArray("tex_params",new Float32Array([0,0,0,4])),e.setUniformArray("pointParams",new Float32Array([0,0,0,128]))}},d.PointCloudShader=A2([Ta(d.PointCloudShader,"PointCloudShader")],d.PointCloudShader);class r0 extends Dt{_texParams=new Float32Array([0,0,0,4]);_pointParamsArray=new Float32Array([0,0,0,128]);constructor(){super(),this.shader=new d.PointCloudShader}setPointTextures(e,t,a,r){const i=this.shader.getDefaultColorShader();if(!i.getUniform("modelMatrix")){const s=new T;i.setUniform("modelMatrix",s.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=it.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 Fn extends Ve{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,s=r*6;a.set([0+i,1+i,2+i,0+i,2+i,3+i],s)}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 i0 extends dt{create(e,t,a,r=!0){let i=I.device;const s=e*4*4;this.format=le.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=E.beginCommandEncoder();return c.copyBufferToTexture({buffer:l,bytesPerRow:s},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.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=le.rgba32float,this.mipmapCount=1,this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const s=E.beginCommandEncoder();return s.copyBufferToTexture({buffer:a,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(s),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=r.createSampler({}),this}}var D2=Object.getOwnPropertyDescriptor,_2=(n,e,t,a)=>{for(var r=a>1?void 0:a?D2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.PointCloudRenderer=class extends Ba{count=0;size=new fe;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 g;get centerOffset(){return this._centerOffset}constructor(){super()}initFromData(e,t,a){if(!e||!t||a<=0){console.error("PointCloudRenderer: Invalid input data");return}if(e.length<a*3){console.error("PointCloudRenderer: Positions array too small");return}if(t.length<a*4){console.error("PointCloudRenderer: Colors array too small");return}this.count=a,this._fullCount=a,this.size=this.evalTextureSize(a),this._positions=e,this._colors=t,this.centerizePositions(),this.buildPositionTexture(),this.buildColorTexture(),this.texParams=new Float32Array([this.count,this.size.x,this.count,4]),this.buildOrderTexture(),this.pointCloudMaterial=new r0,this.geometry=new Fn(this._batchSize),this.materials=[this.pointCloudMaterial],this.instanceCount=Math.ceil(this.count/this._batchSize)}evalTextureSize(e){let t=Math.ceil(Math.sqrt(e));const a=64;t=Math.ceil(t/a)*a;const r=Math.ceil(e/t);return new fe(t,r)}centerizePositions(){if(this.count===0)return;let e=0,t=0,a=0;for(let o=0;o<this.count;o++){const l=o*3;e+=this._positions[l+0],t+=this._positions[l+1],a+=this._positions[l+2]}const r=e/this.count,i=t/this.count,s=a/this.count;this._centerOffset.set(r,i,s);for(let o=0;o<this.count;o++){const l=o*3;this._positions[l+0]-=r,this._positions[l+1]-=i,this._positions[l+2]-=s}this.object3D.localPosition=this._centerOffset}buildPositionTexture(){const e=this.size.x|0,t=this.size.y|0,a=this.count,r=new Float32Array(e*t*4);for(let i=0;i<a;i++){const s=i*4,o=i*3;r[s+0]=this._positions[o+0],r[s+1]=this._positions[o+1],r[s+2]=this._positions[o+2],r[s+3]=0}if(a<e*t){const i=(a-1)*4;for(let s=a;s<e*t;s++){const o=s*4;r[o+0]=r[i+0],r[o+1]=r[i+1],r[o+2]=r[i+2],r[o+3]=0}}this.pointPosition=new i0().create(e,t,r),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 e=this.size.x|0,t=this.size.y|0,a=this.count,r=new Uint8Array(e*t*4);for(let i=0;i<a;i++){const s=i*4,o=i*4;r[s+0]=this._colors[o+0],r[s+1]=this._colors[o+1],r[s+2]=this._colors[o+2],r[s+3]=this._colors[o+3]}if(a<e*t){const i=(a-1)*4;for(let s=a;s<e*t;s++){const o=s*4;r[o+0]=r[i+0],r[o+1]=r[i+1],r[o+2]=r[i+2],r[o+3]=r[i+3]}}this.pointColor=new Si().create(e,t,r,!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 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.pointOrder=new Ds().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(e,t,a,r){const i=this.object3D.transform.worldMatrix;this.pointCloudMaterial.setTransformMatrix(i),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(e,t,a,r)}renderPass(e,t,a){const r=a.encoder;for(let i of this.materials){const s=i.getPass(t);if(!(!s||s.length===0))for(const o of s){if(!o.pipeline)continue;o.apply(this.geometry,a.rendererPassState||a),E.bindPipeline(r,o),E.bindGeometryBuffer(r,this.geometry);const c=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?E.drawIndexed(r,c.indexCount,this.instanceCount,c.indexStart,0,0):E.drawIndexed(r,c.indexCount,1,c.indexStart,0,0)}}}setPointSize(e){this.texParams[3]=Math.max(.1,e),this.pointCloudMaterial&&this.pointCloudMaterial.setPointSize(e)}setPointShape(e){this.pointCloudMaterial&&this.pointCloudMaterial.setPointShape(e)}enableDebugFullScreen(e){this._debugFullScreen=e,this.pointCloudMaterial&&this.pointCloudMaterial.enableDebugFullScreen(e)}setBatchSize(e){if(this._batchSize=Math.max(1,e|0),this.geometry){const t=this.geometry;xe.getInstance().detached(t,this),xe.getInstance().hasReference(t)||t.destroy(),this.geometry=new Fn(this._batchSize)}this.pointCloudMaterial&&(this.pointCloudMaterial.setBatchSize(this._batchSize),this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen)),this.instanceCount=Math.ceil(this.count/this._batchSize)}destroy(e){this.pointColor&&(this.pointColor.destroy(e),this.pointColor=null),this.pointPosition&&(this.pointPosition.destroy(e),this.pointPosition=null),this.pointOrder&&(this.pointOrder.destroy(e),this.pointOrder=null),this._positions=null,this._colors=null,this._orderData=null,this.texParams=null,super.destroy(e)}},d.PointCloudRenderer=_2([Nt(d.PointCloudRenderer,"PointCloudRenderer")],d.PointCloudRenderer);class kn{static maxVector=new g(Number.MAX_VALUE*.1,Number.MAX_VALUE*.1,Number.MAX_VALUE*.1);static minVector=this.maxVector.clone().multiplyScalar(-1);static genMeshMaxVector=g.ZERO.clone();static genMeshMinVector=g.ZERO.clone();static genMeshVectorList8=[new g,new g,new g,new g,new g,new g,new g,new g];static genPointCloudBounds(e,t){t||=new Ce(g.ZERO,g.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(d.PointCloudRenderer);if(!a)return console.warn("genPointCloudBounds: No PointCloudRenderer found on object"),t;for(const r of a){const i=r.positions,s=r.fullCount;if(!i||s===0){console.warn("genPointCloudBounds: No position data available");continue}const o=r.object3D.transform.worldMatrix,l=new g;for(let c=0;c<s;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(g.ZERO,g.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(d.GSplatRenderer);if(!a)return console.warn("genGSplatBounds: No GSplatRenderer found on object"),t;for(const r of a){const i=r.positions,s=r.fullCount;if(!i||s===0)return console.warn("genGSplatBounds: No position data available"),t;const o=r.object3D.transform.worldMatrix,l=new g;for(let c=0;c<s;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(g.ZERO,g.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let s=e.getComponents(d.MeshRenderer);for(const o of s)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),s=this.genMeshVectorList8;a||=new Ce(g.ZERO,g.ZERO),a.setFromMinMax(this.maxVector,this.minVector),s[0].set(r.x,r.y,r.z),s[1].set(r.x,r.y,i.z),s[2].set(r.x,i.y,r.z),s[3].set(r.x,i.y,i.z),s[4].set(i.x,r.y,r.z),s[5].set(i.x,r.y,i.z),s[6].set(i.x,i.y,r.z),s[7].set(i.x,i.y,i.z);for(const o of s)e.transformPoint(o,o),a.expandByPoint(o);return i.copyFrom(a.max),r.copyFrom(a.min),a.setFromMinMax(r,i),a}}class s0 extends ja{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=tn().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&&(kn.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()):Ne.waitStartComponent.forEach((e,t)=>{for(;e.length>0;){const a=e.shift();a.__start(),Ne.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 B2=Object.getOwnPropertyDescriptor,v2=(n,e,t,a)=>{for(var r=a>1?void 0:a?B2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.Object3D=class extends s0{_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(e){this.entityChildren.forEach(t=>{e(t),t.forChild(e)})}addComponent(e,t){if(!this.components.has(e)){let a=new e;return a.object3D=this,this.components.set(e,a),a.__init(t),Ne.appendWaitStart(a),a}return this.components.get(e)}getOrAddComponent(e){let t=this.components.get(e);return t||(t=this.addComponent(e)),t}removeComponent(e){if(this.components.has(e)){let t=this.components.get(e);Ne.removeWaitStart(this,t),this.components.delete(e),t.__stop(),t.beforeDestroy(),t.destroy()}}hasComponent(e){return this.components.has(e)}getComponent(e){return this.components.get(e)}getComponentFromParent(e){if(!this.parent)return null;let t=this.parent.object3D.getComponent(e);return t||this.parent.object3D.getComponentFromParent(e)}getComponentsInChild(e){let t=[],a=this.components.get(e);a&&t.push(a);for(let r=0;r<this.entityChildren.length;r++){let s=this.entityChildren[r].getComponentsInChild(e);t.push(...s)}return t}getComponents(e,t,a){t||=[];let r=this.getComponent(e);r&&(r.enable||a)&&t.push(r);for(let i=0,s=this.entityChildren.length;i<s;i++){let o=this.entityChildren[i];o&&o instanceof d.Object3D&&o.getComponents(e,t,a)}return t}getComponentsExt(e,t,a){t||=[];let r=this.components.get(e);if(r&&(r.enable||a))t.push(r);else for(const i of this.entityChildren)i instanceof d.Object3D&&i.getComponentsExt(e,t,a);return t}getComponentsByProperty(e,t,a=!0,r,i){r||=[];let s;for(const o of this.components.values())o&&(o.enable||i)&&o[e]===t&&(r.push(o),s=!0);if(!(s&&a))for(const o of this.entityChildren)o instanceof d.Object3D&&o.getComponentsByProperty(e,t,a,r,i);return r}clone(){return this.instantiate()}instantiate(){let e=new d.Object3D;return e.name=this.name,e.serializeTag=this.serializeTag,e.prefabRef=this.prefabRef,this.entityChildren.forEach((t,a)=>{let r=t.instantiate();e.addChild(r)}),this.components.forEach((t,a)=>{t.cloneTo(e)}),e}get localPosition(){return this.transform.localPosition}set localPosition(e){this.transform.localPosition=e}get localRotation(){return this.transform.localRotation}set localRotation(e){this.transform.localRotation=e}get localScale(){return this.transform.localScale}set localScale(e){this.transform.localScale=e}get localQuaternion(){return this.transform.localRotQuat}set localQuaternion(e){this.transform.localRotQuat=e}notifyChange(){this.transform.notifyChange()}get parent(){return this.transform.parent}get parentObject(){return this.transform.parent.object3D}set x(e){this.transform.x=e}get x(){return this.transform.x}set y(e){this.transform.y=e}get y(){return this.transform.y}set z(e){this.transform.z=e}get z(){return this.transform.z}set scaleX(e){this.transform.scaleX=e}get scaleX(){return this.transform.scaleX}set scaleY(e){this.transform.scaleY=e}get scaleY(){return this.transform.scaleY}set scaleZ(e){this.transform.scaleZ=e}get scaleZ(){return this.transform.scaleZ}set rotationX(e){this.transform.rotationX=e}get rotationX(){return this.transform.rotationX}set rotationY(e){this.transform.rotationY=e}get rotationY(){return this.transform.rotationY}set rotationZ(e){this.transform.rotationZ=e}get rotationZ(){return this.transform.rotationZ}fixedUpdate(){}lateUpdate(){}traverse(e){e(this);for(let t=0,a=this.entityChildren.length;t<a;t++){let r=this.entityChildren[t];r instanceof d.Object3D&&r.traverse(e)}}destroy(e){this.transform.eventDispatcher.removeEventListener(zt.LOCAL_ONCHANGE,this.onTransformLocalChange,this);const t=this.batchTable;t&&typeof t.destroy=="function"&&(t.destroy(),this.batchTable=null);const a=this.featureTable;a&&typeof a.destroy=="function"&&(a.destroy(),this.featureTable=null),super.destroy(e)}},d.Object3D=v2([U2],d.Object3D);function U2(n,e){return class extends d.Object3D{set active(t){this.transform.enable=t>0}get active(){return this.transform.enable?1:0}get materialColor(){return this.getComponent(d.MeshRenderer)?.material?.shader.getDefaultColorShader().baseColor}set materialColor(t){let a=this.getComponent(d.MeshRenderer)?.material;a&&(a.shader.getDefaultColorShader().baseColor=t)}notifyMaterialColorChange(t,a){this.getComponent(d.MeshRenderer).materials?.[t]?.shader.getDefaultColorShader().uniforms[a].onChange()}}}class ht{static createCamera3DObject(e,t){return this.createCamera3D(null,e,t)}static createCamera3D(e,t,a){return e||=new d.Object3D,t&&t.addChild(e),a&&(e.name=a),e.getOrAddComponent(Hr)}static UnProjection(e,t,a=1,r){let i=new g(e,t,0),s=1,o=g.HELP_0,l=I.canvas.offsetLeft,c=I.canvas.offsetTop,f=I.canvas.clientWidth,h=I.canvas.clientHeight;o.x=((i.x-l)*s/f-.5)*2,o.y=-((i.y-c)*s/h-.5)*2,o.z=a;let u=new g(0,0,0),b=T.helpMatrix2;b.copyFrom(r.projectionMatrix),b.invert();let A=T.helpMatrix;return A.identity(),A.multiply(b),A.multiply(r.transform.worldMatrix),A.perspectiveMultiplyPoint3(o,u),u}static Projection(e,t,a){let r=a||new g(0,0,0),i=T.helpMatrix;i.copyFrom(t.viewMatrix),i.multiply(t.projectionMatrix),i.perspectiveMultiplyPoint3(e,r);let s=I.canvas.clientWidth/2,o=I.canvas.clientHeight/2;return r.x=r.x*s+s,r.y=o-r.y*o,r}static UnProjection2(e,t,a,r,i){let s=i||new g(0,0,0),o=T.helpMatrix;o.copyFrom(r.pvMatrixInv);let l=I.canvas.clientWidth/2,c=I.canvas.clientHeight/2;return s.x=(e-l)/l,s.y=(c-t)/c,s.z=a,o.perspectiveMultiplyPoint3(s,s),s}}class Wt{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==ft.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==ft.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==ft.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==ft.DirectionLight){let a=this.directionLightList.get(e);return a||(a=[],this.directionLightList.set(e,a)),a}else if(t==ft.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==ft.DirectionLight){let a=this.directionLightList.get(t);if(a||(a=[],this.directionLightList.set(t,a)),!e.shadowCamera){e.shadowCamera=ht.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==ft.PointLight||e.lightData.lightType==ft.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==ft.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==ft.PointLight||e.lightData.lightType==ft.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=Wt.directionLightList.get(e.scene),r=Wt.pointLightList.get(e.scene),i=0,s=0,o=0,l=0;if(t.fill(0),a){let f=0;for(let h=0;h<a.length;h++){const u=a[h];t[h]=u.lightData.index,u.lightData.castShadowIndex=f++}s=a.length}if(r){o=s;let f=0;for(let h=o;h<r.length;h++){const u=r[h];t[h]=u.lightData.index,u.lightData.castShadowIndex=f++}l=o+r.length}ve.getAllCameraGroup().forEach(f=>{f.dirShadowStart=i,f.dirShadowEnd=s,f.pointShadowStart=o,f.pointShadowEnd=l,f.shadowLights.set(new Float32Array(t))})}}class En{uuid;usage;globalBindGroup;uniformGPUBuffer;matrixBindGroup;uniformByteLength;matrixesByteLength;shadowMatrixRaw=new Float32Array(128);csmMatrixRaw=new Float32Array(ia.Cascades*16);csmShadowBias=new Float32Array(4);shadowLights=new Float32Array(16);dirShadowStart=0;dirShadowEnd=0;pointShadowStart=0;pointShadowEnd=0;constructor(e){this.uuid=Gt(),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=T.block*4*T.maxCount,this.globalBindGroup=I.device.createBindGroup({label:"global_bindGroupLayout",layout:An.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=Wt.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=B.setting.shadow.shadowSize;if(ia.Cascades>1&&e.enableCSM&&t[0])for(let l=0;l<ia.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=B.setting.reflectionSetting,i=$.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",ct.testObj.testValue2),this.uniformGPUBuffer.setFloat("test3",ct.testObj.testValue3),this.uniformGPUBuffer.setFloat("test4",ct.testObj.testValue4),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",ze.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",ze.time),this.uniformGPUBuffer.setFloat("delta",ze.delta),this.uniformGPUBuffer.setFloat("shadowBias",e.getShadowBias(a)),this.uniformGPUBuffer.setFloat("skyExposure",B.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",B.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",B.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",B.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",B.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",B.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",B.setting.render.renderState_split);let s=B.inputSystem.mouseX*I.pixelRatio,o=B.inputSystem.mouseY*I.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",s),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",B.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",a),this.uniformGPUBuffer.setFloat("shadowSoft",B.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",e.enableCSM?1:0),this.uniformGPUBuffer.setFloat("csmMargin",B.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",ze.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",ze.time),this.uniformGPUBuffer.setFloat("delta",ze.delta),this.uniformGPUBuffer.setFloat("shadowBias",B.setting.shadow.shadowBias),this.uniformGPUBuffer.setFloat("skyExposure",B.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",B.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",B.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",B.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",B.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",B.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",B.setting.render.renderState_split);let t=B.inputSystem.mouseX*I.pixelRatio,a=B.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",B.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",B.setting.shadow.shadowSize),this.uniformGPUBuffer.setFloat("shadowSoft",B.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",0),this.uniformGPUBuffer.setFloat("csmMargin",B.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 n0{setting;probesBufferData;probesBuffer;isVolumeFrameChange=!0;randomOrientation;startPosition=new g;isVolumeChange=!0;irradianceVolumeBuffer;directionDistance=20;randomSeedCount=3;useRandomIndex=0;centerDirection=new g(0,0,this.directionDistance).normalize(1);arroundPositions=[];updateOrientation(){return this.useRandomIndex++,this.useRandomIndex>=this.arroundPositions.length&&(this.useRandomIndex=0),T.fromToRotation(this.centerDirection,this.arroundPositions[this.useRandomIndex],this.randomOrientation),this.randomOrientation}init(e){this.setting=e,this.randomOrientation=new T(!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 g(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,s=this.setting.probeSpace;return r=r||new g,r.x=e*s-s*(i.probeXCount-1)*.5+i.offsetX,r.y=t*s-s*(i.probeYCount-1)*.5+i.offsetY,r.z=a*s-s*(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 o0{storageGPUBuffer;irradianceVolume;_lightList=[];constructor(){this.storageGPUBuffer=new Pe(hs.lightSize*B.setting.light.maxLight,GPUBufferUsage.COPY_SRC),this.irradianceVolume=new n0,this.irradianceVolume.init(B.setting.gi);for(let e=0;e<B.setting.light.maxLight;e++){let t=this.storageGPUBuffer.memory.allocation_node(hs.lightSize*4);this._lightList.push(t)}this.storageGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e){this.storageGPUBuffer.clean();let t=$.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 l0{storageGPUBuffer;reflectionMap;sourceReflectionMap;count;constructor(){this.storageGPUBuffer=new Pe(768)}update(e){this.storageGPUBuffer.clean();let t=$.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 c0 extends Za{size;constructor(e,t=0,a){super(),this.bufferType=ga.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 s=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(s),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 f0{uuid;index;usage;groupBufferSize;matrixBufferDst;constructor(){this.uuid=Gt(),this.groupBufferSize=0,this.usage=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.cacheWorldMatrix()}cacheWorldMatrix(){this.groupBufferSize=T.maxCount*T.blockBytes,this.matrixBufferDst=new c0(this.groupBufferSize/4),this.matrixBufferDst.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBufferDst.buffer.label=this.groupBufferSize.toString()}writeBuffer(e){const t=T.dynamicMatrixBytes;this.matrixBufferDst.mapAsyncWrite(t,e)}}class ve{static _cameraBindGroups;static _lightEntriesMap;static _reflectionEntriesMap;static modelMatrixBindGroup;static init(){this.modelMatrixBindGroup=new f0,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 En(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 En(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 o0,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 l0,this._reflectionEntriesMap.set(e,t)),this._reflectionEntriesMap.get(e)}}class E{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(E.lastShader!=t)E.lastShader=t;else return!1;E.lastPipeline!=t.pipeline&&(E.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=ve.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 s=r[i];e.setVertexBuffer(i,a.buffer,s.offset,s.size)}}}static cleanCache(){this.lastGeometry=null,this.lastPipeline=null,this.lastShader=null}static createPipeline(e){return ct.countStart("GPUContext","pipeline"),I.device.createRenderPipeline(e)}static beginCommandEncoder(){return ct.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,ct.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 s=this.multiTextureViewCache.get(t.multiTexture);s||(s=t.multiTexture.createView(),this.multiTextureViewCache.set(t.multiTexture,s)),i.view=s,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,s){e.drawIndexed(t,a,r,i,s),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 d0{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 h0{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 d0,this._normalAttrDataGroup=new d0}initMorphTarget(e){this._collectMorphTargetData=this.collectMorphTargetList(e),this._computeShader&&this._computeShader.destroy();let t=Xt.CsMain;this._computeShader=new Se(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,E.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("."),h=f[f.length-1];this._blendTarget[h]=u=>this.updateInfluence(c,u)}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 s=this.collectAttribute("a_morphNormals_",e),o;if(s&&s.length>0){let l=0;o=new Float32Array(r*a*3);for(let c=0;c<a;c++){let f=s[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,s=t.getAttribute(i);if(s)a[r]=s;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 y2=Object.defineProperty,C2=Object.getOwnPropertyDescriptor,wn=(n,e,t,a)=>{for(var r=a>1?void 0:a?C2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=(a?s(e,t,r):s(r))||r);return a&&r&&y2(e,t,r),r};d.MeshRenderer=class extends Ba{receiveShadow;morphData;constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(e){e.addComponent(d.MeshRenderer).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.receiveShadow=e.receiveShadow,this}get geometry(){return this._geometry}set geometry(e){if(super.geometry=e,e){let t=e.morphTargetDictionary!=null;t&&(this.morphData||=new h0,this.morphData.morphTargetsRelative=e.morphTargetsRelative,this.morphData.initMorphTarget(e)),this.morphData&&(this.morphData.enable=t),this.morphData?.enable?this.addRendererMask(Me.MorphTarget):this.removeRendererMask(Me.MorphTarget),this.object3D.bound=this._geometry.bounds.clone()}else this.morphData&&(this.morphData.enable=!1),this.removeRendererMask(Me.MorphTarget);this._readyPipeline||(this.initPipeline(),this._computes&&(this.onCompute=os(this.onCompute,()=>{for(let t=0;t<this._computes.length;t++)this._computes[t].onUpdate()})))}get material(){return this._materials[0]}set material(e){this.materials=[e]}setMorphInfluence(e,t){if(this.morphData&&this.morphData.enable){let a=this._geometry.morphTargetDictionary[e];a>=0&&this.morphData.updateInfluence(a,t)}}setMorphInfluenceIndex(e,t){this.morphData&&this.morphData.enable&&e>=0&&this.morphData.updateInfluence(e,t)}onCompute(e,t){this.morphData&&this.morphData.enable&&this.morphData.computeMorphTarget(t)}nodeUpdate(e,t,a,r){if(this.morphData&&this.morphData.enable)for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t);if(o)for(let l=0;l<o.length;l++)this.morphData.applyRenderShader(o[l])}super.nodeUpdate(e,t,a,r)}destroy(e){this.morphData&&(this.morphData.destroy(e),this.morphData=null),super.destroy(e)}},wn([jr],d.MeshRenderer.prototype,"geometry",1),wn([jr],d.MeshRenderer.prototype,"material",1),d.MeshRenderer=wn([Nt(d.MeshRenderer,"MeshRenderer")],d.MeshRenderer);class Qa{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 u0{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]:B.res.redTexture}}class Et extends dt{resolveTarget;sampleCount;autoResize;clear;constructor(e,t,a=le.rgba8unorm,r=!1,i,s=1,o=0,l=!0,c=!0){super(e,t,s),this.name=Gt(),this.autoResize=c,this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=s,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(nr.RESIZE,f=>{let{width:h,height:u}=f.data;this.resize(h,u),this._textureChange=!0},this)}resize(e,t){let a=I.device;this.gpuTexture&&(dt.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==le.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==le.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==le.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=Ht.clamp_to_edge,this.addressModeV=Ht.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 s=new Float32Array(e*t*4);const o=r.createBuffer({size:s.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,s);const l=E.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.endCommandEncoder(l)}clone(){let e=new Et(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 E.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class We{storeOp="store";loadOp="clear";clearValue=[0,0,0,0]}class nt{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 We;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 nt([],[]);return this.clone2Frame(e),e}}class Be extends nt{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,s){let o=this.renderTargets,l=this.rtDescriptors;if(i){let f=new We;f.loadOp="clear",this._colorBufferTex=wt.createRTTexture(e+Qa.colorBufferTex_NAME,t,a,le.rgba16float,!0),o.push(this._colorBufferTex),l.push(f)}this._compressGBufferTex=new Et(t,a,le.rgba32float,!1,void 0,1,0,!0,!0),o.push(this._compressGBufferTex),s?this.depthTexture=s:(this.depthTexture=new Et(t,a,le.depth24plus,!1,void 0,1,0,!0,!0),this.depthTexture.name=e+"_depthTexture");let c;c=new We,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 s;if(Be.gBufferMap.has(e))s=Be.gBufferMap.get(e);else{s=new Be;let o=I.presentationSize;s.createGBuffer(e,t==0?o[0]:t,a==0?o[1]:a,t!=0&&a!=0,r,i),Be.gBufferMap.set(e,s)}return s}static getGUIBufferFrame(){let e=this.getGBufferFrame(this.colorPass_GBuffer);return Be.getGBufferFrame(Be.gui_GBuffer,0,0,!0,e.depthTexture)}clone(){let e=new Be;return this.clone2Frame(e),e}}class Ye{static rendererPassState=new Map;static createRendererPassState(e,t=null){let a=Ye.rendererPassState.get(e);if(a||(a=new u0,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,Ye.rendererPassState.set(e,a)),e&&e.renderTargets.length>0){a.renderTargets=e.renderTargets,a.rtTextureDescriptors=e.rtDescriptors,a.renderPassDescriptor=Ye.getRenderPassDescriptor(a),a.renderPassDescriptor.depthStencilAttachment&&(a.renderPassDescriptor.depthStencilAttachment.depthLoadOp=e.depthLoadOp),t=="load"&&e?.renderTargets[0]&&e.renderTargets[0].name.startsWith(Be.gui_GBuffer)&&(a.renderPassDescriptor.colorAttachments[0].loadOp="load"),a.depthLoadOp=e.depthLoadOp,a.renderBundleEncoderDescriptor=Ye.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(Qa.colorBufferTex_NAME)!=-1&&(a.outColor=r)}}else a.renderPassDescriptor=Ye.getRenderPassDescriptor(a,t),a.renderBundleEncoderDescriptor=Ye.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 s=e.renderTargets[i],o=e.rtTextureDescriptors[i];a.push({view:s.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 $r extends Ve{width;height;segmentW;segmentH;up;constructor(e,t,a=1,r=1,i=g.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,s=this.segmentW+1;(this.segmentH+1)*s,this.bounds=new Ce(g.ZERO.clone(),new g(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),h;this.segmentW*this.segmentH*2*3>=Uint16Array.length?h=new Uint32Array(this.segmentW*this.segmentH*2*3):h=new Uint16Array(this.segmentW*this.segmentH*2*3),r=0;for(var b=0,A=0,m=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 g.Y_AXIS:l[b++]=t,l[b++]=0,l[b++]=a,c[A++]=0,c[A++]=1,c[A++]=0;break;case g.Z_AXIS:l[b++]=t,l[b++]=-a,l[b++]=0,c[A++]=0,c[A++]=0,c[A++]=1;break;case g.X_AXIS:l[b++]=0,l[b++]=t,l[b++]=a,c[A++]=1,c[A++]=0,c[A++]=0;break;default:l[b++]=t,l[b++]=0,l[b++]=a,c[A++]=0,c[A++]=1,c[A++]=0;break}f[m++]=D/this.segmentW,f[m++]=p/this.segmentH,D!=this.segmentW&&p!=this.segmentH&&(i=D+p*s,h[r++]=i+1,h[r++]=i,h[r++]=i+s,h[r++]=i+1,h[r++]=i+s,h[r++]=i+s+1)}this.setIndices(h),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:h.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}var S2=Object.getOwnPropertyDescriptor,x2=(n,e,t,a)=>{for(var r=a>1?void 0:a?S2(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.QuadShader=class extends gt{constructor(e="QuadGlsl_vs",t="QuadGlsl_fs"){super();let a=new qe(e,t);this.addRenderPass(a);let r=a.shaderState;a.blendMode=Ae.NONE,r.frontFace="cw",r.depthWriteEnabled=!1,r.depthCompare=it.always,r.multisample=0,this.setTexture("baseMap",B.res.blackTexture),this.setUniformFloat("x",0),this.setUniformFloat("y",0),this.setUniformFloat("width",100),this.setUniformFloat("height",100)}},d.QuadShader=x2([Ta(d.QuadShader,"QuadShader")],d.QuadShader);class Rn extends d.Object3D{width=128;height=128;quadRenderer;material;rendererPassState;quadShader;constructor(e="QuadGlsl_vs",t="QuadGlsl_fs",a,r=0,i=!1){super();let s=a?a.renderTargets:[];this.material=new Dt,this.quadShader=new d.QuadShader(e,t),this.material.shader=this.quadShader,this.quadRenderer=this.addComponent(d.MeshRenderer),this.quadRenderer.material=this.material,this.quadRenderer.castGI=!1,this.quadRenderer.castShadow=!1,this.quadRenderer.drawType=i?2:0,this.quadRenderer.geometry=new $r(100,100,1,1),this.quadRenderer.material=this.material,this.quadRenderer.__start(),this.quadRenderer._enable=!0,this.quadRenderer.onEnable(),this.rendererPassState=Ye.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:s.length>0?s[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT})),I.addEventListener(nr.RESIZE,o=>{this.rendererPassState=Ye.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:s.length>0?s[0].format:I.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT}))},this)}renderTarget(e,t,a){let r=e.camera,i=E.beginRenderPass(a,t.rendererPassState);E.bindCamera(i,r),t.quadRenderer.nodeUpdate(e,de.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,de.COLOR,t.rendererPassState,null,i),E.endPass(i)}renderToViewQuad(e,t,a,r){let i=e.camera;t.quadShader.setTexture("baseMap",r);let s=E.beginRenderPass(a,t.rendererPassState);E.bindCamera(s,i),t.quadRenderer.nodeUpdate(e,de.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,de.COLOR,t.rendererPassState,null,s),E.endPass(s)}}class wt{static rtTextureMap;static rtViewQuad;static init(){this.rtTextureMap=new Map,this.rtViewQuad=new Map}static createRTTexture(e,t,a,r,i=!1,s=0){let o=this.rtTextureMap.get(e);return o||(e==Qa.colorBufferTex_NAME?o=new Et(t,a,r,i,void 0,1,s,!1):o=new Et(t,a,r,i,void 0,1,s,!0),o.name=e,wt.rtTextureMap.set(e,o)),o}static createRTTextureArray(e,t,a,r,i=1,s=!1,o=0){let l=this.rtTextureMap.get(e);return l||(l=new Et(t,a,r,s,void 0,i,o),l.name=e,wt.rtTextureMap.set(e,l)),l}static createViewQuad(e,t,a,r,i=0){let s=new nt([r],[new We]),o=new Rn(t,a,s,i);return wt.rtViewQuad.set(e,o),o}static getTexture(e){return this.rtTextureMap.get(e)}static CreateSplitTexture(e){let t=this.getTexture(Qa.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(Qa.colorBufferTex_NAME),a=this.getTexture(e+"_split");const r=E.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}),E.endCommandEncoder(r)}}class In{command;encoder;rendererPassStates;rtFrame;constructor(e){this.rtFrame=e,this.rendererPassStates=[]}clean(){this.rendererPassStates.length=0,E.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=Ye.createRendererPassState(a,e);return this.rendererPassStates.push(r),r}else{this.rtFrame.depthLoadOp=t;let a=Ye.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=E.beginCommandEncoder(),this.command}endCommand(){E.endCommandEncoder(this.command),this.command=null}beginNewEncoder(){return this.encoder=E.beginRenderPass(this.command,this.rendererPassState),this.encoder}endEncoder(){E.endPass(this.encoder),this.encoder=null}}class Ma extends ja{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=Ye.createRendererPassState(e);let t=e.clone();t.depthLoadOp="load";for(const a of t.rtDescriptors)a.loadOp="load";this.splitRendererPassState=Ye.createRendererPassState(t)}this.renderContext=new In(e)}getRenderContext(e){return this._rtFrame=e,new In(e)}setIrradiance(e,t){this.rendererPassState.irradianceBuffer=[e,t]}compute(e,t){}render(e,t,a,r=!1){E.cleanCache();let i=e.camera,s=e.scene;this.rendererPassState.camera3D=i;let o=$.instance.getRenderNodes(s,i),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{let f=E.beginCommandEncoder(),h=E.beginRenderPass(f,this.rendererPassState);l.length>0&&h.executeBundles(l),!r&&$.instance.sky&&(E.bindCamera(h,i),$.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,h)),this.drawRenderNodes(e,h,f,o.opaqueList,t),E.endPass(h),E.endCommandEncoder(f)}{let f=E.beginCommandEncoder(),h=E.beginRenderPass(f,this.rendererPassState);c.length>0&&h.executeBundles(c),r||(E.bindCamera(h,i),this.drawRenderNodes(e,h,f,o.transparentList,t)),E.endPass(h),E.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=$.instance.getOpRenderGroup(e.scene);if(i){let s=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))s.push(o.bundleMap.get(this._rendererType));else{let l=E.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),s.push(c)}}),s}return[]}renderBundleTr(e,t,a,r){let i=$.instance.getTrRenderGroup(e.scene);if(i){let s=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))s.push(o.bundleMap.get(this._rendererType));else{let l=E.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),s.push(c)}}),s}return[]}recordRenderBundleNode(e,t,a,r){E.bindCamera(t,e.camera),E.bindGeometryBuffer(t,a[0].geometry);for(let i=0;i<a.length;++i){let s=a[i];s.transform.worldMatrix.index,s.transform.enable&&s.recordRenderPass2(e,this._rendererType,this.rendererPassState,r,t)}}drawRenderNodes(e,t,a,r,i,s){E.bindCamera(t,e.camera);for(let o=B.setting.render.drawOpMin;o<Math.min(r.length,B.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&l.renderPass2(e,this._rendererType,this.rendererPassState,s,t)}}}class b0 extends Ma{constructor(){super(),this.passType=de.COLOR}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,s=e.camera;ve.updateCameraGroup(s),this.rendererPassState.camera3D=s;let o=$.instance.getRenderNodes(i,s),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&&($.instance.getOpRenderGroup(i),f.executeBundles(l)),!r&&$.instance.sky&&(E.bindCamera(f,s),$.instance.sky.preInit(this._rendererType)||$.instance.sky.nodeUpdate(e,this._rendererType,this.rendererPassState,a),$.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,f)),o.opaqueList&&(E.bindCamera(f,s),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let f=this.renderContext.encoder;c.length>0&&f.executeBundles(c),!r&&o.transparentList&&(E.bindCamera(f,s),this.drawNodes(e,this.renderContext,o.transparentList,t,a));let h=$.instance.getGraphicList();for(let u=0;u<h.length;u++){const b=h[u];b.nodeUpdate(e,this._rendererType,this.splitRendererPassState,a),b.renderPass2(e,this._rendererType,this.splitRendererPassState,a,f)}this.renderContext.endRenderPass(),ct.end("ColorPass Draw Transparent")}}drawNodes(e,t,a,r,i){let s=$.instance.getRenderShaderCollect(e);if(s){for(const o of s){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=B.setting.render.drawOpMin;o<Math.min(a.length,B.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(l.hasMask(Me.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 Tn{frustumCullingList;zVisibleList;_renderList;static enable=!0;constructor(){this._renderList=new Map}occlusionRenderNodeTest(e){return B.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 ei extends Za{constructor(e,t){super(),this.bufferType=ga.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 ei(e*2*4),this.clustersUniformBuffer=new Ct(10),this.clustersUniformBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.lightAssignBuffer=new ei(e*t),this.lightAssignBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.assignTableBuffer=new ei(e*4),this.assignTableBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e,t,a,r,i,s,o,l,c,f){this.clustersUniformBuffer.setFloat("clusterTileX",r),this.clustersUniformBuffer.setFloat("clusterTileY",i),this.clustersUniformBuffer.setFloat("clusterTileZ",s),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 Rt{static clusterTileX=16;static clusterTileY=16;static clusterTileZ=32}let m0=`
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 A0 extends Ma{maxNumLightsPerCluster=64;clusterPix=1;clusterLightingBuffer;_currentLightCount=0;_clusterGenerateCompute;_clusterLightingCompute;_useCamera;resize=!1;constructor(e){super(),this.passType=de.Cluster,this.initCompute(e)}initCompute(e){this._clusterGenerateCompute=new Se(m0),this._clusterLightingCompute=new Se(p0);let t=I.presentationSize,a=Rt.clusterTileX*Rt.clusterTileY*Rt.clusterTileZ,r=e.camera,i=r.near,s=r.far;this.clusterLightingBuffer=new g0(a,this.maxNumLightsPerCluster),this.clusterLightingBuffer.update(t[0],t[1],this.clusterPix,Rt.clusterTileX,Rt.clusterTileY,Rt.clusterTileZ,0,this.maxNumLightsPerCluster,i,s),this._clusterGenerateCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterGenerateCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer);let o=ve.getLightEntries(e.scene);this._clusterLightingCompute.setStorageBuffer("models",ve.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=$.instance.getLights(a);if(this._useCamera!=e.camera){this._useCamera=e.camera;let o=ve.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=Rt.clusterTileZ,this._clusterLightingCompute.workerSizeX=Rt.clusterTileZ);let i=I.presentationSize;this.clusterLightingBuffer.update(i[0],i[1],this.clusterPix,Rt.clusterTileX,Rt.clusterTileY,Rt.clusterTileZ,r.length,this.maxNumLightsPerCluster,e.camera.near,e.camera.far),this.resize=!1;let s=E.beginCommandEncoder();E.computeCommand(s,[this._clusterGenerateCompute,this._clusterLightingCompute]),E.endCommandEncoder(s)}}class Ie extends dt{resolveTarget;sampleCount;clone(){let e=new Ie(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=le.rgba8unorm,r=!1,i,s=1,o=0,l=1){super(e,t,s),I.device,this.name=Gt(),this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=s,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&&(dt.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==le.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==le.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==le.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=Ht.mirror_repeat,this.addressModeV=Ht.mirror_repeat,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=I.device;const i=e*4;let s=new Float32Array(e*t*4);const o=r.createBuffer({size:s.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,s);const l=E.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.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 E.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class D0 extends d.Object3D{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=ht.createCamera3DObject(this,"up"),this.down_camera=ht.createCamera3DObject(this,"down"),this.left_camera=ht.createCamera3DObject(this,"left"),this.right_camera=ht.createCamera3DObject(this,"right"),this.front_camera=ht.createCamera3DObject(this,"front"),this.back_camera=ht.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(g.ZERO,g.UP,g.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(g.ZERO,g.DOWN,g.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(g.ZERO,g.LEFT),this.left_camera.object3D.scaleX=-1,this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(g.ZERO,g.RIGHT),this.right_camera.object3D.scaleX=-1,this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(g.ZERO,g.FORWARD),this.front_camera.object3D.scaleX=-1,this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(g.ZERO,g.BACK),this.back_camera.object3D.scaleX=-1,this.up_camera.type=it.shadow,this.down_camera.type=it.shadow,this.left_camera.type=it.shadow,this.right_camera.type=it.shadow,this.front_camera.type=it.shadow,this.back_camera.type=it.shadow}}class _0 extends dt{constructor(e,t,a){super(e,t,a),this.format=le.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:fr.linear,magFilter:fr.linear}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})}}class B0 extends Ma{shadowPassCount;_forceUpdate=!1;_shadowCameraDic;shadowCamera;cubeArrayTexture;colorTexture;shadowSize=1024;constructor(){super(),this.passType=de.POINT_SHADOW,this._shadowCameraDic=new Map,this.cubeArrayTexture=new _0(this.shadowSize,this.shadowSize,8),this.colorTexture=new Ie(this.shadowSize,this.shadowSize,le.bgra8unorm,!1),xe.getInstance().attached(this.cubeArrayTexture,this)}getShadowCamera(e,t){let a;if(this._shadowCameraDic.has(t))a=this._shadowCameraDic.get(t);else{let r=new D0(e.camera.near,e.camera.far,90,!0);r.label=t.name;let i=[],s=[];for(let o=0;o<6;o++){let l=new Ie(this.shadowSize,this.shadowSize,this.cubeArrayTexture.format,!1),c=new st([this.colorTexture],[new We]);l.name="shadowDepthTexture_"+t.name+o+"_face",i[o]=l,c.depthTexture=l,c.label="shadowRender",c.customSize=!0,s[o]=this.getRenderContext(c)}a={cubeCamera:r,depthTexture:i,renderContext:s},this._shadowCameraDic.set(t,a)}return a}render(e,t){if(!B.setting.shadow.enable)return;this.shadowPassCount=0,e.camera;let a=e.scene,r=Wt.getPointShadowLightWhichScene(a),i=r.length;for(let s=0;s<i;s++){let o=r[s];if(o.lightData.lightType!=ft.DirectionLight&&o.lightData.castShadowIndex>-1&&(o.needUpdateShadow||this._forceUpdate||ze.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=$.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=$.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=$.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=$.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=$.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=$.instance.getRenderNodes(a,l.cubeCamera.back_camera),this.renderSceneOnce(5,l,e,l.cubeCamera.back_camera,f,t);let h=E.beginCommandEncoder();for(let u=0;u<6;u++)h.copyTextureToTexture({texture:l.depthTexture[u].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+u}},{width:this.shadowSize,height:this.shadowSize,depthOrArrayLayers:1});E.endCommandEncoder(h)}}this._forceUpdate=!1}renderSceneOnce(e,t,a,r,i,s){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,s),this.drawShadowRenderNodes(a,r,o,i.transparentList,s),o.endRenderPass()}drawShadowRenderNodes(e,t,a,r,i){ve.updateCameraGroup(t),E.bindCamera(a.encoder,t),this.drawNodes(e,t,a,r,i,null)}drawNodes(e,t,a,r,i,s){let o=$.instance.getRenderShaderCollect(e);if(o){for(const l of o){let c=l[1];for(const f of c){let h=f[1];if(!h.isDestroyed&&h.preInit(this._rendererType)){h.nodeUpdate(e,this._rendererType,a.rendererPassState,s);break}}}for(let l=B.setting.render.drawOpMin;l<Math.min(r.length,B.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,s);for(let f of c.materials){let h=f.getPass(this._rendererType);if(!(!h||h.length==0))for(let u of h){const b=u;b.pipeline&&(b.setUniformFloat("cameraFar",t.far),b.setUniformVector3("lightWorldPos",t.transform.worldPosition),b.materialDataUniformBuffer.apply())}}c.renderPass(e,this.passType,a)}}}}}class v0 extends dt{constructor(e,t,a=le.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 U0 extends Ma{shadowPassCount;depth2DArrayTexture;rendererPassStates;_forceUpdate=!1;constructor(){super(),this.setShadowMap(B.setting.shadow.shadowSize,ia.Cascades),this.passType=de.SHADOW}setShadowMap(e,t){this.rendererPassStates=[],this.depth2DArrayTexture=new v0(e,e,le.depth32float,8),xe.getInstance().attached(this.depth2DArrayTexture,this);for(let a=0;a<8;a++){let r=new st([],[]);const i=new Ie(e,e,le.depth32float,!1);i.name=`shadowDepthTexture_${a}`,r.depthTexture=i,r.label="shadowRender",r.customSize=!0,r.depthCleanValue=1;let s=Ye.createRendererPassState(r);this.rendererPassStates[a]=s}}render(e,t){let a=B.setting.shadow;if(!a.enable)return;let r=e.camera,i=e.scene;if(this.shadowPassCount=0,!a.needUpdate||ze.frame%a.updateFrameRate!=0)return;let s=Wt.getDirectShadowLightWhichScene(i),o=a.shadowSize;const l=ia.Cascades;for(let c of s){const f=c;let h=f.shadowIndex;this.rendererPassState=this.rendererPassStates[h],o=this.rendererPassState.depthTexture.width;let u=$.instance.getRenderShaderCollect(e);for(const b of u){let A=b[1];for(const m of A){let p=m[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&&h==0)for(let b=0;b<l;b++){this.rendererPassState=this.rendererPassStates[b];let A=r.csm.children[b],m=r.getCSMShadowWorldExtents(b);this.poseShadowCamera(r,f.direction,A.shadowCamera,m,A.bound.center),this.renderShadow(e,A.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,b,o)}else{r.enableCSM&&(h+=l-1);let b=r.getShadowWorldExtents();this.rendererPassState=this.rendererPassStates[h],this.poseShadowCamera(r,f.direction,f.shadowCamera,b,r.lookTarget),this.renderShadow(e,f.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,h,o)}}this._forceUpdate=!1}copyDepthTexture(e,t,a,r){let i=E.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}),E.endCommandEncoder(i)}_shadowPos=new g;_shadowCameraTarget=new g;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=$.instance.getRenderNodes(e.scene,t),s=E.beginCommandEncoder(),o=E.beginRenderPass(s,r);t.transform.updateWorldMatrix(),Tn.enable&&(a.update(t,e.scene),a.collect(i,t)),ve.updateCameraGroup(t),E.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),E.endPass(o),E.endCommandEncoder(s)}renderShadowBundleOp(e,t,a){let r=$.instance.getOpRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(s=>{if(s.bundleMap.has(this._rendererType))i.push(s.bundleMap.get(this._rendererType));else{let o=E.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,s.renderNodes);let l=o.finish();s.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}renderShadowBundleTr(e,t,a){let r=$.instance.getTrRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(s=>{if(s.bundleMap.has(this._rendererType))i.push(s.bundleMap.get(this._rendererType));else{let o=E.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,s.renderNodes);let l=o.finish();s.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}recordShadowRenderBundleNode(e,t,a,r,i){if(ve.updateCameraGroup(t),E.bindCamera(a,t),r){E.bindGeometryBuffer(a,r[0].geometry);for(let s=0;s<r.length;++s){let o=r[s];o.transform.enable&&o.recordRenderPass2(e,this._rendererType,this.rendererPassState,i,a)}}}drawShadowRenderNodes(e,t,a,r,i){if(ve.updateCameraGroup(t),E.bindCamera(a,t),r)for(let s=B.setting.render.drawOpMin;s<Math.min(r.length,B.setting.render.drawOpMax);++s){let o=r[s];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 y0 extends Ma{zBufferTexture;useRenderBundle=!1;shadowPassCount;zCullingCompute;constructor(){super(),this.passType=de.DEPTH;let e=I.presentationSize,t=1;this.zBufferTexture=wt.createRTTexture(Qa.zBufferTexture_NAME,Math.floor(e[0]*t),Math.floor(e[1]*t),le.rgba16float,!1);let a=new We;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=new st([],[],wt.createRTTexture(Qa.zPreDepthTexture_NAME,Math.floor(e[0]),Math.floor(e[1]),le.depth32float,!1),null,!1);this.setRenderStates(r)}render(e,t){let a=e.camera,r=e.scene;E.cleanCache(),ct.start("DepthPass Renderer");let i=r;this.rendererPassState.camera3D=a;let s=$.instance.getRenderNodes(i,a);this.compute(e,t);let o=this.renderBundleOp(e,s,t),l=[],c=E.beginCommandEncoder(),f=E.beginRenderPass(c,this.rendererPassState);o.length>0&&f.executeBundles(o);let h=$.instance.getRenderShaderCollect(e);for(const u of h){let b=u[1];for(const A of b){let m=A[1];if(!m.isDestroyed&&m.preInit(this._rendererType)){m.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}this.drawRenderNodes(e,f,c,s.opaqueList,t),l.length>0&&f.executeBundles(l),E.endPass(f),E.endCommandEncoder(c),ct.end("DepthPass Renderer")}drawRenderNodes(e,t,a,r,i,s){E.bindCamera(t,e.camera);for(let o=B.setting.render.drawOpMin;o<Math.min(r.length,B.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,s,t)))}}}class C0{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 S0 extends Ma{finalQuadView;postList;constructor(){super(),this._rendererType=de.POST,this.postList=new Map,this.initRenderer()}initRenderer(){X.register("FullQuad_vert_wgsl",Nl),this.finalQuadView=new Rn("Quad_vert_wgsl","Quad_frag_wgsl",new st([],[]),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=E.beginCommandEncoder();this.postList.forEach(a=>{a.enable&&a.render(e,t)}),E.endCommandEncoder(t)}presentContent(e,t){let a=E.beginCommandEncoder();this.finalQuadView.renderToViewQuad(e,this.finalQuadView,a,t),E.endCommandEncoder(a)}}class Jt{enable=!0;postRenderer;rtViewQuad;virtualTexture;constructor(){this.rtViewQuad=new Map,this.virtualTexture=new Map,I.addEventListener(nr.RESIZE,this.onResize,this)}createRTTexture(e,t,a,r,i=!1,s=0){let o=wt.createRTTexture(e,t,a,r,i,s);return o.name=e,this.virtualTexture.set(e,o),xe.getInstance().attached(o,this),o}createViewQuad(e,t,a,r=0){let i=wt.createViewQuad(e,"Quad_vert_wgsl",t,a,r);return this.rtViewQuad.set(e,i),i}getOutTexture(){let e,t=E.lastRenderPassState.renderTargets;return t.length>0?e=t[0]:e=wt.getTexture(Qa.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=E.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];xe.getInstance().detached(a,this),a.destroy(e)}}}class Qn extends d.Object3D{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=ht.createCamera3DObject(this,"up"),this.down_camera=ht.createCamera3DObject(this,"down"),this.left_camera=ht.createCamera3DObject(this,"left"),this.right_camera=ht.createCamera3DObject(this,"right"),this.front_camera=ht.createCamera3DObject(this,"front"),this.back_camera=ht.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(g.ZERO,g.UP,g.DOWN),this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(g.ZERO,g.DOWN,g.DOWN),this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(g.ZERO,g.LEFT),this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(g.ZERO,g.RIGHT),this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(g.ZERO,g.FORWARD),this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(g.ZERO,g.BACK),this.up_camera.type=it.shadow,this.down_camera.type=it.shadow,this.left_camera.type=it.shadow,this.right_camera.type=it.shadow,this.front_camera.type=it.shadow,this.back_camera.type=it.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 x0=`
6360
+ `;class A0 extends Ma{maxNumLightsPerCluster=64;clusterPix=1;clusterLightingBuffer;_currentLightCount=0;_clusterGenerateCompute;_clusterLightingCompute;_useCamera;resize=!1;constructor(e){super(),this.passType=de.Cluster,this.initCompute(e)}initCompute(e){this._clusterGenerateCompute=new Se(m0),this._clusterLightingCompute=new Se(p0);let t=I.presentationSize,a=Rt.clusterTileX*Rt.clusterTileY*Rt.clusterTileZ,r=e.camera,i=r.near,s=r.far;this.clusterLightingBuffer=new g0(a,this.maxNumLightsPerCluster),this.clusterLightingBuffer.update(t[0],t[1],this.clusterPix,Rt.clusterTileX,Rt.clusterTileY,Rt.clusterTileZ,0,this.maxNumLightsPerCluster,i,s),this._clusterGenerateCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterGenerateCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer);let o=ve.getLightEntries(e.scene);this._clusterLightingCompute.setStorageBuffer("models",ve.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=$.instance.getLights(a);if(this._useCamera!=e.camera){this._useCamera=e.camera;let o=ve.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=Rt.clusterTileZ,this._clusterLightingCompute.workerSizeX=Rt.clusterTileZ);let i=I.presentationSize;this.clusterLightingBuffer.update(i[0],i[1],this.clusterPix,Rt.clusterTileX,Rt.clusterTileY,Rt.clusterTileZ,r.length,this.maxNumLightsPerCluster,e.camera.near,e.camera.far),this.resize=!1;let s=E.beginCommandEncoder();E.computeCommand(s,[this._clusterGenerateCompute,this._clusterLightingCompute]),E.endCommandEncoder(s)}}class Ie extends dt{resolveTarget;sampleCount;clone(){let e=new Ie(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=le.rgba8unorm,r=!1,i,s=1,o=0,l=1){super(e,t,s),I.device,this.name=Gt(),this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=s,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&&(dt.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==le.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==le.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==le.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=Ht.mirror_repeat,this.addressModeV=Ht.mirror_repeat,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=I.device;const i=e*4;let s=new Float32Array(e*t*4);const o=r.createBuffer({size:s.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,s);const l=E.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),E.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 E.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class D0 extends d.Object3D{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=ht.createCamera3DObject(this,"up"),this.down_camera=ht.createCamera3DObject(this,"down"),this.left_camera=ht.createCamera3DObject(this,"left"),this.right_camera=ht.createCamera3DObject(this,"right"),this.front_camera=ht.createCamera3DObject(this,"front"),this.back_camera=ht.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(g.ZERO,g.UP,g.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(g.ZERO,g.DOWN,g.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(g.ZERO,g.LEFT),this.left_camera.object3D.scaleX=-1,this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(g.ZERO,g.RIGHT),this.right_camera.object3D.scaleX=-1,this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(g.ZERO,g.FORWARD),this.front_camera.object3D.scaleX=-1,this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(g.ZERO,g.BACK),this.back_camera.object3D.scaleX=-1,this.up_camera.type=st.shadow,this.down_camera.type=st.shadow,this.left_camera.type=st.shadow,this.right_camera.type=st.shadow,this.front_camera.type=st.shadow,this.back_camera.type=st.shadow}}class _0 extends dt{constructor(e,t,a){super(e,t,a),this.format=le.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:fr.linear,magFilter:fr.linear}),this.gpuSampler_comparison=I.device.createSampler({compare:"less",label:"sampler_comparison"})}}class B0 extends Ma{shadowPassCount;_forceUpdate=!1;_shadowCameraDic;shadowCamera;cubeArrayTexture;colorTexture;shadowSize=1024;constructor(){super(),this.passType=de.POINT_SHADOW,this._shadowCameraDic=new Map,this.cubeArrayTexture=new _0(this.shadowSize,this.shadowSize,8),this.colorTexture=new Ie(this.shadowSize,this.shadowSize,le.bgra8unorm,!1),xe.getInstance().attached(this.cubeArrayTexture,this)}getShadowCamera(e,t){let a;if(this._shadowCameraDic.has(t))a=this._shadowCameraDic.get(t);else{let r=new D0(e.camera.near,e.camera.far,90,!0);r.label=t.name;let i=[],s=[];for(let o=0;o<6;o++){let l=new Ie(this.shadowSize,this.shadowSize,this.cubeArrayTexture.format,!1),c=new nt([this.colorTexture],[new We]);l.name="shadowDepthTexture_"+t.name+o+"_face",i[o]=l,c.depthTexture=l,c.label="shadowRender",c.customSize=!0,s[o]=this.getRenderContext(c)}a={cubeCamera:r,depthTexture:i,renderContext:s},this._shadowCameraDic.set(t,a)}return a}render(e,t){if(!B.setting.shadow.enable)return;this.shadowPassCount=0,e.camera;let a=e.scene,r=Wt.getPointShadowLightWhichScene(a),i=r.length;for(let s=0;s<i;s++){let o=r[s];if(o.lightData.lightType!=ft.DirectionLight&&o.lightData.castShadowIndex>-1&&(o.needUpdateShadow||this._forceUpdate||ze.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=$.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=$.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=$.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=$.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=$.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=$.instance.getRenderNodes(a,l.cubeCamera.back_camera),this.renderSceneOnce(5,l,e,l.cubeCamera.back_camera,f,t);let h=E.beginCommandEncoder();for(let u=0;u<6;u++)h.copyTextureToTexture({texture:l.depthTexture[u].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+u}},{width:this.shadowSize,height:this.shadowSize,depthOrArrayLayers:1});E.endCommandEncoder(h)}}this._forceUpdate=!1}renderSceneOnce(e,t,a,r,i,s){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,s),this.drawShadowRenderNodes(a,r,o,i.transparentList,s),o.endRenderPass()}drawShadowRenderNodes(e,t,a,r,i){ve.updateCameraGroup(t),E.bindCamera(a.encoder,t),this.drawNodes(e,t,a,r,i,null)}drawNodes(e,t,a,r,i,s){let o=$.instance.getRenderShaderCollect(e);if(o){for(const l of o){let c=l[1];for(const f of c){let h=f[1];if(!h.isDestroyed&&h.preInit(this._rendererType)){h.nodeUpdate(e,this._rendererType,a.rendererPassState,s);break}}}for(let l=B.setting.render.drawOpMin;l<Math.min(r.length,B.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,s);for(let f of c.materials){let h=f.getPass(this._rendererType);if(!(!h||h.length==0))for(let u of h){const b=u;b.pipeline&&(b.setUniformFloat("cameraFar",t.far),b.setUniformVector3("lightWorldPos",t.transform.worldPosition),b.materialDataUniformBuffer.apply())}}c.renderPass(e,this.passType,a)}}}}}class v0 extends dt{constructor(e,t,a=le.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 U0 extends Ma{shadowPassCount;depth2DArrayTexture;rendererPassStates;_forceUpdate=!1;constructor(){super(),this.setShadowMap(B.setting.shadow.shadowSize,ia.Cascades),this.passType=de.SHADOW}setShadowMap(e,t){this.rendererPassStates=[],this.depth2DArrayTexture=new v0(e,e,le.depth32float,8),xe.getInstance().attached(this.depth2DArrayTexture,this);for(let a=0;a<8;a++){let r=new nt([],[]);const i=new Ie(e,e,le.depth32float,!1);i.name=`shadowDepthTexture_${a}`,r.depthTexture=i,r.label="shadowRender",r.customSize=!0,r.depthCleanValue=1;let s=Ye.createRendererPassState(r);this.rendererPassStates[a]=s}}render(e,t){let a=B.setting.shadow;if(!a.enable)return;let r=e.camera,i=e.scene;if(this.shadowPassCount=0,!a.needUpdate||ze.frame%a.updateFrameRate!=0)return;let s=Wt.getDirectShadowLightWhichScene(i),o=a.shadowSize;const l=ia.Cascades;for(let c of s){const f=c;let h=f.shadowIndex;this.rendererPassState=this.rendererPassStates[h],o=this.rendererPassState.depthTexture.width;let u=$.instance.getRenderShaderCollect(e);for(const b of u){let A=b[1];for(const m of A){let p=m[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&&h==0)for(let b=0;b<l;b++){this.rendererPassState=this.rendererPassStates[b];let A=r.csm.children[b],m=r.getCSMShadowWorldExtents(b);this.poseShadowCamera(r,f.direction,A.shadowCamera,m,A.bound.center),this.renderShadow(e,A.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,b,o)}else{r.enableCSM&&(h+=l-1);let b=r.getShadowWorldExtents();this.rendererPassState=this.rendererPassStates[h],this.poseShadowCamera(r,f.direction,f.shadowCamera,b,r.lookTarget),this.renderShadow(e,f.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,h,o)}}this._forceUpdate=!1}copyDepthTexture(e,t,a,r){let i=E.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}),E.endCommandEncoder(i)}_shadowPos=new g;_shadowCameraTarget=new g;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=$.instance.getRenderNodes(e.scene,t),s=E.beginCommandEncoder(),o=E.beginRenderPass(s,r);t.transform.updateWorldMatrix(),Tn.enable&&(a.update(t,e.scene),a.collect(i,t)),ve.updateCameraGroup(t),E.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),E.endPass(o),E.endCommandEncoder(s)}renderShadowBundleOp(e,t,a){let r=$.instance.getOpRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(s=>{if(s.bundleMap.has(this._rendererType))i.push(s.bundleMap.get(this._rendererType));else{let o=E.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,s.renderNodes);let l=o.finish();s.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}renderShadowBundleTr(e,t,a){let r=$.instance.getTrRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(s=>{if(s.bundleMap.has(this._rendererType))i.push(s.bundleMap.get(this._rendererType));else{let o=E.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,s.renderNodes);let l=o.finish();s.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}recordShadowRenderBundleNode(e,t,a,r,i){if(ve.updateCameraGroup(t),E.bindCamera(a,t),r){E.bindGeometryBuffer(a,r[0].geometry);for(let s=0;s<r.length;++s){let o=r[s];o.transform.enable&&o.recordRenderPass2(e,this._rendererType,this.rendererPassState,i,a)}}}drawShadowRenderNodes(e,t,a,r,i){if(ve.updateCameraGroup(t),E.bindCamera(a,t),r)for(let s=B.setting.render.drawOpMin;s<Math.min(r.length,B.setting.render.drawOpMax);++s){let o=r[s];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 y0 extends Ma{zBufferTexture;useRenderBundle=!1;shadowPassCount;zCullingCompute;constructor(){super(),this.passType=de.DEPTH;let e=I.presentationSize,t=1;this.zBufferTexture=wt.createRTTexture(Qa.zBufferTexture_NAME,Math.floor(e[0]*t),Math.floor(e[1]*t),le.rgba16float,!1);let a=new We;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=new nt([],[],wt.createRTTexture(Qa.zPreDepthTexture_NAME,Math.floor(e[0]),Math.floor(e[1]),le.depth32float,!1),null,!1);this.setRenderStates(r)}render(e,t){let a=e.camera,r=e.scene;E.cleanCache(),ct.start("DepthPass Renderer");let i=r;this.rendererPassState.camera3D=a;let s=$.instance.getRenderNodes(i,a);this.compute(e,t);let o=this.renderBundleOp(e,s,t),l=[],c=E.beginCommandEncoder(),f=E.beginRenderPass(c,this.rendererPassState);o.length>0&&f.executeBundles(o);let h=$.instance.getRenderShaderCollect(e);for(const u of h){let b=u[1];for(const A of b){let m=A[1];if(!m.isDestroyed&&m.preInit(this._rendererType)){m.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}this.drawRenderNodes(e,f,c,s.opaqueList,t),l.length>0&&f.executeBundles(l),E.endPass(f),E.endCommandEncoder(c),ct.end("DepthPass Renderer")}drawRenderNodes(e,t,a,r,i,s){E.bindCamera(t,e.camera);for(let o=B.setting.render.drawOpMin;o<Math.min(r.length,B.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,s,t)))}}}class C0{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 S0 extends Ma{finalQuadView;postList;constructor(){super(),this._rendererType=de.POST,this.postList=new Map,this.initRenderer()}initRenderer(){X.register("FullQuad_vert_wgsl",Nl),this.finalQuadView=new Rn("Quad_vert_wgsl","Quad_frag_wgsl",new nt([],[]),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=E.beginCommandEncoder();this.postList.forEach(a=>{a.enable&&a.render(e,t)}),E.endCommandEncoder(t)}presentContent(e,t){let a=E.beginCommandEncoder();this.finalQuadView.renderToViewQuad(e,this.finalQuadView,a,t),E.endCommandEncoder(a)}}class Jt{enable=!0;postRenderer;rtViewQuad;virtualTexture;constructor(){this.rtViewQuad=new Map,this.virtualTexture=new Map,I.addEventListener(nr.RESIZE,this.onResize,this)}createRTTexture(e,t,a,r,i=!1,s=0){let o=wt.createRTTexture(e,t,a,r,i,s);return o.name=e,this.virtualTexture.set(e,o),xe.getInstance().attached(o,this),o}createViewQuad(e,t,a,r=0){let i=wt.createViewQuad(e,"Quad_vert_wgsl",t,a,r);return this.rtViewQuad.set(e,i),i}getOutTexture(){let e,t=E.lastRenderPassState.renderTargets;return t.length>0?e=t[0]:e=wt.getTexture(Qa.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=E.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];xe.getInstance().detached(a,this),a.destroy(e)}}}class Qn extends d.Object3D{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=ht.createCamera3DObject(this,"up"),this.down_camera=ht.createCamera3DObject(this,"down"),this.left_camera=ht.createCamera3DObject(this,"left"),this.right_camera=ht.createCamera3DObject(this,"right"),this.front_camera=ht.createCamera3DObject(this,"front"),this.back_camera=ht.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(g.ZERO,g.UP,g.DOWN),this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(g.ZERO,g.DOWN,g.DOWN),this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(g.ZERO,g.LEFT),this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(g.ZERO,g.RIGHT),this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(g.ZERO,g.FORWARD),this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(g.ZERO,g.BACK),this.up_camera.type=st.shadow,this.down_camera.type=st.shadow,this.left_camera.type=st.shadow,this.right_camera.type=st.shadow,this.front_camera.type=st.shadow,this.back_camera.type=st.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 x0=`
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 Mn extends Jt{postQuad;renderTexture;constructor(){super();let[e,t]=I.presentationSize;X.register("FXAA_Shader",k0),this.renderTexture=this.createRTTexture("FXAAPost",e,t,le.rgba16float),this.postQuad=this.createViewQuad("fxaa","FXAA_Shader",this.renderTexture),this.postQuad.quadShader.setUniform("u_texel",new fe(1/e,1/t)),this.postQuad.quadShader.setUniform("u_strength",4)}onResize(){let[e,t]=I.presentationSize;this.renderTexture.resize(e,t)}onAttach(e){B.setting.render.postProcessing.fxaa.enable=!0}onDetach(e){B.setting.render.postProcessing.fxaa.enable=!1}}class E0{rendererMap;shadowMapPassRenderer;pointLightShadowRenderer;ddgiProbeRenderer;_postRenderer;get postRenderer(){if(!this._postRenderer){let e=Be.getGBufferFrame("ColorPassGBuffer");this._postRenderer=this.addRenderer(S0),this._postRenderer.setRenderStates(e)}return this._postRenderer}clusterLightingRender;reflectionRenderer;occlusionSystem;depthPassRenderer;get colorPassRenderer(){return this.rendererMap.getRenderer(de.COLOR)}pauseRender=!1;pickFire;renderState=!1;_view;constructor(e){this._view=e,this.rendererMap=new C0,this.occlusionSystem=new Tn,this.clusterLightingRender=this.addRenderer(A0,e),this.reflectionRenderer=this.addRenderer(F0,e),B.setting.render.zPrePass&&(this.depthPassRenderer=this.addRenderer(y0)),this.shadowMapPassRenderer=new U0,this.pointLightShadowRenderer=new B0,B.setting.render.postProcessing.fxaa.enable&&this.addPost(new Mn)}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 Jt&&this.postRenderer.attachPost(this.view,e),e}removePost(e){if(e instanceof Jt)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;ct.startView(e),this.clusterLightingRender&&(ve.getLightEntries(e.scene).update(e),ve.getReflectionEntries(e.scene).update(e)),B.setting.occlusionQuery.enable&&this.occlusionSystem&&this.occlusionSystem.update(e.camera,e.scene),this.clusterLightingRender&&this.clusterLightingRender.render(e,this.occlusionSystem),B.setting.shadow.enable&&this.shadowMapPassRenderer&&(Wt.update(e),this.shadowMapPassRenderer.render(e,this.occlusionSystem)),B.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)),B.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 s=t[i];s.compute(e,this.occlusionSystem),s.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1)}this.postRenderer.render(e);let a=this.rendererMap.getRenderer(de.UI);a.compute(e,this.occlusionSystem),a.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1);let r=Be.getGUIBufferFrame().getColorTexture();this.postRenderer.presentContent(e,r)}debug(){}}class w0 extends st{constructor(e,t,a=!0){super([],[]),this.crateGBuffer(e,t,a)}crateGBuffer(e,t,a){let r=this.renderTargets,i=this.rtDescriptors,s=new Et(e,t,le.rgba16float,!1,void 0,1,0,!0,a);s.name="positionMap";let o=new We;o.loadOp="load";let l=new Et(e,t,le.rgba16float,!1,void 0,1,0,!0,a);l.name="normalMap";let c=new We;c.loadOp="load";let f=new Et(e,t,le.rgba16float,!1,void 0,1,0,!0,a);f.name="colorMap";let h=new We;h.loadOp="load";let u=new Et(e,t,le.depth24plus,!1,void 0,1,0,!0,a);u.name="depthTexture";let b=new We;b.loadOp="load",r.push(s),r.push(l),r.push(f),i.push(o),i.push(c),i.push(h),this.depthTexture=u}}let R0=`
6635
+ `;class Mn extends Jt{postQuad;renderTexture;constructor(){super();let[e,t]=I.presentationSize;X.register("FXAA_Shader",k0),this.renderTexture=this.createRTTexture("FXAAPost",e,t,le.rgba16float),this.postQuad=this.createViewQuad("fxaa","FXAA_Shader",this.renderTexture),this.postQuad.quadShader.setUniform("u_texel",new fe(1/e,1/t)),this.postQuad.quadShader.setUniform("u_strength",4)}onResize(){let[e,t]=I.presentationSize;this.renderTexture.resize(e,t)}onAttach(e){B.setting.render.postProcessing.fxaa.enable=!0}onDetach(e){B.setting.render.postProcessing.fxaa.enable=!1}}class E0{rendererMap;shadowMapPassRenderer;pointLightShadowRenderer;ddgiProbeRenderer;_postRenderer;get postRenderer(){if(!this._postRenderer){let e=Be.getGBufferFrame("ColorPassGBuffer");this._postRenderer=this.addRenderer(S0),this._postRenderer.setRenderStates(e)}return this._postRenderer}clusterLightingRender;reflectionRenderer;occlusionSystem;depthPassRenderer;get colorPassRenderer(){return this.rendererMap.getRenderer(de.COLOR)}pauseRender=!1;pickFire;renderState=!1;_view;constructor(e){this._view=e,this.rendererMap=new C0,this.occlusionSystem=new Tn,this.clusterLightingRender=this.addRenderer(A0,e),this.reflectionRenderer=this.addRenderer(F0,e),B.setting.render.zPrePass&&(this.depthPassRenderer=this.addRenderer(y0)),this.shadowMapPassRenderer=new U0,this.pointLightShadowRenderer=new B0,B.setting.render.postProcessing.fxaa.enable&&this.addPost(new Mn)}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 Jt&&this.postRenderer.attachPost(this.view,e),e}removePost(e){if(e instanceof Jt)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;ct.startView(e),this.clusterLightingRender&&(ve.getLightEntries(e.scene).update(e),ve.getReflectionEntries(e.scene).update(e)),B.setting.occlusionQuery.enable&&this.occlusionSystem&&this.occlusionSystem.update(e.camera,e.scene),this.clusterLightingRender&&this.clusterLightingRender.render(e,this.occlusionSystem),B.setting.shadow.enable&&this.shadowMapPassRenderer&&(Wt.update(e),this.shadowMapPassRenderer.render(e,this.occlusionSystem)),B.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)),B.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 s=t[i];s.compute(e,this.occlusionSystem),s.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1)}this.postRenderer.render(e);let a=this.rendererMap.getRenderer(de.UI);a.compute(e,this.occlusionSystem),a.render(e,this.occlusionSystem,this.clusterLightingRender.clusterLightingBuffer,!1);let r=Be.getGUIBufferFrame().getColorTexture();this.postRenderer.presentContent(e,r)}debug(){}}class w0 extends nt{constructor(e,t,a=!0){super([],[]),this.crateGBuffer(e,t,a)}crateGBuffer(e,t,a){let r=this.renderTargets,i=this.rtDescriptors,s=new Et(e,t,le.rgba16float,!1,void 0,1,0,!0,a);s.name="positionMap";let o=new We;o.loadOp="load";let l=new Et(e,t,le.rgba16float,!1,void 0,1,0,!0,a);l.name="normalMap";let c=new We;c.loadOp="load";let f=new Et(e,t,le.rgba16float,!1,void 0,1,0,!0,a);f.name="colorMap";let h=new We;h.loadOp="load";let u=new Et(e,t,le.depth24plus,!1,void 0,1,0,!0,a);u.name="depthTexture";let b=new We;b.loadOp="load",r.push(s),r.push(l),r.push(f),i.push(o),i.push(c),i.push(h),this.depthTexture=u}}let R0=`
6608
6636
  #include "GenerayRandomDir"
6609
6637
  #include "MathShader"
6610
6638
  #include "IrradianceVolumeData_frag"
@@ -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 Ud{sunRadius=500;sunRadiance=11;mieG=.76;mieHeight=1200;eyePos=1500;sunX=.71;sunY=.56;sunBrightness=1;displaySun=!0;defaultTextureCubeSize=512;defaultTexture2DSize=1024;skyColor=new Z(1,1,1,1)}class yd extends ks{_internalTexture;_cubeSize;setting;constructor(e){return super(),this.setting=e,this._cubeSize=e.defaultTextureCubeSize,this._internalTexture=new Qb(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 Qb extends Ie{_computeShader;_uniformBuffer;constructor(e,t){super(e,t,le.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 Se(vd.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=E.beginCommandEncoder();return E.computeCommand(t,[this._computeShader]),E.endCommandEncoder(t),this}}var Mb=Object.getOwnPropertyDescriptor,Pb=(n,e,t,a)=>{for(var r=a>1?void 0:a?Mb(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.SkyShader=class extends gt{constructor(){super();let e=new qe("sky_vs_frag_wgsl","sky_fs_frag_wgsl");this.addRenderPass(e),e.setUniformVector3("eyesPos",new g),e.setUniformFloat("exposure",1),e.setUniformFloat("roughness",0);let t=e.shaderState;t.frontFace="cw",t.cullMode=Vt.back,t.depthWriteEnabled=!1,t.depthCompare=lt.less}},d.SkyShader=Pb([Ta(d.SkyShader,"SkyShader")],d.SkyShader);class Cd extends Dt{constructor(){super(),this.shader=new d.SkyShader,this.shader.setUniformVector3("eyesPos",new g),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 B.setting.sky.skyExposure}set exposure(e){B.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 Sd extends Ba{gid=0;needUpdate=!0;autoUpdate=!1;radius=500;init(){super.init(),this.addRendererMask(Me.Reflection),this.alwaysRender=!0,this.object3D.bound=new Ce(g.ZERO.clone(),g.MAX),os(this.transform.onPositionChange,()=>{this.needUpdate=!0})}onEnable(){$.instance.addRenderNode(this.transform.scene3D,this)}onDisable(){$.instance.removeRenderNode(this.transform.scene3D,this)}renderPass2(e,t,a,r,i,s=!1){super.renderPass2(e,t,a,r,i,s)}}class xd extends gt{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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}}class Fd extends Dt{constructor(){super(),this.shader=new xd,this.baseMap=B.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 Tr{center=new g;extents;max;min;size;tmpVecA=new g;tmpVecB=new g;tmpVecC=new g;tmpVecD=new g;radius=0;diffBetweenPoints=new g;owner;forward=new g(0,0,1);worldCenter;worldSize;_center=new g;constructor(e,t){this.center=e||new g(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 s=r*r-i;if(s<0)return!1;var o=Math.abs(-r-Math.sqrt(s));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 Tr(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 kd extends Sd{init(){super.init(),this.castShadow=!1,this.castGI=!1,this.addRendererMask(Me.Reflection),this.alwaysRender=!0,this.object3D.bound=new Tr(g.ZERO.clone(),this.radius)}debug(e,t=1){let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);r.addMask(Me.ReflectionDebug),r.geometry=new Ir(25,30,30);let i=B.setting.reflectionSetting,s=Be.getGBufferFrame(Be.reflections_GBuffer,i.width,i.height),o=new Fd;o.reflectionIndex=e,o.baseMap=s.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,s=!1){super.renderPass2(e,t,a,r,i,s)}}class ws extends d.MeshRenderer{skyMaterial;init(){super.init(),this.castShadow=!1,this.castGI=!0,this.addRendererMask(Me.Sky),this.alwaysRender=!0,this.object3D.bound=new Ce(g.ZERO.clone(),g.MAX),this.geometry=new Ir(B.setting.sky.defaultFar,20,20),this.skyMaterial||=new Cd}onEnable(){this._readyPipeline?(this.castNeedPass(),!this._inRenderer&&this.transform.scene3D&&($.instance.sky=this,this._inRenderer=!0)):this.initPipeline()}onDisable(){this._inRenderer&&this.transform.scene3D&&(this._inRenderer=!1,$.instance.sky=null),super.onDisable()}nodeUpdate(e,t,a,r){super.nodeUpdate(e,t,a,r)}renderPass2(e,t,a,r,i,s=!1){super.renderPass2(e,t,a,r,i,s)}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 d.Object3D,t=e.addComponent(kd);t.autoUpdate=!1,e.x=0,e.y=300,e.z=0,this.object3D.addChild(e)}}class Nb{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 Vb 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 Nb,this._atmosphericScatteringSky=new yd(new Ud);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 Qr{static panelRatio=1;static quadMaxCountForWorld=256;static quadMaxCountForView=2048;static SortOrderStartWorld=7e3;static SortOrderStartView=8e3;static SortOrderCanvasSpan=1e4}var fa=(n=>(n[n.View=0]="View",n[n.World=2]="World",n))(fa||{}),si=(n=>(n[n.Simple=0]="Simple",n[n.Sliced=1]="Sliced",n[n.Tiled=2]="Tiled",n[n.Filled=3]="Filled",n))(si||{}),Ar=(n=>(n[n.None=0]="None",n[n.BillboardY=9]="BillboardY",n[n.BillboardXYZ=10]="BillboardXYZ",n))(Ar||{});class Ni extends $e{type;camera;_cameraPosition;constructor(){super(),this._cameraPosition=new g}onUpdate(){this.enable&&this.transform.view3D.camera&&this.updateBillboardMatrix()}updateBillboardMatrix(){let e=this.transform.view3D.camera;this._cameraPosition.copyFrom(e.transform.back),this.type==Ar.BillboardXYZ||this.type==Ar.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(Ni);t.type=this.type}}var ni=(n=>(n[n.None=0]="None",n[n.Box=1]="Box",n[n.Capsule=2]="Capsule",n[n.Sphere=3]="Sphere",n[n.Mesh=4]="Mesh",n))(ni||{});class ut{_center;_size;_halfSize;_shapeType=0;static v3_help_0;static helpMatrix;static helpRay;constructor(){ut.v3_help_0||=new g,ut.helpMatrix||=new T,ut.helpRay||=new na,this._center=new g,this._size=new g,this._halfSize=new g}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 oi extends ut{_pickRet;box;constructor(){super(),this._shapeType=ni.Box,this.box=new Ce(new g,new g)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.size);let r=ut.helpMatrix;r.copyFrom(t).invert();let i=ut.helpRay.copy(e);i.applyMatrix(r);let s=i.intersectBox(this.box,ut.v3_help_0);return s?(this._pickRet||(this._pickRet={intersectPoint:new g,distance:0}),this._pickRet.intersectPoint=s,this._pickRet.distance=g.distance(i.origin,ut.v3_help_0),this._pickRet):null}}class da extends $e{_shape;constructor(){super(),this._shape=new oi}start(){B.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.set(this.transform.worldMatrix.index,this)}onEnable(e){Ne.bindEnablePick(e,this,null)}onDisable(e){Ne.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){B.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.delete(this.transform.worldMatrix.index),super.beforeDestroy(e)}}class Ed{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 ki(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 s of a){var r=Math.floor(s.time/this.clip.frameRate);if(r=Math.min(r,this.clip.numFrame),r=Math.max(r,0),r==this.currFrame){s.skeletonAnimation=this.animation,this.animation.eventDispatcher.dispatchEvent(s);break}}this.lastFrame=this.currFrame}this.clip.getLerpSkeletonPose(this.currFrame,this.nextFrame,this.t,this._currSkeletonPose)}}var Ob=Object.getOwnPropertyDescriptor,Lb=(n,e,t,a)=>{for(var r=a>1?void 0:a?Ob(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.SkeletonAnimationComponent=class extends $e{isPlaying=!0;timeScale=1;_skeleton;_clips=[];_clipStates=new Map;_mixSkeletonPose;_mixTempSkeletonPose;_currentClipState;_bindList=[];_jointMatrixIndexTableBuffer;_crossFadeState;constructor(){super()}start(){}set skeleton(e){this._skeleton=e,this._mixSkeletonPose=new ki(this._skeleton,!0),this._mixTempSkeletonPose=new ki(this._skeleton);const t=new Float32Array(this._mixSkeletonPose.jointMatrixIndexTable);this._jointMatrixIndexTableBuffer=new Pe(this._skeleton.numJoint*4,0,t)}get skeleton(){return this._skeleton}get finalSkeletonPose(){return this._mixSkeletonPose}get jointMatrixIndexTableBuffer(){return this._jointMatrixIndexTableBuffer}getJointIndexTable(e){let t=new Array;for(let a=0;a<e.length;a++){const r=e[a];let i=this._skeleton.getJointByName(r);t[a]=i?i.index:-1}return t}addAnimationClip(e){if(!this._clipStates.has(e.name)){this._clips.push(e);let t=new Ed(e);t.animation=this,this._clipStates.set(e.name,t),this._currentClipState||this.setCurrentClipState(t)}}getAnimationClip(e){var t=this.getAnimationClipState(e);return t?t.clip:null}getAnimationClips(){return this._clips}getAnimationClipState(e){return this._clipStates.has(e)?this._clipStates.get(e):null}getAnimationClipStates(){return this._clipStates}pause(){this.isPlaying=!1}resume(){this.isPlaying=!0}play(e,t=1,a=!1){if(this._currentClipState&&this._currentClipState.name==e)return a&&this._currentClipState.reset(),!1;let r=this.getAnimationClipState(e);return r?(r.speed=t,r.reset(),this._clipStates.forEach((i,s)=>{i.weight=0}),this.setCurrentClipState(r),!0):!1}crossFade(e,t){if(t<.01){this.play(e);return}if(this._currentClipState.name==e)return;let a=this.getAnimationClipState(e);a&&(a.reset(),this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(a,this._currentClipState,t)):this._crossFadeState=new Gb(a,this._currentClipState,t),this._currentClipState=a)}setAnimIsLoop(e,t){this._clipStates.has(e)&&(this._clipStates.get(e).loop=t)}addJointBind(e,t){this._bindList.push({jointName:e,obj:t})}removeJointBind(e){for(let t=0;t<this._bindList.length;t++)if(this._bindList[t].obj==e){this._bindList.splice(t,1);break}}onUpdate(){if(!this.isPlaying)return;let e=ze.delta*.001*this.timeScale;this._crossFadeState&&this._crossFadeState.update(e);var t=0,a=[];if(this._clipStates.forEach((i,s)=>{i.weight>0&&(i.update(e),t+=i.weight,a.push(i))}),a.length>0){this._mixSkeletonPose.copyFrom(a[0].currSkeletonPose);for(var r=1;r<a.length;++r){const i=a[r];this._mixTempSkeletonPose.lerp(this._mixSkeletonPose,i.currSkeletonPose,i.weight/t),this._mixSkeletonPose.copyFrom(this._mixTempSkeletonPose)}}}cloneTo(e){let t=e.addComponent(d.SkeletonAnimationComponent);t.skeleton=this.skeleton;for(var a=0;a<this._clips.length;++a)t.addAnimationClip(this._clips[a])}setCurrentClipState(e){this._currentClipState!=e&&(this._currentClipState=e,this._currentClipState.weight=1)}},d.SkeletonAnimationComponent=Lb([Nt(d.SkeletonAnimationComponent,"SkeletonAnimationComponent")],d.SkeletonAnimationComponent);class Gb{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 zb=Object.getOwnPropertyDescriptor,Wb=(n,e,t,a)=>{for(var r=a>1?void 0:a?zb(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.AnimatorComponent=class extends $e{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 g;_boneScale=new g;_boneRot=new ne;_crossFadeState;init(e){this.propertyCache=new Map,this._clipsMap=new Map,this._clips=[],this._clipsState=[],this._rendererList=this.object3D.getComponentsInChild(d.SkinnedMeshRenderer2);let t=this.object3D.getComponentsInChild(d.MeshRenderer);for(let a of t){let r=a;r.blendShape=a.morphData,this._rendererList.push(r)}for(const a of this._rendererList)ra.hasMask(a.rendererMask,Me.MorphTarget)&&a.selfCloneMaterials("MORPH_TARGET_UUID")}start(){}debug(){}playAnim(e,t=0,a=1){let r=this.getAnimationClipState(e);r?(this._currentSkeletonClip&&(this._currentSkeletonClip.weight=0),this._currentSkeletonClip=r,this._currentSkeletonClip.weight=1,this._skeletonTime=t,this._skeletonSpeed=a,this._skeletonStart=!0):console.warn(`not has anim ${e}`)}crossFade(e,t){let a=this.getAnimationClipState(e);if(!a){console.warn(`not has anim ${e}`);return}if(t<.01||!this._currentSkeletonClip){this.playAnim(e);return}if(this._currentSkeletonClip&&this._currentSkeletonClip.clip.clipName===e)return;let r=a,i=this._currentSkeletonClip;this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(r,i,t)):this._crossFadeState=new Jb(r,i,t),this._currentSkeletonClip=r}playBlendShape(e,t=0,a=1){this._clipsMap.has(e)?(this._currentBlendAnimClip=this._clipsMap.get(e),this._blendShapeTime=t,this._blendShapeSpeed=a,this._blendShapeStart=!0):console.warn(`not has blendShape ${e}`)}set avatar(e){this._avatarName=e,this.inverseBindMatrices=[],this._avatar=B.res.getObj(e);let t=this.buildSkeletonPose();const a=new Float32Array(t);this.jointMatrixIndexTableBuffer=new Pe(this._avatar.count,0,a)}get numJoint(){return this._avatar.count}getJointIndexTable(e){let t=new Array;for(let a=0;a<e.length;a++){let r=this._avatar.boneMap.get(e[a]);t[a]=r?r.boneID:-1}return t}skeltonPoseObject3D={};skeltonTPoseObject3D={};buildSkeletonPose(){let e=[];for(const t of this._avatar.boneData){let a=new d.Object3D;T.getEuler(g.HELP_6,t.q,!0,"ZYX"),a.localPosition=t.t.clone(),a.localRotation=g.HELP_6.clone(),a.localScale=g.ONE,t.s.clone(),this.skeltonPoseObject3D[t.boneName]=a,this.skeltonTPoseObject3D[t.bonePath]=a.clone(),t.parentBoneName&&t.parentBoneName!=""?this.skeltonPoseObject3D[t.parentBoneName].addChild(a):(this.object3D.transform.scene3D&&this.object3D.transform.scene3D.addChild(a),this.root=a),e.push(a.transform.worldMatrix.index);let r=new T;r.copyFrom(a.transform.worldMatrix),r.invert(),this.inverseBindMatrices.push(r.rawData)}return e}set clips(e){this._clips=e;for(const t of e)this._clipsMap.set(t.clipName,t);this._clipsState=[];for(const t of e)this._clipsState.push(new wd(t));this._currentSkeletonClip||this.playAnim(e[0].clipName)}get clips(){return this._clips}get clipsState(){return this._clipsState}cloneTo(e){let t=e.addComponent(d.AnimatorComponent);t.avatar=this._avatarName,t.clips=this._clips}updateTime(){const e=ze.delta*.001;this._skeletonStart&&(this._skeletonTime+=e*this._skeletonSpeed*this.timeScale,this._currentSkeletonClip&&this._currentSkeletonClip.clip.loopTime&&(this._skeletonTime=this._skeletonTime%this._currentSkeletonClip.clip.stopTime)),this._blendShapeStart&&(this._blendShapeTime+=e*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(e)}onUpdate(e){this.updateTime();let t=[];for(let a of this._clipsState)a.weight>0&&t.push(a);t.length>0?this.updateSkeletonAnimMix(t):this.updateSkeletonAnim(),this.updateMorphAnim()}updateSkeletonAnim(){if(this._currentSkeletonClip){let e=this._avatar.boneData,t=0,a=e.length;for(t=0;t<a;t++){const r=e[t];let i=this.skeltonPoseObject3D[r.boneName];if(this._currentSkeletonClip.clip.useSkeletonPos){let o=this.getPosition(r.bonePath,this._skeletonTime);i.transform.localPosition=o}let s=this.getRotation(r.bonePath,this._skeletonTime);if(i.transform.localRotQuat=s,this._currentSkeletonClip.clip.useSkeletonScale){let o=this.getScale(r.bonePath,this._skeletonTime);i.transform.localScale=o}}}}updateMorphAnim(){if(this._currentBlendAnimClip&&this._currentBlendAnimClip.floatCurves&&this._currentBlendAnimClip.floatCurves.size>0&&this._rendererList)for(const e of this._currentBlendAnimClip.floatCurves){let t=e[0],r=e[1].propertys,s=this._currentBlendAnimClip.floatCurves.get(t).getValue(this._blendShapeTime)/100;this.updateBlendShape(r,t,s)}}updateBlendShape(e,t,a){for(const r of this._rendererList)if(r.blendShape){let i=this.propertyCache.get(r);if(i&&t in i)i[t](a);else{i=r;for(const s of e){if(!i[s]){i=null;break}i=i[s]}if(!i||i==r)continue;this.propertyCache.get(r)||this.propertyCache.set(r,{}),this.propertyCache.get(r)[t]=i,i(a)}}}updateSkeletonAnimMix(e){let t=0;for(let a of e)t+=a.weight;if(e.length>0){let a=this._avatar.boneData,r=a.length;for(let i=0;i<r;i++){const s=a[i];let o=this.skeltonPoseObject3D[s.boneName];if(e[0].clip.useSkeletonPos){this._bonePos.copyFrom(this.getPosition(s.bonePath,this._skeletonTime,e[0].clip));for(let l=1;l<e.length;l++){const c=e[l];if(c.clip.useSkeletonPos){let f=this.getPosition(s.bonePath,this._skeletonTime,c.clip);g.HELP_0.lerp(this._bonePos,f,c.weight/t),this._bonePos.copyFrom(g.HELP_0)}}o.transform.localPosition=this._bonePos}this._boneRot.copyFrom(this.getRotation(s.bonePath,this._skeletonTime,e[0].clip));for(let l=1;l<e.length;l++){const c=e[l];let f=this.getRotation(s.bonePath,this._skeletonTime,c.clip);ne.HELP_2.slerp(this._boneRot,f,c.weight/t),this._boneRot.copyFrom(ne.HELP_2)}if(o.transform.localRotQuat=this._boneRot,e[0].clip.useSkeletonScale){this._boneScale.copyFrom(this.getScale(s.bonePath,this._skeletonTime,e[0].clip));for(let l=1;l<e.length;l++){const c=e[l];if(c.clip.useSkeletonScale){let f=this.getScale(s.bonePath,this._skeletonTime,c.clip);g.HELP_0.lerp(this._boneScale,f,c.weight/t),this._boneScale.copyFrom(g.HELP_0)}}o.transform.localScale=this._boneScale}}}}getPosition(e,t,a=this._currentSkeletonClip.clip){return a.positionCurves.has(e)?a.positionCurves.get(e).getValue(t):this.skeltonTPoseObject3D[e].localPosition}getRotation(e,t,a=this._currentSkeletonClip.clip){if(a.rotationCurves.has(e)){let r=a.rotationCurves.get(e).getValue(t);return ne.HELP_0.set(r.x,r.y,r.z,r.w),ne.HELP_0}return this.skeltonTPoseObject3D[e].localQuaternion}getScale(e,t,a=this._currentSkeletonClip.clip){return a.scaleCurves.has(e)?a.scaleCurves.get(e).getValue(t):this.skeltonTPoseObject3D[e].localScale}getAnimationClipState(e){for(let t of this._clipsState)if(t.clip.clipName===e)return t;return null}cloneMorphRenderers(){let e={};for(const t of this._rendererList)for(const a in t.geometry.morphTargetDictionary){let r=e[a]||[];r.push(t),e[a]=r}return e}},d.AnimatorComponent=Wb([Nt(d.AnimatorComponent,"AnimatorComponent")],d.AnimatorComponent);class wd{clip;weight=0;get totalTime(){return this.clip.stopTime-this.clip.startTime}constructor(e){this.clip=e}}class Jb{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 Ao{index;time;timeEnd;coeff=[]}var Dr=(n=>(n[n.PingPong=0]="PingPong",n[n.Repeat=1]="Repeat",n[n.Clamp=2]="Clamp",n))(Dr||{});class Rs{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 Vi{_totalTime=1;_cache=new Ao;_cacheOut={lhsIndex:0,rhsIndex:0};_InvalidateCache=!1;curve=[];serializedVersion;preWarpMode;postWarpMode;rotationOrder;get cacheOut(){return this._cacheOut}constructor(e,t=Dr.Repeat,a=Dr.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,s=i[t],o=i[a];e.index=t,e.time=s.time+r,e.timeEnd=o.time+r,e.index=t;let l,c,f,h,u,b,A;l=o.time-s.time,l=Math.max(l,1e-4),f=o.value-s.value,c=1/(l*l),h=s.outSlope,u=o.inSlope,b=h*l,A=u*l,e.coeff[0]=(b+A-f-f)*c/l,e.coeff[1]=(f+f+f-b-b-A)*c,e.coeff[2]=h,e.coeff[3]=s.value,this.setupStepped(e.coeff,s,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 Rs,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 Rs,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==Dr.Clamp?e=a:this.preWarpMode==Dr.PingPong?e=cn(e,a,r):e=fn(e,a,r):e>r&&(this.postWarpMode==Dr.Clamp?e=r:this.postWarpMode==Dr.PingPong?e=cn(e,a,r):e=fn(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],s=a[r];i.time<=e&&s.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 Rd extends Vi{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 Id{curve={}}var li=(n=>(n[n.Default=0]="Default",n[n.Clamp=1]="Clamp",n[n.Once=1]="Once",n[n.Loop=2]="Loop",n[n.PingPong=4]="PingPong",n[n.ClampForever=8]="ClampForever",n))(li||{});class jb{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:s}=t;this.name=a,this._wrapMode=i,this._sampleRate=s,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 Rd;f.unSerialized(l),this.totalTime=Math.max(this.totalTime,f.totalTime);let h=this.objAnimClip[l.path];h||(h=new Id,this.objAnimClip[l.path]=h),h.curve[c]=f}}}class Td{transform;quaternion;materialColor}class Oi{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 Mr{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 s=new Td;this._propertyTagDic.set(r,s);let o=a.curve;for(const l in o){Oi.updatePropertyTag(s,l);let c=this._propertyCache[t]||={},f=Oi.Property[l].split("."),h=f[0];if(f.length>1){let u=i[h];u||(u=i[h]=r[h]),c[l]={value:u,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!=li.Loop&&this._currentClip.wrapMode!=li.Default&&(this.speed>0?this._time>=this._currentClip.totalTime:this._time<=0)&&(this._isPlaying=!1,this._animation.statusCall(Mr.Complete,a,this._time)),this._animation.statusCall(Mr.Seek,a,this._time)}seek(e){return this._time=this.calcTime(e),this._rootObject3D&&this.validProperty(),this}calcTime(e){return this._currentClip.wrapMode==li.Loop||this._currentClip.wrapMode==li.Default?e=gn(e,this._currentClip.totalTime):e=_e(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 s=this._propertyCache[e][r],o=i.getValue(this._time);r in Oi.Scale&&(o*=Oi.Scale[r]),s.value[s.property]=o}}this._propertyTagDic.forEach((e,t)=>{this.applyProperty(e,t)})}applyProperty(e,t){e.quaternion&&T.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 Zb{clipName;data;time}class Li extends bt{static SEEK="SEEK";static COMPLETE="COMPLETE";animation;frame;constructor(e,t){super(t),this.animation=e}}class Do extends $e{_animator;_clips=[];defaultClip;autoPlay;_seekEvent;_completeEvent;_keyFrameList;constructor(){super(),this._seekEvent=new Li(this,Li.SEEK),this._completeEvent=new Li(this,Li.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 Mr(this)}onUpdate(){this.enable&&this._animator.update(ze.time,ze.delta)}appendClip(e){this._clips.push(e),this.play(e.name)}statusCall(e,t,a){if(e==Mr.Complete)this.eventDispatcher.dispatchEvent(this._completeEvent);else if(e==Mr.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(Do).copyComponent(this)}}var Yb=Object.getOwnPropertyDescriptor,Xb=(n,e,t,a)=>{for(var r=a>1?void 0:a?Yb(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.SkinnedMeshRenderer2=class extends d.MeshRenderer{skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Me.SkinnedMesh)}get geometry(){return this._geometry}set geometry(e){this.skinJointsName=e.skinNames;let t=[];for(let a=0;a<e.bindPose.length;a++)t.push(new Float32Array(e.bindPose[a].rawData.slice(0,16)));this.skinInverseBindMatrices=t,super.geometry=e}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(d.AnimatorComponent),!this.skeletonAnimation){let e=this.object3D.parentObject.parentObject.getComponentsInChild(d.AnimatorComponent);e.length>0&&(this.skeletonAnimation=e[0]);let t=this.object3D;for(;!this.skeletonAnimation&&t;)this.skeletonAnimation=t.getComponentFromParent(d.AnimatorComponent),t.parent&&(t=t.parent.object3D)}}get blendShape(){return this.morphData}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(e){if(this.mSkeletonAnimation=e,!!e&&!this.mJointIndexTableBuffer){let t=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new Pe(t.length,0,new Float32Array(t)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(e){this.mInverseBindMatrixData=e;var t=new Float32Array(e.length*16);for(let a=0;a<e.length;a++){let r=a*16,i=e[a];t.set(i,r)}this.mInverseBindMatrixBuffer=new Pe(t.byteLength,0,t),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(e){let t=e.addComponent(d.SkinnedMeshRenderer2),a=[];for(const r of this.materials)a.push(r.clone());t.materials=a,t.geometry=this.geometry,t.castShadow=this.castShadow,t.castGI=this.castGI,t.receiveShadow=this.receiveShadow,t.rendererMask=this.rendererMask,t.skinJointsName=this.skinJointsName,t.skinInverseBindMatrices=this.skinInverseBindMatrices,t.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(e,t,a,r){for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t);if(o)for(let l=0;l<o.length;l++){const c=o[l];!c.pipeline&&this.mSkeletonAnimation&&(c.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),c.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),c.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(e,t,a,r)}},d.SkinnedMeshRenderer2=Xb([Nt(d.SkinnedMeshRenderer2,"SkinnedMeshRenderer2")],d.SkinnedMeshRenderer2);class Hb extends $e{_targetRenderers={};_vec3=new g;_matrix4=new T;_quaternion=new ne;init(e){let t=this.fetchMorphRenderers(this.object3D,d.SkinnedMeshRenderer2),a=this.fetchMorphRenderers(this.object3D,d.MeshRenderer);t.push(...a);for(const r of t){ra.hasMask(r.rendererMask,Me.MorphTarget)&&r.selfCloneMaterials("MORPH_TARGET_UUID");for(const s in r.geometry.morphTargetDictionary){let o=this._targetRenderers[s]||[];o.push(r),this._targetRenderers[s]=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],s=t[r],o=e.texture[s];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(Me.MorphTarget)&&r.push(i);return r}}class Kb{texture;transform}var Qd=(n=>(n.mouthRollLower="mouthRollLower",n.browOuterUp_L="browOuterUpLeft",n.mouthSmile_L="mouthSmileLeft",n.jawRight="jawRight",n.eyeLookOut_L="eyeLookOutLeft",n.mouthFunnel="mouthFunnel",n.mouthUpperUp_R="mouthUpperUpRight",n.browDown_L="browDownLeft",n.jawLeft="jawLeft",n.mouthLowerDown_L="mouthLowerDownLeft",n.noseSneer_R="noseSneerRight",n.jawForward="jawForward",n.mouthLowerDown_R="mouthLowerDownRight",n.browInnerUp="browInnerUp",n.mouthRollUpper="mouthRollUpper",n.mouthStretch_R="mouthStretchRight",n.mouthPucker="mouthPucker",n.eyeBlink_L="eyeBlinkLeft",n.mouthUpperUp_L="mouthUpperUpLeft",n.mouthShrugUpper="mouthShrugUpper",n.eyeLookIn_R="eyeLookInRight",n.noseSneer_L="noseSneerLeft",n.mouthFrown_L="mouthFrownLeft",n.cheekSquint_L="cheekSquintLeft",n.eyeLookDown_L="eyeLookDownLeft",n.mouthDimple_L="mouthDimpleLeft",n.mouthFrown_R="mouthFrownRight",n.eyeLookIn_L="eyeLookInLeft",n.eyeLookOut_R="eyeLookOutRight",n.mouthLeft="mouthLeft",n.mouthStretch_L="mouthStretchLeft",n.mouthPress_L="mouthPressLeft",n.mouthDimple_R="mouthDimpleRight",n.eyeWide_R="eyeWideRight",n.browDown_R="browDownRight",n.eyeLookUp_R="eyeLookUpRight",n.eyeBlink_R="eyeBlinkRight",n.cheekSquint_R="cheekSquintRight",n.mouthRight="mouthDimpleRight",n.eyeLookDown_R="eyeLookDownRight",n.eyeLookUp_L="eyeLookUpLeft",n.eyeSquint_L="eyeSquintLeft",n.jawOpen="jawOpen",n.browOuterUp_R="browOuterUpRight",n.mouthClose="mouthClose",n.mouthShrugLower="mouthShrugLower",n.eyeWide_L="eyeWideLeft",n.tongueOut="tongueOut",n.eyeSquint_R="eyeSquintRight",n.cheekPuff="cheekPuff",n.mouthPress_R="mouthPressRight",n.mouthSmile_R="mouthSmileRight",n))(Qd||{});class qb{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 $b{_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 or{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 tg extends or{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],s=i.name;this.argumentsData[s]=this.allocation_node(i.data.length*4),a[s]=this.argumentsData[s]}}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 ag{_autoUpdate=!0;_target;_lookAtObject;_origin=new g(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 $e{focus;distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Hr),!this._camera){console.error("FirstPersonCameraController need camera");return}if(!this.focus){console.error("FirstPersonCameraController need target");return}B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){B.inputSystem.addEventListener(Y.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){B.inputSystem.removeEventListener(Y.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+=B.inputSystem.wheelDelta*.1}onUpdate(){let e=new g;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var tt=(n=>(n[n.Key_BackSpace=8]="Key_BackSpace",n[n.Key_Tab=9]="Key_Tab",n[n.Key_Clear=12]="Key_Clear",n[n.Key_Enter=13]="Key_Enter",n[n.Key_Shift_L=16]="Key_Shift_L",n[n.Key_Control_L=17]="Key_Control_L",n[n.Key_Alt_L=18]="Key_Alt_L",n[n.Key_Pause=19]="Key_Pause",n[n.Key_CapsLock=20]="Key_CapsLock",n[n.Key_Escape=21]="Key_Escape",n[n.Key_Esc=27]="Key_Esc",n[n.Key_Space=32]="Key_Space",n[n.Key_Prior=33]="Key_Prior",n[n.Key_Next=34]="Key_Next",n[n.Key_End=35]="Key_End",n[n.Key_Home=36]="Key_Home",n[n.Key_Left=37]="Key_Left",n[n.Key_Up=38]="Key_Up",n[n.Key_Right=39]="Key_Right",n[n.Key_Down=40]="Key_Down",n[n.Key_Select=41]="Key_Select",n[n.Key_Print=42]="Key_Print",n[n.Key_Execute=43]="Key_Execute",n[n.Key_Insert=45]="Key_Insert",n[n.Key_Delete=46]="Key_Delete",n[n.Key_Help=47]="Key_Help",n[n.Key_0=48]="Key_0",n[n.Key_1=49]="Key_1",n[n.Key_2=50]="Key_2",n[n.Key_3=51]="Key_3",n[n.Key_4=52]="Key_4",n[n.Key_5=53]="Key_5",n[n.Key_6=54]="Key_6",n[n.Key_7=55]="Key_7",n[n.Key_8=56]="Key_8",n[n.Key_9=57]="Key_9",n[n.Key_A=65]="Key_A",n[n.Key_B=66]="Key_B",n[n.Key_C=67]="Key_C",n[n.Key_D=68]="Key_D",n[n.Key_E=69]="Key_E",n[n.Key_F=70]="Key_F",n[n.Key_G=71]="Key_G",n[n.Key_H=72]="Key_H",n[n.Key_I=73]="Key_I",n[n.Key_J=74]="Key_J",n[n.Key_K=75]="Key_K",n[n.Key_L=76]="Key_L",n[n.Key_M=77]="Key_M",n[n.Key_N=78]="Key_N",n[n.Key_O=79]="Key_O",n[n.Key_P=80]="Key_P",n[n.Key_Q=81]="Key_Q",n[n.Key_R=82]="Key_R",n[n.Key_S=83]="Key_S",n[n.Key_T=84]="Key_T",n[n.Key_U=85]="Key_U",n[n.Key_V=86]="Key_V",n[n.Key_W=87]="Key_W",n[n.Key_X=88]="Key_X",n[n.Key_Y=89]="Key_Y",n[n.Key_Z=90]="Key_Z",n[n.Key_KP_0=96]="Key_KP_0",n[n.Key_KP_1=97]="Key_KP_1",n[n.Key_KP_2=98]="Key_KP_2",n[n.Key_KP_3=99]="Key_KP_3",n[n.Key_KP_4=100]="Key_KP_4",n[n.Key_KP_5=101]="Key_KP_5",n[n.Key_KP_6=102]="Key_KP_6",n[n.Key_KP_7=103]="Key_KP_7",n[n.Key_KP_8=104]="Key_KP_8",n[n.Key_KP_9=105]="Key_KP_9",n[n.Key_Multiply=106]="Key_Multiply",n[n.Key_Add=107]="Key_Add",n[n.Key_Separator=108]="Key_Separator",n[n.Key_Subtract=109]="Key_Subtract",n[n.Key_Decimal=110]="Key_Decimal",n[n.Key_Divide=111]="Key_Divide",n[n.Key_F1=112]="Key_F1",n[n.Key_F2=113]="Key_F2",n[n.Key_F3=114]="Key_F3",n[n.Key_F4=115]="Key_F4",n[n.Key_F5=116]="Key_F5",n[n.Key_F6=117]="Key_F6",n[n.Key_F7=118]="Key_F7",n[n.Key_F8=119]="Key_F8",n[n.Key_F9=120]="Key_F9",n[n.Key_F10=121]="Key_F10",n[n.Key_F11=122]="Key_F11",n[n.Key_F12=123]="Key_F12",n[n.Key_F13=124]="Key_F13",n[n.Key_F14=125]="Key_F14",n[n.Key_F15=126]="Key_F15",n[n.Key_F16=127]="Key_F16",n[n.Key_F17=128]="Key_F17",n[n.Key_F18=129]="Key_F18",n[n.Key_F19=130]="Key_F19",n[n.Key_F20=131]="Key_F20",n[n.Key_F21=132]="Key_F21",n[n.Key_F22=133]="Key_F22",n[n.Key_F23=134]="Key_F23",n[n.Key_F24=135]="Key_F24",n[n.Key_Num_Lock=136]="Key_Num_Lock",n[n.Key_Scroll_Lock=137]="Key_Scroll_Lock",n))(tt||{});class ig extends $e{moveSpeed=2;targetPos=new g(0,0,10);lookAtPos=new g(0,0,0);config={shiftMoveScale:20};_moveScale=1;_dir;_mouseFactory=25;_factory=1.5;_mouseDown=!1;_lastPos;_keyState;constructor(){super(),this._lastPos=new g,this._keyState={front:!1,back:!1,left:!1,right:!1,q:!1,e:!1},this.setCamera(new g(0,0,100),new g(0,0,0))}setCamera(e,t){this.targetPos.copyFrom(e),this.lookAtPos.copyFrom(t),this.Reset()}start(){B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.mouseDown,this),B.inputSystem.addEventListener(Ia.KEY_UP,this.keyUp,this),B.inputSystem.addEventListener(Ia.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=B.inputSystem.mouseLastX,this._lastPos.y=B.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=_e(ze.delta,0,.016);if(this._mouseDown&&(e.rotationY-=this.internal(e.rotationY+(B.inputSystem.mouseLastX-this._lastPos.x)*.25,e.rotationY,t*this._mouseFactory),e.rotationX-=this.internal(e.rotationX+(B.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=xr(e.y,e.y-this.moveSpeed*this._moveScale,t*this._factory)),this._keyState.e&&(e.y=xr(e.y,e.y+this.moveSpeed*this._moveScale,t*this._factory))}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.mouseDown,this),B.inputSystem.removeEventListener(Ia.KEY_UP,this.keyUp,this),B.inputSystem.removeEventListener(Ia.KEY_DOWN,this.keyDown,this),super.destroy(e)}}class Gi{static add(e,t,a){return a||(a=new g),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 g),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 g),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 g),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 g),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=g.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 g.distance(e,t)}static getRandomXYZ(e=-100,t=100){return new g(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 g(Math.random()*t+e,Math.random()*r+a,Math.random()*t+e)}static sphere(e){let t=e*Math.random(),a=new g(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 s=e+(t-e)*Math.random(),o=new g(Math.random()*a-a*.5,Math.random()*r-r*.5,Math.random()*i-i*.5);return o.normalize(),o.scaleBy(s),o}}class sg extends $e{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 g;_tempPos=new g;constructor(){super(),this._currentPos=new d.Object3D,this._targetPos=new d.Object3D}start(){this.camera=this.object3D.getOrAddComponent(Hr),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onMouseMove,this,null,10),B.inputSystem.addEventListener(Y.POINTER_UP,this.onMouseUp,this,null,10),B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.onMouseWheel,this)}flowTarget(e,t=g.ZERO){this._flowTarget=e,this._flowOffset||=new g,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=kn.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*Gi.distance(this._currentPos.transform.worldPosition,this.camera.transform.worldPosition)/10,this.distance-=B.inputSystem.wheelDelta*this._wheelStep,this.distance=_e(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&&(g.HELP_1.x=-1*e.movementX*Math.cos(this._roll*Math.PI/180)-e.movementY*Math.sin(this._roll*Math.PI/180),g.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+=g.HELP_1.x*this.mouseRightFactor,this._targetPos.z+=g.HELP_1.z*this.mouseRightFactor),this._mouseLeftDown&&(this.roll-=e.movementX*ze.delta*.001*this.mouseLeftFactor,this.pitch-=e.movementY*ze.delta*.001*this.mouseLeftFactor,this.pitch=_e(this.pitch,this._topClamp,this._bottomClamp)))}onBeforeUpdate(e){if(!this.enable)return;this._flowTarget&&(g.HELP_0.copyFrom(this._flowTarget.transform.worldPosition),g.HELP_0.add(this._flowOffset,g.HELP_0),this.target=g.HELP_0);let t=_e(ze.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=ne.HELP_0;a.fromEulerAngles(this._pitch,this._roll,0),this._tempDir.applyQuaternion(a),this._tempPos=Gi.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,g.UP)}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onMouseMove,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.onMouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.onMouseWheel,this),super.destroy(e),this.camera=null,this._flowTarget=null}}class ng extends $e{_camera;autoRotate=!1;autoRotateSpeed=.1;rotateFactor=.5;zoomFactor=.1;panFactor=.25;_smooth=5;_minDistance=1;_maxDistance=1e5;_maxPolarAngle=90;_minPolarAngle=-90;_target=new g(0,0,0);_cTarget=new g(0,0,0);_position=new g(0,0,0);_cPosition=new g(0,0,0);_spherical=new og;_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=_e(e,2e-6,this._maxDistance)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance=_e(e,this._minDistance,1/0)}get minPolarAngle(){return this._minPolarAngle}set minPolarAngle(e){this._minPolarAngle=_e(e,-90,this._maxPolarAngle)}get maxPolarAngle(){return this._maxPolarAngle}set maxPolarAngle(e){this._maxPolarAngle=_e(e,this._minPolarAngle,90)}get spherical(){return this._spherical}start(){this._camera=this.object3D.getComponent(Hr),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,g.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,g.UP)}onWheel(e){e.deltaY=_e(e.deltaY,-this._spherical.radius,this._spherical.radius),this._spherical.radius+=e.deltaY*this.zoomFactor,this._spherical.radius=_e(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=_e(this._spherical.phi,this.minPolarAngle,this.maxPolarAngle),this.updateCamera()}else e.mouseCode===2&&(Gi.mulScale(this.object3D.transform.up,e.movementY*this.panFactor*this._camera.aspect,g.HELP_1),e.ctrlKey||e.metaKey?this._target.y+=g.HELP_1.y:(this._target.x+=g.HELP_1.x,this._target.z+=g.HELP_1.z),Gi.mulScale(this.object3D.transform.right,-e.movementX*this.panFactor,g.HELP_1),this._target.x-=g.HELP_1.x,this._target.z-=g.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(){B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.onWheel,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onPointerDown,this),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onPointerMove,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.onPointerUp,this)}removeEventListener(){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.onWheel,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onPointerDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onPointerMove,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.onPointerUp,this)}}const Md=Math.PI/180/100;class og{radius;phi;theta;coords;constructor(e=1,t=0,a=0){return this.radius=e,this.phi=t,this.theta=a,this.coords=new g,this}set(e,t,a){return this.radius=e,this.phi=t,this.theta=a,this}makeSafe(){return this.phi=Math.max(Md,Math.min(Math.PI-Md,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(_e(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 lg extends $e{focus;_rotation=new g(45,0,0);distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Hr),!this._camera){console.error("ThirdPersonCameraController need camera");return}if(!this.focus){console.error("ThirdPersonCameraController need target");return}B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){B.inputSystem.addEventListener(Y.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){this._rotation.y+=e.movementX*.01,this._rotation.x+=e.movementY*.01}mouseWheel(e){this.distance+=B.inputSystem.wheelDelta*.1}onUpdate(){let e=new g;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t.subtract(e)}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var at=(n=>(n[n.NORMAL=0]="NORMAL",n[n.DOWN=1]="DOWN",n[n.OVER=2]="OVER",n[n.DISABLE=3]="DISABLE",n))(at||{});let Pd=Math.PI*2;class Pr{a;b;c;d;tx;ty;constructor(e=1,t=0,a=0,r=1,i=0,s=0){this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=s}clone(){return new Pr(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*pt;let t=Math.cos(e),a=Math.sin(e),r=this.a,i=this.b,s=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=s*t-o*a,this.d=s*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,s){return this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=s,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 g(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,s=t.c,o=t.d,l=t.tx,c=t.ty,f=a.a,h=a.b,u=a.c,b=a.d,A=a.tx,m=a.ty;h!==0||u!==0?(this.a=r*f+i*u,this.b=r*h+i*b,this.c=s*f+o*u,this.d=s*h+o*b,this.tx=f*l+u*c+A,this.ty=h*l+b*c+m):(this.a=r*f,this.b=i*b,this.c=s*f,this.d=o*b,this.tx=f*l+A,this.ty=b*c+m)}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,s){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+s,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 g(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 s=this;if(a!==0){a=a*pt;let o=Math.cos(a),l=Math.sin(a);s.a=o*e,s.b=l*t,s.c=-l*e,s.d=o*t}else s.a=e,s.b=0,s.c=0,s.d=t;s.tx=r,s.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,s=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*s,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*s+r*o),e.ty=-(a*s+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==Pd)&&(r==0||r==Pd)){this.a=e,this.b=this.c=0,this.d=t;return}a=a*pt,r=r*pt;let i=Math.cos(a),s=Math.sin(a);a==r?(this.a=i*e,this.b=s*e):(this.a=Math.cos(r)*e,this.b=Math.sin(r)*e),this.c=-s*t,this.d=i*t}preMultiplyInto(e,t){let a=e.a*this.a,r=0,i=0,s=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,s+=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=s,t.tx=o,t.ty=l}$transformBounds(e){let t=this.a,a=this.b,r=this.c,i=this.d,s=this.tx,o=this.ty,l=e.x,c=e.y,f=l+e.width,h=c+e.height,u=t*l+r*c+s,b=a*l+i*c+o,A=t*f+r*c+s,m=a*f+i*c+o,p=t*f+r*h+s,D=a*f+i*h+o,_=t*l+r*h+s,v=a*l+i*h+o,U=0;u>A&&(U=u,u=A,A=U),p>_&&(U=p,p=_,_=U),e.x=Math.floor(u<p?u:p),e.width=Math.ceil((A>_?A:_)-e.x),b>m&&(U=b,b=m,m=U),D>v&&(U=D,D=v,v=U),e.y=Math.floor(b<D?b:D),e.height=Math.ceil((m>v?m:v)-e.y)}getDeterminant(){return this.a*this.d-this.b*this.c}}class zi extends $e{isGUICanvas=!0;index=0;addChild(e){return this.object3D.addChild(e),this}removeChild(e){return this.object3D.removeChild(e),this}cloneTo(e){e.getOrAddComponent(zi).copyComponent(this)}copyComponent(e){return e.index=e.index,this}}var nt=(n=>(n[n.NONE=0]="NONE",n[n.POSITION=1]="POSITION",n[n.SPRITE=2]="SPRITE",n[n.COLOR=4]="COLOR",n[n.MAX=7]="MAX",n))(nt||{});class _o{array;buffer;constructor(e){this.buffer=new Pe(e,0),this.array=new Float32Array(this.buffer.memory.shareDataBuffer)}}class Nd extends Ve{_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 g(-a,-a,-a),t=new g(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(...ci.attUV);for(let i=0,s=this.maxQuadCount*ci.vertexCount;i<s;i++)a[i]=i;this._attributeUV=new Float32Array(ci.vertexCount*e*this._uvSize),this._attributeVIndex=new Float32Array(ci.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 s=0;s<ci.indecies.length;s++){const o=ci.indecies[s]+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 _o(e*4),this._spriteAttribute=new _o(e*12),this._colorAttribute=new _o(e*4)}fillQuad(e,t){e.dirtyAttributes&nt.POSITION&&this.fillQuadPosition(e,t),e.dirtyAttributes&nt.COLOR&&this.fillQuadColor(e,t),e.dirtyAttributes&nt.SPRITE&&this.fillQuadSprite(e,t)}fillQuadPosition(e,t){Vd.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;Vd.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==si.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 s=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]=s,c[f+11]=e.visible?1:0,this._onSpriteChange=!0}}class cg{static set(e,t,a,r,...i){let s=t*r+a;for(let o=0,l=i.length;o<l;o++)e[s+o]=i[o]}}class Vd extends cg{static setXYZW(e,t,a,r,i,s){this.set(e,t,0,4,a,r,i,s)}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 ci{static vertexCount=4;static attUV=[0,0,1,0,1,1,0,1];static indecies=[0,1,2,0,2,3]}class Od{_textureMap=new Map;_textureList=[];build(e,t,a){let r=t._geometry;r.resetSubGeometries();let i=-1,s=0,o=0,l=0,c=0,f=this._textureList,h=this._textureMap;function u(){l>0&&(t.updateDrawCallSegment(c,o,l),t._uiRenderer.materials[c].setTextures(f),h.clear(),f.length=0,c++,o+=l,l=0,s=0)}h.clear(),f.length=0;let b=[],A=t.quadMaxCount-1;for(let m of e){let p=m.needUpdateQuads;b.length=0;const D=this.collectQuads(m.object3D,b);for(let _ of D){let v=_.sprite.guiTexture;if(h.has(v.staticId)||(s==7&&u(),h.set(v.staticId,v),v.dynamicId=s,f[s]=v.texture,s+=1),_.z=++i,l+=6,_.cacheTextureId!=v.dynamicId&&(_.dirtyAttributes=nt.MAX,_.cacheTextureId=v.dynamicId),(p||a)&&(_.dirtyAttributes=nt.MAX),_.dirtyAttributes&nt.POSITION&&_.applyTransform(m),_.dirtyAttributes&&_.writeToGeometry(r,m),i==A)return u(),!0}}return u(),!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 s=i.getShadowRender();s&&this.push(s.mainQuads,t),this.push(i.mainQuads,t)}return t}push(e,t){e&&e.length>0&&t.push(...e)}}class Bo{static bindTextureArray(){let e="";for(let t=0;t<7;t++)e+=`
11567
+ `}class Ud{sunRadius=500;sunRadiance=11;mieG=.76;mieHeight=1200;eyePos=1500;sunX=.71;sunY=.56;sunBrightness=1;displaySun=!0;defaultTextureCubeSize=512;defaultTexture2DSize=1024;skyColor=new Z(1,1,1,1)}class yd extends ks{_internalTexture;_cubeSize;setting;constructor(e){return super(),this.setting=e,this._cubeSize=e.defaultTextureCubeSize,this._internalTexture=new Qb(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 Qb extends Ie{_computeShader;_uniformBuffer;constructor(e,t){super(e,t,le.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 Se(vd.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=E.beginCommandEncoder();return E.computeCommand(t,[this._computeShader]),E.endCommandEncoder(t),this}}var Mb=Object.getOwnPropertyDescriptor,Pb=(n,e,t,a)=>{for(var r=a>1?void 0:a?Mb(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.SkyShader=class extends gt{constructor(){super();let e=new qe("sky_vs_frag_wgsl","sky_fs_frag_wgsl");this.addRenderPass(e),e.setUniformVector3("eyesPos",new g),e.setUniformFloat("exposure",1),e.setUniformFloat("roughness",0);let t=e.shaderState;t.frontFace="cw",t.cullMode=Vt.back,t.depthWriteEnabled=!1,t.depthCompare=it.less}},d.SkyShader=Pb([Ta(d.SkyShader,"SkyShader")],d.SkyShader);class Cd extends Dt{constructor(){super(),this.shader=new d.SkyShader,this.shader.setUniformVector3("eyesPos",new g),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 B.setting.sky.skyExposure}set exposure(e){B.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 Sd extends Ba{gid=0;needUpdate=!0;autoUpdate=!1;radius=500;init(){super.init(),this.addRendererMask(Me.Reflection),this.alwaysRender=!0,this.object3D.bound=new Ce(g.ZERO.clone(),g.MAX),os(this.transform.onPositionChange,()=>{this.needUpdate=!0})}onEnable(){$.instance.addRenderNode(this.transform.scene3D,this)}onDisable(){$.instance.removeRenderNode(this.transform.scene3D,this)}renderPass2(e,t,a,r,i,s=!1){super.renderPass2(e,t,a,r,i,s)}}class xd extends gt{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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}}class Fd extends Dt{constructor(){super(),this.shader=new xd,this.baseMap=B.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 Tr{center=new g;extents;max;min;size;tmpVecA=new g;tmpVecB=new g;tmpVecC=new g;tmpVecD=new g;radius=0;diffBetweenPoints=new g;owner;forward=new g(0,0,1);worldCenter;worldSize;_center=new g;constructor(e,t){this.center=e||new g(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 s=r*r-i;if(s<0)return!1;var o=Math.abs(-r-Math.sqrt(s));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 Tr(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 kd extends Sd{init(){super.init(),this.castShadow=!1,this.castGI=!1,this.addRendererMask(Me.Reflection),this.alwaysRender=!0,this.object3D.bound=new Tr(g.ZERO.clone(),this.radius)}debug(e,t=1){let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);r.addMask(Me.ReflectionDebug),r.geometry=new Ir(25,30,30);let i=B.setting.reflectionSetting,s=Be.getGBufferFrame(Be.reflections_GBuffer,i.width,i.height),o=new Fd;o.reflectionIndex=e,o.baseMap=s.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,s=!1){super.renderPass2(e,t,a,r,i,s)}}class ws extends d.MeshRenderer{skyMaterial;init(){super.init(),this.castShadow=!1,this.castGI=!0,this.addRendererMask(Me.Sky),this.alwaysRender=!0,this.object3D.bound=new Ce(g.ZERO.clone(),g.MAX),this.geometry=new Ir(B.setting.sky.defaultFar,20,20),this.skyMaterial||=new Cd}onEnable(){this._readyPipeline?(this.castNeedPass(),!this._inRenderer&&this.transform.scene3D&&($.instance.sky=this,this._inRenderer=!0)):this.initPipeline()}onDisable(){this._inRenderer&&this.transform.scene3D&&(this._inRenderer=!1,$.instance.sky=null),super.onDisable()}nodeUpdate(e,t,a,r){super.nodeUpdate(e,t,a,r)}renderPass2(e,t,a,r,i,s=!1){super.renderPass2(e,t,a,r,i,s)}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 d.Object3D,t=e.addComponent(kd);t.autoUpdate=!1,e.x=0,e.y=300,e.z=0,this.object3D.addChild(e)}}class Nb{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 Vb 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 Nb,this._atmosphericScatteringSky=new yd(new Ud);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 Qr{static panelRatio=1;static quadMaxCountForWorld=256;static quadMaxCountForView=2048;static SortOrderStartWorld=7e3;static SortOrderStartView=8e3;static SortOrderCanvasSpan=1e4}var fa=(n=>(n[n.View=0]="View",n[n.World=2]="World",n))(fa||{}),si=(n=>(n[n.Simple=0]="Simple",n[n.Sliced=1]="Sliced",n[n.Tiled=2]="Tiled",n[n.Filled=3]="Filled",n))(si||{}),Ar=(n=>(n[n.None=0]="None",n[n.BillboardY=9]="BillboardY",n[n.BillboardXYZ=10]="BillboardXYZ",n))(Ar||{});class Ni extends $e{type;camera;_cameraPosition;constructor(){super(),this._cameraPosition=new g}onUpdate(){this.enable&&this.transform.view3D.camera&&this.updateBillboardMatrix()}updateBillboardMatrix(){let e=this.transform.view3D.camera;this._cameraPosition.copyFrom(e.transform.back),this.type==Ar.BillboardXYZ||this.type==Ar.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(Ni);t.type=this.type}}var ni=(n=>(n[n.None=0]="None",n[n.Box=1]="Box",n[n.Capsule=2]="Capsule",n[n.Sphere=3]="Sphere",n[n.Mesh=4]="Mesh",n))(ni||{});class ut{_center;_size;_halfSize;_shapeType=0;static v3_help_0;static helpMatrix;static helpRay;constructor(){ut.v3_help_0||=new g,ut.helpMatrix||=new T,ut.helpRay||=new na,this._center=new g,this._size=new g,this._halfSize=new g}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 oi extends ut{_pickRet;box;constructor(){super(),this._shapeType=ni.Box,this.box=new Ce(new g,new g)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.size);let r=ut.helpMatrix;r.copyFrom(t).invert();let i=ut.helpRay.copy(e);i.applyMatrix(r);let s=i.intersectBox(this.box,ut.v3_help_0);return s?(this._pickRet||(this._pickRet={intersectPoint:new g,distance:0}),this._pickRet.intersectPoint=s,this._pickRet.distance=g.distance(i.origin,ut.v3_help_0),this._pickRet):null}}class da extends $e{_shape;constructor(){super(),this._shape=new oi}start(){B.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.set(this.transform.worldMatrix.index,this)}onEnable(e){Ne.bindEnablePick(e,this,null)}onDisable(e){Ne.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){B.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.delete(this.transform.worldMatrix.index),super.beforeDestroy(e)}}class Ed{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 ki(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 s of a){var r=Math.floor(s.time/this.clip.frameRate);if(r=Math.min(r,this.clip.numFrame),r=Math.max(r,0),r==this.currFrame){s.skeletonAnimation=this.animation,this.animation.eventDispatcher.dispatchEvent(s);break}}this.lastFrame=this.currFrame}this.clip.getLerpSkeletonPose(this.currFrame,this.nextFrame,this.t,this._currSkeletonPose)}}var Ob=Object.getOwnPropertyDescriptor,Lb=(n,e,t,a)=>{for(var r=a>1?void 0:a?Ob(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.SkeletonAnimationComponent=class extends $e{isPlaying=!0;timeScale=1;_skeleton;_clips=[];_clipStates=new Map;_mixSkeletonPose;_mixTempSkeletonPose;_currentClipState;_bindList=[];_jointMatrixIndexTableBuffer;_crossFadeState;constructor(){super()}start(){}set skeleton(e){this._skeleton=e,this._mixSkeletonPose=new ki(this._skeleton,!0),this._mixTempSkeletonPose=new ki(this._skeleton);const t=new Float32Array(this._mixSkeletonPose.jointMatrixIndexTable);this._jointMatrixIndexTableBuffer=new Pe(this._skeleton.numJoint*4,0,t)}get skeleton(){return this._skeleton}get finalSkeletonPose(){return this._mixSkeletonPose}get jointMatrixIndexTableBuffer(){return this._jointMatrixIndexTableBuffer}getJointIndexTable(e){let t=new Array;for(let a=0;a<e.length;a++){const r=e[a];let i=this._skeleton.getJointByName(r);t[a]=i?i.index:-1}return t}addAnimationClip(e){if(!this._clipStates.has(e.name)){this._clips.push(e);let t=new Ed(e);t.animation=this,this._clipStates.set(e.name,t),this._currentClipState||this.setCurrentClipState(t)}}getAnimationClip(e){var t=this.getAnimationClipState(e);return t?t.clip:null}getAnimationClips(){return this._clips}getAnimationClipState(e){return this._clipStates.has(e)?this._clipStates.get(e):null}getAnimationClipStates(){return this._clipStates}pause(){this.isPlaying=!1}resume(){this.isPlaying=!0}play(e,t=1,a=!1){if(this._currentClipState&&this._currentClipState.name==e)return a&&this._currentClipState.reset(),!1;let r=this.getAnimationClipState(e);return r?(r.speed=t,r.reset(),this._clipStates.forEach((i,s)=>{i.weight=0}),this.setCurrentClipState(r),!0):!1}crossFade(e,t){if(t<.01){this.play(e);return}if(this._currentClipState.name==e)return;let a=this.getAnimationClipState(e);a&&(a.reset(),this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(a,this._currentClipState,t)):this._crossFadeState=new Gb(a,this._currentClipState,t),this._currentClipState=a)}setAnimIsLoop(e,t){this._clipStates.has(e)&&(this._clipStates.get(e).loop=t)}addJointBind(e,t){this._bindList.push({jointName:e,obj:t})}removeJointBind(e){for(let t=0;t<this._bindList.length;t++)if(this._bindList[t].obj==e){this._bindList.splice(t,1);break}}onUpdate(){if(!this.isPlaying)return;let e=ze.delta*.001*this.timeScale;this._crossFadeState&&this._crossFadeState.update(e);var t=0,a=[];if(this._clipStates.forEach((i,s)=>{i.weight>0&&(i.update(e),t+=i.weight,a.push(i))}),a.length>0){this._mixSkeletonPose.copyFrom(a[0].currSkeletonPose);for(var r=1;r<a.length;++r){const i=a[r];this._mixTempSkeletonPose.lerp(this._mixSkeletonPose,i.currSkeletonPose,i.weight/t),this._mixSkeletonPose.copyFrom(this._mixTempSkeletonPose)}}}cloneTo(e){let t=e.addComponent(d.SkeletonAnimationComponent);t.skeleton=this.skeleton;for(var a=0;a<this._clips.length;++a)t.addAnimationClip(this._clips[a])}setCurrentClipState(e){this._currentClipState!=e&&(this._currentClipState=e,this._currentClipState.weight=1)}},d.SkeletonAnimationComponent=Lb([Nt(d.SkeletonAnimationComponent,"SkeletonAnimationComponent")],d.SkeletonAnimationComponent);class Gb{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 zb=Object.getOwnPropertyDescriptor,Wb=(n,e,t,a)=>{for(var r=a>1?void 0:a?zb(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.AnimatorComponent=class extends $e{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 g;_boneScale=new g;_boneRot=new ne;_crossFadeState;init(e){this.propertyCache=new Map,this._clipsMap=new Map,this._clips=[],this._clipsState=[],this._rendererList=this.object3D.getComponentsInChild(d.SkinnedMeshRenderer2);let t=this.object3D.getComponentsInChild(d.MeshRenderer);for(let a of t){let r=a;r.blendShape=a.morphData,this._rendererList.push(r)}for(const a of this._rendererList)ra.hasMask(a.rendererMask,Me.MorphTarget)&&a.selfCloneMaterials("MORPH_TARGET_UUID")}start(){}debug(){}playAnim(e,t=0,a=1){let r=this.getAnimationClipState(e);r?(this._currentSkeletonClip&&(this._currentSkeletonClip.weight=0),this._currentSkeletonClip=r,this._currentSkeletonClip.weight=1,this._skeletonTime=t,this._skeletonSpeed=a,this._skeletonStart=!0):console.warn(`not has anim ${e}`)}crossFade(e,t){let a=this.getAnimationClipState(e);if(!a){console.warn(`not has anim ${e}`);return}if(t<.01||!this._currentSkeletonClip){this.playAnim(e);return}if(this._currentSkeletonClip&&this._currentSkeletonClip.clip.clipName===e)return;let r=a,i=this._currentSkeletonClip;this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(r,i,t)):this._crossFadeState=new Jb(r,i,t),this._currentSkeletonClip=r}playBlendShape(e,t=0,a=1){this._clipsMap.has(e)?(this._currentBlendAnimClip=this._clipsMap.get(e),this._blendShapeTime=t,this._blendShapeSpeed=a,this._blendShapeStart=!0):console.warn(`not has blendShape ${e}`)}set avatar(e){this._avatarName=e,this.inverseBindMatrices=[],this._avatar=B.res.getObj(e);let t=this.buildSkeletonPose();const a=new Float32Array(t);this.jointMatrixIndexTableBuffer=new Pe(this._avatar.count,0,a)}get numJoint(){return this._avatar.count}getJointIndexTable(e){let t=new Array;for(let a=0;a<e.length;a++){let r=this._avatar.boneMap.get(e[a]);t[a]=r?r.boneID:-1}return t}skeltonPoseObject3D={};skeltonTPoseObject3D={};buildSkeletonPose(){let e=[];for(const t of this._avatar.boneData){let a=new d.Object3D;T.getEuler(g.HELP_6,t.q,!0,"ZYX"),a.localPosition=t.t.clone(),a.localRotation=g.HELP_6.clone(),a.localScale=g.ONE,t.s.clone(),this.skeltonPoseObject3D[t.boneName]=a,this.skeltonTPoseObject3D[t.bonePath]=a.clone(),t.parentBoneName&&t.parentBoneName!=""?this.skeltonPoseObject3D[t.parentBoneName].addChild(a):(this.object3D.transform.scene3D&&this.object3D.transform.scene3D.addChild(a),this.root=a),e.push(a.transform.worldMatrix.index);let r=new T;r.copyFrom(a.transform.worldMatrix),r.invert(),this.inverseBindMatrices.push(r.rawData)}return e}set clips(e){this._clips=e;for(const t of e)this._clipsMap.set(t.clipName,t);this._clipsState=[];for(const t of e)this._clipsState.push(new wd(t));this._currentSkeletonClip||this.playAnim(e[0].clipName)}get clips(){return this._clips}get clipsState(){return this._clipsState}cloneTo(e){let t=e.addComponent(d.AnimatorComponent);t.avatar=this._avatarName,t.clips=this._clips}updateTime(){const e=ze.delta*.001;this._skeletonStart&&(this._skeletonTime+=e*this._skeletonSpeed*this.timeScale,this._currentSkeletonClip&&this._currentSkeletonClip.clip.loopTime&&(this._skeletonTime=this._skeletonTime%this._currentSkeletonClip.clip.stopTime)),this._blendShapeStart&&(this._blendShapeTime+=e*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(e)}onUpdate(e){this.updateTime();let t=[];for(let a of this._clipsState)a.weight>0&&t.push(a);t.length>0?this.updateSkeletonAnimMix(t):this.updateSkeletonAnim(),this.updateMorphAnim()}updateSkeletonAnim(){if(this._currentSkeletonClip){let e=this._avatar.boneData,t=0,a=e.length;for(t=0;t<a;t++){const r=e[t];let i=this.skeltonPoseObject3D[r.boneName];if(this._currentSkeletonClip.clip.useSkeletonPos){let o=this.getPosition(r.bonePath,this._skeletonTime);i.transform.localPosition=o}let s=this.getRotation(r.bonePath,this._skeletonTime);if(i.transform.localRotQuat=s,this._currentSkeletonClip.clip.useSkeletonScale){let o=this.getScale(r.bonePath,this._skeletonTime);i.transform.localScale=o}}}}updateMorphAnim(){if(this._currentBlendAnimClip&&this._currentBlendAnimClip.floatCurves&&this._currentBlendAnimClip.floatCurves.size>0&&this._rendererList)for(const e of this._currentBlendAnimClip.floatCurves){let t=e[0],r=e[1].propertys,s=this._currentBlendAnimClip.floatCurves.get(t).getValue(this._blendShapeTime)/100;this.updateBlendShape(r,t,s)}}updateBlendShape(e,t,a){for(const r of this._rendererList)if(r.blendShape){let i=this.propertyCache.get(r);if(i&&t in i)i[t](a);else{i=r;for(const s of e){if(!i[s]){i=null;break}i=i[s]}if(!i||i==r)continue;this.propertyCache.get(r)||this.propertyCache.set(r,{}),this.propertyCache.get(r)[t]=i,i(a)}}}updateSkeletonAnimMix(e){let t=0;for(let a of e)t+=a.weight;if(e.length>0){let a=this._avatar.boneData,r=a.length;for(let i=0;i<r;i++){const s=a[i];let o=this.skeltonPoseObject3D[s.boneName];if(e[0].clip.useSkeletonPos){this._bonePos.copyFrom(this.getPosition(s.bonePath,this._skeletonTime,e[0].clip));for(let l=1;l<e.length;l++){const c=e[l];if(c.clip.useSkeletonPos){let f=this.getPosition(s.bonePath,this._skeletonTime,c.clip);g.HELP_0.lerp(this._bonePos,f,c.weight/t),this._bonePos.copyFrom(g.HELP_0)}}o.transform.localPosition=this._bonePos}this._boneRot.copyFrom(this.getRotation(s.bonePath,this._skeletonTime,e[0].clip));for(let l=1;l<e.length;l++){const c=e[l];let f=this.getRotation(s.bonePath,this._skeletonTime,c.clip);ne.HELP_2.slerp(this._boneRot,f,c.weight/t),this._boneRot.copyFrom(ne.HELP_2)}if(o.transform.localRotQuat=this._boneRot,e[0].clip.useSkeletonScale){this._boneScale.copyFrom(this.getScale(s.bonePath,this._skeletonTime,e[0].clip));for(let l=1;l<e.length;l++){const c=e[l];if(c.clip.useSkeletonScale){let f=this.getScale(s.bonePath,this._skeletonTime,c.clip);g.HELP_0.lerp(this._boneScale,f,c.weight/t),this._boneScale.copyFrom(g.HELP_0)}}o.transform.localScale=this._boneScale}}}}getPosition(e,t,a=this._currentSkeletonClip.clip){return a.positionCurves.has(e)?a.positionCurves.get(e).getValue(t):this.skeltonTPoseObject3D[e].localPosition}getRotation(e,t,a=this._currentSkeletonClip.clip){if(a.rotationCurves.has(e)){let r=a.rotationCurves.get(e).getValue(t);return ne.HELP_0.set(r.x,r.y,r.z,r.w),ne.HELP_0}return this.skeltonTPoseObject3D[e].localQuaternion}getScale(e,t,a=this._currentSkeletonClip.clip){return a.scaleCurves.has(e)?a.scaleCurves.get(e).getValue(t):this.skeltonTPoseObject3D[e].localScale}getAnimationClipState(e){for(let t of this._clipsState)if(t.clip.clipName===e)return t;return null}cloneMorphRenderers(){let e={};for(const t of this._rendererList)for(const a in t.geometry.morphTargetDictionary){let r=e[a]||[];r.push(t),e[a]=r}return e}},d.AnimatorComponent=Wb([Nt(d.AnimatorComponent,"AnimatorComponent")],d.AnimatorComponent);class wd{clip;weight=0;get totalTime(){return this.clip.stopTime-this.clip.startTime}constructor(e){this.clip=e}}class Jb{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 Ao{index;time;timeEnd;coeff=[]}var Dr=(n=>(n[n.PingPong=0]="PingPong",n[n.Repeat=1]="Repeat",n[n.Clamp=2]="Clamp",n))(Dr||{});class Rs{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 Vi{_totalTime=1;_cache=new Ao;_cacheOut={lhsIndex:0,rhsIndex:0};_InvalidateCache=!1;curve=[];serializedVersion;preWarpMode;postWarpMode;rotationOrder;get cacheOut(){return this._cacheOut}constructor(e,t=Dr.Repeat,a=Dr.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,s=i[t],o=i[a];e.index=t,e.time=s.time+r,e.timeEnd=o.time+r,e.index=t;let l,c,f,h,u,b,A;l=o.time-s.time,l=Math.max(l,1e-4),f=o.value-s.value,c=1/(l*l),h=s.outSlope,u=o.inSlope,b=h*l,A=u*l,e.coeff[0]=(b+A-f-f)*c/l,e.coeff[1]=(f+f+f-b-b-A)*c,e.coeff[2]=h,e.coeff[3]=s.value,this.setupStepped(e.coeff,s,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 Rs,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 Rs,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==Dr.Clamp?e=a:this.preWarpMode==Dr.PingPong?e=cn(e,a,r):e=fn(e,a,r):e>r&&(this.postWarpMode==Dr.Clamp?e=r:this.postWarpMode==Dr.PingPong?e=cn(e,a,r):e=fn(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],s=a[r];i.time<=e&&s.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 Rd extends Vi{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 Id{curve={}}var li=(n=>(n[n.Default=0]="Default",n[n.Clamp=1]="Clamp",n[n.Once=1]="Once",n[n.Loop=2]="Loop",n[n.PingPong=4]="PingPong",n[n.ClampForever=8]="ClampForever",n))(li||{});class jb{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:s}=t;this.name=a,this._wrapMode=i,this._sampleRate=s,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 Rd;f.unSerialized(l),this.totalTime=Math.max(this.totalTime,f.totalTime);let h=this.objAnimClip[l.path];h||(h=new Id,this.objAnimClip[l.path]=h),h.curve[c]=f}}}class Td{transform;quaternion;materialColor}class Oi{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 Mr{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 s=new Td;this._propertyTagDic.set(r,s);let o=a.curve;for(const l in o){Oi.updatePropertyTag(s,l);let c=this._propertyCache[t]||={},f=Oi.Property[l].split("."),h=f[0];if(f.length>1){let u=i[h];u||(u=i[h]=r[h]),c[l]={value:u,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!=li.Loop&&this._currentClip.wrapMode!=li.Default&&(this.speed>0?this._time>=this._currentClip.totalTime:this._time<=0)&&(this._isPlaying=!1,this._animation.statusCall(Mr.Complete,a,this._time)),this._animation.statusCall(Mr.Seek,a,this._time)}seek(e){return this._time=this.calcTime(e),this._rootObject3D&&this.validProperty(),this}calcTime(e){return this._currentClip.wrapMode==li.Loop||this._currentClip.wrapMode==li.Default?e=gn(e,this._currentClip.totalTime):e=_e(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 s=this._propertyCache[e][r],o=i.getValue(this._time);r in Oi.Scale&&(o*=Oi.Scale[r]),s.value[s.property]=o}}this._propertyTagDic.forEach((e,t)=>{this.applyProperty(e,t)})}applyProperty(e,t){e.quaternion&&T.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 Zb{clipName;data;time}class Li extends bt{static SEEK="SEEK";static COMPLETE="COMPLETE";animation;frame;constructor(e,t){super(t),this.animation=e}}class Do extends $e{_animator;_clips=[];defaultClip;autoPlay;_seekEvent;_completeEvent;_keyFrameList;constructor(){super(),this._seekEvent=new Li(this,Li.SEEK),this._completeEvent=new Li(this,Li.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 Mr(this)}onUpdate(){this.enable&&this._animator.update(ze.time,ze.delta)}appendClip(e){this._clips.push(e),this.play(e.name)}statusCall(e,t,a){if(e==Mr.Complete)this.eventDispatcher.dispatchEvent(this._completeEvent);else if(e==Mr.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(Do).copyComponent(this)}}var Yb=Object.getOwnPropertyDescriptor,Xb=(n,e,t,a)=>{for(var r=a>1?void 0:a?Yb(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.SkinnedMeshRenderer2=class extends d.MeshRenderer{skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Me.SkinnedMesh)}get geometry(){return this._geometry}set geometry(e){this.skinJointsName=e.skinNames;let t=[];for(let a=0;a<e.bindPose.length;a++)t.push(new Float32Array(e.bindPose[a].rawData.slice(0,16)));this.skinInverseBindMatrices=t,super.geometry=e}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(d.AnimatorComponent),!this.skeletonAnimation){let e=this.object3D.parentObject.parentObject.getComponentsInChild(d.AnimatorComponent);e.length>0&&(this.skeletonAnimation=e[0]);let t=this.object3D;for(;!this.skeletonAnimation&&t;)this.skeletonAnimation=t.getComponentFromParent(d.AnimatorComponent),t.parent&&(t=t.parent.object3D)}}get blendShape(){return this.morphData}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(e){if(this.mSkeletonAnimation=e,!!e&&!this.mJointIndexTableBuffer){let t=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new Pe(t.length,0,new Float32Array(t)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(e){this.mInverseBindMatrixData=e;var t=new Float32Array(e.length*16);for(let a=0;a<e.length;a++){let r=a*16,i=e[a];t.set(i,r)}this.mInverseBindMatrixBuffer=new Pe(t.byteLength,0,t),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(e){let t=e.addComponent(d.SkinnedMeshRenderer2),a=[];for(const r of this.materials)a.push(r.clone());t.materials=a,t.geometry=this.geometry,t.castShadow=this.castShadow,t.castGI=this.castGI,t.receiveShadow=this.receiveShadow,t.rendererMask=this.rendererMask,t.skinJointsName=this.skinJointsName,t.skinInverseBindMatrices=this.skinInverseBindMatrices,t.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(e,t,a,r){for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t);if(o)for(let l=0;l<o.length;l++){const c=o[l];!c.pipeline&&this.mSkeletonAnimation&&(c.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),c.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),c.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(e,t,a,r)}},d.SkinnedMeshRenderer2=Xb([Nt(d.SkinnedMeshRenderer2,"SkinnedMeshRenderer2")],d.SkinnedMeshRenderer2);class Hb extends $e{_targetRenderers={};_vec3=new g;_matrix4=new T;_quaternion=new ne;init(e){let t=this.fetchMorphRenderers(this.object3D,d.SkinnedMeshRenderer2),a=this.fetchMorphRenderers(this.object3D,d.MeshRenderer);t.push(...a);for(const r of t){ra.hasMask(r.rendererMask,Me.MorphTarget)&&r.selfCloneMaterials("MORPH_TARGET_UUID");for(const s in r.geometry.morphTargetDictionary){let o=this._targetRenderers[s]||[];o.push(r),this._targetRenderers[s]=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],s=t[r],o=e.texture[s];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(Me.MorphTarget)&&r.push(i);return r}}class Kb{texture;transform}var Qd=(n=>(n.mouthRollLower="mouthRollLower",n.browOuterUp_L="browOuterUpLeft",n.mouthSmile_L="mouthSmileLeft",n.jawRight="jawRight",n.eyeLookOut_L="eyeLookOutLeft",n.mouthFunnel="mouthFunnel",n.mouthUpperUp_R="mouthUpperUpRight",n.browDown_L="browDownLeft",n.jawLeft="jawLeft",n.mouthLowerDown_L="mouthLowerDownLeft",n.noseSneer_R="noseSneerRight",n.jawForward="jawForward",n.mouthLowerDown_R="mouthLowerDownRight",n.browInnerUp="browInnerUp",n.mouthRollUpper="mouthRollUpper",n.mouthStretch_R="mouthStretchRight",n.mouthPucker="mouthPucker",n.eyeBlink_L="eyeBlinkLeft",n.mouthUpperUp_L="mouthUpperUpLeft",n.mouthShrugUpper="mouthShrugUpper",n.eyeLookIn_R="eyeLookInRight",n.noseSneer_L="noseSneerLeft",n.mouthFrown_L="mouthFrownLeft",n.cheekSquint_L="cheekSquintLeft",n.eyeLookDown_L="eyeLookDownLeft",n.mouthDimple_L="mouthDimpleLeft",n.mouthFrown_R="mouthFrownRight",n.eyeLookIn_L="eyeLookInLeft",n.eyeLookOut_R="eyeLookOutRight",n.mouthLeft="mouthLeft",n.mouthStretch_L="mouthStretchLeft",n.mouthPress_L="mouthPressLeft",n.mouthDimple_R="mouthDimpleRight",n.eyeWide_R="eyeWideRight",n.browDown_R="browDownRight",n.eyeLookUp_R="eyeLookUpRight",n.eyeBlink_R="eyeBlinkRight",n.cheekSquint_R="cheekSquintRight",n.mouthRight="mouthDimpleRight",n.eyeLookDown_R="eyeLookDownRight",n.eyeLookUp_L="eyeLookUpLeft",n.eyeSquint_L="eyeSquintLeft",n.jawOpen="jawOpen",n.browOuterUp_R="browOuterUpRight",n.mouthClose="mouthClose",n.mouthShrugLower="mouthShrugLower",n.eyeWide_L="eyeWideLeft",n.tongueOut="tongueOut",n.eyeSquint_R="eyeSquintRight",n.cheekPuff="cheekPuff",n.mouthPress_R="mouthPressRight",n.mouthSmile_R="mouthSmileRight",n))(Qd||{});class qb{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 $b{_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 or{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 tg extends or{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],s=i.name;this.argumentsData[s]=this.allocation_node(i.data.length*4),a[s]=this.argumentsData[s]}}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 ag{_autoUpdate=!0;_target;_lookAtObject;_origin=new g(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 $e{focus;distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Hr),!this._camera){console.error("FirstPersonCameraController need camera");return}if(!this.focus){console.error("FirstPersonCameraController need target");return}B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){B.inputSystem.addEventListener(Y.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){B.inputSystem.removeEventListener(Y.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+=B.inputSystem.wheelDelta*.1}onUpdate(){let e=new g;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var tt=(n=>(n[n.Key_BackSpace=8]="Key_BackSpace",n[n.Key_Tab=9]="Key_Tab",n[n.Key_Clear=12]="Key_Clear",n[n.Key_Enter=13]="Key_Enter",n[n.Key_Shift_L=16]="Key_Shift_L",n[n.Key_Control_L=17]="Key_Control_L",n[n.Key_Alt_L=18]="Key_Alt_L",n[n.Key_Pause=19]="Key_Pause",n[n.Key_CapsLock=20]="Key_CapsLock",n[n.Key_Escape=21]="Key_Escape",n[n.Key_Esc=27]="Key_Esc",n[n.Key_Space=32]="Key_Space",n[n.Key_Prior=33]="Key_Prior",n[n.Key_Next=34]="Key_Next",n[n.Key_End=35]="Key_End",n[n.Key_Home=36]="Key_Home",n[n.Key_Left=37]="Key_Left",n[n.Key_Up=38]="Key_Up",n[n.Key_Right=39]="Key_Right",n[n.Key_Down=40]="Key_Down",n[n.Key_Select=41]="Key_Select",n[n.Key_Print=42]="Key_Print",n[n.Key_Execute=43]="Key_Execute",n[n.Key_Insert=45]="Key_Insert",n[n.Key_Delete=46]="Key_Delete",n[n.Key_Help=47]="Key_Help",n[n.Key_0=48]="Key_0",n[n.Key_1=49]="Key_1",n[n.Key_2=50]="Key_2",n[n.Key_3=51]="Key_3",n[n.Key_4=52]="Key_4",n[n.Key_5=53]="Key_5",n[n.Key_6=54]="Key_6",n[n.Key_7=55]="Key_7",n[n.Key_8=56]="Key_8",n[n.Key_9=57]="Key_9",n[n.Key_A=65]="Key_A",n[n.Key_B=66]="Key_B",n[n.Key_C=67]="Key_C",n[n.Key_D=68]="Key_D",n[n.Key_E=69]="Key_E",n[n.Key_F=70]="Key_F",n[n.Key_G=71]="Key_G",n[n.Key_H=72]="Key_H",n[n.Key_I=73]="Key_I",n[n.Key_J=74]="Key_J",n[n.Key_K=75]="Key_K",n[n.Key_L=76]="Key_L",n[n.Key_M=77]="Key_M",n[n.Key_N=78]="Key_N",n[n.Key_O=79]="Key_O",n[n.Key_P=80]="Key_P",n[n.Key_Q=81]="Key_Q",n[n.Key_R=82]="Key_R",n[n.Key_S=83]="Key_S",n[n.Key_T=84]="Key_T",n[n.Key_U=85]="Key_U",n[n.Key_V=86]="Key_V",n[n.Key_W=87]="Key_W",n[n.Key_X=88]="Key_X",n[n.Key_Y=89]="Key_Y",n[n.Key_Z=90]="Key_Z",n[n.Key_KP_0=96]="Key_KP_0",n[n.Key_KP_1=97]="Key_KP_1",n[n.Key_KP_2=98]="Key_KP_2",n[n.Key_KP_3=99]="Key_KP_3",n[n.Key_KP_4=100]="Key_KP_4",n[n.Key_KP_5=101]="Key_KP_5",n[n.Key_KP_6=102]="Key_KP_6",n[n.Key_KP_7=103]="Key_KP_7",n[n.Key_KP_8=104]="Key_KP_8",n[n.Key_KP_9=105]="Key_KP_9",n[n.Key_Multiply=106]="Key_Multiply",n[n.Key_Add=107]="Key_Add",n[n.Key_Separator=108]="Key_Separator",n[n.Key_Subtract=109]="Key_Subtract",n[n.Key_Decimal=110]="Key_Decimal",n[n.Key_Divide=111]="Key_Divide",n[n.Key_F1=112]="Key_F1",n[n.Key_F2=113]="Key_F2",n[n.Key_F3=114]="Key_F3",n[n.Key_F4=115]="Key_F4",n[n.Key_F5=116]="Key_F5",n[n.Key_F6=117]="Key_F6",n[n.Key_F7=118]="Key_F7",n[n.Key_F8=119]="Key_F8",n[n.Key_F9=120]="Key_F9",n[n.Key_F10=121]="Key_F10",n[n.Key_F11=122]="Key_F11",n[n.Key_F12=123]="Key_F12",n[n.Key_F13=124]="Key_F13",n[n.Key_F14=125]="Key_F14",n[n.Key_F15=126]="Key_F15",n[n.Key_F16=127]="Key_F16",n[n.Key_F17=128]="Key_F17",n[n.Key_F18=129]="Key_F18",n[n.Key_F19=130]="Key_F19",n[n.Key_F20=131]="Key_F20",n[n.Key_F21=132]="Key_F21",n[n.Key_F22=133]="Key_F22",n[n.Key_F23=134]="Key_F23",n[n.Key_F24=135]="Key_F24",n[n.Key_Num_Lock=136]="Key_Num_Lock",n[n.Key_Scroll_Lock=137]="Key_Scroll_Lock",n))(tt||{});class ig extends $e{moveSpeed=2;targetPos=new g(0,0,10);lookAtPos=new g(0,0,0);config={shiftMoveScale:20};_moveScale=1;_dir;_mouseFactory=25;_factory=1.5;_mouseDown=!1;_lastPos;_keyState;constructor(){super(),this._lastPos=new g,this._keyState={front:!1,back:!1,left:!1,right:!1,q:!1,e:!1},this.setCamera(new g(0,0,100),new g(0,0,0))}setCamera(e,t){this.targetPos.copyFrom(e),this.lookAtPos.copyFrom(t),this.Reset()}start(){B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.mouseDown,this),B.inputSystem.addEventListener(Ia.KEY_UP,this.keyUp,this),B.inputSystem.addEventListener(Ia.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=B.inputSystem.mouseLastX,this._lastPos.y=B.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=_e(ze.delta,0,.016);if(this._mouseDown&&(e.rotationY-=this.internal(e.rotationY+(B.inputSystem.mouseLastX-this._lastPos.x)*.25,e.rotationY,t*this._mouseFactory),e.rotationX-=this.internal(e.rotationX+(B.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=xr(e.y,e.y-this.moveSpeed*this._moveScale,t*this._factory)),this._keyState.e&&(e.y=xr(e.y,e.y+this.moveSpeed*this._moveScale,t*this._factory))}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.mouseDown,this),B.inputSystem.removeEventListener(Ia.KEY_UP,this.keyUp,this),B.inputSystem.removeEventListener(Ia.KEY_DOWN,this.keyDown,this),super.destroy(e)}}class Gi{static add(e,t,a){return a||(a=new g),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 g),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 g),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 g),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 g),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=g.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 g.distance(e,t)}static getRandomXYZ(e=-100,t=100){return new g(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 g(Math.random()*t+e,Math.random()*r+a,Math.random()*t+e)}static sphere(e){let t=e*Math.random(),a=new g(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 s=e+(t-e)*Math.random(),o=new g(Math.random()*a-a*.5,Math.random()*r-r*.5,Math.random()*i-i*.5);return o.normalize(),o.scaleBy(s),o}}class sg extends $e{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 g;_tempPos=new g;constructor(){super(),this._currentPos=new d.Object3D,this._targetPos=new d.Object3D}start(){this.camera=this.object3D.getOrAddComponent(Hr),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onMouseMove,this,null,10),B.inputSystem.addEventListener(Y.POINTER_UP,this.onMouseUp,this,null,10),B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.onMouseWheel,this)}flowTarget(e,t=g.ZERO){this._flowTarget=e,this._flowOffset||=new g,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=kn.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*Gi.distance(this._currentPos.transform.worldPosition,this.camera.transform.worldPosition)/10,this.distance-=B.inputSystem.wheelDelta*this._wheelStep,this.distance=_e(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&&(g.HELP_1.x=-1*e.movementX*Math.cos(this._roll*Math.PI/180)-e.movementY*Math.sin(this._roll*Math.PI/180),g.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+=g.HELP_1.x*this.mouseRightFactor,this._targetPos.z+=g.HELP_1.z*this.mouseRightFactor),this._mouseLeftDown&&(this.roll-=e.movementX*ze.delta*.001*this.mouseLeftFactor,this.pitch-=e.movementY*ze.delta*.001*this.mouseLeftFactor,this.pitch=_e(this.pitch,this._topClamp,this._bottomClamp)))}onBeforeUpdate(e){if(!this.enable)return;this._flowTarget&&(g.HELP_0.copyFrom(this._flowTarget.transform.worldPosition),g.HELP_0.add(this._flowOffset,g.HELP_0),this.target=g.HELP_0);let t=_e(ze.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=ne.HELP_0;a.fromEulerAngles(this._pitch,this._roll,0),this._tempDir.applyQuaternion(a),this._tempPos=Gi.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,g.UP)}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onMouseMove,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.onMouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.onMouseWheel,this),super.destroy(e),this.camera=null,this._flowTarget=null}}class ng extends $e{_camera;autoRotate=!1;autoRotateSpeed=.1;rotateFactor=.5;zoomFactor=.1;panFactor=.25;_smooth=5;_minDistance=1;_maxDistance=1e5;_maxPolarAngle=90;_minPolarAngle=-90;_target=new g(0,0,0);_cTarget=new g(0,0,0);_position=new g(0,0,0);_cPosition=new g(0,0,0);_spherical=new og;_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=_e(e,2e-6,this._maxDistance)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance=_e(e,this._minDistance,1/0)}get minPolarAngle(){return this._minPolarAngle}set minPolarAngle(e){this._minPolarAngle=_e(e,-90,this._maxPolarAngle)}get maxPolarAngle(){return this._maxPolarAngle}set maxPolarAngle(e){this._maxPolarAngle=_e(e,this._minPolarAngle,90)}get spherical(){return this._spherical}start(){this._camera=this.object3D.getComponent(Hr),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,g.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,g.UP)}onWheel(e){e.deltaY=_e(e.deltaY,-this._spherical.radius,this._spherical.radius),this._spherical.radius+=e.deltaY*this.zoomFactor,this._spherical.radius=_e(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=_e(this._spherical.phi,this.minPolarAngle,this.maxPolarAngle),this.updateCamera()}else e.mouseCode===2&&(Gi.mulScale(this.object3D.transform.up,e.movementY*this.panFactor*this._camera.aspect,g.HELP_1),e.ctrlKey||e.metaKey?this._target.y+=g.HELP_1.y:(this._target.x+=g.HELP_1.x,this._target.z+=g.HELP_1.z),Gi.mulScale(this.object3D.transform.right,-e.movementX*this.panFactor,g.HELP_1),this._target.x-=g.HELP_1.x,this._target.z-=g.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(){B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.onWheel,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onPointerDown,this),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onPointerMove,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.onPointerUp,this)}removeEventListener(){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.onWheel,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onPointerDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onPointerMove,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.onPointerUp,this)}}const Md=Math.PI/180/100;class og{radius;phi;theta;coords;constructor(e=1,t=0,a=0){return this.radius=e,this.phi=t,this.theta=a,this.coords=new g,this}set(e,t,a){return this.radius=e,this.phi=t,this.theta=a,this}makeSafe(){return this.phi=Math.max(Md,Math.min(Math.PI-Md,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(_e(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 lg extends $e{focus;_rotation=new g(45,0,0);distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Hr),!this._camera){console.error("ThirdPersonCameraController need camera");return}if(!this.focus){console.error("ThirdPersonCameraController need target");return}B.inputSystem.addEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){B.inputSystem.addEventListener(Y.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){this._rotation.y+=e.movementX*.01,this._rotation.x+=e.movementY*.01}mouseWheel(e){this.distance+=B.inputSystem.wheelDelta*.1}onUpdate(){let e=new g;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t.subtract(e)}destroy(e){B.inputSystem.removeEventListener(Y.POINTER_WHEEL,this.mouseWheel,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.mouseUp,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var at=(n=>(n[n.NORMAL=0]="NORMAL",n[n.DOWN=1]="DOWN",n[n.OVER=2]="OVER",n[n.DISABLE=3]="DISABLE",n))(at||{});let Pd=Math.PI*2;class Pr{a;b;c;d;tx;ty;constructor(e=1,t=0,a=0,r=1,i=0,s=0){this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=s}clone(){return new Pr(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*pt;let t=Math.cos(e),a=Math.sin(e),r=this.a,i=this.b,s=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=s*t-o*a,this.d=s*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,s){return this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=s,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 g(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,s=t.c,o=t.d,l=t.tx,c=t.ty,f=a.a,h=a.b,u=a.c,b=a.d,A=a.tx,m=a.ty;h!==0||u!==0?(this.a=r*f+i*u,this.b=r*h+i*b,this.c=s*f+o*u,this.d=s*h+o*b,this.tx=f*l+u*c+A,this.ty=h*l+b*c+m):(this.a=r*f,this.b=i*b,this.c=s*f,this.d=o*b,this.tx=f*l+A,this.ty=b*c+m)}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,s){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+s,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 g(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 s=this;if(a!==0){a=a*pt;let o=Math.cos(a),l=Math.sin(a);s.a=o*e,s.b=l*t,s.c=-l*e,s.d=o*t}else s.a=e,s.b=0,s.c=0,s.d=t;s.tx=r,s.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,s=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*s,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*s+r*o),e.ty=-(a*s+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==Pd)&&(r==0||r==Pd)){this.a=e,this.b=this.c=0,this.d=t;return}a=a*pt,r=r*pt;let i=Math.cos(a),s=Math.sin(a);a==r?(this.a=i*e,this.b=s*e):(this.a=Math.cos(r)*e,this.b=Math.sin(r)*e),this.c=-s*t,this.d=i*t}preMultiplyInto(e,t){let a=e.a*this.a,r=0,i=0,s=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,s+=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=s,t.tx=o,t.ty=l}$transformBounds(e){let t=this.a,a=this.b,r=this.c,i=this.d,s=this.tx,o=this.ty,l=e.x,c=e.y,f=l+e.width,h=c+e.height,u=t*l+r*c+s,b=a*l+i*c+o,A=t*f+r*c+s,m=a*f+i*c+o,p=t*f+r*h+s,D=a*f+i*h+o,_=t*l+r*h+s,v=a*l+i*h+o,U=0;u>A&&(U=u,u=A,A=U),p>_&&(U=p,p=_,_=U),e.x=Math.floor(u<p?u:p),e.width=Math.ceil((A>_?A:_)-e.x),b>m&&(U=b,b=m,m=U),D>v&&(U=D,D=v,v=U),e.y=Math.floor(b<D?b:D),e.height=Math.ceil((m>v?m:v)-e.y)}getDeterminant(){return this.a*this.d-this.b*this.c}}class zi extends $e{isGUICanvas=!0;index=0;addChild(e){return this.object3D.addChild(e),this}removeChild(e){return this.object3D.removeChild(e),this}cloneTo(e){e.getOrAddComponent(zi).copyComponent(this)}copyComponent(e){return e.index=e.index,this}}var ot=(n=>(n[n.NONE=0]="NONE",n[n.POSITION=1]="POSITION",n[n.SPRITE=2]="SPRITE",n[n.COLOR=4]="COLOR",n[n.MAX=7]="MAX",n))(ot||{});class _o{array;buffer;constructor(e){this.buffer=new Pe(e,0),this.array=new Float32Array(this.buffer.memory.shareDataBuffer)}}class Nd extends Ve{_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 g(-a,-a,-a),t=new g(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(...ci.attUV);for(let i=0,s=this.maxQuadCount*ci.vertexCount;i<s;i++)a[i]=i;this._attributeUV=new Float32Array(ci.vertexCount*e*this._uvSize),this._attributeVIndex=new Float32Array(ci.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 s=0;s<ci.indecies.length;s++){const o=ci.indecies[s]+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 _o(e*4),this._spriteAttribute=new _o(e*12),this._colorAttribute=new _o(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){Vd.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;Vd.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==si.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 s=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]=s,c[f+11]=e.visible?1:0,this._onSpriteChange=!0}}class cg{static set(e,t,a,r,...i){let s=t*r+a;for(let o=0,l=i.length;o<l;o++)e[s+o]=i[o]}}class Vd extends cg{static setXYZW(e,t,a,r,i,s){this.set(e,t,0,4,a,r,i,s)}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 ci{static vertexCount=4;static attUV=[0,0,1,0,1,1,0,1];static indecies=[0,1,2,0,2,3]}class Od{_textureMap=new Map;_textureList=[];build(e,t,a){let r=t._geometry;r.resetSubGeometries();let i=-1,s=0,o=0,l=0,c=0,f=this._textureList,h=this._textureMap;function u(){l>0&&(t.updateDrawCallSegment(c,o,l),t._uiRenderer.materials[c].setTextures(f),h.clear(),f.length=0,c++,o+=l,l=0,s=0)}h.clear(),f.length=0;let b=[],A=t.quadMaxCount-1;for(let m of e){let p=m.needUpdateQuads;b.length=0;const D=this.collectQuads(m.object3D,b);for(let _ of D){let v=_.sprite.guiTexture;if(h.has(v.staticId)||(s==7&&u(),h.set(v.staticId,v),v.dynamicId=s,f[s]=v.texture,s+=1),_.z=++i,l+=6,_.cacheTextureId!=v.dynamicId&&(_.dirtyAttributes=ot.MAX,_.cacheTextureId=v.dynamicId),(p||a)&&(_.dirtyAttributes=ot.MAX),_.dirtyAttributes&ot.POSITION&&_.applyTransform(m),_.dirtyAttributes&&_.writeToGeometry(r,m),i==A)return u(),!0}}return u(),!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 s=i.getShadowRender();s&&this.push(s.mainQuads,t),this.push(i.mainQuads,t)}return t}push(e,t){e&&e.length>0&&t.push(...e)}}class Bo{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 vo extends Dt{_scissorRect;_screenSize=new fe(1024,768);_scissorEnable=!1;constructor(e){super(),X.register("GUI_shader_view",Bo.GUI_shader_view),X.register("GUI_shader_world",Bo.GUI_shader_world);let t=new gt;this.addColorPass(t,de.COLOR,e),this.addColorPass(t,de.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 ue),i.setUniformVector2("screenSize",this._screenSize),i.setUniformFloat("scissorCornerRadius",0),i.setUniformFloat("scissorFadeOutSize",0),i.setUniformFloat("pixelRatio",1),i.setUniformVector3("v3",g.ZERO);let s=i.shaderState;s.depthWriteEnabled=!1,i.blendMode=Ae.NORMAL,i.depthCompare=a==fa.View?lt.always:lt.less_equal,i.cullMode=Vt.back,e.addRenderPass(i)}setPanelRatio(e){this.shader.setUniformFloat("pixelRatio",e)}setScissorRect(e,t,a,r){this._scissorRect||=new ue,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]||B.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 Ld extends d.MeshRenderer{_guiGeometry;init(e){super.init(),this.addRendererMask(Me.UI),this.removeRendererMask(Me.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 h=0;h<o.length;h++){const u=o[h];u.pipeline||(u.setStorageBuffer("vPositionBuffer",l),u.setStorageBuffer("vSpriteBuffer",c),u.setStorageBuffer("vColorBuffer",f))}}super.nodeUpdate(e,t,a,r)}onUpdate(e){}}class Gd{_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 Wi;class Na{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=B.res.defaultGUISprite;_color=new Z(1,1,1,1);_imageType=si.Simple;dirtyAttributes=nt.MAX;cacheTextureId=-1;static textPool;static get quadPool(){return this.textPool||=new Gd,this.textPool}static recycleQuad(e){e.sprite=null,e.dirtyAttributes=nt.MAX,e.x=0,e.y=0,e.z=-1,e.cacheTextureId=-1,Na.quadPool.pushBack(e)}static spawnQuad(){return Na.quadPool.getOne(Na)}get imageType(){return this._imageType}set imageType(e){this._imageType=e,this.setAttrChange(nt.SPRITE|nt.POSITION)}get color(){return this._color}set color(e){this._color.copyFrom(e),this.setAttrChange(nt.COLOR)}get visible(){return this._visible}set visible(e){e!=this._visible&&(this._visible=e,this.setAttrChange(nt.SPRITE))}get sprite(){return this._sprite}set sprite(e){this._sprite!=e&&(this._sprite=e,this.setAttrChange(nt.SPRITE|nt.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(nt.POSITION)}setXY(e,t){this.x=e,this.y=t,this.setAttrChange(nt.POSITION)}setAttrChange(e){this.dirtyAttributes=this.dirtyAttributes|e}applyTransform(e){this.setAttrChange(nt.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(),s=t.isSliced&&this._imageType==si.Sliced;if(this._offsetX=e.width*.5*r,this._offsetY=e.height*.5*i,s)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 Wi||=new Pr,Wi.identity(),Wi.setTranslate(this.x,this.y),Wi.mul(e),Wi}writeToGeometry(e,t){return e.fillQuad(this,t),this.dirtyAttributes=nt.NONE,this}}class Uo extends $e{_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(ar),this._uiTransform.setNeedUpdateUIPanel()}copyComponent(e){return this.visible=e.visible,this}}class Ji extends Uo{_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),Na.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 Nr extends Ji{init(e){super.init?.(e),this.attachQuad(Na.spawnQuad()),this.sprite=B.res.defaultGUISprite}cloneTo(e){e.getOrAddComponent(Nr).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||=B.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 ji extends Nr{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(ji).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 vo(this.space);let s=this._uiRenderer.materials.slice();s.push(i),this._uiRenderer.materials=s,i.cullMode=r.cullMode,i.depthCompare=r.depthCompare}}create(e){this._maxCount=this.space==fa.World?Qr.quadMaxCountForWorld:Qr.quadMaxCountForView,this._uiRenderer=this.object3D.addComponent(Ld),this._geometry=this._uiRenderer.geometry=new Nd(this._maxCount).create(),this._uiRenderer.material=new vo(e),this._uiRenderer.renderOrder=Qr.SortOrderStartWorld,this._rebuild=new Od,this.object3D.bound=new Ce(new g,new g(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=Ar.None,console.warn("Cannot enable billboard in view space")),e==Ar.BillboardXYZ||e==Ar.BillboardY?(this._billboard=this.object3D.getOrAddComponent(Ni),this._billboard.type=e):(this.object3D.removeComponent(Ni),this._billboard=null)}get billboard(){return this._billboard?this._billboard.type:Ar.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(ar,a),a.length>0){t._rebuild.build(a,t,t.needUpdateGeometry);for(const o of a)o.needUpdateQuads=!1}let r=t.object3D.getComponentFromParent(zi),i=r?r.index:0;t._uiRenderer.enable=a.length>0;let s=t.isViewPanel?Qr.SortOrderStartView:Qr.SortOrderStartWorld;if(t._uiRenderer.renderOrder=i*Qr.SortOrderCanvasSpan+s+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,s=e/t,o=1;return i<s?o=t/r:o=e/a,o}}class Is extends ji{isViewPanel=!0;space=fa.View;constructor(){super()}cloneTo(e){e.getOrAddComponent(Is).copyComponent(this)}}class Ts extends ji{isWorldPanel=!0;space=fa.World;_depthTest=!0;constructor(){super()}cloneTo(e){e.getOrAddComponent(Ts).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?lt.less_equal:lt.always;for(let a of this._uiRenderer.materials)a.depthCompare=t}}}let zd;class ar extends $e{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 Pr,this._worldMatrix=new Pr}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 s of this.object3D.entityChildren){let o=s.getComponent(ar);o&&o.onUITransformVisible(this._globalVisible)}else i.onUITransformVisible(this._globalVisible)}))}onParentChange(e,t){this.parent?.setNeedUpdateUIPanel(),this.parent=t?.getComponent(ar),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(ar,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(Ts),e||(e=this.object3D.getComponentFromParent(Is)),e&&(e.needUpdateGeometry=!0)}cloneTo(e){let t=e.getOrAddComponent(ar);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)&&(zd||=new Pr().identity(),e.mul(zd.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 Wd{_ray;_mouseCode;_clickEvent;_outEvent;_overEvent;_upEvent;_downEvent;_view;init(e){this._view=e,this._ray=new na,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),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onTouchDown,this,null,1),B.inputSystem.addEventListener(Y.POINTER_UP,this.onTouchUp,this,null,1),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onTouchMove,this,null,1),B.inputSystem.addEventListener(Y.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 fe;_calcDistanceVec2=new fe;_lastDownTime=0;_clickTimeSpan=200;_clickDistanceSpan=10;onTouchDown(e){this._lastDownTime=ze.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&&ze.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 s=r._uiRenderer.__renderOrder,o=i._uiRenderer.__renderOrder;return s>o?-1:1});for(let r of a){this._transformList.length=0,r.object3D.getComponents(ar,this._transformList),this._transformList.reverse();for(const i of this._transformList){let s=i.uiInteractiveList;if(s&&s.length>0)for(let o of s)this._colliderOut.push(o),this._iteractive2PanelDict.set(o,r)}}}}),this._colliderOut}pick(e){this._ray=this._view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY);let t=new fe(B.inputSystem.mouseX,B.inputSystem.mouseY),a=new fe(I.canvas.clientWidth,I.canvas.clientHeight),r;for(const i of e)if(i.interactive&&i.enable&&i.interactiveVisible){let s=this._iteractive2PanelDict.get(i);if(r=i.rayPick(this._ray,s,t,a),r)return r.collider=i,r}return null}}var Jd=(n=>(n[n.COLLINEAR=0]="COLLINEAR",n[n.LINES_INTERSECT=1]="LINES_INTERSECT",n[n.SEGMENTS_INTERSECT=2]="SEGMENTS_INTERSECT",n[n.A_BISECTS_B=3]="A_BISECTS_B",n[n.B_BISECTS_A=4]="B_BISECTS_A",n[n.PARALELL=5]="PARALELL",n))(Jd||{}),jd=(n=>(n[n.ON_LINE=0]="ON_LINE",n[n.LEFT_SIDE=1]="LEFT_SIDE",n[n.RIGHT_SIDE=2]="RIGHT_SIDE",n))(jd||{});class vt{static cacluteLine0=new vt(null,null);static cacluteLine1=new vt(null,null);start;end;color=new Z(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=g.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=gn(a+1,e.length),s=e[r],o=e[i];t.push(new vt(s,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 s=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=s,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 g(e.x,e.y);return t.normalize()}copyFrom(e){this.start||(this.start=new g),this.end||(this.end=new g),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,s=t.start,o=t.end,l=r.x,c=r.y,f=r.z,h=i.x,u=i.y,b=i.z,A=s.x,m=s.y,p=s.z,D=o.x,_=o.y,v=o.z,U=h-l,y=u-c,S=b-f,F=D-A,k=_-m,x=v-p,w=l-A,R=c-m,Q=f-p,M=U*U+y*y+S*S,j=U*F+y*k+S*x,he=F*F+k*k+x*x,ae=U*w+y*R+S*Q,P=F*w+k*R+x*Q,z=M*he-j*j,W=z,V=z,te=0,J=0;this.IsEqual(z,0)?(te=0,W=1,J=P,V=he):(te=j*P-he*ae,J=M*P-j*ae,te<0?(te=0,J=P,V=he):te>W&&(te=W,J=P+j,V=he)),J<0?(J=0,-ae<0?te=0:-ae>M?te=W:(te=-ae,W=M)):J>V&&(J=V,-ae+j<0?te=0:-ae+j>M?te=W:(te=-ae+j,W=M));let K=0,ee=0;this.IsEqual(te,0)?K=0:K=te/W,this.IsEqual(J,0)?ee=0:ee=J/V;let re=w+K*U-ee*F,oe=R+K*y-ee*k,pe=Q+K*S-ee*x;return re*re+oe*oe+pe*pe}isNear(e,t=0,a){let r=g.HELP_0,i=g.HELP_1;r.copyFrom(e.origin),i.copyFrom(e.direction),i.scaleBy(9999),i.add(r,i),vt.cacluteLine0.set(r,i),vt.cacluteLine1.copyFrom(this),a&&(a.perspectiveMultiplyPoint3(vt.cacluteLine1.start,vt.cacluteLine1.start),a.perspectiveMultiplyPoint3(vt.cacluteLine1.end,vt.cacluteLine1.end));let s=vt.squreDistanceSegmentToSegment(vt.cacluteLine0,vt.cacluteLine1,a);return s+1e-4<=t?(e.length=s,!0):(e.length=-999999,!1)}}class Zi{static ID=-1;v1;v2;v3;u1;u2;u3;n1;n2;n3;t0;t;u;v;min=new g;max=new g;id=0;constructor(e,t,a){this.id=Zi.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 g(t.x-e.x,t.y-e.y,t.z-e.z),s=new g(a.x-e.x,a.y-e.y,a.z-e.z).crossProduct(r);return s.normalize(),s}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 vt(e,t),new vt(t,a),new vt(a,e)]}equals(e){let t=this.getLines(),a=e.getLines(),r=0;for(let i=0;i<t.length;i++)for(let s=0;s<a.length;s++)t[i].equals(a[s])&&r++;return r==3}getCenter(){let e=this.min,t=this.max,a=new g;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,s,o,l,c;return i=this.sign2D(e,t,a),s=this.sign2D(e,a,r),o=this.sign2D(e,r,t),l=i<0||s<0||o<0,c=i>0||s>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 Zd{static _pt0;static _pt1;static _pt2;static _pt3;static _hitPoint;static _worldMatrix;static _ray;static _triangle;static _isInit;static init(){this._pt0=new g,this._pt1=new g,this._pt2=new g,this._pt3=new g,this._ray=new na,this._triangle=new Zi,this._hitPoint=new g,this._worldMatrix=new T}static rayPick(e,t,a,r,i,s,o){this._isInit||(this.init(),this._isInit=!0);let l=this._worldMatrix;if(r==fa.World){let c;this.calculateHotArea_World(s,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(s,i,this._pt0,this._pt1,this._pt2,this._pt3);let c=a.x,f=a.y,h=Math.min(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,u=Math.min(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5,b=Math.max(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,A=Math.max(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5;return t.x<=b&&t.x>=h&&t.y<=A&&t.y>=u?(this._hitPoint.set(t.x,t.y,0),{distance:0,intersectPoint:this._hitPoint}):null}return null}static calculateHotArea_View(e,t,a,r,i,s){let o=e.getWorldMatrix(),l=o.getScaleX(),c=o.getScaleY(),f=e.width*.5*l,h=e.height*.5*c;a.set(-f,-h,0),r.set(f,-h,0),i.set(-f,h,0),s.set(f,h,0);let u=o.tx;a.x+=u,r.x+=u,i.x+=u,s.x+=u,u=o.ty,a.y-=u,r.y-=u,i.y-=u,s.y-=u,a.multiplyScalar(t),r.multiplyScalar(t),i.multiplyScalar(t),s.multiplyScalar(t)}static calculateHotArea_World(e,t,a,r,i){let s=e.getWorldMatrix(),o=s.getScaleX(),l=s.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 h=s.tx;t.x+=h,a.x+=h,r.x+=h,i.x+=h,h=s.ty,t.y+=h,a.y+=h,r.y+=h,i.y+=h}}var Yd=(n=>(n[n.UpperLeft=0]="UpperLeft",n[n.UpperCenter=1]="UpperCenter",n[n.UpperRight=2]="UpperRight",n[n.MiddleLeft=3]="MiddleLeft",n[n.MiddleCenter=4]="MiddleCenter",n[n.MiddleRight=5]="MiddleRight",n[n.LowerLeft=6]="LowerLeft",n[n.LowerCenter=7]="LowerCenter",n[n.LowerRight=8]="LowerRight",n))(Yd||{}),Xd=(n=>(n[n.Upper=0]="Upper",n[n.Middle=1]="Middle",n[n.Lower=2]="Lower",n))(Xd||{}),Hd=(n=>(n[n.Left=0]="Left",n[n.Center=1]="Center",n[n.Right=2]="Right",n))(Hd||{});class Kd{charList=[];quadList=[];width=0;index=0}class qd{layout(e){let t=[],a=e.originSize,r=ri.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,s,o,l,c){let f=-1,h=0,u=l*o,b=u*.5,A=e.width/o,m=e.height/o,p=0,D=e.height,_=()=>{h=0,f++;let S=new Kd;return S.index=f,a.push(S),S},v=(S,F)=>{const k=S.charCodeAt(0).toString();let x=ri.getFnt(r,l,k),w=null;return x?(w=Na.spawnQuad(),w.sprite=x,w.x=(h+x.xoffset)*o-p,w.y=(i.base-x.height-x.yoffset-i.base)*o+D,w.width=x.offsetSize.width*o,w.height=x.offsetSize.height*o,h+=x.xadvance):S==`
11815
+ `}class vo extends Dt{_scissorRect;_screenSize=new fe(1024,768);_scissorEnable=!1;constructor(e){super(),X.register("GUI_shader_view",Bo.GUI_shader_view),X.register("GUI_shader_world",Bo.GUI_shader_world);let t=new gt;this.addColorPass(t,de.COLOR,e),this.addColorPass(t,de.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 ue),i.setUniformVector2("screenSize",this._screenSize),i.setUniformFloat("scissorCornerRadius",0),i.setUniformFloat("scissorFadeOutSize",0),i.setUniformFloat("pixelRatio",1),i.setUniformVector3("v3",g.ZERO);let s=i.shaderState;s.depthWriteEnabled=!1,i.blendMode=Ae.NORMAL,i.depthCompare=a==fa.View?it.always:it.less_equal,i.cullMode=Vt.back,e.addRenderPass(i)}setPanelRatio(e){this.shader.setUniformFloat("pixelRatio",e)}setScissorRect(e,t,a,r){this._scissorRect||=new ue,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]||B.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 Ld extends d.MeshRenderer{_guiGeometry;init(e){super.init(),this.addRendererMask(Me.UI),this.removeRendererMask(Me.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 h=0;h<o.length;h++){const u=o[h];u.pipeline||(u.setStorageBuffer("vPositionBuffer",l),u.setStorageBuffer("vSpriteBuffer",c),u.setStorageBuffer("vColorBuffer",f))}}super.nodeUpdate(e,t,a,r)}onUpdate(e){}}class Gd{_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 Wi;class Na{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=B.res.defaultGUISprite;_color=new Z(1,1,1,1);_imageType=si.Simple;dirtyAttributes=ot.MAX;cacheTextureId=-1;static textPool;static get quadPool(){return this.textPool||=new Gd,this.textPool}static recycleQuad(e){e.sprite=null,e.dirtyAttributes=ot.MAX,e.x=0,e.y=0,e.z=-1,e.cacheTextureId=-1,Na.quadPool.pushBack(e)}static spawnQuad(){return Na.quadPool.getOne(Na)}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(),s=t.isSliced&&this._imageType==si.Sliced;if(this._offsetX=e.width*.5*r,this._offsetY=e.height*.5*i,s)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 Wi||=new Pr,Wi.identity(),Wi.setTranslate(this.x,this.y),Wi.mul(e),Wi}writeToGeometry(e,t){return e.fillQuad(this,t),this.dirtyAttributes=ot.NONE,this}}class Uo extends $e{_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(ar),this._uiTransform.setNeedUpdateUIPanel()}copyComponent(e){return this.visible=e.visible,this}}class Ji extends Uo{_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),Na.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 Nr extends Ji{init(e){super.init?.(e),this.attachQuad(Na.spawnQuad()),this.sprite=B.res.defaultGUISprite}cloneTo(e){e.getOrAddComponent(Nr).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||=B.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 ji extends Nr{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(ji).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 vo(this.space);let s=this._uiRenderer.materials.slice();s.push(i),this._uiRenderer.materials=s,i.cullMode=r.cullMode,i.depthCompare=r.depthCompare}}create(e){this._maxCount=this.space==fa.World?Qr.quadMaxCountForWorld:Qr.quadMaxCountForView,this._uiRenderer=this.object3D.addComponent(Ld),this._geometry=this._uiRenderer.geometry=new Nd(this._maxCount).create(),this._uiRenderer.material=new vo(e),this._uiRenderer.renderOrder=Qr.SortOrderStartWorld,this._rebuild=new Od,this.object3D.bound=new Ce(new g,new g(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=Ar.None,console.warn("Cannot enable billboard in view space")),e==Ar.BillboardXYZ||e==Ar.BillboardY?(this._billboard=this.object3D.getOrAddComponent(Ni),this._billboard.type=e):(this.object3D.removeComponent(Ni),this._billboard=null)}get billboard(){return this._billboard?this._billboard.type:Ar.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(ar,a),a.length>0){t._rebuild.build(a,t,t.needUpdateGeometry);for(const o of a)o.needUpdateQuads=!1}let r=t.object3D.getComponentFromParent(zi),i=r?r.index:0;t._uiRenderer.enable=a.length>0;let s=t.isViewPanel?Qr.SortOrderStartView:Qr.SortOrderStartWorld;if(t._uiRenderer.renderOrder=i*Qr.SortOrderCanvasSpan+s+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,s=e/t,o=1;return i<s?o=t/r:o=e/a,o}}class Is extends ji{isViewPanel=!0;space=fa.View;constructor(){super()}cloneTo(e){e.getOrAddComponent(Is).copyComponent(this)}}class Ts extends ji{isWorldPanel=!0;space=fa.World;_depthTest=!0;constructor(){super()}cloneTo(e){e.getOrAddComponent(Ts).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?it.less_equal:it.always;for(let a of this._uiRenderer.materials)a.depthCompare=t}}}let zd;class ar extends $e{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 Pr,this._worldMatrix=new Pr}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 s of this.object3D.entityChildren){let o=s.getComponent(ar);o&&o.onUITransformVisible(this._globalVisible)}else i.onUITransformVisible(this._globalVisible)}))}onParentChange(e,t){this.parent?.setNeedUpdateUIPanel(),this.parent=t?.getComponent(ar),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(ar,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(Ts),e||(e=this.object3D.getComponentFromParent(Is)),e&&(e.needUpdateGeometry=!0)}cloneTo(e){let t=e.getOrAddComponent(ar);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)&&(zd||=new Pr().identity(),e.mul(zd.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 Wd{_ray;_mouseCode;_clickEvent;_outEvent;_overEvent;_upEvent;_downEvent;_view;init(e){this._view=e,this._ray=new na,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),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onTouchDown,this,null,1),B.inputSystem.addEventListener(Y.POINTER_UP,this.onTouchUp,this,null,1),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onTouchMove,this,null,1),B.inputSystem.addEventListener(Y.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 fe;_calcDistanceVec2=new fe;_lastDownTime=0;_clickTimeSpan=200;_clickDistanceSpan=10;onTouchDown(e){this._lastDownTime=ze.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&&ze.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 s=r._uiRenderer.__renderOrder,o=i._uiRenderer.__renderOrder;return s>o?-1:1});for(let r of a){this._transformList.length=0,r.object3D.getComponents(ar,this._transformList),this._transformList.reverse();for(const i of this._transformList){let s=i.uiInteractiveList;if(s&&s.length>0)for(let o of s)this._colliderOut.push(o),this._iteractive2PanelDict.set(o,r)}}}}),this._colliderOut}pick(e){this._ray=this._view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY);let t=new fe(B.inputSystem.mouseX,B.inputSystem.mouseY),a=new fe(I.canvas.clientWidth,I.canvas.clientHeight),r;for(const i of e)if(i.interactive&&i.enable&&i.interactiveVisible){let s=this._iteractive2PanelDict.get(i);if(r=i.rayPick(this._ray,s,t,a),r)return r.collider=i,r}return null}}var Jd=(n=>(n[n.COLLINEAR=0]="COLLINEAR",n[n.LINES_INTERSECT=1]="LINES_INTERSECT",n[n.SEGMENTS_INTERSECT=2]="SEGMENTS_INTERSECT",n[n.A_BISECTS_B=3]="A_BISECTS_B",n[n.B_BISECTS_A=4]="B_BISECTS_A",n[n.PARALELL=5]="PARALELL",n))(Jd||{}),jd=(n=>(n[n.ON_LINE=0]="ON_LINE",n[n.LEFT_SIDE=1]="LEFT_SIDE",n[n.RIGHT_SIDE=2]="RIGHT_SIDE",n))(jd||{});class vt{static cacluteLine0=new vt(null,null);static cacluteLine1=new vt(null,null);start;end;color=new Z(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=g.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=gn(a+1,e.length),s=e[r],o=e[i];t.push(new vt(s,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 s=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=s,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 g(e.x,e.y);return t.normalize()}copyFrom(e){this.start||(this.start=new g),this.end||(this.end=new g),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,s=t.start,o=t.end,l=r.x,c=r.y,f=r.z,h=i.x,u=i.y,b=i.z,A=s.x,m=s.y,p=s.z,D=o.x,_=o.y,v=o.z,U=h-l,y=u-c,S=b-f,F=D-A,k=_-m,x=v-p,w=l-A,R=c-m,Q=f-p,M=U*U+y*y+S*S,j=U*F+y*k+S*x,he=F*F+k*k+x*x,ae=U*w+y*R+S*Q,P=F*w+k*R+x*Q,z=M*he-j*j,W=z,V=z,te=0,J=0;this.IsEqual(z,0)?(te=0,W=1,J=P,V=he):(te=j*P-he*ae,J=M*P-j*ae,te<0?(te=0,J=P,V=he):te>W&&(te=W,J=P+j,V=he)),J<0?(J=0,-ae<0?te=0:-ae>M?te=W:(te=-ae,W=M)):J>V&&(J=V,-ae+j<0?te=0:-ae+j>M?te=W:(te=-ae+j,W=M));let K=0,ee=0;this.IsEqual(te,0)?K=0:K=te/W,this.IsEqual(J,0)?ee=0:ee=J/V;let re=w+K*U-ee*F,oe=R+K*y-ee*k,pe=Q+K*S-ee*x;return re*re+oe*oe+pe*pe}isNear(e,t=0,a){let r=g.HELP_0,i=g.HELP_1;r.copyFrom(e.origin),i.copyFrom(e.direction),i.scaleBy(9999),i.add(r,i),vt.cacluteLine0.set(r,i),vt.cacluteLine1.copyFrom(this),a&&(a.perspectiveMultiplyPoint3(vt.cacluteLine1.start,vt.cacluteLine1.start),a.perspectiveMultiplyPoint3(vt.cacluteLine1.end,vt.cacluteLine1.end));let s=vt.squreDistanceSegmentToSegment(vt.cacluteLine0,vt.cacluteLine1,a);return s+1e-4<=t?(e.length=s,!0):(e.length=-999999,!1)}}class Zi{static ID=-1;v1;v2;v3;u1;u2;u3;n1;n2;n3;t0;t;u;v;min=new g;max=new g;id=0;constructor(e,t,a){this.id=Zi.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 g(t.x-e.x,t.y-e.y,t.z-e.z),s=new g(a.x-e.x,a.y-e.y,a.z-e.z).crossProduct(r);return s.normalize(),s}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 vt(e,t),new vt(t,a),new vt(a,e)]}equals(e){let t=this.getLines(),a=e.getLines(),r=0;for(let i=0;i<t.length;i++)for(let s=0;s<a.length;s++)t[i].equals(a[s])&&r++;return r==3}getCenter(){let e=this.min,t=this.max,a=new g;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,s,o,l,c;return i=this.sign2D(e,t,a),s=this.sign2D(e,a,r),o=this.sign2D(e,r,t),l=i<0||s<0||o<0,c=i>0||s>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 Zd{static _pt0;static _pt1;static _pt2;static _pt3;static _hitPoint;static _worldMatrix;static _ray;static _triangle;static _isInit;static init(){this._pt0=new g,this._pt1=new g,this._pt2=new g,this._pt3=new g,this._ray=new na,this._triangle=new Zi,this._hitPoint=new g,this._worldMatrix=new T}static rayPick(e,t,a,r,i,s,o){this._isInit||(this.init(),this._isInit=!0);let l=this._worldMatrix;if(r==fa.World){let c;this.calculateHotArea_World(s,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(s,i,this._pt0,this._pt1,this._pt2,this._pt3);let c=a.x,f=a.y,h=Math.min(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,u=Math.min(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5,b=Math.max(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,A=Math.max(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5;return t.x<=b&&t.x>=h&&t.y<=A&&t.y>=u?(this._hitPoint.set(t.x,t.y,0),{distance:0,intersectPoint:this._hitPoint}):null}return null}static calculateHotArea_View(e,t,a,r,i,s){let o=e.getWorldMatrix(),l=o.getScaleX(),c=o.getScaleY(),f=e.width*.5*l,h=e.height*.5*c;a.set(-f,-h,0),r.set(f,-h,0),i.set(-f,h,0),s.set(f,h,0);let u=o.tx;a.x+=u,r.x+=u,i.x+=u,s.x+=u,u=o.ty,a.y-=u,r.y-=u,i.y-=u,s.y-=u,a.multiplyScalar(t),r.multiplyScalar(t),i.multiplyScalar(t),s.multiplyScalar(t)}static calculateHotArea_World(e,t,a,r,i){let s=e.getWorldMatrix(),o=s.getScaleX(),l=s.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 h=s.tx;t.x+=h,a.x+=h,r.x+=h,i.x+=h,h=s.ty,t.y+=h,a.y+=h,r.y+=h,i.y+=h}}var Yd=(n=>(n[n.UpperLeft=0]="UpperLeft",n[n.UpperCenter=1]="UpperCenter",n[n.UpperRight=2]="UpperRight",n[n.MiddleLeft=3]="MiddleLeft",n[n.MiddleCenter=4]="MiddleCenter",n[n.MiddleRight=5]="MiddleRight",n[n.LowerLeft=6]="LowerLeft",n[n.LowerCenter=7]="LowerCenter",n[n.LowerRight=8]="LowerRight",n))(Yd||{}),Xd=(n=>(n[n.Upper=0]="Upper",n[n.Middle=1]="Middle",n[n.Lower=2]="Lower",n))(Xd||{}),Hd=(n=>(n[n.Left=0]="Left",n[n.Center=1]="Center",n[n.Right=2]="Right",n))(Hd||{});class Kd{charList=[];quadList=[];width=0;index=0}class qd{layout(e){let t=[],a=e.originSize,r=ri.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,s,o,l,c){let f=-1,h=0,u=l*o,b=u*.5,A=e.width/o,m=e.height/o,p=0,D=e.height,_=()=>{h=0,f++;let S=new Kd;return S.index=f,a.push(S),S},v=(S,F)=>{const k=S.charCodeAt(0).toString();let x=ri.getFnt(r,l,k),w=null;return x?(w=Na.spawnQuad(),w.sprite=x,w.x=(h+x.xoffset)*o-p,w.y=(i.base-x.height-x.yoffset-i.base)*o+D,w.width=x.offsetSize.width*o,w.height=x.offsetSize.height*o,h+=x.xadvance):S==`
11788
11816
  `||(S==" "?h+=u:h+=b),F.width=h,F.quadList.push(w),F.charList.push(S),w},U=()=>{let S=this.getAlignment(t);switch(S.v){case 0:for(let F=0,k=a.length;F<k;F++){let x=a[F];if(F>0){let w=F*u*c;for(let R=0,Q=x.quadList.length;R<Q;R++){let M=x.quadList[R];M&&(M.y-=w)}}}break;case 1:for(let F=0,k=a.length;F<k;F++){let x=a[F],w=(m-k*l*c)*.5*o+F*u*c;for(let R=0,Q=x.quadList.length;R<Q;R++){let M=x.quadList[R];M&&(M.y-=w)}}break;case 2:for(let F=0,k=a.length;F<k;F++){let x=a[F],w=(m-k*l*c)*o+F*u*c;for(let R=0,Q=x.quadList.length;R<Q;R++){let M=x.quadList[R];M&&(M.y-=w)}}break}switch(S.h){case 0:break;case 1:for(let F=0,k=a.length;F<k;F++){let x=a[F],w=(A-x.width)*.5*o;for(let R=0,Q=x.quadList.length;R<Q;R++){let M=x.quadList[R];M&&(M.x+=w)}}break;case 2:for(let F=0,k=a.length;F<k;F++){let x=a[F],w=(A-x.width)*o;for(let R=0,Q=x.quadList.length;R<Q;R++){let M=x.quadList[R];M&&(M.x+=w)}}break}};(()=>{let S=null,F=s.length;for(let k=0;k<F;k++){S||=_();let x=s.charAt(k);x==`
11789
11817
  `||x==" "?S=null:(v(x,S),S.width+b>=A&&(S=_()))}})(),U()}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 Qs extends Uo{_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 Zd.rayPick(e,a,r,t.space,t.panelRatio,this._uiTransform,t.transform.worldMatrix)}cloneTo(e){e.getOrAddComponent(Qs).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.enable=e._enable,this.interactive=e._interactive,this.mouseStyle=e._style,this}}var $d=(n=>(n[n.NONE=0]="NONE",n[n.COLOR=1]="COLOR",n[n.SPRITE=2]="SPRITE",n))($d||{});class yo extends Qs{_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(Nr),this._isCreateImage=this._image==null,this._image||(this._image=this.object3D.addComponent(Nr)),this.imageType=si.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(yo).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(Nr),this._image=null),super.destroy()}}class Co 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(Na.spawnQuad());this._uiTransform.resize(0,0)}getQuad(e){return this._mainQuads[e]}cloneTo(e){e.addComponent(Co,{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||B.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 fe;let a=this._mainQuads[e];return t.x=a.x,t.y=a.y,t}}class So extends Ji{_shadowQuality=1;_shadowOffset;_shadowRadius;_shadowColor;_subShadowColor;needUpdateShadow=!1;init(e){super.init?.(e),this._shadowRadius=2,this._shadowQuality=1,this._shadowOffset=new fe(4,-4),this._shadowColor=new Z(.1,.1,.1,.8),this._subShadowColor=this._shadowColor.clone(),this.isUIShadow=!0}cloneTo(e){e.getOrAddComponent(So).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=_e(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 fe(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=Na.spawnQuad(),s=0,o=0;if(r==0)i.color=this._shadowColor;else{let l=a*(r-1)/(t-1);s=Math.sin(l)*this._shadowRadius,o=Math.cos(l)*this._shadowRadius,i.color=this._subShadowColor}i.setXY(s+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 xo extends Ji{_font="\u5FAE\u8F6F\u96C5\u9ED1";_fontSize=14;_originSize=42;_alignment=0;_lineSpacing=1;_text="";_color=new Z(1,1,1,1);constructor(){super()}cloneTo(e){e.getOrAddComponent(xo).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 qd;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 s=a.quadList[r];s&&this.attachQuad(s)}}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 fg=Object.getOwnPropertyDescriptor,dg=(n,e,t,a)=>{for(var r=a>1?void 0:a?fg(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.Light=class extends Ei{constructor(){super()}init(){super.init(),this.lightData.lightType=ft.PointLight,this.object3D.name==""&&(this.object3D.name="PointLight"+Gt())}get range(){return this.lightData.range}set range(e){this.lightData.range=e,this.onChange()}get at(){return this.lightData.linear}set at(e){this.lightData.linear=e,this.onChange()}get radius(){return this.lightData.radius}set radius(e){this.lightData.radius=e,this.onChange()}get quadratic(){return this.lightData.quadratic}set quadratic(e){this.lightData.quadratic=e,this.onChange()}start(){this.transform.rotationX=90,super.start()}onUpdate(){}onGraphic(e){let t=e.scene.getChildByName("graphic3D");if(!t)return;let a=t.createCustomShape(`PointLight_${this.object3D.instanceID}`,this.transform);a.buildAxis(),a.buildCircle(g.ZERO,this.range,32,g.X_AXIS),a.buildCircle(g.ZERO,this.range,32,g.Y_AXIS),a.buildCircle(g.ZERO,this.range,32,g.Z_AXIS)}debug(){}debugDraw(e){}},d.Light=dg([Nt(d.Light,"Light")],d.Light);var hg=Object.getOwnPropertyDescriptor,ug=(n,e,t,a)=>{for(var r=a>1?void 0:a?hg(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.FatLineRenderer=class extends Ba{_fatLineMaterial=null;_fatLineGeometry=null;_cachedResolution=new fe(0,0);constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(e){e.addComponent(d.FatLineRenderer).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this}set geometry(e){super.geometry=e,this._fatLineGeometry=e,e&&(this.instanceCount=e.instanceCount,this._fatLineMaterial&&e.instanceBuffer&&this._fatLineMaterial.setInstanceBuffer(e.instanceBuffer))}get geometry(){return this._fatLineGeometry}set material(e){this.materials=[e],this._fatLineMaterial=e,this._fatLineGeometry&&this._fatLineGeometry.instanceBuffer&&e.setInstanceBuffer(this._fatLineGeometry.instanceBuffer)}get material(){return this._fatLineMaterial}nodeUpdate(e,t,a,r){if(this._fatLineMaterial&&this.object3D){this._fatLineMaterial.setModelMatrix(this.object3D.transform.worldMatrix);const i=I.presentationSize[0],s=I.presentationSize[1];i>0&&s>0&&(this._cachedResolution.x!==i||this._cachedResolution.y!==s)&&(this._cachedResolution.set(i,s),this._fatLineMaterial.resolution=this._cachedResolution.clone())}super.nodeUpdate(e,t,a,r)}destroy(e){super.destroy(e)}},d.FatLineRenderer=ug([Nt(d.FatLineRenderer,"FatLineRenderer")],d.FatLineRenderer);var bg=Object.getOwnPropertyDescriptor,gg=(n,e,t,a)=>{for(var r=a>1?void 0:a?bg(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.GSplatStreamRenderer=class extends Ba{totalCount=0;size=new fe;localBoundBox=new Ce;get worldBoundBox(){const e=new Ce;e.makeEmpty();const a=this.object3D.transform.worldMatrix.rawData,r=this.localBoundBox.min,i=this.localBoundBox.max,s=[[r.x,r.y,r.z],[i.x,r.y,r.z],[r.x,i.y,r.z],[i.x,i.y,r.z],[r.x,r.y,i.z],[i.x,r.y,i.z],[r.x,i.y,i.z],[i.x,i.y,i.z]];for(const[o,l,c]of s){const f=a[0]*o+a[4]*l+a[8]*c+a[12],h=a[1]*o+a[5]*l+a[9]*c+a[13],u=a[2]*o+a[6]*l+a[10]*c+a[14];e.expandByPoint(new g(f,h,u))}return e}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(e,t=128){if(e<=0)throw new Error("Total count must be greater than 0");this.totalCount=e,this._batchSize=t,this.size=this.evalTextureSize(e);const a=this.size.x|0,r=this.size.y|0,i=a*r;this._colorData=new Uint8Array(i*4),this._colorData.fill(0),this._transformAData=new Uint32Array(i*4),this._transformAData.fill(0),this._transformBData=new Array(i*4).fill(0),this._orderData=new Uint32Array(i);for(let s=0;s<i;s++)this._orderData[s]=s<e?s:e>0?e-1:0;this._positions=new Float32Array(e*3),this._positions.fill(0),this.localBoundBox.makeEmpty(),this._splatSetFlags=new Array(e).fill(!1),this._validCount=0,this.texParams=new Float32Array([this._validCount,this.size.x,0,1]),this.splatColor=new Si().create(a,r,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 xn().create(a,r,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 _s().create(a,r,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 Ds().create(a,r,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 Cn,this.geometry=new Sn(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}setSplatData(e,t){if(e<0||e>=this.totalCount)throw new Error(`Index ${e} out of range [0, ${this.totalCount})`);const a=this._splatSetFlags[e];this._positions[e*3+0]=t.position[0],this._positions[e*3+1]=t.position[1],this._positions[e*3+2]=t.position[2],this.localBoundBox.expandByPoint(new g(t.position[0],t.position[1],t.position[2]));const r=.28209479177387814;let i=.5,s=.5,o=.5;t.sh&&t.sh.coeffs&&t.sh.coeffs.length>=3&&(i=.5+t.sh.coeffs[0]*r,s=.5+t.sh.coeffs[1]*r,o=.5+t.sh.coeffs[2]*r);const l=t.opacity!==void 0?1/(1+Math.exp(-t.opacity)):1,c=e*4;this._colorData[c+0]=Math.max(0,Math.min(255,Math.floor(i*255))),this._colorData[c+1]=Math.max(0,Math.min(255,Math.floor(s*255))),this._colorData[c+2]=Math.max(0,Math.min(255,Math.floor(o*255))),this._colorData[c+3]=Math.max(0,Math.min(255,Math.floor(l*255))),this.updateTransformData(e,t),a||(this._splatSetFlags[e]=!0,this._validCount++),this._pendingUpdates.add(e)}updateTransformData(e,t){const a=e*4,r=new ArrayBuffer(4),i=new Float32Array(r),s=new Uint32Array(r),o=je=>(i[0]=je,s[0]),l=t.position[0],c=t.position[1],f=t.position[2];this._transformAData[a+0]=o(l),this._transformAData[a+1]=o(c),this._transformAData[a+2]=o(f);let h=0,u=0,b=0,A=1;if(t.rotation){h=t.rotation[0],u=t.rotation[1],b=t.rotation[2],A=t.rotation[3];const je=1/Math.hypot(h,u,b,A);h*=je,u*=je,b*=je,A*=je}let m=1,p=1,D=1;t.scale&&(m=Math.exp(t.scale[0]),p=Math.exp(t.scale[1]),D=Math.exp(t.scale[2]));const _=h+h,v=u+u,U=b+b,y=h*_,S=h*v,F=h*U,k=u*v,x=u*U,w=b*U,R=A*_,Q=A*v,M=A*U,j=1-(k+w),he=S+M,ae=F-Q,P=S-M,z=1-(y+w),W=x+R,V=F+Q,te=x-R,J=1-(y+k),K=j*m,ee=he*m,re=ae*m,oe=P*p,pe=z*p,Te=W*p,Oe=V*D,q=te*D,ie=J*D,ce=K*K+oe*oe+Oe*Oe,ge=K*ee+oe*pe+Oe*q,we=K*re+oe*Te+Oe*ie,me=ee*ee+pe*pe+q*q,ye=ee*re+pe*Te+q*ie,Qe=re*re+Te*Te+ie*ie,Re=a;this._transformBData[Re+0]=ce,this._transformBData[Re+1]=ge,this._transformBData[Re+2]=we,this._transformBData[Re+3]=Qe;const Le=qa(me)&65535,Ut=qa(ye)&65535;this._transformAData[a+3]=Le|Ut<<16}flushUpdates(){if(this._pendingUpdates.size===0)return;const e=this.size.x|0,t=this.size.y|0,a=Array.from(this._pendingUpdates);if(a.length===0)return;let r=t,i=0;for(const l of a){const c=Math.floor(l/e);c<r&&(r=c),c>i&&(i=c)}const s=i-r+1;s/t<.5&&s<t?(this.splatColor.updateTexture(e,t,this._colorData,r,s),this.transformA.updateTexture(e,t,this._transformAData,r,s),this.transformB.updateTexture(e,t,this._transformBData,!1,r,s)):(this.splatColor.updateTexture(e,t,this._colorData),this.transformA.updateTexture(e,t,this._transformAData),this.transformB.updateTexture(e,t,this._transformBData,!1)),this.updatePendingWorldPositions(),this._pendingUpdates.clear()}setAutoFlushThreshold(e){this._autoFlushThreshold=Math.max(1,e)}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(e){if(this._validCount===0)return;const t=this.object3D.transform.localChange;t&&this.updateWorldPositions();const a=e.rawData,r=a[2],i=a[6],s=a[10],o=-(a[0]*a[12]+a[1]*a[13]+a[2]*a[14]),l=-(a[4]*a[12]+a[5]*a[13]+a[6]*a[14]),c=-(a[8]*a[12]+a[9]*a[13]+a[10]*a[14]),f=performance.now(),h=(f-this._lastSentTime)/1e3,u=Math.floor(o*1e3)^Math.floor(l*1e3)^Math.floor(c*1e3),b=Math.floor(r*1e3)^Math.floor(i*1e3)^Math.floor(s*1e3),A=u^b;if(A===this._lastViewMatrixHash&&!t&&this._centersSent)return;let m=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const D=Math.abs(A-this._lastViewMatrixHash)/Math.max(h,.001);D<1e3?m=this._minIntervalMs:D<1e4?m=this._minIntervalMs*.5:m=this._minIntervalMs*.2,this._lastCameraSpeed=D}if(!(f-this._lastSentTime<m)){if(this._lastViewMatrixHash=A,this._lastSentTime=f,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=S=>{const F=S.data.order,k=this._orderData.buffer;this._sortWorker.postMessage({order:k},[k]);const x=new Uint32Array(F),w=this.size.x*this.size.y,R=Math.min(this._validCount,x.length);if((!this._orderData||this._orderData.length!==w)&&(this._orderData=new Uint32Array(w)),this._orderData.set(x.subarray(0,R),0),R<w){const j=this._validCount>0?this._validCount-1:0;this._orderData.fill(j,R,w)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const Q=Math.max(0,Math.min(this._validCount,S.data.count|0));this.setCount(Q),this._updateTexParams();const M=Math.ceil(Q/this._batchSize);this.instanceCount=M};const p=new Float32Array(this._validCount*3);let D=0;const _=this.object3D.transform.worldMatrix,v=this._positions,U=_.rawData;for(let S=0;S<this._validCount;S++)if(this._splatSetFlags[S]){const F=S*3,k=v[F+0],x=v[F+1],w=v[F+2];p[D*3+0]=U[0]*k+U[4]*x+U[8]*w+U[12],p[D*3+1]=U[1]*k+U[5]*x+U[9]*w+U[13],p[D*3+2]=U[2]*k+U[6]*x+U[10]*w+U[14],D++}const y=new Uint32Array(this.totalCount);for(let S=0;S<this.totalCount;S++)y[S]=S<this._validCount?S:this._validCount>0?this._validCount-1:0;this._sortWorker.postMessage({order:y.buffer,centers:p.buffer},[y.buffer,p.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const p=new Float32Array(this._validCount*3);let D=0;const _=this.object3D.transform.worldMatrix,v=this._positions,U=_.rawData;for(let y=0;y<this._validCount;y++)if(this._splatSetFlags[y]){const S=y*3,F=v[S+0],k=v[S+1],x=v[S+2];p[D*3+0]=U[0]*F+U[4]*k+U[8]*x+U[12],p[D*3+1]=U[1]*F+U[5]*k+U[9]*x+U[13],p[D*3+2]=U[2]*F+U[6]*k+U[10]*x+U[14],D++}this._sortWorker.postMessage({type:"centers",centers:p.buffer},[p.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:o,y:l,z:c},cameraDirection:{x:-r,y:-i,z:-s}})}}createSortWorker(){function e(){let o,l,c,f,h=!1;const u={x:0,y:0,z:0},b={x:0,y:0,z:0},A={x:0,y:0,z:0},m={x:0,y:0,z:0};let p,D;const _=(U,y,S)=>{for(;U<=y;){const F=y+U>>1,k=S(F);if(k>0)U=F+1;else if(k<0)y=F-1;else return F}return~U},v=()=>{if(!o||!l||!c||!f)return;const U=c.x,y=c.y,S=c.z,F=f.x,k=f.y,x=f.z,w=.001;if(!h&&Math.abs(U-u.x)<w&&Math.abs(y-u.y)<w&&Math.abs(S-u.z)<w&&Math.abs(F-b.x)<w&&Math.abs(k-b.y)<w&&Math.abs(x-b.z)<w)return;h=!1,u.x=U,u.y=y,u.z=S,b.x=F,b.y=k,b.z=x;const R=l.length/3;p?.length!==R&&(p=new Uint32Array(R));let Q,M;for(let W=0;W<8;++W){const V=(W&1?A.x:m.x)-U,te=(W&2?A.y:m.y)-y,J=(W&4?A.z:m.z)-S,K=V*F+te*k+J*x;W===0?Q=M=K:(Q=Math.min(Q,K),M=Math.max(M,K))}D?D.fill(0):D=new Uint32Array(65537);const j=M-Q,he=j<1e-6?0:1/j*2**16;for(let W=0;W<R;++W){const V=W*3,te=l[V+0]-U,J=l[V+1]-y,K=l[V+2]-S,ee=te*F+J*k+K*x,re=Math.floor((ee-Q)*he);p[W]=re,D[re]++}for(let W=1;W<65537;W++)D[W]+=D[W-1];for(let W=0;W<R;W++){const V=p[W],te=--D[V];o[te]=W}const ae=W=>p[o[W]]/he+Q,P=()=>{const W=_(0,R-1,V=>-ae(V));return Math.min(R,Math.abs(W))},z=ae(R-1)>=0?P():R;self.postMessage({order:o.buffer,count:z},[o.buffer]),o=null};self.onmessage=U=>{if(U.data.order&&(o=new Uint32Array(U.data.order)),U.data.centers){l=new Float32Array(U.data.centers),A.x=m.x=l[0],A.y=m.y=l[1],A.z=m.z=l[2];const y=l.length/3;for(let S=1;S<y;++S){const F=l[S*3+0],k=l[S*3+1],x=l[S*3+2];A.x=Math.min(A.x,F),A.y=Math.min(A.y,k),A.z=Math.min(A.z,x),m.x=Math.max(m.x,F),m.y=Math.max(m.y,k),m.z=Math.max(m.z,x)}h=!0}U.data.cameraPosition&&(c=U.data.cameraPosition),U.data.cameraDirection&&(f=U.data.cameraDirection),v()}}const t=`(${e.toString()})()`,a=new Blob([t],{type:"application/javascript"}),r=URL.createObjectURL(a);return new Worker(r)}setVisBoost(e){this.texParams[3]=Math.max(0,e),this._texParamDirty=!0}setCount(e){this.texParams[0]=Math.max(0,e),this._texParamDirty=!0}_updateTexParams(){this._texParamDirty&&(this.gsplatMaterial.setTexParams(this.texParams),this._texParamDirty=!1)}setSortThrottle(e){this._minIntervalMs=Math.max(0,e|0)}setAdaptiveSorting(e){this._adaptiveSorting=e}setPixelCulling(e,t=0,a=0){this._minPixelCoverage=Math.max(0,e),this._maxPixelCoverage=Math.max(0,t),this._maxPixelCullDistance=Math.max(0,a)}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(e){let t=Math.ceil(Math.sqrt(e));const a=64;t=Math.ceil(t/a)*a;const r=Math.ceil(e/t);return new fe(t,r)}nodeUpdate(e,t,a,r){this._validCount>0&&e?.camera&&e.camera.viewMatrix&&this.scheduleOrder(e.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 i=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(i);const s=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;s!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=s),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(e,t,a,r)}renderPass(e,t,a){const r=a.encoder;for(let i of this.materials){const s=i.getPass(t);if(!(!s||s.length===0))for(const o of s){if(!o.pipeline)continue;o.apply(this.geometry,a.rendererPassState||a),E.bindPipeline(r,o),E.bindGeometryBuffer(r,this.geometry);const c=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?E.drawIndexed(r,c.indexCount,this.instanceCount,c.indexStart,0,0):E.drawIndexed(r,c.indexCount,1,c.indexStart,0,0)}}}destroy(e){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(e),this.splatColor=null),this.transformA&&(this.transformA.destroy(e),this.transformA=null),this.transformB&&(this.transformB.destroy(e),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(e),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(e)}},d.GSplatStreamRenderer=gg([Nt(d.GSplatStreamRenderer,"GSplatStreamRenderer")],d.GSplatStreamRenderer);class eh extends d.Object3D{index=0;drawCallFrame=-1;constructor(){super()}}var Fo=(n=>(n[n.CastGI=0]="CastGI",n[n.ReceiveGI=1]="ReceiveGI",n[n.CastDepth=2]="CastDepth",n[n.Other=3]="Other",n))(Fo||{});class th extends Dt{static count=0;constructor(e=0,t=0){super(),X.register("GIProbeShader",Dd);let a=new gt,r=new qe("GIProbeShader","GIProbeShader");r.passType=de.COLOR,a.addRenderPass(r),r.setDefine("USE_BRDF",!0),r.setShaderEntry("VertMain","FragMain"),r.setUniformVector4("probeUniform",new ue(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",B.res.whiteTexture),a.setTexture("normalMap",B.res.normalTexture),a.setTexture("emissiveMap",B.res.blackTexture),this.shader=a}}class mg extends $e{_probes;_volume;_debugMr=[];init(e){e||=B.views[0]?.scene,B.setting.gi.enable=!0,this._volume=ve.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 Ir(4,16,16),s=new g;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),h=new eh;h.index=f,h.name=`${o}_${l}_${c}`;let u=h.addComponent(d.MeshRenderer);u.material=new th(Fo.CastGI,f),u.geometry=i,u.castGI=!1,u.castShadow=!1,this._debugMr.push(u),this.object3D.addChild(h),this._volume.calcPosition(o,l,c,s),h.x=s.x,h.y=s.y,h.z=s.z,this._probes[f]=h,this._debugMr.push(u)}for(let o=0;o<this._probes.length;o++)$.instance.addGIProbe(e,this._probes[o]);this.object3D.transform.enable=!1,this._volume.setting.debug&&this.debug()}debug(){}debugProbeRay(e,t){const a=B.setting.gi.rayNumber;let r=new ne(0,-.7071067811865475,.7071067811865475,0);for(let i=0;i<a;i++){let s=e*a+i,o=new g(-t[s*4+0],-t[s*4+1],-t[s*4+2],0);r.transformVector(o,o);let l=t[s*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 g;for(let i=0;i<e;i++)for(let s=0;s<t;s++)for(let o=0;o<a;o++){let l=i+o*e+s*(e*a),c=this._probes[l];this._volume.calcPosition(i,s,o,r),c.x=r.x,c.y=r.y,c.z=r.z}}onUpdate(){B.setting.gi.maxDistance=B.setting.gi.probeSpace*1.5;let e=this.transform.scene3D.view.camera,t=g.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 pg 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(d.MeshRenderer,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 s=a.materials[i];r+=s.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,s)=>{let o=this._keyBufferGroup.get(s),l=i[0];for(let c=0;c<l.materials.length;c++){let h=l.materials[c].getPass(t);if(h)for(let u=0;u<h.length;u++){const b=h[u];b.setDefine("USE_INSTANCEDRAW",!0),b.setStorageBuffer("instanceDrawID",o)}}l.nodeUpdate(e,t,a,r)})}renderPass(e,t,a){this._keyRenderGroup.forEach((r,i)=>{let s=r[0];s.instanceCount=r.length,this.renderItem(e,t,s,a)})}renderItem(e,t,a,r){let i=a.transform._worldMatrix;for(let s=0;s<a.materials.length;s++){let l=a.materials[s].getPass(t);if(!(!l||l.length==0))for(let c=0;c<l.length;c++){let f=l[c];E.bindGeometryBuffer(r.encoder,a.geometry);const h=f;h.shaderState.splitTexture&&(r.endRenderPass(),wt.WriteSplitColorTexture(a.instanceID),r.beginOpaqueRenderPass(),E.bindCamera(r.encoder,e.camera),E.bindGeometryBuffer(r.encoder,a.geometry)),E.bindPipeline(r.encoder,h);let m=a.geometry.subGeometries[s].lodLevels[a.lodLevel];a.instanceCount>0?E.drawIndexed(r.encoder,m.indexCount,a.instanceCount,m.indexStart,0,0):E.drawIndexed(r.encoder,m.indexCount,1,m.indexStart,0,i.index)}}}beforeDestroy(e){this._keyRenderGroup.clear(),this._keyBufferGroup.clear(),this._keyIdsGroup.clear(),this._keyRenderGroup=this._keyBufferGroup=this._keyIdsGroup=void 0,Ne.removeWaitStart(this.object3D,this)}}var Ag=Object.getOwnPropertyDescriptor,Dg=(n,e,t,a)=>{for(var r=a>1?void 0:a?Ag(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.MeshFilter=class extends d.MeshRenderer{constructor(){super()}get geometry(){return null}set geometry(e){}cloneTo(e){}set meshURL(e){let t=B.res.getGeometry(e);t?this.geometry=t:console.error("no geometry set",e)}},d.MeshFilter=Dg([Nt(d.MeshFilter,"MeshFilter")],d.MeshFilter);var _g=Object.getOwnPropertyDescriptor,Bg=(n,e,t,a)=>{for(var r=a>1?void 0:a?_g(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.SkinnedMeshRenderer=class extends d.MeshRenderer{skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Me.SkinnedMesh)}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(d.SkeletonAnimationComponent),!this.skeletonAnimation){let e=this.object3D.parentObject.parentObject.getComponentsInChild(d.SkeletonAnimationComponent);e.length>0&&(this.skeletonAnimation=e[0]);let t=this.object3D;for(;!this.skeletonAnimation&&t;)this.skeletonAnimation=t.getComponentFromParent(d.SkeletonAnimationComponent),t.parent&&(t=t.parent.object3D)}}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(e){if(this.mSkeletonAnimation=e,!!e&&!this.mJointIndexTableBuffer){let t=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new Pe(t.length*4,0,new Float32Array(t)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(e){this.mInverseBindMatrixData=e;var t=new Float32Array(e.length*16);for(let a=0;a<e.length;a++){let r=a*16,i=e[a];t.set(i,r)}this.mInverseBindMatrixBuffer=new Pe(t.byteLength,0,t),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(e){let t=e.addComponent(d.SkinnedMeshRenderer);t.geometry=this.geometry,t.material=this.material.clone(),t.castShadow=this.castShadow,t.castGI=this.castGI,t.receiveShadow=this.receiveShadow,t.rendererMask=this.rendererMask,t.skinJointsName=this.skinJointsName,t.skinInverseBindMatrices=this.skinInverseBindMatrices,t.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(e,t,a,r){for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t);if(o)for(let l=0;l<o.length;l++){const c=o[l];!c.pipeline&&this.mSkeletonAnimation&&(c.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),c.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),c.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(e,t,a,r)}},d.SkinnedMeshRenderer=Bg([Nt(d.SkinnedMeshRenderer,"SkinnedMeshRenderer")],d.SkinnedMeshRenderer);class vg extends ut{radius=2.5;height=10;constructor(){super(),this._shapeType=ni.Capsule}}class Ms extends ut{mesh;static triangle;_pickRet;constructor(){super(),this._shapeType=ni.Mesh}rayPick(e,t){if(this.mesh){Ms.triangle||=new Zi(new g,new g,new g);let a=this.mesh.getAttribute(G.position),r=this.mesh.getAttribute(G.indices),i=ut.helpMatrix;i.copyFrom(t).invert();let s=ut.helpRay.copy(e);if(s.applyMatrix(i),s.intersectBox(this.mesh.bounds),!s.intersectBox(this.mesh.bounds,ut.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 h=c*3;const u=r.data[h+0]*3,b=r.data[h+1]*3,A=r.data[h+2]*3;let m=Ms.triangle,p=m.v1.set(l[u+0],l[u+1],l[u+2]),D=m.v2.set(l[b+0],l[b+1],l[b+2]),_=m.v3.set(l[A+0],l[A+1],l[A+2]);m.set(p,D,_);let v=s.intersectTriangle(s.origin,s.direction,m);if(v){this._pickRet||={intersectPoint:new g,distance:0},this._pickRet.intersectPoint=v,this._pickRet.distance=g.distance(s.origin,v);let U=this.mesh.getAttribute(G.normal);if(U){let y=U.data,S=new g(y[u],y[u+1],y[u+2]);t.transformVector(S,S),S.normalize(),this._pickRet.normal=S}return this._pickRet}}}}return null}}class Ug extends ut{_pickRet;box;radius=.5;constructor(e){super(),this._shapeType=ni.Sphere,this.radius=e,this.box=new Tr(new g,1)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.radius);let r=ut.helpMatrix;r.copyFrom(t).invert();let i=ut.helpRay.copy(e);i.applyMatrix(r);let s=i.intersectSphere(i.origin,i.direction,this.box.center,this.box.radius);return s?(this._pickRet||(this._pickRet={intersect:!1,intersectPoint:new g,distance:0}),this._pickRet.intersect=!0,this._pickRet.intersectPoint=s,this._pickRet.distance=g.distance(i.origin,ut.v3_help_0),this._pickRet):null}}class yg extends d.Object3D{_envMap;skyObject;envMapChange=!0;view;constructor(){super(),this.transform.scene3D=this,this.skyObject=new d.Object3D,this.addChild(this.skyObject),this._isScene3D=!0,this.envMap||=B.res.defaultSky}get envMap(){return this._envMap}set envMap(e){this._envMap!=e&&(this.envMapChange=!0),this._envMap=e,$.instance.sky&&"map"in $.instance.sky&&($.instance.sky.map=e)}get exposure(){return $.instance.sky&&"exposure"in $.instance.sky?$.instance.sky.exposure:0}set exposure(e){$.instance.sky&&"exposure"in $.instance.sky&&($.instance.sky.exposure=e,B.setting.sky.skyExposure=e)}get roughness(){if($.instance.sky&&"roughness"in $.instance.sky)return $.instance.sky.roughness}set roughness(e){$.instance.sky&&"roughness"in $.instance.sky&&($.instance.sky.roughness=e)}}class ah{_computeShader;_outBuffer;constructor(){}init(){let e=Be.getGBufferFrame(Be.colorPass_GBuffer);this._computeShader=new Se(ad),this._outBuffer=new ei(32),this._computeShader.setStorageBuffer("outBuffer",this._outBuffer),this._computeShader.setSamplerTexture("gBufferTexture",e.getCompressGBufferTexture())}compute(e){let t=ve.getCameraGroup(e.camera);this._computeShader.setStorageBuffer("globalUniform",t.uniformGPUBuffer);let a=E.beginCommandEncoder();E.computeCommand(a,[this._computeShader]),E.endCommandEncoder(a),this._outBuffer.readBuffer()}getPickMeshID(){var e=this._outBuffer.outFloat32Array[0]+.1;return Math.floor(e)}getPickWorldPosition(e){e||=new g;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 g;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 fe;var t=this._outBuffer.outFloat32Array[2],a=this._outBuffer.outFloat32Array[3];return e.set(t,a),e}}class rh extends ja{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 na,this.mouseEnableMap=new Map,this._pickEvent=new Y(Y.PICK_CLICK),this._outEvent=new Y(Y.PICK_OUT),this._overEvent=new Y(Y.PICK_OVER),this._mouseMove=new Y(Y.PICK_MOVE),this._upEvent=new Y(Y.PICK_UP),this._downEvent=new Y(Y.PICK_DOWN)}start(){B.setting.pick.enable&&(B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onTouchStart,this),B.inputSystem.addEventListener(Y.POINTER_UP,this.onTouchEnd,this),B.inputSystem.addEventListener(Y.POINTER_CLICK,this.onTouchOnce,this),B.inputSystem.addEventListener(Y.POINTER_RIGHT_CLICK,this.onTouchOnce,this),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onTouchMove,this)),B.setting.pick.mode=="pixel"&&(this._pickCompute=new ah,this._pickCompute.init())}stop(){B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onTouchStart,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.onTouchEnd,this),B.inputSystem.removeEventListener(Y.POINTER_CLICK,this.onTouchOnce,this),B.inputSystem.removeEventListener(Y.POINTER_RIGHT_CLICK,this.onTouchOnce,this),B.inputSystem.removeEventListener(Y.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=Y.PICK_DOWN,this._downEvent.target=t.object3D,this._downEvent.data=this.getPickInfo(),this.dispatchEvent(this._downEvent),t.object3D.containEventListener(Y.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=Y.PICK_UP,this._upEvent.target=t.object3D,this._upEvent.data=this.getPickInfo(),this.dispatchEvent(this._upEvent),t.object3D.containEventListener(Y.PICK_UP)&&t.object3D.dispatchEvent(this._upEvent))}_lastFocus;getPickInfo(){if(B.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=Y.PICK_MOVE,this._mouseMove.target=t.object3D,this._mouseMove.data=this.getPickInfo(),this.dispatchEvent(this._mouseMove),t.object3D.containEventListener(Y.PICK_MOVE)&&t.object3D.dispatchEvent(this._mouseMove)),t!=this._lastFocus&&(this._lastFocus&&this._lastFocus.object3D&&(Object.assign(this._outEvent,e),this._outEvent.type=Y.PICK_OUT,this._outEvent.target=this._lastFocus.object3D,this._outEvent.data=this.getPickInfo(),this.dispatchEvent(this._outEvent),this._lastFocus.object3D.containEventListener(Y.PICK_OUT)&&this._lastFocus.object3D.dispatchEvent(this._outEvent)),t&&(Object.assign(this._overEvent,e),this._overEvent.type=Y.PICK_OVER,this._overEvent.target=t.object3D,this._overEvent.data=this.getPickInfo(),this.dispatchEvent(this._overEvent),t.object3D.containEventListener(Y.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=Y.PICK_CLICK,this._pickEvent.target=t.object3D,this._pickEvent.data=a,this.dispatchEvent(this._pickEvent),t===this._lastDownTarget&&t.object3D.containEventListener(Y.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,B.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=g.distance(r,this.ray.origin);this._interestList.push({distance:i,collider:a,intersectPoint:r})}}else if(B.setting.pick.mode=="bound"){this.ray=e.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY);let t,a=Ne.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 Cg extends ns{_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 ue(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 rh(this),this.pickFire.start()),this._enablePick=e}get scene(){return this._scene}set scene(e){this._scene=e,e.view=this,Wt.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 d.Object3D;a.name="Canvas "+e,t=a.addComponent(zi),t.index=e,this.canvasList[e]=t}return this.scene.addChild(t.object3D),this.guiPick||(this.guiPick=new Wd,this.guiPick.init(this)),t}disableUICanvas(e=0){let t=this.canvasList[e];t&&t.object3D&&t.object3D.removeFromParent()}}class Sg{normal;fixNormal;center;rotateShape;distance=0;index;constructor(e){this.index=e,this.rotateShape=[]}}class xg extends Ve{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(g.ZERO.clone(),new g(100,100,100)),this}buildSections(e,t){let a,r,i,s=[],o=t.length;for(let c=0;c<o;c++){let f=new Sg(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()),s.push(f)}s[0].fixNormal=s[0].normal.clone();for(let c=1;c<o;c++){let f=s[c-1],h=s[c];h.fixNormal=h.normal.add(f.normal).normalize()}let l=new T().identity();for(let c=0;c<o;c++){let f=s[c],h,u;if(c==0)h=g.UP,u=e;else{let b=s[c-1];h=b.fixNormal,u=b.rotateShape}T.fromToRotation(h,f.fixNormal,l);for(let b=0,A=e.length;b<A;b++){let m=l.multiplyPoint3(u[b]);f.rotateShape.push(m)}}return s}buildGeometry(e,t){let a=t.length,r=e.length,i=a*r,s=a-1,o=new Float32Array(i*3),l=new Float32Array(i*3),c=new Float32Array(i*2),f=new Uint32Array(s*(r-1)*6),h=r-1,u=0,b=0,A=[0];for(let p=1;p<r;p++)b+=e[p-1].subtract(e[p]).length,A.push(b);for(let p=0;p<a;p++){let D=t[p];for(let _=0;_<r;_++){let v=(p*r+_)*3,U=D.rotateShape[_].add(D.center);o[v]=U.x,o[v+1]=U.y,o[v+2]=U.z,l[v+1]=1;let y=(p*r+_)*2,S=A[_]/b;c[y]=this.uNegate?1-S:S,c[y+1]=u*this.vScale}u+=D.distance}let m=0;for(let p=0;p<s;p++){let D=p*r;for(let _=0;_<h;_++){let v=_,U=_+1,y=v+r,S=U+r;f[m++]=v+D,f[m++]=U+D,f[m++]=y+D,f[m++]=U+D,f[m++]=S+D,f[m++]=y+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 ih extends Ve{_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 s=0;s<r;s++){const o=s*3,l=(s+1)*3;i[s*16+0]=t[o+0],i[s*16+1]=t[o+1],i[s*16+2]=t[o+2],i[s*16+3]=0,i[s*16+4]=t[l+0],i[s*16+5]=t[l+1],i[s*16+6]=t[l+2],i[s*16+7]=0,i[s*16+8]=1,i[s*16+9]=1,i[s*16+10]=1,i[s*16+11]=0,i[s*16+12]=1,i[s*16+13]=1,i[s*16+14]=1,i[s*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 s=i*3,o=(i+1)*3;this._instanceData[i*16+8]=t[s+0],this._instanceData[i*16+9]=t[s+1],this._instanceData[i*16+10]=t[s+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 g(1/0,1/0,1/0),a=new g(-1/0,-1/0,-1/0);for(let i=0;i<e.length;i+=3){const s=e[i],o=e[i+1],l=e[i+2];t.x=Math.min(t.x,s),t.y=Math.min(t.y,o),t.z=Math.min(t.z,l),a.x=Math.max(a.x,s),a.y=Math.max(a.y,o),a.z=Math.max(a.z,l)}const r=g.sub(a,t);this.bounds=new Ce(g.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 Fg{name;offset;size;arrayStride;stepMode;attributes}class kg{name;format;offset;shaderLocation;stride}var sh=(n=>(n[n.position=3]="position",n[n.normal=3]="normal",n[n.TANGENT=4]="TANGENT",n[n.uv=2]="uv",n[n.TEXCOORD_1=2]="TEXCOORD_1",n[n.color=4]="color",n[n.joints0=4]="joints0",n[n.weights0=4]="weights0",n[n.joints1=4]="joints1",n[n.weights1=4]="weights1",n[n.vIndex=1]="vIndex",n[n.weight=1]="weight",n[n.a_morphPositions_0=3]="a_morphPositions_0",n))(sh||{});class Eg{get data(){return null}entity}class nh{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 oh{_spaceDesc;getRange(e){return this._spaceDesc[e]}initSpace(e){this._spaceDesc={};for(let t of e)(this._spaceDesc[t]=new nh).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 Yi{static MaxEntityCountInLeaf=4;static MaxLayer=10;static ClearLeafLayer=Yi.MaxLayer-4}class Xi{static UUID=0;uuid="0";constructor(){this.uuid=(Xi.UUID++).toString()}}class wg{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 _r extends Xi{_dimensionIndex=0;_dimensions;_dimension;_left;_right;_space;_parent;_entities;layer;get dimension(){return this._dimension}constructor(e=0){super(),this.layer=e,_r.nodeCount++}initNode(e,t,a){return this._dimensions=t,this._dimensionIndex=a,this._dimension=t[a],this._space=new oh().initSpace(t),e&&this._space.copySpace(e._space),this._parent=e,this._entities=new wg,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>Yi.MaxEntityCountInLeaf&&!this._right&&!this._left&&this.layer<Yi.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 s=this._entities.map[i];r+=s.centerValue(a),e.push(s)}r/=this._entities.count,this._left=new _r(this.layer+1),this._right=new _r(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>Yi.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,_r.nodeCount-=2),e||t}isContain(e){return this._space.isContain(this._dimension,e)}static rangeBox=new Ce(new g(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),new g(-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=_r.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=_r.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 s=r[i],o=s.entityContainPoint(e);!o&&t>0&&(o=s.squareDistanceTo(e,this._dimensions)<=t),o&&a.push(s)}}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 g;rayCast(e,t,a){t=t||[],a=a||[];let r=this.pointIntersect;if(this._entities.count>0){let i=this._entities.map;for(let s in i){let o=i[s];o.entityIntersectsRay(e,r)&&(a.push(new g().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 Rg extends Xi{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 Qt{minPosX=0;minPosY=0;maxPosX=0;maxPosY=0;testID=0;points;offsetPosition;static TINY=1e-6;constructor(){this.points=new Array,this.offsetPosition=new g(0,0,0,0),this.clear()}setAABox(e,t,a,r){this.minPosX=e-a/2-Qt.TINY,this.maxPosX=e+a/2+Qt.TINY,this.minPosY=t-r/2-Qt.TINY,this.maxPosY=t+r/2+Qt.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-Qt.TINY),e.x>this.maxPosX&&(this.maxPosX=e.x+Qt.TINY),e.z<this.minPosY&&(this.minPosY=e.z-Qt.TINY),e.z>this.maxPosY&&(this.maxPosY=e.z+Qt.TINY),this.points.push(e))}clone(){var e=new Qt;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,s=t-r,o=a-e,l=e*r-a*t,c=(-l-s*this.minPosX)/o;c<=this.maxPosY&&c>=this.minPosY&&(i=!0),c=(-l-s*this.maxPosX)/o,c<=this.maxPosY&&c>=this.minPosY&&(i=!0);var f=(-l-o*this.minPosY)/s;return f<=this.maxPosX&&f>=this.minPosX&&(i=!0),f=(-l-o*this.maxPosY)/s,f<=this.maxPosX&&f>=this.minPosX&&(i=!0),i}}class Br{static NUM_CHILDREN=4;childCellIndices;nodeIndices;aabb;points;constructor(e){this.childCellIndices=new Array,this.childCellIndices.length=Br.NUM_CHILDREN,this.nodeIndices=new Array,this.clear(),e?this.aabb=e.clone():this.aabb=new Qt}isLeaf(){return this.childCellIndices[0]==-1}clear(){for(var e=0;e<Br.NUM_CHILDREN;e++)this.childCellIndices[e]=-1;this.nodeIndices.splice(0,this.nodeIndices.length)}}class lh{_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 Qt}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 Br(this._aabb),this._cells.push(this._rootCell);for(var i=this._quadNodes.length,s=0;s<i;s++)this._cells[0].nodeIndices[s]=s;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(s=0;s<Br.NUM_CHILDREN;s++){this._cells[c].childCellIndices[s]=this._cells.length,o.push(this._cells.length),this._cells.push(new Br(this.createAABox(this._cells[c].aabb,s))),f=this._cells[this._cells.length-1],i=this._cells[c].nodeIndices.length;for(var h=0;h<i;h++)l=this._cells[c].nodeIndices[h],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,s=e.sideY,o=new Qt;switch(t){case 0:o.setAABox(a+i/4,r+s/4,i/2,s/2);break;case 1:o.setAABox(a-i/4,r+s/4,i/2,s/2);break;case 2:o.setAABox(a-i/4,r-s/4,i/2,s/2);break;case 3:o.setAABox(a+i/4,r-s/4,i/2,s/2);break;default:o.setAABox(a+i/4,r-s/4,i/2,s/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],s=r[1],o=r[2];if(t.aabb.isPointInside(i)||t.aabb.isPointInside(s)||t.aabb.isPointInside(o))return!0;var l=this.pointInTriangle(t.aabb.minPosX,t.aabb.minPosY,i,s,o)||this.pointInTriangle(t.aabb.minPosX,t.aabb.maxPosY,i,s,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.maxPosY,i,s,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.minPosY,i,s,o);return l?!0:(l=t.aabb.isIntersectLineSegment(i.x,i.z,s.x,s.z)||t.aabb.isIntersectLineSegment(i.x,i.z,o.x,o.z)||t.aabb.isIntersectLineSegment(s.x,s.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,s,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++)s=this.getQuadNode(i.nodeIndices[o]).aabb,s.testID!=this._testID&&(s.testID=this._testID,t.overlapTest(s)&&e.push(i.nodeIndices[o]));else for(o=0;o<Br.NUM_CHILDREN;o++)this._cellsToTest.push(i.childCellIndices[o]);return e.length}pointInTriangle(e,t,a,r,i){var s=a,o=r,l=i,c=s.z-o.z,f=o.x-s.x,h=s.x*o.z-o.x*s.z,u=o.z-l.z,b=l.x-o.x,A=o.x*l.z-l.x*o.z,m=l.z-s.z,p=s.x-l.x,D=l.x*s.z-s.x*l.z,_=!1,v=c*e+f*t+h,U=u*e+b*t+A,y=m*e+p*t+D;const S=.01;return(v>=-S&&U>=-S&&y>=-S||v<=S&&U<=S&&y<=S)&&(_=!0),_}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 s=this._quadNodes[t.nodeIndices[i]];console.log(a+" t="+t.nodeIndices[i]+" "+s.aabb.minPosX.toFixed(2)+" "+s.aabb.maxPosX.toFixed(2)+" "+s.aabb.minPosY.toFixed(2)+" "+s.aabb.maxPosY.toFixed(2))}for(i=0;i<t.childCellIndices.length;i++)t.childCellIndices[i]>=0&&this.logTree(t.childCellIndices[i]);this.logDeep--}}}class ch{_maxNodesPerCell;_minCellSize;_quadTree;_collisionNodesIdx;_segBox;_collisionNodes;constructor(e=10,t=500){this._maxNodesPerCell=e,this._minCellSize=t,this._segBox=new Qt,this._collisionNodesIdx=new Array,this._collisionNodes=new Array}createQuadTree(e){this._quadTree=new lh,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,s=0;s<this._collisionNodesIdx.length;s++)i=this._quadTree.getQuadNode(this._collisionNodesIdx[s]),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,s,o,l,c=0;c<this._collisionNodesIdx.length;c++)s=this._quadTree.getQuadNode(this._collisionNodesIdx[c]),l=s.aabb,g.pointInsideTriangle(e,l.points[0],l.points[1],l.points[2])&&(o=s,r=Math.abs(o.plane.distance(e)),!(r>t)&&(s==null||r<=a)&&(i=o,a=r));return i}}var Ps=(n=>(n[n.MOUSE_LEFT=0]="MOUSE_LEFT",n[n.MOUSE_MID=1]="MOUSE_MID",n[n.MOUSE_RIGHT=2]="MOUSE_RIGHT",n))(Ps||{});class Ig extends bt{static LOADER_PROGRESS="loaderProgress";static LOADER_COMPLETE="loaderComplete"}class Tg extends bt{static ADDED="added";static REMOVED="removed";static CHILD_ADD_EVENT="childAddEvent";static CHILD_REMOVED="childRemoved"}class Qg extends bt{static SHOW="show";static HIDE="hide";static UPDATE="update"}class Mg{static merge(e,t,a,r){let i=0,s=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),s=Math.max(e.height,s),s=Math.max(t.height,s),s=Math.max(a.height,s),s=Math.max(r.height,s);let o=new Ie(i,s,le.rgba8unorm),l=new Se(qf);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(s/8);let c=E.beginCommandEncoder();return E.computeCommand(c,[l]),E.endCommandEncoder(c),o}}class fh{computeShader;setInputes(e,t,a){this.computeShader=new Se(bd(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 dh{sourceShader;compute;needUpdate=!0;constructor(e,t){this.sourceShader=t,this.compute=new Se(e),this.init()}init(){}onUpdate(){this.onFrame&&this.onFrame(),this.onOnce&&this.needUpdate&&(this.needUpdate=!1,this.onFrame())}}class hh extends dh{constructor(e){super(rd,e)}init(){let e=new Ie(256,256,le.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=E.beginCommandEncoder();E.computeCommand(e,[this.compute]),E.endCommandEncoder(e)}}class Pg{gpuBuffer;probes;memoryDo;_probeInfoList;initDataUniform(e){this.memoryDo=new or,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 Ng extends Za{constructor(e,t,a=0){super(),this.bufferType=ga.StructStorageGPUBuffer,this.createBufferByStruct(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|a,e,t)}}class Vg{static codeMax=`
11790
11818
  @group(0) @binding(0) var inputTexture : texture_2d<f32>;
@@ -11812,7 +11840,7 @@ 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),s={mipmapCount:t,texture:e,srcView:null,mipLevel:1,dstHeight:i,dstWidth:r};s.srcView=e.getGPUTexture().createView({format:e.format,dimension:"2d",baseMipLevel:0,mipLevelCount:1}),e.width>1024&&e.height>1024?this.mipmap(this._pipelineMax,s):this.mipmap(this._pipelineMin,s)}static mipmap(e,t){const a=I.device,r=E.beginCommandEncoder();let i=e==this._pipelineMax,s,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}),s=t.texture.getGPUTexture().createView({format:t.texture.format,dimension:"2d",baseMipLevel:l,mipLevelCount:1}),c.push({binding:f++,resource:s});const h=a.createBindGroup({layout:e.getBindGroupLayout(0),entries:c}),u=r.beginComputePass();u.setPipeline(e),u.setBindGroup(0,h);let b=t.dstWidth,A=t.dstHeight;if(i&&(b=Math.max(1,Math.floor(t.dstWidth/8)),A=Math.max(1,Math.floor(t.dstHeight/8))),u.dispatchWorkgroups(b,A),t.dstHeight*=.5,t.dstWidth*=.5,t.srcView=s,t.mipLevel=l+1,o=i&&(t.dstWidth<8||t.dstHeight<8),u.end(),o)break}E.endCommandEncoder(r),o&&this.mipmap(this._pipelineMin,t)}}class uh{name="";passMap=new Map}class bh{passType="";shaderState=new Map;vertexShader="";fragmentShader=""}class Og{static passKeyword="pass";static shaderKeyword="Shader";static vertexKeyword="vertex";static fragmentKeyword="fragment";static passTypeKeyword="PassType";static parser(e,t){e=ma.filterComment(e);let a=new uh,r=e.indexOf(this.shaderKeyword),i=e.indexOf("{",r),s=e.substring(r+this.shaderKeyword.length,i).trim();a.name=s.substring(1,s.length-1),s=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));let o=this.splitPassBlock(s);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=ma.parse(c.vertexShader,t)),c.fragmentShader.length>0&&(c.fragmentShader=ma.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 bh,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),s=t.substring(a+1,r).split(",");for(let o of s){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,s=0;e=e.substring(r);for(let l of e){if(l==t?i++:l==a&&i--,i<=0)break;s++}return e.substring(1,s).trim()}}let gh=new bt("IrradianceDataReaderCompleteEvent");class Hi extends ja{readFlag=!1;probeRenderer;opColorBuffer;opDepthBuffer;srcColorMap;srcDepthMap;opDepthArray;opColorArray;initReader(e,t,a){this.probeRenderer=e,this.srcColorMap=t,this.srcDepthMap=a;let r=B.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(Pn.type,()=>{this.onProbeRenderComplete()},this),this.probeRenderer.addEventListener(Bs.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 Hi.read(this.srcColorMap.getGPUTexture(),this.opColorBuffer,this.opColorArray),await Hi.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=E.beginCommandEncoder();r.copyTextureToBuffer({texture:e},{buffer:t,bytesPerRow:e.width*16},[e.width,e.height]),E.endCommandEncoder(r),await t.mapAsync(GPUMapMode.READ);const i=t.getMappedRange();a.set(new Float32Array(i),0),t.unmap()}}let Lg=new Hi;class Gg{computeShader;visibleBuffer;texture;constructor(){this.computeShader=new Se(md),this.visibleBuffer=new ei(8192*2),this.computeShader.setStorageBuffer("visibleBuffer",this.visibleBuffer),this.texture=wt.getTexture(Qa.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=E.beginCommandEncoder();E.computeCommand(a,[this.computeShader]),this.visibleBuffer.readBuffer(),t.zVisibleList=this.visibleBuffer.outFloat32Array}}class zg extends Jt{RT_BloomUp;RT_BloomDown;RT_threshold;rendererPassState;thresholdCompute;downSampleComputes;upSampleComputes;postCompute;bloomSetting;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.bloom.enable=!0,this.createGUI()}onDetach(e){B.setting.render.postProcessing.bloom.enable=!1,this.removeGUI()}createGUI(){}removeGUI(){}get downSampleBlurSize(){return B.setting.render.postProcessing.bloom.downSampleBlurSize}set downSampleBlurSize(e){B.setting.render.postProcessing.bloom.downSampleBlurSize=e}get downSampleBlurSigma(){return B.setting.render.postProcessing.bloom.downSampleBlurSigma}set downSampleBlurSigma(e){B.setting.render.postProcessing.bloom.downSampleBlurSigma=e}get upSampleBlurSize(){return B.setting.render.postProcessing.bloom.upSampleBlurSize}set upSampleBlurSize(e){B.setting.render.postProcessing.bloom.upSampleBlurSize=e}get upSampleBlurSigma(){return B.setting.render.postProcessing.bloom.upSampleBlurSigma}set upSampleBlurSigma(e){B.setting.render.postProcessing.bloom.upSampleBlurSigma=e}get luminanceThreshole(){return B.setting.render.postProcessing.bloom.luminanceThreshole}set luminanceThreshole(e){B.setting.render.postProcessing.bloom.luminanceThreshole=e}get bloomIntensity(){return B.setting.render.postProcessing.bloom.bloomIntensity}set bloomIntensity(e){B.setting.render.postProcessing.bloom.bloomIntensity=e}get hdr(){return B.setting.render.postProcessing.bloom.hdr}set hdr(e){B.setting.render.postProcessing.bloom.hdr=e}createThreshouldCompute(){this.thresholdCompute=new Se(jf),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=B.setting.render.postProcessing.bloom.downSampleStep;this.downSampleComputes=[];for(let a=0;a<t;a++){let r=new Se(Zf),i=this.RT_BloomDown[a],s=a==0?this.RT_threshold:this.RT_BloomDown[a-1];r.setSamplerTexture("inTex",s),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=B.setting.render.postProcessing.bloom.downSampleStep;this.upSampleComputes=[];{let a=new Se(mo),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 Se(mo),i=this.RT_BloomUp[a],s=this.RT_BloomDown[t-2-a];r.setSamplerTexture("_MainTex",s),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=B.setting.render.postProcessing.bloom.downSampleStep;this.postCompute=new Se(Yf),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=B.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 Ie(t,a,le.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 Ie(o,l,le.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 Ie(l,c,le.rgba16float,!1,r)}}let s=new We;s.loadOp="load",this.rtFrame=new st([this.RT_threshold],[s])}render(e,t){this.thresholdCompute||(this.createResource(),this.createThreshouldCompute(),this.createDownSampleComputes(),this.createUpSampleComputes(),this.createPostCompute(),this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="Bloom");let a=B.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(),E.computeCommand(t,[this.thresholdCompute,...this.downSampleComputes,...this.upSampleComputes,this.postCompute]),E.lastRenderPassState=this.rendererPassState}onResize(){let e=B.setting.render.postProcessing.bloom,[t,a]=I.presentationSize;this.RT_threshold.resize(t,a);const r=e.downSampleStep;let i=Math.ceil(t/4),s=Math.ceil(a/4);for(let o=0;o<r;o++)this.RT_BloomDown[o].resize(i,s),i=Math.ceil(i/2),s=Math.ceil(s/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 Wg extends Jt{blurTexture1;blurTexture2;rendererPassState;blurComputes;blurSettings;outTexture;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.depthOfView.enable=!0}onDetach(e){B.setting.render.postProcessing.depthOfView.enable=!1}get pixelOffset(){return B.setting.render.postProcessing.depthOfView.pixelOffset}set pixelOffset(e){e=Math.max(0,e);let t=B.setting.render.postProcessing.depthOfView;t.pixelOffset=e}get near(){return B.setting.render.postProcessing.depthOfView.near}set near(e){e=Math.max(0,e);let t=B.setting.render.postProcessing.depthOfView;t.near=e}get far(){return B.setting.render.postProcessing.depthOfView.far}set far(e){e=Math.max(0,e);let t=B.setting.render.postProcessing.depthOfView;t.far=e}createBlurCompute(){this.blurSettings=[],this.blurComputes=[];let e=B.setting.render.postProcessing.depthOfView;for(let t=0;t<e.iterationCount;t++){let a=new Ct(4),r=new Se(Xf);this.blurComputes.push(r),this.blurSettings.push(a),r.setUniformBuffer("blurSetting",a);let i=Be.getGBufferFrame(Be.colorPass_GBuffer);r.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture());let s=t%2==0?this.blurTexture1:this.blurTexture2,o=t%2==1?this.blurTexture1:this.blurTexture2;r.setSamplerTexture("inTex",s),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 Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture1.name="dof1";let r=new We;r.clearValue=[0,0,0,1],r.loadOp="clear",this.blurTexture2=new Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture2.name="dof2";let i=new We;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new st([this.blurTexture1,this.blurTexture2],[r,i])}render(e,t){if(!this.blurComputes){this.createResource(),this.createBlurCompute();let r=ve.getCameraGroup(e.camera);for(let i=0;i<this.blurComputes.length;i++)this.blurComputes[i].setUniformBuffer("globalUniform",r.uniformGPUBuffer);this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null)}this.autoSetColorTexture("inTex",this.blurComputes[0]);let a=B.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],s=this.blurSettings[r];s.setFloat("near",a.near),s.setFloat("far",a.far),s.setFloat("pixelOffset",(r+1)*a.pixelOffset),s.apply(),i.setStorageBuffer("blurSetting",s)}E.computeCommand(t,this.blurComputes),E.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=B.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 s=this.blurComputes[i];s.workerSizeX=Math.ceil(this.blurTexture1.width/8),s.workerSizeY=Math.ceil(this.blurTexture1.height/8),s.workerSizeZ=1}}}class Jg extends Jt{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=Be.getGBufferFrame("ColorPassGBuffer");this.currentRenderTexture=e.getColorTexture(),this.gBufferTexture=e.getCompressGBufferTexture();let[t,a]=I.presentationSize;this.outTexture=new Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let r=new We;r.loadOp="load",this.rtFrame=new st([this.outTexture],[r])}createCompute(){this.uniformBuffer=new Ct(4),this.uniformBuffer.setInt32("state",this._state);let e=ve.getCameraGroup(this.view.camera),a=Be.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture(),r=B.setting.reflectionSetting,s=Be.getGBufferFrame(Be.reflections_GBuffer,r.width,r.height).getCompressGBufferTexture(),o=B.renderJobs.get(this.view).reflectionRenderer.outTexture;this.testCompute=new Se(ud),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",s),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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="test");let t=E.beginCommandEncoder();E.computeCommand(t,[this.testCompute]),E.endCommandEncoder(t),E.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 jg extends Jt{gtaoTexture;rendererPassState;gtaoCompute;gtaoSetting;aoBuffer;directionsBuffer;directionsArray;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.gtao.enable=!0}Render;onDetach(e){B.setting.render.postProcessing.gtao.enable=!1}get maxDistance(){return B.setting.render.postProcessing.gtao.maxDistance}set maxDistance(e){e=_e(e,.1,50);let t=B.setting.render.postProcessing.gtao;t.maxDistance=e}get maxPixel(){return B.setting.render.postProcessing.gtao.maxPixel}set maxPixel(e){e=_e(e,5,100);let t=B.setting.render.postProcessing.gtao;t.maxPixel=e}get darkFactor(){return B.setting.render.postProcessing.gtao.darkFactor}set darkFactor(e){e=_e(e,.01,1);let t=B.setting.render.postProcessing.gtao;t.darkFactor=e}get rayMarchSegment(){return B.setting.render.postProcessing.gtao.rayMarchSegment}set rayMarchSegment(e){e=_e(e,4,10);let t=B.setting.render.postProcessing.gtao;t.rayMarchSegment=e}get multiBounce(){return B.setting.render.postProcessing.gtao.multiBounce}set multiBounce(e){let t=B.setting.render.postProcessing.gtao;t.multiBounce=e}get blendColor(){return B.setting.render.postProcessing.gtao.blendColor}set blendColor(e){let t=B.setting.render.postProcessing.gtao;t.blendColor=e}get usePosFloat32(){return B.setting.render.postProcessing.gtao.usePosFloat32}set usePosFloat32(e){let t=B.setting.render.postProcessing.gtao;t.usePosFloat32=e}createCompute(){this.gtaoCompute=new Se(Hf);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=Be.getGBufferFrame(Be.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 Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.gtaoTexture.name="gtaoTex";let a=new We;a.loadOp="load",this.rtFrame=new st([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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GTAO";let l=ve.getCameraGroup(e.camera);this.gtaoCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=B.setting.render.postProcessing.gtao;this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply();let r=1-.2*(ze.frame%2),i=a.maxDistance*r,s=a.maxPixel*r;this.gtaoSetting.setFloat("maxDistance",i),this.gtaoSetting.setFloat("maxPixel",s),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(),E.computeCommand(t,[this.gtaoCompute]),E.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 Zg extends Jt{fogSetting;fogOpTexture;fogCompute;fogUniform;rendererPassState;constructor(){super(),this.fogSetting=B.setting.render.postProcessing.globalFog}createCompute(e){X.register("GlobalFog_shader",po),this.fogCompute=new Se(po),this.fogUniform=new Ct(20),this.fogCompute.setUniformBuffer("fogUniform",this.fogUniform);let t=Be.getGBufferFrame(Be.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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="FOG";let a=ve.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 Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.fogOpTexture.name="fogTex";let a=new We;a.loadOp="load",this.rtFrame=new st([this.fogOpTexture],[a])}onAttach(e){B.setting.render.postProcessing.globalFog.enable=!0}onDetach(e){B.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=B.res.defaultSky;return $.instance.sky instanceof ws&&(e=$.instance.sky.map),e}render(e,t){if(!this.fogCompute){this.createResource(),this.createCompute(e),this.onResize();let r=ve.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(),E.computeCommand(t,[this.fogCompute]),E.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 Yg extends Jt{godRayTexture;rendererPassState;godRayCompute;historyGodRayData;godRaySetting;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.godRay.enable=!0,this.createGUI()}Render;onDetach(e){B.setting.render.postProcessing.godRay.enable=!1,this.removeGUI()}get blendColor(){return B.setting.render.postProcessing.godRay.blendColor}set blendColor(e){B.setting.render.postProcessing.godRay.blendColor=e}get rayMarchCount(){return B.setting.render.postProcessing.godRay.rayMarchCount}set rayMarchCount(e){e=_e(e,8,20),B.setting.render.postProcessing.godRay.rayMarchCount=e}get scatteringExponent(){return B.setting.render.postProcessing.godRay.scatteringExponent}set scatteringExponent(e){e=_e(e,1,40),B.setting.render.postProcessing.godRay.scatteringExponent=e}get intensity(){return B.setting.render.postProcessing.godRay.intensity}set intensity(e){e=_e(e,.01,5),B.setting.render.postProcessing.godRay.intensity=e}createGUI(){}removeGUI(){}createCompute(e){this.godRayCompute=new Se(Kf);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=Be.getGBufferFrame(Be.colorPass_GBuffer);this.godRayCompute.setSamplerTexture("gBufferTexture",a.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",this.godRayCompute),this.godRayCompute.setStorageTexture("outTex",this.godRayTexture);let r=B.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 Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.godRayTexture.name="godRayTexture";let r=new We;r.loadOp="load",this.rtFrame=new st([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=ve.getLightEntries(e.scene);this.godRayCompute.setStorageBuffer("lightBuffer",o.storageGPUBuffer),this.godRayCompute.setStorageBuffer("models",ve.modelMatrixBindGroup.matrixBufferDst),this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GodRay";let l=ve.getCameraGroup(e.camera);this.godRayCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=B.setting.render.postProcessing.godRay;this.godRaySetting.setFloat("intensity",a.intensity),this.godRaySetting.setFloat("rayMarchCount",a.rayMarchCount);let r=I.presentationSize,[i,s]=r;this.godRaySetting.setFloat("viewPortWidth",i),this.godRaySetting.setFloat("viewPortHeight",s),this.godRaySetting.setFloat("blendColor",a.blendColor?1:0),this.godRaySetting.setFloat("scatteringExponent",a.scatteringExponent),this.godRaySetting.apply(),E.computeCommand(t,[this.godRayCompute]),E.lastRenderPassState=this.rendererPassState}}class mh{indexList;color;count}class ph{SlotCount=8;MaxEntities=16;defaultColor=new Z(.2,1,1,1);slots=[];dataDirty=!0;constructor(){let e=B.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 mh;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,s=t.length;i<s;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 Ca=new ph;class Xg extends Jt{outlineTex;lowTex;rendererPassState;calcWeightCompute;outlineCompute;blendCompute;outlineSetting;slotsBuffer;slotsArray;entitiesArray;entitiesBuffer;weightBuffer;lowTexSize;oldOutlineColor;rtFrame;view;constructor(){super()}onAttach(e){this.view=e,B.setting.render.postProcessing.outline.enable=!0}onDetach(e){B.setting.render.postProcessing.outline.enable=!1}set outlinePixel(e){e=_e(e,0,8);let t=B.setting.render.postProcessing.outline;t.outlinePixel!=e&&(t.outlinePixel=e)}get outlinePixel(){return B.setting.render.postProcessing.outline.outlinePixel}set fadeOutlinePixel(e){let t=B.setting.render.postProcessing.outline;e=_e(e,0,8),t.fadeOutlinePixel!=e&&(t.fadeOutlinePixel=e)}get fadeOutlinePixel(){return B.setting.render.postProcessing.outline.fadeOutlinePixel}set strength(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.outline;t.strength!=e&&(t.strength=e)}get strength(){return B.setting.render.postProcessing.outline.strength}set useAddMode(e){B.setting.render.postProcessing.outline.useAddMode=e}get useAddMode(){return B.setting.render.postProcessing.outline.useAddMode}createGUI(){}createCompute(){let e=Be.getGBufferFrame(Be.colorPass_GBuffer);this.calcWeightCompute=new Se(ed);let t=ve.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 Se(td),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 Se($f),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=B.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new fe(Math.ceil(t*r),Math.ceil(a*r)),this.lowTex=new Ie(this.lowTexSize.x,this.lowTexSize.y,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lowTex.name="lowTex";let i=new We;i.clearValue=[0,0,0,1],i.loadOp="clear",this.outlineTex=new Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outlineTex.name="outlineTex";let s=new We;s.clearValue=[0,0,0,1],s.loadOp="clear",this.rtFrame=new st([this.outlineTex],[s]),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(Ca.SlotCount*4),this.slotsBuffer=new Pe(this.slotsArray.length),this.slotsBuffer.setFloat32Array("slotsArray",this.slotsArray),this.slotsBuffer.apply(),this.entitiesArray=new Float32Array(Ca.SlotCount*Ca.MaxEntities),this.entitiesBuffer=new Pe(this.entitiesArray.length),this.entitiesBuffer.setFloat32Array("entitiesArray",this.entitiesArray),this.slotsBuffer.apply(),this.fetchData||={}}fetchData;fetchOutlineData(){if(Ca.fetchData(this.fetchData),this.fetchData.dirty){let e=Ca.SlotCount,t=Ca.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=Ye.createRendererPassState(this.rtFrame,null)),this.computeList||=[this.calcWeightCompute,this.outlineCompute,this.blendCompute];let a=B.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(),E.computeCommand(t,this.computeList),E.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=B.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new fe(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 Hg extends Jt{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?os(e.camera.transform.onPositionChange,(t,a)=>this.onCameraChange(t,a)):(t,a)=>this.onCameraChange(t,a)}onCameraChange(e,t){console.log("a");let a=g.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=Be.getGBufferFrame("ColorPassGBuffer");this.gBufferTexture=e.getCompressGBufferTexture();let t=I.presentationSize,a=t[0],r=t[1];this.lastPosTexture=new Ie(a,r,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lastPosTexture.name="lastPosTexture",this.outTexture=new Ie(a,r,le.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),s=Math.floor(r*this.downSampleCofe);this.newTexture=new Ie(i,s,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.newTexture.name="newTexture",this.oldTexture=new Ie(i,s,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.oldTexture.name="oldTexture",this.combineTexture=new Ie(i,s,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.combineTexture.name="combineTexture";let o=new We;o.loadOp="load",this.rtFrame=new st([this.outTexture],[o])}createCompute(){this.ssgiCompute=new Se(id),this.delayCompute=new Se(hd),this.combineCompute=new Se(dd);let e=ve.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 fh,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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="SSGI"),this.frameCount=this.frame,this.frame++;let t=E.beginCommandEncoder();switch(parseInt(this.debugChanal)){case 0:E.copyTexture(t,this.combineTexture,this.oldTexture),E.computeCommand(t,[this.ssgiCompute,this.delayCompute,this.combineCompute]);break;case 1:E.copyTexture(t,this.posTexture,this.lastPosTexture),E.copyTexture(t,this.lastPosTexture,this.outTexture);break;case 2:E.copyTexture(t,this.normalTexture,this.outTexture);break;case 3:E.copyTexture(t,this.posTexture,this.outTexture);break;case 4:E.copyTexture(t,this.colorTexture,this.outTexture);break;case 5:E.copyTexture(t,this.gBufferTexture,this.outTexture);break}E.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 Kg extends Jt{SSR_RayTraceCompute;SSR_IS_Compute;SSR_Blend_Compute;isRetTexture;finalTexture;rendererPassState;ssrUniformBuffer;rayTraceData;ssrColorData;rtFrame;historyPosition;view;onAttach(e){this.view=e,B.setting.render.postProcessing.ssr.enable=!0}onDetach(e){B.setting.render.postProcessing.ssr.enable=!1}reflectionRatio=.5;get fadeEdgeRatio(){return B.setting.render.postProcessing.ssr.fadeEdgeRatio}set fadeEdgeRatio(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.fadeEdgeRatio=e}get rayMarchRatio(){return B.setting.render.postProcessing.ssr.rayMarchRatio}set rayMarchRatio(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.rayMarchRatio=e}get roughnessThreshold(){return B.setting.render.postProcessing.ssr.roughnessThreshold}set roughnessThreshold(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.roughnessThreshold=e}get fadeDistanceMin(){return B.setting.render.postProcessing.ssr.fadeDistanceMin}set fadeDistanceMin(e){e=_e(e,0,1e4);let t=B.setting.render.postProcessing.ssr;t.fadeDistanceMin=e}get fadeDistanceMax(){return B.setting.render.postProcessing.ssr.fadeDistanceMax}set fadeDistanceMax(e){e=_e(e,0,1e4);let t=B.setting.render.postProcessing.ssr;t.fadeDistanceMax=e}get powDotRN(){return B.setting.render.postProcessing.ssr.powDotRN}set powDotRN(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.powDotRN=e}createRayTraceShader(){let e=ve.getCameraGroup(this.view.camera);this.SSR_RayTraceCompute=new Se(od),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=Be.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture();this.SSR_RayTraceCompute.setSamplerTexture("gBufferTexture",a),$.instance.sky instanceof ws&&this.SSR_RayTraceCompute.setSamplerTexture("prefilterMap",$.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 Se(nd),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=ve.getCameraGroup(this.view.camera);this.SSR_Blend_Compute=new Se(sd),this.SSR_Blend_Compute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_Blend_Compute.setUniformBuffer("globalUniform",t.uniformGPUBuffer);let r=Be.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 Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.finalTexture.name="ssrOutTex";let a=new We;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=Math.ceil(e*B.setting.render.postProcessing.ssr.pixelRatio),i=Math.ceil(t*B.setting.render.postProcessing.ssr.pixelRatio);this.isRetTexture=new Ie(r,i,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.isRetTexture.name="ssrTextureIn";let s=new We;s.clearValue=[0,0,0,0],s.loadOp="clear",this.rtFrame=new st([this.finalTexture,this.isRetTexture],[a,s]),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=Ye.createRendererPassState(this.rtFrame,null);let i=ve.getCameraGroup(e.camera);this.SSR_RayTraceCompute.setUniformBuffer("standUniform",i.uniformGPUBuffer)}let a=B.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];E.computeCommand(t,r),E.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize,a=Math.ceil(e*B.setting.render.postProcessing.ssr.pixelRatio),r=Math.ceil(t*B.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 qg{static createSeeds(){let e=20,t=32,a=[new g(0,0,e)],r=0,i=.02;for(let s=1;s<t;s++){let o=new g;a.push(o),r+=1-(1-.618)*s/t,i+=s*.01,o.x=Math.sin(r)*i,o.y=Math.cos(r)*i,o.z=1-s/t,o.multiplyScalar(e)}return a}}class $g extends Jt{taaTexture;outTexture;rendererPassState;taaCompute;copyTexCompute;sharpCompute;taaSetting;preColorBuffer;preColorTex;preProjMatrix;preViewMatrix;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.taa.enable=!0,e.camera.enableJitterProjection(!0),this.createGUI()}onDetach(e){B.setting.render.postProcessing.taa.enable=!1,e.camera.enableJitterProjection(!1)}get jitterSeedCount(){return B.setting.render.postProcessing.taa.jitterSeedCount}set jitterSeedCount(e){e=_e(e,2,32),e=Math.round(e);let t=B.setting.render.postProcessing.taa;t.jitterSeedCount=e}get blendFactor(){return B.setting.render.postProcessing.taa.blendFactor}set blendFactor(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.taa;t.blendFactor=e}get sharpFactor(){return B.setting.render.postProcessing.taa.sharpFactor}set sharpFactor(e){e=_e(e,.1,.99);let t=B.setting.render.postProcessing.taa;t.sharpFactor=e}get sharpPreBlurFactor(){return B.setting.render.postProcessing.taa.sharpPreBlurFactor}set sharpPreBlurFactor(e){e=_e(e,.1,.99);let t=B.setting.render.postProcessing.taa;t.sharpPreBlurFactor=e}get temporalJitterScale(){return B.setting.render.postProcessing.taa.temporalJitterScale}set temporalJitterScale(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.taa;t.temporalJitterScale=e}createGUI(){}createCompute(e){let t=new Se(fd),a=new Ct(44),r=ve.getCameraGroup(e.camera);t.setUniformBuffer("globalUniform",r.uniformGPUBuffer),t.setUniformBuffer("taaData",a),t.setStorageBuffer("preColorBuffer",this.preColorBuffer);let i=Be.getGBufferFrame(Be.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 Se(ld),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 Se(cd),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 T().identity(),this.preViewMatrix=new T().identity();let[e,t]=I.presentationSize;this.preColorBuffer=new Pe(e*t*4,GPUBufferUsage.COPY_SRC),this.preColorTex=new Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.preColorTex.name="taaTex";let a=new We;a.clearValue=[0,0,0,1],a.loadOp="clear",this.taaTexture=new Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.taaTexture.name="taaTex";let r=new We;r.clearValue=[0,0,0,1],r.loadOp="clear",this.outTexture=new Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="sharpTaaTex";let i=new We;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new st([this.preColorTex,this.taaTexture,this.outTexture],[a,r,i])}render(e,t){this.taaCompute||(this.createResource(),this.createCompute(e),this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null));let a=B.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(),E.computeCommand(t,[this.copyTexCompute,this.taaCompute,this.sharpCompute]),E.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 Ah{_tempIndexArray=[];setOutline(e,t){this.setOutlineList([e],t?[t]:null)}setOutlineList(e,t){e||=[];let a=Ca.defaultColor,r=Ca.SlotCount;for(let i=0;i<r;i++){this._tempIndexArray.length=0;let s=e[i],o=(t?t[i]:null)||a;if(s)for(const l of s)this.getEntityIdList(l,this._tempIndexArray);Ca.fillDataAt(i,this._tempIndexArray,o)}}clearOutline(){return Ca.clear(),this}_rendererList=[];getEntityIdList(e,t){this._rendererList.length=0;let a=e.getComponents(d.MeshRenderer,this._rendererList);for(const r of a)t.push(r.object3D.transform._worldMatrix.index)}}let em=new Ah;class Dh{localPosition=new g;worldPosition=new g;uv=new fe;faceIndex;isIn=!1;t=0;u=0;v=0;triangle;v0;v1;v2;pickList;color}class fi{static EPS=1e-4;static FLT_MAX=3402823466e29;static distPtTri(e,t,a,r){let i=new g,s=new g,o=new g;r.subtract(t,i),a.subtract(t,s),e.subtract(t,o);let l=Ft(i,i),c=Ft(i,s),f=Ft(i,o),h=Ft(s,s),u=Ft(s,o),b=1/(l*h-c*c),A=(h*f-c*u)*b,m=(l*u-c*f)*b;if(A>=-fi.EPS&&m>=-fi.EPS&&A+m<=1+fi.EPS){let p=t[1]+i[1]*A+s[1]*m;return Math.abs(p-e[1])}return fi.FLT_MAX}static _info=new Dh;static IntersectTriangle(e,t,a){let r=t.v1,i=t.v2,s=t.v3,o=i.subtract(r,g.HELP_3),l=s.subtract(r,g.HELP_4),c=e.direction.crossProduct(l,g.HELP_5),f=Ft(o,c),h;if(f>0){if(a)return null;h=e.origin.subtract(r,g.HELP_2)}else h=r.subtract(e.origin,g.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 u=Ft(h,c);if(u<0||u>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let b=h.crossProduct(o,g.HELP_1),A=Ft(e.direction,b);if(A<0||u+A>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let m=Ft(l,b),p=1/f;m*=p,u*=p,A*=p,this._info.isIn=!0,this._info.t=m,this._info.u=u,this._info.v=A;let D=1-u-A;return this._u0.copyFrom(t.u1),this._u0.scale(D),this._u1.copyFrom(t.u2),this._u1.scale(u),this._u2.copyFrom(t.u3),this._u2.scale(A),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(m),this._info.localPosition.add(e.origin,this._info.localPosition),this._info}static _u0=new fe;static _u1=new fe;static _u2=new fe}class Ns extends ja{static _instance;_maxRetry=3;loadAll(e,t){return new Promise((a,r)=>{let i=e.length,s=[];e.forEach((o,l)=>{let c=new t;this.load(o,t).then(f=>{c.parse(f),s.push(c),i--,i===0&&a(s)})})})}constructor(){if(super(),Ns._instance)throw new Error("LoadManager is singleton class...")}static getInstance(){return this._instance||(this._instance=new Ns)}loadUrls(e,t){return new Promise((a,r)=>{let i=e.length,s=[];e.forEach((o,l)=>{this.load(o,t).then(c=>{s.push(c),i--,i===0&&a(s),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 tm extends gr{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,s)=>{let o=!1,l=null,c=null;const f=()=>{o=!0,l&&(l.cancel().catch(()=>{}),l.releaseLock()),c&&c.abort(),h&&typeof h.cancel=="function"&&h.cancel()};let h=null;try{this.baseUrl=e.substring(0,e.lastIndexOf("/")+1),this.initUrl=e,c=new AbortController;const u=await fetch(e,{headers:a?.headers,signal:c.signal});if(!u.ok)throw new Error(`Request rejected with status ${u.status}`);l=u.body.getReader();const b=+u.headers.get("Content-Length")||0;if(h=new t,h.userData=r,h.baseUrl=this.baseUrl,h.initUrl=e,h.loaderFunctions=a,typeof h.initStream!="function")throw new Error(`Parser ${t.name} does not support streaming. Implement initStream() method.`);let A=!1;await h.initStream(b,()=>{!A&&!o&&h&&h.verification()&&(A=!0,i({parser:h,cancel:f}))});let m=0;for(;!o;){const{done:p,value:D}=await l.read();if(p||o){if(!o&&(typeof h.finalizeStream=="function"&&await h.finalizeStream(),!A&&h))if(h.verification())A=!0,i({parser:h,cancel:f});else throw new Error("Parser verification failed");break}if(o)break;m+=D.length,b>0&&a?.onProgress&&!o&&a.onProgress.call(this,m,b,e,h),!o&&typeof h.processChunk=="function"&&await h.processChunk(D,m,b),!A&&!o&&h&&h.verification()&&(A=!0,i({parser:h,cancel:f}))}!o&&a?.onComplete&&a.onComplete.call(this,e)}catch(u){if(o)return;a?.onError&&a.onError(u),s(u)}finally{if(l&&!o)try{l.releaseLock()}catch{}}})}}function ko(n){const e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let a=0;a<n.length;a+=3){const r=n[a+0],i=n[a+1],s=n[a+2];r<e[0]&&(e[0]=r),i<e[1]&&(e[1]=i),s<e[2]&&(e[2]=s),r>t[0]&&(t[0]=r),i>t[1]&&(t[1]=i),s>t[2]&&(t[2]=s)}return{min:e,max:t}}var di=(n=>(n.PLY="ply",n.SPLAT="splat",n.KSPLAT="ksplat",n.UNKNOWN="unknown",n))(di||{});function _h(n){if(n.byteLength<16)return"unknown";const e=new Uint8Array(n,0,Math.min(512,n.byteLength));return new TextDecoder("utf-8").decode(e).startsWith("ply")?"ply":"unknown"}var Sa=(n=>(n[n.Splat=0]="Splat",n[n.PointCloud=1]="PointCloud",n[n.Mesh=2]="Mesh",n))(Sa||{});const Ki=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],Eo=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"];function ea(n){switch(n){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 be(n,e,t){switch(t){case"char":case"int8":return n.getInt8(e);case"uchar":case"uint8":return n.getUint8(e);case"short":case"int16":return n.getInt16(e,!0);case"ushort":case"uint16":return n.getUint16(e,!0);case"int":case"int32":return n.getInt32(e,!0);case"uint":case"uint32":return n.getUint32(e,!0);case"double":case"float64":return n.getFloat64(e,!0);case"float":case"float32":default:return n.getFloat32(e,!0)}}function wo(n){const e=Math.round(Math.sqrt(n));return Math.max(0,e-1)}function qi(n){const e=new TextDecoder("utf-8").decode(new Uint8Array(n,0,Math.min(4096,n.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),s={mipmapCount:t,texture:e,srcView:null,mipLevel:1,dstHeight:i,dstWidth:r};s.srcView=e.getGPUTexture().createView({format:e.format,dimension:"2d",baseMipLevel:0,mipLevelCount:1}),e.width>1024&&e.height>1024?this.mipmap(this._pipelineMax,s):this.mipmap(this._pipelineMin,s)}static mipmap(e,t){const a=I.device,r=E.beginCommandEncoder();let i=e==this._pipelineMax,s,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}),s=t.texture.getGPUTexture().createView({format:t.texture.format,dimension:"2d",baseMipLevel:l,mipLevelCount:1}),c.push({binding:f++,resource:s});const h=a.createBindGroup({layout:e.getBindGroupLayout(0),entries:c}),u=r.beginComputePass();u.setPipeline(e),u.setBindGroup(0,h);let b=t.dstWidth,A=t.dstHeight;if(i&&(b=Math.max(1,Math.floor(t.dstWidth/8)),A=Math.max(1,Math.floor(t.dstHeight/8))),u.dispatchWorkgroups(b,A),t.dstHeight*=.5,t.dstWidth*=.5,t.srcView=s,t.mipLevel=l+1,o=i&&(t.dstWidth<8||t.dstHeight<8),u.end(),o)break}E.endCommandEncoder(r),o&&this.mipmap(this._pipelineMin,t)}}class uh{name="";passMap=new Map}class bh{passType="";shaderState=new Map;vertexShader="";fragmentShader=""}class Og{static passKeyword="pass";static shaderKeyword="Shader";static vertexKeyword="vertex";static fragmentKeyword="fragment";static passTypeKeyword="PassType";static parser(e,t){e=ma.filterComment(e);let a=new uh,r=e.indexOf(this.shaderKeyword),i=e.indexOf("{",r),s=e.substring(r+this.shaderKeyword.length,i).trim();a.name=s.substring(1,s.length-1),s=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));let o=this.splitPassBlock(s);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=ma.parse(c.vertexShader,t)),c.fragmentShader.length>0&&(c.fragmentShader=ma.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 bh,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),s=t.substring(a+1,r).split(",");for(let o of s){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,s=0;e=e.substring(r);for(let l of e){if(l==t?i++:l==a&&i--,i<=0)break;s++}return e.substring(1,s).trim()}}let gh=new bt("IrradianceDataReaderCompleteEvent");class Hi extends ja{readFlag=!1;probeRenderer;opColorBuffer;opDepthBuffer;srcColorMap;srcDepthMap;opDepthArray;opColorArray;initReader(e,t,a){this.probeRenderer=e,this.srcColorMap=t,this.srcDepthMap=a;let r=B.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(Pn.type,()=>{this.onProbeRenderComplete()},this),this.probeRenderer.addEventListener(Bs.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 Hi.read(this.srcColorMap.getGPUTexture(),this.opColorBuffer,this.opColorArray),await Hi.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=E.beginCommandEncoder();r.copyTextureToBuffer({texture:e},{buffer:t,bytesPerRow:e.width*16},[e.width,e.height]),E.endCommandEncoder(r),await t.mapAsync(GPUMapMode.READ);const i=t.getMappedRange();a.set(new Float32Array(i),0),t.unmap()}}let Lg=new Hi;class Gg{computeShader;visibleBuffer;texture;constructor(){this.computeShader=new Se(md),this.visibleBuffer=new ei(8192*2),this.computeShader.setStorageBuffer("visibleBuffer",this.visibleBuffer),this.texture=wt.getTexture(Qa.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=E.beginCommandEncoder();E.computeCommand(a,[this.computeShader]),this.visibleBuffer.readBuffer(),t.zVisibleList=this.visibleBuffer.outFloat32Array}}class zg extends Jt{RT_BloomUp;RT_BloomDown;RT_threshold;rendererPassState;thresholdCompute;downSampleComputes;upSampleComputes;postCompute;bloomSetting;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.bloom.enable=!0,this.createGUI()}onDetach(e){B.setting.render.postProcessing.bloom.enable=!1,this.removeGUI()}createGUI(){}removeGUI(){}get downSampleBlurSize(){return B.setting.render.postProcessing.bloom.downSampleBlurSize}set downSampleBlurSize(e){B.setting.render.postProcessing.bloom.downSampleBlurSize=e}get downSampleBlurSigma(){return B.setting.render.postProcessing.bloom.downSampleBlurSigma}set downSampleBlurSigma(e){B.setting.render.postProcessing.bloom.downSampleBlurSigma=e}get upSampleBlurSize(){return B.setting.render.postProcessing.bloom.upSampleBlurSize}set upSampleBlurSize(e){B.setting.render.postProcessing.bloom.upSampleBlurSize=e}get upSampleBlurSigma(){return B.setting.render.postProcessing.bloom.upSampleBlurSigma}set upSampleBlurSigma(e){B.setting.render.postProcessing.bloom.upSampleBlurSigma=e}get luminanceThreshole(){return B.setting.render.postProcessing.bloom.luminanceThreshole}set luminanceThreshole(e){B.setting.render.postProcessing.bloom.luminanceThreshole=e}get bloomIntensity(){return B.setting.render.postProcessing.bloom.bloomIntensity}set bloomIntensity(e){B.setting.render.postProcessing.bloom.bloomIntensity=e}get hdr(){return B.setting.render.postProcessing.bloom.hdr}set hdr(e){B.setting.render.postProcessing.bloom.hdr=e}createThreshouldCompute(){this.thresholdCompute=new Se(jf),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=B.setting.render.postProcessing.bloom.downSampleStep;this.downSampleComputes=[];for(let a=0;a<t;a++){let r=new Se(Zf),i=this.RT_BloomDown[a],s=a==0?this.RT_threshold:this.RT_BloomDown[a-1];r.setSamplerTexture("inTex",s),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=B.setting.render.postProcessing.bloom.downSampleStep;this.upSampleComputes=[];{let a=new Se(mo),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 Se(mo),i=this.RT_BloomUp[a],s=this.RT_BloomDown[t-2-a];r.setSamplerTexture("_MainTex",s),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=B.setting.render.postProcessing.bloom.downSampleStep;this.postCompute=new Se(Yf),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=B.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 Ie(t,a,le.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 Ie(o,l,le.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 Ie(l,c,le.rgba16float,!1,r)}}let s=new We;s.loadOp="load",this.rtFrame=new nt([this.RT_threshold],[s])}render(e,t){this.thresholdCompute||(this.createResource(),this.createThreshouldCompute(),this.createDownSampleComputes(),this.createUpSampleComputes(),this.createPostCompute(),this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="Bloom");let a=B.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(),E.computeCommand(t,[this.thresholdCompute,...this.downSampleComputes,...this.upSampleComputes,this.postCompute]),E.lastRenderPassState=this.rendererPassState}onResize(){let e=B.setting.render.postProcessing.bloom,[t,a]=I.presentationSize;this.RT_threshold.resize(t,a);const r=e.downSampleStep;let i=Math.ceil(t/4),s=Math.ceil(a/4);for(let o=0;o<r;o++)this.RT_BloomDown[o].resize(i,s),i=Math.ceil(i/2),s=Math.ceil(s/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 Wg extends Jt{blurTexture1;blurTexture2;rendererPassState;blurComputes;blurSettings;outTexture;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.depthOfView.enable=!0}onDetach(e){B.setting.render.postProcessing.depthOfView.enable=!1}get pixelOffset(){return B.setting.render.postProcessing.depthOfView.pixelOffset}set pixelOffset(e){e=Math.max(0,e);let t=B.setting.render.postProcessing.depthOfView;t.pixelOffset=e}get near(){return B.setting.render.postProcessing.depthOfView.near}set near(e){e=Math.max(0,e);let t=B.setting.render.postProcessing.depthOfView;t.near=e}get far(){return B.setting.render.postProcessing.depthOfView.far}set far(e){e=Math.max(0,e);let t=B.setting.render.postProcessing.depthOfView;t.far=e}createBlurCompute(){this.blurSettings=[],this.blurComputes=[];let e=B.setting.render.postProcessing.depthOfView;for(let t=0;t<e.iterationCount;t++){let a=new Ct(4),r=new Se(Xf);this.blurComputes.push(r),this.blurSettings.push(a),r.setUniformBuffer("blurSetting",a);let i=Be.getGBufferFrame(Be.colorPass_GBuffer);r.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture());let s=t%2==0?this.blurTexture1:this.blurTexture2,o=t%2==1?this.blurTexture1:this.blurTexture2;r.setSamplerTexture("inTex",s),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 Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture1.name="dof1";let r=new We;r.clearValue=[0,0,0,1],r.loadOp="clear",this.blurTexture2=new Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture2.name="dof2";let i=new We;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new nt([this.blurTexture1,this.blurTexture2],[r,i])}render(e,t){if(!this.blurComputes){this.createResource(),this.createBlurCompute();let r=ve.getCameraGroup(e.camera);for(let i=0;i<this.blurComputes.length;i++)this.blurComputes[i].setUniformBuffer("globalUniform",r.uniformGPUBuffer);this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null)}this.autoSetColorTexture("inTex",this.blurComputes[0]);let a=B.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],s=this.blurSettings[r];s.setFloat("near",a.near),s.setFloat("far",a.far),s.setFloat("pixelOffset",(r+1)*a.pixelOffset),s.apply(),i.setStorageBuffer("blurSetting",s)}E.computeCommand(t,this.blurComputes),E.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=B.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 s=this.blurComputes[i];s.workerSizeX=Math.ceil(this.blurTexture1.width/8),s.workerSizeY=Math.ceil(this.blurTexture1.height/8),s.workerSizeZ=1}}}class Jg extends Jt{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=Be.getGBufferFrame("ColorPassGBuffer");this.currentRenderTexture=e.getColorTexture(),this.gBufferTexture=e.getCompressGBufferTexture();let[t,a]=I.presentationSize;this.outTexture=new Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let r=new We;r.loadOp="load",this.rtFrame=new nt([this.outTexture],[r])}createCompute(){this.uniformBuffer=new Ct(4),this.uniformBuffer.setInt32("state",this._state);let e=ve.getCameraGroup(this.view.camera),a=Be.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture(),r=B.setting.reflectionSetting,s=Be.getGBufferFrame(Be.reflections_GBuffer,r.width,r.height).getCompressGBufferTexture(),o=B.renderJobs.get(this.view).reflectionRenderer.outTexture;this.testCompute=new Se(ud),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",s),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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="test");let t=E.beginCommandEncoder();E.computeCommand(t,[this.testCompute]),E.endCommandEncoder(t),E.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 jg extends Jt{gtaoTexture;rendererPassState;gtaoCompute;gtaoSetting;aoBuffer;directionsBuffer;directionsArray;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.gtao.enable=!0}Render;onDetach(e){B.setting.render.postProcessing.gtao.enable=!1}get maxDistance(){return B.setting.render.postProcessing.gtao.maxDistance}set maxDistance(e){e=_e(e,.1,50);let t=B.setting.render.postProcessing.gtao;t.maxDistance=e}get maxPixel(){return B.setting.render.postProcessing.gtao.maxPixel}set maxPixel(e){e=_e(e,5,100);let t=B.setting.render.postProcessing.gtao;t.maxPixel=e}get darkFactor(){return B.setting.render.postProcessing.gtao.darkFactor}set darkFactor(e){e=_e(e,.01,1);let t=B.setting.render.postProcessing.gtao;t.darkFactor=e}get rayMarchSegment(){return B.setting.render.postProcessing.gtao.rayMarchSegment}set rayMarchSegment(e){e=_e(e,4,10);let t=B.setting.render.postProcessing.gtao;t.rayMarchSegment=e}get multiBounce(){return B.setting.render.postProcessing.gtao.multiBounce}set multiBounce(e){let t=B.setting.render.postProcessing.gtao;t.multiBounce=e}get blendColor(){return B.setting.render.postProcessing.gtao.blendColor}set blendColor(e){let t=B.setting.render.postProcessing.gtao;t.blendColor=e}get usePosFloat32(){return B.setting.render.postProcessing.gtao.usePosFloat32}set usePosFloat32(e){let t=B.setting.render.postProcessing.gtao;t.usePosFloat32=e}createCompute(){this.gtaoCompute=new Se(Hf);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=Be.getGBufferFrame(Be.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 Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.gtaoTexture.name="gtaoTex";let a=new We;a.loadOp="load",this.rtFrame=new nt([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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GTAO";let l=ve.getCameraGroup(e.camera);this.gtaoCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=B.setting.render.postProcessing.gtao;this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply();let r=1-.2*(ze.frame%2),i=a.maxDistance*r,s=a.maxPixel*r;this.gtaoSetting.setFloat("maxDistance",i),this.gtaoSetting.setFloat("maxPixel",s),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(),E.computeCommand(t,[this.gtaoCompute]),E.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 Zg extends Jt{fogSetting;fogOpTexture;fogCompute;fogUniform;rendererPassState;constructor(){super(),this.fogSetting=B.setting.render.postProcessing.globalFog}createCompute(e){X.register("GlobalFog_shader",po),this.fogCompute=new Se(po),this.fogUniform=new Ct(20),this.fogCompute.setUniformBuffer("fogUniform",this.fogUniform);let t=Be.getGBufferFrame(Be.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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="FOG";let a=ve.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 Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.fogOpTexture.name="fogTex";let a=new We;a.loadOp="load",this.rtFrame=new nt([this.fogOpTexture],[a])}onAttach(e){B.setting.render.postProcessing.globalFog.enable=!0}onDetach(e){B.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=B.res.defaultSky;return $.instance.sky instanceof ws&&(e=$.instance.sky.map),e}render(e,t){if(!this.fogCompute){this.createResource(),this.createCompute(e),this.onResize();let r=ve.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(),E.computeCommand(t,[this.fogCompute]),E.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 Yg extends Jt{godRayTexture;rendererPassState;godRayCompute;historyGodRayData;godRaySetting;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.godRay.enable=!0,this.createGUI()}Render;onDetach(e){B.setting.render.postProcessing.godRay.enable=!1,this.removeGUI()}get blendColor(){return B.setting.render.postProcessing.godRay.blendColor}set blendColor(e){B.setting.render.postProcessing.godRay.blendColor=e}get rayMarchCount(){return B.setting.render.postProcessing.godRay.rayMarchCount}set rayMarchCount(e){e=_e(e,8,20),B.setting.render.postProcessing.godRay.rayMarchCount=e}get scatteringExponent(){return B.setting.render.postProcessing.godRay.scatteringExponent}set scatteringExponent(e){e=_e(e,1,40),B.setting.render.postProcessing.godRay.scatteringExponent=e}get intensity(){return B.setting.render.postProcessing.godRay.intensity}set intensity(e){e=_e(e,.01,5),B.setting.render.postProcessing.godRay.intensity=e}createGUI(){}removeGUI(){}createCompute(e){this.godRayCompute=new Se(Kf);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=Be.getGBufferFrame(Be.colorPass_GBuffer);this.godRayCompute.setSamplerTexture("gBufferTexture",a.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",this.godRayCompute),this.godRayCompute.setStorageTexture("outTex",this.godRayTexture);let r=B.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 Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.godRayTexture.name="godRayTexture";let r=new We;r.loadOp="load",this.rtFrame=new nt([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=ve.getLightEntries(e.scene);this.godRayCompute.setStorageBuffer("lightBuffer",o.storageGPUBuffer),this.godRayCompute.setStorageBuffer("models",ve.modelMatrixBindGroup.matrixBufferDst),this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GodRay";let l=ve.getCameraGroup(e.camera);this.godRayCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=B.setting.render.postProcessing.godRay;this.godRaySetting.setFloat("intensity",a.intensity),this.godRaySetting.setFloat("rayMarchCount",a.rayMarchCount);let r=I.presentationSize,[i,s]=r;this.godRaySetting.setFloat("viewPortWidth",i),this.godRaySetting.setFloat("viewPortHeight",s),this.godRaySetting.setFloat("blendColor",a.blendColor?1:0),this.godRaySetting.setFloat("scatteringExponent",a.scatteringExponent),this.godRaySetting.apply(),E.computeCommand(t,[this.godRayCompute]),E.lastRenderPassState=this.rendererPassState}}class mh{indexList;color;count}class ph{SlotCount=8;MaxEntities=16;defaultColor=new Z(.2,1,1,1);slots=[];dataDirty=!0;constructor(){let e=B.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 mh;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,s=t.length;i<s;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 Ca=new ph;class Xg extends Jt{outlineTex;lowTex;rendererPassState;calcWeightCompute;outlineCompute;blendCompute;outlineSetting;slotsBuffer;slotsArray;entitiesArray;entitiesBuffer;weightBuffer;lowTexSize;oldOutlineColor;rtFrame;view;constructor(){super()}onAttach(e){this.view=e,B.setting.render.postProcessing.outline.enable=!0}onDetach(e){B.setting.render.postProcessing.outline.enable=!1}set outlinePixel(e){e=_e(e,0,8);let t=B.setting.render.postProcessing.outline;t.outlinePixel!=e&&(t.outlinePixel=e)}get outlinePixel(){return B.setting.render.postProcessing.outline.outlinePixel}set fadeOutlinePixel(e){let t=B.setting.render.postProcessing.outline;e=_e(e,0,8),t.fadeOutlinePixel!=e&&(t.fadeOutlinePixel=e)}get fadeOutlinePixel(){return B.setting.render.postProcessing.outline.fadeOutlinePixel}set strength(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.outline;t.strength!=e&&(t.strength=e)}get strength(){return B.setting.render.postProcessing.outline.strength}set useAddMode(e){B.setting.render.postProcessing.outline.useAddMode=e}get useAddMode(){return B.setting.render.postProcessing.outline.useAddMode}createGUI(){}createCompute(){let e=Be.getGBufferFrame(Be.colorPass_GBuffer);this.calcWeightCompute=new Se(ed);let t=ve.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 Se(td),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 Se($f),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=B.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new fe(Math.ceil(t*r),Math.ceil(a*r)),this.lowTex=new Ie(this.lowTexSize.x,this.lowTexSize.y,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lowTex.name="lowTex";let i=new We;i.clearValue=[0,0,0,1],i.loadOp="clear",this.outlineTex=new Ie(t,a,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outlineTex.name="outlineTex";let s=new We;s.clearValue=[0,0,0,1],s.loadOp="clear",this.rtFrame=new nt([this.outlineTex],[s]),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(Ca.SlotCount*4),this.slotsBuffer=new Pe(this.slotsArray.length),this.slotsBuffer.setFloat32Array("slotsArray",this.slotsArray),this.slotsBuffer.apply(),this.entitiesArray=new Float32Array(Ca.SlotCount*Ca.MaxEntities),this.entitiesBuffer=new Pe(this.entitiesArray.length),this.entitiesBuffer.setFloat32Array("entitiesArray",this.entitiesArray),this.slotsBuffer.apply(),this.fetchData||={}}fetchData;fetchOutlineData(){if(Ca.fetchData(this.fetchData),this.fetchData.dirty){let e=Ca.SlotCount,t=Ca.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=Ye.createRendererPassState(this.rtFrame,null)),this.computeList||=[this.calcWeightCompute,this.outlineCompute,this.blendCompute];let a=B.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(),E.computeCommand(t,this.computeList),E.lastRenderPassState=this.rendererPassState}onResize(){let e=I.presentationSize,t=e[0],a=e[1],r=B.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new fe(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 Hg extends Jt{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?os(e.camera.transform.onPositionChange,(t,a)=>this.onCameraChange(t,a)):(t,a)=>this.onCameraChange(t,a)}onCameraChange(e,t){console.log("a");let a=g.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=Be.getGBufferFrame("ColorPassGBuffer");this.gBufferTexture=e.getCompressGBufferTexture();let t=I.presentationSize,a=t[0],r=t[1];this.lastPosTexture=new Ie(a,r,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lastPosTexture.name="lastPosTexture",this.outTexture=new Ie(a,r,le.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),s=Math.floor(r*this.downSampleCofe);this.newTexture=new Ie(i,s,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.newTexture.name="newTexture",this.oldTexture=new Ie(i,s,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.oldTexture.name="oldTexture",this.combineTexture=new Ie(i,s,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.combineTexture.name="combineTexture";let o=new We;o.loadOp="load",this.rtFrame=new nt([this.outTexture],[o])}createCompute(){this.ssgiCompute=new Se(id),this.delayCompute=new Se(hd),this.combineCompute=new Se(dd);let e=ve.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 fh,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=Ye.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="SSGI"),this.frameCount=this.frame,this.frame++;let t=E.beginCommandEncoder();switch(parseInt(this.debugChanal)){case 0:E.copyTexture(t,this.combineTexture,this.oldTexture),E.computeCommand(t,[this.ssgiCompute,this.delayCompute,this.combineCompute]);break;case 1:E.copyTexture(t,this.posTexture,this.lastPosTexture),E.copyTexture(t,this.lastPosTexture,this.outTexture);break;case 2:E.copyTexture(t,this.normalTexture,this.outTexture);break;case 3:E.copyTexture(t,this.posTexture,this.outTexture);break;case 4:E.copyTexture(t,this.colorTexture,this.outTexture);break;case 5:E.copyTexture(t,this.gBufferTexture,this.outTexture);break}E.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 Kg extends Jt{SSR_RayTraceCompute;SSR_IS_Compute;SSR_Blend_Compute;isRetTexture;finalTexture;rendererPassState;ssrUniformBuffer;rayTraceData;ssrColorData;rtFrame;historyPosition;view;onAttach(e){this.view=e,B.setting.render.postProcessing.ssr.enable=!0}onDetach(e){B.setting.render.postProcessing.ssr.enable=!1}reflectionRatio=.5;get fadeEdgeRatio(){return B.setting.render.postProcessing.ssr.fadeEdgeRatio}set fadeEdgeRatio(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.fadeEdgeRatio=e}get rayMarchRatio(){return B.setting.render.postProcessing.ssr.rayMarchRatio}set rayMarchRatio(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.rayMarchRatio=e}get roughnessThreshold(){return B.setting.render.postProcessing.ssr.roughnessThreshold}set roughnessThreshold(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.roughnessThreshold=e}get fadeDistanceMin(){return B.setting.render.postProcessing.ssr.fadeDistanceMin}set fadeDistanceMin(e){e=_e(e,0,1e4);let t=B.setting.render.postProcessing.ssr;t.fadeDistanceMin=e}get fadeDistanceMax(){return B.setting.render.postProcessing.ssr.fadeDistanceMax}set fadeDistanceMax(e){e=_e(e,0,1e4);let t=B.setting.render.postProcessing.ssr;t.fadeDistanceMax=e}get powDotRN(){return B.setting.render.postProcessing.ssr.powDotRN}set powDotRN(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.ssr;t.powDotRN=e}createRayTraceShader(){let e=ve.getCameraGroup(this.view.camera);this.SSR_RayTraceCompute=new Se(od),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=Be.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture();this.SSR_RayTraceCompute.setSamplerTexture("gBufferTexture",a),$.instance.sky instanceof ws&&this.SSR_RayTraceCompute.setSamplerTexture("prefilterMap",$.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 Se(nd),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=ve.getCameraGroup(this.view.camera);this.SSR_Blend_Compute=new Se(sd),this.SSR_Blend_Compute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_Blend_Compute.setUniformBuffer("globalUniform",t.uniformGPUBuffer);let r=Be.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 Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.finalTexture.name="ssrOutTex";let a=new We;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=Math.ceil(e*B.setting.render.postProcessing.ssr.pixelRatio),i=Math.ceil(t*B.setting.render.postProcessing.ssr.pixelRatio);this.isRetTexture=new Ie(r,i,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.isRetTexture.name="ssrTextureIn";let s=new We;s.clearValue=[0,0,0,0],s.loadOp="clear",this.rtFrame=new nt([this.finalTexture,this.isRetTexture],[a,s]),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=Ye.createRendererPassState(this.rtFrame,null);let i=ve.getCameraGroup(e.camera);this.SSR_RayTraceCompute.setUniformBuffer("standUniform",i.uniformGPUBuffer)}let a=B.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];E.computeCommand(t,r),E.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=I.presentationSize,a=Math.ceil(e*B.setting.render.postProcessing.ssr.pixelRatio),r=Math.ceil(t*B.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 qg{static createSeeds(){let e=20,t=32,a=[new g(0,0,e)],r=0,i=.02;for(let s=1;s<t;s++){let o=new g;a.push(o),r+=1-(1-.618)*s/t,i+=s*.01,o.x=Math.sin(r)*i,o.y=Math.cos(r)*i,o.z=1-s/t,o.multiplyScalar(e)}return a}}class $g extends Jt{taaTexture;outTexture;rendererPassState;taaCompute;copyTexCompute;sharpCompute;taaSetting;preColorBuffer;preColorTex;preProjMatrix;preViewMatrix;rtFrame;constructor(){super()}onAttach(e){B.setting.render.postProcessing.taa.enable=!0,e.camera.enableJitterProjection(!0),this.createGUI()}onDetach(e){B.setting.render.postProcessing.taa.enable=!1,e.camera.enableJitterProjection(!1)}get jitterSeedCount(){return B.setting.render.postProcessing.taa.jitterSeedCount}set jitterSeedCount(e){e=_e(e,2,32),e=Math.round(e);let t=B.setting.render.postProcessing.taa;t.jitterSeedCount=e}get blendFactor(){return B.setting.render.postProcessing.taa.blendFactor}set blendFactor(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.taa;t.blendFactor=e}get sharpFactor(){return B.setting.render.postProcessing.taa.sharpFactor}set sharpFactor(e){e=_e(e,.1,.99);let t=B.setting.render.postProcessing.taa;t.sharpFactor=e}get sharpPreBlurFactor(){return B.setting.render.postProcessing.taa.sharpPreBlurFactor}set sharpPreBlurFactor(e){e=_e(e,.1,.99);let t=B.setting.render.postProcessing.taa;t.sharpPreBlurFactor=e}get temporalJitterScale(){return B.setting.render.postProcessing.taa.temporalJitterScale}set temporalJitterScale(e){e=_e(e,0,1);let t=B.setting.render.postProcessing.taa;t.temporalJitterScale=e}createGUI(){}createCompute(e){let t=new Se(fd),a=new Ct(44),r=ve.getCameraGroup(e.camera);t.setUniformBuffer("globalUniform",r.uniformGPUBuffer),t.setUniformBuffer("taaData",a),t.setStorageBuffer("preColorBuffer",this.preColorBuffer);let i=Be.getGBufferFrame(Be.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 Se(ld),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 Se(cd),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 T().identity(),this.preViewMatrix=new T().identity();let[e,t]=I.presentationSize;this.preColorBuffer=new Pe(e*t*4,GPUBufferUsage.COPY_SRC),this.preColorTex=new Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.preColorTex.name="taaTex";let a=new We;a.clearValue=[0,0,0,1],a.loadOp="clear",this.taaTexture=new Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.taaTexture.name="taaTex";let r=new We;r.clearValue=[0,0,0,1],r.loadOp="clear",this.outTexture=new Ie(e,t,le.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="sharpTaaTex";let i=new We;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new nt([this.preColorTex,this.taaTexture,this.outTexture],[a,r,i])}render(e,t){this.taaCompute||(this.createResource(),this.createCompute(e),this.rendererPassState=Ye.createRendererPassState(this.rtFrame,null));let a=B.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(),E.computeCommand(t,[this.copyTexCompute,this.taaCompute,this.sharpCompute]),E.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 Ah{_tempIndexArray=[];setOutline(e,t){this.setOutlineList([e],t?[t]:null)}setOutlineList(e,t){e||=[];let a=Ca.defaultColor,r=Ca.SlotCount;for(let i=0;i<r;i++){this._tempIndexArray.length=0;let s=e[i],o=(t?t[i]:null)||a;if(s)for(const l of s)this.getEntityIdList(l,this._tempIndexArray);Ca.fillDataAt(i,this._tempIndexArray,o)}}clearOutline(){return Ca.clear(),this}_rendererList=[];getEntityIdList(e,t){this._rendererList.length=0;let a=e.getComponents(d.MeshRenderer,this._rendererList);for(const r of a)t.push(r.object3D.transform._worldMatrix.index)}}let em=new Ah;class Dh{localPosition=new g;worldPosition=new g;uv=new fe;faceIndex;isIn=!1;t=0;u=0;v=0;triangle;v0;v1;v2;pickList;color}class fi{static EPS=1e-4;static FLT_MAX=3402823466e29;static distPtTri(e,t,a,r){let i=new g,s=new g,o=new g;r.subtract(t,i),a.subtract(t,s),e.subtract(t,o);let l=Ft(i,i),c=Ft(i,s),f=Ft(i,o),h=Ft(s,s),u=Ft(s,o),b=1/(l*h-c*c),A=(h*f-c*u)*b,m=(l*u-c*f)*b;if(A>=-fi.EPS&&m>=-fi.EPS&&A+m<=1+fi.EPS){let p=t[1]+i[1]*A+s[1]*m;return Math.abs(p-e[1])}return fi.FLT_MAX}static _info=new Dh;static IntersectTriangle(e,t,a){let r=t.v1,i=t.v2,s=t.v3,o=i.subtract(r,g.HELP_3),l=s.subtract(r,g.HELP_4),c=e.direction.crossProduct(l,g.HELP_5),f=Ft(o,c),h;if(f>0){if(a)return null;h=e.origin.subtract(r,g.HELP_2)}else h=r.subtract(e.origin,g.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 u=Ft(h,c);if(u<0||u>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let b=h.crossProduct(o,g.HELP_1),A=Ft(e.direction,b);if(A<0||u+A>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let m=Ft(l,b),p=1/f;m*=p,u*=p,A*=p,this._info.isIn=!0,this._info.t=m,this._info.u=u,this._info.v=A;let D=1-u-A;return this._u0.copyFrom(t.u1),this._u0.scale(D),this._u1.copyFrom(t.u2),this._u1.scale(u),this._u2.copyFrom(t.u3),this._u2.scale(A),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(m),this._info.localPosition.add(e.origin,this._info.localPosition),this._info}static _u0=new fe;static _u1=new fe;static _u2=new fe}class Ns extends ja{static _instance;_maxRetry=3;loadAll(e,t){return new Promise((a,r)=>{let i=e.length,s=[];e.forEach((o,l)=>{let c=new t;this.load(o,t).then(f=>{c.parse(f),s.push(c),i--,i===0&&a(s)})})})}constructor(){if(super(),Ns._instance)throw new Error("LoadManager is singleton class...")}static getInstance(){return this._instance||(this._instance=new Ns)}loadUrls(e,t){return new Promise((a,r)=>{let i=e.length,s=[];e.forEach((o,l)=>{this.load(o,t).then(c=>{s.push(c),i--,i===0&&a(s),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 tm extends gr{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,s)=>{let o=!1,l=null,c=null;const f=()=>{o=!0,l&&(l.cancel().catch(()=>{}),l.releaseLock()),c&&c.abort(),h&&typeof h.cancel=="function"&&h.cancel()};let h=null;try{this.baseUrl=e.substring(0,e.lastIndexOf("/")+1),this.initUrl=e,c=new AbortController;const u=await fetch(e,{headers:a?.headers,signal:c.signal});if(!u.ok)throw new Error(`Request rejected with status ${u.status}`);l=u.body.getReader();const b=+u.headers.get("Content-Length")||0;if(h=new t,h.userData=r,h.baseUrl=this.baseUrl,h.initUrl=e,h.loaderFunctions=a,typeof h.initStream!="function")throw new Error(`Parser ${t.name} does not support streaming. Implement initStream() method.`);let A=!1;await h.initStream(b,()=>{!A&&!o&&h&&h.verification()&&(A=!0,i({parser:h,cancel:f}))});let m=0;for(;!o;){const{done:p,value:D}=await l.read();if(p||o){if(!o&&(typeof h.finalizeStream=="function"&&await h.finalizeStream(),!A&&h))if(h.verification())A=!0,i({parser:h,cancel:f});else throw new Error("Parser verification failed");break}if(o)break;m+=D.length,b>0&&a?.onProgress&&!o&&a.onProgress.call(this,m,b,e,h),!o&&typeof h.processChunk=="function"&&await h.processChunk(D,m,b),!A&&!o&&h&&h.verification()&&(A=!0,i({parser:h,cancel:f}))}!o&&a?.onComplete&&a.onComplete.call(this,e)}catch(u){if(o)return;a?.onError&&a.onError(u),s(u)}finally{if(l&&!o)try{l.releaseLock()}catch{}}})}}function ko(n){const e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let a=0;a<n.length;a+=3){const r=n[a+0],i=n[a+1],s=n[a+2];r<e[0]&&(e[0]=r),i<e[1]&&(e[1]=i),s<e[2]&&(e[2]=s),r>t[0]&&(t[0]=r),i>t[1]&&(t[1]=i),s>t[2]&&(t[2]=s)}return{min:e,max:t}}var di=(n=>(n.PLY="ply",n.SPLAT="splat",n.KSPLAT="ksplat",n.UNKNOWN="unknown",n))(di||{});function _h(n){if(n.byteLength<16)return"unknown";const e=new Uint8Array(n,0,Math.min(512,n.byteLength));return new TextDecoder("utf-8").decode(e).startsWith("ply")?"ply":"unknown"}var Sa=(n=>(n[n.Splat=0]="Splat",n[n.PointCloud=1]="PointCloud",n[n.Mesh=2]="Mesh",n))(Sa||{});const Ki=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],Eo=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"];function ea(n){switch(n){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 be(n,e,t){switch(t){case"char":case"int8":return n.getInt8(e);case"uchar":case"uint8":return n.getUint8(e);case"short":case"int16":return n.getInt16(e,!0);case"ushort":case"uint16":return n.getUint16(e,!0);case"int":case"int32":return n.getInt32(e,!0);case"uint":case"uint32":return n.getUint32(e,!0);case"double":case"float64":return n.getFloat64(e,!0);case"float":case"float32":default:return n.getFloat32(e,!0)}}function wo(n){const e=Math.round(Math.sqrt(n));return Math.max(0,e-1)}function qi(n){const e=new TextDecoder("utf-8").decode(new Uint8Array(n,0,Math.min(4096,n.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="",s=0,o=0;const l=[],c=[],f=[];let h=!1,u=!1;for(const m of r)if(m.startsWith("format "))i=m.split(/\s+/)[1];else if(m.startsWith("comment TextureFile ")){const p=m.substring(20).trim();p&&f.push(p)}else if(m.startsWith("element ")){const p=m.split(/\s+/);h=p[1]==="vertex",u=p[1]==="face",h&&(s=parseInt(p[2]),u=!1),u&&(o=parseInt(p[2]),h=!1)}else if(h&&m.startsWith("property ")){const p=m.split(/\s+/),D=p[1],_=p[2];l.push({name:_,type:D})}else if(u&&m.startsWith("property ")){const p=m.split(/\s+/);if(p[1]==="list"){const D=p[2],_=p[3],v=p[4];c.push({name:v,type:`list ${D} ${_}`})}else{const D=p[1],_=p[2];c.push({name:_,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 b=0,A=0;for(const m of l)Ki.includes(m.name)&&b++,Eo.includes(m.name)&&A++;return{format:i,vertexCount:s,faceCount:o,properties:l,faceProperties:c.length>0?c:void 0,textureFiles:f,headerByteLength:a.length,mode:o?Sa.Mesh:b===Ki.length&&A===3?Sa.Splat:Sa.PointCloud}}function Ro(n){const e=qi(n),{format:t}=e;return t==="ascii"?rm(n,e):am(n,e)}function am(n,e){const{vertexCount:t,properties:a,headerByteLength:r}=e,i=new DataView(n,r),s=U=>a.find(y=>y.name===U)!=null,o=U=>a.findIndex(y=>y.name===U),l=new Float32Array(t*3),c=s("scale_0")?new Float32Array(t*3):void 0,f=s("rot_0")?new Float32Array(t*4):void 0,h=s("opacity")?new Float32Array(t):void 0,u=[o("f_dc_0"),o("f_dc_1"),o("f_dc_2")],b=[];for(let U=0;U<a.length;U++)a[U].name.startsWith("f_rest_")&&b.push(U);const A=u[0]>=0&&u[1]>=0&&u[2]>=0;let m,p=0;if(A){const U=1+b.length/3;p=wo(U),m=new Float32Array(t*U*3)}const D=[];let _=0;for(const U of a)D.push(_),_+=ea(U.type);let v=0;for(let U=0;U<t;U++){const y=v,S=o("x"),F=o("y"),k=o("z");if(S<0||F<0||k<0)throw new Error("PLY: Missing x/y/z for vertex");if(l[U*3+0]=be(i,y+D[S],a[S].type),l[U*3+1]=be(i,y+D[F],a[F].type),l[U*3+2]=be(i,y+D[k],a[k].type),c){const x=o("scale_0"),w=o("scale_1"),R=o("scale_2");c[U*3+0]=be(i,y+D[x],a[x].type),c[U*3+1]=be(i,y+D[w],a[w].type),c[U*3+2]=be(i,y+D[R],a[R].type)}if(f){const x=o("rot_0"),w=o("rot_1"),R=o("rot_2"),Q=o("rot_3"),M=be(i,y+D[x],a[x].type),j=be(i,y+D[w],a[w].type),he=be(i,y+D[R],a[R].type),ae=be(i,y+D[Q],a[Q].type);f[U*4+0]=j,f[U*4+1]=he,f[U*4+2]=ae,f[U*4+3]=M}if(h){const x=o("opacity");h[U]=be(i,y+D[x],a[x].type)}if(A&&m){const x=1+b.length/3,w=U*x*3;m[w+0]=be(i,y+D[u[0]],a[u[0]].type),m[w+x+0]=be(i,y+D[u[1]],a[u[1]].type),m[w+2*x+0]=be(i,y+D[u[2]],a[u[2]].type);let R=1,Q=1,M=1;for(let j=0;j<b.length;j+=3){const he=b[j+0],ae=b[j+1],P=b[j+2];m[w+R]=be(i,y+D[he],a[he].type),m[w+x+Q]=be(i,y+D[ae],a[ae].type),m[w+2*x+M]=be(i,y+D[P],a[P].type),R++,Q++,M++}}v+=_}return{vertexCount:t,position:l,scale:c,rotation:f,opacity:h,sh:A&&m?{order:p,coeffs:m}:void 0}}function rm(n,e){const{vertexCount:t,properties:a}=e,r=new TextDecoder("utf-8").decode(n),i=r.indexOf("end_header");if(i<0)throw new Error("PLY: Invalid PLY header");let s=i+10;for(;s<r.length&&(r[s]===" "||r[s]===`
11817
11845
  `||r[s]==="\r");)s++;const l=r.substring(s).split(/\s+/).filter(P=>P.length>0);let c=0;const f=P=>a.find(z=>z.name===P)!=null,h=P=>a.findIndex(z=>z.name===P),u=P=>{if(c>=l.length)throw new Error("PLY: Unexpected end of file");const z=l[c++];switch(P){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(z);case"float":case"double":case"float32":case"float64":return parseFloat(z);default:return parseFloat(z)}},b=new Float32Array(t*3),A=f("scale_0")?new Float32Array(t*3):void 0,m=f("rot_0")?new Float32Array(t*4):void 0,p=f("opacity")?new Float32Array(t):void 0,D=[h("f_dc_0"),h("f_dc_1"),h("f_dc_2")],_=[];for(let P=0;P<a.length;P++)a[P].name.startsWith("f_rest_")&&_.push(P);const v=D[0]>=0&&D[1]>=0&&D[2]>=0;let U,y=0;if(v){const P=1+_.length/3;y=wo(P),U=new Float32Array(t*P*3)}const S=h("x"),F=h("y"),k=h("z");if(S<0||F<0||k<0)throw new Error("PLY: Missing x/y/z for vertex");const x=A?h("scale_0"):-1,w=A?h("scale_1"):-1,R=A?h("scale_2"):-1,Q=m?h("rot_0"):-1,M=m?h("rot_1"):-1,j=m?h("rot_2"):-1,he=m?h("rot_3"):-1,ae=p?h("opacity"):-1;for(let P=0;P<t;P++)for(let z=0;z<a.length;z++){const W=a[z],V=u(W.type);if(z===S?b[P*3+0]=V:z===F?b[P*3+1]=V:z===k&&(b[P*3+2]=V),A&&z===x?A[P*3+0]=V:A&&z===w?A[P*3+1]=V:A&&z===R&&(A[P*3+2]=V),m&&z===Q?m[P*4+3]=V:m&&z===M?m[P*4+0]=V:m&&z===j?m[P*4+1]=V:m&&z===he&&(m[P*4+2]=V),p&&z===ae&&(p[P]=V),v&&U){const te=1+_.length/3,J=P*te*3;z===D[0]?U[J+0]=V:z===D[1]?U[J+te+0]=V:z===D[2]&&(U[J+2*te+0]=V);for(let K=0;K<_.length;K+=3){const ee=_[K+0],re=_[K+1],oe=_[K+2];z===ee?U[J+(K/3+1)]=V:z===re?U[J+te+(K/3+1)]=V:z===oe&&(U[J+2*te+(K/3+1)]=V)}}}return{vertexCount:t,position:b,scale:A,rotation:m,opacity:p,sh:v&&U?{order:y,coeffs:U}:void 0}}function Bh(n){const e=qi(n),{format:t,vertexCount:a,faceCount:r,properties:i,faceProperties:s,textureFiles:o,headerByteLength:l}=e;return t==="ascii"?sm(n,e):im(n,e)}function im(n,e){const{vertexCount:t,faceCount:a,properties:r,faceProperties:i,textureFiles:s,headerByteLength:o}=e,l=new DataView(n,o),c=P=>r.find(z=>z.name===P)!=null,f=P=>r.findIndex(z=>z.name===P),h=i?.some(P=>P.name==="texcoord")||!1,u=i?.some(P=>P.name==="texnumber")||!1;i?.find(P=>P.name==="texcoord"),i?.find(P=>P.name==="texnumber");const b=new Float32Array(t*3),A=c("nx")&&c("ny")&&c("nz"),m=A?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")),_=D||h?new Float32Array(t*2):void 0,v=new Map,U=u?new Array(a):[],y=[];let S=0;for(const P of r)y.push(S),S+=ea(P.type);let F=0;for(let P=0;P<t;P++){const z=F,W=f("x"),V=f("y"),te=f("z");if(W<0||V<0||te<0)throw new Error("PLY: Missing x/y/z for vertex");if(b[P*3+0]=be(l,z+y[W],r[W].type),b[P*3+1]=be(l,z+y[V],r[V].type),b[P*3+2]=be(l,z+y[te],r[te].type),A){const J=f("nx"),K=f("ny"),ee=f("nz");m[P*3+0]=be(l,z+y[J],r[J].type),m[P*3+1]=be(l,z+y[K],r[K].type),m[P*3+2]=be(l,z+y[ee],r[ee].type)}if(p){const J=f("red")>=0?f("red"):f("r"),K=f("green")>=0?f("green"):f("g"),ee=f("blue")>=0?f("blue"):f("b");if(J>=0&&K>=0&&ee>=0){let re=be(l,z+y[J],r[J].type),oe=be(l,z+y[K],r[K].type),pe=be(l,z+y[ee],r[ee].type);(r[J].type==="uchar"||r[J].type==="uint8")&&(re/=255,oe/=255,pe/=255),p[P*3+0]=re,p[P*3+1]=oe,p[P*3+2]=pe}}if(_){const J=f("u")>=0?f("u"):f("s"),K=f("v")>=0?f("v"):f("t");J>=0&&K>=0&&(_[P*2+0]=be(l,z+y[J],r[J].type),_[P*2+1]=be(l,z+y[K],r[K].type))}F+=S}const k=[],x=[],w=[];let R=F;_&&!D&&!h&&new Array(t).fill(!1);for(let P=0;P<a;P++){let z=R,W=[],V,te=0,J=0;if(!i||i.length===0)throw new Error("PLY: Face element must have properties");for(const ee of i)if(ee.name==="vertex_indices"){const re=ee.type.split(" ");if(re.length!==3||re[0]!=="list")throw new Error(`PLY: Invalid vertex_indices property type: ${ee.type}`);const oe=re[1],pe=re[2];if(J=be(l,z,oe),z+=ea(oe),J<3)throw new Error(`PLY: Face ${P} has less than 3 vertices`);const Te=ea(pe);W=[];for(let Oe=0;Oe<J;Oe++){const q=be(l,z,pe);W.push(q),z+=Te}}else if(ee.name==="texcoord"){const re=ee.type.split(" ");if(re.length!==3||re[0]!=="list")throw new Error(`PLY: Invalid texcoord property type: ${ee.type}`);const oe=re[1],pe=re[2],Te=be(l,z,oe);z+=ea(oe);const Oe=ea(pe);V=new Float32Array(Te);for(let q=0;q<Te;q++)V[q]=be(l,z,pe),z+=Oe;v.set(P,V)}else if(ee.name==="texnumber")te=be(l,z,ee.type),z+=ea(ee.type),U[P]=te;else if(ee.type.startsWith("list ")){const re=ee.type.split(" ");if(re.length===3){const oe=re[1],pe=re[2],Te=be(l,z,oe);z+=ea(oe);const Oe=ea(pe);z+=Te*Oe}}else z+=ea(ee.type);R=z;const K=u?U[P]??0:0;if(J===3)k.push(W[0],W[1],W[2]),u&&x.push(K),h&&V&&V.length>=6&&w.push(V[0],1-V[1],V[2],1-V[3],V[4],1-V[5]);else for(let ee=1;ee<J-1;ee++)k.push(W[0],W[ee],W[ee+1]),u&&x.push(K),h&&V&&V.length>=J*2&&w.push(V[0],1-V[1],V[ee*2+0],1-V[ee*2+1],V[(ee+1)*2+0],1-V[(ee+1)*2+1])}if(!A){for(let P=0;P<t*3;P++)m[P]=0;for(let P=0;P<k.length;P+=3){const z=k[P],W=k[P+1],V=k[P+2],te=b[z*3+0],J=b[z*3+1],K=b[z*3+2],ee=b[W*3+0],re=b[W*3+1],oe=b[W*3+2],pe=b[V*3+0],Te=b[V*3+1],Oe=b[V*3+2],q=ee-te,ie=re-J,ce=oe-K,ge=pe-te,we=Te-J,me=Oe-K,ye=ie*me-ce*we,Qe=ce*ge-q*me,Re=q*we-ie*ge;m[z*3+0]+=ye,m[z*3+1]+=Qe,m[z*3+2]+=Re,m[W*3+0]+=ye,m[W*3+1]+=Qe,m[W*3+2]+=Re,m[V*3+0]+=ye,m[V*3+1]+=Qe,m[V*3+2]+=Re}for(let P=0;P<t;P++){const z=m[P*3+0],W=m[P*3+1],V=m[P*3+2],te=Math.sqrt(z*z+W*W+V*V);te>1e-5?(m[P*3+0]=z/te,m[P*3+1]=W/te,m[P*3+2]=V/te):(m[P*3+0]=0,m[P*3+1]=1,m[P*3+2]=0)}}let Q=b,M=m,j=p,he,ae;if(h&&w.length>0){const P=k.length/3,z=new Float32Array(P*3*3),W=new Float32Array(P*3*3),V=p?new Float32Array(P*3*3):void 0;he=new Float32Array(w);for(let J=0;J<P;J++){const K=J*3,ee=k[K+0],re=k[K+1],oe=k[K+2];z[J*9+0]=b[ee*3+0],z[J*9+1]=b[ee*3+1],z[J*9+2]=b[ee*3+2],z[J*9+3]=b[re*3+0],z[J*9+4]=b[re*3+1],z[J*9+5]=b[re*3+2],z[J*9+6]=b[oe*3+0],z[J*9+7]=b[oe*3+1],z[J*9+8]=b[oe*3+2],W[J*9+0]=m[ee*3+0],W[J*9+1]=m[ee*3+1],W[J*9+2]=m[ee*3+2],W[J*9+3]=m[re*3+0],W[J*9+4]=m[re*3+1],W[J*9+5]=m[re*3+2],W[J*9+6]=m[oe*3+0],W[J*9+7]=m[oe*3+1],W[J*9+8]=m[oe*3+2],V&&p&&(V[J*9+0]=p[ee*3+0],V[J*9+1]=p[ee*3+1],V[J*9+2]=p[ee*3+2],V[J*9+3]=p[re*3+0],V[J*9+4]=p[re*3+1],V[J*9+5]=p[re*3+2],V[J*9+6]=p[oe*3+0],V[J*9+7]=p[oe*3+1],V[J*9+8]=p[oe*3+2])}Q=z,M=W,j=V;const te=new Uint32Array(P*3);for(let J=0;J<P*3;J++)te[J]=J;ae=te}else ae=new Uint32Array(k),he=_;return{vertexCount:h&&w.length>0?Q.length/3:t,faceCount:a,position:Q,normal:M,color:j,uv:he,indices:ae,textureFiles:s.length>0?s:void 0,triangleTexnumbers:x.length>0?x:void 0}}function sm(n,e){const{vertexCount:t,faceCount:a,properties:r,faceProperties:i,textureFiles:s,headerByteLength:o}=e,l=new TextDecoder("utf-8").decode(n),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
11846
  `||l[f]==="\r");)f++;const u=l.substring(f).split(/\s+/).filter(q=>q.length>0);let b=0;const A=q=>r.find(ie=>ie.name===q)!=null,m=q=>{if(b>=u.length)throw new Error("PLY: Unexpected end of file");const ie=u[b++];switch(q){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=A("nx")&&A("ny")&&A("nz"),_=D?new Float32Array(t*3):new Float32Array(t*3),v=(A("red")||A("r"))&&(A("green")||A("g"))&&(A("blue")||A("b"))?new Float32Array(t*3):void 0,U=(A("u")||A("s"))&&(A("v")||A("t")),y=i?.some(q=>q.name==="texcoord")||!1,S=U||y?new Float32Array(t*2):void 0,F=new Map,k=i?.some(q=>q.name==="texnumber")||!1,x=k?new Array(a):[],w=[],R=[],Q=[],M=q=>r.findIndex(ie=>ie.name===q),j=M("x"),he=M("y"),ae=M("z"),P=D?M("nx"):-1,z=D?M("ny"):-1,W=D?M("nz"):-1,V=v?M("red")>=0?M("red"):M("r"):-1,te=v?M("green")>=0?M("green"):M("g"):-1,J=v?M("blue")>=0?M("blue"):M("b"):-1,K=S&&U?M("u")>=0?M("u"):M("s"):-1,ee=S&&U?M("v")>=0?M("v"):M("t"):-1;for(let q=0;q<t;q++)for(let ie=0;ie<r.length;ie++){const ce=r[ie],ge=m(ce.type);ie===j?p[q*3+0]=ge:ie===he?p[q*3+1]=ge:ie===ae?p[q*3+2]=ge:ie===P?_[q*3+0]=ge:ie===z?_[q*3+1]=ge:ie===W?_[q*3+2]=ge:ie===V&&v?v[q*3+0]=ce.type==="uchar"||ce.type==="uint8"?ge/255:ge:ie===te&&v?v[q*3+1]=ce.type==="uchar"||ce.type==="uint8"?ge/255:ge:ie===J&&v?v[q*3+2]=ce.type==="uchar"||ce.type==="uint8"?ge/255:ge:ie===K&&S?S[q*2+0]=ge:ie===ee&&S&&(S[q*2+1]=ge)}for(let q=0;q<a;q++){let ie=[],ce,ge=0;for(const ye of i||[])if(ye.name==="vertex_indices"){const Qe=ye.type.split(" "),Re=Qe[1],Le=Qe[2],Ut=m(Re);ie=[];for(let je=0;je<Ut;je++)ie.push(m(Le))}else if(ye.name==="texcoord"){const Qe=ye.type.split(" "),Re=Qe[1],Le=Qe[2],Ut=m(Re);ce=new Float32Array(Ut);for(let je=0;je<Ut;je++)ce[je]=m(Le);F.set(q,ce)}else ye.name==="texnumber"&&(ge=m(ye.type),x[q]=ge);const we=ie.length,me=k?x[q]??0:0;if(we===3)w.push(ie[0],ie[1],ie[2]),k&&R.push(me),y&&ce&&ce.length>=6&&Q.push(ce[0],1-ce[1],ce[2],1-ce[3],ce[4],1-ce[5]);else for(let ye=1;ye<we-1;ye++)w.push(ie[0],ie[ye],ie[ye+1]),k&&R.push(me),y&&ce&&ce.length>=we*2&&Q.push(ce[0],1-ce[1],ce[ye*2+0],1-ce[ye*2+1],ce[(ye+1)*2+0],1-ce[(ye+1)*2+1])}if(!D){for(let q=0;q<t*3;q++)_[q]=0;for(let q=0;q<w.length;q+=3){const ie=w[q],ce=w[q+1],ge=w[q+2],we=p[ie*3+0],me=p[ie*3+1],ye=p[ie*3+2],Qe=p[ce*3+0],Re=p[ce*3+1],Le=p[ce*3+2],Ut=p[ge*3+0],je=p[ge*3+1],sr=p[ge*3+2],Ea=Qe-we,za=Re-me,Wa=Le-ye,aa=Ut-we,Ja=je-me,ua=sr-ye,Pt=za*ua-Wa*Ja,wa=Wa*aa-Ea*ua,ba=Ea*Ja-za*aa;_[ie*3+0]+=Pt,_[ie*3+1]+=wa,_[ie*3+2]+=ba,_[ce*3+0]+=Pt,_[ce*3+1]+=wa,_[ce*3+2]+=ba,_[ge*3+0]+=Pt,_[ge*3+1]+=wa,_[ge*3+2]+=ba}for(let q=0;q<t;q++){const ie=_[q*3+0],ce=_[q*3+1],ge=_[q*3+2],we=Math.sqrt(ie*ie+ce*ce+ge*ge);we>1e-5?(_[q*3+0]=ie/we,_[q*3+1]=ce/we,_[q*3+2]=ge/we):(_[q*3+0]=0,_[q*3+1]=1,_[q*3+2]=0)}}let re=p,oe=_,pe=v,Te,Oe;if(y&&Q.length>0){const q=w.length/3,ie=new Float32Array(q*3*3),ce=new Float32Array(q*3*3),ge=v?new Float32Array(q*3*3):void 0;Te=new Float32Array(Q);for(let me=0;me<q;me++){const ye=me*3,Qe=w[ye+0],Re=w[ye+1],Le=w[ye+2];ie[me*9+0]=p[Qe*3+0],ie[me*9+1]=p[Qe*3+1],ie[me*9+2]=p[Qe*3+2],ie[me*9+3]=p[Re*3+0],ie[me*9+4]=p[Re*3+1],ie[me*9+5]=p[Re*3+2],ie[me*9+6]=p[Le*3+0],ie[me*9+7]=p[Le*3+1],ie[me*9+8]=p[Le*3+2],ce[me*9+0]=_[Qe*3+0],ce[me*9+1]=_[Qe*3+1],ce[me*9+2]=_[Qe*3+2],ce[me*9+3]=_[Re*3+0],ce[me*9+4]=_[Re*3+1],ce[me*9+5]=_[Re*3+2],ce[me*9+6]=_[Le*3+0],ce[me*9+7]=_[Le*3+1],ce[me*9+8]=_[Le*3+2],ge&&v&&(ge[me*9+0]=v[Qe*3+0],ge[me*9+1]=v[Qe*3+1],ge[me*9+2]=v[Qe*3+2],ge[me*9+3]=v[Re*3+0],ge[me*9+4]=v[Re*3+1],ge[me*9+5]=v[Re*3+2],ge[me*9+6]=v[Le*3+0],ge[me*9+7]=v[Le*3+1],ge[me*9+8]=v[Le*3+2])}re=ie,oe=ce,pe=ge;const we=new Uint32Array(q*3);for(let me=0;me<q*3;me++)we[me]=me;Oe=we}else Oe=new Uint32Array(w),Te=S;return{vertexCount:y&&Q.length>0?re.length/3:t,faceCount:a,position:re,normal:oe,color:pe,uv:Te,indices:Oe,textureFiles:s.length>0?s:void 0,triangleTexnumbers:R.length>0?R:void 0}}function vh(n){const e=qi(n),{format:t}=e;return t==="ascii"?om(n,e):nm(n,e)}function nm(n,e){const{vertexCount:t,properties:a,headerByteLength:r}=e,i=new DataView(n,r),s=m=>a.find(p=>p.name===m)!=null,o=m=>a.findIndex(p=>p.name===m),l=new Float32Array(t*3),c=(s("red")||s("r"))&&(s("green")||s("g"))&&(s("blue")||s("b")),f=s("alpha")||s("a"),h=c?new Uint8Array(t*4):void 0,u=[];let b=0;for(const m of a)u.push(b),b+=ea(m.type);let A=0;for(let m=0;m<t;m++){const p=A,D=o("x"),_=o("y"),v=o("z");if(D<0||_<0||v<0)throw new Error("PLY: Missing x/y/z for vertex");if(l[m*3+0]=be(i,p+u[D],a[D].type),l[m*3+1]=be(i,p+u[_],a[_].type),l[m*3+2]=be(i,p+u[v],a[v].type),h){const U=o("red")>=0?o("red"):o("r"),y=o("green")>=0?o("green"):o("g"),S=o("blue")>=0?o("blue"):o("b"),F=f?o("alpha")>=0?o("alpha"):o("a"):-1;if(U>=0&&y>=0&&S>=0){let k=be(i,p+u[U],a[U].type),x=be(i,p+u[y],a[y].type),w=be(i,p+u[S],a[S].type),R=255;(a[U].type==="float"||a[U].type==="float32"||a[U].type==="double"||a[U].type==="float64")&&(k=Math.round(k*255),x=Math.round(x*255),w=Math.round(w*255)),F>=0&&(R=be(i,p+u[F],a[F].type),(a[F].type==="float"||a[F].type==="float32"||a[F].type==="double"||a[F].type==="float64")&&(R=Math.round(R*255))),h[m*4+0]=Math.max(0,Math.min(255,k)),h[m*4+1]=Math.max(0,Math.min(255,x)),h[m*4+2]=Math.max(0,Math.min(255,w)),h[m*4+3]=Math.max(0,Math.min(255,R))}}A+=b}return{vertexCount:t,position:l,color:h}}function om(n,e){const{vertexCount:t,properties:a}=e,r=new TextDecoder("utf-8").decode(n),i=r.indexOf("end_header");if(i<0)throw new Error("PLY: Invalid PLY header");let s=i+10;for(;s<r.length&&(r[s]===" "||r[s]===`
@@ -11824,5 +11852,5 @@ fn frag(){
11824
11852
  `).filter(Boolean);let i=2,s=!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 h=f.match(/(\d+\.?\d*)/);h&&(i=+h[1])}else(c==="WRAP"||c==="WRAP.")&&(s=f==="YES"||f==="Y")}}return{version:i,wrap:s}}parseWellParams(e){const t=Zt.parseSection(e,"W");if(!t)return{};const r=Zt.removeComment(t).split(`
11825
11853
  `).filter(Boolean),i={};for(const s of r){const o=Zt.parseParameterLine(s);o.mnemonic&&(i[o.mnemonic]={unit:o.unit,value:Zt.convertToValue(o.value),description:o.description})}return i}parseCurveParams(e){const t=Zt.parseSection(e,"C");if(!t)return{};const r=Zt.removeComment(t).split(`
11826
11854
  `).filter(Boolean),i={};for(const s of r){const o=Zt.parseParameterLine(s);o.mnemonic&&(i[o.mnemonic]={unit:o.unit,value:o.value,description:o.description})}return i}parseHeaders(e){const t=Zt.parseSection(e,"C");if(!t)throw new Error("LASLoader: ~CURVE section not found");const r=Zt.removeComment(t).split(`
11827
- `).filter(Boolean),i=[];for(const s of r){const o=Zt.parseParameterLine(s);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 s=i.split(/\s+/).filter(c=>c.trim().length>0).map(c=>Zt.convertToValue(c.trim()));if(s.length===0)throw new Error("LASLoader: No data values found");const o=Math.floor(s.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 h=0;h<t.length;h++){const u=c*t.length+h;u<s.length&&f.push(s[u])}f.length===t.length&&l.push(f)}return l}}var hi=(n=>(n.PointCloud="pointcloud",n.Curve="curve",n.WellTrajectory="trajectory",n))(hi||{}),gm=Object.getOwnPropertyDescriptor,mm=(n,e,t,a)=>{for(var r=a>1?void 0:a?gm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.FatLineShader=class extends gt{constructor(){super();const e=new qe("FatLine_VS","FatLine_FS");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);const t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,t.cullMode=Vt.none,t.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new Z(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new fe(1920,1080));const e=new T;this.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}},d.FatLineShader=mm([Ta(d.FatLineShader,"FatLineShader")],d.FatLineShader);class Ch extends Dt{constructor(){super(),this.shader=new d.FatLineShader,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 pm extends rt{static format=Je.BIN;visualizationMode=hi.PointCloud;async parseBuffer(e){const a=await new yh().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 hi.PointCloud:a=this.createPointCloudVisualization(t);break;case hi.Curve:a=this.createCurveVisualization(t);break;case hi.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 d.Object3D;t.name="LASPointCloud";const a=new d.Object3D;a.name="LASPointCloudRoot",t.addChild(a);const r=a.addComponent(d.PointCloudRenderer);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 s=t.map((D,_)=>_).filter(D=>D!==i).slice(0,2),o=a.filter(D=>!D.some(_=>_===r||_===+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 h=1/0,u=-1/0,b=1/0,A=-1/0;if(s.length>0){const D=o.map(_=>+_[s[0]]).filter(_=>!isNaN(_));if(h=Math.min(...D),u=Math.max(...D),s.length>1){const _=o.map(v=>+v[s[1]]).filter(v=>!isNaN(v));b=Math.min(..._),A=Math.max(..._)}}for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=D*4;if(c[v+2]=+_[i],s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;if(c[v+0]=S*10,s.length>1){const F=+_[s[1]],k=A!==b?(F-b)/(A-b):0;c[v+1]=k*10}else c[v+1]=0}else c[v+0]=0,c[v+1]=0;if(s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;this.mapValueToColor(S,f,U)}else f[U+0]=255,f[U+1]=255,f[U+2]=255,f[U+3]=255}const m=new d.Object3D;m.name="LASPointCloud";const p=m.addComponent(d.PointCloudRenderer);return p.initFromData(c,f,l),p.setPointShape("circle"),p.setPointSize(4),m}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 s=t.map((D,_)=>_).find(D=>D!==i);if(s===void 0)throw new Error("LASParser: No curve column found");const o=a.filter(D=>{const _=+D[i],v=+D[s];return!isNaN(_)&&!isNaN(v)&&v!==r&&v!==+r});if(o.length===0)throw new Error("LASParser: No valid data points");const l=o.map(D=>+D[s]),c=Math.min(...l),h=Math.max(...l)-c,u=new Float32Array(o.length*3);for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=+_[i],y=+_[s];u[v+2]=U;const S=h>0?(y-c)/h:0;u[v+0]=S*10,u[v+1]=0}const b=new ih;b.setPositions(u);const A=new Ch;A.baseColor=new Z(1,0,0,1),A.lineWidth=2;const m=new d.Object3D;m.name=`LASCurve_${t[s]}`;const p=m.addComponent(d.FatLineRenderer);return p.geometry=b,p.material=A,m}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),s=Math.max(...r);return s!==i?(e-i)/(s-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 Io extends rt{static format=Je.BIN;static cloudImageProcessParam="";async parseBuffer(e){switch(qi(e).mode){case Sa.Splat:{const a=Ro(e),r={count:a.vertexCount,position:a.position,rotation:a.rotation,scale:a.scale,opacity:a.opacity,sh:a.sh};r.bbox=ko(a.position);const i=new d.Object3D;i.name="GaussianSplat",i.addComponent(d.GSplatRenderer).initAsset(r),this.data=i;break}case Sa.PointCloud:{const a=vh(e),r=new d.Object3D;r.name="PLYPointCloud";const i=new d.Object3D;i.name="PLYPointCloudRoot",r.addChild(i);const s=i.addComponent(d.PointCloudRenderer);if(a.color)s.initFromData(a.position,a.color,a.vertexCount);else{const o=new Uint8Array(a.vertexCount*4);o.fill(255),s.initFromData(a.position,o,a.vertexCount)}s.setPointShape("circle"),s.setPointSize(4),this.data=r;break}case Sa.Mesh:{const a=Bh(e),r=new d.Object3D;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 s=new Map;if(a.textureFiles&&a.textureFiles.length>0){const o=[];for(let l=0;l<a.textureFiles.length;l++){const c=new qt,f=It.normalizePath(this.baseUrl+a.textureFiles[l]);o.push(B.res.loadTexture(f+Io.cloudImageProcessParam).then(h=>{c.baseMap=h,s.set(l,c)}))}await Promise.all(o)}s.size===0&&s.set(0,new qt);for(const[o,l]of i){const c=[];for(const A of l){const m=A*3;c.push(a.indices[m+0],a.indices[m+1],a.indices[m+2])}const f=new Ve;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 h=s.get(o);h||(h=s.values().next().value||new qt);const u=new d.Object3D;u.name=`PLYMesh_Texture_${o}`;const b=u.addComponent(d.MeshRenderer);b.geometry=f,b.material=h,r.addChild(u)}this.data=r;break}}}verification(){return!!this.data}}class Sh{async parse(e){const t=new DataView(e),a=ti(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 s=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,h=new Ri(e,f,s,o),u=f+s+o,b=h.header.POINTS_LENGTH||0,A=new Fs(e,b,u,l,c);return{version:r,featureTable:h,batchTable:A}}}class xh extends Sh{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 b=await this.parseDraco(a,o,i);l=b.positions,c=b.colors,b.normals}else l=this.parsePositions(a,i),c=this.parseColors(a,i),this.parseNormals(a,i);const f=new d.Object3D,h=f.addComponent(d.PointCloudRenderer);h.initFromData(l,c,i),h.setPointShape("circle"),h.setPointSize(4);const u=a.getData("RTC_CENTER",1,"FLOAT","VEC3");return u&&f.transform.localPosition.set(u[0],u[1],u[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"),s=e.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3");if(!i||!s)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]+s[0],o[f+1]=r[f+1]/l*i[1]+s[1],o[f+2]=r[f+2]/l*i[2]+s[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,h=c*4;l[h+0]=r[f+0],l[h+1]=r[f+1],l[h+2]=r[f+2],l[h+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]),h=c*4;l[h+0]=f[0],l[h+1]=f[1],l[h+2]=f[2],l[h+3]=255}return l}const s=e.getData("CONSTANT_RGBA",1,"UNSIGNED_BYTE","VEC4");if(s){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*4;l[f+0]=s[0],l[f+1]=s[1],l[f+2]=s[2],l[f+3]=s[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,s=e[i]/255,o=e[i+1]/255,l=s*2-1,c=o*2-1,f=1-Math.abs(l)-Math.abs(c);let h,u;f<0?(h=(l>=0?1:-1)*(1-Math.abs(c)),u=(c>=0?1:-1)*(1-Math.abs(l))):(h=l,u=c);const b=Math.sqrt(h*h+u*u+f*f),A=r*3;a[A+0]=h/b,a[A+1]=u/b,a[A+2]=f/b}return a}async parseDraco(e,t,a){throw new Error("Draco compression not yet implemented")}}class Fh extends rt{static format=Je.BIN;async parseBuffer(e){const a=await new xh().parse(e),r=new d.Object3D;r.name="PNTS",r.addChild(a),this.data=r}verification(){if(this.data)return!0;throw new Error("PNTSParser: Parse failed")}}class To{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 To;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class kh extends rt{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()),B.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 H=(n=>(n[n.single=0]="single",n[n.boolean=1]="boolean",n[n.int=2]="int",n[n.int16=3]="int16",n[n.int32=4]="int32",n[n.float=5]="float",n[n.long=6]="long",n[n.uint=7]="uint",n[n.uint32=8]="uint32",n[n.uint64=9]="uint64",n[n.double=10]="double",n[n.string=11]="string",n[n.singleArray=12]="singleArray",n[n.stringArray=13]="stringArray",n[n.floatArray=14]="floatArray",n[n.vector2=15]="vector2",n[n.vector3=16]="vector3",n[n.vector4=17]="vector4",n[n.color=18]="color",n[n.color32=19]="color32",n[n.animationCurve=20]="animationCurve",n[n.quaternion=21]="quaternion",n[n.matrix4x4=22]="matrix4x4",n[n.mesh=23]="mesh",n[n.texture=24]="texture",n[n.material=25]="material",n[n.materials=26]="materials",n[n.skeleton=27]="skeleton",n[n.animClip=28]="animClip",n[n.vector2Int=29]="vector2Int",n[n.int32List=30]="int32List",n[n.colorList=31]="colorList",n[n.color32List=32]="color32List",n))(H||{});class Os{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=il(t);if(r){let i=new Dt;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 H.color:case H.color32:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformColor(i,s)}break;case H.single:case H.float:case H.int:case H.int16:case H.int32:case H.uint:case H.uint32:case H.uint64:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.singleArray:{let s=r.getValue()[0];i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.vector2:case H.vector2Int:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector2(i,s)}break;case H.vector3:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector3(i,s)}break;case H.vector4:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector4(i,s)}break}}}}class Va{static parser(e){switch(e.readInt32()){case H.single:return{t:H.single,v:e.readFloat32()};case H.boolean:return{t:H.boolean,v:e.readBoolean()};case H.int:return{t:H.int,v:e.readInt32()};case H.int16:return{t:H.int16,v:e.readInt16()};case H.int32:return{t:H.int32,v:e.readInt32()};case H.float:return{t:H.float,v:e.readFloat32()};case H.long:return{t:H.long,v:e.readFloat64()};case H.uint:return{t:H.uint,v:e.readUnit32()};case H.uint32:return{t:H.uint32,v:e.readUnit32()};case H.uint64:return{t:H.uint64,v:e.readUnit32()};case H.double:return{t:H.double,v:e.readFloat64()};case H.string:return{t:H.string,v:e.readUTF()};case H.singleArray:return{t:H.singleArray,v:e.readFloatArray()};case H.stringArray:return{t:H.stringArray,v:e.readStringArray()};case H.floatArray:return{t:H.floatArray,v:e.readFloatArray()};case H.vector2:return{t:H.vector2,v:e.readVector2()};case H.vector3:return{t:H.vector3,v:e.readVector3()};case H.vector4:return{t:H.vector4,v:e.readVector4()};case H.color:return{t:H.color,v:e.readColor()};case H.color32:return{t:H.color32,v:e.readColor()};case H.animationCurve:return{t:H.animationCurve,v:null};case H.quaternion:return{t:H.quaternion,v:e.readQuaternion()};case H.matrix4x4:return{t:H.matrix4x4,v:null};case H.mesh:{let o=e.readUTF(),l=B.res.getGeometry(o);return{t:H.mesh,v:l}}case H.texture:{let o=e.readUTF(),l=B.res.getTexture(o);return{t:H.texture,v:l}}case H.material:{let o=e.readUTF(),l=B.res.getMat(o);return{t:H.material,v:l}}case H.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let h=B.res.getMat(f);l.push(h)}return{t:H.materials,v:l}}case H.skeleton:break;case H.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new Zo;f.formBytes(e),o.push(f)}return{t:H.animClip,v:o}}case H.vector2Int:return{t:H.vector2Int,v:e.readVector2int()};case H.int32List:return{t:H.int32List,v:e.readInt32List()};case H.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Va.parser(e).v;r.push(l)}return{t:H.colorList,v:r};case H.color32List:let i=e.readInt32(),s=[];for(let o=0;o<i;o++){const l=Va.parser(e).v;s.push(l)}return{t:H.color32List,v:s}}}}class Mo{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Va.parser(e);this.type=t,this._data=a}}class Eh{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class wh extends rt{static format=Je.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),s=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],h=[],u=i.readInt32();for(let m=0;m<u;m++){let p=new Mo;p.formBytes(i),f.push(p)}let b=i.readInt32();for(let m=0;m<b;m++){let p=i.readBytesArray(),D=new Eh;D.property=p.readUTF(),D.name=p.readUTF(),D.texture=B.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(),h.push(D)}let A=Os.GetMaterial(c);A.name=s;for(let m=0;m<l.length;m++){const p=l[m];A.shader.setDefine(p,!0)}Os.applyMaterialTexture(A,h),Os.applyMaterialProperties(A,f),B.res.addMat(o,A)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Po{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 No{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 Po;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class Rh{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class Ih extends rt{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 Rh,s=e.readBytesArray();i.meshName=s.readUTF(),i.meshID=s.readUTF(),s.readFloat32()>0,s.readFloat32()>0,s.readFloat32()>0;let o=s.readFloat32()>0,l=s.readFloat32()>0;o&&(i.bones=s.readStringArray(),i.bindPose=s.readMatrix44Array()),l&&(i.blendShapeData=new No,i.blendShapeData.formBytes(s));let c=s.readBytesArray(),f=s.readBytesArray(),h=c.readInt32(),u=0,b=[];for(let _=0;_<h;_++)b[_]={},b[_].att=Am[c.readUTF()],b[_].dim=c.readInt32(),u+=b[_].dim,b[_].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let A=s.readInt32Array(),m=[],p=s.readInt32();for(let _=0;_<p;_++){let v=s.readInt32(),U=s.readInt32(),y=s.readInt32(),S=s.readInt32(),F=s.readInt32(),k=s.readInt32();s.readVector3(),s.readVector3();let x={indexStart:U,indexCount:y,vertexStart:S,vertexCount:k,firstStart:F,topology:v,index:_};m.push(x)}A.length>65535?i.indices=new Uint32Array(A):i.indices=new Uint16Array(A);let D=new Ve;if(D.vertexDim=u,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 _=0;_<i.blendShapeData.blendCount;_++){D.setAttribute("a_morphPositions_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendPositionList),D.setAttribute("a_morphNormals_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendNormalList);for(let v=0;v<i.blendShapeData.blendCount;v++){let U=i.blendShapeData.shapeNames[v],y=i.blendShapeData.shapeIndexs[v];D.morphTargetDictionary[U]=y}}}for(let _=0;_<b.length;_++){const v=b[_].att;D.setAttribute(v,null)}for(let _=0;_<m.length;_++){const v=m[_];D.addSubGeometry(v)}D.name=i.meshName,B.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let Am={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 Ls 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 Ls(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 fe;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new fe;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new g;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 ue;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 Z;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 ne;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 T,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 Th extends rt{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();Qh.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let s=await B.res.loadBitmapTextures(i,B.setting.loader.numConcurrent,a,!0);for(const o of s)B.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var Dm=Object.getOwnPropertyDescriptor,_m=(n,e,t,a)=>{for(var r=a>1?void 0:a?Dm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitSSSShader=class extends gt{constructor(){super(),X.register("PBRLitSSSShader",_d);let e=new qe("PBRLitSSSShader","PBRLitSSSShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.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 hh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(1,1,1)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.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 Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new Z(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _SSSMap(e){this.setTexture("sssMap",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?Vt.none:t.shaderState.cullMode}set _SkinColor(e){this.setUniformColor("skinColor",e)}set _SkinPower(e){this.setUniformFloat("skinPower",e)}set _SkinColorIns(e){this.setUniformFloat("skinColorIns",e)}set curveFactor(e){this.setUniformFloat("curveFactor",e)}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitSSSShader=_m([Ta(d.LitSSSShader,"LitSSSShader")],d.LitSSSShader);var Bm=Object.getOwnPropertyDescriptor,vm=(n,e,t,a)=>{for(var r=a>1?void 0:a?Bm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitShader=class extends gt{constructor(){super();let e=new qe("PBRLItShader","PBRLItShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(0,0,0)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.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 Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=B.res.grayTexture,this._BumpMap=B.res.normalTexture,this._MaskTex=B.res.maskTexture}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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitShader=vm([Ta(d.LitShader,"LitShader")],d.LitShader);class Gs{comName;data;static parser(e){let t=e.readBytesArray(),a=new Gs;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let s=new Mo;s.formBytes(t),a.data.push(s)}return a}}class $i{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new $i;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 s=0;s<r;s++){const o=Gs.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let s=0;s<i;s++){const o=$i.parser(t);a.child.push(o)}return a}}class Qh extends rt{static useWebp=!0;static format=Je.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new Ls(e,0);await Th.parserTexture(t,this,this.loaderFunctions),kh.parser(t,this),Ih.parserMeshs(t,this),wh.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return $i.parser(e)}parserNodeTree(e){let t=new d.Object3D;if(t.localPosition=g.serialize(e.position),t.localQuaternion=ne.serialize(e.rotation),t.localScale=g.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,s=rl(r.comName);if(s){i=t.getOrAddComponent(s);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 Um{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 s=a[i];r.push(s)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var ym=Object.getOwnPropertyDescriptor,Cm=(n,e,t,a)=>{for(var r=a>1?void 0:a?ym(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitShader=class extends gt{constructor(){super();let e=new qe("UnLit","UnLit");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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitShader=Cm([Ta(d.UnLitShader,"UnLitShader")],d.UnLitShader);var Sm=Object.getOwnPropertyDescriptor,xm=(n,e,t,a)=>{for(var r=a>1?void 0:a?Sm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitTexArrayShader=class extends gt{constructor(){super(),X.register("VertexAttributeIndexShader",pd),X.register("UnLitTextureArray",Bd);let e=new qe("UnLitTextureArray","UnLitTextureArray");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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitTexArrayShader=xm([Ta(d.UnLitTexArrayShader,"UnLitTexArrayShader")],d.UnLitTexArrayShader);const vr=-1,Ur=0,Vo=1,Mh=2,Oa=3,Fm=6378137,km=1/298.257223563,Em=6356752314245179e-9,wm=Symbol("PLUGIN_REGISTERED");class Oo{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=Ur;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 Ph=2**30;class Nh{minSize=6e3;maxSize=8e3;minBytesSize=.3*Ph;maxBytesSize=.4*Ph;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,s=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-s<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,s+=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 Lo{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}),s={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,s),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(s=>{i.reject(s),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function Vh(n,e=null,t=null){const a=[];for(a.push(n),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),s=a.pop();if(e&&e(s,i,r)===!0){t&&t(s,i,r);return}const o=s.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(s),a.push(r+1);if(t&&t(s,i,r)===!0)return}}function Rm(n,e){let t=n;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const zs={inView:!1,error:1/0,distanceFromCamera:1/0},Oh=!0;function Lh(n){return n===Oa||n===vr}function yr(n,e){return n.lastFrameVisited===e&&n.used}function Gh(n){return n.childrenProcessed===n.children.length}function Go(n){return n.hasUnrenderableContent||n.parent!==null&&n.parent.geometricError<n.geometricError}function zo(n,e){n.lastFrameVisited!==e.frameCount&&(n.usedLastFrame=n.used,n.lastFrameVisited=e.frameCount,n.used=!1,n.inFrustum=!1,n.isLeaf=!1,n.visible=!1,n.active=!1,n.error=1/0,n.distanceFromCamera=1/0,n.allChildrenReady=!1,e.calculateTileViewError(n,zs),n.inFrustum=zs.inView,n.error=zs.error,n.distanceFromCamera=zs.distanceFromCamera)}function Wo(n,e,t=!1){n.used||(t||(n.used=!0,e.stats.used++),e.markTileUsed(n),n.inFrustum===!0&&e.stats.inFrustum++)}function Im(n,e){if(n.canTraverse&&n.canTraverseFrame===e.frameCount)return n.canTraverse;let t=!1;return n.error<=e.errorTarget&&!Go(n)||n.depth>=e.maxDepth||!n.children||n.children.length===0?t=!1:t=!0,n.canTraverse=t,n.canTraverseFrame=e.frameCount,t}function Jo(n,e,t=!1){if(e.ensureChildrenArePreprocessed(n),zo(n,e),Wo(n,e,t),Go(n)&&Gh(n)){const a=n.children;for(let r=0,i=a.length;r<i;r++)Jo(a[r],e,t)}}function Ws(n,e){if(e.ensureChildrenArePreprocessed(n),zo(n,e),!n.inFrustum)return;if(!Im(n,e)){Wo(n,e);const s=n.children;if(!n.hasContent&&s&&s.length>0)for(let o=0,l=s.length;o<l;o++){const c=s[o];Ws(c,e)}return}const a=n.children;let r=!1,i=!1;for(let s=0,o=a.length;s<o;s++){const l=a[s];Ws(l,e),r=r||yr(l,e.frameCount),i=i||l.inFrustum}if(n.refine==="REPLACE"&&!i&&a.length!==0){n.inFrustum=!1;for(let s=0,o=a.length;s<o;s++)Jo(a[s],e,!0);return}if(Wo(n,e),n.refine==="REPLACE"&&(r&&n.depth!==0||Oh))for(let s=0,o=a.length;s<o;s++)Jo(a[s],e)}function jo(n,e){const t=e.frameCount;if(!yr(n,t))return;const a=n.children;let r=!1;for(let i=0,s=a.length;i<s;i++){const o=a[i];r=r||yr(o,t)}if(!r)n.isLeaf=!0;else{let i=!0;for(let s=0,o=a.length;s<o;s++){const l=a[s];if(jo(l,e),yr(l,t)){const c=!Go(l);let f=!l.hasContent||l.hasRenderableContent&&Lh(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===vr;f=c&&f||l.allChildrenReady,i=i&&f}}n.allChildrenReady=i}}function zh(n,e){if(e.ensureChildrenArePreprocessed(n),yr(n,e.frameCount)&&(n.hasContent&&e.queueTileForDownload(n),Gh(n))){const t=n.children;for(let a=0,r=t.length;a<r;a++)zh(t[a],e)}}function Js(n,e){const t=e.stats;if(!yr(n,e.frameCount))return;if(n.isLeaf){n.loadingState===Oa?(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++):n.hasContent&&e.queueTileForDownload(n);return}const a=n.children,r=n.hasContent,i=Lh(n.loadingState)&&r,s=(e.errorTarget+1)*(e.errorThreshold||1),o=n.error<=s,l=n.refine==="ADD",c=n.allChildrenReady||n.depth===0&&!Oh;if(r&&(o||l)&&e.queueTileForDownload(n),(o&&i&&!c||i&&l)&&(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++),!l&&o&&!c)for(let f=0,h=a.length;f<h;f++){const u=a[f];yr(u,e.frameCount)&&zh(u,e)}else for(let f=0,h=a.length;f<h;f++)Js(a[f],e)}function js(n,e){const t=yr(n,e.frameCount);if(t||n.usedLastFrame){let a=!1,r=!1;if(t?(a=n.active,r=n.visible):zo(n,e),n.hasRenderableContent&&n.loadingState===Oa){const s=n.__wasSetVisible;n.__wasSetActive!==a&&(e.setTileDelayedActive(n,a),n.__wasSetActive=a),s!==r&&(e.setTileDelayedVisible(n,r),n.__wasSetVisible=r)}n.usedLastFrame=t;const i=n.children;for(let s=0,o=i.length;s<o;s++)js(i[s],e)}}class Vr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Vr.s_tmpMatrix||(Vr.s_tmpMatrix=new T),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 g(e[0],e[1],e[2]),a=new g(e[3],e[4],e[5]),r=new g(e[6],e[7],e[8]),i=new g(e[9],e[10],e[11]),s=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),h=i.clone().normalize();this._matrix=new T;const u=this._matrix.rawData;u[0]=c.x,u[1]=c.y,u[2]=c.z,u[3]=0,u[4]=f.x,u[5]=f.y,u[6]=f.z,u[7]=0,u[8]=h.x,u[9]=h.y,u[10]=h.z,u[11]=0,u[12]=t.x,u[13]=t.y,u[14]=t.z,u[15]=1;const b=new g(s*2,o*2,l*2);this._box=new Ce(new g(0,0,0),b)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new g(e[0],e[1],e[2]),a=e[3];this._sphere=new Tr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,s,o]=e,l=new g((t+r)/2,(a+i)/2,(s+o)/2),c=new g(Math.abs(r-t),Math.abs(i-a),Math.abs(o-s));this._box=new Ce(l,c),this._matrix=new T,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new g(a.x-r,a.y-r,a.z-r),s=new g(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,s),t){const o=[new g(i.x,i.y,i.z),new g(s.x,i.y,i.z),new g(i.x,s.y,i.z),new g(s.x,s.y,i.z),new g(i.x,i.y,s.z),new g(s.x,i.y,s.z),new g(i.x,s.y,s.z),new g(s.x,s.y,s.z)];o.forEach(l=>{const c=new g;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Vr.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 g(r.min.x,r.min.y,r.min.z),new g(r.max.x,r.min.y,r.min.z),new g(r.min.x,r.max.y,r.min.z),new g(r.max.x,r.max.y,r.min.z),new g(r.min.x,r.min.y,r.max.z),new g(r.max.x,r.min.y,r.max.z),new g(r.min.x,r.max.y,r.max.z),new g(r.max.x,r.max.y,r.max.z)];i.forEach(s=>{const o=new g;a.transformPoint(s,o),s.copyFrom(o)}),e.makeEmpty(),i.forEach(s=>{e.expandByPoint(s)})}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 g;t.transformPoint(a,o),r=o}const i=this._sphere.radius,s=e.clone().subtract(r).length;return Math.max(0,s-i)}else if(this._box){const a=new Ce;this.getAABB(a,t);const r=a.center,i=a.size,s=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(s*s+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 Wh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.used!==e.used?n.used?1:-1:n.error!==e.error?n.error>e.error?1:-1:n.distanceFromCamera!==e.distanceFromCamera?n.distanceFromCamera>e.distanceFromCamera?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},Jh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.lastFrameVisited!==e.lastFrameVisited?n.lastFrameVisited>e.lastFrameVisited?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:n.loadingState!==e.loadingState?n.loadingState>e.loadingState?-1:1:n.hasUnrenderableContent!==e.hasUnrenderableContent?n.hasUnrenderableContent?-1:1:n.error!==e.error?n.error>e.error?-1:1:0};class Tm{rootLoadingState=Ur;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 T;_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 Nh,this.lruCache.unloadPriorityCallback=Jh,this.loadQueue=new Lo,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=Wh,this.processNodeQueue=new Lo,this.processNodeQueue.maxJobs=25,this.group=new d.Object3D,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===Ur&&(this.rootLoadingState=Vo,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=Oa,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),h=this.preprocessNode(c.root,f,null);this.queueTileForDownload(h),this._root=h;const u=new Vr(h.boundingVolume),b=new Tr;u.getSphere(b);const A=new Ce;if(u.getAABB(A),this.rtcOffset=new g(-b.center.x,-b.center.y,-b.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:b.center,radius:b.radius,boundingBox:A,rtcOffset:this.rtcOffset})}catch(m){console.warn("Failed to calculate bounding volume for root tile:",m)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=vr,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const s=this.root;if(!s)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(),Ws(s,this),jo(s,this),Js(s,this),js(s,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&&Vh(this.root,(r,i,s)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,s):!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,s=a.boundingVolume;if(!s){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,h=1/0;const u=a.worldTransform;for(let b=0,A=r.length;b<A;b++){const m=i[b];let p,D;if(m.isOrthographic){const v=m.pixelSize;p=e.geometricError/v,D=1/0}else{const v=m.sseDenominator;D=s.distanceToPoint(m.position,u),p=D===0?1/0:e.geometricError/(D*v)}const _=i[b].frustum;s.intersectsFrustum(_,u)&&(o=!0,l=Math.max(l,p),c=Math.min(c,D)),f=Math.max(f,p),h=Math.min(h,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=h)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new g,frustum:new pn,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],s=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(s.position.copyFrom(l),s.frustum=i.frustum,s.isOrthographic=i.type===it.ortho,s.isOrthographic){const c=i.frustumSize;s.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;s.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 Oo?r=e:r=new Oo(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 Vr(r.boundingVolume);r.cached.boundingVolume=c}const i=new g(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),s=new T;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)s.rawData[f]=c[f]}if(!a){s.copyFrom(this._upRotationMatrix);const c=new g;c.copyFrom(i),c.applyMatrix4(s);const f=r.cached.boundingVolume.box,h=[new g(f.min.x,f.min.y,f.min.z),new g(f.max.x,f.min.y,f.min.z),new g(f.min.x,f.max.y,f.min.z),new g(f.max.x,f.max.y,f.min.z),new g(f.min.x,f.min.y,f.max.z),new g(f.max.x,f.min.y,f.max.z),new g(f.min.x,f.max.y,f.max.z),new g(f.max.x,f.max.y,f.max.z)];for(const A of h)A.applyMatrix4(s);const u=new Ce;h.forEach(A=>{u.expandByPoint(A)}),s.rawData[12]=-c.x,s.rawData[13]=-c.y,s.rawData[14]=-c.z;const b=u.min;s.rawData[13]-=b.y}const o=new T;o.copyFrom(s),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,s);const l=new T;if(l.copyFrom(o),l.invert(),r.cached.transfrom=s,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],h=this.preprocessNode(f,t,r);r.children.push(h)}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 s=a[r];s.basePath!==void 0&&s.basePath!==""||s.cached.boundingVolume||(t?(this.processNodeQueue.remove(s),this.preprocessNode(s,e.basePath,e)):this.processNodeQueue.has(s)||this.processNodeQueue.add(s,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!==Ur){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=Vo,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=vr,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async s=>{try{await this.parseTileContent(s,r,i),this.stats.downloading--}catch(o){s.loadingState=vr,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=Mh;const i=(c=>{const f=c.split(".");return f.length>1?f[f.length-1]:""})(t),s=a;let o=null;const l=new Tt;switch(i.toLowerCase()){case"b3dm":{o=(await l.load(s,ro,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"i3dm":{o=(await l.load(s,no,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"glb":case"gltf":{o=(await l.load(s,_t,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"pnts":{o=(await l.load(s,Fh,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"json":try{const c=await B.res.loadJSON(s);e.children.length=0,e.childrenProcessed=0;const f=this._getBasePath(s);if(c.root){const h=this.preprocessNode(c.root,f,e);e.children.push(h),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:c,url:s})}e.loadingState=Oa;return}catch(c){console.error("Failed to load external tileset:",c),e.loadingState=vr,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 h=f.cached.scene;h.parent&&h.parent.object3D.removeChild(h),h.destroy(!0),f.cached.scene=null}f.loadingState=Ur}),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=Oa,e.usedLastFrame=!0,Js(e,this),js(e,this)}else e.loadingState=vr,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!==Ur||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 B.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new T;switch(e.toLowerCase()){case"x":t.makeRotationAxis(g.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(g.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(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;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(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;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,s=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:s}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===Oa&&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,s=0;return this.traverse(o=>(e++,o.loadingState===Oa&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),s+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?s/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=Ur,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===Oa&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent(d.MeshRenderer);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 Qm{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class Mm{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class Pm{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class Nm{uri;group;metadata}class Vm{class;properties}function Om(n,e){let t=0,a=null;return function(...r){const i=Date.now(),s=i-t;s>=e?(t=i,n.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),n.apply(this,r),a=null},e-s))}}class Lm extends Dt{static count=0;constructor(){super(),X.register("ColorLitShader",Ad),this.shader=new gt;let e=new qe("ColorLitShader","ColorLitShader");e.passType=de.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new Z),e.setUniformColor("emissiveColor",new Z),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",B.res.normalTexture),e.setTexture("emissiveMap",B.res.blackTexture)}clone(){return null}debug(){}}class Gm extends Dt{constructor(){super();let e=new qe("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=de.COLOR,e.setUniformVector4("transformUV1",new ue(0,0,1,1)),e.setUniformVector4("transformUV2",new ue(0,0,1,1)),e.setUniformColor("baseColor",new Z(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 gt;a.addRenderPass(e),this.shader=a,this.baseMap=B.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 zm(n,e){}class Wm extends Dt{constructor(){super(),this.shader=new d.UnLitTexArrayShader,this.baseMap=B.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 Zo{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 s=new Cr;s.formBytes(e),this.positionCurves.set(s.path,s)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new Cr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let s=new Cr;s.formBytes(e),this.scaleCurves.set(s.path,s)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new Cr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class Cr{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 Vi;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new fe;break;case 3:this._cacheValue=new g;break;case 4:this._cacheValue=new ue;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),s=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(s.time-i.time);ne.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),ne.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),ne.HELP_2.slerp(ne.HELP_0,ne.HELP_1,o),this._cacheValue.x=ne.HELP_2.x,this._cacheValue.y=ne.HELP_2.y,this._cacheValue.z=ne.HELP_2.z,this._cacheValue.w=ne.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 Jm 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 jm{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],s=this.colorArray[r];return Z.lerp(t-a,i,s)}}class Zs{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return g.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,s=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(s))}getTangent(e){if(!(e>=0&&e<=1))return g.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)),s=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(s)}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 s=(t+i)/2,o=(i+a)/2,l=this.getPoint(s),c=this.getPoint(o),f=l.subtract(e).lengthSquared,h=c.subtract(e).lengthSquared;return f<h?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var jh=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(jh||{});class Zm{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],s=a[r*3];t+=i.subtract(s).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 s=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(s);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,h=c.lengthSquared;if(f>0&&h>0){let u=(f+h)/8,b=c.div(h).subtract(l.div(f));b.normalize(),b=b.mul(u),r[o*3-1]=e[o].subtract(b),r[o*3+1]=e[o].add(b)}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 s=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[s].subtract(e[l]),f=e[o].subtract(e[l]),h=c.lengthSquared,u=f.lengthSquared,b=3*i-1,A=(3*i+1)%(this.numControlVertices-1);if(h>0&&u>0){let m=(h+u)/8,p=f.div(u).subtract(c.div(h));p.normalize(),p=p.mul(m),r[b]=e[l].subtract(p),r[A]=e[l].add(p)}else r[b]=e[l],r[A]=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=Ot.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 Zs(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=Ot.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 Zs(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],s=new Zs(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let h=0;h<4;h++)i[h]=this.controlVertices[o+h];s.setControlVertices(i);let l=s.getClosestParam(e,t),f=s.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 Zh=(n=>(n[n.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",n[n.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",n[n.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",n[n.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",n[n.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",n[n.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",n[n.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",n[n.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",n[n.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",n[n.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",n[n.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",n[n.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",n[n.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",n))(Zh||{});const Xm=3.141592653589793;class Hm{}function Yh(n,e,t){let a=.3333333333333333,r=.5,i=n*a,s=i*i,l=s*i-i*e*r+t*r,c=-s+e*a,f=c*c*c,h=f+l*l;if(h>=0){let A=Math.sqrt(h)-l;return A=A>0?Math.pow(A,a):-Math.pow(-A,a),-i-c/A+A}let u=Math.sqrt(-f),b=Math.acos(-l/u);return u=Math.pow(u,a),u=u-c/u,b=-i+u*Math.cos(b*a),b}function Ys(n,e,t,a){let r=1e-5;if(Math.abs(n)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*n*t;if(i<0)return 0;let s=.5/n,o=Math.sqrt(i);return a.r0=(o-e)*s,a.r1=(-o-e)*s,2}function Xh(n,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let s=t/e,o=a/e,l=r/e;n[0]=Yh(s,o,l),i++;let c=e,f=t+e*n[0],h=a+t*n[0]+e*n[0]*n[0];i+=Ys(c,f,h,{r0:n[1],r1:n[2]})}else i+=Ys(t,a,r,{r0:n[1],r1:n[2]});return i}class La{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class rr{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[rr.kMaxNumSegments]=new La,this.integrationCache[rr.kMaxNumSegments]=0,this.doubleIntegrationCache[rr.kMaxNumSegments]=0,this.times[rr.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=fe.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=fe.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],s=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=Xh(c,i,s,o,l);for(let h=0;h<f;h++){let u=c[h]+t[r];u>=t[r]&&u<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(u))}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;Yo(i);let s=t-a;e.integrationCache[r]=e.integrationCache[r-1]+La.EvalSegment(s,i)*s,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+=La.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++)Yo(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)Hh(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<=rr.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+La.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]+La.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 La.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 La,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 s=0;s<this.segmentCount;s++){let o;e.calculateCacheData(o,s,s+1,0),this.segments[s+i].coeff=o.coeff.concat(),this.times[s+i]=e.getKey(s+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 s=0;s<this.segmentCount;s++)this.segments[s].coeff[0]*=t,this.segments[s].coeff[1]*=t,this.segments[s].coeff[2]*=t,this.segments[s].coeff[3]*=t}return!0}}function Hh(n){n[0]/=20,n[1]/=12,n[2]/=6,n[3]/=2}function Yo(n){n[0]/=4,n[1]/=3,n[2]/=2,n[3]/=1}var Kh=(n=>(n[n.kEMScalar=0]="kEMScalar",n[n.kEMOptimized=1]="kEMOptimized",n[n.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",n[n.kEMSlow=3]="kEMSlow",n))(Kh||{}),qh=(n=>(n[n.kMMCScalar=0]="kMMCScalar",n[n.kMMCCurve=1]="kMMCCurve",n[n.kMMCTwoCurves=2]="kMMCTwoCurves",n[n.kMMCTwoConstants=3]="kMMCTwoConstants",n))(qh||{});class Km{max;min}class qm{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class $h{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new Vi,this.maxCurve=new Vi}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?xr(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?xr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?xr(e._minScalar,e._scalar,a):e.minMaxState==2?xr(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 $m{value=0;mode=0;spread=0;speed=new $h;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function ep(n,e){let t=rr.isValidCurve(n.max);return e!=2&&e!=3?t:t&&rr.isValidCurve(n.min)}function tp(n,e,t,a){n.max.buildCurve(e.max,t),a!=2&&a!=3?n.min.buildCurve(e.max,t):n.min.buildCurve(e.min,t)}function ap(n,e){let t=e.getKeyCount();if(t!=0)if(t==1)es(n,e.getKey(0).value);else{let a=t-1;es(n,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Ao;e.calculateCacheData(i,r,r+1,0);let s=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,h=[],u=Ys(s,o,l,{r0:h[0],r1:h[1]});for(let b=0;b<u;b++)h[b]>=0&&h[b]+c<f&&es(n,La.EvalSegment(h[b],i.coeff));es(n,La.EvalSegment(f-c,i.coeff))}}}function es(n,e){n.x=Math.min(n.x,e),n.y=Math.max(n.y,e)}class Or{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class eu{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,s=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-s*l,this.b=s*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?Or.BACK:a>t?Or.FRONT:Or.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function rp(n,e){return Math.random()*e+Math.random()*n+(e-n)*Math.random()}function ip(n,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*n*a+(e-n)*Math.random()*a}function tu(n,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=tu(n,e,t)),i=Math.pow(i,t),i*=e-n,i+=n,i}function xa(n){return n>0?Math.floor(n):Math.floor(n)-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 Xo(n,e){let t=n&15,a=1+(t&7);return t&8&&(a=-a),a*e}function Xs(n,e,t){let a=n&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function ts(n,e,t,a){let r=n&15,i=r<8?e:t,s=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-s:s)}function ui(n,e,t,a,r){let i=n&31,s=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-s:s)+(i&2?-o:o)+(i&4?-l:l)}let ta=[[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 sp(n){let e=xa(n),t=e+1,a=n-e,r=a-1,i,s,o=1-a*a;o*=o,i=o*o*Xo(Ue[e&255],a);let l=1-r*r;return l*=l,s=l*l*Xo(Ue[t&255],r),.25*(i+s)}function np(n,e){const t=.366025403,a=.211324865;let r,i,s,o=(n+e)*t,l=n+o,c=e+o,f=xa(l),h=xa(c),u=(f+h)*a,b=f-u,A=h-u,m=n-b,p=e-A,D,_;m>p?(D=1,_=0):(D=0,_=1);let v=m-D+a,U=p-_+a,y=m-1+2*a,S=p-1+2*a,F=f&255,k=h&255,x=.5-m*m-p*p;x<0?r=0:(x*=x,r=x*x*Xs(Ue[F+Ue[k]],m,p));let w=.5-v*v-U*U;w<0?i=0:(w*=w,i=w*w*Xs(Ue[F+D+Ue[k+_]],v,U));let R=.5-y*y-S*S;return R<0?s=0:(R*=R,s=R*R*Xs(Ue[F+1+Ue[k+1]],y,S)),40*(r+i+s)}function op(n,e,t){const a=.333333333,r=.166666667;let i,s,o,l,c=(n+e+t)*a,f=n+c,h=e+c,u=t+c,b=xa(f),A=xa(h),m=xa(u),p=(b+A+m)*r,D=b-p,_=A-p,v=m-p,U=n-D,y=e-_,S=t-v,F,k,x,w,R,Q;U>=y?y>=S?(F=1,k=0,x=0,w=1,R=1,Q=0):U>=S?(F=1,k=0,x=0,w=1,R=0,Q=1):(F=0,k=0,x=1,w=1,R=0,Q=1):y<S?(F=0,k=0,x=1,w=0,R=1,Q=1):U<S?(F=0,k=1,x=0,w=0,R=1,Q=1):(F=0,k=1,x=0,w=1,R=1,Q=0);let M=U-F+r,j=y-k+r,he=S-x+r,ae=U-w+2*r,P=y-R+2*r,z=S-Q+2*r,W=U-1+3*r,V=y-1+3*r,te=S-1+3*r,J=b&255,K=A&255,ee=m&255,re=.6-U*U-y*y-S*S;re<0?i=0:(re*=re,i=re*re*ts(Ue[J+Ue[K+Ue[ee]]],U,y,S));let oe=.6-M*M-j*j-he*he;oe<0?s=0:(oe*=oe,s=oe*oe*ts(Ue[J+F+Ue[K+k+Ue[ee+x]]],M,j,he));let pe=.6-ae*ae-P*P-z*z;pe<0?o=0:(pe*=pe,o=pe*pe*ts(Ue[J+w+Ue[K+R+Ue[ee+Q]]],ae,P,z));let Te=.6-W*W-V*V-te*te;return Te<0?l=0:(Te*=Te,l=Te*Te*ts(Ue[J+1+Ue[K+1+Ue[ee+1]]],W,V,te)),32*(i+s+o+l)}function lp(n,e,t,a){const r=.309016994,i=.138196601;let s,o,l,c,f,h=(n+e+t+a)*r,u=n+h,b=e+h,A=t+h,m=a+h,p=xa(u),D=xa(b),_=xa(A),v=xa(m),U=(p+D+_+v)*i,y=p-U,S=D-U,F=_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za*za-Wa*Wa-aa*aa-Ja*Ja;return Jr<0?f=0:(Jr*=Jr,f=Jr*Jr*ui(Ue[ua+1+Ue[Pt+1+Ue[wa+1+Ue[ba+1]]]],za,Wa,aa,Ja)),27*(s+o+l+c+f)}class Ho extends fe{static uv_0=new Ho;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),s=r%t;return new ue(i/t,s/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 H.single:{let r=this.getKeyFrame(0);r[a]=t}break;case H.float:{let r=this.getKeyFrame(0);r[a]=t}break;case H.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y}break;case H.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case H.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case H.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[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 Rs,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}=Va.parser(e);this.split(t,a,"value")}{let{t,v:a}=Va.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Va.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outWeight")}}}class cp{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new fe(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new g(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new ue(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 ne(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 Sr{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 Mt extends g{static CALC_VECTOR3D1=new g;static CALC_VECTOR3D2=new g;static CALC_VECTOR3D3=new g;static CALC_VECTOR3D4=new g;static CALC_VECTOR3D5=new g;_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 Mt.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),Mt.CALC_VECTOR3D3.length}}class au{_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,Sr.WalkAble,Sr.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+Mt.calcDistance(a,e)*a.costMultiplier,i=Mt.calcDistance(a,this._endNode),s=r+i;a.openId==this._findIndex?a.f>s&&(a.f=s,a.gg=r,a.h=i,a.parent=e):(a.f=s,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 Mt{_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 ka{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new g;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 g,this._edgeMask=Sr.WalkAble,Mt.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=Mt.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&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(e),ka.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(ka.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(-e),ka.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(ka.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 Mt.equalPoint(e,this._pointA)?this._pointA:Mt.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 Mt.equalPoint(e,this._pointA)?this._pointA:Mt.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&Sr.WalkAble)==Sr.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class De{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new g;static RAY_2=new g;static TEST_RAY=new g;static TEST_RAY_1=new g;static TEST_RAY_2=new g;static CALC_CROSS_POINT=new g;static CALC_CROSS_TEST=new g;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=De.RAY_1,this.rayB=De.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(De.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);De.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var s;if(De.TEST_RAY_1.copyFrom(t.pointA),De.TEST_RAY_1.decrementBy(this.curPoint),De.TEST_RAY_2.copyFrom(t.pointB),De.TEST_RAY_2.decrementBy(this.curPoint),De.TEST_RAY_1.y=0,De.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,De.TEST_RAY_1,De.TEST_RAY_2)||this.isPointAtCenter(this.rayB,De.TEST_RAY_1,De.TEST_RAY_2)?s=!1:s=!0,s)return this.isPointAtCenter(this.rayA,De.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return De.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,De.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){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);let i=De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z;var s=0;return i!=0&&(s=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),s>1?s=1:s<0&&(s=0),De.CALC_CROSS_POINT.scaleBy(s),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(De.CALC_CROSS_POINT.scaleBy(i),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){De.CALC_CROSS_TEST.copyFrom(t),De.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_TEST.x*r.z-r.x*De.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,De.RAY_1.setTo(0,0,0),De.RAY_2.setTo(0,0,0)}}class ir{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new g;constructor(){this._router=new De}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)!=Or.INTERSECT||a[a.length-1].plane.classifyPoint(t,is.EPSILON)!=Or.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,s,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),s=a[r],c=s.plane,s=a[r+1],l=s.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,is.EPSILON)==Or.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,h,u,b;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],s=a[r+1],b=r==i-1,b?l=t:l=s.getEdgeAgainstPoint(o),u=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,b),u||(f=this._router.cornerPoint,h=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(h),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let A=[];for(let m of this._result)A.push(new g().copyFrom(m));this._result=A}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 s=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),s=r.crossPoint;else{i=null,o=null;for(var h=f+1;h<a&&(i=this._tempPublicEdgeList[h],o=i.crossPoint,!o);h++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==s?c=o.clone():(ir.CROSS_TEST_DIRECTION.setTo(o.x-s.x,0,o.z-s.z),c=this._router.calcCrossEdge(r,s,ir.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,s,o,l,c,f,h,u,b,A,m;for(m=0;m<t;m++)c=f=h=null,s=o=l=null,b=!1,A=null,a=this._result[m],r=this._result[m+1],i=this._result[m+2],a instanceof Fa&&(s=a),r instanceof Fa&&(o=r),i instanceof Fa&&(l=i),s&&(c=s.ownerPoint),o&&(f=o.ownerPoint),l&&(h=l.ownerPoint),c&&f&&c==f&&f!=h&&(b=!0),h&&f&&h==f&&c!=f&&(b=!0),b&&(ir.CROSS_TEST_DIRECTION.copyFrom(a),ir.CROSS_TEST_DIRECTION.decrementBy(i),u=o.ownerEdge,b=this._router.hasCrossPoint(u.pointA,u.pointB,i,ir.CROSS_TEST_DIRECTION),b&&(A=this._router.calcCrossPointOut(f,r,i,ir.CROSS_TEST_DIRECTION)),A&&(e[m+1]=A))}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 ru extends g{_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 Qt,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=Sr.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 eu,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,s=this._neibourTriangles.getKeys(),o;for(o of s)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(Sr.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 fp{_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 au,this._nav3dFunnel=new ir,this._terrainQuad=new ch(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),s=this._nav3dAstar.findPath(this,r,i);return s?(this._triangleList=this._nav3dAstar.channel,s=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,s):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new Mt(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,s,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)&&(s=new ru(l,a,r,i),this._nav3dTriangles.push(s))}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 ka(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,s,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&&(s=a.loopPublicEdge(r),s&&(a.addNeibour(s,r),r.addNeibour(s,a)))}}}class Ko{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 Ko;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class Ga extends Ve{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(g.ZERO.clone(),new g(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]),s=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,s),this.setAttribute(G.TEXCOORD_1,s),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class iu extends Ve{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,s=!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=s,this.thetaStart=o,this.thetaLength=l,this.instanceID=Gt(),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 s=0;const o=[],l=this.height/2;let c=0;A(),this.openEnded===!1&&(this.radiusTop>0&&m(!0),this.radiusBottom>0&&m(!1));let f=new Float32Array(t),h=new Float32Array(a),u=new Float32Array(r),b=new Uint16Array(i);this.setAttribute(G.position,f),this.setAttribute(G.normal,h),this.setAttribute(G.uv,u),this.setAttribute(G.TEXCOORD_1,u),this.setIndices(b);function A(){const p=new g,D=new g;let _=0;const v=(e.radiusBottom-e.radiusTop)/e.height;for(let U=0;U<=e.heightSegments;U++){const y=[],S=U/e.heightSegments,F=S*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let k=0;k<=e.radialSegments;k++){const x=k/e.radialSegments;let w=x*e.thetaLength+e.thetaStart;k==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(w=0);const R=Math.sin(w),Q=Math.cos(w);D.x=F*R,D.y=-S*e.height+l,D.z=F*Q,t.push(D.x,D.y,D.z),p.set(R,v,Q).normalize(),a.push(p.x,p.y,p.z),r.push(x,1-S),y.push(s++)}o.push(y)}for(let U=0;U<e.radialSegments;U++)for(let y=0;y<e.heightSegments;y++){const S=o[y][U],F=o[y+1][U],k=o[y+1][U+1],x=o[y][U+1];i.push(S,F,x),i.push(F,k,x),_+=6}e.addGroup(c,_,0),c+=_}function m(p){const D=s,_=new fe,v=new g;let U=0;const y=p===!0?e.radiusTop:e.radiusBottom,S=p===!0?1:-1;for(let k=1;k<=e.radialSegments;k++)t.push(0,l*S,0),a.push(0,S,0),r.push(.5,.5),s++;const F=s;for(let k=0;k<=e.radialSegments;k++){const w=k/e.radialSegments*e.thetaLength+e.thetaStart,R=Math.cos(w),Q=Math.sin(w);v.x=y*Q,v.y=l*S,v.z=y*R,t.push(v.x,v.y,v.z),a.push(0,S,0),_.x=R*.5+.5,_.y=Q*.5*S+.5,r.push(_.x,_.y),s++}for(let k=0;k<e.radialSegments;k++){const x=D+k,w=F+k;p===!0?i.push(w,w+1,x):i.push(w+1,w,x),U+=3}e.addGroup(c,U,p===!0?1:2),c+=U}}}class su extends Ve{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(g.ZERO.clone(),new g(t*2,a*2,t*2));var s=(r+1)*(i+1);let o=new Float32Array(s*3),l=new Float32Array(s*3),c=new Float32Array(s*2),f=new Uint16Array(r*i*2*3),h=0,u=0,b=0,A=0;for(let m=0;m<=r;m++)for(let p=0;p<=i;p++){const D=p/i,_=m/r,v=D*e,U=_*Math.PI*2;if(o[h++]=(t+a*Math.cos(U))*Math.sin(v),o[h++]=a*Math.sin(U),o[h++]=(t+a*Math.cos(U))*Math.cos(v),l[u++]=Math.sin(v)*Math.cos(U),l[u++]=Math.sin(U),l[u++]=Math.cos(v)*Math.cos(U),c[b++]=D,c[b++]=_,p<i&&m<r){const y=i+1,S=y*m+p,F=y*(m+1)+p,k=y*(m+1)+p+1,x=y*m+p+1;f[A++]=S,f[A++]=x,f[A++]=F,f[A++]=x,f[A++]=k,f[A++]=F}}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 dp extends Ve{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 s=i*2,o=s,l=s+1,c=s+2,f=s+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 hp extends Ve{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 s=0;s<this.faceCount;s++){let o=s*3+0,l=s*3+1,c=s*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 up extends ks{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new _s;let t=[];return B.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,B.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 bp extends d.Object3D{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new d.Object3D,t=new d.Object3D,a=new d.Object3D,r=new Ga(2,2,2),i=new Ga(2,2,2),s=new Ga(2,2,2),o=new Bt;o.baseColor=new Z(1,0,0);let l=new Bt;l.baseColor=new Z(0,1,0);let c=new Bt;c.baseColor=new Z(0,0,1);let f=e.addComponent(d.MeshRenderer),h=t.addComponent(d.MeshRenderer),u=a.addComponent(d.MeshRenderer);f.geometry=r,f.material=o,f.castShadow=!1,h.geometry=i,h.material=l,h.castShadow=!1,u.geometry=s,u.material=c,u.castShadow=!1,e.localScale=new g(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new g(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new g(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class gp{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Ve,i=e.getAttribute(G.position).data.length/3,s=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let h=f[1].attribute;if(h==G.indices)continue;let u=e.getAttribute(h).data,b=u.length,A=new Float32Array(b*t);for(let m=0;m<t;m++){A.set(u,b*m);for(let p=0;p<i;p++)s[i*m+p]=m}r.setAttribute(h,A)}r.setAttribute(G.vIndex,s);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 h=0;h<l;h++){let u=f*i,b=f*l;const A=o[h]+u;c[b+h]=A}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 mp extends d.Object3D{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 s=new Ve;s.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),s.setAttribute(G.position,new Float32Array(e)),s.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 Z(1,1,1,.15),o.blendMode=Ae.ADD,o.castReflection=!1;let l=this.addComponent(d.MeshRenderer);l.geometry=s,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 Ve;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 d.Object3D,s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(1,0,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new d.Object3D;i.rotationY=90;let s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(0,1,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class pp{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 Z(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 Ap{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new Ga),this.planeGeo||(this.planeGeo=new $r(1,1,1,1,g.UP)),this.sphere||(this.sphere=new Ir(1,35,35)),this.material||(this.material=new qt),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 d.Object3D,t=e.addComponent(d.MeshRenderer);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 qt,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.geometry=this.planeGeo;let r=this.GetMaterial(e);return r.blendMode=Ae.ADD,r.castShadow=!1,a.material=r,a.castGI=!1,a.castReflection=!1,t}static GetSingleCube(e,t,a,r,i,s){this.initHeap();let o=new qt;o.roughness=.5,o.metallic=.1,o.baseColor=new Z(r,i,s,1);let l=new d.Object3D,c=l.addComponent(d.MeshRenderer);return c.castGI=!0,c.geometry=new Ga(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new qt;i.baseColor=new Z(t,a,r,1);let s=new d.Object3D,o=s.addComponent(d.MeshRenderer);return o.castGI=!0,o.geometry=new Ir(e,20,20),o.material=i,s}static get Sphere(){this.initHeap();let e=new d.Object3D,t=e.addComponent(d.MeshRenderer);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);return r.castShadow=!1,r.geometry=new Ga(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,s,o=1,l=!0){let c=new d.Object3D,f=c.addComponent(d.PointLight);f.lightColor=new Z(r,i,s,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let h=this.GetSingleSphere(.1,1,1,1);return c.addChild(h),f}}var N=(n=>(n[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z",n[n.XY=3]="XY",n[n.XZ=4]="XZ",n[n.YZ=5]="YZ",n[n.XYZ=6]="XYZ",n[n.MAX=7]="MAX",n[n.NONE=8]="NONE",n))(N||{}),ha=(n=>(n[n.Local=0]="Local",n[n.Global=1]="Global",n))(ha||{});class Hs extends $e{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(N.MAX),this.mAxisColor=new Array(N.MAX),this.mAxisMaterial=new Array(N.MAX),this.mAxisCollider=new Array(N.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 d.Object3D;let t=new Bt;t.baseColor=new Z(1,0,0),t.depthCompare=lt.always,this.mAxisColor[N.X]=t.baseColor,this.mAxisMaterial[N.X]=t;let a=new Bt;a.baseColor=new Z(0,1,0),a.depthCompare=lt.always,this.mAxisColor[N.Y]=a.baseColor,this.mAxisMaterial[N.Y]=a;let r=new Bt;r.baseColor=new Z(0,0,1),r.depthCompare=lt.always,this.mAxisColor[N.Z]=r.baseColor,this.mAxisMaterial[N.Z]=r;let i=this.createCustomAxis(N.X),s=this.createCustomAxis(N.Y),o=this.createCustomAxis(N.Z);this.mContainer.addChild(this.mAxis[N.X]=i),this.mContainer.addChild(this.mAxis[N.Y]=s),this.mContainer.addChild(this.mAxis[N.Z]=o),this.mAxisCollider[N.X]=i.getComponent(da),this.mAxisCollider[N.Y]=s.getComponent(da),this.mAxisCollider[N.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=T.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(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||s==N.XYZ)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},s==N.XYZ)))break}return i}currentAxis=N.NONE;beginPoint=new g;beginMousePos=new g;currentPoint=new g;onMouseDown(e){if(e.mouseCode!=Ps.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),s=r.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(s),this.beginMousePos.x=B.inputSystem.mouseX,this.beginMousePos.y=B.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==N.NONE){let t=this.lastMoveObj.getComponent(d.MeshRenderer).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.X]),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Y]),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Z])),this.lastMoveAxis=N.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new Z(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let s=i.subtract(this.beginPoint);g.HELP_0.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let o=g.distance(g.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(g.HELP_0),this.transformSpaceMode){case ha.Local:this.applyLocalTransform(this.currentAxis,s,o);break;case ha.Global:this.applyGlobalTransform(this.currentAxis,s,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Ps.MOUSE_LEFT&&(this.currentAxis=N.NONE,this.reset())}onUpdate(e){let a=g.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 N.X:t=1;break;case N.Y:a=1;break;case N.Z:r=1;break}let i=.4+t*20,s=.4+a*20,o=.4+r*20,l=new d.Object3D;l.x=i*.5,l.y=s*.5,l.z=o*.5;let c=l.addComponent(d.MeshRenderer);c.geometry=new Ga(i,s,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(da),h=new oi;return h.setFromCenterAndSize(new g(0,0,0),new g(i+1,s+1,o+1)),f.shape=h,l}}class nu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(.9,.9,.9),t.depthCompare=lt.always,this.mAxisColor[N.XYZ]=t.baseColor,this.mAxisMaterial[N.XYZ]=t;let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);r.geometry=new Ga(2,2,2),r.material=this.mAxisMaterial[N.XYZ];let i=a.addComponent(da),s=new oi;s.setFromCenterAndSize(new g(0,0,0),new g(2,2,2)),i.shape=s,this.mContainer.addChild(this.mAxis[N.XYZ]=a),this.mAxisCollider[N.XYZ]=a.getComponent(da)}applyLocalTransform(e,t,a){switch(this.currentAxis){case N.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==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=g.HELP_0;r.set(0,0,0),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(r.x=t.x),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(r.y=t.y),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,g.HELP_1),this.mX.scaleX+=g.HELP_1.x,this.mX.scaleY+=g.HELP_1.y,this.mX.scaleZ+=g.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 d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new Ga(2,2,2),c.material=this.mAxisMaterial[e],i}}var mt=(n=>(n[n.Scale=0]="Scale",n[n.Rotation=1]="Rotation",n[n.Translation=2]="Translation",n[n.NONE=3]="NONE",n))(mt||{});class ou extends Hs{applyLocalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ,this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.identity(),T.help_matrix_1.createByRotation(1,g.Y_AXIS),T.help_matrix_2.multiplyMatrices(T.help_matrix_1,T.help_matrix_0),T.help_matrix_2.invert(),T.help_matrix_1.multiplyMatrices(T.help_matrix_2,T.help_matrix_0);let r=T.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),this.currentAxis==N.X){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.x-a.x>0&&(s=360-s),s}if(this.currentAxis==N.Y){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.y-a.y>0&&(s=360-s),s}if(this.currentAxis==N.Z){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.z-a.z>0&&(s=360-s),s}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.Y||this.currentAxis==N.Z){let r=this.getAngle();switch(T.help_matrix_0.identity(),this.currentAxis){case N.X:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.X_AXIS);break;case N.Y:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Y_AXIS);break;case N.Z:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Z_AXIS);break}T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let s=T.help_matrix_1.decompose(sa.QUATERNION)[1];ne.HELP_0.set(s.x,s.y,s.z,s.w),this.mLastAngle=r,this.mX.transform.localRotQuat=ne.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!1,this.mAxis[this.currentAxis].getComponent(d.MeshRenderer).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new d.Object3D;switch(e){case N.X:t.rotationZ=90;break;case N.Y:break;case N.Z:t.rotationX=90;break}let a=t.addComponent(d.MeshRenderer);a.geometry=new su(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;return i.setFromCenterAndSize(new g,new g(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r)){let l=g.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class lu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(0,0,1),t.depthCompare=lt.always,this.mAxisColor[N.XY]=t.baseColor,this.mAxisMaterial[N.XY]=t;let a=new Bt;a.doubleSide=!0,a.baseColor=new Z(0,1,0),a.depthCompare=lt.always,this.mAxisColor[N.XZ]=a.baseColor,this.mAxisMaterial[N.XZ]=a;let r=new Bt;r.doubleSide=!0,r.baseColor=new Z(1,0,0),r.depthCompare=lt.always,this.mAxisColor[N.YZ]=r.baseColor,this.mAxisMaterial[N.YZ]=r;let i=this.createPlane(N.XY),s=this.createPlane(N.XZ),o=this.createPlane(N.YZ);this.mContainer.addChild(this.mAxis[N.XY]=i),this.mContainer.addChild(this.mAxis[N.XZ]=s),this.mContainer.addChild(this.mAxis[N.YZ]=o),this.mAxisCollider[N.XY]=i.getComponent(da),this.mAxisCollider[N.XZ]=s.getComponent(da),this.mAxisCollider[N.YZ]=o.getComponent(da)}applyLocalTransform(e,t,a){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),T.help_matrix_0.transformVector(t,g.HELP_0),this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ||(g.HELP_0.x=0),this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ||(g.HELP_0.y=0),this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ||(g.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(g.HELP_0,g.HELP_1),this.mX.x+=g.HELP_1.x,this.mX.y+=g.HELP_1.y,this.mX.z+=g.HELP_1.z}applyGlobalTransform(e,t,a){T.help_matrix_0.identity(),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&T.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,0,t.z),T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let r=T.help_matrix_1.decompose(sa.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 d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1,i.rotationY=-90;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new iu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;switch(r.shape=i,e){case N.XY:a.geometry=new $r(4,4,1,1,g.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,4,.1));break;case N.XZ:a.geometry=new $r(4,4,1,1,g.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,.1,4));break;case N.YZ:a.geometry=new $r(4,4,1,1,g.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(.1,4,4));break}return t}}class qo extends d.Object3D{static _instance;static get instance(){return this._instance||(this._instance=new qo),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(nu),this.mControllers[mt.Rotation]=this.addComponent(ou),this.mControllers[mt.Translation]=this.addComponent(lu),this.mControllers[mt.Scale].enable=!1,this.mControllers[mt.Rotation].enable=!1,this.mControllers[mt.Translation].enable=!1,this.mXObj=new d.Object3D,this.mYObj=new d.Object3D,this.mZObj=new d.Object3D,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(){B.inputSystem.addEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onMouseDown,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onMouseMove,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){B.inputSystem.removeEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onMouseMove,this),B.inputSystem.removeEventListener(Y.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 Dp=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));d.AccelerateDecelerateInterpolator=z0,d.AccelerateInterpolator=L0,d.AnimationCurve=Vi,d.AnimationCurveT=Cr,d.AnimationMonitor=Mr,d.AnimatorEventKeyframe=Zb,d.AnticipateInterpolator=j0,d.AnticipateOvershootInterpolator=xi,d.ArrayHas=gu,d.ArrayItemIndex=mu,d.AtlasParser=Tf,d.AtmosphericComponent=Vb,d.AtmosphericScatteringSky=yd,d.AtmosphericScatteringSkySetting=Ud,d.AtmosphericScatteringSky_shader=vd,d.AttributeAnimCurve=Rd,d.AxisObject=bp,d.B3DMLoader=er,d.B3DMLoaderBase=Bf,d.B3DMParseUtil=so,d.B3DMParser=ro,d.BRDFLUT=xf,d.BRDFLUTGenerate=Ff,d.BRDF_frag=wl,d.BatchTable=Fs,d.BiMap=Jm,d.BillboardComponent=Ni,d.BillboardType=Ar,d.BitUtil=ic,d.BitmapTexture2D=$a,d.BitmapTexture2DArray=yc,d.BitmapTextureCube=Kn,d.Blend=vc,d.BlendFactor=Uc,d.BlendMode=Ae,d.BlendShapeData=No,d.BlendShapePropertyData=Po,d.BloomPost=zg,d.BlurEffectCreatorBlur_cs=hf,d.BlurEffectCreatorSample_cs=df,d.BlurTexture2DBufferCreator=uf,d.BounceInterpolator=Kt,d.BoundUtil=kn,d.BoundingBox=Ce,d.BoundingSphere=Tr,d.BoundingVolume=Vr,d.BoxColliderShape=oi,d.BoxGeometry=Ga,d.BrdfLut_frag=Bl,d.BsDF_frag=Il,d.BxDF_frag=Rl,d.BxdfDebug_frag=Pl,d.BytesArray=Ls,d.CEvent=bt,d.CEventDispatcher=ja,d.CEventListener=ns,d.CResizeEvent=nr,d.CSM=ia,d.Camera3D=Hr,d.CameraControllerBase=ag,d.CameraType=it,d.CameraUtil=ht,d.CapsuleColliderShape=vg,d.CastPointShadowMaterialPass=Nc,d.CastShadowMaterialPass=Pc,d.Clearcoat_frag=Tl,d.ClusterBoundsSource_cs=m0,d.ClusterConfig=Rt,d.ClusterDebug_frag=cl,d.ClusterLight=Jl,d.ClusterLightingBuffer=g0,d.ClusterLightingRender=A0,d.ClusterLighting_cs=p0,d.CollectInfo=Gc,d.ColliderComponent=da,d.ColliderShape=ut,d.ColliderShapeType=ni,d.Color=Z,d.ColorGradient=jm,d.ColorLitMaterial=Lm,d.ColorLitShader=Ad,d.ColorPassFragmentOutput=Eb,d.ColorPassRenderer=b0,d.ColorUtil=cs,d.ComData=Gs,d.Combine_cs=dd,d.Common_frag=Dl,d.Common_vert=_l,d.ComponentBase=$e,d.ComponentCollect=Ne,d.ComputeGPUBuffer=ei,d.ComputeShader=Se,d.Context3D=al,d.CubeCamera=Qn,d.CubeMapFaceEnum=bf,d.CubeSky_Shader=rn,d.CubicBezierCurve=Zs,d.CubicBezierPath=Zm,d.CubicBezierType=jh,d.CycleInterpolator=Z0,d.CylinderGeometry=iu,d.DDGIIrradianceComputePass=I0,d.DDGIIrradianceGPUBufferReader=Hi,d.DDGIIrradianceVolume=n0,d.DDGIIrradiance_shader=R0,d.DDGILightingPass=P0,d.DDGILighting_shader=M0,d.DDGIMultiBouncePass=Q0,d.DDGIProbeRenderer=N0,d.DEGREES_TO_RADIANS=pt,d.DRACO_DECODER_GLTF_JS=H0,d.DecelerateInterpolator=G0,d.Denoising_cs=hd,d.Depth2DTextureArray=v0,d.DepthCubeArrayTexture=_0,d.DepthMaterialPass=Vc,d.DepthOfFieldPost=Wg,d.DepthOfView_cs=Xf,d.DoubleArray=rs,d.EditorInspector=jr,d.Engine3D=B,d.Entity=s0,d.EntityBatchCollect=zc,d.EntityCollect=$,d.EnvMap_frag=vl,d.ErpImage2CubeMap=jt,d.ErpImage2CubeMapCreateCube_cs=gf,d.ErpImage2CubeMapRgbe2rgba_cs=mf,d.ExtrudeGeometry=xg,d.FAILED=vr,d.FASTFLOOR=xa,d.FXAAPost=Mn,d.FXAAShader=k0,d.FastMathShader=yl,d.FatLineGeometry=ih,d.FatLineMaterial=Ch,d.FatLine_FS=fc,d.FatLine_VS=cc,d.FeatureTable=Ri,d.FileLoader=Tt,d.FirstPersonCameraController=rg,d.Float16ArrayTexture=_s,d.Float32ArrayTexture=i0,d.FlyCameraController=ig,d.FontChar=wf,d.FontInfo=kf,d.FontPage=Ef,d.FontParser=tr,d.ForwardRenderJob=O0,d.FragmentOutput=on,d.FragmentVarying=Sl,d.FrameCache=Ao,d.Frustum=pn,d.FrustumCSM=Bc,d.FrustumCulling_cs=kb,d.FullQuad_vert_wgsl=Nl,d.GBufferFrame=Be,d.GBufferPass=Mc,d.GBufferPost=Jg,d.GBufferStand=sc,d.GBuffer_pass=ln,d.GILighting=Xn,d.GIProbeMaterial=th,d.GIProbeMaterialType=Fo,d.GIProbeShader=Dd,d.GIRenderCompleteEvent=Pn,d.GIRenderStartEvent=Bs,d.GLBChunk=cf,d.GLBHeader=lf,d.GLBParser=Hn,d.GLSLLexer=Cc,d.GLSLLexerToken=Di,d.GLSLPreprocessor=Sc,d.GLSLSyntax=Ec,d.GLTFBinaryExtension=yf,d.GLTFMaterial=hm,d.GLTFParser=_t,d.GLTFSubParser=ys,d.GLTFSubParserCamera=K0,d.GLTFSubParserConverter=of,d.GLTFSubParserMaterial=$0,d.GLTFSubParserMesh=q0,d.GLTFSubParserSkeleton=Yn,d.GLTFSubParserSkin=ef,d.GLTFType=oa,d.GLTF_Accessors=T2,d.GLTF_Info=vs,d.GLTF_Light=E2,d.GLTF_Mesh=I2,d.GLTF_Node=w2,d.GLTF_Primitives=R2,d.GLTF_Scene=k2,d.GPUAddressMode=Ht,d.GPUBlendFactor=pu,d.GPUBufferBase=Za,d.GPUBufferType=ga,d.GPUCompareFunction=lt,d.GPUContext=E,d.GPUCullMode=Vt,d.GPUFilterMode=fr,d.GPUPrimitiveTopology=ls,d.GPUTextureFormat=le,d.GPUVertexFormat=mi,d.GPUVertexStepMode=_u,d.GSplatFormat=di,d.GSplatGeometry=Sn,d.GSplatMaterial=Cn,d.GSplat_FS=Zc,d.GSplat_VS=jc,d.GTAOPost=jg,d.GTAO_cs=Hf,d.GUIAtlasTexture=If,d.GUICanvas=zi,d.GUIConfig=Qr,d.GUIGeometry=Nd,d.GUIGeometryRebuild=Od,d.GUIMaterial=vo,d.GUIPassRenderer=V0,d.GUIPick=Wd,d.GUIPickHelper=Zd,d.GUIQuad=Na,d.GUIQuadAttrEnum=nt,d.GUIRenderer=Ld,d.GUIShader=Bo,d.GUISpace=fa,d.GUISprite=ai,d.GUITexture=mr,d.GaussianSplatParser=lm,d.GenerayRandomDir=zl,d.GeoJsonParser=fm,d.GeoJsonUtil=dm,d.GeoType=Vs,d.GeometryBase=Ve,d.GeometryIndicesBuffer=Hc,d.GeometryUtil=gp,d.GeometryVertexBuffer=Yc,d.GeometryVertexType=kt,d.GetComponentClass=rl,d.GetCountInstanceID=tn,d.GetRepeat=ku,d.GetShader=il,d.GlassShader=wb,d.GlobalBindGroup=ve,d.GlobalBindGroupLayout=An,d.GlobalFog=Zg,d.GlobalFog_shader=po,d.GlobalIlluminationComponent=mg,d.GlobalUniform=sn,d.GlobalUniformGroup=En,d.GodRayPost=Yg,d.GodRay_cs=Kf,d.GridObject=mp,d.HDRTexture=$n,d.HDRTextureCube=xs,d.Hair_frag=jl,d.Hair_shader_op=Rb,d.Hair_shader_tr=Ib,d.HaltonSeq=us,d.Horizontal=Hd,d.HoverCameraController=sg,d.I3DMLoader=va,d.I3DMLoaderBase=Cf,d.I3DMParser=no,d.IBLEnvMapCreator=Df,d.IBLEnvMapCreator_cs=Af,d.IESProfiles=Aa,d.IESProfiles_frag=Fl,d.IKDTreeUserData=Eg,d.ImageType=si,d.IndicesGPUBuffer=Xc,d.Inline_vert=Al,d.InputSystem=tl,d.InstanceDrawComponent=pg,d.InstanceUniform=Ul,d.InstancedMesh=Sf,d.Interpolator=br,d.InterpolatorEnum=Nn,d.IrradianceDataReaderCompleteEvent=gh,d.IrradianceVolumeData_frag=pl,d.Irradiance_frag=El,d.IsEditorInspector=uu,d.IsNonSerialize=$s,d.Joint=tf,d.JointPose=Zn,d.JumperInterpolator=J0,d.KDTreeEntity=Rg,d.KDTreeNode=_r,d.KDTreeRange=nh,d.KDTreeSpace=oh,d.KDTreeUUID=Xi,d.KHR_draco_mesh_compression=jn,d.KHR_lights_punctual=um,d.KHR_materials_clearcoat=rf,d.KHR_materials_emissive_strength=sf,d.KHR_materials_ior=bm,d.KHR_materials_unlit=nf,d.KMZParser=Gf,d.KV=Mo,d.KelvinUtil=pp,d.KeyCode=tt,d.KeyEvent=Ia,d.Keyframe=Rs,d.KeyframeT=as,d.LASLoader=yh,d.LASParser=pm,d.LASUtils=Zt,d.LASVisualizationMode=hi,d.LDRTextureCube=ks,d.LOADED=Oa,d.LOADING=Vo,d.LRUCache=Nh,d.LambertMaterial=Gm,d.Lambert_shader=Yl,d.LightBase=Ei,d.LightData=hs,d.LightEntries=o0,d.LightType=ft,d.LightingFunction_frag=fl,d.Line=vt,d.LineClassification=Jd,d.LinearInterpolator=W0,d.LitMaterial=qt,d.Lit_shader=Ql,d.LoaderBase=gr,d.LoaderEvent=Ig,d.LoaderManager=Ns,d.MAX_VALUE=yu,d.MIN_VALUE=Cu,d.Material=Dt,d.MaterialDataUniformGPUBuffer=Tc,d.MaterialUtilities=Os,d.MathShader=dl,d.MathUtil=Ot,d.Matrix3=Pr,d.Matrix4=T,d.MatrixBindGroup=f0,d.MatrixGPUBuffer=c0,d.MatrixShader=Wl,d.MemoryDO=or,d.MemoryInfo=nl,d.MergeRGBACreator=Mg,d.MergeRGBA_cs=qf,d.MeshColliderShape=Ms,d.MinMaxAnimationCurves=Km,d.MinMaxCurve=$h,d.MinMaxCurveState=qh,d.MinMaxPolyCurves=qm,d.MorePassParser=Og,d.MorePassShader=uh,d.MorphTargetBlender=Hb,d.MorphTargetData=h0,d.MorphTargetFrame=Kb,d.MorphTargetTransformKey=Qd,d.MorphTarget_shader=Xt,d.MouseCode=Ps,d.MultiBouncePass_cs=T0,d.Navi3DAstar=au,d.Navi3DConst=is,d.Navi3DEdge=ka,d.Navi3DFunnel=ir,d.Navi3DMaskType=Sr,d.Navi3DMesh=fp,d.Navi3DPoint=Mt,d.Navi3DPoint2D=Ko,d.Navi3DPointFat=Fa,d.Navi3DRouter=De,d.Navi3DTriangle=ru,d.NonSerialize=qs,d.NormalMap_frag=Cl,d.OAnimationEvent=af,d.OBJParser=wi,d.Object3DEvent=Tg,d.Object3DTransformTools=qo,d.Object3DUtil=Ap,d.ObjectAnimClip=Id,d.OcclusionSystem=Tn,d.Octree=ur,d.OctreeEntity=Jc,d.OrbitController=ng,d.OrderMap=Ym,d.Orientation3D=sa,d.OutLineBlendColor_cs=$f,d.OutlineCalcOutline_cs=ed,d.OutlinePass=Tb,d.OutlinePost=Xg,d.OutlinePostData=ph,d.OutlinePostManager=Ah,d.OutlinePostSlot=mh,d.Outline_cs=td,d.OvershootInterpolator=Y0,d.PARSING=Mh,d.PBRLItShader=Ml,d.PBRLitSSSShader=_d,d.PLUGIN_REGISTERED=wm,d.PNTSLoader=xh,d.PNTSLoaderBase=Sh,d.PNTSParser=Fh,d.ParserBase=rt,d.ParserFormat=Je,d.ParticleSystemCurveEvalMode=Kh,d.ParticleSystemRandomnessIds=Zh,d.PassGenerate=yi,d.PassShader=bh,d.PassType=de,d.PhysicMaterialUniform_frag=hl,d.PickCompute=ah,d.PickFire=rh,d.PickGUIEvent3D=yt,d.PickResult=Dh,d.Picker_cs=ad,d.PingPong=cn,d.PipelinePool=vn,d.Plane3D=eu,d.PlaneClassification=Or,d.PlaneGeometry=$r,d.PlyMode=Sa,d.PlyParser=Io,d.PlyStreamParser=Uh,d.PointClassification=jd,d.PointCloudGeometry=Fn,d.PointCloudMaterial=r0,d.PointCloud_FS=a0,d.PointCloud_VS=t0,d.PointLightShadowRenderer=B0,d.PointShadowCubeCamera=D0,d.PointerEvent3D=Y,d.Polynomial=La,d.PolynomialCurve=rr,d.Polynomials=Hm,d.PoolNode=Gd,d.PostBase=Jt,d.PostProcessingComponent=Wf,d.PostRenderer=S0,d.PreDepthPassRenderer=y0,d.PreFilteredEnvironment_cs=x0,d.PreFilteredEnvironment_cs2=vb,d.PreIntegratedLut=rd,d.PreIntegratedLutCompute=hh,d.PrefabAvatarData=Qo,d.PrefabAvatarParser=kh,d.PrefabBoneData=To,d.PrefabMaterialParser=wh,d.PrefabMeshData=Rh,d.PrefabMeshParser=Ih,d.PrefabNode=$i,d.PrefabParser=Qh,d.PrefabStringUtil=Um,d.PrefabTextureData=Eh,d.PrefabTextureParser=Th,d.Preprocessor=ma,d.PriorityQueue=Lo,d.Probe=eh,d.ProbeEntries=Pg,d.ProbeGBufferFrame=w0,d.ProfilerUtil=ct,d.PropertyAnimClip=jb,d.PropertyAnimTag=Td,d.PropertyAnimation=Do,d.PropertyAnimationClip=Zo,d.PropertyAnimationClipState=wd,d.PropertyAnimationEvent=Li,d.PropertyHelp=Oi,d.QuadAABB=Qt,d.QuadGlsl_fs=Hl,d.QuadGlsl_vs=Xl,d.QuadRoot=ch,d.QuadTree=lh,d.QuadTreeCell=Br,d.Quad_depth2dArray_frag_wgsl=Bu,d.Quad_depth2d_frag_wgsl=Ll,d.Quad_depthCube_frag_wgsl=Gl,d.Quad_frag_wgsl=Ol,d.Quad_vert_wgsl=Vl,d.Quaternion=ne,d.R32UintTexture=Ds,d.RADIANS_TO_DEGREES=Yr,d.RGBEErrorCode=pf,d.RGBEHeader=eo,d.RGBEParser=to,d.RTDescriptor=We,d.RTFrame=st,d.RTResourceConfig=Qa,d.RTResourceMap=wt,d.Rand=pi,d.RandomSeed=Eu,d.Ray=na,d.RayCastMeshDetail=fi,d.Reader=Kr,d.Rect=Ai,d.Reference=xe,d.Reflection=Sd,d.ReflectionCG=oc,d.ReflectionEntries=l0,d.ReflectionMaterial=Fd,d.ReflectionRenderer=F0,d.ReflectionShader=xd,d.ReflectionShader_shader=nc,d.RegisterComponent=Nt,d.RegisterShader=Ta,d.RenderContext=In,d.RenderLayer=Ci,d.RenderLayerUtil=Un,d.RenderNode=Ba,d.RenderShaderCollect=Wc,d.RenderShaderCompute=dh,d.RenderShaderPass=qe,d.RenderTexture=Et,d.RendererBase=Ma,d.RendererJob=E0,d.RendererMap=C0,d.RendererMask=Me,d.RendererMaskUtil=ra,d.RendererPassState=u0,d.RepeatSE=fn,d.Res=zf,d.RotationControlComponents=ou,d.SHCommon_frag=lc,d.SN_ArrayConstant=_i,d.SN_BinaryOperation=hr,d.SN_Break=o2,d.SN_CodeBlock=Da,d.SN_Constant=Ha,d.SN_Continue=ms,d.SN_Declaration=et,d.SN_Discard=l2,d.SN_DoWhileLoop=n2,d.SN_Expression=Fe,d.SN_ForLoop=kr,d.SN_Function=bs,d.SN_FunctionArgs=gs,d.SN_FunctionCall=Fr,d.SN_IFBranch=wr,d.SN_Identifier=Xa,d.SN_IndexOperation=Rr,d.SN_Layout=Ui,d.SN_ParenExpression=Fc,d.SN_Precision=ps,d.SN_Return=Bi,d.SN_SelectOperation=vi,d.SN_Struct=Ya,d.SN_TernaryOperation=kc,d.SN_UnaryOperation=qr,d.SN_WhileLoop=Er,d.SSAO_cs=Ub,d.SSGI2_cs=id,d.SSGIPost=Hg,d.SSRPost=Kg,d.SSR_BlendColor_cs=sd,d.SSR_IS_Kernel=qg,d.SSR_IS_cs=nd,d.SSR_RayTrace_cs=od,d.ScaleControlComponents=nu,d.Scene3D=yg,d.Shader=gt,d.ShaderAttributeInfo=Bn,d.ShaderConverter=wc,d.ShaderConverterResult=Rc,d.ShaderLib=X,d.ShaderPassBase=an,d.ShaderReflection=xt,d.ShaderStage=_a,d.ShaderState=Ic,d.ShaderUniformInfo=_n,d.ShaderUtil=Ka,d.ShadingInput=xl,d.ShadowLightsCollect=Wt,d.ShadowMapPassRenderer=U0,d.ShadowMapping_frag=kl,d.Skeleton=qb,d.SkeletonAnimationClip=Us,d.SkeletonAnimationClipState=Ed,d.SkeletonAnimationCompute=$b,d.SkeletonAnimation_shader=Zr,d.SkeletonBlendComputeArgs=eg,d.SkeletonPose=ki,d.SkeletonTransformComputeArgs=tg,d.SkyGBufferPass=Qc,d.SkyGBuffer_pass=Kl,d.SkyMaterial=Cd,d.SkyRenderer=ws,d.SolidColorSky=up,d.SphereColliderShape=Ug,d.SphereGeometry=Ir,d.SphereReflection=kd,d.StandShader=ff,d.StatementNode=Ge,d.StorageGPUBuffer=Pe,d.StreamLoader=tm,d.StreamingGaussianSplatParser=cm,d.StringUtil=It,d.Struct=gi,d.StructStorageGPUBuffer=Ng,d.SubGeometry=Kc,d.TAACopyTex_cs=ld,d.TAAPost=$g,d.TAASharpTex_cs=cd,d.TAA_cs=fd,d.TestComputeLoadBuffer=ud,d.TextAnchor=Yd,d.TextFieldLayout=qd,d.TextFieldLine=Kd,d.Texture=dt,d.TextureCube=Cs,d.TextureCubeFaceData=ao,d.TextureCubeStdCreator=Ss,d.TextureCubeUtils=qn,d.TextureMipmapCompute=Vg,d.TextureMipmapGenerator=pa,d.TextureScaleCompute=fh,d.ThirdPersonCameraController=lg,d.Tile=Oo,d.TileSet=Qm,d.TileSetChild=Pm,d.TileSetChildContent=Nm,d.TileSetChildContentMetaData=Vm,d.TileSetRoot=Mm,d.TilesRenderer=Tm,d.Time=ze,d.TokenType=C,d.TorusGeometry=su,d.TouchData=el,d.TrailGeometry=dp,d.Transform=zt,d.TransformAxisEnum=N,d.TransformControllerBaseComponent=Hs,d.TransformMode=mt,d.TransformSpaceMode=ha,d.TranslationControlComponents=lu,d.TranslatorContext=Dn,d.TriGeometry=hp,d.Triangle=Zi,d.UIButton=yo,d.UIButtonTransition=$d,d.UIComponentBase=Uo,d.UIEvent=Qg,d.UIImage=Nr,d.UIImageGroup=Co,d.UIInteractive=Qs,d.UIInteractiveStyle=at,d.UIPanel=ji,d.UIRenderAble=Ji,d.UIShadow=So,d.UITextField=xo,d.UITransform=ar,d.UNLOADED=Ur,d.UUID=Gt,d.UV=Ho,d.Uint32ArrayTexture=xn,d.Uint8ArrayTexture=Si,d.UnLit=Zl,d.UnLitMaterial=Bt,d.UnLitMaterialUniform_frag=ul,d.UnLitTexArrayMaterial=Wm,d.UnLitTextureArray=Bd,d.UnLit_frag=bl,d.UniformGPUBuffer=Ct,d.UniformNode=lr,d.UniformType=St,d.ValueEnumType=H,d.ValueOp=cp,d.ValueParser=Va,d.ValueSpread=$m,d.Vector2=fe,d.Vector3=g,d.Vector3Ex=Gi,d.Vector4=ue,d.VertexAttribute=kg,d.VertexAttributeIndexShader=pd,d.VertexAttributeName=G,d.VertexAttributeSize=cr,d.VertexAttributeStride=sh,d.VertexAttributes_vert=gl,d.VertexBufferLayout=Fg,d.VertexFormat=ll,d.VertexGPUBuffer=As,d.Vertical=Xd,d.VideoUniform_frag=ml,d.View3D=Cg,d.ViewPanel=Is,d.ViewQuad=Rn,d.VirtualTexture=Ie,d.WGS84_FLATTENING=km,d.WGS84_HEIGHT=Em,d.WGS84_RADIUS=Fm,d.WGSLTranslator=xc,d.WayLines3D=Pi,d.WayPoint3D=Mi,d.WebGPUDescriptorCreator=Ye,d.WorldMatrixUniform=nn,d.WorldPanel=Ts,d.WrapMode=li,d.WrapTimeMode=Dr,d.ZCullingCompute=Gg,d.ZPassShader_cs=md,d.ZPassShader_fs=rc,d.ZPassShader_vs=ac,d.ZSorterUtil=Oc,d.append=_c,d.arrayToString=_f,d.blendComponent=Au,d.buildCurves=tp,d.byteSizeOfType=ea,d.calculateCurveRangesValue=ap,d.calculateMinMax=es,d.castPointShadowMap_vert=$l,d.clamp=_e,d.clampRepeat=qu,d.computeAABBFromPositions=ko,d.cos=zu,d.crossProduct=Xu,d.cubicPolynomialRoot=Yh,d.cubicPolynomialRootsGeneric=Xh,d.curvesSupportProcedural=ep,d.deg2Rad=Ou,d.detectGSplatFormat=_h,d.directionShadowCastMap_frag=tc,d.dot=Ft,d.doubleIntegrateSegment=Hh,d.downSample=Zf,d.fastInvSqrt=Ac,d.floorfToIntPos=pc,d.fonts=ri,d.generateRandom=Hu,d.generateRandom3=Ku,d.getFloatFromInt=bc,d.getGLTypeFromTypedArray=j2,d.getGLTypeFromTypedArrayType=J2,d.getGlobalRandomSeed=Wu,d.getTypedArray=Z2,d.getTypedArrayTypeFromGLType=Jn,d.grad1=Xo,d.grad2=Xs,d.grad3=ts,d.grad4=ui,d.inferSHOrder=wo,d.integrateSegment=Yo,d.irradianceDataReader=Lg,d.kPI=Xm,d.lerp=xr,d.lerpByte=Fu,d.lerpColor=xu,d.lerpVector3=Su,d.lruPriorityCallback=Jh,d.magnitude=hn,d.makeAloneSprite=ab,d.makeGUISprite=Rf,d.makeMatrix44=ds,d.markUsedSetLeaves=jo,d.markUsedTiles=Ws,d.markVisibleTiles=Js,d.matrixMultiply=mn,d.matrixRotate=a2,d.matrixRotateY=t2,d.mergeFunctions=os,d.multiplyMatrices4x4REF=Dc,d.normal_distribution=tu,d.normalizeFast=Yu,d.normalizeSafe=uc,d.normalizedToByte=Zu,d.normalizedToWord=ju,d.outlinePostData=Ca,d.outlinePostManager=em,d.parsePlyGaussianSplat=Ro,d.parsePlyHeader=qi,d.parsePlyMesh=Bh,d.parsePlyPointCloud=vh,d.perm=Ue,d.post=Yf,d.priorityCallback=Wh,d.quadraticPolynomialRootsGeneric=Ys,d.rad2Deg=Lu,d.random01=Xr,d.randomBarycentricCoord=Vu,d.randomPointBetweenEllipsoid=Nu,d.randomPointBetweenSphere=Mu,d.randomPointInsideCube=Tu,d.randomPointInsideEllipsoid=Qu,d.randomPointInsideUnitCircle=Pu,d.randomPointInsideUnitSphere=mc,d.randomQuaternion=Ru,d.randomQuaternionUniformDistribution=Iu,d.randomUnitVector=fs,d.randomUnitVector2=gc,d.rangedRandomFloat=At,d.rangedRandomInt=wu,d.readByType=be,d.readMagicBytes=ti,d.registerMaterial=zm,d.repeat=gn,d.rotMatrix=e2,d.rotateVectorByQuat=Uu,d.roundfToIntPos=un,d.scale=dn,d.shadowCastMap_frag=ec,d.shadowCastMap_vert=ql,d.simplex=ta,d.sin=Gu,d.snoise1=sp,d.snoise2=np,d.snoise3=op,d.snoise4=lp,d.splatColorProperties=Eo,d.splatProperties=Ki,d.sqrMagnitude=bn,d.sqrtImpl=hc,d.stencilStateFace=Du,d.swap=Ju,d.textureCompress=bd,d.threshold=jf,d.throttle=Om,d.toHalfFloat=qa,d.toggleTiles=js,d.traverseAncestors=Rm,d.traverseSet=Vh,d.tw=Fb,d.uniform_real_distribution=rp,d.uniform_real_distribution2=ip,d.upSample=mo,d.webGPUContext=I,d.zSorterUtil=Lc,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
11855
+ `).filter(Boolean),i=[];for(const s of r){const o=Zt.parseParameterLine(s);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 s=i.split(/\s+/).filter(c=>c.trim().length>0).map(c=>Zt.convertToValue(c.trim()));if(s.length===0)throw new Error("LASLoader: No data values found");const o=Math.floor(s.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 h=0;h<t.length;h++){const u=c*t.length+h;u<s.length&&f.push(s[u])}f.length===t.length&&l.push(f)}return l}}var hi=(n=>(n.PointCloud="pointcloud",n.Curve="curve",n.WellTrajectory="trajectory",n))(hi||{}),gm=Object.getOwnPropertyDescriptor,mm=(n,e,t,a)=>{for(var r=a>1?void 0:a?gm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.FatLineShader=class extends gt{constructor(){super();const e=new qe("FatLine_VS","FatLine_FS");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);const t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,t.cullMode=Vt.none,t.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new Z(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new fe(1920,1080));const e=new T;this.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}},d.FatLineShader=mm([Ta(d.FatLineShader,"FatLineShader")],d.FatLineShader);class Ch extends Dt{constructor(){super(),this.shader=new d.FatLineShader,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 pm extends rt{static format=Je.BIN;visualizationMode=hi.PointCloud;async parseBuffer(e){const a=await new yh().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 hi.PointCloud:a=this.createPointCloudVisualization(t);break;case hi.Curve:a=this.createCurveVisualization(t);break;case hi.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 d.Object3D;t.name="LASPointCloud";const a=new d.Object3D;a.name="LASPointCloudRoot",t.addChild(a);const r=a.addComponent(d.PointCloudRenderer);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 s=t.map((D,_)=>_).filter(D=>D!==i).slice(0,2),o=a.filter(D=>!D.some(_=>_===r||_===+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 h=1/0,u=-1/0,b=1/0,A=-1/0;if(s.length>0){const D=o.map(_=>+_[s[0]]).filter(_=>!isNaN(_));if(h=Math.min(...D),u=Math.max(...D),s.length>1){const _=o.map(v=>+v[s[1]]).filter(v=>!isNaN(v));b=Math.min(..._),A=Math.max(..._)}}for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=D*4;if(c[v+2]=+_[i],s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;if(c[v+0]=S*10,s.length>1){const F=+_[s[1]],k=A!==b?(F-b)/(A-b):0;c[v+1]=k*10}else c[v+1]=0}else c[v+0]=0,c[v+1]=0;if(s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;this.mapValueToColor(S,f,U)}else f[U+0]=255,f[U+1]=255,f[U+2]=255,f[U+3]=255}const m=new d.Object3D;m.name="LASPointCloud";const p=m.addComponent(d.PointCloudRenderer);return p.initFromData(c,f,l),p.setPointShape("circle"),p.setPointSize(4),m}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 s=t.map((D,_)=>_).find(D=>D!==i);if(s===void 0)throw new Error("LASParser: No curve column found");const o=a.filter(D=>{const _=+D[i],v=+D[s];return!isNaN(_)&&!isNaN(v)&&v!==r&&v!==+r});if(o.length===0)throw new Error("LASParser: No valid data points");const l=o.map(D=>+D[s]),c=Math.min(...l),h=Math.max(...l)-c,u=new Float32Array(o.length*3);for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=+_[i],y=+_[s];u[v+2]=U;const S=h>0?(y-c)/h:0;u[v+0]=S*10,u[v+1]=0}const b=new ih;b.setPositions(u);const A=new Ch;A.baseColor=new Z(1,0,0,1),A.lineWidth=2;const m=new d.Object3D;m.name=`LASCurve_${t[s]}`;const p=m.addComponent(d.FatLineRenderer);return p.geometry=b,p.material=A,m}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),s=Math.max(...r);return s!==i?(e-i)/(s-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 Io extends rt{static format=Je.BIN;static cloudImageProcessParam="";async parseBuffer(e){switch(qi(e).mode){case Sa.Splat:{const a=Ro(e),r={count:a.vertexCount,position:a.position,rotation:a.rotation,scale:a.scale,opacity:a.opacity,sh:a.sh};r.bbox=ko(a.position);const i=new d.Object3D;i.name="GaussianSplat",i.addComponent(d.GSplatRenderer).initAsset(r),this.data=i;break}case Sa.PointCloud:{const a=vh(e),r=new d.Object3D;r.name="PLYPointCloud";const i=new d.Object3D;i.name="PLYPointCloudRoot",r.addChild(i);const s=i.addComponent(d.PointCloudRenderer);if(a.color)s.initFromData(a.position,a.color,a.vertexCount);else{const o=new Uint8Array(a.vertexCount*4);o.fill(255),s.initFromData(a.position,o,a.vertexCount)}s.setPointShape("circle"),s.setPointSize(4),this.data=r;break}case Sa.Mesh:{const a=Bh(e),r=new d.Object3D;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 s=new Map;if(a.textureFiles&&a.textureFiles.length>0){const o=[];for(let l=0;l<a.textureFiles.length;l++){const c=new qt,f=It.normalizePath(this.baseUrl+a.textureFiles[l]);o.push(B.res.loadTexture(f+Io.cloudImageProcessParam).then(h=>{c.baseMap=h,s.set(l,c)}))}await Promise.all(o)}s.size===0&&s.set(0,new qt);for(const[o,l]of i){const c=[];for(const A of l){const m=A*3;c.push(a.indices[m+0],a.indices[m+1],a.indices[m+2])}const f=new Ve;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 h=s.get(o);h||(h=s.values().next().value||new qt);const u=new d.Object3D;u.name=`PLYMesh_Texture_${o}`;const b=u.addComponent(d.MeshRenderer);b.geometry=f,b.material=h,r.addChild(u)}this.data=r;break}}}verification(){return!!this.data}}class Sh{async parse(e){const t=new DataView(e),a=ti(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 s=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,h=new Ri(e,f,s,o),u=f+s+o,b=h.header.POINTS_LENGTH||0,A=new Fs(e,b,u,l,c);return{version:r,featureTable:h,batchTable:A}}}class xh extends Sh{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 b=await this.parseDraco(a,o,i);l=b.positions,c=b.colors,b.normals}else l=this.parsePositions(a,i),c=this.parseColors(a,i),this.parseNormals(a,i);const f=new d.Object3D,h=f.addComponent(d.PointCloudRenderer);h.initFromData(l,c,i),h.setPointShape("circle"),h.setPointSize(4);const u=a.getData("RTC_CENTER",1,"FLOAT","VEC3");return u&&f.transform.localPosition.set(u[0],u[1],u[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"),s=e.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3");if(!i||!s)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]+s[0],o[f+1]=r[f+1]/l*i[1]+s[1],o[f+2]=r[f+2]/l*i[2]+s[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,h=c*4;l[h+0]=r[f+0],l[h+1]=r[f+1],l[h+2]=r[f+2],l[h+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]),h=c*4;l[h+0]=f[0],l[h+1]=f[1],l[h+2]=f[2],l[h+3]=255}return l}const s=e.getData("CONSTANT_RGBA",1,"UNSIGNED_BYTE","VEC4");if(s){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*4;l[f+0]=s[0],l[f+1]=s[1],l[f+2]=s[2],l[f+3]=s[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,s=e[i]/255,o=e[i+1]/255,l=s*2-1,c=o*2-1,f=1-Math.abs(l)-Math.abs(c);let h,u;f<0?(h=(l>=0?1:-1)*(1-Math.abs(c)),u=(c>=0?1:-1)*(1-Math.abs(l))):(h=l,u=c);const b=Math.sqrt(h*h+u*u+f*f),A=r*3;a[A+0]=h/b,a[A+1]=u/b,a[A+2]=f/b}return a}async parseDraco(e,t,a){throw new Error("Draco compression not yet implemented")}}class Fh extends rt{static format=Je.BIN;async parseBuffer(e){const a=await new xh().parse(e),r=new d.Object3D;r.name="PNTS",r.addChild(a),this.data=r}verification(){if(this.data)return!0;throw new Error("PNTSParser: Parse failed")}}class To{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 To;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class kh extends rt{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()),B.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 H=(n=>(n[n.single=0]="single",n[n.boolean=1]="boolean",n[n.int=2]="int",n[n.int16=3]="int16",n[n.int32=4]="int32",n[n.float=5]="float",n[n.long=6]="long",n[n.uint=7]="uint",n[n.uint32=8]="uint32",n[n.uint64=9]="uint64",n[n.double=10]="double",n[n.string=11]="string",n[n.singleArray=12]="singleArray",n[n.stringArray=13]="stringArray",n[n.floatArray=14]="floatArray",n[n.vector2=15]="vector2",n[n.vector3=16]="vector3",n[n.vector4=17]="vector4",n[n.color=18]="color",n[n.color32=19]="color32",n[n.animationCurve=20]="animationCurve",n[n.quaternion=21]="quaternion",n[n.matrix4x4=22]="matrix4x4",n[n.mesh=23]="mesh",n[n.texture=24]="texture",n[n.material=25]="material",n[n.materials=26]="materials",n[n.skeleton=27]="skeleton",n[n.animClip=28]="animClip",n[n.vector2Int=29]="vector2Int",n[n.int32List=30]="int32List",n[n.colorList=31]="colorList",n[n.color32List=32]="color32List",n))(H||{});class Os{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=il(t);if(r){let i=new Dt;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 H.color:case H.color32:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformColor(i,s)}break;case H.single:case H.float:case H.int:case H.int16:case H.int32:case H.uint:case H.uint32:case H.uint64:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.singleArray:{let s=r.getValue()[0];i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.vector2:case H.vector2Int:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector2(i,s)}break;case H.vector3:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector3(i,s)}break;case H.vector4:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector4(i,s)}break}}}}class Va{static parser(e){switch(e.readInt32()){case H.single:return{t:H.single,v:e.readFloat32()};case H.boolean:return{t:H.boolean,v:e.readBoolean()};case H.int:return{t:H.int,v:e.readInt32()};case H.int16:return{t:H.int16,v:e.readInt16()};case H.int32:return{t:H.int32,v:e.readInt32()};case H.float:return{t:H.float,v:e.readFloat32()};case H.long:return{t:H.long,v:e.readFloat64()};case H.uint:return{t:H.uint,v:e.readUnit32()};case H.uint32:return{t:H.uint32,v:e.readUnit32()};case H.uint64:return{t:H.uint64,v:e.readUnit32()};case H.double:return{t:H.double,v:e.readFloat64()};case H.string:return{t:H.string,v:e.readUTF()};case H.singleArray:return{t:H.singleArray,v:e.readFloatArray()};case H.stringArray:return{t:H.stringArray,v:e.readStringArray()};case H.floatArray:return{t:H.floatArray,v:e.readFloatArray()};case H.vector2:return{t:H.vector2,v:e.readVector2()};case H.vector3:return{t:H.vector3,v:e.readVector3()};case H.vector4:return{t:H.vector4,v:e.readVector4()};case H.color:return{t:H.color,v:e.readColor()};case H.color32:return{t:H.color32,v:e.readColor()};case H.animationCurve:return{t:H.animationCurve,v:null};case H.quaternion:return{t:H.quaternion,v:e.readQuaternion()};case H.matrix4x4:return{t:H.matrix4x4,v:null};case H.mesh:{let o=e.readUTF(),l=B.res.getGeometry(o);return{t:H.mesh,v:l}}case H.texture:{let o=e.readUTF(),l=B.res.getTexture(o);return{t:H.texture,v:l}}case H.material:{let o=e.readUTF(),l=B.res.getMat(o);return{t:H.material,v:l}}case H.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let h=B.res.getMat(f);l.push(h)}return{t:H.materials,v:l}}case H.skeleton:break;case H.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new Zo;f.formBytes(e),o.push(f)}return{t:H.animClip,v:o}}case H.vector2Int:return{t:H.vector2Int,v:e.readVector2int()};case H.int32List:return{t:H.int32List,v:e.readInt32List()};case H.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Va.parser(e).v;r.push(l)}return{t:H.colorList,v:r};case H.color32List:let i=e.readInt32(),s=[];for(let o=0;o<i;o++){const l=Va.parser(e).v;s.push(l)}return{t:H.color32List,v:s}}}}class Mo{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Va.parser(e);this.type=t,this._data=a}}class Eh{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class wh extends rt{static format=Je.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),s=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],h=[],u=i.readInt32();for(let m=0;m<u;m++){let p=new Mo;p.formBytes(i),f.push(p)}let b=i.readInt32();for(let m=0;m<b;m++){let p=i.readBytesArray(),D=new Eh;D.property=p.readUTF(),D.name=p.readUTF(),D.texture=B.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(),h.push(D)}let A=Os.GetMaterial(c);A.name=s;for(let m=0;m<l.length;m++){const p=l[m];A.shader.setDefine(p,!0)}Os.applyMaterialTexture(A,h),Os.applyMaterialProperties(A,f),B.res.addMat(o,A)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Po{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 No{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 Po;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class Rh{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class Ih extends rt{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 Rh,s=e.readBytesArray();i.meshName=s.readUTF(),i.meshID=s.readUTF(),s.readFloat32()>0,s.readFloat32()>0,s.readFloat32()>0;let o=s.readFloat32()>0,l=s.readFloat32()>0;o&&(i.bones=s.readStringArray(),i.bindPose=s.readMatrix44Array()),l&&(i.blendShapeData=new No,i.blendShapeData.formBytes(s));let c=s.readBytesArray(),f=s.readBytesArray(),h=c.readInt32(),u=0,b=[];for(let _=0;_<h;_++)b[_]={},b[_].att=Am[c.readUTF()],b[_].dim=c.readInt32(),u+=b[_].dim,b[_].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let A=s.readInt32Array(),m=[],p=s.readInt32();for(let _=0;_<p;_++){let v=s.readInt32(),U=s.readInt32(),y=s.readInt32(),S=s.readInt32(),F=s.readInt32(),k=s.readInt32();s.readVector3(),s.readVector3();let x={indexStart:U,indexCount:y,vertexStart:S,vertexCount:k,firstStart:F,topology:v,index:_};m.push(x)}A.length>65535?i.indices=new Uint32Array(A):i.indices=new Uint16Array(A);let D=new Ve;if(D.vertexDim=u,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 _=0;_<i.blendShapeData.blendCount;_++){D.setAttribute("a_morphPositions_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendPositionList),D.setAttribute("a_morphNormals_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendNormalList);for(let v=0;v<i.blendShapeData.blendCount;v++){let U=i.blendShapeData.shapeNames[v],y=i.blendShapeData.shapeIndexs[v];D.morphTargetDictionary[U]=y}}}for(let _=0;_<b.length;_++){const v=b[_].att;D.setAttribute(v,null)}for(let _=0;_<m.length;_++){const v=m[_];D.addSubGeometry(v)}D.name=i.meshName,B.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let Am={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 Ls 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 Ls(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 fe;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new fe;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new g;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 ue;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 Z;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 ne;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 T,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 Th extends rt{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();Qh.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let s=await B.res.loadBitmapTextures(i,B.setting.loader.numConcurrent,a,!0);for(const o of s)B.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var Dm=Object.getOwnPropertyDescriptor,_m=(n,e,t,a)=>{for(var r=a>1?void 0:a?Dm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitSSSShader=class extends gt{constructor(){super(),X.register("PBRLitSSSShader",_d);let e=new qe("PBRLitSSSShader","PBRLitSSSShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.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 hh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(1,1,1)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.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 Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new Z(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _SSSMap(e){this.setTexture("sssMap",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?Vt.none:t.shaderState.cullMode}set _SkinColor(e){this.setUniformColor("skinColor",e)}set _SkinPower(e){this.setUniformFloat("skinPower",e)}set _SkinColorIns(e){this.setUniformFloat("skinColorIns",e)}set curveFactor(e){this.setUniformFloat("curveFactor",e)}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitSSSShader=_m([Ta(d.LitSSSShader,"LitSSSShader")],d.LitSSSShader);var Bm=Object.getOwnPropertyDescriptor,vm=(n,e,t,a)=>{for(var r=a>1?void 0:a?Bm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitShader=class extends gt{constructor(){super();let e=new qe("PBRLItShader","PBRLItShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(0,0,0)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.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 Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=B.res.grayTexture,this._BumpMap=B.res.normalTexture,this._MaskTex=B.res.maskTexture}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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitShader=vm([Ta(d.LitShader,"LitShader")],d.LitShader);class Gs{comName;data;static parser(e){let t=e.readBytesArray(),a=new Gs;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let s=new Mo;s.formBytes(t),a.data.push(s)}return a}}class $i{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new $i;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 s=0;s<r;s++){const o=Gs.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let s=0;s<i;s++){const o=$i.parser(t);a.child.push(o)}return a}}class Qh extends rt{static useWebp=!0;static format=Je.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new Ls(e,0);await Th.parserTexture(t,this,this.loaderFunctions),kh.parser(t,this),Ih.parserMeshs(t,this),wh.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return $i.parser(e)}parserNodeTree(e){let t=new d.Object3D;if(t.localPosition=g.serialize(e.position),t.localQuaternion=ne.serialize(e.rotation),t.localScale=g.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,s=rl(r.comName);if(s){i=t.getOrAddComponent(s);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 Um{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 s=a[i];r.push(s)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var ym=Object.getOwnPropertyDescriptor,Cm=(n,e,t,a)=>{for(var r=a>1?void 0:a?ym(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitShader=class extends gt{constructor(){super();let e=new qe("UnLit","UnLit");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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitShader=Cm([Ta(d.UnLitShader,"UnLitShader")],d.UnLitShader);var Sm=Object.getOwnPropertyDescriptor,xm=(n,e,t,a)=>{for(var r=a>1?void 0:a?Sm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitTexArrayShader=class extends gt{constructor(){super(),X.register("VertexAttributeIndexShader",pd),X.register("UnLitTextureArray",Bd);let e=new qe("UnLitTextureArray","UnLitTextureArray");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 ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),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?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitTexArrayShader=xm([Ta(d.UnLitTexArrayShader,"UnLitTexArrayShader")],d.UnLitTexArrayShader);const vr=-1,Ur=0,Vo=1,Mh=2,Oa=3,Fm=6378137,km=1/298.257223563,Em=6356752314245179e-9,wm=Symbol("PLUGIN_REGISTERED");class Oo{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=Ur;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 Ph=2**30;class Nh{minSize=6e3;maxSize=8e3;minBytesSize=.3*Ph;maxBytesSize=.4*Ph;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,s=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-s<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,s+=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 Lo{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}),s={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,s),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(s=>{i.reject(s),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function Vh(n,e=null,t=null){const a=[];for(a.push(n),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),s=a.pop();if(e&&e(s,i,r)===!0){t&&t(s,i,r);return}const o=s.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(s),a.push(r+1);if(t&&t(s,i,r)===!0)return}}function Rm(n,e){let t=n;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const zs={inView:!1,error:1/0,distanceFromCamera:1/0},Oh=!0;function Lh(n){return n===Oa||n===vr}function yr(n,e){return n.lastFrameVisited===e&&n.used}function Gh(n){return n.childrenProcessed===n.children.length}function Go(n){return n.hasUnrenderableContent||n.parent!==null&&n.parent.geometricError<n.geometricError}function zo(n,e){n.lastFrameVisited!==e.frameCount&&(n.usedLastFrame=n.used,n.lastFrameVisited=e.frameCount,n.used=!1,n.inFrustum=!1,n.isLeaf=!1,n.visible=!1,n.active=!1,n.error=1/0,n.distanceFromCamera=1/0,n.allChildrenReady=!1,e.calculateTileViewError(n,zs),n.inFrustum=zs.inView,n.error=zs.error,n.distanceFromCamera=zs.distanceFromCamera)}function Wo(n,e,t=!1){n.used||(t||(n.used=!0,e.stats.used++),e.markTileUsed(n),n.inFrustum===!0&&e.stats.inFrustum++)}function Im(n,e){if(n.canTraverse&&n.canTraverseFrame===e.frameCount)return n.canTraverse;let t=!1;return n.error<=e.errorTarget&&!Go(n)||n.depth>=e.maxDepth||!n.children||n.children.length===0?t=!1:t=!0,n.canTraverse=t,n.canTraverseFrame=e.frameCount,t}function Jo(n,e,t=!1){if(e.ensureChildrenArePreprocessed(n),zo(n,e),Wo(n,e,t),Go(n)&&Gh(n)){const a=n.children;for(let r=0,i=a.length;r<i;r++)Jo(a[r],e,t)}}function Ws(n,e){if(e.ensureChildrenArePreprocessed(n),zo(n,e),!n.inFrustum)return;if(!Im(n,e)){Wo(n,e);const s=n.children;if(!n.hasContent&&s&&s.length>0)for(let o=0,l=s.length;o<l;o++){const c=s[o];Ws(c,e)}return}const a=n.children;let r=!1,i=!1;for(let s=0,o=a.length;s<o;s++){const l=a[s];Ws(l,e),r=r||yr(l,e.frameCount),i=i||l.inFrustum}if(n.refine==="REPLACE"&&!i&&a.length!==0){n.inFrustum=!1;for(let s=0,o=a.length;s<o;s++)Jo(a[s],e,!0);return}if(Wo(n,e),n.refine==="REPLACE"&&(r&&n.depth!==0||Oh))for(let s=0,o=a.length;s<o;s++)Jo(a[s],e)}function jo(n,e){const t=e.frameCount;if(!yr(n,t))return;const a=n.children;let r=!1;for(let i=0,s=a.length;i<s;i++){const o=a[i];r=r||yr(o,t)}if(!r)n.isLeaf=!0;else{let i=!0;for(let s=0,o=a.length;s<o;s++){const l=a[s];if(jo(l,e),yr(l,t)){const c=!Go(l);let f=!l.hasContent||l.hasRenderableContent&&Lh(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===vr;f=c&&f||l.allChildrenReady,i=i&&f}}n.allChildrenReady=i}}function zh(n,e){if(e.ensureChildrenArePreprocessed(n),yr(n,e.frameCount)&&(n.hasContent&&e.queueTileForDownload(n),Gh(n))){const t=n.children;for(let a=0,r=t.length;a<r;a++)zh(t[a],e)}}function Js(n,e){const t=e.stats;if(!yr(n,e.frameCount))return;if(n.isLeaf){n.loadingState===Oa?(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++):n.hasContent&&e.queueTileForDownload(n);return}const a=n.children,r=n.hasContent,i=Lh(n.loadingState)&&r,s=(e.errorTarget+1)*(e.errorThreshold||1),o=n.error<=s,l=n.refine==="ADD",c=n.allChildrenReady||n.depth===0&&!Oh;if(r&&(o||l)&&e.queueTileForDownload(n),(o&&i&&!c||i&&l)&&(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++),!l&&o&&!c)for(let f=0,h=a.length;f<h;f++){const u=a[f];yr(u,e.frameCount)&&zh(u,e)}else for(let f=0,h=a.length;f<h;f++)Js(a[f],e)}function js(n,e){const t=yr(n,e.frameCount);if(t||n.usedLastFrame){let a=!1,r=!1;if(t?(a=n.active,r=n.visible):zo(n,e),n.hasRenderableContent&&n.loadingState===Oa){const s=n.__wasSetVisible;n.__wasSetActive!==a&&(e.setTileDelayedActive(n,a),n.__wasSetActive=a),s!==r&&(e.setTileDelayedVisible(n,r),n.__wasSetVisible=r)}n.usedLastFrame=t;const i=n.children;for(let s=0,o=i.length;s<o;s++)js(i[s],e)}}class Vr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Vr.s_tmpMatrix||(Vr.s_tmpMatrix=new T),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 g(e[0],e[1],e[2]),a=new g(e[3],e[4],e[5]),r=new g(e[6],e[7],e[8]),i=new g(e[9],e[10],e[11]),s=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),h=i.clone().normalize();this._matrix=new T;const u=this._matrix.rawData;u[0]=c.x,u[1]=c.y,u[2]=c.z,u[3]=0,u[4]=f.x,u[5]=f.y,u[6]=f.z,u[7]=0,u[8]=h.x,u[9]=h.y,u[10]=h.z,u[11]=0,u[12]=t.x,u[13]=t.y,u[14]=t.z,u[15]=1;const b=new g(s*2,o*2,l*2);this._box=new Ce(new g(0,0,0),b)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new g(e[0],e[1],e[2]),a=e[3];this._sphere=new Tr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,s,o]=e,l=new g((t+r)/2,(a+i)/2,(s+o)/2),c=new g(Math.abs(r-t),Math.abs(i-a),Math.abs(o-s));this._box=new Ce(l,c),this._matrix=new T,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new g(a.x-r,a.y-r,a.z-r),s=new g(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,s),t){const o=[new g(i.x,i.y,i.z),new g(s.x,i.y,i.z),new g(i.x,s.y,i.z),new g(s.x,s.y,i.z),new g(i.x,i.y,s.z),new g(s.x,i.y,s.z),new g(i.x,s.y,s.z),new g(s.x,s.y,s.z)];o.forEach(l=>{const c=new g;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Vr.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 g(r.min.x,r.min.y,r.min.z),new g(r.max.x,r.min.y,r.min.z),new g(r.min.x,r.max.y,r.min.z),new g(r.max.x,r.max.y,r.min.z),new g(r.min.x,r.min.y,r.max.z),new g(r.max.x,r.min.y,r.max.z),new g(r.min.x,r.max.y,r.max.z),new g(r.max.x,r.max.y,r.max.z)];i.forEach(s=>{const o=new g;a.transformPoint(s,o),s.copyFrom(o)}),e.makeEmpty(),i.forEach(s=>{e.expandByPoint(s)})}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 g;t.transformPoint(a,o),r=o}const i=this._sphere.radius,s=e.clone().subtract(r).length;return Math.max(0,s-i)}else if(this._box){const a=new Ce;this.getAABB(a,t);const r=a.center,i=a.size,s=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(s*s+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 Wh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.used!==e.used?n.used?1:-1:n.error!==e.error?n.error>e.error?1:-1:n.distanceFromCamera!==e.distanceFromCamera?n.distanceFromCamera>e.distanceFromCamera?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},Jh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.lastFrameVisited!==e.lastFrameVisited?n.lastFrameVisited>e.lastFrameVisited?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:n.loadingState!==e.loadingState?n.loadingState>e.loadingState?-1:1:n.hasUnrenderableContent!==e.hasUnrenderableContent?n.hasUnrenderableContent?-1:1:n.error!==e.error?n.error>e.error?-1:1:0};class Tm{rootLoadingState=Ur;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 T;_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 Nh,this.lruCache.unloadPriorityCallback=Jh,this.loadQueue=new Lo,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=Wh,this.processNodeQueue=new Lo,this.processNodeQueue.maxJobs=25,this.group=new d.Object3D,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===Ur&&(this.rootLoadingState=Vo,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=Oa,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),h=this.preprocessNode(c.root,f,null);this.queueTileForDownload(h),this._root=h;const u=new Vr(h.boundingVolume),b=new Tr;u.getSphere(b);const A=new Ce;if(u.getAABB(A),this.rtcOffset=new g(-b.center.x,-b.center.y,-b.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:b.center,radius:b.radius,boundingBox:A,rtcOffset:this.rtcOffset})}catch(m){console.warn("Failed to calculate bounding volume for root tile:",m)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=vr,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const s=this.root;if(!s)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(),Ws(s,this),jo(s,this),Js(s,this),js(s,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&&Vh(this.root,(r,i,s)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,s):!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,s=a.boundingVolume;if(!s){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,h=1/0;const u=a.worldTransform;for(let b=0,A=r.length;b<A;b++){const m=i[b];let p,D;if(m.isOrthographic){const v=m.pixelSize;p=e.geometricError/v,D=1/0}else{const v=m.sseDenominator;D=s.distanceToPoint(m.position,u),p=D===0?1/0:e.geometricError/(D*v)}const _=i[b].frustum;s.intersectsFrustum(_,u)&&(o=!0,l=Math.max(l,p),c=Math.min(c,D)),f=Math.max(f,p),h=Math.min(h,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=h)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new g,frustum:new pn,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],s=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(s.position.copyFrom(l),s.frustum=i.frustum,s.isOrthographic=i.type===st.ortho,s.isOrthographic){const c=i.frustumSize;s.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;s.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 Oo?r=e:r=new Oo(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 Vr(r.boundingVolume);r.cached.boundingVolume=c}const i=new g(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),s=new T;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)s.rawData[f]=c[f]}if(!a){s.copyFrom(this._upRotationMatrix);const c=new g;c.copyFrom(i),c.applyMatrix4(s);const f=r.cached.boundingVolume.box,h=[new g(f.min.x,f.min.y,f.min.z),new g(f.max.x,f.min.y,f.min.z),new g(f.min.x,f.max.y,f.min.z),new g(f.max.x,f.max.y,f.min.z),new g(f.min.x,f.min.y,f.max.z),new g(f.max.x,f.min.y,f.max.z),new g(f.min.x,f.max.y,f.max.z),new g(f.max.x,f.max.y,f.max.z)];for(const A of h)A.applyMatrix4(s);const u=new Ce;h.forEach(A=>{u.expandByPoint(A)}),s.rawData[12]=-c.x,s.rawData[13]=-c.y,s.rawData[14]=-c.z;const b=u.min;s.rawData[13]-=b.y}const o=new T;o.copyFrom(s),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,s);const l=new T;if(l.copyFrom(o),l.invert(),r.cached.transfrom=s,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],h=this.preprocessNode(f,t,r);r.children.push(h)}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 s=a[r];s.basePath!==void 0&&s.basePath!==""||s.cached.boundingVolume||(t?(this.processNodeQueue.remove(s),this.preprocessNode(s,e.basePath,e)):this.processNodeQueue.has(s)||this.processNodeQueue.add(s,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!==Ur){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=Vo,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=vr,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async s=>{try{await this.parseTileContent(s,r,i),this.stats.downloading--}catch(o){s.loadingState=vr,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=Mh;const i=(c=>{const f=c.split(".");return f.length>1?f[f.length-1]:""})(t),s=a;let o=null;const l=new Tt;switch(i.toLowerCase()){case"b3dm":{o=(await l.load(s,ro,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"i3dm":{o=(await l.load(s,no,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"glb":case"gltf":{o=(await l.load(s,_t,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"pnts":{o=(await l.load(s,Fh,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"json":try{const c=await B.res.loadJSON(s);e.children.length=0,e.childrenProcessed=0;const f=this._getBasePath(s);if(c.root){const h=this.preprocessNode(c.root,f,e);e.children.push(h),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:c,url:s})}e.loadingState=Oa;return}catch(c){console.error("Failed to load external tileset:",c),e.loadingState=vr,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 h=f.cached.scene;h.parent&&h.parent.object3D.removeChild(h),h.destroy(!0),f.cached.scene=null}f.loadingState=Ur}),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=Oa,e.usedLastFrame=!0,Js(e,this),js(e,this)}else e.loadingState=vr,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!==Ur||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 B.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new T;switch(e.toLowerCase()){case"x":t.makeRotationAxis(g.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(g.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(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;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(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;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,s=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:s}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===Oa&&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,s=0;return this.traverse(o=>(e++,o.loadingState===Oa&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),s+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?s/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=Ur,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===Oa&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent(d.MeshRenderer);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 Qm{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class Mm{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class Pm{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class Nm{uri;group;metadata}class Vm{class;properties}function Om(n,e){let t=0,a=null;return function(...r){const i=Date.now(),s=i-t;s>=e?(t=i,n.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),n.apply(this,r),a=null},e-s))}}class Lm extends Dt{static count=0;constructor(){super(),X.register("ColorLitShader",Ad),this.shader=new gt;let e=new qe("ColorLitShader","ColorLitShader");e.passType=de.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new Z),e.setUniformColor("emissiveColor",new Z),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",B.res.normalTexture),e.setTexture("emissiveMap",B.res.blackTexture)}clone(){return null}debug(){}}class Gm extends Dt{constructor(){super();let e=new qe("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=de.COLOR,e.setUniformVector4("transformUV1",new ue(0,0,1,1)),e.setUniformVector4("transformUV2",new ue(0,0,1,1)),e.setUniformColor("baseColor",new Z(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 gt;a.addRenderPass(e),this.shader=a,this.baseMap=B.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 zm(n,e){}class Wm extends Dt{constructor(){super(),this.shader=new d.UnLitTexArrayShader,this.baseMap=B.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 Zo{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 s=new Cr;s.formBytes(e),this.positionCurves.set(s.path,s)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new Cr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let s=new Cr;s.formBytes(e),this.scaleCurves.set(s.path,s)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new Cr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class Cr{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 Vi;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new fe;break;case 3:this._cacheValue=new g;break;case 4:this._cacheValue=new ue;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),s=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(s.time-i.time);ne.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),ne.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),ne.HELP_2.slerp(ne.HELP_0,ne.HELP_1,o),this._cacheValue.x=ne.HELP_2.x,this._cacheValue.y=ne.HELP_2.y,this._cacheValue.z=ne.HELP_2.z,this._cacheValue.w=ne.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 Jm 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 jm{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],s=this.colorArray[r];return Z.lerp(t-a,i,s)}}class Zs{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return g.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,s=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(s))}getTangent(e){if(!(e>=0&&e<=1))return g.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)),s=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(s)}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 s=(t+i)/2,o=(i+a)/2,l=this.getPoint(s),c=this.getPoint(o),f=l.subtract(e).lengthSquared,h=c.subtract(e).lengthSquared;return f<h?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var jh=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(jh||{});class Zm{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],s=a[r*3];t+=i.subtract(s).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 s=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(s);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,h=c.lengthSquared;if(f>0&&h>0){let u=(f+h)/8,b=c.div(h).subtract(l.div(f));b.normalize(),b=b.mul(u),r[o*3-1]=e[o].subtract(b),r[o*3+1]=e[o].add(b)}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 s=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[s].subtract(e[l]),f=e[o].subtract(e[l]),h=c.lengthSquared,u=f.lengthSquared,b=3*i-1,A=(3*i+1)%(this.numControlVertices-1);if(h>0&&u>0){let m=(h+u)/8,p=f.div(u).subtract(c.div(h));p.normalize(),p=p.mul(m),r[b]=e[l].subtract(p),r[A]=e[l].add(p)}else r[b]=e[l],r[A]=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=Ot.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 Zs(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=Ot.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 Zs(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],s=new Zs(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let h=0;h<4;h++)i[h]=this.controlVertices[o+h];s.setControlVertices(i);let l=s.getClosestParam(e,t),f=s.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 Zh=(n=>(n[n.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",n[n.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",n[n.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",n[n.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",n[n.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",n[n.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",n[n.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",n[n.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",n[n.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",n[n.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",n[n.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",n[n.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",n[n.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",n))(Zh||{});const Xm=3.141592653589793;class Hm{}function Yh(n,e,t){let a=.3333333333333333,r=.5,i=n*a,s=i*i,l=s*i-i*e*r+t*r,c=-s+e*a,f=c*c*c,h=f+l*l;if(h>=0){let A=Math.sqrt(h)-l;return A=A>0?Math.pow(A,a):-Math.pow(-A,a),-i-c/A+A}let u=Math.sqrt(-f),b=Math.acos(-l/u);return u=Math.pow(u,a),u=u-c/u,b=-i+u*Math.cos(b*a),b}function Ys(n,e,t,a){let r=1e-5;if(Math.abs(n)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*n*t;if(i<0)return 0;let s=.5/n,o=Math.sqrt(i);return a.r0=(o-e)*s,a.r1=(-o-e)*s,2}function Xh(n,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let s=t/e,o=a/e,l=r/e;n[0]=Yh(s,o,l),i++;let c=e,f=t+e*n[0],h=a+t*n[0]+e*n[0]*n[0];i+=Ys(c,f,h,{r0:n[1],r1:n[2]})}else i+=Ys(t,a,r,{r0:n[1],r1:n[2]});return i}class La{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class rr{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[rr.kMaxNumSegments]=new La,this.integrationCache[rr.kMaxNumSegments]=0,this.doubleIntegrationCache[rr.kMaxNumSegments]=0,this.times[rr.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=fe.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=fe.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],s=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=Xh(c,i,s,o,l);for(let h=0;h<f;h++){let u=c[h]+t[r];u>=t[r]&&u<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(u))}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;Yo(i);let s=t-a;e.integrationCache[r]=e.integrationCache[r-1]+La.EvalSegment(s,i)*s,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+=La.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++)Yo(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)Hh(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<=rr.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+La.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]+La.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 La.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 La,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 s=0;s<this.segmentCount;s++){let o;e.calculateCacheData(o,s,s+1,0),this.segments[s+i].coeff=o.coeff.concat(),this.times[s+i]=e.getKey(s+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 s=0;s<this.segmentCount;s++)this.segments[s].coeff[0]*=t,this.segments[s].coeff[1]*=t,this.segments[s].coeff[2]*=t,this.segments[s].coeff[3]*=t}return!0}}function Hh(n){n[0]/=20,n[1]/=12,n[2]/=6,n[3]/=2}function Yo(n){n[0]/=4,n[1]/=3,n[2]/=2,n[3]/=1}var Kh=(n=>(n[n.kEMScalar=0]="kEMScalar",n[n.kEMOptimized=1]="kEMOptimized",n[n.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",n[n.kEMSlow=3]="kEMSlow",n))(Kh||{}),qh=(n=>(n[n.kMMCScalar=0]="kMMCScalar",n[n.kMMCCurve=1]="kMMCCurve",n[n.kMMCTwoCurves=2]="kMMCTwoCurves",n[n.kMMCTwoConstants=3]="kMMCTwoConstants",n))(qh||{});class Km{max;min}class qm{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class $h{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new Vi,this.maxCurve=new Vi}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?xr(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?xr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?xr(e._minScalar,e._scalar,a):e.minMaxState==2?xr(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 $m{value=0;mode=0;spread=0;speed=new $h;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function ep(n,e){let t=rr.isValidCurve(n.max);return e!=2&&e!=3?t:t&&rr.isValidCurve(n.min)}function tp(n,e,t,a){n.max.buildCurve(e.max,t),a!=2&&a!=3?n.min.buildCurve(e.max,t):n.min.buildCurve(e.min,t)}function ap(n,e){let t=e.getKeyCount();if(t!=0)if(t==1)es(n,e.getKey(0).value);else{let a=t-1;es(n,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Ao;e.calculateCacheData(i,r,r+1,0);let s=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,h=[],u=Ys(s,o,l,{r0:h[0],r1:h[1]});for(let b=0;b<u;b++)h[b]>=0&&h[b]+c<f&&es(n,La.EvalSegment(h[b],i.coeff));es(n,La.EvalSegment(f-c,i.coeff))}}}function es(n,e){n.x=Math.min(n.x,e),n.y=Math.max(n.y,e)}class Or{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class eu{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,s=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-s*l,this.b=s*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?Or.BACK:a>t?Or.FRONT:Or.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function rp(n,e){return Math.random()*e+Math.random()*n+(e-n)*Math.random()}function ip(n,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*n*a+(e-n)*Math.random()*a}function tu(n,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=tu(n,e,t)),i=Math.pow(i,t),i*=e-n,i+=n,i}function xa(n){return n>0?Math.floor(n):Math.floor(n)-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 Xo(n,e){let t=n&15,a=1+(t&7);return t&8&&(a=-a),a*e}function Xs(n,e,t){let a=n&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function ts(n,e,t,a){let r=n&15,i=r<8?e:t,s=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-s:s)}function ui(n,e,t,a,r){let i=n&31,s=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-s:s)+(i&2?-o:o)+(i&4?-l:l)}let ta=[[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 sp(n){let e=xa(n),t=e+1,a=n-e,r=a-1,i,s,o=1-a*a;o*=o,i=o*o*Xo(Ue[e&255],a);let l=1-r*r;return l*=l,s=l*l*Xo(Ue[t&255],r),.25*(i+s)}function np(n,e){const t=.366025403,a=.211324865;let r,i,s,o=(n+e)*t,l=n+o,c=e+o,f=xa(l),h=xa(c),u=(f+h)*a,b=f-u,A=h-u,m=n-b,p=e-A,D,_;m>p?(D=1,_=0):(D=0,_=1);let v=m-D+a,U=p-_+a,y=m-1+2*a,S=p-1+2*a,F=f&255,k=h&255,x=.5-m*m-p*p;x<0?r=0:(x*=x,r=x*x*Xs(Ue[F+Ue[k]],m,p));let w=.5-v*v-U*U;w<0?i=0:(w*=w,i=w*w*Xs(Ue[F+D+Ue[k+_]],v,U));let R=.5-y*y-S*S;return R<0?s=0:(R*=R,s=R*R*Xs(Ue[F+1+Ue[k+1]],y,S)),40*(r+i+s)}function op(n,e,t){const a=.333333333,r=.166666667;let i,s,o,l,c=(n+e+t)*a,f=n+c,h=e+c,u=t+c,b=xa(f),A=xa(h),m=xa(u),p=(b+A+m)*r,D=b-p,_=A-p,v=m-p,U=n-D,y=e-_,S=t-v,F,k,x,w,R,Q;U>=y?y>=S?(F=1,k=0,x=0,w=1,R=1,Q=0):U>=S?(F=1,k=0,x=0,w=1,R=0,Q=1):(F=0,k=0,x=1,w=1,R=0,Q=1):y<S?(F=0,k=0,x=1,w=0,R=1,Q=1):U<S?(F=0,k=1,x=0,w=0,R=1,Q=1):(F=0,k=1,x=0,w=1,R=1,Q=0);let M=U-F+r,j=y-k+r,he=S-x+r,ae=U-w+2*r,P=y-R+2*r,z=S-Q+2*r,W=U-1+3*r,V=y-1+3*r,te=S-1+3*r,J=b&255,K=A&255,ee=m&255,re=.6-U*U-y*y-S*S;re<0?i=0:(re*=re,i=re*re*ts(Ue[J+Ue[K+Ue[ee]]],U,y,S));let oe=.6-M*M-j*j-he*he;oe<0?s=0:(oe*=oe,s=oe*oe*ts(Ue[J+F+Ue[K+k+Ue[ee+x]]],M,j,he));let pe=.6-ae*ae-P*P-z*z;pe<0?o=0:(pe*=pe,o=pe*pe*ts(Ue[J+w+Ue[K+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zr=.6-ye*ye-Qe*Qe-Re*Re-Le*Le;zr<0?l=0:(zr*=zr,l=zr*zr*ui(Ue[ua+ee+Ue[Pt+re+Ue[wa+oe+Ue[ba+pe]]]],ye,Qe,Re,Le));let Wr=.6-Ut*Ut-je*je-sr*sr-Ea*Ea;Wr<0?c=0:(Wr*=Wr,c=Wr*Wr*ui(Ue[ua+Te+Ue[Pt+Oe+Ue[wa+q+Ue[ba+ie]]]],Ut,je,sr,Ea));let Jr=.6-za*za-Wa*Wa-aa*aa-Ja*Ja;return Jr<0?f=0:(Jr*=Jr,f=Jr*Jr*ui(Ue[ua+1+Ue[Pt+1+Ue[wa+1+Ue[ba+1]]]],za,Wa,aa,Ja)),27*(s+o+l+c+f)}class Ho extends fe{static uv_0=new Ho;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),s=r%t;return new ue(i/t,s/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 H.single:{let r=this.getKeyFrame(0);r[a]=t}break;case H.float:{let r=this.getKeyFrame(0);r[a]=t}break;case H.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y}break;case H.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case H.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case H.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[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 Rs,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}=Va.parser(e);this.split(t,a,"value")}{let{t,v:a}=Va.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Va.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outWeight")}}}class cp{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new fe(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new g(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new ue(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 ne(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 Sr{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 Mt extends g{static CALC_VECTOR3D1=new g;static CALC_VECTOR3D2=new g;static CALC_VECTOR3D3=new g;static CALC_VECTOR3D4=new g;static CALC_VECTOR3D5=new g;_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 Mt.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),Mt.CALC_VECTOR3D3.length}}class au{_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,Sr.WalkAble,Sr.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+Mt.calcDistance(a,e)*a.costMultiplier,i=Mt.calcDistance(a,this._endNode),s=r+i;a.openId==this._findIndex?a.f>s&&(a.f=s,a.gg=r,a.h=i,a.parent=e):(a.f=s,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 Mt{_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 ka{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new g;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 g,this._edgeMask=Sr.WalkAble,Mt.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=Mt.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&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(e),ka.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(ka.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(-e),ka.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(ka.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 Mt.equalPoint(e,this._pointA)?this._pointA:Mt.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 Mt.equalPoint(e,this._pointA)?this._pointA:Mt.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&Sr.WalkAble)==Sr.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class De{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new g;static RAY_2=new g;static TEST_RAY=new g;static TEST_RAY_1=new g;static TEST_RAY_2=new g;static CALC_CROSS_POINT=new g;static CALC_CROSS_TEST=new g;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=De.RAY_1,this.rayB=De.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(De.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);De.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var s;if(De.TEST_RAY_1.copyFrom(t.pointA),De.TEST_RAY_1.decrementBy(this.curPoint),De.TEST_RAY_2.copyFrom(t.pointB),De.TEST_RAY_2.decrementBy(this.curPoint),De.TEST_RAY_1.y=0,De.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,De.TEST_RAY_1,De.TEST_RAY_2)||this.isPointAtCenter(this.rayB,De.TEST_RAY_1,De.TEST_RAY_2)?s=!1:s=!0,s)return this.isPointAtCenter(this.rayA,De.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return De.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,De.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){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);let i=De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z;var s=0;return i!=0&&(s=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),s>1?s=1:s<0&&(s=0),De.CALC_CROSS_POINT.scaleBy(s),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(De.CALC_CROSS_POINT.scaleBy(i),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){De.CALC_CROSS_TEST.copyFrom(t),De.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_TEST.x*r.z-r.x*De.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,De.RAY_1.setTo(0,0,0),De.RAY_2.setTo(0,0,0)}}class ir{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new g;constructor(){this._router=new De}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)!=Or.INTERSECT||a[a.length-1].plane.classifyPoint(t,is.EPSILON)!=Or.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,s,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),s=a[r],c=s.plane,s=a[r+1],l=s.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,is.EPSILON)==Or.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,h,u,b;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],s=a[r+1],b=r==i-1,b?l=t:l=s.getEdgeAgainstPoint(o),u=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,b),u||(f=this._router.cornerPoint,h=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(h),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let A=[];for(let m of this._result)A.push(new g().copyFrom(m));this._result=A}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 s=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),s=r.crossPoint;else{i=null,o=null;for(var h=f+1;h<a&&(i=this._tempPublicEdgeList[h],o=i.crossPoint,!o);h++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==s?c=o.clone():(ir.CROSS_TEST_DIRECTION.setTo(o.x-s.x,0,o.z-s.z),c=this._router.calcCrossEdge(r,s,ir.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,s,o,l,c,f,h,u,b,A,m;for(m=0;m<t;m++)c=f=h=null,s=o=l=null,b=!1,A=null,a=this._result[m],r=this._result[m+1],i=this._result[m+2],a instanceof Fa&&(s=a),r instanceof Fa&&(o=r),i instanceof Fa&&(l=i),s&&(c=s.ownerPoint),o&&(f=o.ownerPoint),l&&(h=l.ownerPoint),c&&f&&c==f&&f!=h&&(b=!0),h&&f&&h==f&&c!=f&&(b=!0),b&&(ir.CROSS_TEST_DIRECTION.copyFrom(a),ir.CROSS_TEST_DIRECTION.decrementBy(i),u=o.ownerEdge,b=this._router.hasCrossPoint(u.pointA,u.pointB,i,ir.CROSS_TEST_DIRECTION),b&&(A=this._router.calcCrossPointOut(f,r,i,ir.CROSS_TEST_DIRECTION)),A&&(e[m+1]=A))}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 ru extends g{_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 Qt,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=Sr.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 eu,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,s=this._neibourTriangles.getKeys(),o;for(o of s)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(Sr.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 fp{_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 au,this._nav3dFunnel=new ir,this._terrainQuad=new ch(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),s=this._nav3dAstar.findPath(this,r,i);return s?(this._triangleList=this._nav3dAstar.channel,s=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,s):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new Mt(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,s,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)&&(s=new ru(l,a,r,i),this._nav3dTriangles.push(s))}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 ka(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,s,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&&(s=a.loopPublicEdge(r),s&&(a.addNeibour(s,r),r.addNeibour(s,a)))}}}class Ko{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 Ko;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class Ga extends Ve{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(g.ZERO.clone(),new g(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]),s=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,s),this.setAttribute(G.TEXCOORD_1,s),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class iu extends Ve{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,s=!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=s,this.thetaStart=o,this.thetaLength=l,this.instanceID=Gt(),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 s=0;const o=[],l=this.height/2;let c=0;A(),this.openEnded===!1&&(this.radiusTop>0&&m(!0),this.radiusBottom>0&&m(!1));let f=new Float32Array(t),h=new Float32Array(a),u=new Float32Array(r),b=new Uint16Array(i);this.setAttribute(G.position,f),this.setAttribute(G.normal,h),this.setAttribute(G.uv,u),this.setAttribute(G.TEXCOORD_1,u),this.setIndices(b);function A(){const p=new g,D=new g;let _=0;const v=(e.radiusBottom-e.radiusTop)/e.height;for(let U=0;U<=e.heightSegments;U++){const y=[],S=U/e.heightSegments,F=S*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let k=0;k<=e.radialSegments;k++){const x=k/e.radialSegments;let w=x*e.thetaLength+e.thetaStart;k==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(w=0);const R=Math.sin(w),Q=Math.cos(w);D.x=F*R,D.y=-S*e.height+l,D.z=F*Q,t.push(D.x,D.y,D.z),p.set(R,v,Q).normalize(),a.push(p.x,p.y,p.z),r.push(x,1-S),y.push(s++)}o.push(y)}for(let U=0;U<e.radialSegments;U++)for(let y=0;y<e.heightSegments;y++){const S=o[y][U],F=o[y+1][U],k=o[y+1][U+1],x=o[y][U+1];i.push(S,F,x),i.push(F,k,x),_+=6}e.addGroup(c,_,0),c+=_}function m(p){const D=s,_=new fe,v=new g;let U=0;const y=p===!0?e.radiusTop:e.radiusBottom,S=p===!0?1:-1;for(let k=1;k<=e.radialSegments;k++)t.push(0,l*S,0),a.push(0,S,0),r.push(.5,.5),s++;const F=s;for(let k=0;k<=e.radialSegments;k++){const w=k/e.radialSegments*e.thetaLength+e.thetaStart,R=Math.cos(w),Q=Math.sin(w);v.x=y*Q,v.y=l*S,v.z=y*R,t.push(v.x,v.y,v.z),a.push(0,S,0),_.x=R*.5+.5,_.y=Q*.5*S+.5,r.push(_.x,_.y),s++}for(let k=0;k<e.radialSegments;k++){const x=D+k,w=F+k;p===!0?i.push(w,w+1,x):i.push(w+1,w,x),U+=3}e.addGroup(c,U,p===!0?1:2),c+=U}}}class su extends Ve{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(g.ZERO.clone(),new g(t*2,a*2,t*2));var s=(r+1)*(i+1);let o=new Float32Array(s*3),l=new Float32Array(s*3),c=new Float32Array(s*2),f=new Uint16Array(r*i*2*3),h=0,u=0,b=0,A=0;for(let m=0;m<=r;m++)for(let p=0;p<=i;p++){const D=p/i,_=m/r,v=D*e,U=_*Math.PI*2;if(o[h++]=(t+a*Math.cos(U))*Math.sin(v),o[h++]=a*Math.sin(U),o[h++]=(t+a*Math.cos(U))*Math.cos(v),l[u++]=Math.sin(v)*Math.cos(U),l[u++]=Math.sin(U),l[u++]=Math.cos(v)*Math.cos(U),c[b++]=D,c[b++]=_,p<i&&m<r){const y=i+1,S=y*m+p,F=y*(m+1)+p,k=y*(m+1)+p+1,x=y*m+p+1;f[A++]=S,f[A++]=x,f[A++]=F,f[A++]=x,f[A++]=k,f[A++]=F}}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 dp extends Ve{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 s=i*2,o=s,l=s+1,c=s+2,f=s+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 hp extends Ve{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 s=0;s<this.faceCount;s++){let o=s*3+0,l=s*3+1,c=s*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 up extends ks{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new _s;let t=[];return B.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,B.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 bp extends d.Object3D{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new d.Object3D,t=new d.Object3D,a=new d.Object3D,r=new Ga(2,2,2),i=new Ga(2,2,2),s=new Ga(2,2,2),o=new Bt;o.baseColor=new Z(1,0,0);let l=new Bt;l.baseColor=new Z(0,1,0);let c=new Bt;c.baseColor=new Z(0,0,1);let f=e.addComponent(d.MeshRenderer),h=t.addComponent(d.MeshRenderer),u=a.addComponent(d.MeshRenderer);f.geometry=r,f.material=o,f.castShadow=!1,h.geometry=i,h.material=l,h.castShadow=!1,u.geometry=s,u.material=c,u.castShadow=!1,e.localScale=new g(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new g(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new g(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class gp{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Ve,i=e.getAttribute(G.position).data.length/3,s=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let h=f[1].attribute;if(h==G.indices)continue;let u=e.getAttribute(h).data,b=u.length,A=new Float32Array(b*t);for(let m=0;m<t;m++){A.set(u,b*m);for(let p=0;p<i;p++)s[i*m+p]=m}r.setAttribute(h,A)}r.setAttribute(G.vIndex,s);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 h=0;h<l;h++){let u=f*i,b=f*l;const A=o[h]+u;c[b+h]=A}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 mp extends d.Object3D{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 s=new Ve;s.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),s.setAttribute(G.position,new Float32Array(e)),s.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 Z(1,1,1,.15),o.blendMode=Ae.ADD,o.castReflection=!1;let l=this.addComponent(d.MeshRenderer);l.geometry=s,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 Ve;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 d.Object3D,s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(1,0,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new d.Object3D;i.rotationY=90;let s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(0,1,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class pp{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 Z(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 Ap{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new Ga),this.planeGeo||(this.planeGeo=new $r(1,1,1,1,g.UP)),this.sphere||(this.sphere=new Ir(1,35,35)),this.material||(this.material=new qt),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 d.Object3D,t=e.addComponent(d.MeshRenderer);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 qt,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.geometry=this.planeGeo;let r=this.GetMaterial(e);return r.blendMode=Ae.ADD,r.castShadow=!1,a.material=r,a.castGI=!1,a.castReflection=!1,t}static GetSingleCube(e,t,a,r,i,s){this.initHeap();let o=new qt;o.roughness=.5,o.metallic=.1,o.baseColor=new Z(r,i,s,1);let l=new d.Object3D,c=l.addComponent(d.MeshRenderer);return c.castGI=!0,c.geometry=new Ga(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new qt;i.baseColor=new Z(t,a,r,1);let s=new d.Object3D,o=s.addComponent(d.MeshRenderer);return o.castGI=!0,o.geometry=new Ir(e,20,20),o.material=i,s}static get Sphere(){this.initHeap();let e=new d.Object3D,t=e.addComponent(d.MeshRenderer);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);return r.castShadow=!1,r.geometry=new Ga(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,s,o=1,l=!0){let c=new d.Object3D,f=c.addComponent(d.PointLight);f.lightColor=new Z(r,i,s,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let h=this.GetSingleSphere(.1,1,1,1);return c.addChild(h),f}}var N=(n=>(n[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z",n[n.XY=3]="XY",n[n.XZ=4]="XZ",n[n.YZ=5]="YZ",n[n.XYZ=6]="XYZ",n[n.MAX=7]="MAX",n[n.NONE=8]="NONE",n))(N||{}),ha=(n=>(n[n.Local=0]="Local",n[n.Global=1]="Global",n))(ha||{});class Hs extends $e{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(N.MAX),this.mAxisColor=new Array(N.MAX),this.mAxisMaterial=new Array(N.MAX),this.mAxisCollider=new Array(N.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 d.Object3D;let t=new Bt;t.baseColor=new Z(1,0,0),t.depthCompare=it.always,this.mAxisColor[N.X]=t.baseColor,this.mAxisMaterial[N.X]=t;let a=new Bt;a.baseColor=new Z(0,1,0),a.depthCompare=it.always,this.mAxisColor[N.Y]=a.baseColor,this.mAxisMaterial[N.Y]=a;let r=new Bt;r.baseColor=new Z(0,0,1),r.depthCompare=it.always,this.mAxisColor[N.Z]=r.baseColor,this.mAxisMaterial[N.Z]=r;let i=this.createCustomAxis(N.X),s=this.createCustomAxis(N.Y),o=this.createCustomAxis(N.Z);this.mContainer.addChild(this.mAxis[N.X]=i),this.mContainer.addChild(this.mAxis[N.Y]=s),this.mContainer.addChild(this.mAxis[N.Z]=o),this.mAxisCollider[N.X]=i.getComponent(da),this.mAxisCollider[N.Y]=s.getComponent(da),this.mAxisCollider[N.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=T.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(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||s==N.XYZ)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},s==N.XYZ)))break}return i}currentAxis=N.NONE;beginPoint=new g;beginMousePos=new g;currentPoint=new g;onMouseDown(e){if(e.mouseCode!=Ps.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),s=r.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(s),this.beginMousePos.x=B.inputSystem.mouseX,this.beginMousePos.y=B.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==N.NONE){let t=this.lastMoveObj.getComponent(d.MeshRenderer).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.X]),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Y]),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Z])),this.lastMoveAxis=N.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new Z(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let s=i.subtract(this.beginPoint);g.HELP_0.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let o=g.distance(g.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(g.HELP_0),this.transformSpaceMode){case ha.Local:this.applyLocalTransform(this.currentAxis,s,o);break;case ha.Global:this.applyGlobalTransform(this.currentAxis,s,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Ps.MOUSE_LEFT&&(this.currentAxis=N.NONE,this.reset())}onUpdate(e){let a=g.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 N.X:t=1;break;case N.Y:a=1;break;case N.Z:r=1;break}let i=.4+t*20,s=.4+a*20,o=.4+r*20,l=new d.Object3D;l.x=i*.5,l.y=s*.5,l.z=o*.5;let c=l.addComponent(d.MeshRenderer);c.geometry=new Ga(i,s,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(da),h=new oi;return h.setFromCenterAndSize(new g(0,0,0),new g(i+1,s+1,o+1)),f.shape=h,l}}class nu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(.9,.9,.9),t.depthCompare=it.always,this.mAxisColor[N.XYZ]=t.baseColor,this.mAxisMaterial[N.XYZ]=t;let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);r.geometry=new Ga(2,2,2),r.material=this.mAxisMaterial[N.XYZ];let i=a.addComponent(da),s=new oi;s.setFromCenterAndSize(new g(0,0,0),new g(2,2,2)),i.shape=s,this.mContainer.addChild(this.mAxis[N.XYZ]=a),this.mAxisCollider[N.XYZ]=a.getComponent(da)}applyLocalTransform(e,t,a){switch(this.currentAxis){case N.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==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=g.HELP_0;r.set(0,0,0),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(r.x=t.x),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(r.y=t.y),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,g.HELP_1),this.mX.scaleX+=g.HELP_1.x,this.mX.scaleY+=g.HELP_1.y,this.mX.scaleZ+=g.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 d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new Ga(2,2,2),c.material=this.mAxisMaterial[e],i}}var mt=(n=>(n[n.Scale=0]="Scale",n[n.Rotation=1]="Rotation",n[n.Translation=2]="Translation",n[n.NONE=3]="NONE",n))(mt||{});class ou extends Hs{applyLocalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ,this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.identity(),T.help_matrix_1.createByRotation(1,g.Y_AXIS),T.help_matrix_2.multiplyMatrices(T.help_matrix_1,T.help_matrix_0),T.help_matrix_2.invert(),T.help_matrix_1.multiplyMatrices(T.help_matrix_2,T.help_matrix_0);let r=T.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),this.currentAxis==N.X){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.x-a.x>0&&(s=360-s),s}if(this.currentAxis==N.Y){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.y-a.y>0&&(s=360-s),s}if(this.currentAxis==N.Z){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.z-a.z>0&&(s=360-s),s}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.Y||this.currentAxis==N.Z){let r=this.getAngle();switch(T.help_matrix_0.identity(),this.currentAxis){case N.X:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.X_AXIS);break;case N.Y:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Y_AXIS);break;case N.Z:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Z_AXIS);break}T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let s=T.help_matrix_1.decompose(sa.QUATERNION)[1];ne.HELP_0.set(s.x,s.y,s.z,s.w),this.mLastAngle=r,this.mX.transform.localRotQuat=ne.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!1,this.mAxis[this.currentAxis].getComponent(d.MeshRenderer).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new d.Object3D;switch(e){case N.X:t.rotationZ=90;break;case N.Y:break;case N.Z:t.rotationX=90;break}let a=t.addComponent(d.MeshRenderer);a.geometry=new su(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;return i.setFromCenterAndSize(new g,new g(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r)){let l=g.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class lu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(0,0,1),t.depthCompare=it.always,this.mAxisColor[N.XY]=t.baseColor,this.mAxisMaterial[N.XY]=t;let a=new Bt;a.doubleSide=!0,a.baseColor=new Z(0,1,0),a.depthCompare=it.always,this.mAxisColor[N.XZ]=a.baseColor,this.mAxisMaterial[N.XZ]=a;let r=new Bt;r.doubleSide=!0,r.baseColor=new Z(1,0,0),r.depthCompare=it.always,this.mAxisColor[N.YZ]=r.baseColor,this.mAxisMaterial[N.YZ]=r;let i=this.createPlane(N.XY),s=this.createPlane(N.XZ),o=this.createPlane(N.YZ);this.mContainer.addChild(this.mAxis[N.XY]=i),this.mContainer.addChild(this.mAxis[N.XZ]=s),this.mContainer.addChild(this.mAxis[N.YZ]=o),this.mAxisCollider[N.XY]=i.getComponent(da),this.mAxisCollider[N.XZ]=s.getComponent(da),this.mAxisCollider[N.YZ]=o.getComponent(da)}applyLocalTransform(e,t,a){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),T.help_matrix_0.transformVector(t,g.HELP_0),this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ||(g.HELP_0.x=0),this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ||(g.HELP_0.y=0),this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ||(g.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(g.HELP_0,g.HELP_1),this.mX.x+=g.HELP_1.x,this.mX.y+=g.HELP_1.y,this.mX.z+=g.HELP_1.z}applyGlobalTransform(e,t,a){T.help_matrix_0.identity(),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&T.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,0,t.z),T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let r=T.help_matrix_1.decompose(sa.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 d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1,i.rotationY=-90;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new iu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;switch(r.shape=i,e){case N.XY:a.geometry=new $r(4,4,1,1,g.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,4,.1));break;case N.XZ:a.geometry=new $r(4,4,1,1,g.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,.1,4));break;case N.YZ:a.geometry=new $r(4,4,1,1,g.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(.1,4,4));break}return t}}class qo extends d.Object3D{static _instance;static get instance(){return this._instance||(this._instance=new qo),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(nu),this.mControllers[mt.Rotation]=this.addComponent(ou),this.mControllers[mt.Translation]=this.addComponent(lu),this.mControllers[mt.Scale].enable=!1,this.mControllers[mt.Rotation].enable=!1,this.mControllers[mt.Translation].enable=!1,this.mXObj=new d.Object3D,this.mYObj=new d.Object3D,this.mZObj=new d.Object3D,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(){B.inputSystem.addEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onMouseDown,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onMouseMove,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){B.inputSystem.removeEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onMouseMove,this),B.inputSystem.removeEventListener(Y.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 Dp=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));d.AccelerateDecelerateInterpolator=z0,d.AccelerateInterpolator=L0,d.AnimationCurve=Vi,d.AnimationCurveT=Cr,d.AnimationMonitor=Mr,d.AnimatorEventKeyframe=Zb,d.AnticipateInterpolator=j0,d.AnticipateOvershootInterpolator=xi,d.ArrayHas=gu,d.ArrayItemIndex=mu,d.AtlasParser=Tf,d.AtmosphericComponent=Vb,d.AtmosphericScatteringSky=yd,d.AtmosphericScatteringSkySetting=Ud,d.AtmosphericScatteringSky_shader=vd,d.AttributeAnimCurve=Rd,d.AxisObject=bp,d.B3DMLoader=er,d.B3DMLoaderBase=Bf,d.B3DMParseUtil=so,d.B3DMParser=ro,d.BRDFLUT=xf,d.BRDFLUTGenerate=Ff,d.BRDF_frag=wl,d.BatchTable=Fs,d.BiMap=Jm,d.BillboardComponent=Ni,d.BillboardType=Ar,d.BitUtil=ic,d.BitmapTexture2D=$a,d.BitmapTexture2DArray=yc,d.BitmapTextureCube=Kn,d.Blend=vc,d.BlendFactor=Uc,d.BlendMode=Ae,d.BlendShapeData=No,d.BlendShapePropertyData=Po,d.BloomPost=zg,d.BlurEffectCreatorBlur_cs=hf,d.BlurEffectCreatorSample_cs=df,d.BlurTexture2DBufferCreator=uf,d.BounceInterpolator=Kt,d.BoundUtil=kn,d.BoundingBox=Ce,d.BoundingSphere=Tr,d.BoundingVolume=Vr,d.BoxColliderShape=oi,d.BoxGeometry=Ga,d.BrdfLut_frag=Bl,d.BsDF_frag=Il,d.BxDF_frag=Rl,d.BxdfDebug_frag=Pl,d.BytesArray=Ls,d.CEvent=bt,d.CEventDispatcher=ja,d.CEventListener=ns,d.CResizeEvent=nr,d.CSM=ia,d.Camera3D=Hr,d.CameraControllerBase=ag,d.CameraType=st,d.CameraUtil=ht,d.CapsuleColliderShape=vg,d.CastPointShadowMaterialPass=Nc,d.CastShadowMaterialPass=Pc,d.Clearcoat_frag=Tl,d.ClusterBoundsSource_cs=m0,d.ClusterConfig=Rt,d.ClusterDebug_frag=cl,d.ClusterLight=Jl,d.ClusterLightingBuffer=g0,d.ClusterLightingRender=A0,d.ClusterLighting_cs=p0,d.CollectInfo=Gc,d.ColliderComponent=da,d.ColliderShape=ut,d.ColliderShapeType=ni,d.Color=Z,d.ColorGradient=jm,d.ColorLitMaterial=Lm,d.ColorLitShader=Ad,d.ColorPassFragmentOutput=Eb,d.ColorPassRenderer=b0,d.ColorUtil=cs,d.ComData=Gs,d.Combine_cs=dd,d.Common_frag=Dl,d.Common_vert=_l,d.ComponentBase=$e,d.ComponentCollect=Ne,d.ComputeGPUBuffer=ei,d.ComputeShader=Se,d.Context3D=al,d.CubeCamera=Qn,d.CubeMapFaceEnum=bf,d.CubeSky_Shader=rn,d.CubicBezierCurve=Zs,d.CubicBezierPath=Zm,d.CubicBezierType=jh,d.CycleInterpolator=Z0,d.CylinderGeometry=iu,d.DDGIIrradianceComputePass=I0,d.DDGIIrradianceGPUBufferReader=Hi,d.DDGIIrradianceVolume=n0,d.DDGIIrradiance_shader=R0,d.DDGILightingPass=P0,d.DDGILighting_shader=M0,d.DDGIMultiBouncePass=Q0,d.DDGIProbeRenderer=N0,d.DEGREES_TO_RADIANS=pt,d.DRACO_DECODER_GLTF_JS=H0,d.DecelerateInterpolator=G0,d.Denoising_cs=hd,d.Depth2DTextureArray=v0,d.DepthCubeArrayTexture=_0,d.DepthMaterialPass=Vc,d.DepthOfFieldPost=Wg,d.DepthOfView_cs=Xf,d.DoubleArray=rs,d.EditorInspector=jr,d.Engine3D=B,d.Entity=s0,d.EntityBatchCollect=zc,d.EntityCollect=$,d.EnvMap_frag=vl,d.ErpImage2CubeMap=jt,d.ErpImage2CubeMapCreateCube_cs=gf,d.ErpImage2CubeMapRgbe2rgba_cs=mf,d.ExtrudeGeometry=xg,d.FAILED=vr,d.FASTFLOOR=xa,d.FXAAPost=Mn,d.FXAAShader=k0,d.FastMathShader=yl,d.FatLineGeometry=ih,d.FatLineMaterial=Ch,d.FatLine_FS=fc,d.FatLine_VS=cc,d.FeatureTable=Ri,d.FileLoader=Tt,d.FirstPersonCameraController=rg,d.Float16ArrayTexture=_s,d.Float32ArrayTexture=i0,d.FlyCameraController=ig,d.FontChar=wf,d.FontInfo=kf,d.FontPage=Ef,d.FontParser=tr,d.ForwardRenderJob=O0,d.FragmentOutput=on,d.FragmentVarying=Sl,d.FrameCache=Ao,d.Frustum=pn,d.FrustumCSM=Bc,d.FrustumCulling_cs=kb,d.FullQuad_vert_wgsl=Nl,d.GBufferFrame=Be,d.GBufferPass=Mc,d.GBufferPost=Jg,d.GBufferStand=sc,d.GBuffer_pass=ln,d.GILighting=Xn,d.GIProbeMaterial=th,d.GIProbeMaterialType=Fo,d.GIProbeShader=Dd,d.GIRenderCompleteEvent=Pn,d.GIRenderStartEvent=Bs,d.GLBChunk=cf,d.GLBHeader=lf,d.GLBParser=Hn,d.GLSLLexer=Cc,d.GLSLLexerToken=Di,d.GLSLPreprocessor=Sc,d.GLSLSyntax=Ec,d.GLTFBinaryExtension=yf,d.GLTFMaterial=hm,d.GLTFParser=_t,d.GLTFSubParser=ys,d.GLTFSubParserCamera=K0,d.GLTFSubParserConverter=of,d.GLTFSubParserMaterial=$0,d.GLTFSubParserMesh=q0,d.GLTFSubParserSkeleton=Yn,d.GLTFSubParserSkin=ef,d.GLTFType=oa,d.GLTF_Accessors=T2,d.GLTF_Info=vs,d.GLTF_Light=E2,d.GLTF_Mesh=I2,d.GLTF_Node=w2,d.GLTF_Primitives=R2,d.GLTF_Scene=k2,d.GPUAddressMode=Ht,d.GPUBlendFactor=pu,d.GPUBufferBase=Za,d.GPUBufferType=ga,d.GPUCompareFunction=it,d.GPUContext=E,d.GPUCullMode=Vt,d.GPUFilterMode=fr,d.GPUPrimitiveTopology=ls,d.GPUTextureFormat=le,d.GPUVertexFormat=mi,d.GPUVertexStepMode=_u,d.GSplatFormat=di,d.GSplatGeometry=Sn,d.GSplatMaterial=Cn,d.GSplat_FS=Zc,d.GSplat_VS=jc,d.GTAOPost=jg,d.GTAO_cs=Hf,d.GUIAtlasTexture=If,d.GUICanvas=zi,d.GUIConfig=Qr,d.GUIGeometry=Nd,d.GUIGeometryRebuild=Od,d.GUIMaterial=vo,d.GUIPassRenderer=V0,d.GUIPick=Wd,d.GUIPickHelper=Zd,d.GUIQuad=Na,d.GUIQuadAttrEnum=ot,d.GUIRenderer=Ld,d.GUIShader=Bo,d.GUISpace=fa,d.GUISprite=ai,d.GUITexture=mr,d.GaussianSplatParser=lm,d.GenerayRandomDir=zl,d.GeoJsonParser=fm,d.GeoJsonUtil=dm,d.GeoType=Vs,d.GeometryBase=Ve,d.GeometryIndicesBuffer=Hc,d.GeometryUtil=gp,d.GeometryVertexBuffer=Yc,d.GeometryVertexType=kt,d.GetComponentClass=rl,d.GetCountInstanceID=tn,d.GetRepeat=ku,d.GetShader=il,d.GlassShader=wb,d.GlobalBindGroup=ve,d.GlobalBindGroupLayout=An,d.GlobalFog=Zg,d.GlobalFog_shader=po,d.GlobalIlluminationComponent=mg,d.GlobalUniform=sn,d.GlobalUniformGroup=En,d.GodRayPost=Yg,d.GodRay_cs=Kf,d.GridObject=mp,d.HDRTexture=$n,d.HDRTextureCube=xs,d.Hair_frag=jl,d.Hair_shader_op=Rb,d.Hair_shader_tr=Ib,d.HaltonSeq=us,d.Horizontal=Hd,d.HoverCameraController=sg,d.I3DMLoader=va,d.I3DMLoaderBase=Cf,d.I3DMParser=no,d.IBLEnvMapCreator=Df,d.IBLEnvMapCreator_cs=Af,d.IESProfiles=Aa,d.IESProfiles_frag=Fl,d.IKDTreeUserData=Eg,d.ImageType=si,d.IndicesGPUBuffer=Xc,d.Inline_vert=Al,d.InputSystem=tl,d.InstanceDrawComponent=pg,d.InstanceUniform=Ul,d.InstancedMesh=Sf,d.Interpolator=br,d.InterpolatorEnum=Nn,d.IrradianceDataReaderCompleteEvent=gh,d.IrradianceVolumeData_frag=pl,d.Irradiance_frag=El,d.IsEditorInspector=uu,d.IsNonSerialize=$s,d.Joint=tf,d.JointPose=Zn,d.JumperInterpolator=J0,d.KDTreeEntity=Rg,d.KDTreeNode=_r,d.KDTreeRange=nh,d.KDTreeSpace=oh,d.KDTreeUUID=Xi,d.KHR_draco_mesh_compression=jn,d.KHR_lights_punctual=um,d.KHR_materials_clearcoat=rf,d.KHR_materials_emissive_strength=sf,d.KHR_materials_ior=bm,d.KHR_materials_unlit=nf,d.KMZParser=Gf,d.KV=Mo,d.KelvinUtil=pp,d.KeyCode=tt,d.KeyEvent=Ia,d.Keyframe=Rs,d.KeyframeT=as,d.LASLoader=yh,d.LASParser=pm,d.LASUtils=Zt,d.LASVisualizationMode=hi,d.LDRTextureCube=ks,d.LOADED=Oa,d.LOADING=Vo,d.LRUCache=Nh,d.LambertMaterial=Gm,d.Lambert_shader=Yl,d.LightBase=Ei,d.LightData=hs,d.LightEntries=o0,d.LightType=ft,d.LightingFunction_frag=fl,d.Line=vt,d.LineClassification=Jd,d.LinearInterpolator=W0,d.LitMaterial=qt,d.Lit_shader=Ql,d.LoaderBase=gr,d.LoaderEvent=Ig,d.LoaderManager=Ns,d.MAX_VALUE=yu,d.MIN_VALUE=Cu,d.Material=Dt,d.MaterialDataUniformGPUBuffer=Tc,d.MaterialUtilities=Os,d.MathShader=dl,d.MathUtil=Ot,d.Matrix3=Pr,d.Matrix4=T,d.MatrixBindGroup=f0,d.MatrixGPUBuffer=c0,d.MatrixShader=Wl,d.MemoryDO=or,d.MemoryInfo=nl,d.MergeRGBACreator=Mg,d.MergeRGBA_cs=qf,d.MeshColliderShape=Ms,d.MinMaxAnimationCurves=Km,d.MinMaxCurve=$h,d.MinMaxCurveState=qh,d.MinMaxPolyCurves=qm,d.MorePassParser=Og,d.MorePassShader=uh,d.MorphTargetBlender=Hb,d.MorphTargetData=h0,d.MorphTargetFrame=Kb,d.MorphTargetTransformKey=Qd,d.MorphTarget_shader=Xt,d.MouseCode=Ps,d.MultiBouncePass_cs=T0,d.Navi3DAstar=au,d.Navi3DConst=is,d.Navi3DEdge=ka,d.Navi3DFunnel=ir,d.Navi3DMaskType=Sr,d.Navi3DMesh=fp,d.Navi3DPoint=Mt,d.Navi3DPoint2D=Ko,d.Navi3DPointFat=Fa,d.Navi3DRouter=De,d.Navi3DTriangle=ru,d.NonSerialize=qs,d.NormalMap_frag=Cl,d.OAnimationEvent=af,d.OBJParser=wi,d.Object3DEvent=Tg,d.Object3DTransformTools=qo,d.Object3DUtil=Ap,d.ObjectAnimClip=Id,d.OcclusionSystem=Tn,d.Octree=ur,d.OctreeEntity=Jc,d.OrbitController=ng,d.OrderMap=Ym,d.Orientation3D=sa,d.OutLineBlendColor_cs=$f,d.OutlineCalcOutline_cs=ed,d.OutlinePass=Tb,d.OutlinePost=Xg,d.OutlinePostData=ph,d.OutlinePostManager=Ah,d.OutlinePostSlot=mh,d.Outline_cs=td,d.OvershootInterpolator=Y0,d.PARSING=Mh,d.PBRLItShader=Ml,d.PBRLitSSSShader=_d,d.PLUGIN_REGISTERED=wm,d.PNTSLoader=xh,d.PNTSLoaderBase=Sh,d.PNTSParser=Fh,d.ParserBase=rt,d.ParserFormat=Je,d.ParticleSystemCurveEvalMode=Kh,d.ParticleSystemRandomnessIds=Zh,d.PassGenerate=yi,d.PassShader=bh,d.PassType=de,d.PhysicMaterialUniform_frag=hl,d.PickCompute=ah,d.PickFire=rh,d.PickGUIEvent3D=yt,d.PickResult=Dh,d.Picker_cs=ad,d.PingPong=cn,d.PipelinePool=vn,d.Plane3D=eu,d.PlaneClassification=Or,d.PlaneGeometry=$r,d.PlyMode=Sa,d.PlyParser=Io,d.PlyStreamParser=Uh,d.PointClassification=jd,d.PointCloudGeometry=Fn,d.PointCloudMaterial=r0,d.PointCloud_FS=a0,d.PointCloud_VS=t0,d.PointLightShadowRenderer=B0,d.PointShadowCubeCamera=D0,d.PointerEvent3D=Y,d.Polynomial=La,d.PolynomialCurve=rr,d.Polynomials=Hm,d.PoolNode=Gd,d.PostBase=Jt,d.PostProcessingComponent=Wf,d.PostRenderer=S0,d.PreDepthPassRenderer=y0,d.PreFilteredEnvironment_cs=x0,d.PreFilteredEnvironment_cs2=vb,d.PreIntegratedLut=rd,d.PreIntegratedLutCompute=hh,d.PrefabAvatarData=Qo,d.PrefabAvatarParser=kh,d.PrefabBoneData=To,d.PrefabMaterialParser=wh,d.PrefabMeshData=Rh,d.PrefabMeshParser=Ih,d.PrefabNode=$i,d.PrefabParser=Qh,d.PrefabStringUtil=Um,d.PrefabTextureData=Eh,d.PrefabTextureParser=Th,d.Preprocessor=ma,d.PriorityQueue=Lo,d.Probe=eh,d.ProbeEntries=Pg,d.ProbeGBufferFrame=w0,d.ProfilerUtil=ct,d.PropertyAnimClip=jb,d.PropertyAnimTag=Td,d.PropertyAnimation=Do,d.PropertyAnimationClip=Zo,d.PropertyAnimationClipState=wd,d.PropertyAnimationEvent=Li,d.PropertyHelp=Oi,d.QuadAABB=Qt,d.QuadGlsl_fs=Hl,d.QuadGlsl_vs=Xl,d.QuadRoot=ch,d.QuadTree=lh,d.QuadTreeCell=Br,d.Quad_depth2dArray_frag_wgsl=Bu,d.Quad_depth2d_frag_wgsl=Ll,d.Quad_depthCube_frag_wgsl=Gl,d.Quad_frag_wgsl=Ol,d.Quad_vert_wgsl=Vl,d.Quaternion=ne,d.R32UintTexture=Ds,d.RADIANS_TO_DEGREES=Yr,d.RGBEErrorCode=pf,d.RGBEHeader=eo,d.RGBEParser=to,d.RTDescriptor=We,d.RTFrame=nt,d.RTResourceConfig=Qa,d.RTResourceMap=wt,d.Rand=pi,d.RandomSeed=Eu,d.Ray=na,d.RayCastMeshDetail=fi,d.Reader=Kr,d.Rect=Ai,d.Reference=xe,d.Reflection=Sd,d.ReflectionCG=oc,d.ReflectionEntries=l0,d.ReflectionMaterial=Fd,d.ReflectionRenderer=F0,d.ReflectionShader=xd,d.ReflectionShader_shader=nc,d.RegisterComponent=Nt,d.RegisterShader=Ta,d.RenderContext=In,d.RenderLayer=Ci,d.RenderLayerUtil=Un,d.RenderNode=Ba,d.RenderShaderCollect=Wc,d.RenderShaderCompute=dh,d.RenderShaderPass=qe,d.RenderTexture=Et,d.RendererBase=Ma,d.RendererJob=E0,d.RendererMap=C0,d.RendererMask=Me,d.RendererMaskUtil=ra,d.RendererPassState=u0,d.RepeatSE=fn,d.Res=zf,d.RotationControlComponents=ou,d.SHCommon_frag=lc,d.SN_ArrayConstant=_i,d.SN_BinaryOperation=hr,d.SN_Break=o2,d.SN_CodeBlock=Da,d.SN_Constant=Ha,d.SN_Continue=ms,d.SN_Declaration=et,d.SN_Discard=l2,d.SN_DoWhileLoop=n2,d.SN_Expression=Fe,d.SN_ForLoop=kr,d.SN_Function=bs,d.SN_FunctionArgs=gs,d.SN_FunctionCall=Fr,d.SN_IFBranch=wr,d.SN_Identifier=Xa,d.SN_IndexOperation=Rr,d.SN_Layout=Ui,d.SN_ParenExpression=Fc,d.SN_Precision=ps,d.SN_Return=Bi,d.SN_SelectOperation=vi,d.SN_Struct=Ya,d.SN_TernaryOperation=kc,d.SN_UnaryOperation=qr,d.SN_WhileLoop=Er,d.SSAO_cs=Ub,d.SSGI2_cs=id,d.SSGIPost=Hg,d.SSRPost=Kg,d.SSR_BlendColor_cs=sd,d.SSR_IS_Kernel=qg,d.SSR_IS_cs=nd,d.SSR_RayTrace_cs=od,d.ScaleControlComponents=nu,d.Scene3D=yg,d.Shader=gt,d.ShaderAttributeInfo=Bn,d.ShaderConverter=wc,d.ShaderConverterResult=Rc,d.ShaderLib=X,d.ShaderPassBase=an,d.ShaderReflection=xt,d.ShaderStage=_a,d.ShaderState=Ic,d.ShaderUniformInfo=_n,d.ShaderUtil=Ka,d.ShadingInput=xl,d.ShadowLightsCollect=Wt,d.ShadowMapPassRenderer=U0,d.ShadowMapping_frag=kl,d.Skeleton=qb,d.SkeletonAnimationClip=Us,d.SkeletonAnimationClipState=Ed,d.SkeletonAnimationCompute=$b,d.SkeletonAnimation_shader=Zr,d.SkeletonBlendComputeArgs=eg,d.SkeletonPose=ki,d.SkeletonTransformComputeArgs=tg,d.SkyGBufferPass=Qc,d.SkyGBuffer_pass=Kl,d.SkyMaterial=Cd,d.SkyRenderer=ws,d.SolidColorSky=up,d.SphereColliderShape=Ug,d.SphereGeometry=Ir,d.SphereReflection=kd,d.StandShader=ff,d.StatementNode=Ge,d.StorageGPUBuffer=Pe,d.StreamLoader=tm,d.StreamingGaussianSplatParser=cm,d.StringUtil=It,d.Struct=gi,d.StructStorageGPUBuffer=Ng,d.SubGeometry=Kc,d.TAACopyTex_cs=ld,d.TAAPost=$g,d.TAASharpTex_cs=cd,d.TAA_cs=fd,d.TestComputeLoadBuffer=ud,d.TextAnchor=Yd,d.TextFieldLayout=qd,d.TextFieldLine=Kd,d.Texture=dt,d.TextureCube=Cs,d.TextureCubeFaceData=ao,d.TextureCubeStdCreator=Ss,d.TextureCubeUtils=qn,d.TextureMipmapCompute=Vg,d.TextureMipmapGenerator=pa,d.TextureScaleCompute=fh,d.ThirdPersonCameraController=lg,d.Tile=Oo,d.TileSet=Qm,d.TileSetChild=Pm,d.TileSetChildContent=Nm,d.TileSetChildContentMetaData=Vm,d.TileSetRoot=Mm,d.TilesRenderer=Tm,d.Time=ze,d.TokenType=C,d.TorusGeometry=su,d.TouchData=el,d.TrailGeometry=dp,d.Transform=zt,d.TransformAxisEnum=N,d.TransformControllerBaseComponent=Hs,d.TransformMode=mt,d.TransformSpaceMode=ha,d.TranslationControlComponents=lu,d.TranslatorContext=Dn,d.TriGeometry=hp,d.Triangle=Zi,d.UIButton=yo,d.UIButtonTransition=$d,d.UIComponentBase=Uo,d.UIEvent=Qg,d.UIImage=Nr,d.UIImageGroup=Co,d.UIInteractive=Qs,d.UIInteractiveStyle=at,d.UIPanel=ji,d.UIRenderAble=Ji,d.UIShadow=So,d.UITextField=xo,d.UITransform=ar,d.UNLOADED=Ur,d.UUID=Gt,d.UV=Ho,d.Uint32ArrayTexture=xn,d.Uint8ArrayTexture=Si,d.UnLit=Zl,d.UnLitMaterial=Bt,d.UnLitMaterialUniform_frag=ul,d.UnLitTexArrayMaterial=Wm,d.UnLitTextureArray=Bd,d.UnLit_frag=bl,d.UniformGPUBuffer=Ct,d.UniformNode=lr,d.UniformType=St,d.ValueEnumType=H,d.ValueOp=cp,d.ValueParser=Va,d.ValueSpread=$m,d.Vector2=fe,d.Vector3=g,d.Vector3Ex=Gi,d.Vector4=ue,d.VertexAttribute=kg,d.VertexAttributeIndexShader=pd,d.VertexAttributeName=G,d.VertexAttributeSize=cr,d.VertexAttributeStride=sh,d.VertexAttributes_vert=gl,d.VertexBufferLayout=Fg,d.VertexFormat=ll,d.VertexGPUBuffer=As,d.Vertical=Xd,d.VideoUniform_frag=ml,d.View3D=Cg,d.ViewPanel=Is,d.ViewQuad=Rn,d.VirtualTexture=Ie,d.WGS84_FLATTENING=km,d.WGS84_HEIGHT=Em,d.WGS84_RADIUS=Fm,d.WGSLTranslator=xc,d.WayLines3D=Pi,d.WayPoint3D=Mi,d.WebGPUDescriptorCreator=Ye,d.WorldMatrixUniform=nn,d.WorldPanel=Ts,d.WrapMode=li,d.WrapTimeMode=Dr,d.ZCullingCompute=Gg,d.ZPassShader_cs=md,d.ZPassShader_fs=rc,d.ZPassShader_vs=ac,d.ZSorterUtil=Oc,d.append=_c,d.arrayToString=_f,d.blendComponent=Au,d.buildCurves=tp,d.byteSizeOfType=ea,d.calculateCurveRangesValue=ap,d.calculateMinMax=es,d.castPointShadowMap_vert=$l,d.clamp=_e,d.clampRepeat=qu,d.computeAABBFromPositions=ko,d.cos=zu,d.crossProduct=Xu,d.cubicPolynomialRoot=Yh,d.cubicPolynomialRootsGeneric=Xh,d.curvesSupportProcedural=ep,d.deg2Rad=Ou,d.detectGSplatFormat=_h,d.directionShadowCastMap_frag=tc,d.dot=Ft,d.doubleIntegrateSegment=Hh,d.downSample=Zf,d.fastInvSqrt=Ac,d.floorfToIntPos=pc,d.fonts=ri,d.generateRandom=Hu,d.generateRandom3=Ku,d.getFloatFromInt=bc,d.getGLTypeFromTypedArray=j2,d.getGLTypeFromTypedArrayType=J2,d.getGlobalRandomSeed=Wu,d.getTypedArray=Z2,d.getTypedArrayTypeFromGLType=Jn,d.grad1=Xo,d.grad2=Xs,d.grad3=ts,d.grad4=ui,d.inferSHOrder=wo,d.integrateSegment=Yo,d.irradianceDataReader=Lg,d.kPI=Xm,d.lerp=xr,d.lerpByte=Fu,d.lerpColor=xu,d.lerpVector3=Su,d.lruPriorityCallback=Jh,d.magnitude=hn,d.makeAloneSprite=ab,d.makeGUISprite=Rf,d.makeMatrix44=ds,d.markUsedSetLeaves=jo,d.markUsedTiles=Ws,d.markVisibleTiles=Js,d.matrixMultiply=mn,d.matrixRotate=a2,d.matrixRotateY=t2,d.mergeFunctions=os,d.multiplyMatrices4x4REF=Dc,d.normal_distribution=tu,d.normalizeFast=Yu,d.normalizeSafe=uc,d.normalizedToByte=Zu,d.normalizedToWord=ju,d.outlinePostData=Ca,d.outlinePostManager=em,d.parsePlyGaussianSplat=Ro,d.parsePlyHeader=qi,d.parsePlyMesh=Bh,d.parsePlyPointCloud=vh,d.perm=Ue,d.post=Yf,d.priorityCallback=Wh,d.quadraticPolynomialRootsGeneric=Ys,d.rad2Deg=Lu,d.random01=Xr,d.randomBarycentricCoord=Vu,d.randomPointBetweenEllipsoid=Nu,d.randomPointBetweenSphere=Mu,d.randomPointInsideCube=Tu,d.randomPointInsideEllipsoid=Qu,d.randomPointInsideUnitCircle=Pu,d.randomPointInsideUnitSphere=mc,d.randomQuaternion=Ru,d.randomQuaternionUniformDistribution=Iu,d.randomUnitVector=fs,d.randomUnitVector2=gc,d.rangedRandomFloat=At,d.rangedRandomInt=wu,d.readByType=be,d.readMagicBytes=ti,d.registerMaterial=zm,d.repeat=gn,d.rotMatrix=e2,d.rotateVectorByQuat=Uu,d.roundfToIntPos=un,d.scale=dn,d.shadowCastMap_frag=ec,d.shadowCastMap_vert=ql,d.simplex=ta,d.sin=Gu,d.snoise1=sp,d.snoise2=np,d.snoise3=op,d.snoise4=lp,d.splatColorProperties=Eo,d.splatProperties=Ki,d.sqrMagnitude=bn,d.sqrtImpl=hc,d.stencilStateFace=Du,d.swap=Ju,d.textureCompress=bd,d.threshold=jf,d.throttle=Om,d.toHalfFloat=qa,d.toggleTiles=js,d.traverseAncestors=Rm,d.traverseSet=Vh,d.tw=Fb,d.uniform_real_distribution=rp,d.uniform_real_distribution2=ip,d.upSample=mo,d.webGPUContext=I,d.zSorterUtil=Lc,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
11828
11856
  //# sourceMappingURL=rings.umd.js.map