@rings-webgpu/core 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rings.es.js +14 -14
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +188 -28
- package/dist/rings.umd.js +9 -9
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +188 -28
- package/dist/types/assets/Res.d.ts +2 -0
- package/dist/types/core/geometry/GeometryBase.d.ts +1 -0
- package/dist/types/gfx/graphics/webGpu/core/texture/Texture.d.ts +2 -0
- package/dist/types/gfx/graphics/webGpu/shader/Shader.d.ts +1 -1
- package/dist/types/loader/parser/b3dm/FeatureTable.d.ts +1 -0
- package/dist/types/loader/parser/tileRenderer/TilesRenderer.d.ts +1 -1
- package/dist/types/materials/Material.d.ts +1 -0
- package/dist/types/textures/BitmapTexture2D.d.ts +1 -0
- package/package.json +1 -1
package/dist/rings.es.js
CHANGED
|
@@ -5666,7 +5666,7 @@ struct InstanceData {
|
|
|
5666
5666
|
`,""),c=c.replaceAll(" "," "),this.parserAttribute(c,t)}else{var n=r.split(":")[1];n=n.replaceAll(" ",""),n=n.replaceAll(" ",""),n=n.replaceAll(")",""),n=e.split(`struct ${n}`)[1];let l=n.indexOf("{"),c=n.indexOf("}");n=n.slice(l,c),i=n.split("@");for(let f=1;f<i.length;f++){let h=i[f].replace(/\s*$/g,"");h=h.replaceAll(`
|
|
5667
5667
|
`,""),h=h.split(",")[0],h=h.replaceAll(" "," "),this.parserAttribute(h,t)}}return t}static parserVertex(e,t){let a=[],i=t.split(`fn ${e}(`)[1].split("->")[0],n=i.split("@");if(n&&n.length>1)for(let l=1;l<n.length;l++){let f=n[l].replace(/\s*$/g,"");f=f.replaceAll(",",""),f=f.replaceAll(`
|
|
5668
5668
|
`,""),f=f.replaceAll(" "," "),this.parserAttribute(f,a)}else{var o=i.split(":")[1];o=o.replaceAll(" ",""),o=o.replaceAll(" ",""),o=o.replaceAll(")",""),o=t.split(`struct ${o}`)[1];let c=o.indexOf("{"),f=o.indexOf("}");o=o.slice(c,f),n=o.split("@");for(let d=1;d<n.length;d++){let b=n[d].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=$a[a.valueType],t.push(a)}else if(e.indexOf("location")!=-1){a.type="location";var r=e.match(/\((.+?)\)/g)[0];r=e.match(/\((.+?)\)/g)[0],r=r.replace("(",""),r=r.replaceAll(")",""),a.location=parseInt(r);let n=e.split(":");a.name=n[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=n[1],a.valueType=a.valueType.replaceAll(" "," "),a.valueType=a.valueType.replaceAll(" ",""),a.valueType=a.valueType.replaceAll("\r",""),a.valueType=a.valueType.replaceAll(")",""),a.valueType=a.valueType.replaceAll(")",""),a.size=$a[a.valueType],t.push(a)}a.format=ul[$a[a.valueType]]}}class fe extends ln{entryPoint="CsMain";workerSizeX=1;workerSizeY=0;workerSizeZ=0;_computePipeline;_csShaderModule;_destCS;_sourceCS;_storageTextureDic;_sampleTextureDic;_groupsShaderReflectionVarInfos;_groupCache={};constructor(e){super(),this._sourceCS=e,Bt.getShaderReflection2(e,this),this._storageTextureDic=new Map,this._sampleTextureDic=new Map}setStorageTexture(e,t){this._storageTextureDic.has(e)||this._storageTextureDic.set(e,t)}setSamplerTexture(e,t){this._sampleTextureDic.set(e,t)}compute(e){this._computePipeline||this.genComputePipeline(),e.setPipeline(this._computePipeline);for(let t=0;t<this.bindGroups.length;++t)e.setBindGroup(t,this.bindGroups[t]);this.workerSizeX&&this.workerSizeY&&this.workerSizeZ?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY,this.workerSizeZ):this.workerSizeX&&this.workerSizeY?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY):e.dispatchWorkgroups(this.workerSizeX)}createBufferBindGroup(e,t,a,r){let i=this._bufferDic.get(t);if(i){let n={binding:a,resource:{buffer:i.buffer,offset:0,size:i.memory.shareDataBuffer.byteLength}};r.push(n)}else console.error(`ComputeShader(${this.instanceID})`,`buffer ${t} is missing!`)}noticeBufferChange(e){let t=this._groupCache[e];t&&this.genGroups(t.groupIndex,t.infos,!0)}genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;++o){const l=r[o];if(l)switch(l.varType){case"uniform":case"storage-read":case"storage-read_write":this.createBufferBindGroup(e,l.varName,l.binding,i),this._groupCache[l.varName]={groupIndex:e,infos:t};break;case"var":if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType.indexOf("texture_storage")!=-1){let c=this._storageTextureDic.get(l.varName);if(c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f),me.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),me.getInstance().attached(c,this)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}break;default:console.error("unprocessed type:",l.varType);break}}let n=k.device.createBindGroup({layout:this._computePipeline.getBindGroupLayout(e),entries:i});this.bindGroups[e]=n}}genComputePipeline(){this.preCompileShader(this._sourceCS),this.genReflection(),this._computePipeline=k.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)}k.addEventListener(Ha.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=ra.parseComputeShader(e,this.defineValue)}compileShader(){let e=k.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+=Bt.genComputeShaderVariant(this);let e=Bt.poolGetReflection(this.shaderVariant);e?this.shaderReflection=e:(Bt.getShaderReflection2(this._destCS,this),Bt.combineShaderReflectionVarInfo(this.shaderReflection,this.shaderReflection.cs_variables))}}var H=(s=>(s[s.COLOR=1]="COLOR",s[s.REFLECTION=2]="REFLECTION",s[s.POSITION=4]="POSITION",s[s.GRAPHIC=8]="GRAPHIC",s[s.GI=16]="GI",s[s.Cluster=32]="Cluster",s[s.SHADOW=64]="SHADOW",s[s.POINT_SHADOW=128]="POINT_SHADOW",s[s.POST=256]="POST",s[s.DEPTH=512]="DEPTH",s[s.UI=1024]="UI",s))(H||{});class Ye{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 H)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 H)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 Su=(()=>{var s=import.meta.url;return(async function(e={}){var t=e,a,r;t.ready=new Promise((I,N)=>{a=I,r=N});var i=Object.assign({},t),n=[],o="./this.program",l=(I,N)=>{throw N},c=typeof window=="object",f=typeof importScripts=="function",d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function b(I){return t.locateFile?t.locateFile(I,h):h+I}var p,g;if(d){const{createRequire:I}=await Promise.resolve().then(()=>hm);var A=I(import.meta.url),D=A("fs"),_=A("path");f?h=_.dirname(h)+"/":h=A("url").fileURLToPath(new URL("data:text/javascript;base64,DQp2YXIgTW9kdWxlID0gKCgpID0+IHsNCiAgdmFyIF9zY3JpcHREaXIgPSBpbXBvcnQubWV0YS51cmw7DQogIA0KICByZXR1cm4gKA0KYXN5bmMgZnVuY3Rpb24obW9kdWxlQXJnID0ge30pIHsNCg0KdmFyIE1vZHVsZT1tb2R1bGVBcmc7dmFyIHJlYWR5UHJvbWlzZVJlc29sdmUscmVhZHlQcm9taXNlUmVqZWN0O01vZHVsZVsicmVhZHkiXT1uZXcgUHJvbWlzZSgocmVzb2x2ZSxyZWplY3QpPT57cmVhZHlQcm9taXNlUmVzb2x2ZT1yZXNvbHZlO3JlYWR5UHJvbWlzZVJlamVjdD1yZWplY3R9KTt2YXIgbW9kdWxlT3ZlcnJpZGVzPU9iamVjdC5hc3NpZ24oe30sTW9kdWxlKTt2YXIgYXJndW1lbnRzXz1bXTt2YXIgdGhpc1Byb2dyYW09Ii4vdGhpcy5wcm9ncmFtIjt2YXIgcXVpdF89KHN0YXR1cyx0b1Rocm93KT0+e3Rocm93IHRvVGhyb3d9O3ZhciBFTlZJUk9OTUVOVF9JU19XRUI9dHlwZW9mIHdpbmRvdz09Im9iamVjdCI7dmFyIEVOVklST05NRU5UX0lTX1dPUktFUj10eXBlb2YgaW1wb3J0U2NyaXB0cz09ImZ1bmN0aW9uIjt2YXIgRU5WSVJPTk1FTlRfSVNfTk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XS5sZW5ndGg+MCl7TW9kdWxlWyJwcmVJbml0Il0ucG9wKCkoKX19dmFyIHNob3VsZFJ1bk5vdz10cnVlO2lmKE1vZHVsZVsibm9Jbml0aWFsUnVuIl0pc2hvdWxkUnVuTm93PWZhbHNlO3J1bigpOw0KDQoNCiAgcmV0dXJuIG1vZHVsZUFyZy5yZWFkeQ0KfQ0KKTsNCn0pKCk7DQpleHBvcnQgZGVmYXVsdCBNb2R1bGU7",import.meta.url)),p=(N,W)=>(N=Nt(N)?new URL(N):_.normalize(N),D.readFileSync(N,W?void 0:"utf8")),g=N=>{var W=p(N,!0);return W.buffer||(W=new Uint8Array(W)),W},!t.thisProgram&&process.argv.length>1&&(o=process.argv[1].replace(/\\/g,"/")),n=process.argv.slice(2),l=(N,W)=>{throw process.exitCode=N,W}}else(c||f)&&(f?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),s&&(h=s),h.startsWith("blob:")?h="":h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1),p=I=>{var N=new XMLHttpRequest;return N.open("GET",I,!1),N.send(null),N.responseText},f&&(g=I=>{var N=new XMLHttpRequest;return N.open("GET",I,!1),N.responseType="arraybuffer",N.send(null),new Uint8Array(N.response)}));var U=t.print||console.log.bind(console),v=t.printErr||console.error.bind(console);Object.assign(t,i),i=null,t.arguments&&(n=t.arguments),t.thisProgram&&(o=t.thisProgram),t.quit&&(l=t.quit);var x;t.wasmBinary&&(x=t.wasmBinary);function C(I){if(typeof d<"u"&&d){var N=Buffer.from(I,"base64");return new Uint8Array(N.buffer,N.byteOffset,N.length)}for(var W=atob(I),he=new Uint8Array(W.length),Re=0;Re<W.length;++Re)he[Re]=W.charCodeAt(Re);return he}function F(I){if(kt(I))return C(I.slice(Ft.length))}var w,S=!1,M,T,Q,L;function X(){var I=w.buffer;t.HEAP8=T=new Int8Array(I),t.HEAP16=new Int16Array(I),t.HEAPU8=Q=new Uint8Array(I),t.HEAPU16=new Uint16Array(I),t.HEAP32=new Int32Array(I),t.HEAPU32=L=new Uint32Array(I),t.HEAPF32=new Float32Array(I),t.HEAPF64=new Float64Array(I)}var ie=[],q=[],be=[],Ue=[];function Z(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)_e(t.preRun.shift());_a(ie)}function de(){_a(q)}function ce(){_a(be)}function De(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)we(t.postRun.shift());_a(Ue)}function _e(I){ie.unshift(I)}function Ne(I){q.unshift(I)}function we(I){Ue.unshift(I)}var Ce=0,Me=null;function ct(I){Ce++,t.monitorRunDependencies?.(Ce)}function ga(I){if(Ce--,t.monitorRunDependencies?.(Ce),Ce==0&&Me){var N=Me;Me=null,N()}}function Mt(I){t.onAbort?.(I),I="Aborted("+I+")",v(I),S=!0,M=1,I+=". Build with -sASSERTIONS for more info.";var N=new WebAssembly.RuntimeError(I);throw r(N),N}var Ft="data:application/octet-stream;base64,",kt=I=>I.startsWith(Ft),Nt=I=>I.startsWith("file://"),xt;xt="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/AUHwuAQLBzkOAWYCAAFnAB0BaABbAWkAUgFqAE4BawBNAWwASwFtA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BQRAQQAhBANAIAJBCGpBAEHwABAHGiACQoCAgICAgID4PzcDeCACQoCAgICAgID4PzcDUCACQoCAgICAgID4PzcDKCACQoCAgICAgID4PzcDACACQYABaiECIARBAWoiBCAFRw0ACwsgBkEHdCADaiEDIAZBAWtB////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/QsDACACQQhrIANBCGsrAwA5AwAgBSECIAEiAyAGRw0ACwsgACAHNgIIIAAgCDYCBCAAIAU2AgAgBgRAIAYQDAsPCxATAAsQEgALGQEBf0GgKygCACIBIAAgASgCACgCGBEBAAsQACMAIABrQXBxIgAkACAACwcAIAAoAgQLBQBBowkLBQBBzQkLBQBBkAkLFwEBf0GgKygCACIAIAAoAgAoAhQRAAALFQAgAEUEQEEADwsgAEHkJhAiQQBHCxoAIAAgASgCCCAFEAoEQCABIAIg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AAAAFQAAALgVAAAABABBxCoLAQEAQdQqCwX/////CgBBmCsLA3AcAQ==",kt(xt)||(xt=b(xt));function pa(I){if(I==xt&&x)return new Uint8Array(x);var N=F(I);if(N)return N;if(g)return g(I);throw"both async and sync fetching of the wasm failed"}function ma(I){return Promise.resolve().then(()=>pa(I))}function Aa(I,N,W){return ma(I).then(he=>WebAssembly.instantiate(he,N)).then(W,he=>{v(`failed to asynchronously prepare wasm: ${he}`),Mt(he)})}function Da(I,N,W,he){return Aa(N,W,he)}function Dr(){var I={a:pu};function N(he,Re){return yt=he.exports,w=yt.f,X(),Ne(yt.g),ga(),yt}ct();function W(he){N(he.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(I,N)}catch(he){v(`Module.instantiateWasm callback failed with error: ${he}`),r(he)}return Da(x,xt,I,W).catch(r),{}}function ja(I){this.name="ExitStatus",this.message=`Program terminated with exit(${I})`,this.status=I}var _a=I=>{for(;I.length>0;)I.shift()(t)};t.noExitRuntime;class _r{constructor(N){this.excPtr=N,this.ptr=N-24}set_type(N){L[this.ptr+4>>2]=N}get_type(){return L[this.ptr+4>>2]}set_destructor(N){L[this.ptr+8>>2]=N}get_destructor(){return L[this.ptr+8>>2]}set_caught(N){N=N?1:0,T[this.ptr+12]=N}get_caught(){return T[this.ptr+12]!=0}set_rethrown(N){N=N?1:0,T[this.ptr+13]=N}get_rethrown(){return T[this.ptr+13]!=0}init(N,W){this.set_adjusted_ptr(0),this.set_type(N),this.set_destructor(W)}set_adjusted_ptr(N){L[this.ptr+16>>2]=N}get_adjusted_ptr(){return L[this.ptr+16>>2]}get_exception_ptr(){var N=al(this.get_type());if(N)return L[this.excPtr>>2];var W=this.get_adjusted_ptr();return W!==0?W:this.excPtr}}var Ya=0,Br=(I,N,W)=>{var he=new _r(I);throw he.init(N,W),Ya=I,Ya},Ba=()=>{Mt("")},vr=(I,N,W)=>Q.copyWithin(I,N,N+W),Ur=()=>2147483648,Jt=I=>{var N=w.buffer,W=(I-N.byteLength+65535)/65536;try{return w.grow(W),X(),1}catch{}},xr=I=>{var N=Q.length;I>>>=0;var W=Ur();if(I>W)return!1;for(var he=(ta,Zr)=>ta+(Zr-ta%Zr)%Zr,Re=1;Re<=4;Re*=2){var Je=N*(1+.2/Re);Je=Math.min(Je,I+100663296);var Ie=Math.min(W,he(Math.max(I,Je),65536)),Se=Jt(Ie);if(Se)return!0}return!1},yr=[null,[],[]],Xa=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Cr=(I,N,W)=>{for(var he=N+W,Re=N;I[Re]&&!(Re>=he);)++Re;if(Re-N>16&&I.buffer&&Xa)return Xa.decode(I.subarray(N,Re));for(var Je="";N<Re;){var Ie=I[N++];if(!(Ie&128)){Je+=String.fromCharCode(Ie);continue}var Se=I[N++]&63;if((Ie&224)==192){Je+=String.fromCharCode((Ie&31)<<6|Se);continue}var ta=I[N++]&63;if((Ie&240)==224?Ie=(Ie&15)<<12|Se<<6|ta:Ie=(Ie&7)<<18|Se<<12|ta<<6|I[N++]&63,Ie<65536)Je+=String.fromCharCode(Ie);else{var Zr=Ie-65536;Je+=String.fromCharCode(55296|Zr>>10,56320|Zr&1023)}}return Je},Sr=(I,N)=>{var W=yr[I];N===0||N===10?((I===1?U:v)(Cr(W,0)),W.length=0):W.push(N)},Fr=(I,N,W,he)=>{for(var Re=0,Je=0;Je<W;Je++){var Ie=L[N>>2],Se=L[N+4>>2];N+=8;for(var ta=0;ta<Se;ta++)Sr(I,Q[Ie+ta]);Re+=Se}return L[he>>2]=Re,0},kr=I=>{M=I,l(I,new ja(I))},Er=(I,N)=>{M=I,kr(I)},du=I=>{if(I instanceof ja||I=="unwind")return M;l(1,I)},hu=I=>{for(var N=0,W=0;W<I.length;++W){var he=I.charCodeAt(W);he<=127?N++:he<=2047?N+=2:he>=55296&&he<=57343?(N+=4,++W):N+=3}return N},uu=(I,N,W,he)=>{if(!(he>0))return 0;for(var Re=W,Je=W+he-1,Ie=0;Ie<I.length;++Ie){var Se=I.charCodeAt(Ie);if(Se>=55296&&Se<=57343){var ta=I.charCodeAt(++Ie);Se=65536+((Se&1023)<<10)|ta&1023}if(Se<=127){if(W>=Je)break;N[W++]=Se}else if(Se<=2047){if(W+1>=Je)break;N[W++]=192|Se>>6,N[W++]=128|Se&63}else if(Se<=65535){if(W+2>=Je)break;N[W++]=224|Se>>12,N[W++]=128|Se>>6&63,N[W++]=128|Se&63}else{if(W+3>=Je)break;N[W++]=240|Se>>18,N[W++]=128|Se>>12&63,N[W++]=128|Se>>6&63,N[W++]=128|Se&63}}return N[W]=0,W-Re},bu=(I,N,W)=>uu(I,Q,N,W),gu=I=>{var N=hu(I)+1,W=an(N);return bu(I,W,N),W},pu={b:Br,c:Ba,e:vr,d:xr,a:Fr},yt=Dr();t._initialize=(I,N,W)=>(t._initialize=yt.h)(I,N,W),t._allocMatrix=I=>(t._allocMatrix=yt.i)(I),t._getMatrixBufferPtr=()=>(t._getMatrixBufferPtr=yt.j)(),t._getSRTPtr=()=>(t._getSRTPtr=yt.k)(),t._getInfoPtr=()=>(t._getInfoPtr=yt.l)(),t._getContinuedSRTPtr=()=>(t._getContinuedSRTPtr=yt.m)(),t._printMatrix=I=>(t._printMatrix=yt.n)(I),t._updateAllMatrixContinueTransform=(I,N,W)=>(t._updateAllMatrixContinueTransform=yt.o)(I,N,W);var tl=t._main=(I,N)=>(tl=t._main=yt.p)(I,N),an=I=>(an=yt.r)(I),al=I=>(al=yt.s)(I),ds;Me=function I(){ds||rl(),ds||(Me=I)};function mu(I=[]){var N=tl;I.unshift(o);var W=I.length,he=an((W+1)*4),Re=he;I.forEach(Ie=>{L[Re>>2]=gu(Ie),Re+=4}),L[Re>>2]=0;try{var Je=N(W,he);return Er(Je,!0),Je}catch(Ie){return du(Ie)}}function rl(I=n){if(Ce>0||(Z(),Ce>0))return;function N(){ds||(ds=!0,t.calledRun=!0,!S&&(de(),ce(),a(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),il&&mu(I),De()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),N()},1)):N()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();var il=!0;return t.noInitialRun&&(il=!1),rl(),e.ready})})();function tr(s,e,t){return m.setting.doublePrecision?new Float64Array(s,e,t):new Float32Array(s,e,t)}class pe{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 Su(),this.useDoublePrecision=t,this.wasm._initialize(e,t,0),this.allocMatrix(e)}static allocMatrix(e){e>E.maxCount&&console.error(`The maximum allocation size is exceeded! current:${e}, limit:${E.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=tr(this.wasm.HEAPF64.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=tr(this.wasm.HEAPF64.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=tr(this.wasm.HEAPF64.buffer,this.matrixContinuedSRTBufferPtr,9*e),E.blockBytes=E.block*8):(this.matrixBuffer=tr(this.wasm.HEAPF32.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=tr(this.wasm.HEAPF32.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=tr(this.wasm.HEAPF32.buffer,this.matrixContinuedSRTBufferPtr,9*e),E.blockBytes=E.block*4),this.matrixStateBuffer=new Int32Array(this.wasm.HEAP32.buffer,this.matrixStateBufferPtr,pe.stateStruct*e),E.allocMatrix(e)}static updateAllContinueTransform(e,t,a){this.wasm._updateAllMatrixContinueTransform(e,t,a)}static setParent(e,t,a){this.matrixStateBuffer[e*pe.stateStruct+2]=t>=0?t:-1,this.matrixStateBuffer[e*pe.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*pe.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*pe.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*pe.stateStruct+1]=1)}}class jt{static AXIS_ANGLE="axisAngle";static EULER_ANGLES="eulerAngles";static QUATERNION="quaternion"}class j{static HELP_0=new j(0,0,0,1);static HELP_1=new j(0,0,0,1);static HELP_2=new j(0,0,0,1);static _zero=new j(0,0,0,1);static CALCULATION_QUATERNION=new j;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 j._zero}static quaternionToMatrix(e,t){let a=e.x*2,r=e.y*2,i=e.z*2,n=e.x*a,o=e.y*r,l=e.z*i,c=e.x*r,f=e.x*i,d=e.y*i,h=e.w*a,b=e.w*r,p=e.w*i;t.rawData[0]=1-(o+l),t.rawData[1]=c+p,t.rawData[2]=f-b,t.rawData[3]=0,t.rawData[4]=c-p,t.rawData[5]=1-(n+l),t.rawData[6]=d+h,t.rawData[7]=0,t.rawData[8]=f+b,t.rawData[9]=d-h,t.rawData[10]=1-(n+o),t.rawData[11]=0,t.rawData[12]=0,t.rawData[13]=0,t.rawData[14]=0,t.rawData[15]=1}get magnitude(){return Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z)}set(e=0,t=0,a=0,r=1){return this.x=e,this.y=t,this.z=a,this.w=r,this}divide(e){return e instanceof j?new j(this.x/e.x,this.y/e.y,this.z/e.z):(this.x=this.x/e,this.y=this.y/e,this.z=this.z/e,this)}setFromArray(e){return this.x=e[0],this.y=e[1],this.z=e[2],this.w=e[3],this}multiply(e,t){var a=e.w,r=e.x,i=e.y,n=e.z,o=t.w,l=t.x,c=t.y,f=t.z;this.w=a*o-r*l-i*c-n*f,this.x=a*l+r*o+i*f-n*c,this.y=a*c-r*f+i*o+n*l,this.z=a*f+r*c-i*l+n*o}multiplyVector(e,t=null){t||=new j;var a=e.x,r=e.y,i=e.z;return t.w=-this.x*a-this.y*r-this.z*i,t.x=this.w*a+this.y*i-this.z*r,t.y=this.w*r-this.x*i+this.z*a,t.z=this.w*i+this.x*r-this.y*a,t}fromAxisAngle(e,t){t*=Math.PI/180;var a=t*.5,r=Math.sin(a);this.w=Math.cos(a),this.x=e.x*r,this.y=e.y*r,this.z=e.z*r,this.normalize()}toAxisAngle(e){var t=this.x*this.x+this.y*this.y+this.z*this.z,a=0;return t>0?(a=2*Math.acos(this.w),t=1/Math.sqrt(t),e.x=this.x*t,e.y=this.y*t,e.z=this.z*t):(a=0,e.x=1,e.y=0,e.z=0),a}slerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h=r*l+i*c+n*f+o*d;if(h<0&&(h=-h,l=-l,c=-c,f=-f,d=-d),h<.95){var b=Math.acos(h),p=1/Math.sin(b),g=Math.sin(b*(1-a))*p,A=Math.sin(b*a)*p;this.w=r*g+l*A,this.x=i*g+c*A,this.y=n*g+f*A,this.z=o*g+d*A}else{this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o);var D=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z);this.w*=D,this.x*=D,this.y*=D,this.z*=D}}lerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h;r*l+i*c+n*f+o*d<0&&(l=-l,c=-c,f=-f,d=-d),this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o),h=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=h,this.x*=h,this.y*=h,this.z*=h}fromEulerAngles(e,t,a){e*=rt,t*=rt,a*=rt;var r=e*.5,i=t*.5,n=a*.5,o=Math.cos(r),l=Math.sin(r),c=Math.cos(i),f=Math.sin(i),d=Math.cos(n),h=Math.sin(n);return this.w=o*c*d+l*f*h,this.x=l*c*d-o*f*h,this.y=o*f*d+l*c*h,this.z=o*c*h-l*f*d,this}setFromRotationMatrix(e){const t=e.rawData,a=t[0],r=t[4],i=t[8],n=t[1],o=t[5],l=t[9],c=t[2],f=t[6],d=t[10],h=a+o+d;if(h>0){const b=.5/Math.sqrt(h+1);this.w=.25/b,this.x=(f-l)*b,this.y=(i-c)*b,this.z=(n-r)*b}else if(a>o&&a>d){const b=2*Math.sqrt(1+a-o-d);this.w=(f-l)/b,this.x=.25*b,this.y=(r+n)/b,this.z=(i+c)/b}else if(o>d){const b=2*Math.sqrt(1+o-a-d);this.w=(i-c)/b,this.x=(r+n)/b,this.y=.25*b,this.z=(l+f)/b}else{const b=2*Math.sqrt(1+d-a-o);this.w=(n-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,n,o,l,c;return e||=new u,i=this.x,n=this.y,o=this.z,l=this.w,c=2*(l*n-i*o),c<=-.99999?(t=2*Math.atan2(i,l),a=-Math.PI/2,r=0):c>=.99999?(t=2*Math.atan2(i,l),a=Math.PI/2,r=0):(t=Math.atan2(2*(l*i+n*o),1-2*(i*i+n*n)),a=Math.asin(c),r=Math.atan2(2*(l*o+i*n),1-2*(n*n+o*o))),e.set(t,a,r).scaleBy(Xr)}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(jt.QUATERNION)[1];this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}inverse(e=null){e||=new j;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 j(this.x,this.y,this.z,this.w)}transformVector(e,t=null){var a,r,i,n,o=e.x,l=e.y,c=e.z;return t||=new u,n=-this.x*o-this.y*l-this.z*c,a=this.w*o+this.y*c-this.z*l,r=this.w*l-this.x*c+this.z*o,i=this.w*c+this.x*l-this.y*o,t.x=-n*this.x+a*this.w-r*this.z+i*this.y,t.y=-n*this.y+a*this.z+r*this.w-i*this.x,t.z=-n*this.z-a*this.y+r*this.x+i*this.w,t}copyFrom(e){var t=this;return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,this}mul(e,t,a){let r=a||new j;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 j(e.x,e.y,e.z,e.w)}}function Fu(s,e,t){let a=s.x*2,r=s.y*2,i=s.z*2,n=s.x*a,o=s.y*r,l=s.z*i,c=s.x*r,f=s.x*i,d=s.y*i,h=s.w*a,b=s.w*r,p=s.w*i,g=t||new u;return g.x=(1-(o+l))*e.x+(c-p)*e.y+(f+b)*e.z,g.y=(c+p)*e.x+(1-(n+l))*e.y+(d-h)*e.z,g.z=(f-b)*e.x+(d+h)*e.y+(1-(n+o))*e.z,g}class Yi{_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 Yi;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 Dc(this.get())}getSignedFloat(){return this.getFloat()*2-1}}let Xr=180/Math.PI,rt=Math.PI/180,ku=2147483647,Eu=-2147483647;function se(s,e,t){return Math.max(e,Math.min(t,s))}class St{static gaussFunction(e,t,a,r){let i=Math.pow(e-a,2),n=2*Math.pow(r,2),o=-1*(i/n),l=Math.pow(Math.E,o);return Math.round(l*t)}static computeGaussian(e,t){return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(e*e)/(2*t*t))}static gaussCoef(e){e<.5&&(e=.5);let t=Math.exp(.726*.726)/e,a=Math.exp(-t),r=Math.exp(-2*t),i=(1-a)*(1-a)/(1+2*t*a-r),n=i,o=i*(t-1)*a,l=i*(t+1)*a,c=-i*r,f=2*a,d=-r,h=(n+o)/(1-f-d),b=(l+c)/(1-f-d);return new Float32Array([n,o,l,c,f,d,h,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()*rt,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()*rt,r=Math.cos(a)*t,i=Math.tan(a)*t,n=Math.sin(a)*t;return new u(r,i,n)}static getCycleXYZ(e){let t=e*Math.random(),a=360*Math.random()*rt,r=Math.cos(a)*t,i=e*Math.random()-e*.5,n=Math.sin(a)*t;return new u(r,i,n)}static angle(e,t){let a=K.HELP_0,r=K.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=u.HELP_0;return e.crossProduct(t,a),a.z>0?St.angle(e,t):360-St.angle(e,t)}getRotationY(e){return St.normalizeAngle(Math.atan2(e.z,e.x)*Xr)}static fromToRotation(e,t,a=null){a||=new j;let r=E.help_matrix_2;return E.fromToRotation(e,t,r),a.fromMatrix(r),a}static getEularDir_yUp(e){let t=j.HELP_0;return t.fromEulerAngles(0,e,0),t.transformVector(u.Z_AXIS,u.HELP_5),u.HELP_5}static transformVector(e,t,a=null){a||=new u;let r=e.rawData,i=r[0],n=r[1],o=r[2],l=r[3],c=r[4],f=r[5],d=r[6],h=r[7],b=r[8],p=r[9],g=r[10],A=r[11],D=r[12],_=r[13],U=r[14],v=r[15],x=t.x,C=t.y,F=t.z;return a.x=i*x+c*C+b*F+D,a.y=n*x+f*C+p*F+_,a.z=o*x+d*C+g*F+U,a.w=l*x+h*C+A*F+v,a}}let wr=function(s,e,t){return s*(1-t)+e*t};function wu(s,e,t){let a=new u,r=s.x,i=s.y,n=s.z,o=s.w,l=e.x,c=e.y,f=e.z,d=e.w;return a.x=(l-r)*t+r,a.y=(c-i)*t+i,a.z=(f-n)*t+n,a.w=(d-o)*t+o,a}function Ru(s,e,t){let a=new P;return a.r=(1-t)*s.r+t*e.r,a.g=(1-t)*s.g+t*e.g,a.b=(1-t)*s.b+t*e.b,a.a=(1-t)*s.a+t*e.a,a}function Iu(s,e,t){return s+((e-s)*t>>8)&255}let gn=function(s,e,t){let a=t-e;return Math.floor(s/a)%2==0?s%a+e:t-s%a+e},pn=function(s,e,t){let a=t-e;return s%a+e},Qu=function(s,e){let t=0;for(let a in s)a==e&&t++;return t};class Tu{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 ut(s,e){return s instanceof u&&e instanceof u||s instanceof j&&e instanceof j?s.x*e.x+s.y*e.y+s.z*e.z:s.x*e.x+s.y*e.y}function mn(s,e){return new u(s.x*e.x,s.y*e.y,s.z*e.z)}function mc(s){return Math.sqrt(s)}function An(s){return mc(ut(s,s))}function Ac(s,e){if(An(s)>u.EPSILON)return s.divide(An(s));if(s instanceof K)return new K;if(s instanceof u)return new u;if(s instanceof j)return new j}function Dc(s){return(s&8388607)*(1/8388607)}function Hr(s){return s.getFloat()}function it(s,e,t){let a=s.getFloat();return a=e*a+(1-a)*t,a}function Mu(s,e,t){let a;if(e<t){a=t-e;let r=s.get()%a;return r+=e,r}else if(e>t){a=e-t;let r=s.get()%a;return r=e-r,r}else return e}function gs(s){let e=it(s,-1,1),t=it(s,0,2*Math.PI),a=Math.sqrt(1-e*e),r=a*Math.cos(t),i=a*Math.sin(t);return new u(r,i,e)}function _c(s){let e=it(s,0,2*Math.PI),t=Math.cos(e),a=Math.sin(e);return new K(t,a)}function Nu(s){let e=new j;return e.x=it(s,-1,1),e.y=it(s,-1,1),e.z=it(s,-1,1),e.w=it(s,-1,1),e=Ac(e),ut(e,j.identity())<0?-e:e}function Vu(s){const e=2*Math.PI;let t=it(s,0,1),a=it(s,0,e),r=it(s,0,e),i=Math.sqrt(1-t),n=Math.sqrt(t),o=new j(i*Math.sin(a),i*Math.cos(a),n*Math.sin(r),n*Math.cos(r));return ut(o,j.identity())<0?-o:o}function Pu(s,e){return new u(it(s,-e.x,e.x),it(s,-e.y,e.y),it(s,-e.z,e.z))}function Bc(s){let e=gs(s);return e.scaleBy(Math.pow(Hr(s),1/3)),e}function Ou(s,e){return mn(Bc(s),e)}function Lu(s,e,t){let a=gs(s),r=Math.pow(it(s,0,1),1/3);return a.scaleBy(e+(t-e)*r),a}function Gu(s){let e=_c(s);return e.multiply(Math.pow(it(s,0,1),1/2),e),e}function zu(s,e,t){let a=mn(gs(s),e),r=Math.pow(it(s,t,1),1/3);return a.scaleBy(r),a}function Ju(s){let e=s.getFloat(),t=s.getFloat();e+t>1&&(e=1-e,t=1-t);let a=1-e-t;return new u(e,t,a)}function Wu(s){return s/360*2*Math.PI}function Zu(s){return 180*s/Math.PI}function ju(s){return Math.sin(s)}function Yu(s){return Math.cos(s)}let vc=4919;function Xu(){return++vc}function Hu(s,e,t){let a=s[e],r=s[t];s[e]=r,s[t]=a}function Uc(s){return Math.floor(s)}function Dn(s){return Uc(s+.5)}function Ku(s){return s=Math.max(s,0),s=Math.min(s,1),Dn(s*65535)}function qu(s){return s=Math.max(s,0),s=Math.min(s,1),Dn(s*255)}function xc(s){return Math.abs(s)==0?s:1/Math.sqrt(s)}function $u(s){let e=_n(s);return s.scaleBy(xc(e))}function e2(s,e){return s.crossProduct(e)}function _n(s){return ut(s,s)}function t2(s){let e=new Yi(s);return Hr(e)}function a2(s,e){let t=new Yi(e);s.x=Hr(t),s.y=Hr(t),s.z=Hr(t)}function r2(s,e,t){return s<e?t:s>t?e:s}function Bn(s,e){return s-Math.floor(s/e)*e}const i2=1e-6;class E{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 u(0,0,0);static _one=new u(1,1,1);static _prs=[new u,new u,new u];index=0;offset=0;rawData;_position;static allocMatrix(e){this.allocCount=e,E.dynamicMatrixBytes=pe.matrixBuffer,E.buffer=E.dynamicMatrixBytes.buffer,E.wasmMatrixPtr=pe.matrixBufferPtr,this.dynamicGlobalMatrixRef||=[],this.dynamicGlobalMatrixRef.forEach(t=>{t.offset=E.wasmMatrixPtr+t.index*E.blockBytes,t.rawData=tr(E.dynamicMatrixBytes.buffer,t.offset,16)}),E.help_matrix_0||=new E,E.help_matrix_1||=new E,E.help_matrix_2||=new E,E.helpMatrix||=new E,E.helpMatrix2||=new E,E._getEulerMatrix||=new E,E._getEulerMatrix.identity()}static fromToRotation(e,t,a){return a||=new E,a.transformDir(e,t),a}static fromArray(e){if(e.length!==16)throw new Error("Array must contain exactly 16 elements");const t=new E;for(let a=0;a<16;a++)t.rawData[a]=e[a];return t}static getAxisRotation(e,t,a,r){let i=new E,n=r*(Math.PI/180),o=Math.cos(n),l=Math.sin(n),c=1-o,f,d;return i.rawData[0]=o+e*e*c,i.rawData[5]=o+t*t*c,i.rawData[10]=o+a*a*c,f=e*t*c,d=a*l,i.rawData[1]=f+d,i.rawData[4]=f-d,f=e*a*c,d=t*l,i.rawData[8]=f+d,i.rawData[2]=f-d,f=t*a*c,d=e*l,i.rawData[9]=f-d,i.rawData[6]=f+d,i}static sanitizeEuler(e){E.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)),E.sanitizeEuler(t),!0):(t.x=Math.PI*.5,t.y=Math.atan2(e.get(0,1),e.get(0,0)),t.z=0,E.sanitizeEuler(t),!1):(t.x=-Math.PI*.5,t.y=Math.atan2(-e.get(0,1),e.get(0,0)),t.z=0,E.sanitizeEuler(t),!1)}static matrixMultiply(e,t,a){E.wasm.Matrix_Multiply(e.index,t.index,a.index)}static matrixAppend(e,t,a){E.wasm.Matrix_Append(e.index,t.index,a.index)}static matrixRotateY(e,t){E.wasm.Matrix_Append(e,t.index)}static matrixRotate(e,t,a){E.wasm.Matrix_Rotate(e,t,a.index)}constructor(e=!1){if(E.useCount>=E.allocCount){let t=E.allocCount+E.allocOnceCount;pe.allocMatrix(t)}this.index=E.useCount,this.offset=E.wasmMatrixPtr+this.index*E.blockBytes,E.dynamicGlobalMatrixRef[this.index]=this,E.useCount++,this.rawData=tr(E.dynamicMatrixBytes.buffer,this.offset,16),this._position=new u,this.identity()}lookAt(e,t,a=u.Y_AXIS){let r=this.rawData,i=t.subtract(e,u.HELP_0);i.length===0&&(i.z=1),i.normalize();let n=a.crossProduct(i,u.HELP_1);n.length===0&&(Math.abs(a.z)===1?i.x+=1e-4:i.z-=1e-4,i.normalize(),n=a.crossProduct(i,u.HELP_1)),n.normalize();let o=i.crossProduct(n,u.HELP_2);r[0]=n.x,r[1]=o.x,r[2]=i.x,r[3]=0,r[4]=n.y,r[5]=o.y,r[6]=i.y,r[7]=0,r[8]=n.z,r[9]=o.z,r[10]=i.z,r[11]=0,r[12]=-n.dotProduct(e),r[13]=-o.dotProduct(e),r[14]=-i.dotProduct(e),r[15]=1}static floatArray=new Float64Array(16).fill(0);multiply(e){let t=this.rawData,a=e.rawData,r=E.floatArray;r[0]=t[0]*a[0]+t[1]*a[4]+t[2]*a[8]+t[3]*a[12],r[1]=t[0]*a[1]+t[1]*a[5]+t[2]*a[9]+t[3]*a[13],r[2]=t[0]*a[2]+t[1]*a[6]+t[2]*a[10]+t[3]*a[14],r[3]=t[0]*a[3]+t[1]*a[7]+t[2]*a[11]+t[3]*a[15],r[4]=t[4]*a[0]+t[5]*a[4]+t[6]*a[8]+t[7]*a[12],r[5]=t[4]*a[1]+t[5]*a[5]+t[6]*a[9]+t[7]*a[13],r[6]=t[4]*a[2]+t[5]*a[6]+t[6]*a[10]+t[7]*a[14],r[7]=t[4]*a[3]+t[5]*a[7]+t[6]*a[11]+t[7]*a[15],r[8]=t[8]*a[0]+t[9]*a[4]+t[10]*a[8]+t[11]*a[12],r[9]=t[8]*a[1]+t[9]*a[5]+t[10]*a[9]+t[11]*a[13],r[10]=t[8]*a[2]+t[9]*a[6]+t[10]*a[10]+t[11]*a[14],r[11]=t[8]*a[3]+t[9]*a[7]+t[10]*a[11]+t[11]*a[15],r[12]=t[12]*a[0]+t[13]*a[4]+t[14]*a[8]+t[15]*a[12],r[13]=t[12]*a[1]+t[13]*a[5]+t[14]*a[9]+t[15]*a[13],r[14]=t[12]*a[2]+t[13]*a[6]+t[14]*a[10]+t[15]*a[14],r[15]=t[12]*a[3]+t[13]*a[7]+t[14]*a[11]+t[15]*a[15],t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]}multiplyMatrices(e,t){const a=e.rawData,r=t.rawData,i=this.rawData,n=a[0],o=a[4],l=a[8],c=a[12],f=a[1],d=a[5],h=a[9],b=a[13],p=a[2],g=a[6],A=a[10],D=a[14],_=a[3],U=a[7],v=a[11],x=a[15],C=r[0],F=r[4],w=r[8],S=r[12],M=r[1],T=r[5],Q=r[9],L=r[13],X=r[2],ie=r[6],q=r[10],be=r[14],Ue=r[3],Z=r[7],de=r[11],ce=r[15];return i[0]=n*C+o*M+l*X+c*Ue,i[4]=n*F+o*T+l*ie+c*Z,i[8]=n*w+o*Q+l*q+c*de,i[12]=n*S+o*L+l*be+c*ce,i[1]=f*C+d*M+h*X+b*Ue,i[5]=f*F+d*T+h*ie+b*Z,i[9]=f*w+d*Q+h*q+b*de,i[13]=f*S+d*L+h*be+b*ce,i[2]=p*C+g*M+A*X+D*Ue,i[6]=p*F+g*T+A*ie+D*Z,i[10]=p*w+g*Q+A*q+D*de,i[14]=p*S+g*L+A*be+D*ce,i[3]=_*C+U*M+v*X+x*Ue,i[7]=_*F+U*T+v*ie+x*Z,i[11]=_*w+U*Q+v*q+x*de,i[15]=_*S+U*L+v*be+x*ce,this}multiplyPoint3(e,t){t||=new u;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 u;let a=this.rawData,r=e.x,i=e.y,n=e.z,o=a[3]*r+a[7]*i+a[11]*n+a[15];return o=o||1,t.x=(a[0]*r+a[4]*i+a[8]*n+a[12])/o,t.y=(a[1]*r+a[5]*i+a[9]*n+a[13])/o,t.z=(a[2]*r+a[6]*i+a[10]*n+a[14])/o,t.w=1,t}transformVector4(e,t){let a=this.rawData;t||=new u;let r=e.x,i=e.y,n=e.z,o=e.w;return t.x=r*a[0]+i*a[4]+n*a[8]+o*a[12],t.y=r*a[1]+i*a[5]+n*a[9]+o*a[13],t.z=r*a[2]+i*a[6]+n*a[10]+o*a[14],t.w=r*a[3]+i*a[7]+n*a[11]+o*a[15],t}perspectiveMultiplyPoint3(e,t){let a=u.HELP_2,r,i=this.rawData;if(a.x=i[0]*e.x+i[4]*e.y+i[8]*e.z+i[12],a.y=i[1]*e.x+i[5]*e.y+i[9]*e.z+i[13],a.z=i[2]*e.x+i[6]*e.y+i[10]*e.z+i[14],r=i[3]*e.x+i[7]*e.y+i[11]*e.z+i[15],Math.abs(r)>1e-7){let n=1/r;return t.x=a.x*n,t.y=a.y*n,t.z=a.z*n,!0}else return t.x=0,t.y=0,t.z=0,!1}perspective(e,t,a,r){let i=this.rawData,n=e*rt/2,o=Math.cos(n)/Math.sin(n);i[0]=-o/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r/(r-a),i[11]=1,i[12]=0,i[13]=0,i[14]=-a*r/(r-a),i[15]=0}perspective3(e,t,a,r){let i=Math.tan(e*Math.PI/360)*a,n=i*t;this.frustum(-n,n,-i,i,a,r)}frustum(e,t,a,r,i,n){let o=this.rawData;o[0]=-2*i/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*i/(r-a),o[6]=0,o[7]=0,o[8]=(t+e)/(t-e),o[9]=(r+a)/(r-a),o[10]=n/(n-i),o[11]=1,o[12]=0,o[13]=0,o[14]=-n*i/(n-i),o[15]=0}ortho(e,t,a,r){let i=this.rawData;return i[0]=2/e,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/t,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1/(r-a),i[11]=0,i[12]=0,i[13]=0,i[14]=a/(a-r),i[15]=1,this}orthoZO(e,t,a,r,i,n){let o=this.rawData,l=1/(e-t),c=1/(a-r),f=1/(i-n);return o[0]=-2*l,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*c,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=f,o[11]=0,o[12]=(e+t)*l,o[13]=(r+a)*c,o[14]=i*f,o[15]=1,this}orthoOffCenter(e,t,a,r,i,n){let o=this.rawData;o[0]=2/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2/(r-a),o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1/(n-i),o[11]=0,o[12]=(e+t)/(e-t),o[13]=(r+a)/(a-r),o[14]=i/(i-n),o[15]=1}transformDir(e,t){let a=this.rawData,r=1e-6,i=u.ZERO;t.crossProduct(e,i);let n=t.dotProduct(e);if(n>1-r)this.identity();else if(n<-1+r){let o=u.HELP_1,l=u.HELP_2,c=0,f,d,h,b,p,g,A,D,_,U,v,x,C,F,w,S,M,T;l.x=0,l.y=e.z,l.z=-e.y,l.dotProduct(l)<r&&(l.x=-e.z,l.y=0,l.z=e.x),c=1/Math.sqrt(l.dotProduct(l)),l.x*=c,l.y*=c,l.z*=c,l.crossProduct(e,o),f=-e.x*e.x,d=-e.y*e.y,h=-e.z*e.z,b=-e.x*e.y,p=-e.x*e.z,g=-e.y*e.z,A=o.x*o.x,D=o.y*o.y,_=o.z*o.z,U=o.x*o.y,v=o.x*o.z,x=o.y*o.z,C=-l.x*l.x,F=-l.y*l.y,w=-l.z*l.z,S=-l.x*l.y,M=-l.x*l.z,T=-l.y*l.z,a[0]=f+A+C,a[1]=b+U+S,a[2]=p+v+M,a[4]=a[1],a[5]=d+D+F,a[6]=g+x+T,a[8]=a[2],a[9]=a[6],a[10]=h+_+w,a[3]=0,a[7]=0,a[11]=0,a[15]=1}else{let o,l,c,f,d,h=i.dotProduct(i),b=(1-n)/h;o=b*i.x,l=b*i.z,c=o*i.y,f=o*i.z,d=l*i.y,a[0]=n+o*i.x,a[1]=c-i.z,a[2]=f+i.y,a[4]=c+i.z,a[5]=n+b*i.y*i.y,a[6]=d-i.x,a[8]=f-i.y,a[9]=d+i.x,a[10]=n+l*i.z,a[3]=0,a[7]=0,a[11]=0,a[15]=1}return this}append(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],b=t[10],p=t[14],g=t[3],A=t[7],D=t[11],_=t[15];t[0]=a*e.rawData[0]+o*e.rawData[4]+d*e.rawData[8]+g*e.rawData[12],t[1]=a*e.rawData[1]+o*e.rawData[5]+d*e.rawData[9]+g*e.rawData[13],t[2]=a*e.rawData[2]+o*e.rawData[6]+d*e.rawData[10]+g*e.rawData[14],t[3]=a*e.rawData[3]+o*e.rawData[7]+d*e.rawData[11]+g*e.rawData[15],t[4]=r*e.rawData[0]+l*e.rawData[4]+h*e.rawData[8]+A*e.rawData[12],t[5]=r*e.rawData[1]+l*e.rawData[5]+h*e.rawData[9]+A*e.rawData[13],t[6]=r*e.rawData[2]+l*e.rawData[6]+h*e.rawData[10]+A*e.rawData[14],t[7]=r*e.rawData[3]+l*e.rawData[7]+h*e.rawData[11]+A*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]=n*e.rawData[0]+f*e.rawData[4]+p*e.rawData[8]+_*e.rawData[12],t[13]=n*e.rawData[1]+f*e.rawData[5]+p*e.rawData[9]+_*e.rawData[13],t[14]=n*e.rawData[2]+f*e.rawData[6]+p*e.rawData[10]+_*e.rawData[14],t[15]=n*e.rawData[3]+f*e.rawData[7]+p*e.rawData[11]+_*e.rawData[15]}add(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],b=t[10],p=t[14],g=t[3],A=t[7],D=t[11],_=t[15],U=e.rawData[0],v=e.rawData[4],x=e.rawData[8],C=e.rawData[12],F=e.rawData[1],w=e.rawData[5],S=e.rawData[9],M=e.rawData[13],T=e.rawData[2],Q=e.rawData[6],L=e.rawData[10],X=e.rawData[14],ie=e.rawData[3],q=e.rawData[7],be=e.rawData[11],Ue=e.rawData[15];return t[0]=a+U,t[1]=o+F,t[2]=d+T,t[3]=g+ie,t[4]=r+v,t[5]=l+w,t[6]=h+Q,t[7]=A+q,t[8]=i+x,t[9]=c+S,t[10]=b+L,t[11]=D+be,t[12]=n+C,t[13]=f+M,t[14]=p+X,t[15]=_+Ue,this}sub(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],b=t[10],p=t[14],g=t[3],A=t[7],D=t[11],_=t[15],U=e.rawData[0],v=e.rawData[4],x=e.rawData[8],C=e.rawData[12],F=e.rawData[1],w=e.rawData[5],S=e.rawData[9],M=e.rawData[13],T=e.rawData[2],Q=e.rawData[6],L=e.rawData[10],X=e.rawData[14],ie=e.rawData[3],q=e.rawData[7],be=e.rawData[11],Ue=e.rawData[15];return t[0]=a-U,t[1]=o-F,t[2]=d-T,t[3]=g-ie,t[4]=r-v,t[5]=l-w,t[6]=h-Q,t[7]=A-q,t[8]=i-x,t[9]=c-S,t[10]=b-L,t[11]=D-be,t[12]=n-C,t[13]=f-M,t[14]=p-X,t[15]=_-Ue,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=E.getAxisRotation(t.x,t.y,t.z,e);this.append(a)}createByRotation(e,t){let a=E.helpMatrix,r,i,n=e*rt;return r=Math.sin(n),i=Math.cos(n),t.x==1&&(a.rawData[0]=1,a.rawData[1]=0,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=i,a.rawData[6]=r,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=-r,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.y==1&&(a.rawData[0]=i,a.rawData[1]=0,a.rawData[2]=-r,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=1,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=r,a.rawData[9]=0,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.z==1&&(a.rawData[0]=i,a.rawData[1]=r,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=-r,a.rawData[5]=i,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=0,a.rawData[10]=1,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),this.append(a),this}appendScale(e,t,a){E.helpMatrix.createByScale(e,t,a),this.append(E.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 E;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(E._zero,e,E._one),this}static decomposeRawData=new Float64Array(16).fill(0);decompose(e="eulerAngles",t){let a=j.CALCULATION_QUATERNION,r=t||E._prs;this.copyRawDataTo(E.decomposeRawData);let i=E.decomposeRawData,n=r[0];n.x=i[12],n.y=i[13],n.z=i[14],i[12]=0,i[13]=0,i[14]=0;let o=r[2];o.x=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]),o.y=Math.sqrt(i[4]*i[4]+i[5]*i[5]+i[6]*i[6]),o.z=Math.sqrt(i[8]*i[8]+i[9]*i[9]+i[10]*i[10]),i[0]*(i[5]*i[10]-i[6]*i[9])-i[1]*(i[4]*i[10]-i[6]*i[8])+i[2]*(i[4]*i[9]-i[5]*i[8])<0&&(o.z=-o.z),i[0]/=o.x,i[1]/=o.x,i[2]/=o.x,i[4]/=o.y,i[5]/=o.y,i[6]/=o.y,i[8]/=o.z,i[9]/=o.z,i[10]/=o.z;let l=r[1],c;switch(e){case jt.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 jt.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 jt.EULER_ANGLES:c=i[0]+i[5]+i[10],c>0?(a.w=Math.sqrt(1+c)/2,a.x=(i[6]-i[9])/(4*a.w),a.y=(i[8]-i[2])/(4*a.w),a.z=(i[1]-i[4])/(4*a.w)):i[0]>i[5]&&i[0]>i[10]?(a.x=Math.sqrt(1+i[0]-i[5]-i[10])/2,a.w=(i[6]-i[9])/(4*a.x),a.y=(i[1]+i[4])/(4*a.x),a.z=(i[8]+i[2])/(4*a.x)):i[5]>i[10]?(l.y=Math.sqrt(1+i[5]-i[0]-i[10])/2,a.x=(i[1]+i[4])/(4*a.y),a.w=(i[8]-i[2])/(4*a.y),a.z=(i[6]+i[9])/(4*a.y)):(a.z=Math.sqrt(1+i[10]-i[0]-i[5])/2,a.x=(i[8]+i[2])/(4*a.z),a.y=(i[6]+i[9])/(4*a.z),a.w=(i[1]-i[4])/(4*a.z)),a.getEulerAngles(l);break}return r[0]=n,r[1]=l,r[2]=o,r}static getEuler(e,t,a=!0,r){return e||=new u,E._getEulerMatrix.makeRotationFromQuaternion(t).makeEuler(e,a,r),e}compose(e,t,a){const r=this.rawData,i=t.x,n=t.y,o=t.z,l=t.w,c=i+i,f=n+n,d=o+o,h=i*c,b=i*f,p=i*d,g=n*f,A=n*d,D=o*d,_=l*c,U=l*f,v=l*d,x=a.x,C=a.y,F=a.z;return r[0]=(1-(g+D))*x,r[1]=(b+v)*x,r[2]=(p-U)*x,r[3]=0,r[4]=(b-v)*C,r[5]=(1-(h+D))*C,r[6]=(A+_)*C,r[7]=0,r[8]=(p+U)*F,r[9]=(A-_)*F,r[10]=(1-(h+g))*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 u;let a=this.rawData,r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t.w=r*a[3]+i*a[7]+n*a[11],t}identity(){let e=this.rawData;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}fill(e){let t=this.rawData;t[1]=e,t[2]=e,t[3]=e,t[4]=e,t[6]=e,t[7]=e,t[8]=e,t[9]=e,t[11]=e,t[12]=e,t[13]=e,t[14]=e,t[0]=e,t[5]=e,t[10]=e,t[15]=e}invers33(){let e=this.rawData,t=e[5]*e[10]-e[9]*e[6],a=e[8]*e[6]-e[4]*e[10],r=e[4]*e[9]-e[8]*e[5],i=e[9]*e[2]-e[1]*e[10],n=e[0]*e[10]-e[8]*e[2],o=e[8]*e[1]-e[0]*e[9],l=e[1]*e[6]-e[5]*e[2],c=e[4]*e[2]-e[0]*e[6],f=e[0]*e[5]-e[4]*e[1],d=e[0]*t+e[4]*i+e[8]*l;if(Math.abs(d)>1e-11){let h=1/d;e[0]=h*t,e[4]=h*a,e[8]=h*r,e[1]=h*i,e[5]=h*n,e[9]=h*o,e[2]=h*l,e[6]=h*c,e[10]=h*f}}invert(){let e=this.determinant,t=Math.abs(e)>1e-11,a=this.rawData;if(t){e=1/e;let r=a[0],i=a[4],n=a[8],o=a[12],l=a[1],c=a[5],f=a[9],d=a[13],h=a[2],b=a[6],p=a[10],g=a[14],A=a[3],D=a[7],_=a[11],U=a[15];a[0]=e*(c*(p*U-g*_)-f*(b*U-g*D)+d*(b*_-p*D)),a[1]=-e*(l*(p*U-g*_)-f*(h*U-g*A)+d*(h*_-p*A)),a[2]=e*(l*(b*U-g*D)-c*(h*U-g*A)+d*(h*D-b*A)),a[3]=-e*(l*(b*_-p*D)-c*(h*_-p*A)+f*(h*D-b*A)),a[4]=-e*(i*(p*U-g*_)-n*(b*U-g*D)+o*(b*_-p*D)),a[5]=e*(r*(p*U-g*_)-n*(h*U-g*A)+o*(h*_-p*A)),a[6]=-e*(r*(b*U-g*D)-i*(h*U-g*A)+o*(h*D-b*A)),a[7]=e*(r*(b*_-p*D)-i*(h*_-p*A)+n*(h*D-b*A)),a[8]=e*(i*(f*U-d*_)-n*(c*U-d*D)+o*(c*_-f*D)),a[9]=-e*(r*(f*U-d*_)-n*(l*U-d*A)+o*(l*_-f*A)),a[10]=e*(r*(c*U-d*D)-i*(l*U-d*A)+o*(l*D-c*A)),a[11]=-e*(r*(c*_-f*D)-i*(l*_-f*A)+n*(l*D-c*A)),a[12]=-e*(i*(f*g-d*p)-n*(c*g-d*b)+o*(c*p-f*b)),a[13]=e*(r*(f*g-d*p)-n*(l*g-d*h)+o*(l*p-f*h)),a[14]=-e*(r*(c*g-d*b)-i*(l*g-d*h)+o*(l*b-c*h)),a[15]=e*(r*(c*p-f*b)-i*(l*p-f*h)+n*(l*b-c*h))}return t}transformPoint(e,t){let a=this.rawData;t||=new u;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8]+a[12],t.y=r*a[1]+i*a[5]+n*a[9]+a[13],t.z=r*a[2]+i*a[6]+n*a[10]+a[14],t}transformVector(e,t){let a=this.rawData;t||=new u;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t}transpose(){let e=this.rawData;for(let t=0;t<E.helpMatrix.rawData.length;t++)E.helpMatrix.rawData[t]=e[t];e[1]=E.helpMatrix.rawData[4],e[2]=E.helpMatrix.rawData[8],e[3]=E.helpMatrix.rawData[12],e[4]=E.helpMatrix.rawData[1],e[6]=E.helpMatrix.rawData[9],e[7]=E.helpMatrix.rawData[13],e[8]=E.helpMatrix.rawData[2],e[9]=E.helpMatrix.rawData[6],e[11]=E.helpMatrix.rawData[14],e[12]=E.helpMatrix.rawData[3],e[13]=E.helpMatrix.rawData[7],e[14]=E.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 u;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 u(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(),j.quaternionToMatrix(t,this),this.translate(new u(-e.x,-e.y,-e.z))}setScale(e){return this.set(0,0,e.x),this.set(0,1,0),this.set(0,2,0),this.set(0,3,0),this.set(1,0,0),this.set(1,1,e.y),this.set(1,2,0),this.set(1,3,0),this.set(2,0,0),this.set(2,1,0),this.set(2,2,e.z),this.set(2,3,0),this.set(3,0,0),this.set(3,1,0),this.set(3,2,0),this.set(3,3,1),this}makeBasis(e,t,a){return this.setElements(e.x,t.x,a.x,0,e.y,t.y,a.y,0,e.z,t.z,a.z,0,0,0,0,1),this}makeRotationAxis(e,t){const a=Math.cos(t),r=Math.sin(t),i=1-a,n=e.x,o=e.y,l=e.z,c=i*n,f=i*o;return this.setElements(c*n+a,c*o-r*l,c*l+r*o,0,c*o+r*l,f*o+a,f*l-r*n,0,c*l-r*o,f*l+r*n,i*l*l+a,0,0,0,0,1),this}static transpose(e,t){t||=new E;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 E;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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a[12]*a[6]-a[2]*a[4]*a[13]+a[2]*a[12]*a[5],r[15]=a[0]*a[5]*a[10]-a[0]*a[9]*a[6]-a[1]*a[4]*a[10]+a[1]*a[8]*a[6]+a[2]*a[4]*a[9]-a[2]*a[8]*a[5];let i=a[0]*r[0]+a[1]*r[4]+a[2]*r[8]+a[3]*r[12];for(let n=0;n<16;n++)r[n]/=i;return t}makeEuler(e,t,a="XYZ"){const r=this.rawData,i=r[0],n=r[4],o=r[8],l=r[1],c=r[5],f=r[9],d=r[2],h=r[6],b=r[10];switch(a){case"XYZ":e.y=Math.asin(se(o,-1,1)),Math.abs(o)<.9999999?(e.x=Math.atan2(-f,b),e.z=Math.atan2(-n,i)):(e.x=Math.atan2(h,c),e.z=0);break;case"YXZ":e.x=Math.asin(-se(f,-1,1)),Math.abs(f)<.9999999?(e.y=Math.atan2(o,b),e.z=Math.atan2(l,c)):(e.y=Math.atan2(-d,i),e.z=0);break;case"ZXY":e.x=Math.asin(se(h,-1,1)),Math.abs(h)<.9999999?(e.y=Math.atan2(-d,b),e.z=Math.atan2(-n,c)):(e.y=0,e.z=Math.atan2(l,i));break;case"ZYX":e.y=Math.asin(-se(d,-1,1)),Math.abs(d)<.9999999?(e.x=Math.atan2(h,b),e.z=Math.atan2(l,i)):(e.x=0,e.z=Math.atan2(-n,c));break;case"YZX":e.z=Math.asin(se(l,-1,1)),Math.abs(l)<.9999999?(e.x=Math.atan2(-f,c),e.y=Math.atan2(-d,i)):(e.x=0,e.y=Math.atan2(o,b));break;case"XZY":e.z=Math.asin(-se(n,-1,1)),Math.abs(n)<.9999999?(e.x=Math.atan2(h,c),e.y=Math.atan2(o,i)):(e.x=Math.atan2(-f,b),e.y=0);break}return t&&e.multiplyScalar(Xr),e}setElements(e,t,a,r,i,n,o,l,c,f,d,h,b,p,g,A){const D=this.rawData;return D[0]=e,D[4]=t,D[8]=a,D[12]=r,D[1]=i,D[5]=n,D[9]=o,D[13]=l,D[2]=c,D[6]=f,D[10]=d,D[14]=h,D[3]=b,D[7]=p,D[11]=g,D[15]=A,this}makeMatrix44ByQuaternion(e,t,a){this.identity(),j.quaternionToMatrix(a,this),this.appendTranslation(e.x,e.y,e.z),this.appendScale(t.x,t.y,t.z)}}function yc(s,e,t){for(let a=0;a<4;a++)t.rawData[a]=s.rawData[a]*e.rawData[0]+s.rawData[a+4]*e.rawData[1]+s.rawData[a+8]*e.rawData[2]+s.rawData[a+12]*e.rawData[3],t.rawData[a+4]=s.rawData[a]*e.rawData[4]+s.rawData[a+4]*e.rawData[5]+s.rawData[a+8]*e.rawData[6]+s.rawData[a+12]*e.rawData[7],t.rawData[a+8]=s.rawData[a]*e.rawData[8]+s.rawData[a+4]*e.rawData[9]+s.rawData[a+8]*e.rawData[10]+s.rawData[a+12]*e.rawData[11],t.rawData[a+12]=s.rawData[a]*e.rawData[12]+s.rawData[a+4]*e.rawData[13]+s.rawData[a+8]*e.rawData[14]+s.rawData[a+12]*e.rawData[15]}function ps(s,e,t,a){let r=a.rawData,i=s.x*rt,n=s.y*rt,o=s.z*rt,l=0,c=i*.5,f=n*.5,d=o*.5,h=Math.cos(c),b=Math.sin(c),p=Math.cos(f),g=Math.sin(f),A=Math.cos(d),D=Math.sin(d);l=h*p*A+b*g*D,i=b*p*A-h*g*D,n=h*g*A+b*p*D,o=h*p*D-b*g*A;let _=i+i,U=n+n,v=o+o,x=i*_,C=i*U,F=i*v,w=n*U,S=n*v,M=o*v,T=l*_,Q=l*U,L=l*v,X=t.x,ie=t.y,q=t.z;r[0]=(1-(w+M))*X,r[1]=(C+L)*X,r[2]=(F-Q)*X,r[3]=0,r[4]=(C-L)*ie,r[5]=(1-(x+M))*ie,r[6]=(S+T)*ie,r[7]=0,r[8]=(F+Q)*q,r[9]=(S-T)*q,r[10]=(1-(x+w))*q,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1}function Cc(s,e,t){let a=s.rawData,r=t.rawData,i=a[0],n=a[4],o=a[8],l=a[12],c=a[1],f=a[5],d=a[9],h=a[13],b=a[2],p=a[6],g=a[10],A=a[14],D=a[3],_=a[7],U=a[11],v=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]=n*e.rawData[0]+f*e.rawData[4]+p*e.rawData[8]+_*e.rawData[12],r[5]=n*e.rawData[1]+f*e.rawData[5]+p*e.rawData[9]+_*e.rawData[13],r[6]=n*e.rawData[2]+f*e.rawData[6]+p*e.rawData[10]+_*e.rawData[14],r[7]=n*e.rawData[3]+f*e.rawData[7]+p*e.rawData[11]+_*e.rawData[15],r[8]=o*e.rawData[0]+d*e.rawData[4]+g*e.rawData[8]+U*e.rawData[12],r[9]=o*e.rawData[1]+d*e.rawData[5]+g*e.rawData[9]+U*e.rawData[13],r[10]=o*e.rawData[2]+d*e.rawData[6]+g*e.rawData[10]+U*e.rawData[14],r[11]=o*e.rawData[3]+d*e.rawData[7]+g*e.rawData[11]+U*e.rawData[15],r[12]=l*e.rawData[0]+h*e.rawData[4]+A*e.rawData[8]+v*e.rawData[12],r[13]=l*e.rawData[1]+h*e.rawData[5]+A*e.rawData[9]+v*e.rawData[13],r[14]=l*e.rawData[2]+h*e.rawData[6]+A*e.rawData[10]+v*e.rawData[14],r[15]=l*e.rawData[3]+h*e.rawData[7]+A*e.rawData[11]+v*e.rawData[15]}function s2(s,e){let t=e.x,a=e.y,r=e.z,i=e.w,n=s.rawData,o=2*t*a,l=2*t*r,c=2*t*i,f=2*a*r,d=2*a*i,h=2*r*i,b=t*t,p=a*a,g=r*r,A=i*i;return n[0]=b-p-g+A,n[4]=o-h,n[8]=l+d,n[12]=0,n[1]=o+h,n[5]=-b+p-g+A,n[9]=f-c,n[13]=0,n[2]=l-d,n[6]=f+c,n[10]=-b-p+g+A,n[14]=0,n[3]=0,n[7]=0,n[11]=0,n[15]=1,s}function n2(s,e){let t=e.rawData,a=Math.sin(s),r=Math.cos(s);return t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[8]=a,t[9]=0,t[10]=r,t[11]=0,t}function o2(s,e,t){let a=e.x,r=e.y,i=e.z,n=Math.hypot(a,r,i),o,l,c,f,d,h,b,p,g,A,D,_;if(n<i2)return null;n=1/n,a*=n,r*=n,i*=n,o=Math.sin(s),l=Math.cos(s),c=1-l,f=a*a*c+l,d=r*a*c+i*o,h=i*a*c-r*o,b=a*r*c-i*o,p=r*r*c+l,g=i*r*c+a*o,A=a*i*c+r*o,D=r*i*c-a*o,_=i*i*c+l;let U=t.rawData;return U[0]=f,U[1]=d,U[2]=h,U[3]=0,U[4]=b,U[5]=p,U[6]=g,U[7]=0,U[8]=A,U[9]=D,U[10]=_,U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U}function vn(s,e,t){let a=s.rawData,r=a[0],i=a[1],n=a[2],o=a[3],l=a[4],c=a[5],f=a[6],d=a[7],h=a[8],b=a[9],p=a[10],g=a[11],A=a[12],D=a[13],_=a[14],U=a[15],v=e.rawData,x=t.rawData,C=v[0],F=v[1],w=v[2],S=v[3];return x[0]=C*r+F*l+w*h+S*A,x[1]=C*i+F*c+w*b+S*D,x[2]=C*n+F*f+w*p+S*_,x[3]=C*o+F*d+w*g+S*U,C=v[4],F=v[5],w=v[6],S=v[7],x[4]=C*r+F*l+w*h+S*A,x[5]=C*i+F*c+w*b+S*D,x[6]=C*n+F*f+w*p+S*_,x[7]=C*o+F*d+w*g+S*U,C=v[8],F=v[9],w=v[10],S=v[11],x[8]=C*r+F*l+w*h+S*A,x[9]=C*i+F*c+w*b+S*D,x[10]=C*n+F*f+w*p+S*_,x[11]=C*o+F*d+w*g+S*U,C=v[12],F=v[13],w=v[14],S=v[15],x[12]=C*r+F*l+w*h+S*A,x[13]=C*i+F*c+w*b+S*D,x[14]=C*n+F*f+w*p+S*_,x[15]=C*o+F*d+w*g+S*U,x}var Xe=(s=>(s[s.None=0]="None",s[s.PointLight=1]="PointLight",s[s.DirectionLight=2]="DirectionLight",s[s.SpotLight=3]="SpotLight",s[s.SkyLight=4]="SkyLight",s))(Xe||{});class ms extends bi{static lightSize=24;index=-1;lightType=-1;radius=.001;linear=8;lightPosition=new u;lightMatrixIndex=-1;direction=new u;quadratic=.032;lightColor=new P(1,1,1,1);intensity=1;innerAngle=0;outerAngle=1;range=100;castShadowIndex=-1;lightTangent=u.FORWARD;iesIndex=-1}class xe{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=xe.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 Pe{object3D=null;_eventDispatcher;get eventDispatcher(){return this._eventDispatcher||=new Ra,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?xe.bindUpdate(this.transform.view3D,this,e):xe.unBindUpdate(this.transform.view3D,this)}_onLateUpdate(e){e!=null?xe.bindLateUpdate(this.transform.view3D,this,e):xe.unBindLateUpdate(this.transform.view3D,this)}_onBeforeUpdate(e){e!=null?xe.bindBeforeUpdate(this.transform.view3D,this,e):xe.unBindBeforeUpdate(this.transform.view3D,this)}_onCompute(e){e!=null?xe.bindCompute(this.transform.view3D,this,e):xe.unBindCompute(this.transform.view3D,this)}_onGraphic(e){e!=null?xe.bindGraphic(this.transform.view3D,this,e):xe.unBindGraphic(this.transform.view3D,this)}beforeDestroy(e){xe.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 As{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 ea{origin=new u;length=Number.MAX_VALUE;static _rayl=1e9;static _smallnum=1e-8;_vector=new u;_dir=new u;constructor(e,t){this.origin.copyFrom(e||new u),this._dir.copyFrom(t||new u),this._dir.normalize()}get direction(){return this._dir}set direction(e){this._dir.copyFrom(e),this._dir.normalize()}clone(){return new ea(this.origin,this.direction)}intersectBox(e,t){let a=this.direction,r=this.origin,i,n,o,l,c,f;const d=1/a.x,h=1/a.y,b=1/a.z,p=e.min,g=e.max;return i=((d>=0?p.x:g.x)-r.x)*d,n=((d>=0?g.x:p.x)-r.x)*d,o=((h>=0?p.y:g.y)-r.y)*h,l=((h>=0?g.y:p.y)-r.y)*h,i>l||o>n||(o>i&&(i=o),l<n&&(n=l),c=((b>=0?p.z:g.z)-r.z)*b,f=((b>=0?g.z:p.z)-r.z)*b,i>f||c>n)||(c>i&&(i=c),f<n&&(n=f),n<0)?null:(t||=new u,this.pointAt(i>=0?i:n,t))}pointAt(e,t){return t||=new u,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=ut(a,t),i=ut(t,t),n=r/i,o=this.getPoint(n);return _n(e.subtract(o))}applyMatrix(e){this.origin=e.transformPoint(this.origin),this._dir=e.transformVector(this._dir)}_v0=new u;_v1=new u;_v2=new u;pointInTriangle(e,t,a,r){let i=this._v0,n=this._v1,o=this._v2;r.subtract(t,i),a.subtract(t,n),e.subtract(t,o);let l=u.dot(i,i),c=u.dot(i,n),f=u.dot(i,o),d=u.dot(n,n),h=u.dot(n,o),b=1/(l*d-c*c),p=(d*f-c*h)*b,g=(l*h-c*f)*b;return p>=0&&g>=0&&p+g<1}_E1=new u;_E2=new u;_P=new u;_T=new u;_Q=new u;intersectTriangle(e,t,a){let r=a.v1,i=a.v2,n=a.v3;i.subtract(r,this._E1),n.subtract(r,this._E2),t.crossProduct(this._E2,this._P);let o=this._E1.dotProduct(this._P);if(o>0?e.subtract(r,this._T):(r.subtract(e,this._T),o=-o),o<1e-4||(a.u=this._T.dotProduct(this._P),a.u<0||a.u>o)||(this._T.crossProduct(this._E1,this._Q),a.v=t.dotProduct(this._Q),a.v<0||a.u+a.v>o))return null;let l=new u;a.t0=a.t=this._E2.dotProduct(this._Q);let c=1/o;return a.t*=c,a.u*=c,a.v*=c,l.x=e.x+a.t*t.x,l.y=e.y+a.t*t.y,l.z=e.z+a.t*t.z,l}intersectSphere(e,t,a,r){let i=e.subtract(a),n=u.dot(t,t),o=2*u.dot(i,t),l=u.dot(i,i)-r*r,c=o*o-4*n*l,f=u.HELP_3;if(c<0)return null;{let d=(-o-Math.sqrt(c))/(n*2);return d<0?null:(f.x=e.x+d*t.x,f.y=e.y+d*t.y,f.z=e.z+d*t.z,f)}}intersectionSegment(e,t,a){const r=this.origin,i=u.HELP_0,n=u.HELP_1,o=u.HELP_2,l=u.HELP_3;t.subtract(e,i),this._dir.scaleToRef(ea._rayl,o),r.add(o,n),e.subtract(r,l);var c=u.dot(i,i),f=u.dot(i,o),d=u.dot(o,o),h=u.dot(i,l),b=u.dot(o,l),p=c*d-f*f,g,A,D=p,_,U,v=p;p<ea._smallnum?(A=0,D=1,U=b,v=d):(A=f*b-d*h,U=c*b-f*h,A<0?(A=0,U=b,v=d):A>D&&(A=D,U=b+f,v=d)),U<0?(U=0,-h<0?A=0:-h>c?A=D:(A=-h,D=c)):U>v&&(U=v,-h+f<0?A=0:-h+f>c?A=D:(A=-h+f,D=c)),g=Math.abs(A)<ea._smallnum?0:A/D,_=Math.abs(U)<ea._smallnum?0:U/v;const x=u.HELP_4;o.scaleToRef(_,x);const C=u.HELP_5;i.scaleToRef(g,C),C.add(l,C);const F=u.HELP_6;C.subtract(x,F);var w=_>0&&_<=this._dir.length&&F.lengthSquared<a*a;if(w){let S=new u;return S.copyFrom(t.subtract(e)),S.scaleBy(g),S.add(e,S),{out:S,length:C.length}}return{out:null,length:-1}}get_vec(e,t){let a=u.HELP_1;return a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}}class is{x;y;w;h;constructor(e=0,t=0,a=0,r=0){this.x=e,this.y=t,this.w=a,this.h=r}get width(){return this.w}set width(e){this.w=e}get height(){return this.h}set height(e){this.h=e}static pointInRect(e,t,a,r,i,n){return!(e<a||e>i||t<r||t>n)}clone(){return new is(this.x,this.y,this.w,this.h)}copyFrom(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}copyTo(e){e.copyFrom(this)}inner(e,t){return!(e<this.x||e>this.x+this.width||t<this.y||t>this.y+this.height)}equal(e){return!(this.x!=e.x||this.y!=e.y||this.width!=e.width||this.height!=e.height)}equalArea(e,t,a,r){return!(this.x!=e||this.y!=t||this.width!=a||this.height!=r)}equalInnerArea(e){var t=this.x,a=this.y,r=this.x+this.width,i=this.y+this.height,n=e.x,o=e.y,l=e.x+e.width,c=e.y+e.height;return Math.max(t,n)<=Math.min(r,l)&&Math.max(a,o)<=Math.min(i,c)}innerArea(e,t){t=t||new is;var a=this.x,r=this.y,i=this.x+this.width,n=this.y+this.height,o=e.x,l=e.y,c=e.x+e.width,f=e.y+e.height,d=Math.max(r,l),h=Math.min(n,f),b=Math.max(a,o),p=Math.min(c,i);return d>=0&&h>=0&&h-d>=0&&p-b>0?(t.x=b,t.y=d,t.width=p-b,t.height=h-d):(t.x=0,t.y=0,t.width=0,t.height=0),t}setTo(e,t,a,r){this.x=e,this.y=t,this.width=a,this.height=r}}class ge{center;extents;max;min;size;static maxVector3=new u(1,1,1).multiplyScalar(Number.MAX_VALUE*.1);static minVector3=new u(1,1,1).multiplyScalar(-Number.MAX_VALUE*.1);constructor(e,t){e||=u.ZERO.clone(),t||=u.ZERO.clone(),this.setFromCenterAndSize(e,t)}makeEmpty(){return this.setFromMinMax(ge.maxVector3,ge.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 u,this.max||=new u,this.size||=new u,this.center||=new u,this.extents||=new u,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 ge(new u,new u),a=0;a<e.length;a++)t.expandByPoint(e[a]);return t}calculateTransform(e){}clone(){var e=new ge(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 Un{planes;corners;boundingBox=new ge;constructor(){this.planes=[],this.corners=[];for(var e=0;e<6;e++)this.planes[e]=new u;for(var e=0;e<8;e++)this.corners[e]=new u}updateBoundBox(e){this.boundingBox.makeEmpty();let t=this.boundingBox.min,a=this.boundingBox.max,r=0;for(let i=0;i<2;++i)for(let n=0;n<2;++n)for(let o=0;o<2;++o){let l=this.corners[r];r++,l.set(2*i-1,2*n-1,o,1),e.transformVector4(l,l),l.div(l.w,l),t.x=Math.min(l.x,t.x),t.y=Math.min(l.y,t.y),t.z=Math.min(l.z,t.z),a.x=Math.max(l.x,a.x),a.y=Math.max(l.y,a.y),a.z=Math.max(l.z,a.z)}return this.boundingBox.setFromMinMax(t,a),this}setFrustumCorners(e){let t=0;for(let a=0;a<2;++a)for(let r=0;r<2;++r)for(let i=0;i<2;++i){let n=this.corners[t];n.set(2*a-1,2*r-1,i,1),e.transformVector4(n,n),n.div(n.w,n),t++}}update(e){var t=e.rawData;this.planes[0].x=t[3]-t[0],this.planes[0].y=t[7]-t[4],this.planes[0].z=t[11]-t[8],this.planes[0].w=t[15]-t[12];var a=Math.sqrt(this.planes[0].x*this.planes[0].x+this.planes[0].y*this.planes[0].y+this.planes[0].z*this.planes[0].z);this.planes[0].x/=a,this.planes[0].y/=a,this.planes[0].z/=a,this.planes[0].w/=a,this.planes[1].x=t[3]+t[0],this.planes[1].y=t[7]+t[4],this.planes[1].z=t[11]+t[8],this.planes[1].w=t[15]+t[12],a=Math.sqrt(this.planes[1].x*this.planes[1].x+this.planes[1].y*this.planes[1].y+this.planes[1].z*this.planes[1].z),this.planes[1].x/=a,this.planes[1].y/=a,this.planes[1].z/=a,this.planes[1].w/=a,this.planes[2].x=t[3]+t[1],this.planes[2].y=t[7]+t[5],this.planes[2].z=t[11]+t[9],this.planes[2].w=t[15]+t[13],a=Math.sqrt(this.planes[2].x*this.planes[2].x+this.planes[2].y*this.planes[2].y+this.planes[2].z*this.planes[2].z),this.planes[2].x/=a,this.planes[2].y/=a,this.planes[2].z/=a,this.planes[2].w/=a,this.planes[3].x=t[3]-t[1],this.planes[3].y=t[7]-t[5],this.planes[3].z=t[11]-t[9],this.planes[3].w=t[15]-t[13],a=Math.sqrt(this.planes[3].x*this.planes[3].x+this.planes[3].y*this.planes[3].y+this.planes[3].z*this.planes[3].z),this.planes[3].x/=a,this.planes[3].y/=a,this.planes[3].z/=a,this.planes[3].w/=a,this.planes[4].x=t[3]-t[2],this.planes[4].y=t[7]-t[6],this.planes[4].z=t[11]-t[10],this.planes[4].w=t[15]-t[14],a=Math.sqrt(this.planes[4].x*this.planes[4].x+this.planes[4].y*this.planes[4].y+this.planes[4].z*this.planes[4].z),this.planes[4].x/=a,this.planes[4].y/=a,this.planes[4].z/=a,this.planes[4].w/=a,this.planes[5].x=t[3]+t[2],this.planes[5].y=t[7]+t[6],this.planes[5].z=t[11]+t[10],this.planes[5].w=t[15]+t[14],a=Math.sqrt(this.planes[5].x*this.planes[5].x+this.planes[5].y*this.planes[5].y+this.planes[5].z*this.planes[5].z),this.planes[5].x/=a,this.planes[5].y/=a,this.planes[5].z/=a,this.planes[5].w/=a}containsPoint(e){for(var t=0;t<6;t++)if(this.planes[t].x*e.x+this.planes[t].y*e.y+this.planes[t].z*e.z+this.planes[t].w<=0)return!1;return!0}containsSphere(e){let t=e.bound,a=0,r,i=e.transform.worldPosition,n=t.radius,o=t.center.x+i.x,l=t.center.y+i.y,c=t.center.z+i.z;for(let f of this.planes){if(r=f.x*o+f.y*l+f.z*c+f.w,r<=-n)return 0;r>n&&a++}return a===6?2:1}containsBox(e){let t=0,a,i=Math.max(e.size.x,e.size.y,e.size.z)*2,n=e.center.x,o=e.center.y,l=e.center.z;for(let c of this.planes){if(a=c.x*n+c.y*o+c.z*l+c.w,a<=-i)return 0;a>i&&t++}return t===6?2:1}containsBox2(e){let t=0,a,r=1.74*Math.max(e.extents.x,e.extents.y,e.extents.z);for(let i of this.planes){if(a=i.x*e.center.x+i.y*e.center.y+i.z*e.center.z+i.w,a<=-r)return 0;a>r&&t++}return t===6?2:1}containsBoxPrecise(e){const t=[new u(e.min.x,e.min.y,e.min.z),new u(e.max.x,e.min.y,e.min.z),new u(e.min.x,e.max.y,e.min.z),new u(e.max.x,e.max.y,e.min.z),new u(e.min.x,e.min.y,e.max.z),new u(e.max.x,e.min.y,e.max.z),new u(e.min.x,e.max.y,e.max.z),new u(e.max.x,e.max.y,e.max.z)];let a=0;for(let r=0;r<6;r++){const i=this.planes[r];let n=-1/0,o=1/0;for(let l=0;l<8;l++){const c=t[l],f=i.x*c.x+i.y*c.y+i.z*c.z+i.w;n=Math.max(n,f),o=Math.min(o,f)}if(n<0)return 0;o>0&&a++}return a===6?2:1}}var We=(s=>(s[s.ortho=0]="ortho",s[s.perspective=1]="perspective",s[s.shadow=2]="shadow",s))(We||{});class l2{corners;index;constructor(e){this.index=e,this.corners=[];for(let t=0;t<4;t++)this.corners.push(new u)}}class c2{bound;twoSections;name;color;shadowCamera;index;constructor(e,t,a){this.bound=new ge,this.shadowCamera=Ke.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 P(1,0,0,1):a==1?this.color=new P(0,1,0,1):a==2?this.color=new P(0,0,1,1):a==3&&(this.color=new P(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 Sc{sections;children;name;constructor(e){this.sections=[];let t=e+1;for(let a=0;a<t;a++)this.sections.push(new l2(a));this.children=[];for(let a=0;a<e;a++)this.children.push(new c2(this.sections[a],this.sections[a+1],a))}update(e,t,a,r,i){let n=this.sections.length-1;for(let o=0;o<=n;++o){let l=this.sections[o],c=0,f=this.logSplit(a,r,o,this.sections.length);{let h=(f-a)/r;h=h**i.csmScatteringExp,f=(r-a)*h+a}f*=i.csmAreaScale;let d=(e.rawData[10]*f+e.rawData[14])/f;for(let h=0;h<2;++h)for(let b=0;b<2;++b){let p=l.corners[c];c++,p.set(2*h-1,2*b-1,d,1),t.transformVector4(p,p),p.div(p.w,p)}}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 Kr extends Pe{fov=60;name;aspect=1;near=1;far=5e3;left=-100;right=100;top=100;bottom=-100;frustumSize=100;viewPort=new is;frustum;sh=new Float32Array(36);isShadowCamera=!1;_projectionMatrixInv=new E;_projectionMatrix=new E;_viewMatrix=new E;_viewMatrixInv=new E;_unprojection=new E;_pvMatrixInv=new E;_pvMatrix=new E;_halfw;_halfh;_ray;_enableCSM=!1;mainCamera;get projectionMatrix(){return this._projectionMatrix}lookTarget;type=We.perspective;csm;cubeShadowCameras=[];get enableCSM(){return this._enableCSM}set enableCSM(e){e&&!this.csm&&(this.csm=new Sc(Zt.Cascades)),this._enableCSM=e}constructor(){super()}init(){super.init(),this._ray=new ea,this.frustum=new Un,this.lookTarget=new u(0,0,0),this.viewPort.x=0,this.viewPort.y=0,this.viewPort.w=k.presentationSize[0],this.viewPort.h=k.presentationSize[1],this.updateProjection(),k.addEventListener(Ha.RESIZE,this.updateProjection,this)}updateProjection(){this.aspect=k.aspect,this.type==We.perspective?this.perspective(this.fov,this.aspect,this.near,this.far):this.type==We.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-m.setting.shadow.shadowBias*.01}getShadowWorldExtents(){let e=m.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=We.perspective}ortho(e,t,a){this.frustumSize=e;let r=e*.5*this.aspect,i=e*.5,n=-r/2,o=r/2,l=i/2,c=-i/2;this.orthoOffCenter(n,o,c,l,t,a)}orthoOffCenter(e,t,a,r,i,n){this.near=i,this.far=n,this.left=e,this.right=t,this.top=r,this.bottom=a,this.type=We.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 u(0,0,0,1)),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5,St.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 u),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5;let a=e.x,r=e.y;return t.x=a/this.viewPort.width-.25,t.y=r/this.viewPort.height-.25,this.unProject(t.x,t.y,e.z,t),t}get pvMatrix(){return vn(this._projectionMatrix,this.viewMatrix,this._pvMatrix),this._pvMatrix}get pvMatrix2(){vn(this._projectionMatrix,this.transform.worldMatrix,this._pvMatrix);let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get pvMatrixInv(){let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get vMatrixInv(){let e=this._viewMatrixInv.copyFrom(this.viewMatrix);return e.invert(),e}get cameraToWorld(){let e=E.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e.multiply(this.vMatrixInv),e}get ndcToView(){let e=E.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 u),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(),St.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=Ke.UnProjection(e,t,.01,this),i=Ke.UnProjection(e,t,1,this);return i=i.subtract(r).normalize(),a.origin.copyFrom(r),a.direction=i,a}screenPointToWorld(e,t,a){return Ke.UnProjection(e,t,a,this)}worldToScreenPoint(e,t){return Ke.Projection(e,this,t)}lookAt(e,t,a=u.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=m.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 As,this._jitterOffsetList=[];for(let t=0;t<32;t++){let a=this.generateRandomOffset();this._jitterOffsetList.push(a)}this._jitterOffsetList.reverse()}generateRandomOffset(){let e=new K(As.get((this._sampleIndex&1023)+1,2)-.5,As.get((this._sampleIndex&1023)+1,3)-.5);return++this._sampleIndex>=32&&(this._sampleIndex=0),e}getJitteredProjectionMatrix(){let e=m.setting.render.postProcessing.taa,t=this._projectionMatrix,a=e.temporalJitterScale,r=this._jitterFrameIndex%e.jitterSeedCount,i=this._jitterOffsetList[r].x*a,n=this._jitterOffsetList[r].y*a,o=t.get(0,2),l=t.get(1,2);this._jitterX=i/this.viewPort.width,this._jitterY=n/this.viewPort.height,o+=this._jitterX,l+=this._jitterY,t.set(0,2,o),t.set(1,2,l),this._jitterFrameIndex++}getWorldDirection(e){e||=new u;const t=this.transform._worldMatrix.rawData;return e.set(-t[8],-t[9],-t[10]).normalize()}}class Qt extends Pe{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 $e(Qt.POSITION_ONCHANGE);eventRotationChange=new $e(Qt.ROTATION_ONCHANGE);eventScaleChange=new $e(Qt.SCALE_ONCHANGE);eventLocalChange=new $e(Qt.LOCAL_ONCHANGE);onPositionChange;onRotationChange;onScaleChange;_scene3d;_parent;_localPos;_localRot;_localRotQuat;_localScale;_localDetailPos;_localDetailRot;_localDetailScale;index;index2;_forward=new u;_back=new u;_right=new u;_left=new u;_up=new u;_down=new u;_worldMatrix;_targetPos;static=!1;depthOrder=0;get localChange(){return pe.matrixStateBuffer[this.index2]!=0}set localChange(e){pe.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,pe.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=>{xe.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 E(!0),this.index=this._worldMatrix.index,this.index2=this._worldMatrix.index*pe.stateStruct,this._localPos=new u,this._localRot=new u,this._localRotQuat=new j,this._localScale=new u(1,1,1),pe.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),pe.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),pe.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(u.UP,this._up),this._up}set up(e){this._up.copyFrom(e),St.fromToRotation(u.UP,this._up,j.HELP_0),this.transform.localRotQuat=j.HELP_0}get down(){return this.worldMatrix.transformVector(u.DOWN,this._down),this._down}set down(e){this._down.copyFrom(e),St.fromToRotation(u.DOWN,this._down,j.HELP_0),this.transform.localRotQuat=j.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get forward(){return this.worldMatrix.transformVector(u.FORWARD,this._forward),this._forward}set forward(e){this._forward.copyFrom(e),St.fromToRotation(u.FORWARD,this._forward,j.HELP_0),this.transform.localRotQuat=j.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get back(){return this.worldMatrix.transformVector(u.BACK,this._back),this._back}set back(e){this._back.copyFrom(e),St.fromToRotation(u.BACK,this._back,j.HELP_0),this.transform.localRotQuat=j.HELP_0}get left(){return this.worldMatrix.transformVector(u.neg_X_AXIS,this._left),this._left}set left(e){this._left.copyFrom(e),St.fromToRotation(u.LEFT,this._left,j.HELP_0),this.transform.localRotQuat=j.HELP_0}get right(){return this.worldMatrix.transformVector(u.X_AXIS,this._right),this._right}set right(e){this._right.copyFrom(e),St.fromToRotation(u.RIGHT,this._right,j.HELP_0),this.transform.localRotQuat=j.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),pe.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?(ps(this._localRot,this._localPos,this._localScale,this._worldMatrix),Cc(this._worldMatrix,this.parent.worldMatrix,this._worldMatrix)):ps(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=u.UP){this.lookAt(this.transform.worldPosition,e,t)}lookAt(e,t,a=u.UP){this._targetPos||=new u,this._targetPos.copyFrom(t),this.localPosition=e,E.helpMatrix.lookAt(e,t,a),E.helpMatrix.invert();var r=E.helpMatrix.decompose(jt.QUATERNION);this.localRotQuat=j.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,pe.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,pe.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,pe.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,pe.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,pe.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,pe.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,pe.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,pe.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,pe.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),pe.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),pe.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){pe.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,pe.setContinueScale(this.index,e.x,e.y,e.z)}get localDetailRot(){return this._localDetailRot}set localDetailRot(e){this._localDetailRot=e,pe.setContinueRotation(this.index,e.x,e.y,e.z)}get localDetailPos(){return this._localDetailPos}set localDetailPos(e){this._localDetailPos=e,pe.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 Yt{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 V=(s=>(s.position="position",s.normal="normal",s.uv="uv",s.TANGENT="TANGENT",s.TEXCOORD_1="TEXCOORD_1",s.TEXCOORD_2="TEXCOORD_2",s.TEXCOORD_3="TEXCOORD_3",s.TEXCOORD_4="TEXCOORD_4",s.TEXCOORD_5="TEXCOORD_5",s.TEXCOORD_6="TEXCOORD_6",s.TEXCOORD_7="TEXCOORD_7",s.color="color",s.joints0="joints0",s.joints1="joints1",s.weights0="weights0",s.weights1="weights1",s.weight="weight",s.indices="indices",s.vIndex="vIndex",s.a_morphPositions_0="a_morphPositions_0",s.all="all",s))(V||{}),ae=(s=>(s[s.NONE=0]="NONE",s[s.ABOVE=1]="ABOVE",s[s.ALPHA=2]="ALPHA",s[s.NORMAL=3]="NORMAL",s[s.ADD=4]="ADD",s[s.BELOW=5]="BELOW",s[s.ERASE=6]="ERASE",s[s.MUL=7]="MUL",s[s.SCREEN=8]="SCREEN",s[s.DIVD=9]="DIVD",s[s.SOFT_ADD=10]="SOFT_ADD",s))(ae||{}),Fc=(s=>(s[s.src_a=0]="src_a",s[s.dest_a=1]="dest_a",s))(Fc||{});class kc{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 ua{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=$a[a.valueType],t.push(a)}else if(e.indexOf("location")!=-1){a.type="location";var r=e.match(/\((.+?)\)/g)[0];r=e.match(/\((.+?)\)/g)[0],r=r.replace("(",""),r=r.replaceAll(")",""),a.location=parseInt(r);let n=e.split(":");a.name=n[0].split(" ")[1],a.name=a.name.replaceAll(" "," "),a.name=a.name.replaceAll(" ",""),a.valueType=n[1],a.valueType=a.valueType.replaceAll(" "," "),a.valueType=a.valueType.replaceAll(" ",""),a.valueType=a.valueType.replaceAll("\r",""),a.valueType=a.valueType.replaceAll(")",""),a.valueType=a.valueType.replaceAll(")",""),a.size=$a[a.valueType],t.push(a)}a.format=ul[$a[a.valueType]]}}class fe extends ln{entryPoint="CsMain";workerSizeX=1;workerSizeY=0;workerSizeZ=0;_computePipeline;_csShaderModule;_destCS;_sourceCS;_storageTextureDic;_sampleTextureDic;_groupsShaderReflectionVarInfos;_groupCache={};constructor(e){super(),this._sourceCS=e,Bt.getShaderReflection2(e,this),this._storageTextureDic=new Map,this._sampleTextureDic=new Map}setStorageTexture(e,t){this._storageTextureDic.has(e)||this._storageTextureDic.set(e,t)}setSamplerTexture(e,t){this._sampleTextureDic.set(e,t)}compute(e){this._computePipeline||this.genComputePipeline(),e.setPipeline(this._computePipeline);for(let t=0;t<this.bindGroups.length;++t)e.setBindGroup(t,this.bindGroups[t]);this.workerSizeX&&this.workerSizeY&&this.workerSizeZ?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY,this.workerSizeZ):this.workerSizeX&&this.workerSizeY?e.dispatchWorkgroups(this.workerSizeX,this.workerSizeY):e.dispatchWorkgroups(this.workerSizeX)}createBufferBindGroup(e,t,a,r){let i=this._bufferDic.get(t);if(i){let n={binding:a,resource:{buffer:i.buffer,offset:0,size:i.memory.shareDataBuffer.byteLength}};r.push(n)}else console.error(`ComputeShader(${this.instanceID})`,`buffer ${t} is missing!`)}noticeBufferChange(e){let t=this._groupCache[e];t&&this.genGroups(t.groupIndex,t.infos,!0)}genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;++o){const l=r[o];if(l)switch(l.varType){case"uniform":case"storage-read":case"storage-read_write":this.createBufferBindGroup(e,l.varName,l.binding,i),this._groupCache[l.varName]={groupIndex:e,infos:t};break;case"var":if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this._sampleTextureDic.get(c);if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}else if(l.dataType.indexOf("texture_storage")!=-1){let c=this._storageTextureDic.get(l.varName);if(c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f),ge.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),ge.getInstance().attached(c,this)}else console.error(`ComputeShader(${this.instanceID})`,`texture ${l.varName} is missing! `)}break;default:console.error("unprocessed type:",l.varType);break}}let n=k.device.createBindGroup({layout:this._computePipeline.getBindGroupLayout(e),entries:i});this.bindGroups[e]=n}}genComputePipeline(){this.preCompileShader(this._sourceCS),this.genReflection(),this._computePipeline=k.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)}k.addEventListener(Ha.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=ra.parseComputeShader(e,this.defineValue)}compileShader(){let e=k.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+=Bt.genComputeShaderVariant(this);let e=Bt.poolGetReflection(this.shaderVariant);e?this.shaderReflection=e:(Bt.getShaderReflection2(this._destCS,this),Bt.combineShaderReflectionVarInfo(this.shaderReflection,this.shaderReflection.cs_variables))}}var H=(s=>(s[s.COLOR=1]="COLOR",s[s.REFLECTION=2]="REFLECTION",s[s.POSITION=4]="POSITION",s[s.GRAPHIC=8]="GRAPHIC",s[s.GI=16]="GI",s[s.Cluster=32]="Cluster",s[s.SHADOW=64]="SHADOW",s[s.POINT_SHADOW=128]="POINT_SHADOW",s[s.POST=256]="POST",s[s.DEPTH=512]="DEPTH",s[s.UI=1024]="UI",s))(H||{});class Ye{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 H)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 H)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 Su=(()=>{var s=import.meta.url;return(async function(e={}){var t=e,a,r;t.ready=new Promise((I,N)=>{a=I,r=N});var i=Object.assign({},t),n=[],o="./this.program",l=(I,N)=>{throw N},c=typeof window=="object",f=typeof importScripts=="function",d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function b(I){return t.locateFile?t.locateFile(I,h):h+I}var p,g;if(d){const{createRequire:I}=await Promise.resolve().then(()=>hm);var A=I(import.meta.url),D=A("fs"),_=A("path");f?h=_.dirname(h)+"/":h=A("url").fileURLToPath(new URL("data:text/javascript;base64,DQp2YXIgTW9k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t.thisProgram&&process.argv.length>1&&(o=process.argv[1].replace(/\\/g,"/")),n=process.argv.slice(2),l=(N,W)=>{throw process.exitCode=N,W}}else(c||f)&&(f?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),s&&(h=s),h.startsWith("blob:")?h="":h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1),p=I=>{var N=new XMLHttpRequest;return N.open("GET",I,!1),N.send(null),N.responseText},f&&(g=I=>{var N=new XMLHttpRequest;return N.open("GET",I,!1),N.responseType="arraybuffer",N.send(null),new Uint8Array(N.response)}));var U=t.print||console.log.bind(console),v=t.printErr||console.error.bind(console);Object.assign(t,i),i=null,t.arguments&&(n=t.arguments),t.thisProgram&&(o=t.thisProgram),t.quit&&(l=t.quit);var x;t.wasmBinary&&(x=t.wasmBinary);function C(I){if(typeof d<"u"&&d){var N=Buffer.from(I,"base64");return new Uint8Array(N.buffer,N.byteOffset,N.length)}for(var W=atob(I),he=new Uint8Array(W.length),Re=0;Re<W.length;++Re)he[Re]=W.charCodeAt(Re);return he}function F(I){if(kt(I))return C(I.slice(Ft.length))}var w,S=!1,M,T,Q,L;function X(){var I=w.buffer;t.HEAP8=T=new Int8Array(I),t.HEAP16=new Int16Array(I),t.HEAPU8=Q=new Uint8Array(I),t.HEAPU16=new Uint16Array(I),t.HEAP32=new Int32Array(I),t.HEAPU32=L=new Uint32Array(I),t.HEAPF32=new Float32Array(I),t.HEAPF64=new Float64Array(I)}var ie=[],q=[],be=[],Ue=[];function Z(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)_e(t.preRun.shift());_a(ie)}function de(){_a(q)}function ce(){_a(be)}function De(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)we(t.postRun.shift());_a(Ue)}function _e(I){ie.unshift(I)}function Ne(I){q.unshift(I)}function we(I){Ue.unshift(I)}var Ce=0,Me=null;function ct(I){Ce++,t.monitorRunDependencies?.(Ce)}function ga(I){if(Ce--,t.monitorRunDependencies?.(Ce),Ce==0&&Me){var N=Me;Me=null,N()}}function Mt(I){t.onAbort?.(I),I="Aborted("+I+")",v(I),S=!0,M=1,I+=". Build with -sASSERTIONS for more info.";var N=new WebAssembly.RuntimeError(I);throw r(N),N}var Ft="data:application/octet-stream;base64,",kt=I=>I.startsWith(Ft),Nt=I=>I.startsWith("file://"),xt;xt="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/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQ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EAcaIAJCgICAgICAgPg/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/QsDACACQQhrIANBCGsrAwA5AwAgBSECIAEiAyAGRw0ACwsgACAHNgIIIAAgCDYCBCAAIAU2AgAgBgRAIAYQDAsPCxATAAsQEgALGQEBf0GgKygCACIBIAAgASgCACgCGBEBAAsQACMAIABrQXBxIgAkACAACwcAIAAoAgQLBQBBowkLBQBBzQkLBQBBkAkLFwEBf0GgKygCACIAIAAoAgAoAhQRAAALFQAgAEUEQEEADwsgAEHkJhAiQQBHCxoAIAAgASgCCCAFEAoEQCABIAIgAyAEECALCzcAIAAgASgCCCAFEAoEQCABIAIgAyAEECAPCyAAKAIIIgAgASACIAMgBCAFIAAoAgAoAhQRCQALpwEAIAAgASgCCCAEEAoEQAJAIAEoAgQgAkcNACABKAIcQQFGDQAgASADNgIcCw8LAkAgACABKAIAIAQQCkUNAAJAIAIgASgCEEcEQCABKAIUIAJHDQELIANBAUcNASABQQE2AiAPCyABIAI2AhQgASADNgIgIAEgASgCKEEBajYCKAJAIAEoAiRBAUcNACABKAIYQQJHDQAgAUEBOgA2CyABQQQ2AiwLC4gCACAAIAEoAgggBBAKBEACQCABKAIEIAJHDQAgASgCHEEBRg0AIAEgAzYCHAsP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5mb0UAAACgEwAA4BIAANQSAABOMTBfX2N4eGFiaXYxMTdfX3BiYXNlX3R5cGVfaW5mb0UAAACgEwAAEBMAANQSAABOMTBfX2N4eGFiaXYxMTlfX3BvaW50ZXJfdHlwZV9pbmZvRQCgEwAAQBMAADQTAAAAAAAABBMAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAAAAAAOgTAAAXAAAAHwAAABkAAAAaAAAAGwAAACAAAAAhAAAAIgAAAE4xMF9fY3h4YWJpdjEyMF9fc2lfY2xhc3NfdHlwZV9pbmZvRQAAAACgEwAAwBMAAAQTAAAAAAAAWBQAAAEAAAAjAAAAJAAAAAAAAACAFAAAAQAAACUAAAAmAAAAAAAAAEAUAAABAAAAJwAAACgAAABTdDlleGNlcHRpb24AAAAAeBMAADAUAABTdDliYWRfYWxsb2MAAAAAoBMAAEgUAABAFAAAU3QyMGJhZF9hcnJheV9uZXdfbGVuZ3RoAAAAAKATAABkFAAAWBQAAAAAAACwFAAAAgAAACkAAAAqAAAAU3QxMWxvZ2ljX2Vycm9yAKATAACgFAAAQBQAAAAAAADkFAAAAgAAACsAAAAqAAAAU3QxMmxlbmd0aF9lcnJvcgAAAACgEwAA0BQAALAUAABTdDl0eXBlX2luZm8AAAAAeBMAAPAUAEGIKgsBBQBBlCoLARMAQawqCw4UAAAAFQAAALgVAAAABABBxCoLAQEAQdQqCwX/////CgBBmCsLA3AcAQ==",kt(xt)||(xt=b(xt));function pa(I){if(I==xt&&x)return new Uint8Array(x);var N=F(I);if(N)return N;if(g)return g(I);throw"both async and sync fetching of the wasm failed"}function ma(I){return Promise.resolve().then(()=>pa(I))}function Aa(I,N,W){return ma(I).then(he=>WebAssembly.instantiate(he,N)).then(W,he=>{v(`failed to asynchronously prepare wasm: ${he}`),Mt(he)})}function Da(I,N,W,he){return Aa(N,W,he)}function Dr(){var I={a:pu};function N(he,Re){return yt=he.exports,w=yt.f,X(),Ne(yt.g),ga(),yt}ct();function W(he){N(he.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(I,N)}catch(he){v(`Module.instantiateWasm callback failed with error: ${he}`),r(he)}return Da(x,xt,I,W).catch(r),{}}function ja(I){this.name="ExitStatus",this.message=`Program terminated with exit(${I})`,this.status=I}var _a=I=>{for(;I.length>0;)I.shift()(t)};t.noExitRuntime;class _r{constructor(N){this.excPtr=N,this.ptr=N-24}set_type(N){L[this.ptr+4>>2]=N}get_type(){return L[this.ptr+4>>2]}set_destructor(N){L[this.ptr+8>>2]=N}get_destructor(){return L[this.ptr+8>>2]}set_caught(N){N=N?1:0,T[this.ptr+12]=N}get_caught(){return T[this.ptr+12]!=0}set_rethrown(N){N=N?1:0,T[this.ptr+13]=N}get_rethrown(){return T[this.ptr+13]!=0}init(N,W){this.set_adjusted_ptr(0),this.set_type(N),this.set_destructor(W)}set_adjusted_ptr(N){L[this.ptr+16>>2]=N}get_adjusted_ptr(){return L[this.ptr+16>>2]}get_exception_ptr(){var N=al(this.get_type());if(N)return L[this.excPtr>>2];var W=this.get_adjusted_ptr();return W!==0?W:this.excPtr}}var Ya=0,Br=(I,N,W)=>{var he=new _r(I);throw he.init(N,W),Ya=I,Ya},Ba=()=>{Mt("")},vr=(I,N,W)=>Q.copyWithin(I,N,N+W),Ur=()=>2147483648,Jt=I=>{var N=w.buffer,W=(I-N.byteLength+65535)/65536;try{return w.grow(W),X(),1}catch{}},xr=I=>{var N=Q.length;I>>>=0;var W=Ur();if(I>W)return!1;for(var he=(ta,Zr)=>ta+(Zr-ta%Zr)%Zr,Re=1;Re<=4;Re*=2){var Je=N*(1+.2/Re);Je=Math.min(Je,I+100663296);var Ie=Math.min(W,he(Math.max(I,Je),65536)),Se=Jt(Ie);if(Se)return!0}return!1},yr=[null,[],[]],Xa=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Cr=(I,N,W)=>{for(var he=N+W,Re=N;I[Re]&&!(Re>=he);)++Re;if(Re-N>16&&I.buffer&&Xa)return Xa.decode(I.subarray(N,Re));for(var Je="";N<Re;){var Ie=I[N++];if(!(Ie&128)){Je+=String.fromCharCode(Ie);continue}var Se=I[N++]&63;if((Ie&224)==192){Je+=String.fromCharCode((Ie&31)<<6|Se);continue}var ta=I[N++]&63;if((Ie&240)==224?Ie=(Ie&15)<<12|Se<<6|ta:Ie=(Ie&7)<<18|Se<<12|ta<<6|I[N++]&63,Ie<65536)Je+=String.fromCharCode(Ie);else{var Zr=Ie-65536;Je+=String.fromCharCode(55296|Zr>>10,56320|Zr&1023)}}return Je},Sr=(I,N)=>{var W=yr[I];N===0||N===10?((I===1?U:v)(Cr(W,0)),W.length=0):W.push(N)},Fr=(I,N,W,he)=>{for(var Re=0,Je=0;Je<W;Je++){var Ie=L[N>>2],Se=L[N+4>>2];N+=8;for(var ta=0;ta<Se;ta++)Sr(I,Q[Ie+ta]);Re+=Se}return L[he>>2]=Re,0},kr=I=>{M=I,l(I,new ja(I))},Er=(I,N)=>{M=I,kr(I)},du=I=>{if(I instanceof ja||I=="unwind")return M;l(1,I)},hu=I=>{for(var N=0,W=0;W<I.length;++W){var he=I.charCodeAt(W);he<=127?N++:he<=2047?N+=2:he>=55296&&he<=57343?(N+=4,++W):N+=3}return N},uu=(I,N,W,he)=>{if(!(he>0))return 0;for(var Re=W,Je=W+he-1,Ie=0;Ie<I.length;++Ie){var Se=I.charCodeAt(Ie);if(Se>=55296&&Se<=57343){var ta=I.charCodeAt(++Ie);Se=65536+((Se&1023)<<10)|ta&1023}if(Se<=127){if(W>=Je)break;N[W++]=Se}else if(Se<=2047){if(W+1>=Je)break;N[W++]=192|Se>>6,N[W++]=128|Se&63}else if(Se<=65535){if(W+2>=Je)break;N[W++]=224|Se>>12,N[W++]=128|Se>>6&63,N[W++]=128|Se&63}else{if(W+3>=Je)break;N[W++]=240|Se>>18,N[W++]=128|Se>>12&63,N[W++]=128|Se>>6&63,N[W++]=128|Se&63}}return N[W]=0,W-Re},bu=(I,N,W)=>uu(I,Q,N,W),gu=I=>{var N=hu(I)+1,W=an(N);return bu(I,W,N),W},pu={b:Br,c:Ba,e:vr,d:xr,a:Fr},yt=Dr();t._initialize=(I,N,W)=>(t._initialize=yt.h)(I,N,W),t._allocMatrix=I=>(t._allocMatrix=yt.i)(I),t._getMatrixBufferPtr=()=>(t._getMatrixBufferPtr=yt.j)(),t._getSRTPtr=()=>(t._getSRTPtr=yt.k)(),t._getInfoPtr=()=>(t._getInfoPtr=yt.l)(),t._getContinuedSRTPtr=()=>(t._getContinuedSRTPtr=yt.m)(),t._printMatrix=I=>(t._printMatrix=yt.n)(I),t._updateAllMatrixContinueTransform=(I,N,W)=>(t._updateAllMatrixContinueTransform=yt.o)(I,N,W);var tl=t._main=(I,N)=>(tl=t._main=yt.p)(I,N),an=I=>(an=yt.r)(I),al=I=>(al=yt.s)(I),ds;Me=function I(){ds||rl(),ds||(Me=I)};function mu(I=[]){var N=tl;I.unshift(o);var W=I.length,he=an((W+1)*4),Re=he;I.forEach(Ie=>{L[Re>>2]=gu(Ie),Re+=4}),L[Re>>2]=0;try{var Je=N(W,he);return Er(Je,!0),Je}catch(Ie){return du(Ie)}}function rl(I=n){if(Ce>0||(Z(),Ce>0))return;function N(){ds||(ds=!0,t.calledRun=!0,!S&&(de(),ce(),a(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),il&&mu(I),De()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),N()},1)):N()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();var il=!0;return t.noInitialRun&&(il=!1),rl(),e.ready})})();function tr(s,e,t){return m.setting.doublePrecision?new Float64Array(s,e,t):new Float32Array(s,e,t)}class me{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 Su(),this.useDoublePrecision=t,this.wasm._initialize(e,t,0),this.allocMatrix(e)}static allocMatrix(e){e>E.maxCount&&console.error(`The maximum allocation size is exceeded! current:${e}, limit:${E.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=tr(this.wasm.HEAPF64.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=tr(this.wasm.HEAPF64.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=tr(this.wasm.HEAPF64.buffer,this.matrixContinuedSRTBufferPtr,9*e),E.blockBytes=E.block*8):(this.matrixBuffer=tr(this.wasm.HEAPF32.buffer,this.matrixBufferPtr,16*e),this.matrixSRTBuffer=tr(this.wasm.HEAPF32.buffer,this.matrixSRTBufferPtr,9*e),this.matrixContinuedSRTBuffer=tr(this.wasm.HEAPF32.buffer,this.matrixContinuedSRTBufferPtr,9*e),E.blockBytes=E.block*4),this.matrixStateBuffer=new Int32Array(this.wasm.HEAP32.buffer,this.matrixStateBufferPtr,me.stateStruct*e),E.allocMatrix(e)}static updateAllContinueTransform(e,t,a){this.wasm._updateAllMatrixContinueTransform(e,t,a)}static setParent(e,t,a){this.matrixStateBuffer[e*me.stateStruct+2]=t>=0?t:-1,this.matrixStateBuffer[e*me.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*me.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*me.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*me.stateStruct+1]=1)}}class jt{static AXIS_ANGLE="axisAngle";static EULER_ANGLES="eulerAngles";static QUATERNION="quaternion"}class j{static HELP_0=new j(0,0,0,1);static HELP_1=new j(0,0,0,1);static HELP_2=new j(0,0,0,1);static _zero=new j(0,0,0,1);static CALCULATION_QUATERNION=new j;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 j._zero}static quaternionToMatrix(e,t){let a=e.x*2,r=e.y*2,i=e.z*2,n=e.x*a,o=e.y*r,l=e.z*i,c=e.x*r,f=e.x*i,d=e.y*i,h=e.w*a,b=e.w*r,p=e.w*i;t.rawData[0]=1-(o+l),t.rawData[1]=c+p,t.rawData[2]=f-b,t.rawData[3]=0,t.rawData[4]=c-p,t.rawData[5]=1-(n+l),t.rawData[6]=d+h,t.rawData[7]=0,t.rawData[8]=f+b,t.rawData[9]=d-h,t.rawData[10]=1-(n+o),t.rawData[11]=0,t.rawData[12]=0,t.rawData[13]=0,t.rawData[14]=0,t.rawData[15]=1}get magnitude(){return Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z)}set(e=0,t=0,a=0,r=1){return this.x=e,this.y=t,this.z=a,this.w=r,this}divide(e){return e instanceof j?new j(this.x/e.x,this.y/e.y,this.z/e.z):(this.x=this.x/e,this.y=this.y/e,this.z=this.z/e,this)}setFromArray(e){return this.x=e[0],this.y=e[1],this.z=e[2],this.w=e[3],this}multiply(e,t){var a=e.w,r=e.x,i=e.y,n=e.z,o=t.w,l=t.x,c=t.y,f=t.z;this.w=a*o-r*l-i*c-n*f,this.x=a*l+r*o+i*f-n*c,this.y=a*c-r*f+i*o+n*l,this.z=a*f+r*c-i*l+n*o}multiplyVector(e,t=null){t||=new j;var a=e.x,r=e.y,i=e.z;return t.w=-this.x*a-this.y*r-this.z*i,t.x=this.w*a+this.y*i-this.z*r,t.y=this.w*r-this.x*i+this.z*a,t.z=this.w*i+this.x*r-this.y*a,t}fromAxisAngle(e,t){t*=Math.PI/180;var a=t*.5,r=Math.sin(a);this.w=Math.cos(a),this.x=e.x*r,this.y=e.y*r,this.z=e.z*r,this.normalize()}toAxisAngle(e){var t=this.x*this.x+this.y*this.y+this.z*this.z,a=0;return t>0?(a=2*Math.acos(this.w),t=1/Math.sqrt(t),e.x=this.x*t,e.y=this.y*t,e.z=this.z*t):(a=0,e.x=1,e.y=0,e.z=0),a}slerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h=r*l+i*c+n*f+o*d;if(h<0&&(h=-h,l=-l,c=-c,f=-f,d=-d),h<.95){var b=Math.acos(h),p=1/Math.sin(b),g=Math.sin(b*(1-a))*p,A=Math.sin(b*a)*p;this.w=r*g+l*A,this.x=i*g+c*A,this.y=n*g+f*A,this.z=o*g+d*A}else{this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o);var D=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z);this.w*=D,this.x*=D,this.y*=D,this.z*=D}}lerp(e,t,a){var r=e.w,i=e.x,n=e.y,o=e.z,l=t.w,c=t.x,f=t.y,d=t.z,h;r*l+i*c+n*f+o*d<0&&(l=-l,c=-c,f=-f,d=-d),this.w=r+a*(l-r),this.x=i+a*(c-i),this.y=n+a*(f-n),this.z=o+a*(d-o),h=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=h,this.x*=h,this.y*=h,this.z*=h}fromEulerAngles(e,t,a){e*=rt,t*=rt,a*=rt;var r=e*.5,i=t*.5,n=a*.5,o=Math.cos(r),l=Math.sin(r),c=Math.cos(i),f=Math.sin(i),d=Math.cos(n),h=Math.sin(n);return this.w=o*c*d+l*f*h,this.x=l*c*d-o*f*h,this.y=o*f*d+l*c*h,this.z=o*c*h-l*f*d,this}setFromRotationMatrix(e){const t=e.rawData,a=t[0],r=t[4],i=t[8],n=t[1],o=t[5],l=t[9],c=t[2],f=t[6],d=t[10],h=a+o+d;if(h>0){const b=.5/Math.sqrt(h+1);this.w=.25/b,this.x=(f-l)*b,this.y=(i-c)*b,this.z=(n-r)*b}else if(a>o&&a>d){const b=2*Math.sqrt(1+a-o-d);this.w=(f-l)/b,this.x=.25*b,this.y=(r+n)/b,this.z=(i+c)/b}else if(o>d){const b=2*Math.sqrt(1+o-a-d);this.w=(i-c)/b,this.x=(r+n)/b,this.y=.25*b,this.z=(l+f)/b}else{const b=2*Math.sqrt(1+d-a-o);this.w=(n-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,n,o,l,c;return e||=new u,i=this.x,n=this.y,o=this.z,l=this.w,c=2*(l*n-i*o),c<=-.99999?(t=2*Math.atan2(i,l),a=-Math.PI/2,r=0):c>=.99999?(t=2*Math.atan2(i,l),a=Math.PI/2,r=0):(t=Math.atan2(2*(l*i+n*o),1-2*(i*i+n*n)),a=Math.asin(c),r=Math.atan2(2*(l*o+i*n),1-2*(n*n+o*o))),e.set(t,a,r).scaleBy(Xr)}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(jt.QUATERNION)[1];this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}inverse(e=null){e||=new j;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 j(this.x,this.y,this.z,this.w)}transformVector(e,t=null){var a,r,i,n,o=e.x,l=e.y,c=e.z;return t||=new u,n=-this.x*o-this.y*l-this.z*c,a=this.w*o+this.y*c-this.z*l,r=this.w*l-this.x*c+this.z*o,i=this.w*c+this.x*l-this.y*o,t.x=-n*this.x+a*this.w-r*this.z+i*this.y,t.y=-n*this.y+a*this.z+r*this.w-i*this.x,t.z=-n*this.z-a*this.y+r*this.x+i*this.w,t}copyFrom(e){var t=this;return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,this}mul(e,t,a){let r=a||new j;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 j(e.x,e.y,e.z,e.w)}}function Fu(s,e,t){let a=s.x*2,r=s.y*2,i=s.z*2,n=s.x*a,o=s.y*r,l=s.z*i,c=s.x*r,f=s.x*i,d=s.y*i,h=s.w*a,b=s.w*r,p=s.w*i,g=t||new u;return g.x=(1-(o+l))*e.x+(c-p)*e.y+(f+b)*e.z,g.y=(c+p)*e.x+(1-(n+l))*e.y+(d-h)*e.z,g.z=(f-b)*e.x+(d+h)*e.y+(1-(n+o))*e.z,g}class Yi{_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 Yi;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 Dc(this.get())}getSignedFloat(){return this.getFloat()*2-1}}let Xr=180/Math.PI,rt=Math.PI/180,ku=2147483647,Eu=-2147483647;function se(s,e,t){return Math.max(e,Math.min(t,s))}class St{static gaussFunction(e,t,a,r){let i=Math.pow(e-a,2),n=2*Math.pow(r,2),o=-1*(i/n),l=Math.pow(Math.E,o);return Math.round(l*t)}static computeGaussian(e,t){return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(e*e)/(2*t*t))}static gaussCoef(e){e<.5&&(e=.5);let t=Math.exp(.726*.726)/e,a=Math.exp(-t),r=Math.exp(-2*t),i=(1-a)*(1-a)/(1+2*t*a-r),n=i,o=i*(t-1)*a,l=i*(t+1)*a,c=-i*r,f=2*a,d=-r,h=(n+o)/(1-f-d),b=(l+c)/(1-f-d);return new Float32Array([n,o,l,c,f,d,h,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()*rt,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()*rt,r=Math.cos(a)*t,i=Math.tan(a)*t,n=Math.sin(a)*t;return new u(r,i,n)}static getCycleXYZ(e){let t=e*Math.random(),a=360*Math.random()*rt,r=Math.cos(a)*t,i=e*Math.random()-e*.5,n=Math.sin(a)*t;return new u(r,i,n)}static angle(e,t){let a=K.HELP_0,r=K.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=u.HELP_0;return e.crossProduct(t,a),a.z>0?St.angle(e,t):360-St.angle(e,t)}getRotationY(e){return St.normalizeAngle(Math.atan2(e.z,e.x)*Xr)}static fromToRotation(e,t,a=null){a||=new j;let r=E.help_matrix_2;return E.fromToRotation(e,t,r),a.fromMatrix(r),a}static getEularDir_yUp(e){let t=j.HELP_0;return t.fromEulerAngles(0,e,0),t.transformVector(u.Z_AXIS,u.HELP_5),u.HELP_5}static transformVector(e,t,a=null){a||=new u;let r=e.rawData,i=r[0],n=r[1],o=r[2],l=r[3],c=r[4],f=r[5],d=r[6],h=r[7],b=r[8],p=r[9],g=r[10],A=r[11],D=r[12],_=r[13],U=r[14],v=r[15],x=t.x,C=t.y,F=t.z;return a.x=i*x+c*C+b*F+D,a.y=n*x+f*C+p*F+_,a.z=o*x+d*C+g*F+U,a.w=l*x+h*C+A*F+v,a}}let wr=function(s,e,t){return s*(1-t)+e*t};function wu(s,e,t){let a=new u,r=s.x,i=s.y,n=s.z,o=s.w,l=e.x,c=e.y,f=e.z,d=e.w;return a.x=(l-r)*t+r,a.y=(c-i)*t+i,a.z=(f-n)*t+n,a.w=(d-o)*t+o,a}function Ru(s,e,t){let a=new P;return a.r=(1-t)*s.r+t*e.r,a.g=(1-t)*s.g+t*e.g,a.b=(1-t)*s.b+t*e.b,a.a=(1-t)*s.a+t*e.a,a}function Iu(s,e,t){return s+((e-s)*t>>8)&255}let gn=function(s,e,t){let a=t-e;return Math.floor(s/a)%2==0?s%a+e:t-s%a+e},pn=function(s,e,t){let a=t-e;return s%a+e},Qu=function(s,e){let t=0;for(let a in s)a==e&&t++;return t};class Tu{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 ut(s,e){return s instanceof u&&e instanceof u||s instanceof j&&e instanceof j?s.x*e.x+s.y*e.y+s.z*e.z:s.x*e.x+s.y*e.y}function mn(s,e){return new u(s.x*e.x,s.y*e.y,s.z*e.z)}function mc(s){return Math.sqrt(s)}function An(s){return mc(ut(s,s))}function Ac(s,e){if(An(s)>u.EPSILON)return s.divide(An(s));if(s instanceof K)return new K;if(s instanceof u)return new u;if(s instanceof j)return new j}function Dc(s){return(s&8388607)*(1/8388607)}function Hr(s){return s.getFloat()}function it(s,e,t){let a=s.getFloat();return a=e*a+(1-a)*t,a}function Mu(s,e,t){let a;if(e<t){a=t-e;let r=s.get()%a;return r+=e,r}else if(e>t){a=e-t;let r=s.get()%a;return r=e-r,r}else return e}function gs(s){let e=it(s,-1,1),t=it(s,0,2*Math.PI),a=Math.sqrt(1-e*e),r=a*Math.cos(t),i=a*Math.sin(t);return new u(r,i,e)}function _c(s){let e=it(s,0,2*Math.PI),t=Math.cos(e),a=Math.sin(e);return new K(t,a)}function Nu(s){let e=new j;return e.x=it(s,-1,1),e.y=it(s,-1,1),e.z=it(s,-1,1),e.w=it(s,-1,1),e=Ac(e),ut(e,j.identity())<0?-e:e}function Vu(s){const e=2*Math.PI;let t=it(s,0,1),a=it(s,0,e),r=it(s,0,e),i=Math.sqrt(1-t),n=Math.sqrt(t),o=new j(i*Math.sin(a),i*Math.cos(a),n*Math.sin(r),n*Math.cos(r));return ut(o,j.identity())<0?-o:o}function Pu(s,e){return new u(it(s,-e.x,e.x),it(s,-e.y,e.y),it(s,-e.z,e.z))}function Bc(s){let e=gs(s);return e.scaleBy(Math.pow(Hr(s),1/3)),e}function Ou(s,e){return mn(Bc(s),e)}function Lu(s,e,t){let a=gs(s),r=Math.pow(it(s,0,1),1/3);return a.scaleBy(e+(t-e)*r),a}function Gu(s){let e=_c(s);return e.multiply(Math.pow(it(s,0,1),1/2),e),e}function zu(s,e,t){let a=mn(gs(s),e),r=Math.pow(it(s,t,1),1/3);return a.scaleBy(r),a}function Ju(s){let e=s.getFloat(),t=s.getFloat();e+t>1&&(e=1-e,t=1-t);let a=1-e-t;return new u(e,t,a)}function Wu(s){return s/360*2*Math.PI}function Zu(s){return 180*s/Math.PI}function ju(s){return Math.sin(s)}function Yu(s){return Math.cos(s)}let vc=4919;function Xu(){return++vc}function Hu(s,e,t){let a=s[e],r=s[t];s[e]=r,s[t]=a}function Uc(s){return Math.floor(s)}function Dn(s){return Uc(s+.5)}function Ku(s){return s=Math.max(s,0),s=Math.min(s,1),Dn(s*65535)}function qu(s){return s=Math.max(s,0),s=Math.min(s,1),Dn(s*255)}function xc(s){return Math.abs(s)==0?s:1/Math.sqrt(s)}function $u(s){let e=_n(s);return s.scaleBy(xc(e))}function e2(s,e){return s.crossProduct(e)}function _n(s){return ut(s,s)}function t2(s){let e=new Yi(s);return Hr(e)}function a2(s,e){let t=new Yi(e);s.x=Hr(t),s.y=Hr(t),s.z=Hr(t)}function r2(s,e,t){return s<e?t:s>t?e:s}function Bn(s,e){return s-Math.floor(s/e)*e}const i2=1e-6;class E{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 u(0,0,0);static _one=new u(1,1,1);static _prs=[new u,new u,new u];index=0;offset=0;rawData;_position;static allocMatrix(e){this.allocCount=e,E.dynamicMatrixBytes=me.matrixBuffer,E.buffer=E.dynamicMatrixBytes.buffer,E.wasmMatrixPtr=me.matrixBufferPtr,this.dynamicGlobalMatrixRef||=[],this.dynamicGlobalMatrixRef.forEach(t=>{t.offset=E.wasmMatrixPtr+t.index*E.blockBytes,t.rawData=tr(E.dynamicMatrixBytes.buffer,t.offset,16)}),E.help_matrix_0||=new E,E.help_matrix_1||=new E,E.help_matrix_2||=new E,E.helpMatrix||=new E,E.helpMatrix2||=new E,E._getEulerMatrix||=new E,E._getEulerMatrix.identity()}static fromToRotation(e,t,a){return a||=new E,a.transformDir(e,t),a}static fromArray(e){if(e.length!==16)throw new Error("Array must contain exactly 16 elements");const t=new E;for(let a=0;a<16;a++)t.rawData[a]=e[a];return t}static getAxisRotation(e,t,a,r){let i=new E,n=r*(Math.PI/180),o=Math.cos(n),l=Math.sin(n),c=1-o,f,d;return i.rawData[0]=o+e*e*c,i.rawData[5]=o+t*t*c,i.rawData[10]=o+a*a*c,f=e*t*c,d=a*l,i.rawData[1]=f+d,i.rawData[4]=f-d,f=e*a*c,d=t*l,i.rawData[8]=f+d,i.rawData[2]=f-d,f=t*a*c,d=e*l,i.rawData[9]=f-d,i.rawData[6]=f+d,i}static sanitizeEuler(e){E.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)),E.sanitizeEuler(t),!0):(t.x=Math.PI*.5,t.y=Math.atan2(e.get(0,1),e.get(0,0)),t.z=0,E.sanitizeEuler(t),!1):(t.x=-Math.PI*.5,t.y=Math.atan2(-e.get(0,1),e.get(0,0)),t.z=0,E.sanitizeEuler(t),!1)}static matrixMultiply(e,t,a){E.wasm.Matrix_Multiply(e.index,t.index,a.index)}static matrixAppend(e,t,a){E.wasm.Matrix_Append(e.index,t.index,a.index)}static matrixRotateY(e,t){E.wasm.Matrix_Append(e,t.index)}static matrixRotate(e,t,a){E.wasm.Matrix_Rotate(e,t,a.index)}constructor(e=!1){if(E.useCount>=E.allocCount){let t=E.allocCount+E.allocOnceCount;me.allocMatrix(t)}this.index=E.useCount,this.offset=E.wasmMatrixPtr+this.index*E.blockBytes,E.dynamicGlobalMatrixRef[this.index]=this,E.useCount++,this.rawData=tr(E.dynamicMatrixBytes.buffer,this.offset,16),this._position=new u,this.identity()}lookAt(e,t,a=u.Y_AXIS){let r=this.rawData,i=t.subtract(e,u.HELP_0);i.length===0&&(i.z=1),i.normalize();let n=a.crossProduct(i,u.HELP_1);n.length===0&&(Math.abs(a.z)===1?i.x+=1e-4:i.z-=1e-4,i.normalize(),n=a.crossProduct(i,u.HELP_1)),n.normalize();let o=i.crossProduct(n,u.HELP_2);r[0]=n.x,r[1]=o.x,r[2]=i.x,r[3]=0,r[4]=n.y,r[5]=o.y,r[6]=i.y,r[7]=0,r[8]=n.z,r[9]=o.z,r[10]=i.z,r[11]=0,r[12]=-n.dotProduct(e),r[13]=-o.dotProduct(e),r[14]=-i.dotProduct(e),r[15]=1}static floatArray=new Float64Array(16).fill(0);multiply(e){let t=this.rawData,a=e.rawData,r=E.floatArray;r[0]=t[0]*a[0]+t[1]*a[4]+t[2]*a[8]+t[3]*a[12],r[1]=t[0]*a[1]+t[1]*a[5]+t[2]*a[9]+t[3]*a[13],r[2]=t[0]*a[2]+t[1]*a[6]+t[2]*a[10]+t[3]*a[14],r[3]=t[0]*a[3]+t[1]*a[7]+t[2]*a[11]+t[3]*a[15],r[4]=t[4]*a[0]+t[5]*a[4]+t[6]*a[8]+t[7]*a[12],r[5]=t[4]*a[1]+t[5]*a[5]+t[6]*a[9]+t[7]*a[13],r[6]=t[4]*a[2]+t[5]*a[6]+t[6]*a[10]+t[7]*a[14],r[7]=t[4]*a[3]+t[5]*a[7]+t[6]*a[11]+t[7]*a[15],r[8]=t[8]*a[0]+t[9]*a[4]+t[10]*a[8]+t[11]*a[12],r[9]=t[8]*a[1]+t[9]*a[5]+t[10]*a[9]+t[11]*a[13],r[10]=t[8]*a[2]+t[9]*a[6]+t[10]*a[10]+t[11]*a[14],r[11]=t[8]*a[3]+t[9]*a[7]+t[10]*a[11]+t[11]*a[15],r[12]=t[12]*a[0]+t[13]*a[4]+t[14]*a[8]+t[15]*a[12],r[13]=t[12]*a[1]+t[13]*a[5]+t[14]*a[9]+t[15]*a[13],r[14]=t[12]*a[2]+t[13]*a[6]+t[14]*a[10]+t[15]*a[14],r[15]=t[12]*a[3]+t[13]*a[7]+t[14]*a[11]+t[15]*a[15],t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]}multiplyMatrices(e,t){const a=e.rawData,r=t.rawData,i=this.rawData,n=a[0],o=a[4],l=a[8],c=a[12],f=a[1],d=a[5],h=a[9],b=a[13],p=a[2],g=a[6],A=a[10],D=a[14],_=a[3],U=a[7],v=a[11],x=a[15],C=r[0],F=r[4],w=r[8],S=r[12],M=r[1],T=r[5],Q=r[9],L=r[13],X=r[2],ie=r[6],q=r[10],be=r[14],Ue=r[3],Z=r[7],de=r[11],ce=r[15];return i[0]=n*C+o*M+l*X+c*Ue,i[4]=n*F+o*T+l*ie+c*Z,i[8]=n*w+o*Q+l*q+c*de,i[12]=n*S+o*L+l*be+c*ce,i[1]=f*C+d*M+h*X+b*Ue,i[5]=f*F+d*T+h*ie+b*Z,i[9]=f*w+d*Q+h*q+b*de,i[13]=f*S+d*L+h*be+b*ce,i[2]=p*C+g*M+A*X+D*Ue,i[6]=p*F+g*T+A*ie+D*Z,i[10]=p*w+g*Q+A*q+D*de,i[14]=p*S+g*L+A*be+D*ce,i[3]=_*C+U*M+v*X+x*Ue,i[7]=_*F+U*T+v*ie+x*Z,i[11]=_*w+U*Q+v*q+x*de,i[15]=_*S+U*L+v*be+x*ce,this}multiplyPoint3(e,t){t||=new u;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 u;let a=this.rawData,r=e.x,i=e.y,n=e.z,o=a[3]*r+a[7]*i+a[11]*n+a[15];return o=o||1,t.x=(a[0]*r+a[4]*i+a[8]*n+a[12])/o,t.y=(a[1]*r+a[5]*i+a[9]*n+a[13])/o,t.z=(a[2]*r+a[6]*i+a[10]*n+a[14])/o,t.w=1,t}transformVector4(e,t){let a=this.rawData;t||=new u;let r=e.x,i=e.y,n=e.z,o=e.w;return t.x=r*a[0]+i*a[4]+n*a[8]+o*a[12],t.y=r*a[1]+i*a[5]+n*a[9]+o*a[13],t.z=r*a[2]+i*a[6]+n*a[10]+o*a[14],t.w=r*a[3]+i*a[7]+n*a[11]+o*a[15],t}perspectiveMultiplyPoint3(e,t){let a=u.HELP_2,r,i=this.rawData;if(a.x=i[0]*e.x+i[4]*e.y+i[8]*e.z+i[12],a.y=i[1]*e.x+i[5]*e.y+i[9]*e.z+i[13],a.z=i[2]*e.x+i[6]*e.y+i[10]*e.z+i[14],r=i[3]*e.x+i[7]*e.y+i[11]*e.z+i[15],Math.abs(r)>1e-7){let n=1/r;return t.x=a.x*n,t.y=a.y*n,t.z=a.z*n,!0}else return t.x=0,t.y=0,t.z=0,!1}perspective(e,t,a,r){let i=this.rawData,n=e*rt/2,o=Math.cos(n)/Math.sin(n);i[0]=-o/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r/(r-a),i[11]=1,i[12]=0,i[13]=0,i[14]=-a*r/(r-a),i[15]=0}perspective3(e,t,a,r){let i=Math.tan(e*Math.PI/360)*a,n=i*t;this.frustum(-n,n,-i,i,a,r)}frustum(e,t,a,r,i,n){let o=this.rawData;o[0]=-2*i/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*i/(r-a),o[6]=0,o[7]=0,o[8]=(t+e)/(t-e),o[9]=(r+a)/(r-a),o[10]=n/(n-i),o[11]=1,o[12]=0,o[13]=0,o[14]=-n*i/(n-i),o[15]=0}ortho(e,t,a,r){let i=this.rawData;return i[0]=2/e,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/t,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1/(r-a),i[11]=0,i[12]=0,i[13]=0,i[14]=a/(a-r),i[15]=1,this}orthoZO(e,t,a,r,i,n){let o=this.rawData,l=1/(e-t),c=1/(a-r),f=1/(i-n);return o[0]=-2*l,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*c,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=f,o[11]=0,o[12]=(e+t)*l,o[13]=(r+a)*c,o[14]=i*f,o[15]=1,this}orthoOffCenter(e,t,a,r,i,n){let o=this.rawData;o[0]=2/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2/(r-a),o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1/(n-i),o[11]=0,o[12]=(e+t)/(e-t),o[13]=(r+a)/(a-r),o[14]=i/(i-n),o[15]=1}transformDir(e,t){let a=this.rawData,r=1e-6,i=u.ZERO;t.crossProduct(e,i);let n=t.dotProduct(e);if(n>1-r)this.identity();else if(n<-1+r){let o=u.HELP_1,l=u.HELP_2,c=0,f,d,h,b,p,g,A,D,_,U,v,x,C,F,w,S,M,T;l.x=0,l.y=e.z,l.z=-e.y,l.dotProduct(l)<r&&(l.x=-e.z,l.y=0,l.z=e.x),c=1/Math.sqrt(l.dotProduct(l)),l.x*=c,l.y*=c,l.z*=c,l.crossProduct(e,o),f=-e.x*e.x,d=-e.y*e.y,h=-e.z*e.z,b=-e.x*e.y,p=-e.x*e.z,g=-e.y*e.z,A=o.x*o.x,D=o.y*o.y,_=o.z*o.z,U=o.x*o.y,v=o.x*o.z,x=o.y*o.z,C=-l.x*l.x,F=-l.y*l.y,w=-l.z*l.z,S=-l.x*l.y,M=-l.x*l.z,T=-l.y*l.z,a[0]=f+A+C,a[1]=b+U+S,a[2]=p+v+M,a[4]=a[1],a[5]=d+D+F,a[6]=g+x+T,a[8]=a[2],a[9]=a[6],a[10]=h+_+w,a[3]=0,a[7]=0,a[11]=0,a[15]=1}else{let o,l,c,f,d,h=i.dotProduct(i),b=(1-n)/h;o=b*i.x,l=b*i.z,c=o*i.y,f=o*i.z,d=l*i.y,a[0]=n+o*i.x,a[1]=c-i.z,a[2]=f+i.y,a[4]=c+i.z,a[5]=n+b*i.y*i.y,a[6]=d-i.x,a[8]=f-i.y,a[9]=d+i.x,a[10]=n+l*i.z,a[3]=0,a[7]=0,a[11]=0,a[15]=1}return this}append(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],b=t[10],p=t[14],g=t[3],A=t[7],D=t[11],_=t[15];t[0]=a*e.rawData[0]+o*e.rawData[4]+d*e.rawData[8]+g*e.rawData[12],t[1]=a*e.rawData[1]+o*e.rawData[5]+d*e.rawData[9]+g*e.rawData[13],t[2]=a*e.rawData[2]+o*e.rawData[6]+d*e.rawData[10]+g*e.rawData[14],t[3]=a*e.rawData[3]+o*e.rawData[7]+d*e.rawData[11]+g*e.rawData[15],t[4]=r*e.rawData[0]+l*e.rawData[4]+h*e.rawData[8]+A*e.rawData[12],t[5]=r*e.rawData[1]+l*e.rawData[5]+h*e.rawData[9]+A*e.rawData[13],t[6]=r*e.rawData[2]+l*e.rawData[6]+h*e.rawData[10]+A*e.rawData[14],t[7]=r*e.rawData[3]+l*e.rawData[7]+h*e.rawData[11]+A*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]=n*e.rawData[0]+f*e.rawData[4]+p*e.rawData[8]+_*e.rawData[12],t[13]=n*e.rawData[1]+f*e.rawData[5]+p*e.rawData[9]+_*e.rawData[13],t[14]=n*e.rawData[2]+f*e.rawData[6]+p*e.rawData[10]+_*e.rawData[14],t[15]=n*e.rawData[3]+f*e.rawData[7]+p*e.rawData[11]+_*e.rawData[15]}add(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],b=t[10],p=t[14],g=t[3],A=t[7],D=t[11],_=t[15],U=e.rawData[0],v=e.rawData[4],x=e.rawData[8],C=e.rawData[12],F=e.rawData[1],w=e.rawData[5],S=e.rawData[9],M=e.rawData[13],T=e.rawData[2],Q=e.rawData[6],L=e.rawData[10],X=e.rawData[14],ie=e.rawData[3],q=e.rawData[7],be=e.rawData[11],Ue=e.rawData[15];return t[0]=a+U,t[1]=o+F,t[2]=d+T,t[3]=g+ie,t[4]=r+v,t[5]=l+w,t[6]=h+Q,t[7]=A+q,t[8]=i+x,t[9]=c+S,t[10]=b+L,t[11]=D+be,t[12]=n+C,t[13]=f+M,t[14]=p+X,t[15]=_+Ue,this}sub(e){let t=this.rawData,a=t[0],r=t[4],i=t[8],n=t[12],o=t[1],l=t[5],c=t[9],f=t[13],d=t[2],h=t[6],b=t[10],p=t[14],g=t[3],A=t[7],D=t[11],_=t[15],U=e.rawData[0],v=e.rawData[4],x=e.rawData[8],C=e.rawData[12],F=e.rawData[1],w=e.rawData[5],S=e.rawData[9],M=e.rawData[13],T=e.rawData[2],Q=e.rawData[6],L=e.rawData[10],X=e.rawData[14],ie=e.rawData[3],q=e.rawData[7],be=e.rawData[11],Ue=e.rawData[15];return t[0]=a-U,t[1]=o-F,t[2]=d-T,t[3]=g-ie,t[4]=r-v,t[5]=l-w,t[6]=h-Q,t[7]=A-q,t[8]=i-x,t[9]=c-S,t[10]=b-L,t[11]=D-be,t[12]=n-C,t[13]=f-M,t[14]=p-X,t[15]=_-Ue,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=E.getAxisRotation(t.x,t.y,t.z,e);this.append(a)}createByRotation(e,t){let a=E.helpMatrix,r,i,n=e*rt;return r=Math.sin(n),i=Math.cos(n),t.x==1&&(a.rawData[0]=1,a.rawData[1]=0,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=i,a.rawData[6]=r,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=-r,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.y==1&&(a.rawData[0]=i,a.rawData[1]=0,a.rawData[2]=-r,a.rawData[3]=0,a.rawData[4]=0,a.rawData[5]=1,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=r,a.rawData[9]=0,a.rawData[10]=i,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),t.z==1&&(a.rawData[0]=i,a.rawData[1]=r,a.rawData[2]=0,a.rawData[3]=0,a.rawData[4]=-r,a.rawData[5]=i,a.rawData[6]=0,a.rawData[7]=0,a.rawData[8]=0,a.rawData[9]=0,a.rawData[10]=1,a.rawData[11]=0,a.rawData[12]=0,a.rawData[13]=0,a.rawData[14]=0,a.rawData[15]=1),this.append(a),this}appendScale(e,t,a){E.helpMatrix.createByScale(e,t,a),this.append(E.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 E;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(E._zero,e,E._one),this}static decomposeRawData=new Float64Array(16).fill(0);decompose(e="eulerAngles",t){let a=j.CALCULATION_QUATERNION,r=t||E._prs;this.copyRawDataTo(E.decomposeRawData);let i=E.decomposeRawData,n=r[0];n.x=i[12],n.y=i[13],n.z=i[14],i[12]=0,i[13]=0,i[14]=0;let o=r[2];o.x=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]),o.y=Math.sqrt(i[4]*i[4]+i[5]*i[5]+i[6]*i[6]),o.z=Math.sqrt(i[8]*i[8]+i[9]*i[9]+i[10]*i[10]),i[0]*(i[5]*i[10]-i[6]*i[9])-i[1]*(i[4]*i[10]-i[6]*i[8])+i[2]*(i[4]*i[9]-i[5]*i[8])<0&&(o.z=-o.z),i[0]/=o.x,i[1]/=o.x,i[2]/=o.x,i[4]/=o.y,i[5]/=o.y,i[6]/=o.y,i[8]/=o.z,i[9]/=o.z,i[10]/=o.z;let l=r[1],c;switch(e){case jt.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 jt.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 jt.EULER_ANGLES:c=i[0]+i[5]+i[10],c>0?(a.w=Math.sqrt(1+c)/2,a.x=(i[6]-i[9])/(4*a.w),a.y=(i[8]-i[2])/(4*a.w),a.z=(i[1]-i[4])/(4*a.w)):i[0]>i[5]&&i[0]>i[10]?(a.x=Math.sqrt(1+i[0]-i[5]-i[10])/2,a.w=(i[6]-i[9])/(4*a.x),a.y=(i[1]+i[4])/(4*a.x),a.z=(i[8]+i[2])/(4*a.x)):i[5]>i[10]?(l.y=Math.sqrt(1+i[5]-i[0]-i[10])/2,a.x=(i[1]+i[4])/(4*a.y),a.w=(i[8]-i[2])/(4*a.y),a.z=(i[6]+i[9])/(4*a.y)):(a.z=Math.sqrt(1+i[10]-i[0]-i[5])/2,a.x=(i[8]+i[2])/(4*a.z),a.y=(i[6]+i[9])/(4*a.z),a.w=(i[1]-i[4])/(4*a.z)),a.getEulerAngles(l);break}return r[0]=n,r[1]=l,r[2]=o,r}static getEuler(e,t,a=!0,r){return e||=new u,E._getEulerMatrix.makeRotationFromQuaternion(t).makeEuler(e,a,r),e}compose(e,t,a){const r=this.rawData,i=t.x,n=t.y,o=t.z,l=t.w,c=i+i,f=n+n,d=o+o,h=i*c,b=i*f,p=i*d,g=n*f,A=n*d,D=o*d,_=l*c,U=l*f,v=l*d,x=a.x,C=a.y,F=a.z;return r[0]=(1-(g+D))*x,r[1]=(b+v)*x,r[2]=(p-U)*x,r[3]=0,r[4]=(b-v)*C,r[5]=(1-(h+D))*C,r[6]=(A+_)*C,r[7]=0,r[8]=(p+U)*F,r[9]=(A-_)*F,r[10]=(1-(h+g))*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 u;let a=this.rawData,r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t.w=r*a[3]+i*a[7]+n*a[11],t}identity(){let e=this.rawData;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}fill(e){let t=this.rawData;t[1]=e,t[2]=e,t[3]=e,t[4]=e,t[6]=e,t[7]=e,t[8]=e,t[9]=e,t[11]=e,t[12]=e,t[13]=e,t[14]=e,t[0]=e,t[5]=e,t[10]=e,t[15]=e}invers33(){let e=this.rawData,t=e[5]*e[10]-e[9]*e[6],a=e[8]*e[6]-e[4]*e[10],r=e[4]*e[9]-e[8]*e[5],i=e[9]*e[2]-e[1]*e[10],n=e[0]*e[10]-e[8]*e[2],o=e[8]*e[1]-e[0]*e[9],l=e[1]*e[6]-e[5]*e[2],c=e[4]*e[2]-e[0]*e[6],f=e[0]*e[5]-e[4]*e[1],d=e[0]*t+e[4]*i+e[8]*l;if(Math.abs(d)>1e-11){let h=1/d;e[0]=h*t,e[4]=h*a,e[8]=h*r,e[1]=h*i,e[5]=h*n,e[9]=h*o,e[2]=h*l,e[6]=h*c,e[10]=h*f}}invert(){let e=this.determinant,t=Math.abs(e)>1e-11,a=this.rawData;if(t){e=1/e;let r=a[0],i=a[4],n=a[8],o=a[12],l=a[1],c=a[5],f=a[9],d=a[13],h=a[2],b=a[6],p=a[10],g=a[14],A=a[3],D=a[7],_=a[11],U=a[15];a[0]=e*(c*(p*U-g*_)-f*(b*U-g*D)+d*(b*_-p*D)),a[1]=-e*(l*(p*U-g*_)-f*(h*U-g*A)+d*(h*_-p*A)),a[2]=e*(l*(b*U-g*D)-c*(h*U-g*A)+d*(h*D-b*A)),a[3]=-e*(l*(b*_-p*D)-c*(h*_-p*A)+f*(h*D-b*A)),a[4]=-e*(i*(p*U-g*_)-n*(b*U-g*D)+o*(b*_-p*D)),a[5]=e*(r*(p*U-g*_)-n*(h*U-g*A)+o*(h*_-p*A)),a[6]=-e*(r*(b*U-g*D)-i*(h*U-g*A)+o*(h*D-b*A)),a[7]=e*(r*(b*_-p*D)-i*(h*_-p*A)+n*(h*D-b*A)),a[8]=e*(i*(f*U-d*_)-n*(c*U-d*D)+o*(c*_-f*D)),a[9]=-e*(r*(f*U-d*_)-n*(l*U-d*A)+o*(l*_-f*A)),a[10]=e*(r*(c*U-d*D)-i*(l*U-d*A)+o*(l*D-c*A)),a[11]=-e*(r*(c*_-f*D)-i*(l*_-f*A)+n*(l*D-c*A)),a[12]=-e*(i*(f*g-d*p)-n*(c*g-d*b)+o*(c*p-f*b)),a[13]=e*(r*(f*g-d*p)-n*(l*g-d*h)+o*(l*p-f*h)),a[14]=-e*(r*(c*g-d*b)-i*(l*g-d*h)+o*(l*b-c*h)),a[15]=e*(r*(c*p-f*b)-i*(l*p-f*h)+n*(l*b-c*h))}return t}transformPoint(e,t){let a=this.rawData;t||=new u;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8]+a[12],t.y=r*a[1]+i*a[5]+n*a[9]+a[13],t.z=r*a[2]+i*a[6]+n*a[10]+a[14],t}transformVector(e,t){let a=this.rawData;t||=new u;let r=e.x,i=e.y,n=e.z;return t.x=r*a[0]+i*a[4]+n*a[8],t.y=r*a[1]+i*a[5]+n*a[9],t.z=r*a[2]+i*a[6]+n*a[10],t}transpose(){let e=this.rawData;for(let t=0;t<E.helpMatrix.rawData.length;t++)E.helpMatrix.rawData[t]=e[t];e[1]=E.helpMatrix.rawData[4],e[2]=E.helpMatrix.rawData[8],e[3]=E.helpMatrix.rawData[12],e[4]=E.helpMatrix.rawData[1],e[6]=E.helpMatrix.rawData[9],e[7]=E.helpMatrix.rawData[13],e[8]=E.helpMatrix.rawData[2],e[9]=E.helpMatrix.rawData[6],e[11]=E.helpMatrix.rawData[14],e[12]=E.helpMatrix.rawData[3],e[13]=E.helpMatrix.rawData[7],e[14]=E.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 u;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 u(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(),j.quaternionToMatrix(t,this),this.translate(new u(-e.x,-e.y,-e.z))}setScale(e){return this.set(0,0,e.x),this.set(0,1,0),this.set(0,2,0),this.set(0,3,0),this.set(1,0,0),this.set(1,1,e.y),this.set(1,2,0),this.set(1,3,0),this.set(2,0,0),this.set(2,1,0),this.set(2,2,e.z),this.set(2,3,0),this.set(3,0,0),this.set(3,1,0),this.set(3,2,0),this.set(3,3,1),this}makeBasis(e,t,a){return this.setElements(e.x,t.x,a.x,0,e.y,t.y,a.y,0,e.z,t.z,a.z,0,0,0,0,1),this}makeRotationAxis(e,t){const a=Math.cos(t),r=Math.sin(t),i=1-a,n=e.x,o=e.y,l=e.z,c=i*n,f=i*o;return this.setElements(c*n+a,c*o-r*l,c*l+r*o,0,c*o+r*l,f*o+a,f*l-r*n,0,c*l-r*o,f*l+r*n,i*l*l+a,0,0,0,0,1),this}static transpose(e,t){t||=new E;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 E;let a=e.rawData,r=t.rawData;r[0]=a[5]*a[10]*a[15]-a[5]*a[14]*a[11]-a[6]*a[9]*a[15]+a[6]*a[13]*a[11]+a[7]*a[9]*a[14]-a[7]*a[13]*a[10],r[1]=-a[1]*a[10]*a[15]+a[1]*a[14]*a[11]+a[2]*a[9]*a[15]-a[2]*a[13]*a[11]-a[3]*a[9]*a[14]+a[3]*a[13]*a[10],r[2]=a[1]*a[6]*a[15]-a[1]*a[14]*a[7]-a[2]*a[5]*a[15]+a[2]*a[13]*a[7]+a[3]*a[5]*a[14]-a[3]*a[13]*a[6],r[3]=-a[1]*a[6]*a[11]+a[1]*a[10]*a[7]+a[2]*a[5]*a[11]-a[2]*a[9]*a[7]-a[3]*a[5]*a[10]+a[3]*a[9]*a[6],r[4]=-a[4]*a[10]*a[15]+a[4]*a[14]*a[11]+a[6]*a[8]*a[15]-a[6]*a[12]*a[11]-a[7]*a[8]*a[14]+a[7]*a[12]*a[10],r[5]=a[0]*a[10]*a[15]-a[0]*a[14]*a[11]-a[2]*a[8]*a[15]+a[2]*a[12]*a[11]+a[3]*a[8]*a[14]-a[3]*a[12]*a[10],r[6]=-a[0]*a[6]*a[15]+a[0]*a[14]*a[7]+a[2]*a[4]*a[15]-a[2]*a[12]*a[7]-a[3]*a[4]*a[14]+a[3]*a[12]*a[6],r[7]=a[0]*a[6]*a[11]-a[0]*a[10]*a[7]-a[2]*a[4]*a[11]+a[2]*a[8]*a[7]+a[3]*a[4]*a[10]-a[3]*a[8]*a[6],r[8]=a[4]*a[9]*a[15]-a[4]*a[13]*a[11]-a[5]*a[8]*a[15]+a[5]*a[12]*a[11]+a[7]*a[8]*a[13]-a[7]*a[12]*a[9],r[9]=-a[0]*a[9]*a[15]+a[0]*a[13]*a[11]+a[1]*a[8]*a[15]-a[1]*a[12]*a[11]-a[3]*a[8]*a[13]+a[3]*a[12]*a[9],r[10]=a[0]*a[5]*a[15]-a[0]*a[13]*a[7]-a[1]*a[4]*a[15]+a[1]*a[12]*a[7]+a[3]*a[4]*a[13]-a[3]*a[12]*a[5],r[11]=-a[0]*a[5]*a[11]+a[0]*a[9]*a[7]+a[1]*a[4]*a[11]-a[1]*a[8]*a[7]-a[3]*a[4]*a[9]+a[3]*a[8]*a[5],r[12]=-a[4]*a[9]*a[14]+a[4]*a[13]*a[10]+a[5]*a[8]*a[14]-a[5]*a[12]*a[10]-a[6]*a[8]*a[13]+a[6]*a[12]*a[9],r[13]=a[0]*a[9]*a[14]-a[0]*a[13]*a[10]-a[1]*a[8]*a[14]+a[1]*a[12]*a[10]+a[2]*a[8]*a[13]-a[2]*a[12]*a[9],r[14]=-a[0]*a[5]*a[14]+a[0]*a[13]*a[6]+a[1]*a[4]*a[14]-a[1]*a[12]*a[6]-a[2]*a[4]*a[13]+a[2]*a[12]*a[5],r[15]=a[0]*a[5]*a[10]-a[0]*a[9]*a[6]-a[1]*a[4]*a[10]+a[1]*a[8]*a[6]+a[2]*a[4]*a[9]-a[2]*a[8]*a[5];let i=a[0]*r[0]+a[1]*r[4]+a[2]*r[8]+a[3]*r[12];for(let n=0;n<16;n++)r[n]/=i;return t}makeEuler(e,t,a="XYZ"){const r=this.rawData,i=r[0],n=r[4],o=r[8],l=r[1],c=r[5],f=r[9],d=r[2],h=r[6],b=r[10];switch(a){case"XYZ":e.y=Math.asin(se(o,-1,1)),Math.abs(o)<.9999999?(e.x=Math.atan2(-f,b),e.z=Math.atan2(-n,i)):(e.x=Math.atan2(h,c),e.z=0);break;case"YXZ":e.x=Math.asin(-se(f,-1,1)),Math.abs(f)<.9999999?(e.y=Math.atan2(o,b),e.z=Math.atan2(l,c)):(e.y=Math.atan2(-d,i),e.z=0);break;case"ZXY":e.x=Math.asin(se(h,-1,1)),Math.abs(h)<.9999999?(e.y=Math.atan2(-d,b),e.z=Math.atan2(-n,c)):(e.y=0,e.z=Math.atan2(l,i));break;case"ZYX":e.y=Math.asin(-se(d,-1,1)),Math.abs(d)<.9999999?(e.x=Math.atan2(h,b),e.z=Math.atan2(l,i)):(e.x=0,e.z=Math.atan2(-n,c));break;case"YZX":e.z=Math.asin(se(l,-1,1)),Math.abs(l)<.9999999?(e.x=Math.atan2(-f,c),e.y=Math.atan2(-d,i)):(e.x=0,e.y=Math.atan2(o,b));break;case"XZY":e.z=Math.asin(-se(n,-1,1)),Math.abs(n)<.9999999?(e.x=Math.atan2(h,c),e.y=Math.atan2(o,i)):(e.x=Math.atan2(-f,b),e.y=0);break}return t&&e.multiplyScalar(Xr),e}setElements(e,t,a,r,i,n,o,l,c,f,d,h,b,p,g,A){const D=this.rawData;return D[0]=e,D[4]=t,D[8]=a,D[12]=r,D[1]=i,D[5]=n,D[9]=o,D[13]=l,D[2]=c,D[6]=f,D[10]=d,D[14]=h,D[3]=b,D[7]=p,D[11]=g,D[15]=A,this}makeMatrix44ByQuaternion(e,t,a){this.identity(),j.quaternionToMatrix(a,this),this.appendTranslation(e.x,e.y,e.z),this.appendScale(t.x,t.y,t.z)}}function yc(s,e,t){for(let a=0;a<4;a++)t.rawData[a]=s.rawData[a]*e.rawData[0]+s.rawData[a+4]*e.rawData[1]+s.rawData[a+8]*e.rawData[2]+s.rawData[a+12]*e.rawData[3],t.rawData[a+4]=s.rawData[a]*e.rawData[4]+s.rawData[a+4]*e.rawData[5]+s.rawData[a+8]*e.rawData[6]+s.rawData[a+12]*e.rawData[7],t.rawData[a+8]=s.rawData[a]*e.rawData[8]+s.rawData[a+4]*e.rawData[9]+s.rawData[a+8]*e.rawData[10]+s.rawData[a+12]*e.rawData[11],t.rawData[a+12]=s.rawData[a]*e.rawData[12]+s.rawData[a+4]*e.rawData[13]+s.rawData[a+8]*e.rawData[14]+s.rawData[a+12]*e.rawData[15]}function ps(s,e,t,a){let r=a.rawData,i=s.x*rt,n=s.y*rt,o=s.z*rt,l=0,c=i*.5,f=n*.5,d=o*.5,h=Math.cos(c),b=Math.sin(c),p=Math.cos(f),g=Math.sin(f),A=Math.cos(d),D=Math.sin(d);l=h*p*A+b*g*D,i=b*p*A-h*g*D,n=h*g*A+b*p*D,o=h*p*D-b*g*A;let _=i+i,U=n+n,v=o+o,x=i*_,C=i*U,F=i*v,w=n*U,S=n*v,M=o*v,T=l*_,Q=l*U,L=l*v,X=t.x,ie=t.y,q=t.z;r[0]=(1-(w+M))*X,r[1]=(C+L)*X,r[2]=(F-Q)*X,r[3]=0,r[4]=(C-L)*ie,r[5]=(1-(x+M))*ie,r[6]=(S+T)*ie,r[7]=0,r[8]=(F+Q)*q,r[9]=(S-T)*q,r[10]=(1-(x+w))*q,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1}function Cc(s,e,t){let a=s.rawData,r=t.rawData,i=a[0],n=a[4],o=a[8],l=a[12],c=a[1],f=a[5],d=a[9],h=a[13],b=a[2],p=a[6],g=a[10],A=a[14],D=a[3],_=a[7],U=a[11],v=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]=n*e.rawData[0]+f*e.rawData[4]+p*e.rawData[8]+_*e.rawData[12],r[5]=n*e.rawData[1]+f*e.rawData[5]+p*e.rawData[9]+_*e.rawData[13],r[6]=n*e.rawData[2]+f*e.rawData[6]+p*e.rawData[10]+_*e.rawData[14],r[7]=n*e.rawData[3]+f*e.rawData[7]+p*e.rawData[11]+_*e.rawData[15],r[8]=o*e.rawData[0]+d*e.rawData[4]+g*e.rawData[8]+U*e.rawData[12],r[9]=o*e.rawData[1]+d*e.rawData[5]+g*e.rawData[9]+U*e.rawData[13],r[10]=o*e.rawData[2]+d*e.rawData[6]+g*e.rawData[10]+U*e.rawData[14],r[11]=o*e.rawData[3]+d*e.rawData[7]+g*e.rawData[11]+U*e.rawData[15],r[12]=l*e.rawData[0]+h*e.rawData[4]+A*e.rawData[8]+v*e.rawData[12],r[13]=l*e.rawData[1]+h*e.rawData[5]+A*e.rawData[9]+v*e.rawData[13],r[14]=l*e.rawData[2]+h*e.rawData[6]+A*e.rawData[10]+v*e.rawData[14],r[15]=l*e.rawData[3]+h*e.rawData[7]+A*e.rawData[11]+v*e.rawData[15]}function s2(s,e){let t=e.x,a=e.y,r=e.z,i=e.w,n=s.rawData,o=2*t*a,l=2*t*r,c=2*t*i,f=2*a*r,d=2*a*i,h=2*r*i,b=t*t,p=a*a,g=r*r,A=i*i;return n[0]=b-p-g+A,n[4]=o-h,n[8]=l+d,n[12]=0,n[1]=o+h,n[5]=-b+p-g+A,n[9]=f-c,n[13]=0,n[2]=l-d,n[6]=f+c,n[10]=-b-p+g+A,n[14]=0,n[3]=0,n[7]=0,n[11]=0,n[15]=1,s}function n2(s,e){let t=e.rawData,a=Math.sin(s),r=Math.cos(s);return t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[8]=a,t[9]=0,t[10]=r,t[11]=0,t}function o2(s,e,t){let a=e.x,r=e.y,i=e.z,n=Math.hypot(a,r,i),o,l,c,f,d,h,b,p,g,A,D,_;if(n<i2)return null;n=1/n,a*=n,r*=n,i*=n,o=Math.sin(s),l=Math.cos(s),c=1-l,f=a*a*c+l,d=r*a*c+i*o,h=i*a*c-r*o,b=a*r*c-i*o,p=r*r*c+l,g=i*r*c+a*o,A=a*i*c+r*o,D=r*i*c-a*o,_=i*i*c+l;let U=t.rawData;return U[0]=f,U[1]=d,U[2]=h,U[3]=0,U[4]=b,U[5]=p,U[6]=g,U[7]=0,U[8]=A,U[9]=D,U[10]=_,U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U}function vn(s,e,t){let a=s.rawData,r=a[0],i=a[1],n=a[2],o=a[3],l=a[4],c=a[5],f=a[6],d=a[7],h=a[8],b=a[9],p=a[10],g=a[11],A=a[12],D=a[13],_=a[14],U=a[15],v=e.rawData,x=t.rawData,C=v[0],F=v[1],w=v[2],S=v[3];return x[0]=C*r+F*l+w*h+S*A,x[1]=C*i+F*c+w*b+S*D,x[2]=C*n+F*f+w*p+S*_,x[3]=C*o+F*d+w*g+S*U,C=v[4],F=v[5],w=v[6],S=v[7],x[4]=C*r+F*l+w*h+S*A,x[5]=C*i+F*c+w*b+S*D,x[6]=C*n+F*f+w*p+S*_,x[7]=C*o+F*d+w*g+S*U,C=v[8],F=v[9],w=v[10],S=v[11],x[8]=C*r+F*l+w*h+S*A,x[9]=C*i+F*c+w*b+S*D,x[10]=C*n+F*f+w*p+S*_,x[11]=C*o+F*d+w*g+S*U,C=v[12],F=v[13],w=v[14],S=v[15],x[12]=C*r+F*l+w*h+S*A,x[13]=C*i+F*c+w*b+S*D,x[14]=C*n+F*f+w*p+S*_,x[15]=C*o+F*d+w*g+S*U,x}var Xe=(s=>(s[s.None=0]="None",s[s.PointLight=1]="PointLight",s[s.DirectionLight=2]="DirectionLight",s[s.SpotLight=3]="SpotLight",s[s.SkyLight=4]="SkyLight",s))(Xe||{});class ms extends bi{static lightSize=24;index=-1;lightType=-1;radius=.001;linear=8;lightPosition=new u;lightMatrixIndex=-1;direction=new u;quadratic=.032;lightColor=new P(1,1,1,1);intensity=1;innerAngle=0;outerAngle=1;range=100;castShadowIndex=-1;lightTangent=u.FORWARD;iesIndex=-1}class xe{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=xe.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 Pe{object3D=null;_eventDispatcher;get eventDispatcher(){return this._eventDispatcher||=new Ra,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?xe.bindUpdate(this.transform.view3D,this,e):xe.unBindUpdate(this.transform.view3D,this)}_onLateUpdate(e){e!=null?xe.bindLateUpdate(this.transform.view3D,this,e):xe.unBindLateUpdate(this.transform.view3D,this)}_onBeforeUpdate(e){e!=null?xe.bindBeforeUpdate(this.transform.view3D,this,e):xe.unBindBeforeUpdate(this.transform.view3D,this)}_onCompute(e){e!=null?xe.bindCompute(this.transform.view3D,this,e):xe.unBindCompute(this.transform.view3D,this)}_onGraphic(e){e!=null?xe.bindGraphic(this.transform.view3D,this,e):xe.unBindGraphic(this.transform.view3D,this)}beforeDestroy(e){xe.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 As{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 ea{origin=new u;length=Number.MAX_VALUE;static _rayl=1e9;static _smallnum=1e-8;_vector=new u;_dir=new u;constructor(e,t){this.origin.copyFrom(e||new u),this._dir.copyFrom(t||new u),this._dir.normalize()}get direction(){return this._dir}set direction(e){this._dir.copyFrom(e),this._dir.normalize()}clone(){return new ea(this.origin,this.direction)}intersectBox(e,t){let a=this.direction,r=this.origin,i,n,o,l,c,f;const d=1/a.x,h=1/a.y,b=1/a.z,p=e.min,g=e.max;return i=((d>=0?p.x:g.x)-r.x)*d,n=((d>=0?g.x:p.x)-r.x)*d,o=((h>=0?p.y:g.y)-r.y)*h,l=((h>=0?g.y:p.y)-r.y)*h,i>l||o>n||(o>i&&(i=o),l<n&&(n=l),c=((b>=0?p.z:g.z)-r.z)*b,f=((b>=0?g.z:p.z)-r.z)*b,i>f||c>n)||(c>i&&(i=c),f<n&&(n=f),n<0)?null:(t||=new u,this.pointAt(i>=0?i:n,t))}pointAt(e,t){return t||=new u,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=ut(a,t),i=ut(t,t),n=r/i,o=this.getPoint(n);return _n(e.subtract(o))}applyMatrix(e){this.origin=e.transformPoint(this.origin),this._dir=e.transformVector(this._dir)}_v0=new u;_v1=new u;_v2=new u;pointInTriangle(e,t,a,r){let i=this._v0,n=this._v1,o=this._v2;r.subtract(t,i),a.subtract(t,n),e.subtract(t,o);let l=u.dot(i,i),c=u.dot(i,n),f=u.dot(i,o),d=u.dot(n,n),h=u.dot(n,o),b=1/(l*d-c*c),p=(d*f-c*h)*b,g=(l*h-c*f)*b;return p>=0&&g>=0&&p+g<1}_E1=new u;_E2=new u;_P=new u;_T=new u;_Q=new u;intersectTriangle(e,t,a){let r=a.v1,i=a.v2,n=a.v3;i.subtract(r,this._E1),n.subtract(r,this._E2),t.crossProduct(this._E2,this._P);let o=this._E1.dotProduct(this._P);if(o>0?e.subtract(r,this._T):(r.subtract(e,this._T),o=-o),o<1e-4||(a.u=this._T.dotProduct(this._P),a.u<0||a.u>o)||(this._T.crossProduct(this._E1,this._Q),a.v=t.dotProduct(this._Q),a.v<0||a.u+a.v>o))return null;let l=new u;a.t0=a.t=this._E2.dotProduct(this._Q);let c=1/o;return a.t*=c,a.u*=c,a.v*=c,l.x=e.x+a.t*t.x,l.y=e.y+a.t*t.y,l.z=e.z+a.t*t.z,l}intersectSphere(e,t,a,r){let i=e.subtract(a),n=u.dot(t,t),o=2*u.dot(i,t),l=u.dot(i,i)-r*r,c=o*o-4*n*l,f=u.HELP_3;if(c<0)return null;{let d=(-o-Math.sqrt(c))/(n*2);return d<0?null:(f.x=e.x+d*t.x,f.y=e.y+d*t.y,f.z=e.z+d*t.z,f)}}intersectionSegment(e,t,a){const r=this.origin,i=u.HELP_0,n=u.HELP_1,o=u.HELP_2,l=u.HELP_3;t.subtract(e,i),this._dir.scaleToRef(ea._rayl,o),r.add(o,n),e.subtract(r,l);var c=u.dot(i,i),f=u.dot(i,o),d=u.dot(o,o),h=u.dot(i,l),b=u.dot(o,l),p=c*d-f*f,g,A,D=p,_,U,v=p;p<ea._smallnum?(A=0,D=1,U=b,v=d):(A=f*b-d*h,U=c*b-f*h,A<0?(A=0,U=b,v=d):A>D&&(A=D,U=b+f,v=d)),U<0?(U=0,-h<0?A=0:-h>c?A=D:(A=-h,D=c)):U>v&&(U=v,-h+f<0?A=0:-h+f>c?A=D:(A=-h+f,D=c)),g=Math.abs(A)<ea._smallnum?0:A/D,_=Math.abs(U)<ea._smallnum?0:U/v;const x=u.HELP_4;o.scaleToRef(_,x);const C=u.HELP_5;i.scaleToRef(g,C),C.add(l,C);const F=u.HELP_6;C.subtract(x,F);var w=_>0&&_<=this._dir.length&&F.lengthSquared<a*a;if(w){let S=new u;return S.copyFrom(t.subtract(e)),S.scaleBy(g),S.add(e,S),{out:S,length:C.length}}return{out:null,length:-1}}get_vec(e,t){let a=u.HELP_1;return a.x=e.x-t.x,a.y=e.y-t.y,a.z=e.z-t.z,a}}class is{x;y;w;h;constructor(e=0,t=0,a=0,r=0){this.x=e,this.y=t,this.w=a,this.h=r}get width(){return this.w}set width(e){this.w=e}get height(){return this.h}set height(e){this.h=e}static pointInRect(e,t,a,r,i,n){return!(e<a||e>i||t<r||t>n)}clone(){return new is(this.x,this.y,this.w,this.h)}copyFrom(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}copyTo(e){e.copyFrom(this)}inner(e,t){return!(e<this.x||e>this.x+this.width||t<this.y||t>this.y+this.height)}equal(e){return!(this.x!=e.x||this.y!=e.y||this.width!=e.width||this.height!=e.height)}equalArea(e,t,a,r){return!(this.x!=e||this.y!=t||this.width!=a||this.height!=r)}equalInnerArea(e){var t=this.x,a=this.y,r=this.x+this.width,i=this.y+this.height,n=e.x,o=e.y,l=e.x+e.width,c=e.y+e.height;return Math.max(t,n)<=Math.min(r,l)&&Math.max(a,o)<=Math.min(i,c)}innerArea(e,t){t=t||new is;var a=this.x,r=this.y,i=this.x+this.width,n=this.y+this.height,o=e.x,l=e.y,c=e.x+e.width,f=e.y+e.height,d=Math.max(r,l),h=Math.min(n,f),b=Math.max(a,o),p=Math.min(c,i);return d>=0&&h>=0&&h-d>=0&&p-b>0?(t.x=b,t.y=d,t.width=p-b,t.height=h-d):(t.x=0,t.y=0,t.width=0,t.height=0),t}setTo(e,t,a,r){this.x=e,this.y=t,this.width=a,this.height=r}}class pe{center;extents;max;min;size;static maxVector3=new u(1,1,1).multiplyScalar(Number.MAX_VALUE*.1);static minVector3=new u(1,1,1).multiplyScalar(-Number.MAX_VALUE*.1);constructor(e,t){e||=u.ZERO.clone(),t||=u.ZERO.clone(),this.setFromCenterAndSize(e,t)}makeEmpty(){return this.setFromMinMax(pe.maxVector3,pe.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 u,this.max||=new u,this.size||=new u,this.center||=new u,this.extents||=new u,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 pe(new u,new u),a=0;a<e.length;a++)t.expandByPoint(e[a]);return t}calculateTransform(e){}clone(){var e=new pe(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 Un{planes;corners;boundingBox=new pe;constructor(){this.planes=[],this.corners=[];for(var e=0;e<6;e++)this.planes[e]=new u;for(var e=0;e<8;e++)this.corners[e]=new u}updateBoundBox(e){this.boundingBox.makeEmpty();let t=this.boundingBox.min,a=this.boundingBox.max,r=0;for(let i=0;i<2;++i)for(let n=0;n<2;++n)for(let o=0;o<2;++o){let l=this.corners[r];r++,l.set(2*i-1,2*n-1,o,1),e.transformVector4(l,l),l.div(l.w,l),t.x=Math.min(l.x,t.x),t.y=Math.min(l.y,t.y),t.z=Math.min(l.z,t.z),a.x=Math.max(l.x,a.x),a.y=Math.max(l.y,a.y),a.z=Math.max(l.z,a.z)}return this.boundingBox.setFromMinMax(t,a),this}setFrustumCorners(e){let t=0;for(let a=0;a<2;++a)for(let r=0;r<2;++r)for(let i=0;i<2;++i){let n=this.corners[t];n.set(2*a-1,2*r-1,i,1),e.transformVector4(n,n),n.div(n.w,n),t++}}update(e){var t=e.rawData;this.planes[0].x=t[3]-t[0],this.planes[0].y=t[7]-t[4],this.planes[0].z=t[11]-t[8],this.planes[0].w=t[15]-t[12];var a=Math.sqrt(this.planes[0].x*this.planes[0].x+this.planes[0].y*this.planes[0].y+this.planes[0].z*this.planes[0].z);this.planes[0].x/=a,this.planes[0].y/=a,this.planes[0].z/=a,this.planes[0].w/=a,this.planes[1].x=t[3]+t[0],this.planes[1].y=t[7]+t[4],this.planes[1].z=t[11]+t[8],this.planes[1].w=t[15]+t[12],a=Math.sqrt(this.planes[1].x*this.planes[1].x+this.planes[1].y*this.planes[1].y+this.planes[1].z*this.planes[1].z),this.planes[1].x/=a,this.planes[1].y/=a,this.planes[1].z/=a,this.planes[1].w/=a,this.planes[2].x=t[3]+t[1],this.planes[2].y=t[7]+t[5],this.planes[2].z=t[11]+t[9],this.planes[2].w=t[15]+t[13],a=Math.sqrt(this.planes[2].x*this.planes[2].x+this.planes[2].y*this.planes[2].y+this.planes[2].z*this.planes[2].z),this.planes[2].x/=a,this.planes[2].y/=a,this.planes[2].z/=a,this.planes[2].w/=a,this.planes[3].x=t[3]-t[1],this.planes[3].y=t[7]-t[5],this.planes[3].z=t[11]-t[9],this.planes[3].w=t[15]-t[13],a=Math.sqrt(this.planes[3].x*this.planes[3].x+this.planes[3].y*this.planes[3].y+this.planes[3].z*this.planes[3].z),this.planes[3].x/=a,this.planes[3].y/=a,this.planes[3].z/=a,this.planes[3].w/=a,this.planes[4].x=t[3]-t[2],this.planes[4].y=t[7]-t[6],this.planes[4].z=t[11]-t[10],this.planes[4].w=t[15]-t[14],a=Math.sqrt(this.planes[4].x*this.planes[4].x+this.planes[4].y*this.planes[4].y+this.planes[4].z*this.planes[4].z),this.planes[4].x/=a,this.planes[4].y/=a,this.planes[4].z/=a,this.planes[4].w/=a,this.planes[5].x=t[3]+t[2],this.planes[5].y=t[7]+t[6],this.planes[5].z=t[11]+t[10],this.planes[5].w=t[15]+t[14],a=Math.sqrt(this.planes[5].x*this.planes[5].x+this.planes[5].y*this.planes[5].y+this.planes[5].z*this.planes[5].z),this.planes[5].x/=a,this.planes[5].y/=a,this.planes[5].z/=a,this.planes[5].w/=a}containsPoint(e){for(var t=0;t<6;t++)if(this.planes[t].x*e.x+this.planes[t].y*e.y+this.planes[t].z*e.z+this.planes[t].w<=0)return!1;return!0}containsSphere(e){let t=e.bound,a=0,r,i=e.transform.worldPosition,n=t.radius,o=t.center.x+i.x,l=t.center.y+i.y,c=t.center.z+i.z;for(let f of this.planes){if(r=f.x*o+f.y*l+f.z*c+f.w,r<=-n)return 0;r>n&&a++}return a===6?2:1}containsBox(e){let t=0,a,i=Math.max(e.size.x,e.size.y,e.size.z)*2,n=e.center.x,o=e.center.y,l=e.center.z;for(let c of this.planes){if(a=c.x*n+c.y*o+c.z*l+c.w,a<=-i)return 0;a>i&&t++}return t===6?2:1}containsBox2(e){let t=0,a,r=1.74*Math.max(e.extents.x,e.extents.y,e.extents.z);for(let i of this.planes){if(a=i.x*e.center.x+i.y*e.center.y+i.z*e.center.z+i.w,a<=-r)return 0;a>r&&t++}return t===6?2:1}containsBoxPrecise(e){const t=[new u(e.min.x,e.min.y,e.min.z),new u(e.max.x,e.min.y,e.min.z),new u(e.min.x,e.max.y,e.min.z),new u(e.max.x,e.max.y,e.min.z),new u(e.min.x,e.min.y,e.max.z),new u(e.max.x,e.min.y,e.max.z),new u(e.min.x,e.max.y,e.max.z),new u(e.max.x,e.max.y,e.max.z)];let a=0;for(let r=0;r<6;r++){const i=this.planes[r];let n=-1/0,o=1/0;for(let l=0;l<8;l++){const c=t[l],f=i.x*c.x+i.y*c.y+i.z*c.z+i.w;n=Math.max(n,f),o=Math.min(o,f)}if(n<0)return 0;o>0&&a++}return a===6?2:1}}var We=(s=>(s[s.ortho=0]="ortho",s[s.perspective=1]="perspective",s[s.shadow=2]="shadow",s))(We||{});class l2{corners;index;constructor(e){this.index=e,this.corners=[];for(let t=0;t<4;t++)this.corners.push(new u)}}class c2{bound;twoSections;name;color;shadowCamera;index;constructor(e,t,a){this.bound=new pe,this.shadowCamera=Ke.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 P(1,0,0,1):a==1?this.color=new P(0,1,0,1):a==2?this.color=new P(0,0,1,1):a==3&&(this.color=new P(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 Sc{sections;children;name;constructor(e){this.sections=[];let t=e+1;for(let a=0;a<t;a++)this.sections.push(new l2(a));this.children=[];for(let a=0;a<e;a++)this.children.push(new c2(this.sections[a],this.sections[a+1],a))}update(e,t,a,r,i){let n=this.sections.length-1;for(let o=0;o<=n;++o){let l=this.sections[o],c=0,f=this.logSplit(a,r,o,this.sections.length);{let h=(f-a)/r;h=h**i.csmScatteringExp,f=(r-a)*h+a}f*=i.csmAreaScale;let d=(e.rawData[10]*f+e.rawData[14])/f;for(let h=0;h<2;++h)for(let b=0;b<2;++b){let p=l.corners[c];c++,p.set(2*h-1,2*b-1,d,1),t.transformVector4(p,p),p.div(p.w,p)}}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 Kr extends Pe{fov=60;name;aspect=1;near=1;far=5e3;left=-100;right=100;top=100;bottom=-100;frustumSize=100;viewPort=new is;frustum;sh=new Float32Array(36);isShadowCamera=!1;_projectionMatrixInv=new E;_projectionMatrix=new E;_viewMatrix=new E;_viewMatrixInv=new E;_unprojection=new E;_pvMatrixInv=new E;_pvMatrix=new E;_halfw;_halfh;_ray;_enableCSM=!1;mainCamera;get projectionMatrix(){return this._projectionMatrix}lookTarget;type=We.perspective;csm;cubeShadowCameras=[];get enableCSM(){return this._enableCSM}set enableCSM(e){e&&!this.csm&&(this.csm=new Sc(Zt.Cascades)),this._enableCSM=e}constructor(){super()}init(){super.init(),this._ray=new ea,this.frustum=new Un,this.lookTarget=new u(0,0,0),this.viewPort.x=0,this.viewPort.y=0,this.viewPort.w=k.presentationSize[0],this.viewPort.h=k.presentationSize[1],this.updateProjection(),k.addEventListener(Ha.RESIZE,this.updateProjection,this)}updateProjection(){this.aspect=k.aspect,this.type==We.perspective?this.perspective(this.fov,this.aspect,this.near,this.far):this.type==We.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-m.setting.shadow.shadowBias*.01}getShadowWorldExtents(){let e=m.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=We.perspective}ortho(e,t,a){this.frustumSize=e;let r=e*.5*this.aspect,i=e*.5,n=-r/2,o=r/2,l=i/2,c=-i/2;this.orthoOffCenter(n,o,c,l,t,a)}orthoOffCenter(e,t,a,r,i,n){this.near=i,this.far=n,this.left=e,this.right=t,this.top=r,this.bottom=a,this.type=We.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 u(0,0,0,1)),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5,St.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 u),this._halfw=this.viewPort.width*.5,this._halfh=this.viewPort.height*.5;let a=e.x,r=e.y;return t.x=a/this.viewPort.width-.25,t.y=r/this.viewPort.height-.25,this.unProject(t.x,t.y,e.z,t),t}get pvMatrix(){return vn(this._projectionMatrix,this.viewMatrix,this._pvMatrix),this._pvMatrix}get pvMatrix2(){vn(this._projectionMatrix,this.transform.worldMatrix,this._pvMatrix);let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get pvMatrixInv(){let e=this._pvMatrixInv.copyFrom(this.pvMatrix);return e.invert(),e}get vMatrixInv(){let e=this._viewMatrixInv.copyFrom(this.viewMatrix);return e.invert(),e}get cameraToWorld(){let e=E.helpMatrix;return e.identity(),e.copyFrom(this.projectionMatrixInv),e.multiply(this.vMatrixInv),e}get ndcToView(){let e=E.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 u),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(),St.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=Ke.UnProjection(e,t,.01,this),i=Ke.UnProjection(e,t,1,this);return i=i.subtract(r).normalize(),a.origin.copyFrom(r),a.direction=i,a}screenPointToWorld(e,t,a){return Ke.UnProjection(e,t,a,this)}worldToScreenPoint(e,t){return Ke.Projection(e,this,t)}lookAt(e,t,a=u.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=m.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 As,this._jitterOffsetList=[];for(let t=0;t<32;t++){let a=this.generateRandomOffset();this._jitterOffsetList.push(a)}this._jitterOffsetList.reverse()}generateRandomOffset(){let e=new K(As.get((this._sampleIndex&1023)+1,2)-.5,As.get((this._sampleIndex&1023)+1,3)-.5);return++this._sampleIndex>=32&&(this._sampleIndex=0),e}getJitteredProjectionMatrix(){let e=m.setting.render.postProcessing.taa,t=this._projectionMatrix,a=e.temporalJitterScale,r=this._jitterFrameIndex%e.jitterSeedCount,i=this._jitterOffsetList[r].x*a,n=this._jitterOffsetList[r].y*a,o=t.get(0,2),l=t.get(1,2);this._jitterX=i/this.viewPort.width,this._jitterY=n/this.viewPort.height,o+=this._jitterX,l+=this._jitterY,t.set(0,2,o),t.set(1,2,l),this._jitterFrameIndex++}getWorldDirection(e){e||=new u;const t=this.transform._worldMatrix.rawData;return e.set(-t[8],-t[9],-t[10]).normalize()}}class Qt extends Pe{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 $e(Qt.POSITION_ONCHANGE);eventRotationChange=new $e(Qt.ROTATION_ONCHANGE);eventScaleChange=new $e(Qt.SCALE_ONCHANGE);eventLocalChange=new $e(Qt.LOCAL_ONCHANGE);onPositionChange;onRotationChange;onScaleChange;_scene3d;_parent;_localPos;_localRot;_localRotQuat;_localScale;_localDetailPos;_localDetailRot;_localDetailScale;index;index2;_forward=new u;_back=new u;_right=new u;_left=new u;_up=new u;_down=new u;_worldMatrix;_targetPos;static=!1;depthOrder=0;get localChange(){return me.matrixStateBuffer[this.index2]!=0}set localChange(e){me.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,me.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=>{xe.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 E(!0),this.index=this._worldMatrix.index,this.index2=this._worldMatrix.index*me.stateStruct,this._localPos=new u,this._localRot=new u,this._localRotQuat=new j,this._localScale=new u(1,1,1),me.setScale(this.index,this._localScale.x,this._localScale.y,this._localScale.z),me.setRotation(this.index,this._localRot.x,this._localRot.y,this._localRot.z),me.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(u.UP,this._up),this._up}set up(e){this._up.copyFrom(e),St.fromToRotation(u.UP,this._up,j.HELP_0),this.transform.localRotQuat=j.HELP_0}get down(){return this.worldMatrix.transformVector(u.DOWN,this._down),this._down}set down(e){this._down.copyFrom(e),St.fromToRotation(u.DOWN,this._down,j.HELP_0),this.transform.localRotQuat=j.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get forward(){return this.worldMatrix.transformVector(u.FORWARD,this._forward),this._forward}set forward(e){this._forward.copyFrom(e),St.fromToRotation(u.FORWARD,this._forward,j.HELP_0),this.transform.localRotQuat=j.HELP_0,this.notifyLocalChange(),this.onRotationChange?.(),this.eventRotationChange&&this.eventDispatcher.dispatchEvent(this.eventRotationChange)}get back(){return this.worldMatrix.transformVector(u.BACK,this._back),this._back}set back(e){this._back.copyFrom(e),St.fromToRotation(u.BACK,this._back,j.HELP_0),this.transform.localRotQuat=j.HELP_0}get left(){return this.worldMatrix.transformVector(u.neg_X_AXIS,this._left),this._left}set left(e){this._left.copyFrom(e),St.fromToRotation(u.LEFT,this._left,j.HELP_0),this.transform.localRotQuat=j.HELP_0}get right(){return this.worldMatrix.transformVector(u.X_AXIS,this._right),this._right}set right(e){this._right.copyFrom(e),St.fromToRotation(u.RIGHT,this._right,j.HELP_0),this.transform.localRotQuat=j.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),me.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?(ps(this._localRot,this._localPos,this._localScale,this._worldMatrix),Cc(this._worldMatrix,this.parent.worldMatrix,this._worldMatrix)):ps(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=u.UP){this.lookAt(this.transform.worldPosition,e,t)}lookAt(e,t,a=u.UP){this._targetPos||=new u,this._targetPos.copyFrom(t),this.localPosition=e,E.helpMatrix.lookAt(e,t,a),E.helpMatrix.invert();var r=E.helpMatrix.decompose(jt.QUATERNION);this.localRotQuat=j.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,me.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,me.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,me.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,me.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,me.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,me.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,me.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,me.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,me.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),me.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),me.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){me.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,me.setContinueScale(this.index,e.x,e.y,e.z)}get localDetailRot(){return this._localDetailRot}set localDetailRot(e){this._localDetailRot=e,me.setContinueRotation(this.index,e.x,e.y,e.z)}get localDetailPos(){return this._localDetailPos}set localDetailPos(e){this._localDetailPos=e,me.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 Yt{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 V=(s=>(s.position="position",s.normal="normal",s.uv="uv",s.TANGENT="TANGENT",s.TEXCOORD_1="TEXCOORD_1",s.TEXCOORD_2="TEXCOORD_2",s.TEXCOORD_3="TEXCOORD_3",s.TEXCOORD_4="TEXCOORD_4",s.TEXCOORD_5="TEXCOORD_5",s.TEXCOORD_6="TEXCOORD_6",s.TEXCOORD_7="TEXCOORD_7",s.color="color",s.joints0="joints0",s.joints1="joints1",s.weights0="weights0",s.weights1="weights1",s.weight="weight",s.indices="indices",s.vIndex="vIndex",s.a_morphPositions_0="a_morphPositions_0",s.all="all",s))(V||{}),ae=(s=>(s[s.NONE=0]="NONE",s[s.ABOVE=1]="ABOVE",s[s.ALPHA=2]="ALPHA",s[s.NORMAL=3]="NORMAL",s[s.ADD=4]="ADD",s[s.BELOW=5]="BELOW",s[s.ERASE=6]="ERASE",s[s.MUL=7]="MUL",s[s.SCREEN=8]="SCREEN",s[s.DIVD=9]="DIVD",s[s.SOFT_ADD=10]="SOFT_ADD",s))(ae||{}),Fc=(s=>(s[s.src_a=0]="src_a",s[s.dest_a=1]="dest_a",s))(Fc||{});class kc{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 ua{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));
|
|
@@ -5692,7 +5692,7 @@ struct InstanceData {
|
|
|
5692
5692
|
var outColor: vec4<f32> = textureSampleLevel(img, imgSampler, texCoord, 0.0);
|
|
5693
5693
|
return outColor;
|
|
5694
5694
|
}
|
|
5695
|
-
`;static pipelineCache={};static pipeline;static getMipmapPipeline(e){let t=k.device,a=ua.pipelineCache[e.format];if(!a){const r=t.createShaderModule({code:ua.mipmapShader});let i=t.createBindGroupLayout({entries:[{binding:0,visibility:e.visibility,sampler:e.samplerBindingLayout},{binding:1,visibility:e.visibility,texture:e.textureBindingLayout}]}),n=k.device.createPipelineLayout({bindGroupLayouts:[i]});a=t.createRenderPipeline({layout:n,vertex:{module:r,entryPoint:"vertexMain"},fragment:{module:r,entryPoint:"fragmentMain",targets:[{format:e.format}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint32"}}),ua.pipelineCache[e.format]=a}return a}static webGPUGenerateMipmap(e){let t=k.device,a=e.textureDescriptor,r=ua.getMipmapPipeline(e),i=e.getGPUTexture().createView({baseMipLevel:0,mipLevelCount:1});const n=y.beginCommandEncoder();for(let o=1;o<a.mipLevelCount;++o){const l=e.getGPUTexture().createView({baseMipLevel:o,mipLevelCount:1}),c=n.beginRenderPass({colorAttachments:[{view:l,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]});let f=t.createBindGroupLayout({entries:[{binding:0,visibility:e.visibility,sampler:e.samplerBindingLayout},{binding:1,visibility:e.visibility,texture:e.textureBindingLayout}]});const d=t.createBindGroup({layout:f,entries:[{binding:0,resource:e.gpuSampler},{binding:1,resource:i}]});c.setPipeline(r),c.setBindGroup(0,d),c.draw(4),c.end(),i=l}y.endCommandEncoder(n)}static getMipmapCount(e,t){let i=Math.max(e,t);return 1+Math.log2(i)|0}}class He{name;url;gpuTexture;pid;view;gpuSampler;gpuSampler_comparison;format;usage;width=4;height=4;depthOrArrayLayers=1;numberLayer=1;viewDescriptor;textureDescriptor;visibility=GPUShaderStage.COMPUTE|GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT;textureBindingLayout={viewDimension:"2d",multisampled:!1};samplerBindingLayout={type:"filtering"};sampler_comparisonBindingLayout={type:"comparison"};flipY;isVideoTexture;isHDRTexture;_useMipmap=!1;_sourceImageData;_addressModeU;_addressModeV;_addressModeW;_magFilter;_minFilter;_mipmapFilter;_lodMinClamp;_lodMaxClamp;_compare;_maxAnisotropy;mipmapCount=1;_textureChange=!1;constructor(e=32,t=32,a=1){this.width=e,this.height=t,this.numberLayer=a,this.minFilter=er.linear,this.magFilter=er.linear,this.mipmapFilter=er.linear,this.addressModeU=Ot.repeat,this.addressModeV=Ot.repeat}init(){let e=this;return e.internalCreateBindingLayoutDesc&&e.internalCreateBindingLayoutDesc(),e.internalCreateTexture&&e.internalCreateTexture(),e.internalCreateView&&e.internalCreateView(),e.internalCreateSampler&&e.internalCreateSampler(),this}createTextureDescriptor(e,t,a,r,i=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.STORAGE_BINDING,n=1,o=0){this.width=e,this.height=t,this.format=r,this.usage=i,this.textureDescriptor={size:[e,t,n],mipLevelCount:a,format:r,usage:i,label:`${this.name+this.width+this.height+this.format}`},o>0&&(this.textureDescriptor.sampleCount=o),n>1?this.viewDescriptor={format:r,dimension:"2d-array"}:this.viewDescriptor={format:r,dimension:this.textureBindingLayout.viewDimension,mipLevelCount:a,baseMipLevel:0}}generate(e){let t=32,a=32;"width"in e&&(t=e.width,a=e.height),(t<32||a<32)&&console.log(e.name+"Size must be greater than 32!"),this.width=t,this.height=a,this.createTexture(e)}createTexture(e){this._sourceImageData=e,this.updateTextureDescription(),this.updateGPUTexture();let t=k.device;this.gpuTexture instanceof GPUTexture&&t.queue.copyExternalImageToTexture({source:this._sourceImageData},{texture:this.gpuTexture},[this.width,this.height]),this.useMipmap&&ua.webGPUGenerateMipmap(this)}get useMipmap(){return this._useMipmap}set useMipmap(e){if(e){if(this.samplerBindingLayout.type="filtering",this._useMipmap==!1&&this._sourceImageData){this._useMipmap=!0,this.updateTextureDescription(),this.updateGPUTexture();let t=k.device;this.gpuTexture instanceof GPUTexture&&t.queue.copyExternalImageToTexture({source:this._sourceImageData},{texture:this.gpuTexture},[this.width,this.height]),ua.webGPUGenerateMipmap(this)}}else if(this.samplerBindingLayout.type="non-filtering",this._useMipmap==!0&&this._sourceImageData){this._useMipmap=!1,this.updateTextureDescription(),this.updateGPUTexture();let t=k.device;this.gpuTexture instanceof GPUTexture&&t.queue.copyExternalImageToTexture({source:this._sourceImageData},{texture:this.gpuTexture},[this.width,this.height])}this._textureChange=!0,this._useMipmap=e,this.noticeChange()}get sourceImageData(){return this._sourceImageData}getMipmapCount(){let e=this.width,t=this.height,a=Math.max(e,t);return 1+Math.log2(a)|0}updateTextureDescription(){this.mipmapCount=Math.floor(this.useMipmap?this.getMipmapCount():1),this.createTextureDescriptor(this.width,this.height,this.mipmapCount,this.format)}updateGPUTexture(){this.gpuTexture&&this.gpuTexture instanceof GPUTexture&&this.gpuTexture.destroy(),this.gpuTexture=null,this.view=null,this.gpuTexture=this.getGPUTexture()}getGPUTexture(){return this.gpuTexture||(this.gpuTexture=k.device.createTexture(this.textureDescriptor)),this.gpuTexture}getGPUView(e=0){return this.view||(this.gpuTexture=this.getGPUTexture(),this.gpuTexture instanceof GPUTexture&&(this.view=this.gpuTexture.createView(this.viewDescriptor),this.view.label=this.name)),this.view}_stateChangeRef=new Map;bindStateChange(e,t){this._stateChangeRef.set(t,e)}unBindStateChange(e){this._stateChangeRef.delete(e)}noticeChange(){this.gpuSampler=k.device.createSampler(this),this._stateChangeRef.forEach((e,t)=>{e()})}destroy(e){e&&this.gpuTexture instanceof GPUTexture&&(this.gpuSampler=null,this.gpuSampler_comparison=null,this.textureBindingLayout=null,this.textureDescriptor=null,this.gpuTexture.destroy(),this.gpuTexture=null),this._stateChangeRef.clear()}get addressModeU(){return this._addressModeU}set addressModeU(e){this._addressModeU!=e&&(this._addressModeU=e,this.noticeChange())}get addressModeV(){return this._addressModeV}set addressModeV(e){this._addressModeV!=e&&(this._addressModeV=e,this.noticeChange())}get addressModeW(){return this._addressModeW}set addressModeW(e){this._addressModeW!=e&&(this._addressModeW=e,this.noticeChange())}get magFilter(){return this._magFilter}set magFilter(e){this._magFilter!=e&&(this._magFilter=e,this.noticeChange())}get minFilter(){return this._minFilter}set minFilter(e){this._minFilter!=e&&(this._minFilter=e,this.noticeChange())}get mipmapFilter(){return this._mipmapFilter}set mipmapFilter(e){this._mipmapFilter!=e&&(this._mipmapFilter=e,this.noticeChange())}get lodMinClamp(){return this._lodMinClamp}set lodMinClamp(e){this._lodMinClamp!=e&&(this._lodMinClamp=e,this.noticeChange())}get lodMaxClamp(){return this._lodMaxClamp}set lodMaxClamp(e){this._lodMaxClamp!=e&&(this._lodMaxClamp=e,this.noticeChange())}get compare(){return this._compare}set compare(e){this._compare!=e&&(this._compare=e,this.noticeChange())}get maxAnisotropy(){return this._maxAnisotropy}set maxAnisotropy(e){this._maxAnisotropy!=e&&(this._maxAnisotropy=e,this.noticeChange())}static _texs=[];static delayDestroyTexture(e){this._texs.includes(e)||this._texs.push(e)}static destroyTexture(){if(this._texs.length>0)for(;this._texs.length>0;)this._texs.shift().destroy()}}class Ec extends He{_bitmapTextures;constructor(e,t,a){super(e,t,a),this.format=Y.rgba8unorm,this.mipmapCount=1,this._bitmapTextures=[],this.init()}setTextures(e){this._bitmapTextures.length=0;for(let t=0;t<e.length;t++){const a=e[t];this.addTexture(a)}}addTexture(e){(e.width!=this.width||e.height!=this.height)&&console.error("bitmap texture must match bitmapTextureArray size!"),e.pid=this._bitmapTextures.length,this._bitmapTextures.push(e),this.updateTexture()}removeTexture(e){let t=this._bitmapTextures.indexOf(e);if(t!=-1){this._bitmapTextures.splice(t,1);for(let a=0;a<this._bitmapTextures.length;a++){const r=this._bitmapTextures[a];r.pid=a}}}updateTexture(){let e=y.beginCommandEncoder();for(let t=0;t<this._bitmapTextures.length;t++){let a=this._bitmapTextures[t];e.copyTextureToTexture({texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:this.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:t}},{width:this.width,height:this.height,depthOrArrayLayers:1})}y.endCommandEncoder(e)}internalCreateBindingLayoutDesc(){this.textureBindingLayout.viewDimension="2d-array",this.samplerBindingLayout.type="filtering",this.minFilter=er.linear,this.magFilter=er.linear}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=k.device.createSampler(this)}}class ba{static use=!1;static iesTexture;static ies_list=[];_iesTexture;index=0;constructor(){}generateIES(e){}set IESTexture(e){this._iesTexture=e,e.addressModeU=Ot.repeat,e.addressModeV=Ot.repeat,e.addressModeW=Ot.repeat,ba.ies_list.indexOf(this)==-1&&(this.index=ba.ies_list.length,ba.ies_list.push(this),ba.iesTexture||ba.create(e.width,e.height),ba.iesTexture.addTexture(e))}get IESTexture(){return this._iesTexture}static create(e,t){let a=48;this.iesTexture=new Ec(e,t,a)}}class xn{static _globalDataBindGroupLayout;static getGlobalDataBindGroupLayout(){if(this._globalDataBindGroupLayout)return this._globalDataBindGroupLayout;let e=[];return e.push({binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,buffer:{type:"uniform"}}),e.push({binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}),this._globalDataBindGroupLayout=k.device.createBindGroupLayout({entries:e}),this._globalDataBindGroupLayout}}class pi{Type=0;Line=0;Colume=0;Literal="";constructor(e=0,t="\0"){this.Type=e,this.Literal=t}isTypeEqual(e){return this.Type==e}isLiteralEqual(e){return this.Literal==e}isBuiltinType(){return this.Type>33&&this.Type<101}isDataType(){return this.Type==1||this.isBuiltinType()}isOperation(){return this.Type>102&&this.Type<127}isAssignOperation(){return this.Type>128&&this.Type<133}get nOperationPriorityLevel(){switch(this.Type){case 26:return 1;case 27:return 1;case 125:return 2;case 110:return 3;case 114:return 3;case 105:return 4;case 106:return 4;case 103:return 5;case 104:return 5;case 115:return 6;case 116:return 6;case 119:return 7;case 120:return 7;case 122:return 7;case 123:return 7;case 121:return 8;case 124:return 8;case 111:return 9;case 113:return 10;case 112:return 11;case 107:return 12;case 109:return 13;case 108:return 14;case 24:return 15;case 126:return 16;case 129:return 16;case 130:return 16;case 131:return 16;case 132:return 16}return 99}}var B=(s=>(s[s.EOF=0]="EOF",s[s.IDENT=1]="IDENT",s[s.VOID=2]="VOID",s[s.CONST=3]="CONST",s[s.LAYOUT=4]="LAYOUT",s[s.PRECISION=5]="PRECISION",s[s.ATTRIBUTE=6]="ATTRIBUTE",s[s.UNIFORM=7]="UNIFORM",s[s.VARYING=8]="VARYING",s[s.INVARIANT=9]="INVARIANT",s[s.IN=10]="IN",s[s.OUT=11]="OUT",s[s.INOUT=12]="INOUT",s[s.IF=13]="IF",s[s.ELSE=14]="ELSE",s[s.FOR=15]="FOR",s[s.WHILE=16]="WHILE",s[s.DO=17]="DO",s[s.BREAK=18]="BREAK",s[s.RETURN=19]="RETURN",s[s.CONTINUE=20]="CONTINUE",s[s.STRUCT=21]="STRUCT",s[s.COMMA=22]="COMMA",s[s.COLON=23]="COLON",s[s.QUEMARK=24]="QUEMARK",s[s.SEMICOLON=25]="SEMICOLON",s[s.LEFTSAMLL=26]="LEFTSAMLL",s[s.RIGHTSAMLL=27]="RIGHTSAMLL",s[s.LEFTMEDI=28]="LEFTMEDI",s[s.RIGHTMEDI=29]="RIGHTMEDI",s[s.LEFTBIG=30]="LEFTBIG",s[s.RIGHTBIG=31]="RIGHTBIG",s[s.LITERAL=32]="LITERAL",s[s.BeginBuiltinType=33]="BeginBuiltinType",s[s.INT=34]="INT",s[s.INT_ARRAY=35]="INT_ARRAY",s[s.UINT=36]="UINT",s[s.UINT_ARRAY=37]="UINT_ARRAY",s[s.BOOL=38]="BOOL",s[s.BOOL_ARRAY=39]="BOOL_ARRAY",s[s.FLOAT=40]="FLOAT",s[s.FLOAT_ARRAY=41]="FLOAT_ARRAY",s[s.DOUBLE=42]="DOUBLE",s[s.DOUBLE_ARRAY=43]="DOUBLE_ARRAY",s[s.VEC2=44]="VEC2",s[s.VEC2_ARRAY=45]="VEC2_ARRAY",s[s.VEC3=46]="VEC3",s[s.VEC3_ARRAY=47]="VEC3_ARRAY",s[s.VEC4=48]="VEC4",s[s.VEC4_ARRAY=49]="VEC4_ARRAY",s[s.BVEC2=50]="BVEC2",s[s.BVEC2_ARRAY=51]="BVEC2_ARRAY",s[s.BVEC3=52]="BVEC3",s[s.BVEC3_ARRAY=53]="BVEC3_ARRAY",s[s.BVEC4=54]="BVEC4",s[s.BVEC4_ARRAY=55]="BVEC4_ARRAY",s[s.IVEC2=56]="IVEC2",s[s.IVEC2_ARRAY=57]="IVEC2_ARRAY",s[s.IVEC3=58]="IVEC3",s[s.IVEC3_ARRAY=59]="IVEC3_ARRAY",s[s.IVEC4=60]="IVEC4",s[s.IVEC4_ARRAY=61]="IVEC4_ARRAY",s[s.UVEC2=62]="UVEC2",s[s.UVEC2_ARRAY=63]="UVEC2_ARRAY",s[s.UVEC3=64]="UVEC3",s[s.UVEC3_ARRAY=65]="UVEC3_ARRAY",s[s.UVEC4=66]="UVEC4",s[s.UVEC4_ARRAY=67]="UVEC4_ARRAY",s[s.MAT2x2=68]="MAT2x2",s[s.MAT2x2_ARRAY=69]="MAT2x2_ARRAY",s[s.MAT2x3=70]="MAT2x3",s[s.MAT2x3_ARRAY=71]="MAT2x3_ARRAY",s[s.MAT2x4=72]="MAT2x4",s[s.MAT2x4_ARRAY=73]="MAT2x4_ARRAY",s[s.MAT3x2=74]="MAT3x2",s[s.MAT3x2_ARRAY=75]="MAT3x2_ARRAY",s[s.MAT3x3=76]="MAT3x3",s[s.MAT3x3_ARRAY=77]="MAT3x3_ARRAY",s[s.MAT3x4=78]="MAT3x4",s[s.MAT3x4_ARRAY=79]="MAT3x4_ARRAY",s[s.MAT4x2=80]="MAT4x2",s[s.MAT4x2_ARRAY=81]="MAT4x2_ARRAY",s[s.MAT4x3=82]="MAT4x3",s[s.MAT4x3_ARRAY=83]="MAT4x3_ARRAY",s[s.MAT4x4=84]="MAT4x4",s[s.MAT4x4_ARRAY=85]="MAT4x4_ARRAY",s[s.SAMPLER=86]="SAMPLER",s[s.SAMPLER_1D=87]="SAMPLER_1D",s[s.SAMPLER_2D=88]="SAMPLER_2D",s[s.SAMPLER_3D=89]="SAMPLER_3D",s[s.SAMPLER_CUBE=90]="SAMPLER_CUBE",s[s.SAMPLER_SHADOW=91]="SAMPLER_SHADOW",s[s.SAMPLER_1D_SHADOW=92]="SAMPLER_1D_SHADOW",s[s.SAMPLER_2D_SHADOW=93]="SAMPLER_2D_SHADOW",s[s.TEXTURE_1D=94]="TEXTURE_1D",s[s.TEXTURE_1D_ARRAY=95]="TEXTURE_1D_ARRAY",s[s.TEXTURE_2D=96]="TEXTURE_2D",s[s.TEXTURE_2D_ARRAY=97]="TEXTURE_2D_ARRAY",s[s.TEXTURE_3D=98]="TEXTURE_3D",s[s.TEXTURE_CUBE=99]="TEXTURE_CUBE",s[s.TEXTURE_CUBE_ARRAY=100]="TEXTURE_CUBE_ARRAY",s[s.EndBuiltinType=101]="EndBuiltinType",s[s.BeginOperation=102]="BeginOperation",s[s.ADD=103]="ADD",s[s.SUB=104]="SUB",s[s.MUL=105]="MUL",s[s.DIV=106]="DIV",s[s.AND=107]="AND",s[s.OR=108]="OR",s[s.XOR=109]="XOR",s[s.NOT=110]="NOT",s[s.BITAND=111]="BITAND",s[s.BITOR=112]="BITOR",s[s.BITXOR=113]="BITXOR",s[s.BITNOT=114]="BITNOT",s[s.BITSHIFT_L=115]="BITSHIFT_L",s[s.BITSHIFT_R=116]="BITSHIFT_R",s[s.INC=117]="INC",s[s.DEC=118]="DEC",s[s.GREATER=119]="GREATER",s[s.GREATEREQUAL=120]="GREATEREQUAL",s[s.EQUAL=121]="EQUAL",s[s.LESS=122]="LESS",s[s.LESSEQUAL=123]="LESSEQUAL",s[s.NOTEQUAL=124]="NOTEQUAL",s[s.DOT=125]="DOT",s[s.ASSIGN=126]="ASSIGN",s[s.EndOperation=127]="EndOperation",s[s.BeginAssignOperation=128]="BeginAssignOperation",s[s.ADDASSIGN=129]="ADDASSIGN",s[s.SUBASSIGN=130]="SUBASSIGN",s[s.MULASSIGN=131]="MULASSIGN",s[s.DIVASSIGN=132]="DIVASSIGN",s[s.EndAssignOperation=133]="EndAssignOperation",s))(B||{});class qr{_char;_line;_column;_source;_currPosition;_nextPosition;constructor(e){this.reset(e)}reset(e){this._char="",this._line=0,this._column=0,this._source=e,this._currPosition=0,this._nextPosition=0}get source(){return this._source}getChar(){return this._char}get currPosition(){return this._currPosition}peekChar(){return this._nextPosition>=this._source.length?"\0":this._source[this._nextPosition]}readChar(){this._char=this._nextPosition>=this._source.length?"\0":this._source[this._nextPosition],this._char!==`
|
|
5695
|
+
`;static pipelineCache={};static pipeline;static getMipmapPipeline(e){let t=k.device,a=ua.pipelineCache[e.format];if(!a){const r=t.createShaderModule({code:ua.mipmapShader});let i=t.createBindGroupLayout({entries:[{binding:0,visibility:e.visibility,sampler:e.samplerBindingLayout},{binding:1,visibility:e.visibility,texture:e.textureBindingLayout}]}),n=k.device.createPipelineLayout({bindGroupLayouts:[i]});a=t.createRenderPipeline({layout:n,vertex:{module:r,entryPoint:"vertexMain"},fragment:{module:r,entryPoint:"fragmentMain",targets:[{format:e.format}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint32"}}),ua.pipelineCache[e.format]=a}return a}static webGPUGenerateMipmap(e){let t=k.device,a=e.textureDescriptor,r=ua.getMipmapPipeline(e),i=e.getGPUTexture().createView({baseMipLevel:0,mipLevelCount:1});const n=y.beginCommandEncoder();for(let o=1;o<a.mipLevelCount;++o){const l=e.getGPUTexture().createView({baseMipLevel:o,mipLevelCount:1}),c=n.beginRenderPass({colorAttachments:[{view:l,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]});let f=t.createBindGroupLayout({entries:[{binding:0,visibility:e.visibility,sampler:e.samplerBindingLayout},{binding:1,visibility:e.visibility,texture:e.textureBindingLayout}]});const d=t.createBindGroup({layout:f,entries:[{binding:0,resource:e.gpuSampler},{binding:1,resource:i}]});c.setPipeline(r),c.setBindGroup(0,d),c.draw(4),c.end(),i=l}y.endCommandEncoder(n)}static getMipmapCount(e,t){let i=Math.max(e,t);return 1+Math.log2(i)|0}}class He{name;url;gpuTexture;_isDestroyed=!1;get isDestroyed(){return this._isDestroyed}pid;view;gpuSampler;gpuSampler_comparison;format;usage;width=4;height=4;depthOrArrayLayers=1;numberLayer=1;viewDescriptor;textureDescriptor;visibility=GPUShaderStage.COMPUTE|GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT;textureBindingLayout={viewDimension:"2d",multisampled:!1};samplerBindingLayout={type:"filtering"};sampler_comparisonBindingLayout={type:"comparison"};flipY;isVideoTexture;isHDRTexture;_useMipmap=!1;_sourceImageData;_addressModeU;_addressModeV;_addressModeW;_magFilter;_minFilter;_mipmapFilter;_lodMinClamp;_lodMaxClamp;_compare;_maxAnisotropy;mipmapCount=1;_textureChange=!1;constructor(e=32,t=32,a=1){this.width=e,this.height=t,this.numberLayer=a,this.minFilter=er.linear,this.magFilter=er.linear,this.mipmapFilter=er.linear,this.addressModeU=Ot.repeat,this.addressModeV=Ot.repeat}init(){let e=this;return e.internalCreateBindingLayoutDesc&&e.internalCreateBindingLayoutDesc(),e.internalCreateTexture&&e.internalCreateTexture(),e.internalCreateView&&e.internalCreateView(),e.internalCreateSampler&&e.internalCreateSampler(),this}createTextureDescriptor(e,t,a,r,i=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.STORAGE_BINDING,n=1,o=0){this.width=e,this.height=t,this.format=r,this.usage=i,this.textureDescriptor={size:[e,t,n],mipLevelCount:a,format:r,usage:i,label:`${this.name+this.width+this.height+this.format}`},o>0&&(this.textureDescriptor.sampleCount=o),n>1?this.viewDescriptor={format:r,dimension:"2d-array"}:this.viewDescriptor={format:r,dimension:this.textureBindingLayout.viewDimension,mipLevelCount:a,baseMipLevel:0}}generate(e){let t=32,a=32;"width"in e&&(t=e.width,a=e.height),(t<32||a<32)&&console.log(e.name+"Size must be greater than 32!"),this.width=t,this.height=a,this.createTexture(e)}createTexture(e){this._sourceImageData=e,this.updateTextureDescription(),this.updateGPUTexture();let t=k.device;this.gpuTexture instanceof GPUTexture&&t.queue.copyExternalImageToTexture({source:this._sourceImageData},{texture:this.gpuTexture},[this.width,this.height]),this.useMipmap&&ua.webGPUGenerateMipmap(this)}get useMipmap(){return this._useMipmap}set useMipmap(e){if(e){if(this.samplerBindingLayout.type="filtering",this._useMipmap==!1&&this._sourceImageData){this._useMipmap=!0,this.updateTextureDescription(),this.updateGPUTexture();let t=k.device;this.gpuTexture instanceof GPUTexture&&t.queue.copyExternalImageToTexture({source:this._sourceImageData},{texture:this.gpuTexture},[this.width,this.height]),ua.webGPUGenerateMipmap(this)}}else if(this.samplerBindingLayout.type="non-filtering",this._useMipmap==!0&&this._sourceImageData){this._useMipmap=!1,this.updateTextureDescription(),this.updateGPUTexture();let t=k.device;this.gpuTexture instanceof GPUTexture&&t.queue.copyExternalImageToTexture({source:this._sourceImageData},{texture:this.gpuTexture},[this.width,this.height])}this._textureChange=!0,this._useMipmap=e,this.noticeChange()}get sourceImageData(){return this._sourceImageData}getMipmapCount(){let e=this.width,t=this.height,a=Math.max(e,t);return 1+Math.log2(a)|0}updateTextureDescription(){this.mipmapCount=Math.floor(this.useMipmap?this.getMipmapCount():1),this.createTextureDescriptor(this.width,this.height,this.mipmapCount,this.format)}updateGPUTexture(){this.gpuTexture&&this.gpuTexture instanceof GPUTexture&&this.gpuTexture.destroy(),this.gpuTexture=null,this.view=null,this.gpuTexture=this.getGPUTexture()}getGPUTexture(){return this.gpuTexture||(this.gpuTexture=k.device.createTexture(this.textureDescriptor)),this.gpuTexture}getGPUView(e=0){return this.view||(this.gpuTexture=this.getGPUTexture(),this.gpuTexture instanceof GPUTexture&&(this.view=this.gpuTexture.createView(this.viewDescriptor),this.view.label=this.name)),this.view}_stateChangeRef=new Map;bindStateChange(e,t){this._stateChangeRef.set(t,e)}unBindStateChange(e){this._stateChangeRef.delete(e)}noticeChange(){this.gpuSampler=k.device.createSampler(this),this._stateChangeRef.forEach((e,t)=>{e()})}destroy(e){if(e&&this.gpuTexture instanceof GPUTexture&&(this.gpuSampler=null,this.gpuSampler_comparison=null,this.textureBindingLayout=null,this.textureDescriptor=null,this.gpuTexture.destroy(),this.gpuTexture=null,this._isDestroyed=!0),this._sourceImageData&&this._sourceImageData instanceof ImageBitmap){try{this._sourceImageData.close()}catch{}this._sourceImageData=null}this._stateChangeRef.clear()}get addressModeU(){return this._addressModeU}set addressModeU(e){this._addressModeU!=e&&(this._addressModeU=e,this.noticeChange())}get addressModeV(){return this._addressModeV}set addressModeV(e){this._addressModeV!=e&&(this._addressModeV=e,this.noticeChange())}get addressModeW(){return this._addressModeW}set addressModeW(e){this._addressModeW!=e&&(this._addressModeW=e,this.noticeChange())}get magFilter(){return this._magFilter}set magFilter(e){this._magFilter!=e&&(this._magFilter=e,this.noticeChange())}get minFilter(){return this._minFilter}set minFilter(e){this._minFilter!=e&&(this._minFilter=e,this.noticeChange())}get mipmapFilter(){return this._mipmapFilter}set mipmapFilter(e){this._mipmapFilter!=e&&(this._mipmapFilter=e,this.noticeChange())}get lodMinClamp(){return this._lodMinClamp}set lodMinClamp(e){this._lodMinClamp!=e&&(this._lodMinClamp=e,this.noticeChange())}get lodMaxClamp(){return this._lodMaxClamp}set lodMaxClamp(e){this._lodMaxClamp!=e&&(this._lodMaxClamp=e,this.noticeChange())}get compare(){return this._compare}set compare(e){this._compare!=e&&(this._compare=e,this.noticeChange())}get maxAnisotropy(){return this._maxAnisotropy}set maxAnisotropy(e){this._maxAnisotropy!=e&&(this._maxAnisotropy=e,this.noticeChange())}static _texs=[];static delayDestroyTexture(e){this._texs.includes(e)||this._texs.push(e)}static destroyTexture(){if(this._texs.length>0)for(;this._texs.length>0;)this._texs.shift().destroy()}}class Ec extends He{_bitmapTextures;constructor(e,t,a){super(e,t,a),this.format=Y.rgba8unorm,this.mipmapCount=1,this._bitmapTextures=[],this.init()}setTextures(e){this._bitmapTextures.length=0;for(let t=0;t<e.length;t++){const a=e[t];this.addTexture(a)}}addTexture(e){(e.width!=this.width||e.height!=this.height)&&console.error("bitmap texture must match bitmapTextureArray size!"),e.pid=this._bitmapTextures.length,this._bitmapTextures.push(e),this.updateTexture()}removeTexture(e){let t=this._bitmapTextures.indexOf(e);if(t!=-1){this._bitmapTextures.splice(t,1);for(let a=0;a<this._bitmapTextures.length;a++){const r=this._bitmapTextures[a];r.pid=a}}}updateTexture(){let e=y.beginCommandEncoder();for(let t=0;t<this._bitmapTextures.length;t++){let a=this._bitmapTextures[t];e.copyTextureToTexture({texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:this.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:t}},{width:this.width,height:this.height,depthOrArrayLayers:1})}y.endCommandEncoder(e)}internalCreateBindingLayoutDesc(){this.textureBindingLayout.viewDimension="2d-array",this.samplerBindingLayout.type="filtering",this.minFilter=er.linear,this.magFilter=er.linear}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=k.device.createSampler(this)}}class ba{static use=!1;static iesTexture;static ies_list=[];_iesTexture;index=0;constructor(){}generateIES(e){}set IESTexture(e){this._iesTexture=e,e.addressModeU=Ot.repeat,e.addressModeV=Ot.repeat,e.addressModeW=Ot.repeat,ba.ies_list.indexOf(this)==-1&&(this.index=ba.ies_list.length,ba.ies_list.push(this),ba.iesTexture||ba.create(e.width,e.height),ba.iesTexture.addTexture(e))}get IESTexture(){return this._iesTexture}static create(e,t){let a=48;this.iesTexture=new Ec(e,t,a)}}class xn{static _globalDataBindGroupLayout;static getGlobalDataBindGroupLayout(){if(this._globalDataBindGroupLayout)return this._globalDataBindGroupLayout;let e=[];return e.push({binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,buffer:{type:"uniform"}}),e.push({binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}),this._globalDataBindGroupLayout=k.device.createBindGroupLayout({entries:e}),this._globalDataBindGroupLayout}}class pi{Type=0;Line=0;Colume=0;Literal="";constructor(e=0,t="\0"){this.Type=e,this.Literal=t}isTypeEqual(e){return this.Type==e}isLiteralEqual(e){return this.Literal==e}isBuiltinType(){return this.Type>33&&this.Type<101}isDataType(){return this.Type==1||this.isBuiltinType()}isOperation(){return this.Type>102&&this.Type<127}isAssignOperation(){return this.Type>128&&this.Type<133}get nOperationPriorityLevel(){switch(this.Type){case 26:return 1;case 27:return 1;case 125:return 2;case 110:return 3;case 114:return 3;case 105:return 4;case 106:return 4;case 103:return 5;case 104:return 5;case 115:return 6;case 116:return 6;case 119:return 7;case 120:return 7;case 122:return 7;case 123:return 7;case 121:return 8;case 124:return 8;case 111:return 9;case 113:return 10;case 112:return 11;case 107:return 12;case 109:return 13;case 108:return 14;case 24:return 15;case 126:return 16;case 129:return 16;case 130:return 16;case 131:return 16;case 132:return 16}return 99}}var B=(s=>(s[s.EOF=0]="EOF",s[s.IDENT=1]="IDENT",s[s.VOID=2]="VOID",s[s.CONST=3]="CONST",s[s.LAYOUT=4]="LAYOUT",s[s.PRECISION=5]="PRECISION",s[s.ATTRIBUTE=6]="ATTRIBUTE",s[s.UNIFORM=7]="UNIFORM",s[s.VARYING=8]="VARYING",s[s.INVARIANT=9]="INVARIANT",s[s.IN=10]="IN",s[s.OUT=11]="OUT",s[s.INOUT=12]="INOUT",s[s.IF=13]="IF",s[s.ELSE=14]="ELSE",s[s.FOR=15]="FOR",s[s.WHILE=16]="WHILE",s[s.DO=17]="DO",s[s.BREAK=18]="BREAK",s[s.RETURN=19]="RETURN",s[s.CONTINUE=20]="CONTINUE",s[s.STRUCT=21]="STRUCT",s[s.COMMA=22]="COMMA",s[s.COLON=23]="COLON",s[s.QUEMARK=24]="QUEMARK",s[s.SEMICOLON=25]="SEMICOLON",s[s.LEFTSAMLL=26]="LEFTSAMLL",s[s.RIGHTSAMLL=27]="RIGHTSAMLL",s[s.LEFTMEDI=28]="LEFTMEDI",s[s.RIGHTMEDI=29]="RIGHTMEDI",s[s.LEFTBIG=30]="LEFTBIG",s[s.RIGHTBIG=31]="RIGHTBIG",s[s.LITERAL=32]="LITERAL",s[s.BeginBuiltinType=33]="BeginBuiltinType",s[s.INT=34]="INT",s[s.INT_ARRAY=35]="INT_ARRAY",s[s.UINT=36]="UINT",s[s.UINT_ARRAY=37]="UINT_ARRAY",s[s.BOOL=38]="BOOL",s[s.BOOL_ARRAY=39]="BOOL_ARRAY",s[s.FLOAT=40]="FLOAT",s[s.FLOAT_ARRAY=41]="FLOAT_ARRAY",s[s.DOUBLE=42]="DOUBLE",s[s.DOUBLE_ARRAY=43]="DOUBLE_ARRAY",s[s.VEC2=44]="VEC2",s[s.VEC2_ARRAY=45]="VEC2_ARRAY",s[s.VEC3=46]="VEC3",s[s.VEC3_ARRAY=47]="VEC3_ARRAY",s[s.VEC4=48]="VEC4",s[s.VEC4_ARRAY=49]="VEC4_ARRAY",s[s.BVEC2=50]="BVEC2",s[s.BVEC2_ARRAY=51]="BVEC2_ARRAY",s[s.BVEC3=52]="BVEC3",s[s.BVEC3_ARRAY=53]="BVEC3_ARRAY",s[s.BVEC4=54]="BVEC4",s[s.BVEC4_ARRAY=55]="BVEC4_ARRAY",s[s.IVEC2=56]="IVEC2",s[s.IVEC2_ARRAY=57]="IVEC2_ARRAY",s[s.IVEC3=58]="IVEC3",s[s.IVEC3_ARRAY=59]="IVEC3_ARRAY",s[s.IVEC4=60]="IVEC4",s[s.IVEC4_ARRAY=61]="IVEC4_ARRAY",s[s.UVEC2=62]="UVEC2",s[s.UVEC2_ARRAY=63]="UVEC2_ARRAY",s[s.UVEC3=64]="UVEC3",s[s.UVEC3_ARRAY=65]="UVEC3_ARRAY",s[s.UVEC4=66]="UVEC4",s[s.UVEC4_ARRAY=67]="UVEC4_ARRAY",s[s.MAT2x2=68]="MAT2x2",s[s.MAT2x2_ARRAY=69]="MAT2x2_ARRAY",s[s.MAT2x3=70]="MAT2x3",s[s.MAT2x3_ARRAY=71]="MAT2x3_ARRAY",s[s.MAT2x4=72]="MAT2x4",s[s.MAT2x4_ARRAY=73]="MAT2x4_ARRAY",s[s.MAT3x2=74]="MAT3x2",s[s.MAT3x2_ARRAY=75]="MAT3x2_ARRAY",s[s.MAT3x3=76]="MAT3x3",s[s.MAT3x3_ARRAY=77]="MAT3x3_ARRAY",s[s.MAT3x4=78]="MAT3x4",s[s.MAT3x4_ARRAY=79]="MAT3x4_ARRAY",s[s.MAT4x2=80]="MAT4x2",s[s.MAT4x2_ARRAY=81]="MAT4x2_ARRAY",s[s.MAT4x3=82]="MAT4x3",s[s.MAT4x3_ARRAY=83]="MAT4x3_ARRAY",s[s.MAT4x4=84]="MAT4x4",s[s.MAT4x4_ARRAY=85]="MAT4x4_ARRAY",s[s.SAMPLER=86]="SAMPLER",s[s.SAMPLER_1D=87]="SAMPLER_1D",s[s.SAMPLER_2D=88]="SAMPLER_2D",s[s.SAMPLER_3D=89]="SAMPLER_3D",s[s.SAMPLER_CUBE=90]="SAMPLER_CUBE",s[s.SAMPLER_SHADOW=91]="SAMPLER_SHADOW",s[s.SAMPLER_1D_SHADOW=92]="SAMPLER_1D_SHADOW",s[s.SAMPLER_2D_SHADOW=93]="SAMPLER_2D_SHADOW",s[s.TEXTURE_1D=94]="TEXTURE_1D",s[s.TEXTURE_1D_ARRAY=95]="TEXTURE_1D_ARRAY",s[s.TEXTURE_2D=96]="TEXTURE_2D",s[s.TEXTURE_2D_ARRAY=97]="TEXTURE_2D_ARRAY",s[s.TEXTURE_3D=98]="TEXTURE_3D",s[s.TEXTURE_CUBE=99]="TEXTURE_CUBE",s[s.TEXTURE_CUBE_ARRAY=100]="TEXTURE_CUBE_ARRAY",s[s.EndBuiltinType=101]="EndBuiltinType",s[s.BeginOperation=102]="BeginOperation",s[s.ADD=103]="ADD",s[s.SUB=104]="SUB",s[s.MUL=105]="MUL",s[s.DIV=106]="DIV",s[s.AND=107]="AND",s[s.OR=108]="OR",s[s.XOR=109]="XOR",s[s.NOT=110]="NOT",s[s.BITAND=111]="BITAND",s[s.BITOR=112]="BITOR",s[s.BITXOR=113]="BITXOR",s[s.BITNOT=114]="BITNOT",s[s.BITSHIFT_L=115]="BITSHIFT_L",s[s.BITSHIFT_R=116]="BITSHIFT_R",s[s.INC=117]="INC",s[s.DEC=118]="DEC",s[s.GREATER=119]="GREATER",s[s.GREATEREQUAL=120]="GREATEREQUAL",s[s.EQUAL=121]="EQUAL",s[s.LESS=122]="LESS",s[s.LESSEQUAL=123]="LESSEQUAL",s[s.NOTEQUAL=124]="NOTEQUAL",s[s.DOT=125]="DOT",s[s.ASSIGN=126]="ASSIGN",s[s.EndOperation=127]="EndOperation",s[s.BeginAssignOperation=128]="BeginAssignOperation",s[s.ADDASSIGN=129]="ADDASSIGN",s[s.SUBASSIGN=130]="SUBASSIGN",s[s.MULASSIGN=131]="MULASSIGN",s[s.DIVASSIGN=132]="DIVASSIGN",s[s.EndAssignOperation=133]="EndAssignOperation",s))(B||{});class qr{_char;_line;_column;_source;_currPosition;_nextPosition;constructor(e){this.reset(e)}reset(e){this._char="",this._line=0,this._column=0,this._source=e,this._currPosition=0,this._nextPosition=0}get source(){return this._source}getChar(){return this._char}get currPosition(){return this._currPosition}peekChar(){return this._nextPosition>=this._source.length?"\0":this._source[this._nextPosition]}readChar(){this._char=this._nextPosition>=this._source.length?"\0":this._source[this._nextPosition],this._char!==`
|
|
5696
5696
|
`?this._column++:(this._line++,this._column=0),this._currPosition=this._nextPosition,this._nextPosition++}readCharAndSkipWhitespace(){this.readChar(),this.skipWhitespace()}readIdentifier(){for(var e=this._currPosition;this.isIdentifier(this._char);)this.readChar();return this._source.substring(e,this._currPosition)}isIdentifier(e){var t=e.charCodeAt(0);return 97<=t&&t<=122||65<=t&&t<=90||48<=t&&t<=57||t==95}skipWhitespace(){for(;this.IsWhitespace(this._char);)this.readChar()}IsWhitespace(e){return e===" "||e===" "||e==="\r"||e===`
|
|
5697
5697
|
`}skipComment(){for(;this._char!==`
|
|
5698
5698
|
`&&this._char!=="\0";)this.readChar();this.skipWhitespace()}skipMultilineComment(){if(!(this._char!=="/"&&this.peekChar()!=="*")){this.readChar(),this.readChar();for(let e=1;e>0&&this._char!=="\0";)if(this.readChar(),this._char==="/"&&this.peekChar()==="*"){e++,this.readChar();continue}else if(this._char==="*"&&this.peekChar()==="/"){e--,this.readChar();continue}this.readChar(),this.readChar(),this.skipWhitespace()}}isDigit(e){var t=e.charCodeAt(0);return 48<=t&&t<=57}readNumber(){for(var e=this._currPosition;this.isDigit(this._char);)this.readChar();if(this._char===".")for(this.readChar();this.isDigit(this._char);)this.readChar();return this._source.substring(e,this._currPosition)}readValue(){return this.isDigit(this._char)?this.readNumber():this.readIdentifier()}readLine(){var e=this._currPosition,t=this._source.indexOf(`
|
|
@@ -5742,7 +5742,7 @@ struct InstanceData {
|
|
|
5742
5742
|
`,a}}class ue extends ye{constructor(){super()}static parse(e){let t=new Array,a=new Array,r=0;for(;e.peekToken(0).Type!=B.EOF;){let i=e.peekToken(0);if(i.Type==B.SEMICOLON||i.Type==B.RIGHTMEDI||i.Type==B.COMMA||i.Type==B.COLON||i.Type==B.RIGHTBIG)break;if(i.isOperation()){if(i.isOperation()){if(i.Type==B.INC||i.Type==B.DEC){let n=i;e.skipToken(1);let o=ue.parse(e);a.push(new $r(n,void 0,o));continue}else if(t.length>0){if(t[t.length-1].nOperationPriorityLevel<=i.nOperationPriorityLevel)ue.unionOperation(t,a);else if(t.length>0&&t[t.length-1].Literal=="-"){let o=t.pop(),l=a.pop();a.push(new $r(o,void 0,l))}}t.push(i),e.skipToken(1)}}else if(i.Type==B.LITERAL){a.push(new La(i.Literal)),e.skipToken(1);continue}else if(i.Type==B.LEFTSAMLL){r++,t.push(i),e.skipToken(1);continue}else if(i.Type==B.RIGHTSAMLL){if(r<=0)break;for(r--;ue.unionOperation(t,a););if(t[t.length-1].Type==B.LEFTSAMLL){t.pop();let n=new Qc;n.addNode(a.pop()),a.push(n)}e.skipToken(1);continue}else if(i.Type==B.IDENT){if(e.peekToken(1).Type==B.INC||e.peekToken(1).Type==B.DEC){let n=e.peekToken(1),o=new Ta(i.Literal);a.push(new $r(n,o,void 0)),e.skipToken(2);continue}else if(e.peekToken(1).Type==B.LEFTSAMLL){a.push(Pr.parse(e));continue}else if(e.peekToken(1).Type==B.DOT){a.push(Hi.parse(e));continue}else if(e.peekToken(1).Type==B.LEFTMEDI){a.push(Gr.parse(e));continue}a.push(new Ta(i.Literal)),e.skipToken(1);continue}else{if(i.isBuiltinType()&&e.peekToken(1).Type==B.LEFTSAMLL){a.push(Pr.parse(e));continue}if(i.isAssignOperation()){let n=i;e.skipToken(1);let o=a.pop(),l=ue.parse(e);a.push(new ar(n,o,l));continue}if(i.Type==B.LEFTBIG&&(e.peekToken(1).Type==B.LITERAL||e.peekToken(1).Type==B.SUB&&e.peekToken(2).Type==B.LITERAL)){a.push(ss.parse(e));continue}if(i.Type==B.QUEMARK){t.length>0&&t[t.length-1].nOperationPriorityLevel<=i.nOperationPriorityLevel&&ue.unionOperation(t,a),e.skipToken(1);let n=a.pop(),o=ue.parse(e);e.peekToken(0).Type==B.COLON&&e.skipToken(1);let l=ue.parse(e);if(a.push(new Tc(n,o,l)),e.peekToken(-1).Type==B.SEMICOLON)break;continue}if(i.Type==B.LEFTMEDI){e.skipToken(1);let n=ue.parse(e);e.peekToken(0).Type==B.RIGHTMEDI&&e.skipToken(1);let o=a.pop();a.push(new Gr(o,n));continue}throw"An unexpected character"}}for(;t.length>0&&ue.unionOperation(t,a););if(t.length<=0&&a.length==1){let i=new ue;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 $r(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==B.DOT?t.push(new Hi(i,a)):t.push(new ar(r,i,a)),!0}return!1}}class Qc extends ye{constructor(){super()}formatToWGSL(e,t){return(t<=0?"":" ".repeat(t))+"("+this.nodes[0].formatToWGSL(e,0)+")"}}class Ta extends ye{name;constructor(e){super(),this.name=e}formatToWGSL(e,t){return(t<=0?"":" ".repeat(t))+e.findIdentifier(this.name)}}class La extends ye{value;constructor(e){super(),this.value=e}static parse(e){let t=e.peekToken(0);if(t.Type==B.SUB&&e.peekToken(1).Type==B.LITERAL){let a=new La("-"+e.peekToken(1).Literal);return e.skipToken(2),a}else if(t.Type==B.LITERAL){let a=new La(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 ss extends La{arrayValue;constructor(e){super(""),this.arrayValue=e}static parse(e){if(e.peekToken(0).Type==B.LEFTBIG&&e.peekToken(1).Type==B.LITERAL||e.peekToken(0).Type==B.LEFTBIG&&e.peekToken(1).Type==B.SUB&&e.peekToken(2).Type==B.LITERAL){e.skipToken(1);let t=[];for(;e.peekToken(0).Type!=B.RIGHTBIG;){if(e.peekToken(0).Type==B.LEFTSAMLL){t.push(ss.parse(e));continue}if(t.push(La.parse(e)),e.peekToken(0).Type==B.COMMA){e.skipToken(1);continue}else if(e.peekToken(0).Type==B.RIGHTBIG){e.skipToken(1);break}else throw"Error parsing array constants: Unexpected characters"}return new ss(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 h2 extends ye{constructor(){super()}}class u2 extends ye{constructor(){super()}}class Ws extends ye{constructor(){super()}static parse(e){if(e.peekToken(0).Type==B.CONTINUE&&e.peekToken(1).Type==B.SEMICOLON)return e.skipToken(2),new Ws;throw"Error parsing continue: Unexpected character"}formatToWGSL(e,t){let a="",r=t<=0?"":" ".repeat(t);return a+=r+"continue",a}}class Xi extends ye{value;constructor(e){super(),this.value=e}static parse(e){if(e.peekToken(0).Type==B.RETURN){e.skipToken(1);let t=ue.parse(e);return e.peekToken(0).Type==B.SEMICOLON&&e.skipToken(1),new Xi(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 $r extends ye{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 ar extends ye{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 Tc extends ye{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 Hi extends ye{leftValue;rightValue;constructor(e,t){super(),this.leftValue=e,this.rightValue=t}static parse(e){if(e.peekToken(0).Type==B.IDENT&&e.peekToken(1).Type==B.DOT&&e.peekToken(2).Type==B.IDENT){let t=new Ta(e.peekToken(0).Literal),a=new Ta(e.peekToken(2).Literal);return e.skipToken(3),new Hi(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 Gr extends ye{leftValue;indexValue;constructor(e,t){super(),this.leftValue=e,this.indexValue=t}static parse(e){if(e.peekToken(0).Type==B.IDENT&&e.peekToken(1).Type==B.LEFTMEDI){let t=new Ta(e.peekToken(0).Literal);e.skipToken(2);let a=ue.parse(e);e.peekToken(0).Type==B.RIGHTMEDI&&e.skipToken(1);let r=new Gr(t,a);for(;e.peekToken(0).Type==B.LEFTMEDI;)e.skipToken(1),a=ue.parse(e),e.peekToken(0).Type==B.RIGHTMEDI&&e.skipToken(1),r=new Gr(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 ca extends ye{constructor(){super()}static parse(e){if(e.peekToken(0).Type==B.LEFTBIG){e.skipToken(1);let t=new ca;for(let a=1;a>0&&e.peekToken(0).Type!=B.EOF;){let r=e.peekToken(0);if(r.Type==B.LEFTBIG){a++,e.skipToken(1);continue}if(r.Type==B.RIGHTBIG){a--,e.skipToken(1);continue}if(r.Type==B.SEMICOLON){e.skipToken(1);continue}if(r.isDataType()&&e.peekToken(1).Type==B.IDENT){t.addNode(Ge.parse(e));continue}if(r.Type==B.CONST&&e.peekToken(1).isDataType()&&e.peekToken(2).Type==B.IDENT){t.addNode(Ge.parse(e));continue}else if(r.Type==B.IDENT&&e.peekToken(1).Type==B.ASSIGN){t.addNode(ue.parse(e)),e.peekToken(0).Type==B.SEMICOLON&&e.skipToken(1);continue}else if(r.Type==B.IDENT&&e.peekToken(1).Type==B.LEFTMEDI){let i=Gr.parse(e);if(e.peekToken(0).Type==B.ASSIGN){let n=e.peekToken(0);e.skipToken(1);let o=ue.parse(e);e.peekToken(0).Type==B.RIGHTMEDI&&e.skipToken(1),t.addNode(new ar(n,i,o));continue}t.addNode(i);continue}else if(r.Type==B.IDENT&&e.peekToken(1).Type==B.DOT){let i=ue.parse(e);t.addNode(i);continue}else if(r.Type==B.IDENT&&e.peekToken(1).isAssignOperation()){let i=e.peekToken(1),n=new Ta(r.Literal);e.skipToken(2);let o=ue.parse(e);e.peekToken(0).Type==B.SEMICOLON&&e.skipToken(1),t.addNode(new ar(i,n,o));continue}else if(r.Type==B.IDENT&&(e.peekToken(1).Type==B.INC||e.peekToken(1).Type==B.DEC)&&e.peekToken(2).Type==B.SEMICOLON){let i=e.peekToken(1);t.addNode(new $r(i,new Ta(r.Literal),void 0)),e.skipToken(3);continue}else if(r.Type==B.RETURN){t.addNode(Xi.parse(e));continue}else if(r.Type==B.CONTINUE){t.addNode(Ws.parse(e));continue}else if(r.Type==B.WHILE){t.addNode(Lr.parse(e));continue}else if(r.Type==B.FOR){t.addNode(Or.parse(e));continue}else if(r.Type==B.IF){t.addNode(Tr.parse(e));continue}else if(r.Type==B.IDENT&&e.peekToken(1).Type==B.LEFTSAMLL){t.addNode(Pr.parse(e)),e.peekToken(0).Type==B.SEMICOLON&&e.skipToken(0);continue}throw"Error parsing block: Unexpected symbol("+r.Literal+")"}return t}throw"Error parsing block: Unexpected symbol"}}class Zs extends ye{type;qualifier;constructor(e,t){super(),this.type=t,this.qualifier=e}static parse(e){if(e.peekToken(0).Type==B.PRECISION&&e.peekToken(1).Type==B.IDENT&&e.peekToken(2).isBuiltinType()){let t=new Zs(e.peekToken(1).Literal,e.peekToken(2).Literal);return e.skipToken(3),e.peekToken(0).Type==B.SEMICOLON&&e.skipToken(1),t}throw"Error parsing precision qualifier: Unexpected character"}formatToWGSL(e,t){return""}}class Ki extends ye{scope="";qualifier=new Map;constructor(){super()}addQualifier(e,t=""){this.qualifier.set(e,t)}static parse(e){if(e.peekToken(0).Type==B.LAYOUT&&e.peekToken(1).Type==B.LEFTSAMLL){let t=new Ki;e.skipToken(2);do if(e.peekToken(0).Type==B.IDENT){if(e.peekToken(1).Type==B.ASSIGN&&e.peekToken(2).Type==B.LITERAL){let r=e.peekToken(0).Literal,i=e.peekToken(2).Literal;if(t.addQualifier(r,i),e.skipToken(3),e.peekToken(0).Type==B.COMMA){e.skipToken(1);continue}let n=e.peekToken(0);n.Line=0}else if(e.peekToken(1).Type==B.RIGHTSAMLL){let r=e.peekToken(0).Literal;t.addQualifier(r,""),e.skipToken(1);break}else if(e.peekToken(1).Type==B.COMMA){let r=e.peekToken(0).Literal;t.addQualifier(r,""),e.skipToken(2);continue}}while(e.peekToken(0).Type!=B.RIGHTSAMLL);if(e.peekToken(0).Type==B.RIGHTSAMLL&&e.skipToken(1),t.scope=e.peekToken(0).Literal,e.skipToken(1),e.peekToken(0).Type==B.SEMICOLON)return e.skipToken(1),t;if(e.peekToken(0).isBuiltinType()&&e.peekToken(1).Type==B.IDENT&&e.peekToken(2).Type==B.SEMICOLON){let a=new Ge(e.peekToken(0).Literal,e.peekToken(1).Literal);return t.addNode(a),e.skipToken(3),t}else if(e.peekToken(0).Type==B.IDENT&&e.peekToken(1).Type==B.LEFTBIG){let a=Oa.parse(e);return t.addNode(a),e.peekToken(0).Type==B.IDENT&&e.peekToken(1).Type==B.SEMICOLON&&(a.addNode(new Ge(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 Ge){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+": "+Xt(r.type)+`;\r
|
|
5743
5743
|
`}else if(r instanceof Oa){if(this.scope=="buffer"?e.stage=="compute"?a+="var<storage, read_write> ":a+="var<storage, read> ":a+="var<"+this.scope+"> ",r.nodes.length<=0){let i="unif"+e.layoutUniformCount.toString();for(;e.hasIdentifier(i);)e.layoutUniformCount++,i="unif"+e.layoutUniformCount.toString();for(let n of r.fields)e.addIdentifier(n.name,i+"."+n.name);a+=i+": "+r.name+`;\r
|
|
5744
5744
|
`,e.layoutUniformCount++}else{let i=r.nodes[0];a+=i.name+": "+i.type+`;\r
|
|
5745
|
-
`}return a}return a}}function Xt(s){switch(s){case"int":return"i32";case"int[]":return"array<i32>";case"uint":return"u32";case"uint[]":return"array<u32>";case"float":return"f32";case"float[]":return"array<f32>";case"vec2":return"vec2<f32>";case"vec3":return"vec3<f32>";case"vec4":return"vec4<f32>";case"vec2[]":return"array<vec2<f32>>";case"vec3[]":return"array<vec3<f32>>";case"vec4[]":return"array<vec4<f32>>";case"ivec2":return"vec2<i32>";case"ivec3":return"vec3<i32>";case"ivec4":return"vec4<i32>";case"ivec2[]":return"array<vec2<i32>>";case"ivec3[]":return"array<vec3<i32>>";case"ivec4[]":return"array<vec4<i32>>";case"mat2":return"mat2x2<f32>";case"mat2x2":return"mat2x2<f32>";case"mat2x3":return"mat2x3<f32>";case"mat2x4":return"mat2x4<f32>";case"mat2[]":return"array<mat2x2<f32>>";case"mat2x2[]":return"array<mat2x2<f32>>";case"mat2x3[]":return"array<mat2x3<f32>>";case"mat2x4[]":return"array<mat2x4<f32>>";case"mat3":return"mat3x3<f32>";case"mat3x2":return"mat3x2<f32>";case"mat3x3":return"mat3x3<f32>";case"mat3x4":return"mat3x4<f32>";case"mat3[]":return"array<mat3x3<f32>>";case"mat3x2[]":return"array<mat3x2<f32>>";case"mat3x3[]":return"array<mat3x3<f32>>";case"mat3x4[]":return"array<mat3x4<f32>>";case"mat4":return"mat4x4<f32>";case"mat4x2":return"mat4x2<f32>";case"mat4x3":return"mat4x3<f32>";case"mat4x4":return"mat4x4<f32>";case"mat4[]":return"array<mat4x4<f32>>";case"mat4x2[]":return"array<mat4x2<f32>>";case"mat4x3[]":return"array<mat4x3<f32>>";case"mat4x4[]":return"array<mat4x4<f32>>";case"texture2D":return"texture_2d<f32>"}return s}class Mc{_lexer;_rootNode;constructor(e){this._lexer=e,this._rootNode=new ye,this.parse()}get lexer(){return this._lexer}parse(){for(;this.peekToken(0).Type!==B.EOF;){if(this.peekToken(0).Type==B.SEMICOLON){this.skipToken(1);continue}let e=this.parseStatement();e!==null&&this._rootNode.addNode(e)}}parseStatement(){let e=this.peekToken();if(e.Type==B.LAYOUT&&this.peekToken(1).Type==B.LEFTSAMLL)return Ki.parse(this._lexer);if(e.Type==B.STRUCT)return this.skipToken(1),Oa.parse(this._lexer);if((e.isBuiltinType()||e.Type==B.VOID)&&this.peekToken(1).Type==B.IDENT&&this.peekToken(2).Type==B.LEFTSAMLL)return zs.parse(this._lexer);if(e.Type==B.CONST&&this.peekToken(1).isDataType())return Ge.parse(this._lexer);if(e.isDataType()&&this.peekToken(1).Type==B.IDENT)return Ge.parse(this._lexer);if(e.Type==B.OUT&&this.peekToken(1).isDataType()&&this.peekToken(2).Type==B.IDENT)return Ge.parse(this._lexer);if(e.Type==B.PRECISION)return Zs.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 Nc{static VertexShader="VertexShader";static FragmentShader="FragmentShader";static convertGLSL(e){var t=new Rc(e),a=new wc(t),r=new Mc(a),i=new Ic(r);return i.generateWGSL()}}class Cn{setID=0;bindingID=0;name="";type=""}class Sn{name="";type="";locationID=0;builtinName="";isBuiltinAttribute(){return this.builtinName!=""}}class Vc{uniformInfo=[];inputAttribute=[];outputAttribute=[];sourceCode=""}var ia=(s=>(s[s.vertex=0]="vertex",s[s.fragment=1]="fragment",s[s.computer=2]="computer",s))(ia||{});class Pc{blendMode=ae.NONE;depthCompare=et.less_equal;depthWriteEnabled=!0;frontFace="ccw";cullMode=wt.back;topology=cn.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 Oc extends Qa{uniformNodes=[];_onChange=!0;constructor(){super(),this.bufferType=aa.MaterialDataUniformGPUBuffer}initDataUniform(e){this.uniformNodes=e;let t=0;for(const a in e){const r=e[a];r||console.error(a,"is empty"),t+=r.size*4}t=Math.floor(t/256+1)*256,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,t/4,null,"MaterialDataUniformGPUBuffer");for(const a in e){const r=e[a];r||console.error(a,"is empty");let i=this.memory.allocation_node(r.size*4);r.memoryInfo=i,r.bindOnChange=()=>this.onChange()}}onChange(){this._onChange=!0}apply(){if(this.uniformNodes.length!=0&&this._onChange){for(const e in this.uniformNodes)this.uniformNodes[e].update();super.apply(),this._onChange=!1}}}class Ma{static renderShaderModulePool;static renderShader;static init(){this.renderShaderModulePool=new Map,this.renderShader=new Map}}class me{reference;static _ins;static getInstance(){return this._ins||=new me,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){let a=this.reference.get(e);a&&a.delete(t)}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 Fn{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 Ve extends ln{passType=H.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 z||console.error("Shader Not Register, Please Register Shader!",this.vsName),this.fsName in z||console.error("Shader Not Register, Please Register Shader!",this.fsName),z[this.vsName]&&(this._sourceVS=z[this.vsName]),z[this.fsName]&&(this._sourceFS=z[this.fsName]),this.textures={},this.bindGroups=[],this.shaderState=new Pc,this.materialDataUniformBuffer=new Oc,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==wt.none}set doubleSide(e){let t=e?wt.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}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(ia.vertex,this._destVS,t),this.compileShader(ia.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=Bt.genRenderShaderVariant(this),this.reBuild(e,t),this._valueChange=!1,a&&a())}preCompile(e){this.preDefine(e),this.preCompileShader(ia.vertex,this._sourceVS.concat()),this.preCompileShader(ia.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),m.setting.render.useCompressGBuffer?this.defineValue.USE_COMPRESSGBUFFER=!0:this.defineValue.USE_COMPRESSGBUFFER=!1,ra.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=Nc.convertGLSL(r);r=i.sourceCode}for(const n in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,n)){const o=this.constValues[n];r=r.replaceAll(`&${n}`,o.toString())}switch(e){case ia.vertex:this._destVS=r;break;case ia.fragment:this._destFS=r;break}}compileShader(e,t,a){let r=t;r=this.applyPostDefine(r,a);let i=t;for(let o in this.defineValue)i+=`${o}=${this.defineValue[o]},`;let n=Ma.renderShaderModulePool.get(i);switch(n||(r=this.applyPostDefine(r,a),n=k.device.createShaderModule({label:e==ia.vertex?this.vsName:this.fsName,code:r}),n.getCompilationInfo().then(o=>{o.messages.length>0&&(console.log(r),console.log(o))}),Ma.renderShaderModulePool.set(i,n)),e){case ia.vertex:this._vsShaderModule=n,this._destVS=r;break;case ia.fragment:this._fsShaderModule=n,this._destFS=r;break}}getGroupLayout(e,t){let a=[];for(let r=0;r<t.length;r++){const i=t[r];if(i)if(i.varType=="uniform"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"uniform"}};a.push(o)}else if(i.varType=="storage-read"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"read-only-storage"}};a.push(o)}else if(i.varType=="var")switch(i.dataType){case"sampler":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:m.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.samplerBindingLayout};a.push(l),this._textureGroup=e}break;case"sampler_comparison":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:m.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.sampler_comparisonBindingLayout};a.push(l),this._textureGroup=e}break;case"texture_2d<f32>":case"texture_2d_array<f32>":case"texture_cube<f32>":case"texture_depth_2d":case"texture_depth_2d_array":case"texture_depth_cube":case"texture_depth_cube_array":{let n=this.textures[i.varName]?this.textures[i.varName]:m.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,me.getInstance().attached(n,this)}break;case"texture_external":{let n=this.textures[i.varName]?this.textures[i.varName]:m.res.redTexture,o={binding:i.binding,visibility:n.visibility,externalTexture:{}};a.push(o),this._textureGroup=e,me.getInstance().attached(n,this)}break;default:{let n=this.textures[i.varName]?this.textures[i.varName]:m.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,me.getInstance().attached(n,this)}break}else{debugger;console.error("bind group can't empty")}}return a}_cacheEntries;genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;o++){const l=r[o];if(l){if(l.varType=="uniform"){let c=this._bufferDic.get(l.varName);if(c){if(c.bufferType==aa.MaterialDataUniformGPUBuffer){let d=[];for(let h=0;h<l.dataFields.length;h++){const b=l.dataFields[h];this.uniforms[b.name]||console.error(`shader-${this.vsName}:${this.fsName} ${b.name}is empty`),d.push(this.uniforms[b.name])}this.materialDataUniformBuffer.initDataUniform(d)}let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`shader${this.vsName}-${this.fsName}`,`buffer ${l.varName} is missing!`)}else if(l.varType=="storage-read"){let c=this._bufferDic.get(l.varName);if(c){let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`buffer ${l.varName} is missing!`)}else if(l.varType=="var")if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f||(f=m.res.blackTexture,this.setTexture(c,f)),f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else{let c=this.textures[l.varName];if(c||(c=m.res.whiteTexture,this.setTexture(l.varName,c)),c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}}}let n=k.device.createBindGroup({layout:this.bindGroupLayouts[e],entries:i});this.bindGroups[e]=n}}createPipeline(e,t,a){let r=e,i=this.shaderState,n=[];for(const c of t.renderTargetTextures)n.push({format:c.format});for(let c=0;c<n.length;c++){const f=n[c];i.writeMasks&&i.writeMasks.length>0&&(f.writeMask=i.writeMasks[c])}if(t.outColor!=-1){let c=n[t.outColor];i.blendMode!=ae.NONE?c.blend=kc.getBlend(i.blendMode):delete c.blend}let o={label:this.vsName+"|"+this.fsName,layout:a,primitive:{topology:i.topology,cullMode:i.cullMode,frontFace:i.frontFace},vertex:void 0};this.vsEntryPoint!=""&&(o.vertex={module:this._vsShaderModule,entryPoint:this.vsEntryPoint,buffers:r.vertexBuffer.vertexBufferLayouts}),this.fsEntryPoint!=""&&(o.fragment={module:this._fsShaderModule,entryPoint:this.fsEntryPoint,targets:n}),i.multisample>0&&(o.multisample={count:i.multisample}),(t.zPreTexture||t.depthTexture)&&(i.blendMode!=ae.NONE,m.setting.render.zPrePass&&t.zPreTexture&&i.useZ?o.depthStencil={depthWriteEnabled:!1,depthCompare:et.less,format:t.zPreTexture.format}:o.depthStencil={depthWriteEnabled:i.depthWriteEnabled,depthCompare:i.depthCompare,format:t.depthTexture.format});let l=Fn.getSharePipeline(this.shaderVariant);l?this.pipeline=l:(this.pipeline=y.createPipeline(o),Fn.setSharePipeline(this.shaderVariant,this.pipeline))}createGroupLayouts(){this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroupLayouts=[xn.getGlobalDataBindGroupLayout()];for(let a=1;a<e.groups.length;a++){let r=e.groups[a];if(r){let i=this.getGroupLayout(a,r);this._groupsShaderReflectionVarInfos[a]=r;let n=k.device.createBindGroupLayout({entries:i,label:`vs${this.vsName} fs${this.fsName} ${r.length}`});this.bindGroupLayouts[a]=n}else console.error("can't set empty group!",a)}let t=k.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(V.TEXCOORD_1),a=e.hasAttribute(V.joints0),r=e.hasAttribute(V.a_morphPositions_0),i=e.hasAttribute(V.TANGENT),n=e.hasAttribute(V.color),o=this.shaderState.acceptGI,l=this.shaderState.useLight;t&&(this.defineValue.USE_SECONDUV=!0),a&&r?this.defineValue.USE_METAHUMAN=!0:(this.defineValue.USE_SKELETON=a,this.defineValue.USE_MORPHTARGETS=r),"USE_TANGENT"in this.defineValue||(this.defineValue.USE_TANGENT=i),this.defineValue.USE_GI=o,this.defineValue.USE_SHADOWMAPING=this.shaderState.acceptShadow,this.defineValue.USE_LIGHT=l,this.defineValue.USE_VERTXCOLOR=n,m.setting.pick.mode=="pixel"&&(this.defineValue.USE_WORLDPOS=!0),m.setting.gi.enable?this.defineValue.USEGI=!0:this.defineValue.USEGI=!1,m.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,m.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=m.setting.shadow.type=="PCF",this.defineValue.USE_HARD_SHADOW=m.setting.shadow.type=="HARD",this.defineValue.USE_SOFT_SHADOW=m.setting.shadow.type=="SOFT",this.defineValue.USE_CSM=Zt.Cascades>1,this.defineValue.USE_IES_PROFILE=ba.use}genReflection(){this.shaderVariant=Bt.genRenderShaderVariant(this);let e=Bt.poolGetReflection(this.shaderVariant);if(e)this.shaderReflection=e;else{let t=ra.parse(this._destVS,this.defineValue);t=ra.parse(t,this.defineValue),Bt.getShaderReflection2(t,this);let a=ra.parse(this._destFS,this.defineValue);a=ra.parse(a,this.defineValue),Bt.getShaderReflection2(a,this),Bt.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(me.getInstance().detached(a,this),e&&!me.getInstance().hasReference(a))a.destroy(e);else{a.destroy(!1);let r=me.getInstance().getReference(a);if(r){let i=[];r.forEach((n,o)=>{"name"in n?i.push(n.name):i.push("NaN")})}}}this.bindGroups.length=0,this.shaderState=null,this.textures=null,this.pipeline=null,this.bindGroupLayouts=null,this._sourceVS=null,this._sourceFS=null,this._destVS=null,this._destFS=null,this._vsShaderModule=null,this._fsShaderModule=null,this.materialDataUniformBuffer.destroy(e),this.materialDataUniformBuffer=null}static destroyShader(e){Ma.renderShader.has(e)&&(Ma.renderShader.get(e).destroy(),Ma.renderShader.delete(e))}static getShader(e){return Ma.renderShader.get(e)}static createShader(e,t){let a=new Ve(e,t);return Ma.renderShader.set(a.instanceID,a),a.instanceID}}class Lc extends Ve{constructor(){super("sky_vs_frag_wgsl","SkyGBuffer_fs"),this.passType=H.GI,this.setUniformVector3("eyesPos",new u),this.setUniformFloat("exposure",1),this.setUniformFloat("roughness",0);let e=this.shaderState;e.frontFace="ccw",e.cullMode=wt.front,e.depthWriteEnabled=!1,e.depthCompare=et.less}}class Gc extends Ve{transparency;constructor(){super("gbuffer_vs","gbuffer_fs"),this.setShaderEntry("VertMain","FragMain"),this.passType=H.GI,this.setUniformColor("baseColor",new P),this.setUniformColor("emissiveColor",new P),this.setUniformFloat("emissiveIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("alphaCutoff",1),this.blendMode=ae.NONE,this.setTexture("normalMap",m.res.normalTexture)}}class zc extends Ve{constructor(){super("shadowCastMap_vert","directionShadowCastMap_frag"),this.passType=H.SHADOW,this.setShaderEntry("main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",u.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Jc extends Ve{constructor(){super("castPointShadowMap_vert","shadowCastMap_frag"),this.passType=H.POINT_SHADOW,this.setShaderEntry("main","main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",u.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Wc extends Ve{constructor(){super("ZPass_shader_vs","ZPass_shader_vs"),this.passType=H.DEPTH,this.setShaderEntry("main"),this.useRz=!1;let e=this.shaderState;e.receiveEnv=!1}}class mi{static createGIPass(e,t){if(Wt.hasMask(e.rendererMask,Be.Sky)){if(!t.passShader.get(H.GI)){let r=t.getSubShaders(H.COLOR)[0],i=new Lc;i.setTexture("baseMap",r.getTexture("baseMap")),i.cullMode=r.cullMode,i.frontFace=r.frontFace,t.addRenderPass(i,0),i.preCompile(e.geometry)}}else this.castGBufferPass(e,t)}static castGBufferPass(e,t){let a=t.getDefaultShaders();for(let r=0;r<a.length;r++){const i=a[r];let n=t.getSubShaders(H.GI);if(!n||n.length==0||n.length<r){let o=new Gc;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=Wt.hasMask(e.rendererMask,Be.SkinnedMesh),r=e.geometry.hasAttribute(V.TANGENT),i=e.geometry.hasAttribute(Yt.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(Yt.MORPH_NORMAL_PREFIX+"0"),o=t.getSubShaders(H.COLOR);for(let l=0;l<o.length;l++){const c=o[l];let f=t.getSubShaders(H.SHADOW);if(!f||f.length<l+1){let h=new zc;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),c.cullMode=="none"?h.shaderState.cullMode="none":c.cullMode=="back"?h.shaderState.cullMode="front":c.cullMode=="front"&&(h.shaderState.cullMode="back"),h.preCompile(e.geometry),t.addRenderPass(h)}let d=t.getSubShaders(H.POINT_SHADOW);if(!d||d.length<l+1){let h=new Jc;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),h.setDefine("USE_ALPHACUT",1);for(let b=0;b<1;b++)r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),h.shaderState.cullMode="front",h.preCompile(e.geometry);t.addRenderPass(h)}}}static createDepthPass(e,t){let a=t.getSubShaders(H.COLOR),r=e.geometry.hasAttribute("TANGENT"),i=e.geometry.hasAttribute(Yt.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(Yt.MORPH_NORMAL_PREFIX+"0"),o=Wt.hasMask(e.rendererMask,Be.SkinnedMesh);for(let l=0;l<a.length;l++){const c=a[l];let f=t.getSubShaders(H.DEPTH);if(!f&&c.shaderState.useZ&&(!f||f.length<l)){let d=new Wc;d.setTexture("baseMap",c.getTexture("baseMap")),r||d.setDefine("USE_TANGENT",r),o&&d.setDefine("USE_SKELETON",o),i&&d.setDefine("USE_MORPHTARGETS",i),n&&d.setDefine("USE_MORPHNORMALS",n),d.cullMode=c.cullMode,d.frontFace=c.frontFace,d.preCompile(e.geometry),t.addRenderPass(d)}}}static createReflectionPass(e,t){let a=t.getDefaultShaders();for(let o=0;o<a.length;o++){const l=a[o];let c=t.getSubShaders(H.REFLECTION);if(!c||c.length==0||c.length<o){let f=new Ve(l.vsName,l.fsName);f.vsEntryPoint=l.vsEntryPoint,f.fsEntryPoint=l.fsEntryPoint,f.passType=H.REFLECTION;for(const d in l.shaderState){var r=l.shaderState[d];f.shaderState[d]=r}for(const d in l.textures){var i=l.getTexture(d);f.setTexture(d,i)}for(const d in l.uniforms){var n=l.getUniform(d);f.setUniform(d,n)}for(const d in l.defineValue){var n=l.defineValue[d];f.setDefine(d,n)}f.setDefine("USE_CASTREFLECTION",!0),f.preCompile(e.geometry),t.addRenderPass(f)}}}}class gr{static _v1=new u;static _v2=new u;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<gr.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=gr._v1,t=this.box.extents.clone();let a=this.level+1,r=0;for(let i=0;i<2;i++)for(let n=0;n<2;n++)for(let o=0;o<2;o++){const l=new ge;this.box.min.add(e.set(i,n,o).multiply(t),l.min),l.min.add(t,l.max),l.setFromMinMax(l.min,l.max);let c=new gr(l,r++,this,a);this.subTrees.push(c)}}}__rayCastTempVector=new u;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>gr.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>gr.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 Zc{_pool=[];_worldPosition=new u;_viewPosition=new u;_zSortList=[];pop(){return this._pool.pop()||{}}recycle(){for(let e of this._zSortList)e.z=0,e.userData=null,e.obj3d=null,this._pool.push(e);this._zSortList.length=0}sort(e,t,a,r){this._zSortList=[];for(let i of t){let n=this.pop();n.userData=i,n.obj3d=a(i),n.z=this.worldToCameraDepth(n.obj3d,e),this._zSortList.push(n)}this._zSortList.sort((i,n)=>i.z-n.z>0?1:-1),r||=[];for(let i of this._zSortList)r.push(i.userData);return this.recycle(),r}worldToCameraDepth(e,t){t||=e.transform.view3D.camera;let a=0;return t&&(this._worldPosition.copyFrom(e.transform.worldPosition),t.worldToScreenPoint(this._worldPosition,this._viewPosition),a=this._viewPosition.z),a}}let jc=new Zc;var Ai=(s=>(s[s.None=2]="None",s[s.StaticBatch=4]="StaticBatch",s[s.DynamicBatch=8]="DynamicBatch",s[s.Hiden=16]="Hiden",s))(Ai||{});class kn{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)!=0}}class Yc{opaqueList=[];transparentList=[];sky;clean(){this.opaqueList.length=0,this.transparentList.length=0}}class Xc{renderGroup;constructor(){this.renderGroup=new Map}collect_add(e){let t="",a="";t+=e.geometry.instanceID;for(let i=0;i<e.materials.length;i++){const n=e.materials[i];a+=n.shader.getDefaultColorShader().shaderVariant}let r=t+a;this.renderGroup.has(r)||this.renderGroup.set(r,{bundleMap:new Map,key:r,renderNodes:[]}),this.renderGroup.get(r).renderNodes.indexOf(e)==-1&&this.renderGroup.get(r).renderNodes.push(e)}}class Hc{renderShaderUpdateList=new Map;renderNodeList=new Map;collect_add(e){let t=e.transform.view3D;t&&e.materials&&e.materials.forEach(a=>{let r=this.renderShaderUpdateList.get(t);r||(r=new Map,this.renderShaderUpdateList.set(t,r));let i=this.renderNodeList.get(t);i||(i=new Map,this.renderNodeList.set(t,i)),i.set(e.instanceID,e);let n=a.getAllPass();for(let o=0;o<n.length;o++){const l=n[o];let c=`${e.geometry.instanceID+l.instanceID}`,f=r.get(c);f||(f=new Map,r.set(c,f)),f.set(e.instanceID,e)}})}collect_remove(e){let t=e.transform.view3D;if(t&&e.materials){let a=this.renderShaderUpdateList.get(t);a&&e.materials.forEach(r=>{let i=r.getAllPass();for(let n=0;n<i.length;n++){const o=i[n];let l=`${e.geometry.instanceID+o.instanceID}`;a.delete(l)}})}}}class J{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 J),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 Yc,this._renderShaderCollect=new Hc,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(Be.Sky))this.sky=t;else if(t.hasMask(Be.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(Be.Graphic3D))this._graphics.indexOf(t)==-1&&this._graphics.push(t);else if(kn.hasMask(t.renderLayer,Ai.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),m.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 Xc),r.get(e).collect_add(t)}t.object3D.renderNode=t,this._renderShaderCollect.collect_add(t)}getOctree(e){let t,a=m.setting.occlusionQuery.octree;if(a&&(t=this._octreeRenderNodes.get(e),!t)){let r=new u(a.x,a.y,a.z),i=new u(a.width,a.height,a.depth),n=new ge(r,i);t=new gr(n),this._octreeRenderNodes.set(e,t)}return t}removeRenderNode(e,t){if(t.detachSceneOctree(),t.hasMask(Be.Sky))this.sky=null;else if(t.hasMask(Be.Reflection)){let a=this._reflections.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}else if(kn.hasMask(t.renderLayer,Ai.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>=m.setting.light.maxLight){console.warn("Alreay meet maxmium light number:",m.setting.light.maxLight);return}a.indexOf(t)!=-1||a.push(t)}}removeLight(e,t){if(this._sceneLights.has(e)){let a=this._sceneLights.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getLights(e){let t=this._sceneLights.get(e);return t||[]}addGIProbe(e,t){this._sceneGIProbes.has(e)?this._sceneGIProbes.get(e).push(t):this._sceneGIProbes.set(e,[t])}removeGIProbe(e,t){if(this._sceneGIProbes.has(e)){let a=this._sceneGIProbes.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getProbes(e){let t=this._sceneGIProbes.get(e);return t||[]}getReflections(e){let t=this._reflections.get(e);return t||[]}autoSortRenderNodes(e){let t=this._tr_RenderNodes.get(e);if(!t)return;let a=!1;for(const r of t)if(r.isRenderOrderChange||r.needSortOnCameraZ){a=!0;break}if(a){for(const r of t){let i=r.renderOrder;if(r.needSortOnCameraZ){let n=jc.worldToCameraDepth(r.object3D);n=1-Math.max(0,Math.min(1,n)),i+=n}r.__renderOrder=i,r.isRenderOrderChange=!1}t.sort((r,i)=>r.__renderOrder>i.__renderOrder?1:-1)}return this}getRenderNodes(e,t){if(this.autoSortRenderNodes(e),this._collectInfo.clean(),this._collectInfo.sky=this.sky,m.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 Kc{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 b2=Object.defineProperty,g2=Object.getOwnPropertyDescriptor,En=(s,e,t,a)=>{for(var r=g2(e,t),i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(e,t,r)||r);return r&&b2(e,t,r),r};class Na extends Pe{instanceCount=0;lodLevel=0;alwaysRender=!1;instanceID;drawType=0;_geometry;_materials=[];_castShadow=!0;_castReflection=!0;_castGI=!1;_rendererMask=Be.Default;_inRenderer=!1;_readyPipeline=!1;_combineShaderRefection;_ignoreEnvMap;_ignorePrefilterMap;__renderOrder=0;_renderOrder=0;_passInit=new Map;isRenderOrderChange;needSortOnCameraZ;isRecievePostEffectUI;_octreeBinder;_renderLayer=Ai.None;_computes;init(e){this.renderOrder=0,this.rendererMask=Be.Default,this.instanceID=on().toString(),this._computes=[]}attachSceneOctree(e){this._octreeBinder={octree:e,entity:new Kc(this)},this.transform.eventDispatcher.addEventListener(Qt.LOCAL_ONCHANGE,this.updateOctreeEntity,this)}detachSceneOctree(){this._octreeBinder&&(this._octreeBinder.entity?.leaveNode(),this.transform.eventDispatcher.removeEventListener(Qt.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&&me.getInstance().detached(this._geometry,this),e&&me.getInstance().attached(e,this)),this._geometry=e}addMask(e){this._rendererMask=Wt.addMask(this.rendererMask,e)}removeMask(e){this._rendererMask=Wt.removeMask(this.rendererMask,e)}hasMask(e){return Wt.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];me.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];me.getInstance().attached(r,this),r.shader&&r.shader.computes&&this.addComputes(r.shader.computes)}this._materials=e;let t=0;for(let a=0;a<e.length;a++){const n=e[a].getPass(H.COLOR)[0];n.shaderState.transparent&&(t=t>n.renderOrder?t:n.renderOrder)}this.renderOrder=t,this._readyPipeline||this.initPipeline()}addComputes(e){this._computes.push(...e)}removeComputes(e){for(const t of e){let a=this._computes.indexOf(t);a!=-1&&this._computes.splice(a,1)}}addRendererMask(e){this._rendererMask=Wt.addMask(this._rendererMask,e)}removeRendererMask(e){this._rendererMask=Wt.removeMask(this._rendererMask,e)}onEnable(){this._readyPipeline||this.initPipeline(),J.instance.addRenderNode(this.transform.scene3D,this),this.updateOctreeEntity()}onDisable(){this._enable=!1,J.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(H.COLOR);for(let i=0;i<r.length;i++){const n=r[i];n.shaderReflection||n.preCompile(this._geometry),this._geometry.generate(n.shaderReflection)}this.object3D.bound=this._geometry.bounds.clone()}this._readyPipeline=!0;let e=0;for(let t=0;t<this.materials.length;t++){const i=this.materials[t].getPass(H.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&&J.instance.addRenderNode(this.transform.scene3D,this)}}castNeedPass(){if(this.castGI)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];mi.createGIPass(this,a.shader)}for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castShadow&&mi.createShadowPass(this,a.shader)}if(this.castReflection)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castReflection&&mi.createReflectionPass(this,a.shader)}if(!Wt.hasMask(this.rendererMask,Be.IgnoreDepthPass)&&m.setting.render.zPrePass)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];mi.createDepthPass(this,a.shader)}else for(let t=0;t<this.materials.length;t++)this.materials[t].shader.removeShaderByIndex(H.DEPTH,0)}get castShadow(){return this._castShadow}set castShadow(e){this._castShadow=e}get castGI(){return this._castGI}set castGI(e){this._castGI=e}get castReflection(){return this._castReflection}set castReflection(e){this._castReflection=e}renderPass(e,t,a){if(!this._geometry)return;let r=this,i=r.transform._worldMatrix;const n=Math.max(r.materials.length,r._geometry.subGeometries.length);for(let o=0;o<n;o++){const l=o>=r.materials.length?r.materials[0]:r.materials[o];if(!l||!l.enable)continue;let c=l.getPass(t);if(!(!c||c.length==0)){y.bindGeometryBuffer(a.encoder,r._geometry),Ye.viewCount_vertex(e,H[t],r._geometry.vertexCount);for(let f=0;f<c.length;f++){if(!c||c.length==0)continue;const h=c[f];if(h.pipeline){h.shaderState.splitTexture&&(a.endRenderPass(),vt.WriteSplitColorTexture(r.instanceID),a.beginOpaqueRenderPass(),y.bindCamera(a.encoder,e.camera),y.bindGeometryBuffer(a.encoder,r._geometry)),y.bindPipeline(a.encoder,h)&&Ye.viewCount_pipeline(e,H[t]);let A=(o>=r._geometry.subGeometries.length?r._geometry.subGeometries[0]:r._geometry.subGeometries[o]).lodLevels[r.lodLevel];r.instanceCount>0?(Ye.viewCount_instance(e,H[t],r.instanceCount),Ye.viewCount_indices(e,H[t],A.indexCount),Ye.viewCount_tri(e,H[t],A.indexCount/3*r.instanceCount),y.drawIndexed(a.encoder,A.indexCount,r.instanceCount,A.indexStart,0,0)):(Ye.viewCount_indices(e,H[t],A.indexCount),Ye.viewCount_tri(e,H[t],A.indexCount/3),y.drawIndexed(a.encoder,A.indexCount,1,A.indexStart,0,i.index)),Ye.viewCount_draw(e,H[t])}}}}}renderPass2(e,t,a,r,i,n=!1){if(!this.enable||!this._geometry)return;let o=this,l=o.object3D.transform._worldMatrix;for(let c=0;c<this.materials.length;c++){const f=this.materials[c];if(!f.castShadow&&t==H.SHADOW)continue;let d=f.getPass(t);if(!d||d.length==0)return;if(this.drawType==2)for(let h of d)h.pipeline&&(y.bindPipeline(i,h),y.draw(i,6,1,0,l.index));else{y.bindGeometryBuffer(i,o._geometry);for(let h of d)if(h.pipeline){y.bindPipeline(i,h);let A=o._geometry.subGeometries[c].lodLevels[o.lodLevel];y.drawIndexed(i,A.indexCount,1,A.indexStart,0,l.index)}}}}recordRenderPass2(e,t,a,r,i,n=!1){if(!this.enable)return;let o=this;for(let l=0;l<this.materials.length;l++){let f=this.materials[l].getPass(t);if(!f||f.length==0)return;let d=o.object3D.transform._worldMatrix;for(let h=0;h<f.length;h++){const b=f[h];y.bindPipeline(i,b);let D=o._geometry.subGeometries[l].lodLevels[o.lodLevel];y.drawIndexed(i,D.indexCount,1,D.indexStart,0,d.index)}}}noticeShaderChange(){this.enable&&(this.onEnable(),this._passInit.forEach((e,t)=>{this._passInit.set(t,!1)}))}preInit(e){return this._passInit.get(e)}nodeUpdate(e,t,a,r){let i=this,n=e.scene.envMap;for(let o=0;o<i.materials.length;o++){let c=i.materials[o].getPass(t);if(c)for(let f=0;f<c.length;f++){const h=c[f];if(h.shaderState.splitTexture){let U=vt.CreateSplitTexture(i.instanceID);h.setTexture("splitTexture_Map",U)}!i._ignoreEnvMap&&h.envMap!=n&&h.setTexture("envMap",n),h.prefilterMap||h.setTexture("prefilterMap",n);let b=oe.getReflectionEntries(e.scene);if(!h.reflectionMap&&b&&b.reflectionMap&&(h.setTexture("reflectionMap",b.reflectionMap),h.setStorageBuffer("reflectionBuffer",b.storageGPUBuffer)),h.pipeline){h.apply(i._geometry,a,()=>i.noticeShaderChange());continue}let p=m.res.getTexture("BRDFLUT");h.setTexture("brdflutMap",p);let g=m.getRenderJob(e).shadowMapPassRenderer;g&&g.depth2DArrayTexture&&h.setTexture("shadowMap",m.getRenderJob(e).shadowMapPassRenderer.depth2DArrayTexture);let A=m.getRenderJob(e).pointLightShadowRenderer;A&&A.cubeArrayTexture&&h.setTexture("pointShadowMap",A.cubeArrayTexture);let D=ba.iesTexture;D&&h.setTexture("iesTextureArrayMap",D),a.irradianceBuffer&&a.irradianceBuffer.length>0&&(h.setTexture("irradianceMap",a.irradianceBuffer[0]),h.setTexture("irradianceDepthMap",a.irradianceBuffer[1]));let _=oe.getLightEntries(e.scene);_&&(h.setStorageBuffer("lightBuffer",_.storageGPUBuffer),_.irradianceVolume&&h.setUniformBuffer("irradianceData",_.irradianceVolume.irradianceVolumeBuffer)),r&&(h.setStorageBuffer("clustersUniform",r.clustersUniformBuffer),h.setStorageBuffer("lightAssignBuffer",r.lightAssignBuffer),h.setStorageBuffer("assignTable",r.assignTableBuffer),h.setStorageBuffer("clusterBuffer",r.clusterBuffer)),h.apply(i._geometry,a),this._passInit.set(t,!0)}}}beforeDestroy(e){me.getInstance().detached(this._geometry,this),me.getInstance().hasReference(this._geometry)||this._geometry.destroy(e);for(let t=0;t<this._materials.length;t++){const a=this._materials[t];me.getInstance().detached(a,this),me.getInstance().hasReference(a)||a.destroy(e)}super.beforeDestroy(e)}destroy(e){super.destroy(e),this._geometry=void 0,this._materials.length=0,this._combineShaderRefection=void 0}}En([jr],Na.prototype,"materials"),En([jr],Na.prototype,"castShadow"),En([jr],Na.prototype,"castGI");class mt{instanceID;name;enable=!0;_defaultSubShader;_shader;constructor(){this.instanceID=Et()}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(H.COLOR)}clone(){let e=new mt;return e.shader=this.shader.clone(),e}destroy(e){this.name=null,this.instanceID=null,this._shader.destroy(),this._shader=null}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 qc=`
|
|
5745
|
+
`}return a}return a}}function Xt(s){switch(s){case"int":return"i32";case"int[]":return"array<i32>";case"uint":return"u32";case"uint[]":return"array<u32>";case"float":return"f32";case"float[]":return"array<f32>";case"vec2":return"vec2<f32>";case"vec3":return"vec3<f32>";case"vec4":return"vec4<f32>";case"vec2[]":return"array<vec2<f32>>";case"vec3[]":return"array<vec3<f32>>";case"vec4[]":return"array<vec4<f32>>";case"ivec2":return"vec2<i32>";case"ivec3":return"vec3<i32>";case"ivec4":return"vec4<i32>";case"ivec2[]":return"array<vec2<i32>>";case"ivec3[]":return"array<vec3<i32>>";case"ivec4[]":return"array<vec4<i32>>";case"mat2":return"mat2x2<f32>";case"mat2x2":return"mat2x2<f32>";case"mat2x3":return"mat2x3<f32>";case"mat2x4":return"mat2x4<f32>";case"mat2[]":return"array<mat2x2<f32>>";case"mat2x2[]":return"array<mat2x2<f32>>";case"mat2x3[]":return"array<mat2x3<f32>>";case"mat2x4[]":return"array<mat2x4<f32>>";case"mat3":return"mat3x3<f32>";case"mat3x2":return"mat3x2<f32>";case"mat3x3":return"mat3x3<f32>";case"mat3x4":return"mat3x4<f32>";case"mat3[]":return"array<mat3x3<f32>>";case"mat3x2[]":return"array<mat3x2<f32>>";case"mat3x3[]":return"array<mat3x3<f32>>";case"mat3x4[]":return"array<mat3x4<f32>>";case"mat4":return"mat4x4<f32>";case"mat4x2":return"mat4x2<f32>";case"mat4x3":return"mat4x3<f32>";case"mat4x4":return"mat4x4<f32>";case"mat4[]":return"array<mat4x4<f32>>";case"mat4x2[]":return"array<mat4x2<f32>>";case"mat4x3[]":return"array<mat4x3<f32>>";case"mat4x4[]":return"array<mat4x4<f32>>";case"texture2D":return"texture_2d<f32>"}return s}class Mc{_lexer;_rootNode;constructor(e){this._lexer=e,this._rootNode=new ye,this.parse()}get lexer(){return this._lexer}parse(){for(;this.peekToken(0).Type!==B.EOF;){if(this.peekToken(0).Type==B.SEMICOLON){this.skipToken(1);continue}let e=this.parseStatement();e!==null&&this._rootNode.addNode(e)}}parseStatement(){let e=this.peekToken();if(e.Type==B.LAYOUT&&this.peekToken(1).Type==B.LEFTSAMLL)return Ki.parse(this._lexer);if(e.Type==B.STRUCT)return this.skipToken(1),Oa.parse(this._lexer);if((e.isBuiltinType()||e.Type==B.VOID)&&this.peekToken(1).Type==B.IDENT&&this.peekToken(2).Type==B.LEFTSAMLL)return zs.parse(this._lexer);if(e.Type==B.CONST&&this.peekToken(1).isDataType())return Ge.parse(this._lexer);if(e.isDataType()&&this.peekToken(1).Type==B.IDENT)return Ge.parse(this._lexer);if(e.Type==B.OUT&&this.peekToken(1).isDataType()&&this.peekToken(2).Type==B.IDENT)return Ge.parse(this._lexer);if(e.Type==B.PRECISION)return Zs.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 Nc{static VertexShader="VertexShader";static FragmentShader="FragmentShader";static convertGLSL(e){var t=new Rc(e),a=new wc(t),r=new Mc(a),i=new Ic(r);return i.generateWGSL()}}class Cn{setID=0;bindingID=0;name="";type=""}class Sn{name="";type="";locationID=0;builtinName="";isBuiltinAttribute(){return this.builtinName!=""}}class Vc{uniformInfo=[];inputAttribute=[];outputAttribute=[];sourceCode=""}var ia=(s=>(s[s.vertex=0]="vertex",s[s.fragment=1]="fragment",s[s.computer=2]="computer",s))(ia||{});class Pc{blendMode=ae.NONE;depthCompare=et.less_equal;depthWriteEnabled=!0;frontFace="ccw";cullMode=wt.back;topology=cn.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 Oc extends Qa{uniformNodes=[];_onChange=!0;constructor(){super(),this.bufferType=aa.MaterialDataUniformGPUBuffer}initDataUniform(e){this.uniformNodes=e;let t=0;for(const a in e){const r=e[a];r||console.error(a,"is empty"),t+=r.size*4}t=Math.floor(t/256+1)*256,this.createBuffer(GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,t/4,null,"MaterialDataUniformGPUBuffer");for(const a in e){const r=e[a];r||console.error(a,"is empty");let i=this.memory.allocation_node(r.size*4);r.memoryInfo=i,r.bindOnChange=()=>this.onChange()}}onChange(){this._onChange=!0}apply(){if(this.uniformNodes.length!=0&&this._onChange){for(const e in this.uniformNodes)this.uniformNodes[e].update();super.apply(),this._onChange=!1}}}class Ma{static renderShaderModulePool;static renderShader;static init(){this.renderShaderModulePool=new Map,this.renderShader=new Map}}class ge{reference;static _ins;static getInstance(){return this._ins||=new ge,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 Fn{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 Ve extends ln{passType=H.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 z||console.error("Shader Not Register, Please Register Shader!",this.vsName),this.fsName in z||console.error("Shader Not Register, Please Register Shader!",this.fsName),z[this.vsName]&&(this._sourceVS=z[this.vsName]),z[this.fsName]&&(this._sourceFS=z[this.fsName]),this.textures={},this.bindGroups=[],this.shaderState=new Pc,this.materialDataUniformBuffer=new Oc,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==wt.none}set doubleSide(e){let t=e?wt.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}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(ia.vertex,this._destVS,t),this.compileShader(ia.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=Bt.genRenderShaderVariant(this),this.reBuild(e,t),this._valueChange=!1,a&&a())}preCompile(e){this.preDefine(e),this.preCompileShader(ia.vertex,this._sourceVS.concat()),this.preCompileShader(ia.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),m.setting.render.useCompressGBuffer?this.defineValue.USE_COMPRESSGBUFFER=!0:this.defineValue.USE_COMPRESSGBUFFER=!1,ra.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=Nc.convertGLSL(r);r=i.sourceCode}for(const n in this.constValues)if(Object.prototype.hasOwnProperty.call(this.constValues,n)){const o=this.constValues[n];r=r.replaceAll(`&${n}`,o.toString())}switch(e){case ia.vertex:this._destVS=r;break;case ia.fragment:this._destFS=r;break}}compileShader(e,t,a){let r=t;r=this.applyPostDefine(r,a);let i=t;for(let o in this.defineValue)i+=`${o}=${this.defineValue[o]},`;let n=Ma.renderShaderModulePool.get(i);switch(n||(r=this.applyPostDefine(r,a),n=k.device.createShaderModule({label:e==ia.vertex?this.vsName:this.fsName,code:r}),n.getCompilationInfo().then(o=>{o.messages.length>0&&(console.log(r),console.log(o))}),Ma.renderShaderModulePool.set(i,n)),e){case ia.vertex:this._vsShaderModule=n,this._destVS=r;break;case ia.fragment:this._fsShaderModule=n,this._destFS=r;break}}getGroupLayout(e,t){let a=[];for(let r=0;r<t.length;r++){const i=t[r];if(i)if(i.varType=="uniform"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"uniform"}};a.push(o)}else if(i.varType=="storage-read"){this._bufferDic.has(i.varName)||console.error(`not set ${i.varName} buffer`);let n=this._bufferDic.get(i.varName).visibility,o={binding:i.binding,visibility:n,buffer:{type:"read-only-storage"}};a.push(o)}else if(i.varType=="var")switch(i.dataType){case"sampler":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:m.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.samplerBindingLayout};a.push(l),this._textureGroup=e}break;case"sampler_comparison":{let n=i.varName.replace("Sampler",""),o=this.textures[n]?this.textures[n]:m.res.redTexture,l={binding:i.binding,visibility:o.visibility,sampler:o.sampler_comparisonBindingLayout};a.push(l),this._textureGroup=e}break;case"texture_2d<f32>":case"texture_2d_array<f32>":case"texture_cube<f32>":case"texture_depth_2d":case"texture_depth_2d_array":case"texture_depth_cube":case"texture_depth_cube_array":{let n=this.textures[i.varName]?this.textures[i.varName]:m.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,ge.getInstance().attached(n,this)}break;case"texture_external":{let n=this.textures[i.varName]?this.textures[i.varName]:m.res.redTexture,o={binding:i.binding,visibility:n.visibility,externalTexture:{}};a.push(o),this._textureGroup=e,ge.getInstance().attached(n,this)}break;default:{let n=this.textures[i.varName]?this.textures[i.varName]:m.res.redTexture,o={binding:i.binding,visibility:n.visibility,texture:n.textureBindingLayout};a.push(o),this._textureGroup=e,ge.getInstance().attached(n,this)}break}else{debugger;console.error("bind group can't empty")}}return a}_cacheEntries;genGroups(e,t,a=!1){if(!this.bindGroups[e]||a){const r=t[e];let i=[];for(let o=0;o<r.length;o++){const l=r[o];if(l){if(l.varType=="uniform"){let c=this._bufferDic.get(l.varName);if(c){if(c.bufferType==aa.MaterialDataUniformGPUBuffer){let d=[];for(let h=0;h<l.dataFields.length;h++){const b=l.dataFields[h];this.uniforms[b.name]||console.error(`shader-${this.vsName}:${this.fsName} ${b.name}is empty`),d.push(this.uniforms[b.name])}this.materialDataUniformBuffer.initDataUniform(d)}let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`shader${this.vsName}-${this.fsName}`,`buffer ${l.varName} is missing!`)}else if(l.varType=="storage-read"){let c=this._bufferDic.get(l.varName);if(c){let f={binding:l.binding,resource:{buffer:c.buffer,offset:0,size:c.memory.shareDataBuffer.byteLength}};i.push(f),this.checkBuffer(l.varName,c)}else console.error(`buffer ${l.varName} is missing!`)}else if(l.varType=="var")if(l.dataType=="sampler"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f||(f=m.res.blackTexture,this.setTexture(c,f)),f){let d={binding:l.binding,resource:f.gpuSampler};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else if(l.dataType=="sampler_comparison"){let c=l.varName.replace("Sampler",""),f=this.textures[c];if(f){let d={binding:l.binding,resource:f.gpuSampler_comparison};i.push(d)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}else{let c=this.textures[l.varName];if(c||(c=m.res.whiteTexture,this.setTexture(l.varName,c)),c){let f={binding:l.binding,resource:c.getGPUView()};i.push(f)}else console.error(`shader${this.vsName}-${this.fsName}`,`texture ${l.varName} is missing! `)}}}let n=k.device.createBindGroup({layout:this.bindGroupLayouts[e],entries:i});this.bindGroups[e]=n}}createPipeline(e,t,a){let r=e,i=this.shaderState,n=[];for(const c of t.renderTargetTextures)n.push({format:c.format});for(let c=0;c<n.length;c++){const f=n[c];i.writeMasks&&i.writeMasks.length>0&&(f.writeMask=i.writeMasks[c])}if(t.outColor!=-1){let c=n[t.outColor];i.blendMode!=ae.NONE?c.blend=kc.getBlend(i.blendMode):delete c.blend}let o={label:this.vsName+"|"+this.fsName,layout:a,primitive:{topology:i.topology,cullMode:i.cullMode,frontFace:i.frontFace},vertex:void 0};this.vsEntryPoint!=""&&(o.vertex={module:this._vsShaderModule,entryPoint:this.vsEntryPoint,buffers:r.vertexBuffer.vertexBufferLayouts}),this.fsEntryPoint!=""&&(o.fragment={module:this._fsShaderModule,entryPoint:this.fsEntryPoint,targets:n}),i.multisample>0&&(o.multisample={count:i.multisample}),(t.zPreTexture||t.depthTexture)&&(i.blendMode!=ae.NONE,m.setting.render.zPrePass&&t.zPreTexture&&i.useZ?o.depthStencil={depthWriteEnabled:!1,depthCompare:et.less,format:t.zPreTexture.format}:o.depthStencil={depthWriteEnabled:i.depthWriteEnabled,depthCompare:i.depthCompare,format:t.depthTexture.format});let l=Fn.getSharePipeline(this.shaderVariant);l?this.pipeline=l:(this.pipeline=y.createPipeline(o),Fn.setSharePipeline(this.shaderVariant,this.pipeline))}createGroupLayouts(){this._groupsShaderReflectionVarInfos=[];let e=this.shaderReflection;this.bindGroupLayouts=[xn.getGlobalDataBindGroupLayout()];for(let a=1;a<e.groups.length;a++){let r=e.groups[a];if(r){let i=this.getGroupLayout(a,r);this._groupsShaderReflectionVarInfos[a]=r;let n=k.device.createBindGroupLayout({entries:i,label:`vs${this.vsName} fs${this.fsName} ${r.length}`});this.bindGroupLayouts[a]=n}else console.error("can't set empty group!",a)}let t=k.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(V.TEXCOORD_1),a=e.hasAttribute(V.joints0),r=e.hasAttribute(V.a_morphPositions_0),i=e.hasAttribute(V.TANGENT),n=e.hasAttribute(V.color),o=this.shaderState.acceptGI,l=this.shaderState.useLight;t&&(this.defineValue.USE_SECONDUV=!0),a&&r?this.defineValue.USE_METAHUMAN=!0:(this.defineValue.USE_SKELETON=a,this.defineValue.USE_MORPHTARGETS=r),"USE_TANGENT"in this.defineValue||(this.defineValue.USE_TANGENT=i),this.defineValue.USE_GI=o,this.defineValue.USE_SHADOWMAPING=this.shaderState.acceptShadow,this.defineValue.USE_LIGHT=l,this.defineValue.USE_VERTXCOLOR=n,m.setting.pick.mode=="pixel"&&(this.defineValue.USE_WORLDPOS=!0),m.setting.gi.enable?this.defineValue.USEGI=!0:this.defineValue.USEGI=!1,m.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,m.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=m.setting.shadow.type=="PCF",this.defineValue.USE_HARD_SHADOW=m.setting.shadow.type=="HARD",this.defineValue.USE_SOFT_SHADOW=m.setting.shadow.type=="SOFT",this.defineValue.USE_CSM=Zt.Cascades>1,this.defineValue.USE_IES_PROFILE=ba.use}genReflection(){this.shaderVariant=Bt.genRenderShaderVariant(this);let e=Bt.poolGetReflection(this.shaderVariant);if(e)this.shaderReflection=e;else{let t=ra.parse(this._destVS,this.defineValue);t=ra.parse(t,this.defineValue),Bt.getShaderReflection2(t,this);let a=ra.parse(this._destFS,this.defineValue);a=ra.parse(a,this.defineValue),Bt.getShaderReflection2(a,this),Bt.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(ge.getInstance().detached(a,this),e&&!ge.getInstance().hasReference(a))a.destroy(e);else{a.destroy(!1);let r=ge.getInstance().getReference(a);if(r){let i=[];r.forEach((n,o)=>{"name"in n?i.push(n.name):i.push("NaN")})}}}this.bindGroups.length=0,this.shaderState=null,this.textures=null,this.pipeline=null,this.bindGroupLayouts=null,this._sourceVS=null,this._sourceFS=null,this._destVS=null,this._destFS=null,this._vsShaderModule=null,this._fsShaderModule=null,this.materialDataUniformBuffer.destroy(e),this.materialDataUniformBuffer=null}static destroyShader(e){Ma.renderShader.has(e)&&(Ma.renderShader.get(e).destroy(),Ma.renderShader.delete(e))}static getShader(e){return Ma.renderShader.get(e)}static createShader(e,t){let a=new Ve(e,t);return Ma.renderShader.set(a.instanceID,a),a.instanceID}}class Lc extends Ve{constructor(){super("sky_vs_frag_wgsl","SkyGBuffer_fs"),this.passType=H.GI,this.setUniformVector3("eyesPos",new u),this.setUniformFloat("exposure",1),this.setUniformFloat("roughness",0);let e=this.shaderState;e.frontFace="ccw",e.cullMode=wt.front,e.depthWriteEnabled=!1,e.depthCompare=et.less}}class Gc extends Ve{transparency;constructor(){super("gbuffer_vs","gbuffer_fs"),this.setShaderEntry("VertMain","FragMain"),this.passType=H.GI,this.setUniformColor("baseColor",new P),this.setUniformColor("emissiveColor",new P),this.setUniformFloat("emissiveIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("alphaCutoff",1),this.blendMode=ae.NONE,this.setTexture("normalMap",m.res.normalTexture)}}class zc extends Ve{constructor(){super("shadowCastMap_vert","directionShadowCastMap_frag"),this.passType=H.SHADOW,this.setShaderEntry("main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",u.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Jc extends Ve{constructor(){super("castPointShadowMap_vert","shadowCastMap_frag"),this.passType=H.POINT_SHADOW,this.setShaderEntry("main","main"),this.setUniformFloat("cameraFar",5e3),this.setUniformVector3("lightWorldPos",u.ZERO),this.shaderState.receiveEnv=!1,this.shaderState.castShadow=!1,this.shaderState.acceptShadow=!1,this.setDefine("USE_ALPHACUT",!0)}}class Wc extends Ve{constructor(){super("ZPass_shader_vs","ZPass_shader_vs"),this.passType=H.DEPTH,this.setShaderEntry("main"),this.useRz=!1;let e=this.shaderState;e.receiveEnv=!1}}class mi{static createGIPass(e,t){if(Wt.hasMask(e.rendererMask,Be.Sky)){if(!t.passShader.get(H.GI)){let r=t.getSubShaders(H.COLOR)[0],i=new Lc;i.setTexture("baseMap",r.getTexture("baseMap")),i.cullMode=r.cullMode,i.frontFace=r.frontFace,t.addRenderPass(i,0),i.preCompile(e.geometry)}}else this.castGBufferPass(e,t)}static castGBufferPass(e,t){let a=t.getDefaultShaders();for(let r=0;r<a.length;r++){const i=a[r];let n=t.getSubShaders(H.GI);if(!n||n.length==0||n.length<r){let o=new Gc;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=Wt.hasMask(e.rendererMask,Be.SkinnedMesh),r=e.geometry.hasAttribute(V.TANGENT),i=e.geometry.hasAttribute(Yt.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(Yt.MORPH_NORMAL_PREFIX+"0"),o=t.getSubShaders(H.COLOR);for(let l=0;l<o.length;l++){const c=o[l];let f=t.getSubShaders(H.SHADOW);if(!f||f.length<l+1){let h=new zc;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),c.cullMode=="none"?h.shaderState.cullMode="none":c.cullMode=="back"?h.shaderState.cullMode="front":c.cullMode=="front"&&(h.shaderState.cullMode="back"),h.preCompile(e.geometry),t.addRenderPass(h)}let d=t.getSubShaders(H.POINT_SHADOW);if(!d||d.length<l+1){let h=new Jc;h.setTexture("baseMap",c.getTexture("baseMap")),h.setUniform("alphaCutoff",c.getUniform("alphaCutoff")),h.setDefine("USE_ALPHACUT",1);for(let b=0;b<1;b++)r&&h.setDefine("USE_TANGENT",r),a&&h.setDefine("USE_SKELETON",a),i&&h.setDefine("USE_MORPHTARGETS",i),n&&h.setDefine("USE_MORPHNORMALS",n),h.shaderState.cullMode="front",h.preCompile(e.geometry);t.addRenderPass(h)}}}static createDepthPass(e,t){let a=t.getSubShaders(H.COLOR),r=e.geometry.hasAttribute("TANGENT"),i=e.geometry.hasAttribute(Yt.MORPH_POSITION_PREFIX+"0"),n=e.geometry.hasAttribute(Yt.MORPH_NORMAL_PREFIX+"0"),o=Wt.hasMask(e.rendererMask,Be.SkinnedMesh);for(let l=0;l<a.length;l++){const c=a[l];let f=t.getSubShaders(H.DEPTH);if(!f&&c.shaderState.useZ&&(!f||f.length<l)){let d=new Wc;d.setTexture("baseMap",c.getTexture("baseMap")),r||d.setDefine("USE_TANGENT",r),o&&d.setDefine("USE_SKELETON",o),i&&d.setDefine("USE_MORPHTARGETS",i),n&&d.setDefine("USE_MORPHNORMALS",n),d.cullMode=c.cullMode,d.frontFace=c.frontFace,d.preCompile(e.geometry),t.addRenderPass(d)}}}static createReflectionPass(e,t){let a=t.getDefaultShaders();for(let o=0;o<a.length;o++){const l=a[o];let c=t.getSubShaders(H.REFLECTION);if(!c||c.length==0||c.length<o){let f=new Ve(l.vsName,l.fsName);f.vsEntryPoint=l.vsEntryPoint,f.fsEntryPoint=l.fsEntryPoint,f.passType=H.REFLECTION;for(const d in l.shaderState){var r=l.shaderState[d];f.shaderState[d]=r}for(const d in l.textures){var i=l.getTexture(d);f.setTexture(d,i)}for(const d in l.uniforms){var n=l.getUniform(d);f.setUniform(d,n)}for(const d in l.defineValue){var n=l.defineValue[d];f.setDefine(d,n)}f.setDefine("USE_CASTREFLECTION",!0),f.preCompile(e.geometry),t.addRenderPass(f)}}}}class gr{static _v1=new u;static _v2=new u;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<gr.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=gr._v1,t=this.box.extents.clone();let a=this.level+1,r=0;for(let i=0;i<2;i++)for(let n=0;n<2;n++)for(let o=0;o<2;o++){const l=new pe;this.box.min.add(e.set(i,n,o).multiply(t),l.min),l.min.add(t,l.max),l.setFromMinMax(l.min,l.max);let c=new gr(l,r++,this,a);this.subTrees.push(c)}}}__rayCastTempVector=new u;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>gr.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>gr.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 Zc{_pool=[];_worldPosition=new u;_viewPosition=new u;_zSortList=[];pop(){return this._pool.pop()||{}}recycle(){for(let e of this._zSortList)e.z=0,e.userData=null,e.obj3d=null,this._pool.push(e);this._zSortList.length=0}sort(e,t,a,r){this._zSortList=[];for(let i of t){let n=this.pop();n.userData=i,n.obj3d=a(i),n.z=this.worldToCameraDepth(n.obj3d,e),this._zSortList.push(n)}this._zSortList.sort((i,n)=>i.z-n.z>0?1:-1),r||=[];for(let i of this._zSortList)r.push(i.userData);return this.recycle(),r}worldToCameraDepth(e,t){t||=e.transform.view3D.camera;let a=0;return t&&(this._worldPosition.copyFrom(e.transform.worldPosition),t.worldToScreenPoint(this._worldPosition,this._viewPosition),a=this._viewPosition.z),a}}let jc=new Zc;var Ai=(s=>(s[s.None=2]="None",s[s.StaticBatch=4]="StaticBatch",s[s.DynamicBatch=8]="DynamicBatch",s[s.Hiden=16]="Hiden",s))(Ai||{});class kn{static addMask(e,t){return e|t}static removeMask(e,t){return e&~t}static hasMask(e,t){return(e&t)!=0}}class Yc{opaqueList=[];transparentList=[];sky;clean(){this.opaqueList.length=0,this.transparentList.length=0}}class Xc{renderGroup;constructor(){this.renderGroup=new Map}collect_add(e){let t="",a="";t+=e.geometry.instanceID;for(let i=0;i<e.materials.length;i++){const n=e.materials[i];a+=n.shader.getDefaultColorShader().shaderVariant}let r=t+a;this.renderGroup.has(r)||this.renderGroup.set(r,{bundleMap:new Map,key:r,renderNodes:[]}),this.renderGroup.get(r).renderNodes.indexOf(e)==-1&&this.renderGroup.get(r).renderNodes.push(e)}}class Hc{renderShaderUpdateList=new Map;renderNodeList=new Map;collect_add(e){let t=e.transform.view3D;t&&e.materials&&e.materials.forEach(a=>{let r=this.renderShaderUpdateList.get(t);r||(r=new Map,this.renderShaderUpdateList.set(t,r));let i=this.renderNodeList.get(t);i||(i=new Map,this.renderNodeList.set(t,i)),i.set(e.instanceID,e);let n=a.getAllPass();for(let o=0;o<n.length;o++){const l=n[o];let c=`${e.geometry.instanceID+l.instanceID}`,f=r.get(c);f||(f=new Map,r.set(c,f)),f.set(e.instanceID,e)}})}collect_remove(e){let t=e.transform.view3D;if(t&&e.materials){let a=this.renderShaderUpdateList.get(t);a&&e.materials.forEach(r=>{let i=r.getAllPass();for(let n=0;n<i.length;n++){const o=i[n];let l=`${e.geometry.instanceID+o.instanceID}`;a.delete(l)}})}}}class J{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 J),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 Yc,this._renderShaderCollect=new Hc,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(Be.Sky))this.sky=t;else if(t.hasMask(Be.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(Be.Graphic3D))this._graphics.indexOf(t)==-1&&this._graphics.push(t);else if(kn.hasMask(t.renderLayer,Ai.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),m.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 Xc),r.get(e).collect_add(t)}t.object3D.renderNode=t,this._renderShaderCollect.collect_add(t)}getOctree(e){let t,a=m.setting.occlusionQuery.octree;if(a&&(t=this._octreeRenderNodes.get(e),!t)){let r=new u(a.x,a.y,a.z),i=new u(a.width,a.height,a.depth),n=new pe(r,i);t=new gr(n),this._octreeRenderNodes.set(e,t)}return t}removeRenderNode(e,t){if(t.detachSceneOctree(),t.hasMask(Be.Sky))this.sky=null;else if(t.hasMask(Be.Reflection)){let a=this._reflections.get(e);if(a){let r=a.indexOf(t);r!=-1&&a.splice(r,1)}}else if(kn.hasMask(t.renderLayer,Ai.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>=m.setting.light.maxLight){console.warn("Alreay meet maxmium light number:",m.setting.light.maxLight);return}a.indexOf(t)!=-1||a.push(t)}}removeLight(e,t){if(this._sceneLights.has(e)){let a=this._sceneLights.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getLights(e){let t=this._sceneLights.get(e);return t||[]}addGIProbe(e,t){this._sceneGIProbes.has(e)?this._sceneGIProbes.get(e).push(t):this._sceneGIProbes.set(e,[t])}removeGIProbe(e,t){if(this._sceneGIProbes.has(e)){let a=this._sceneGIProbes.get(e),r=a.indexOf(t);r!=-1&&a.splice(r,1)}}getProbes(e){let t=this._sceneGIProbes.get(e);return t||[]}getReflections(e){let t=this._reflections.get(e);return t||[]}autoSortRenderNodes(e){let t=this._tr_RenderNodes.get(e);if(!t)return;let a=!1;for(const r of t)if(r.isRenderOrderChange||r.needSortOnCameraZ){a=!0;break}if(a){for(const r of t){let i=r.renderOrder;if(r.needSortOnCameraZ){let n=jc.worldToCameraDepth(r.object3D);n=1-Math.max(0,Math.min(1,n)),i+=n}r.__renderOrder=i,r.isRenderOrderChange=!1}t.sort((r,i)=>r.__renderOrder>i.__renderOrder?1:-1)}return this}getRenderNodes(e,t){if(this.autoSortRenderNodes(e),this._collectInfo.clean(),this._collectInfo.sky=this.sky,m.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 Kc{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 b2=Object.defineProperty,g2=Object.getOwnPropertyDescriptor,En=(s,e,t,a)=>{for(var r=g2(e,t),i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(e,t,r)||r);return r&&b2(e,t,r),r};class Na extends Pe{instanceCount=0;lodLevel=0;alwaysRender=!1;instanceID;drawType=0;_geometry;_materials=[];_castShadow=!0;_castReflection=!0;_castGI=!1;_rendererMask=Be.Default;_inRenderer=!1;_readyPipeline=!1;_combineShaderRefection;_ignoreEnvMap;_ignorePrefilterMap;__renderOrder=0;_renderOrder=0;_passInit=new Map;isRenderOrderChange;needSortOnCameraZ;isRecievePostEffectUI;_octreeBinder;_renderLayer=Ai.None;_computes;init(e){this.renderOrder=0,this.rendererMask=Be.Default,this.instanceID=on().toString(),this._computes=[]}attachSceneOctree(e){this._octreeBinder={octree:e,entity:new Kc(this)},this.transform.eventDispatcher.addEventListener(Qt.LOCAL_ONCHANGE,this.updateOctreeEntity,this)}detachSceneOctree(){this._octreeBinder&&(this._octreeBinder.entity?.leaveNode(),this.transform.eventDispatcher.removeEventListener(Qt.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&&ge.getInstance().detached(this._geometry,this),e&&ge.getInstance().attached(e,this)),this._geometry=e}addMask(e){this._rendererMask=Wt.addMask(this.rendererMask,e)}removeMask(e){this._rendererMask=Wt.removeMask(this.rendererMask,e)}hasMask(e){return Wt.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];ge.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];ge.getInstance().attached(r,this),r.shader&&r.shader.computes&&this.addComputes(r.shader.computes)}this._materials=e;let t=0;for(let a=0;a<e.length;a++){const n=e[a].getPass(H.COLOR)[0];n.shaderState.transparent&&(t=t>n.renderOrder?t:n.renderOrder)}this.renderOrder=t,this._readyPipeline||this.initPipeline()}addComputes(e){this._computes.push(...e)}removeComputes(e){for(const t of e){let a=this._computes.indexOf(t);a!=-1&&this._computes.splice(a,1)}}addRendererMask(e){this._rendererMask=Wt.addMask(this._rendererMask,e)}removeRendererMask(e){this._rendererMask=Wt.removeMask(this._rendererMask,e)}onEnable(){this._readyPipeline||this.initPipeline(),J.instance.addRenderNode(this.transform.scene3D,this),this.updateOctreeEntity()}onDisable(){this._enable=!1,J.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(H.COLOR);for(let i=0;i<r.length;i++){const n=r[i];n.shaderReflection||n.preCompile(this._geometry),this._geometry.generate(n.shaderReflection)}this.object3D.bound=this._geometry.bounds.clone()}this._readyPipeline=!0;let e=0;for(let t=0;t<this.materials.length;t++){const i=this.materials[t].getPass(H.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&&J.instance.addRenderNode(this.transform.scene3D,this)}}castNeedPass(){if(this.castGI)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];mi.createGIPass(this,a.shader)}for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castShadow&&mi.createShadowPass(this,a.shader)}if(this.castReflection)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];a.castReflection&&mi.createReflectionPass(this,a.shader)}if(!Wt.hasMask(this.rendererMask,Be.IgnoreDepthPass)&&m.setting.render.zPrePass)for(let t=0;t<this.materials.length;t++){const a=this.materials[t];mi.createDepthPass(this,a.shader)}else for(let t=0;t<this.materials.length;t++)this.materials[t].shader.removeShaderByIndex(H.DEPTH,0)}get castShadow(){return this._castShadow}set castShadow(e){this._castShadow=e}get castGI(){return this._castGI}set castGI(e){this._castGI=e}get castReflection(){return this._castReflection}set castReflection(e){this._castReflection=e}renderPass(e,t,a){if(!this._geometry)return;let r=this,i=r.transform._worldMatrix;const n=Math.max(r.materials.length,r._geometry.subGeometries.length);for(let o=0;o<n;o++){const l=o>=r.materials.length?r.materials[0]:r.materials[o];if(!l||!l.enable)continue;let c=l.getPass(t);if(!(!c||c.length==0)){y.bindGeometryBuffer(a.encoder,r._geometry),Ye.viewCount_vertex(e,H[t],r._geometry.vertexCount);for(let f=0;f<c.length;f++){if(!c||c.length==0)continue;const h=c[f];if(h.pipeline){h.shaderState.splitTexture&&(a.endRenderPass(),vt.WriteSplitColorTexture(r.instanceID),a.beginOpaqueRenderPass(),y.bindCamera(a.encoder,e.camera),y.bindGeometryBuffer(a.encoder,r._geometry)),y.bindPipeline(a.encoder,h)&&Ye.viewCount_pipeline(e,H[t]);let A=(o>=r._geometry.subGeometries.length?r._geometry.subGeometries[0]:r._geometry.subGeometries[o]).lodLevels[r.lodLevel];r.instanceCount>0?(Ye.viewCount_instance(e,H[t],r.instanceCount),Ye.viewCount_indices(e,H[t],A.indexCount),Ye.viewCount_tri(e,H[t],A.indexCount/3*r.instanceCount),y.drawIndexed(a.encoder,A.indexCount,r.instanceCount,A.indexStart,0,0)):(Ye.viewCount_indices(e,H[t],A.indexCount),Ye.viewCount_tri(e,H[t],A.indexCount/3),y.drawIndexed(a.encoder,A.indexCount,1,A.indexStart,0,i.index)),Ye.viewCount_draw(e,H[t])}}}}}renderPass2(e,t,a,r,i,n=!1){if(!this.enable||!this._geometry)return;let o=this,l=o.object3D.transform._worldMatrix;for(let c=0;c<this.materials.length;c++){const f=this.materials[c];if(!f.castShadow&&t==H.SHADOW)continue;let d=f.getPass(t);if(!d||d.length==0)return;if(this.drawType==2)for(let h of d)h.pipeline&&(y.bindPipeline(i,h),y.draw(i,6,1,0,l.index));else{y.bindGeometryBuffer(i,o._geometry);for(let h of d)if(h.pipeline){y.bindPipeline(i,h);let A=o._geometry.subGeometries[c].lodLevels[o.lodLevel];y.drawIndexed(i,A.indexCount,1,A.indexStart,0,l.index)}}}}recordRenderPass2(e,t,a,r,i,n=!1){if(!this.enable)return;let o=this;for(let l=0;l<this.materials.length;l++){let f=this.materials[l].getPass(t);if(!f||f.length==0)return;let d=o.object3D.transform._worldMatrix;for(let h=0;h<f.length;h++){const b=f[h];y.bindPipeline(i,b);let D=o._geometry.subGeometries[l].lodLevels[o.lodLevel];y.drawIndexed(i,D.indexCount,1,D.indexStart,0,d.index)}}}noticeShaderChange(){this.enable&&(this.onEnable(),this._passInit.forEach((e,t)=>{this._passInit.set(t,!1)}))}preInit(e){return this._passInit.get(e)}nodeUpdate(e,t,a,r){let i=this,n=e.scene.envMap;for(let o=0;o<i.materials.length;o++){let c=i.materials[o].getPass(t);if(c)for(let f=0;f<c.length;f++){const h=c[f];if(h.shaderState.splitTexture){let U=vt.CreateSplitTexture(i.instanceID);h.setTexture("splitTexture_Map",U)}!i._ignoreEnvMap&&h.envMap!=n&&h.setTexture("envMap",n),h.prefilterMap||h.setTexture("prefilterMap",n);let b=oe.getReflectionEntries(e.scene);if(!h.reflectionMap&&b&&b.reflectionMap&&(h.setTexture("reflectionMap",b.reflectionMap),h.setStorageBuffer("reflectionBuffer",b.storageGPUBuffer)),h.pipeline){h.apply(i._geometry,a,()=>i.noticeShaderChange());continue}let p=m.res.getTexture("BRDFLUT");h.setTexture("brdflutMap",p);let g=m.getRenderJob(e).shadowMapPassRenderer;g&&g.depth2DArrayTexture&&h.setTexture("shadowMap",m.getRenderJob(e).shadowMapPassRenderer.depth2DArrayTexture);let A=m.getRenderJob(e).pointLightShadowRenderer;A&&A.cubeArrayTexture&&h.setTexture("pointShadowMap",A.cubeArrayTexture);let D=ba.iesTexture;D&&h.setTexture("iesTextureArrayMap",D),a.irradianceBuffer&&a.irradianceBuffer.length>0&&(h.setTexture("irradianceMap",a.irradianceBuffer[0]),h.setTexture("irradianceDepthMap",a.irradianceBuffer[1]));let _=oe.getLightEntries(e.scene);_&&(h.setStorageBuffer("lightBuffer",_.storageGPUBuffer),_.irradianceVolume&&h.setUniformBuffer("irradianceData",_.irradianceVolume.irradianceVolumeBuffer)),r&&(h.setStorageBuffer("clustersUniform",r.clustersUniformBuffer),h.setStorageBuffer("lightAssignBuffer",r.lightAssignBuffer),h.setStorageBuffer("assignTable",r.assignTableBuffer),h.setStorageBuffer("clusterBuffer",r.clusterBuffer)),h.apply(i._geometry,a),this._passInit.set(t,!0)}}}beforeDestroy(e){this._geometry&&(ge.getInstance().detached(this._geometry,this),ge.getInstance().hasReference(this._geometry)||this._geometry.destroy(e));for(let t=0;t<this._materials.length;t++){const a=this._materials[t];a&&(ge.getInstance().detached(a,this),ge.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}}En([jr],Na.prototype,"materials"),En([jr],Na.prototype,"castShadow"),En([jr],Na.prototype,"castGI");class mt{instanceID;name;enable=!0;_defaultSubShader;_shader;_isDestroyed=!1;constructor(){this.instanceID=Et()}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(H.COLOR)}clone(){let e=new mt;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 qc=`
|
|
5746
5746
|
#include "GlobalUniform"
|
|
5747
5747
|
|
|
5748
5748
|
// Constants
|
|
@@ -5992,7 +5992,7 @@ struct InstanceData {
|
|
|
5992
5992
|
o.color = evalSplat(vTexCoord, vColor);
|
|
5993
5993
|
return o;
|
|
5994
5994
|
}
|
|
5995
|
-
`;class ot{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(H.COLOR)}getDefaultColorShader(){return this.passShader.get(H.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(){this.getDefaultColorShader().destroy()}clone(){let e=new ot,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 p2=Object.getOwnPropertyDescriptor,m2=(s,e,t,a)=>{for(var r=a>1?void 0:a?p2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Di=class extends ot{constructor(){super();const s=new Ve("gsplat_vs_dc","gsplat_fs_dc");s.passType=H.COLOR,s.setShaderEntry("VertMain","FragMain"),s.topology=cn.triangle_list,s.depthWriteEnabled=!1,s.cullMode=wt.none,s.shaderState.transparent=!0,s.shaderState.blendMode=ae.NORMAL,s.shaderState.writeMasks=[15,15],s.shaderState.castReflection=!1,this.addRenderPass(s),this.setDefault()}setDefault(){const s=this.getDefaultColorShader(),e=new E;s.setUniform("modelMatrix",e.rawData),s.setUniform("pixelCull",new Float32Array([2,0,0,0]))}};Di=m2([Ia(Di,"GSplatShader")],Di);class e0 extends mt{_pixelCullArray=new Float32Array(4);constructor(){super(),z.register("gsplat_vs_dc",qc),z.register("gsplat_fs_dc",$c),this.shader=new Di}setSplatTextures(e,t,a,r,i){const n=this.shader.getDefaultColorShader();n.setTexture("splatColor",e),n.setTexture("transformA",t),n.setTexture("transformB",a),n.setUniformArray("tex_params",r),i&&n.setTexture("splatOrder",i),n.shaderState.depthCompare=et.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)}}class Ds extends Qa{node;constructor(e){super(),this.bufferType=aa.VertexGPUBuffer,this.createVertexBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,e)}createVertexBuffer(e,t){let a=k.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 Ka,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),this.node=this.memory.allocation_node(this.byteSize)}}var bt=(s=>(s[s.split=0]="split",s[s.compose=1]="compose",s[s.compose_bin=2]="compose_bin",s))(bt||{});class t0{vertexCount=0;vertexGPUBuffer;geometryType=bt.compose;_vertexBufferLayouts;_attributeSlotLayouts;_attributeLocation;constructor(){this._vertexBufferLayouts=[],this._attributeLocation={},this._attributeSlotLayouts=[]}get vertexBufferLayouts(){return this._vertexBufferLayouts}createVertexBuffer(e,t){switch(this.geometryType){case bt.split:this.createSplitVertexBuffer(e,t);break;case bt.compose:this.createComposeVertexBuffer(e,t);break;case bt.compose_bin:this.createComposBinVertexBuffer(e,t);break}}createSplitVertexBuffer(e,t){let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:0,shaderLocation:i.location,stride:$a[i.format]};this._attributeSlotLayouts[i.location]=[n];let o=e.get(i.name);o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o));let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l,this._vertexBufferLayouts[i.location]={name:i.name,arrayStride:i.size*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[i.location],offset:a*4,size:this.vertexCount*i.size*4},a+=this.vertexCount*i.size}this.vertexGPUBuffer=new Ds(a)}createComposeVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index"||i.type=="builtin")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:a*4,shaderLocation:i.location,stride:$a[i.format]};this._attributeSlotLayouts[0][i.location]=n;let o=e.get(i.name);if(o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o)),o.data){let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l}a+=i.size}this._vertexBufferLayouts[0]={name:"composeStruct",arrayStride:a*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[0],offset:0,size:this.vertexCount*a*4},this.vertexGPUBuffer=new Ds(this.vertexCount*a)}createComposBinVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let n=0;n<t.attributes.length;n++){const o=t.attributes[n];if(o.name=="index"||o.type=="builtin")continue;this._attributeLocation[o.name]=o.location;let l={name:o.name,format:o.format,offset:a*4,shaderLocation:o.location,stride:$a[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(V.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 Ds(this.vertexCount*a)}upload(e,t){if(this.vertexGPUBuffer){switch(this.geometryType){case bt.split:{let a=this._attributeLocation[e],r=this._vertexBufferLayouts[a];this.vertexGPUBuffer.node.setFloat32Array(r.offset/4,t.data)}break;case bt.compose:for(let a=0;a<this.vertexCount;a++){const r=this._attributeSlotLayouts[0][this._attributeLocation[e]];for(let i=0;i<r.stride;i++){let n=t.data[a*r.stride+i],o=a*(this._vertexBufferLayouts[0].arrayStride/4)+r.offset/4+i;this.vertexGPUBuffer.node.setFloat(n,o)}}break;case bt.compose_bin:this.vertexGPUBuffer.node.setFloat32Array(0,t.data);break}this.vertexGPUBuffer?.apply()}}updateAttributes(e){switch(this.geometryType){case bt.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 bt.compose:for(let t=0;t<this.vertexCount;t++)this._attributeSlotLayouts.forEach(a=>{for(let r=0;r<a.length;r++){const i=a[r];let n=e.get(i.name);for(let o=0;o<i.stride;o++){let l=n.data[t*i.stride+o],c=t*(this._vertexBufferLayouts[0].arrayStride/4)+i.offset/4+o;this.vertexGPUBuffer.node.setFloat(l,c)}}});break;case bt.compose_bin:{let t=e.get(V.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 a0 extends Qa{indicesNode;constructor(e){super(),this.bufferType=aa.IndicesGPUBuffer,this.createIndicesBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.INDEX|GPUBufferUsage.INDIRECT,e)}createIndicesBuffer(e,t){let a=k.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 Ka,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 r0{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 a0(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 i0{lodLevels}class Ee{instanceID;name;subGeometries=[];morphTargetsRelative;morphTargetDictionary;skinNames;bindPose;blendShapeData;vertexDim;vertexCount=0;_bounds;_attributeMap;_attributes;_indicesBuffer;_vertexBuffer;_onChange=!0;_wireframeLines;constructor(){this.instanceID=Et(),this._attributeMap=new Map,this._attributes=[],this._vertexBuffer=new t0}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 ge(new u,new u(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(V.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 i0;return t.lodLevels=e,this.subGeometries.push(t),t}generate(e){this._onChange&&(this._onChange=!1,this._indicesBuffer.upload(this.getAttribute(V.indices).data),this._vertexBuffer.createVertexBuffer(this._attributeMap,e),this._vertexBuffer.updateAttributes(this._attributeMap),this.vertexCount=this._vertexBuffer.vertexCount)}setIndices(e){if(!this._attributeMap.has(V.indices)){let t={attribute:V.indices,data:e};this._attributeMap.set(V.indices,t),this._indicesBuffer=new r0,this._indicesBuffer.createIndicesBuffer(t)}}setAttribute(e,t){if(e==V.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==bt.split||this.geometryType==bt.compose){let e=this.getAttribute(V.position),t=this.getAttribute(V.indices);if(t&&e&&t.data.length>0){let a=e.data,r=[];for(let i=0;i<t.data.length/3;i++){const n=t.data[i*3+0],o=t.data[i*3+1],l=t.data[i*3+2];let c=new u(a[n*3+0],a[n*3+1],a[n*3+2]),f=new u(a[o*3+0],a[o*3+1],a[o*3+2]),d=new u(a[l*3+0],a[l*3+1],a[l*3+2]);r.push(c,f),r.push(f,d),r.push(d,c)}return this._wireframeLines=r,r}}else if(this.geometryType==bt.compose_bin){let e=this.getAttribute(V.all),t=this.vertexDim,a=this.getAttribute(V.indices);if(a&&e&&a.data.length>0){let r=e.data,i=[];for(let n=0;n<a.data.length/3;n++){const o=a.data[n*3+0],l=a.data[n*3+1],c=a.data[n*3+2];let f=new u(r[o*t+0],r[o*t+1],r[o*t+2]),d=new u(r[l*t+0],r[l*t+1],r[l*t+2]),h=new u(r[c*t+0],r[c*t+1],r[c*t+2]);i.push(f,d),i.push(d,h),i.push(h,f)}return this._wireframeLines=i,i}}return null}compute(){this._indicesBuffer&&this._indicesBuffer.compute(),this._vertexBuffer&&this._vertexBuffer.compute()}static crossA=u.UP.clone();static crossB=u.UP.clone();static crossRet=u.UP.clone();static point1=u.UP.clone();static point2=u.UP.clone();static point3=u.UP.clone();computeNormals(){let e=this.getAttribute(V.position),t=this.getAttribute(V.normal),a=this.getAttribute(V.indices);if(!e||!t||!a)return this;let r=a.data.length/3,i=Ee.point1,n=Ee.point2,o=Ee.point3,l=Ee.crossA,c=Ee.crossB,f=Ee.crossRet;for(let d=0;d<r;d++){let h=a.data[d*3],b=a.data[d*3+1],p=a.data[d*3+2];i.set(e.data[h*3],e.data[h*3+1],e.data[h*3+2]),n.set(e.data[b*3],e.data[b*3+1],e.data[b*3+2]),o.set(e.data[p*3],e.data[p*3+1],e.data[p*3+2]),u.sub(i,n,l).normalize(),u.sub(i,o,c).normalize();let g=l.crossProduct(c,f).normalize();t.data[h*3]=t.data[b*3]=t.data[p*3]=g.x,t.data[h*3+1]=t.data[b*3+1]=t.data[p*3+1]=g.y,t.data[h*3+2]=t.data[b*3+2]=t.data[p*3+2]=g.z}return this._vertexBuffer.upload(V.normal,t),this}isPrimitive(){return!1}destroy(e){this.instanceID=null,this.name=null,this.subGeometries=null,this.morphTargetDictionary=null,this._bounds.destroy(),this._bounds=null,this._attributeMap=null,this._attributes=null,this._indicesBuffer.destroy(),this._vertexBuffer.destroy(),this._indicesBuffer=null,this._vertexBuffer=null}}class s0 extends Ee{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(V.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 wn extends He{_dataBuffer;create(e,t,a,r=!1){let i=k.device;const n=Math.ceil(e*4/256)*256;this.format=Y.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);const l=y.beginCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(l),r&&ua.webGPUGenerateMipmap(this),this}updateTexture(e,t,a){let r=k.device;const i=Math.ceil(e*4/256)*256;this.mipmapCount=Math.floor(Math.log2(e)),this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null;const n=this._dataBuffer=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(n,0,a);const o=y.beginCommandEncoder();o.copyBufferToTexture({buffer:n,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(o),this.gpuSampler=r.createSampler(this),this.mipmapCount>1&&ua.webGPUGenerateMipmap(this)}}class n0 extends He{_dataBuffer;create(e,t,a){let r=k.device;const i=e*4*4;this.format=Y.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){let r=k.device;const i=e*4*4;r.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:i},{width:e,height:t,depthOrArrayLayers:1})}}class o0 extends He{_dataBuffer;create(e,t,a){let r=k.device;const i=e*4;this.format=Y.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=k.device;const i=e*4;r.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:i},{width:e,height:t,depthOrArrayLayers:1})}}const l0=new Float32Array(1),A2=new Int32Array(l0.buffer);let rr=function(s){l0[0]=s;const e=A2[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)};class Rn extends He{uint16Array;floatArray;_dataBuffer;create(e,t,a=null,r=!0){if(a==null){a=[];for(let i=0,n=e*t*4;i<n;i++)a[i]=0}return this.updateTexture(e,t,a,r),this}updateTexture(e,t,a,r=!0){(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 i=k.device;const n=e*4*2;this.format=Y.rgba16float,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format),(!this.uint16Array||this.uint16Array.length!=a.length)&&(this.uint16Array=new Uint16Array(a.length));let o=this.uint16Array;for(let f=0,d=o.length;f<d;f++)o[f]=rr(a[f]);const l=this._dataBuffer=i.createBuffer({size:o.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});i.queue.writeBuffer(l,0,o);const c=y.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),y.endCommandEncoder(c),this.gpuSampler=i.createSampler(this),this.gpuTexture=this.getGPUTexture(),this.mipmapCount>1&&ua.webGPUGenerateMipmap(this)}}var D2=Object.getOwnPropertyDescriptor,_2=(s,e,t,a)=>{for(var r=a>1?void 0:a?D2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let _i=class extends Na{count=0;size=new K;splatColor;transformA;transformB;texParams;splatOrder;gsplatMaterial;_positions;get positions(){return this._positions}_worldPositions;_orderData;_sortWorker;_lastSentTime=0;_minIntervalMs=16;_centersSent=!1;_lastViewMatrixHash=0;_lastCameraSpeed=0;_adaptiveSorting=!0;_lastPixelCullParams="";_texturesInitialized=!1;_lodEnabled=!1;_lodDistances=[5,10,20,40];_lodRatios=[1,.75,.5,.25,.1];_currentLodLevel=0;_minPixelCoverage=4;_maxPixelCoverage=0;_maxPixelCullDistance=0;_mapping=null;_fullCount=0;get fullCount(){return this._fullCount}_batchSize=128;instanceCount=0;constructor(){super()}initAsset(s){this.count=s.count,this._fullCount=s.count,this.size=this.evalTextureSize(s.count),this.buildColor(s),this.buildTransform(s),this.texParams=new Float32Array([this.count,this.size.x,this.count,1]),this._positions=s.position;const e=this.size.x*this.size.y;this._orderData=new Uint32Array(e);for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;this.splatOrder=new o0().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 e0,this.geometry=new s0(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}onBeforeUpdate(s){this.count>0&&s?.camera&&(this._lodEnabled&&this.updateLOD(s),s.camera.viewMatrix&&this.scheduleOrder(s.camera.viewMatrix))}updateLOD(s){if(!this._worldPositions||this._fullCount===0)return;const t=s.camera.viewMatrix.rawData,a=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),r=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),i=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]);let n=0,o=0,l=0;const c=Math.min(100,this._fullCount);for(let g=0;g<c;g++){const A=Math.floor(g/c*this._fullCount)*3;n+=this._worldPositions[A+0],o+=this._worldPositions[A+1],l+=this._worldPositions[A+2]}n/=c,o/=c,l/=c;const f=a-n,d=r-o,h=i-l,b=Math.sqrt(f*f+d*d+h*h);let p=this._lodDistances.length;for(let g=0;g<this._lodDistances.length;g++)if(b<this._lodDistances[g]){p=g;break}if(p!==this._currentLodLevel){this._currentLodLevel=p;const g=this._lodRatios[p],A=Math.floor(this._fullCount*g);if(this._mapping){const D=this._mapping;this._mapping=new Uint32Array(Math.min(A,D.length));for(let _=0;_<this._mapping.length;_++)this._mapping[_]=D[_];this.setMapping(this._mapping)}else this.count=A,this.texParams[0]=this.count,this.texParams[2]=this.count}}setMapping(s){this._mapping=s&&s.length>0?s:null,this.count=this._mapping?this._mapping.length:this._fullCount,this.texParams[0]=this.count,this.texParams[2]=Math.min(this.texParams[0],this.count);const e=this.size.x*this.size.y;for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;if(this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData),this._sortWorker){const t=this._worldPositions||this._positions,a=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(t);if(this._mapping)for(let r=0;r<this._mapping.length;++r){const i=this._mapping[r]*3,n=r*3;a[n+0]=t[i+0],a[n+1]=t[i+1],a[n+2]=t[i+2]}this._sortWorker.postMessage({type:"centers",centers:a.buffer,mapping:this._mapping?this._mapping:null},[a.buffer]),this._centersSent=!0}else this._centersSent=!1;this.instanceCount=0}setVisBoost(s){this.texParams[3]=Math.max(0,s)}setSortThrottle(s){this._minIntervalMs=Math.max(0,s|0)}setAdaptiveSorting(s){this._adaptiveSorting=s}setLOD(s,e,t){this._lodEnabled=s,e&&(this._lodDistances=e),t&&(this._lodRatios=t)}getLODStats(){return{enabled:this._lodEnabled,currentLevel:this._currentLodLevel,distances:this._lodDistances,ratios:this._lodRatios,currentRatio:this._lodRatios[this._currentLodLevel],visibleCount:this._lodEnabled?Math.floor(this._fullCount*this._lodRatios[this._currentLodLevel]):this._fullCount}}setPixelCulling(s,e=0,t=0){this._minPixelCoverage=Math.max(0,s),this._maxPixelCoverage=Math.max(0,e),this._maxPixelCullDistance=Math.max(0,t)}getPixelCullingStats(){return{minPixels:this._minPixelCoverage,maxPixels:this._maxPixelCoverage,maxPixelCullDistance:this._maxPixelCullDistance,maxEnabled:this._maxPixelCoverage>0,distanceEnabled:this._maxPixelCullDistance>0}}getBatchingStats(){return{enabled:!0,batchSize:this._batchSize,instanceCount:this.instanceCount,splatCount:this.count,reduction:this.count>0?(1-this.instanceCount/this.count)*100:0}}evalTextureSize(s){let e=Math.ceil(Math.sqrt(s));const t=64;e=Math.ceil(e/t)*t;const a=Math.ceil(s/e);return new K(e,a)}buildColor(s){const e=this.size.x|0,t=this.size.y|0,a=new Uint8Array(e*t*4),r=.28209479177387814,i=s.count,n=s.sh?.coeffs,o=n?n.length/(3*i):1;for(let l=0;l<i;l++){let c=.5,f=.5,d=.5;if(n&&o>=1){const p=l*o*3;c=.5+n[p+0]*r,f=.5+n[p+o+0]*r,d=.5+n[p+2*o+0]*r}const h=s.opacity?1/(1+Math.exp(-s.opacity[l])):1,b=l*4;a[b+0]=Math.max(0,Math.min(255,Math.floor(c*255))),a[b+1]=Math.max(0,Math.min(255,Math.floor(f*255))),a[b+2]=Math.max(0,Math.min(255,Math.floor(d*255))),a[b+3]=Math.max(0,Math.min(255,Math.floor(h*255)))}this.splatColor=new wn().create(e,t,a,!1),this.splatColor.name="splatColor",this.splatColor.minFilter="nearest",this.splatColor.magFilter="nearest",this.splatColor.mipmapFilter="nearest",this.splatColor.addressModeU="clamp-to-edge",this.splatColor.addressModeV="clamp-to-edge"}buildTransform(s){const e=this.size.x|0,t=this.size.y|0,a=s.count,r=new Uint32Array(e*t*4),i=new Array(e*t*4).fill(0),n=new ArrayBuffer(4),o=new Float32Array(n),l=new Uint32Array(n),c=b=>(o[0]=b,l[0]),f=s.position,d=s.rotation,h=s.scale;for(let b=0;b<a;b++){const p=b*4,g=f[b*3+0],A=f[b*3+1],D=f[b*3+2];r[p+0]=c(g),r[p+1]=c(A),r[p+2]=c(D);let _=0,U=0,v=0,x=1;if(d){_=d[b*4+0],U=d[b*4+1],v=d[b*4+2],x=d[b*4+3];const Jt=1/Math.hypot(_,U,v,x);_*=Jt,U*=Jt,v*=Jt,x*=Jt}let C=1,F=1,w=1;h&&(C=Math.exp(h[b*3+0]),F=Math.exp(h[b*3+1]),w=Math.exp(h[b*3+2]));const S=_+_,M=U+U,T=v+v,Q=_*S,L=_*M,X=_*T,ie=U*M,q=U*T,be=v*T,Ue=x*S,Z=x*M,de=x*T,ce=1-(ie+be),De=L+de,_e=X-Z,Ne=L-de,we=1-(Q+be),Ce=q+Ue,Me=X+Z,ct=q-Ue,ga=1-(Q+ie),Mt=ce*C,Ft=De*C,kt=_e*C,Nt=Ne*F,xt=we*F,pa=Ce*F,ma=Me*w,Aa=ct*w,Da=ga*w,Dr=Mt*Mt+Nt*Nt+ma*ma,ja=Mt*Ft+Nt*xt+ma*Aa,_a=Mt*kt+Nt*pa+ma*Da,_r=Ft*Ft+xt*xt+Aa*Aa,Ya=Ft*kt+xt*pa+Aa*Da,Br=kt*kt+pa*pa+Da*Da,Ba=p;i[Ba+0]=Dr,i[Ba+1]=ja,i[Ba+2]=_a,i[Ba+3]=Br;const vr=rr(_r)&65535,Ur=rr(Ya)&65535;r[p+3]=vr|Ur<<16}this.transformA=new n0().create(e,t,r),this.transformA.name="transformA",this.transformA.minFilter="nearest",this.transformA.magFilter="nearest",this.transformA.addressModeU="clamp-to-edge",this.transformA.addressModeV="clamp-to-edge",this.transformB=new Rn().create(e,t,i,!1),this.transformB.name="transformB",this.transformB.minFilter="nearest",this.transformB.magFilter="nearest",this.transformB.mipmapFilter="nearest",this.transformB.addressModeU="clamp-to-edge",this.transformB.addressModeV="clamp-to-edge"}updateWorldPositions(){if(!this._positions)return;const s=this.object3D.transform.worldMatrix,e=this._positions,t=this._fullCount;this._worldPositions||(this._worldPositions=new Float32Array(e.length));const a=s.rawData;for(let r=0;r<t;r++){const i=r*3,n=e[i+0],o=e[i+1],l=e[i+2];this._worldPositions[i+0]=a[0]*n+a[4]*o+a[8]*l+a[12],this._worldPositions[i+1]=a[1]*n+a[5]*o+a[9]*l+a[13],this._worldPositions[i+2]=a[2]*n+a[6]*o+a[10]*l+a[14]}this._centersSent=!1}scheduleOrder(s){if(this.count===0)return;const e=this.object3D.transform.localChange;(e||!this._worldPositions)&&this.updateWorldPositions();const t=s.rawData,a=t[2],r=t[6],i=t[10],n=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),o=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),l=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]),c=performance.now(),f=(c-this._lastSentTime)/1e3,d=Math.floor(n*1e3)^Math.floor(o*1e3)^Math.floor(l*1e3),h=Math.floor(a*1e3)^Math.floor(r*1e3)^Math.floor(i*1e3),b=d^h;if(b===this._lastViewMatrixHash&&!e)return;let p=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const A=Math.abs(b-this._lastViewMatrixHash)/Math.max(f,.001);A<1e3?p=this._minIntervalMs:A<1e4?p=this._minIntervalMs*.5:p=this._minIntervalMs*.2,this._lastCameraSpeed=A}if(!(c-this._lastSentTime<p)){if(this._lastViewMatrixHash=b,this._lastSentTime=c,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=_=>{const U=_.data.order,v=this._orderData.buffer;this._sortWorker.postMessage({order:v},[v]);const x=new Uint32Array(U),C=this.size.x*this.size.y,F=this.count;(!this._orderData||this._orderData.length!==C)&&(this._orderData=new Uint32Array(C));const w=Math.min(F,x.length);if(this._orderData.set(x.subarray(0,w),0),w<C){const T=F>0?F-1:0;this._orderData.fill(T,w,C)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const S=Math.max(0,Math.min(this.count,_.data.count|0));this.texParams[2]=S;const M=Math.ceil(S/this._batchSize);this.instanceCount=M};const g=this._worldPositions||this._positions,A=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let _=0;_<this._mapping.length;++_){const U=this._mapping[_]*3,v=_*3;A[v+0]=g[U+0],A[v+1]=g[U+1],A[v+2]=g[U+2]}const D=new Uint32Array(this.count);for(let _=0;_<this.count;_++)D[_]=_;this._sortWorker.postMessage({order:D.buffer,centers:A.buffer,mapping:this._mapping},[D.buffer,A.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const g=this._worldPositions||this._positions,A=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let D=0;D<this._mapping.length;++D){const _=this._mapping[D]*3,U=D*3;A[U+0]=g[_+0],A[U+1]=g[_+1],A[U+2]=g[_+2]}this._sortWorker.postMessage({type:"centers",centers:A.buffer,mapping:this._mapping?this._mapping:null},[A.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:n,y:o,z:l},cameraDirection:{x:-a,y:-r,z:-i}})}}createSortWorker(){function s(){let n,o,l,c,f,d=!1;const h={x:0,y:0,z:0},b={x:0,y:0,z:0},p={x:0,y:0,z:0},g={x:0,y:0,z:0};let A,D;const _=(v,x,C)=>{for(;v<=x;){const F=x+v>>1,w=C(F);if(w>0)v=F+1;else if(w<0)x=F-1;else return F}return~v},U=()=>{if(!n||!o||!c||!f)return;const v=c.x,x=c.y,C=c.z,F=f.x,w=f.y,S=f.z,M=.001;if(!d&&Math.abs(v-h.x)<M&&Math.abs(x-h.y)<M&&Math.abs(C-h.z)<M&&Math.abs(F-b.x)<M&&Math.abs(w-b.y)<M&&Math.abs(S-b.z)<M)return;d=!1,h.x=v,h.y=x,h.z=C,b.x=F,b.y=w,b.z=S;const T=o.length/3;A?.length!==T&&(A=new Uint32Array(T));let Q,L;for(let Z=0;Z<8;++Z){const de=(Z&1?p.x:g.x)-v,ce=(Z&2?p.y:g.y)-x,De=(Z&4?p.z:g.z)-C,_e=de*F+ce*w+De*S;Z===0?Q=L=_e:(Q=Math.min(Q,_e),L=Math.max(L,_e))}D?D.fill(0):D=new Uint32Array(65537);const X=L-Q,ie=X<1e-6?0:1/X*2**16;for(let Z=0;Z<T;++Z){const de=Z*3,ce=o[de+0]-v,De=o[de+1]-x,_e=o[de+2]-C,Ne=ce*F+De*w+_e*S,we=Math.floor((Ne-Q)*ie);A[Z]=we,D[we]++}for(let Z=1;Z<65537;Z++)D[Z]+=D[Z-1];for(let Z=0;Z<T;Z++){const de=A[Z],ce=--D[de];n[ce]=Z}const q=Z=>A[n[Z]]/ie+Q,be=()=>{const Z=_(0,T-1,de=>-q(de));return Math.min(T,Math.abs(Z))},Ue=q(T-1)>=0?be():T;if(l)for(let Z=0;Z<T;++Z)n[Z]=l[n[Z]];self.postMessage({order:n.buffer,count:Ue},[n.buffer]),n=null};self.onmessage=v=>{if(v.data.order&&(n=new Uint32Array(v.data.order)),v.data.centers){o=new Float32Array(v.data.centers),p.x=g.x=o[0],p.y=g.y=o[1],p.z=g.z=o[2];const x=o.length/3;for(let C=1;C<x;++C){const F=o[C*3+0],w=o[C*3+1],S=o[C*3+2];p.x=Math.min(p.x,F),p.y=Math.min(p.y,w),p.z=Math.min(p.z,S),g.x=Math.max(g.x,F),g.y=Math.max(g.y,w),g.z=Math.max(g.z,S)}d=!0}v.data.hasOwnProperty("mapping")&&(l=v.data.mapping?new Uint32Array(v.data.mapping):null,d=!0),v.data.cameraPosition&&(c=v.data.cameraPosition),v.data.cameraDirection&&(f=v.data.cameraDirection),U()}}const e=`(${s.toString()})()`,t=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(t);return new Worker(a)}nodeUpdate(s,e,t,a){const r=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(r);const i=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;i!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=i),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(s,e,t,a)}renderPass(s,e,t){const a=t.encoder;for(let r of this.materials){const i=r.getPass(e);if(!(!i||i.length===0))for(const n of i){if(!n.pipeline)continue;n.apply(this.geometry,t.rendererPassState||t),y.bindPipeline(a,n),y.bindGeometryBuffer(a,this.geometry);const l=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?y.drawIndexed(a,l.indexCount,this.instanceCount,l.indexStart,0,0):y.drawIndexed(a,l.indexCount,1,l.indexStart,0,0)}}}destroy(s){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(s),this.splatColor=null),this.transformA&&(this.transformA.destroy(s),this.transformA=null),this.transformB&&(this.transformB.destroy(s),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(s),this.splatOrder=null),this._positions=null,this._worldPositions=null,this._orderData=null,this.texParams=null,this._mapping=null,super.destroy(s)}};_i=_2([Vt(_i,"GSplatRenderer")],_i);class In{static maxVector=new u(Number.MAX_VALUE*.1,Number.MAX_VALUE*.1,Number.MAX_VALUE*.1);static minVector=this.maxVector.clone().multiplyScalar(-1);static genMeshMaxVector=u.ZERO.clone();static genMeshMinVector=u.ZERO.clone();static genMeshVectorList8=[new u,new u,new u,new u,new u,new u,new u,new u];static genGSplatBounds(e,t){t||=new ge(u.ZERO,u.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(_i);if(!a)return console.warn("genGSplatBounds: No GSplatRenderer found on object"),t;for(const r of a){const i=r.positions,n=r.fullCount;if(!i||n===0)return console.warn("genGSplatBounds: No position data available"),t;const o=r.object3D.transform.worldMatrix,l=new u;for(let c=0;c<n;c++){const f=c*3;l.set(i[f+0],i[f+1],i[f+2]),o.transformPoint(l,l),t.expandByPoint(l)}t.setFromMinMax(t.min,t.max)}return t}static genMeshBounds(e,t){let a=this.genMeshMinVector,r=this.genMeshMaxVector,i=this.genMeshVectorList8;t||=new ge(u.ZERO,u.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let n=e.getComponents($);for(const o of n)if(o&&o.geometry){let l=o.object3D.transform.worldMatrix;a.copy(o.geometry.bounds.min),r.copy(o.geometry.bounds.max),i[0].set(a.x,a.y,a.z),i[1].set(a.x,a.y,r.z),i[2].set(a.x,r.y,a.z),i[3].set(a.x,r.y,r.z),i[4].set(r.x,a.y,a.z),i[5].set(r.x,a.y,r.z),i[6].set(r.x,r.y,a.z),i[7].set(r.x,r.y,r.z);for(const c of i)l.transformPoint(c,c),t.expandByPoint(c)}return r.copyFrom(t.max),a.copyFrom(t.min),t.setFromMinMax(a,r),t}static transformBound(e,t,a){let r=this.genMeshMinVector.copyFrom(t.min),i=this.genMeshMaxVector.copyFrom(t.max),n=this.genMeshVectorList8;a||=new ge(u.ZERO,u.ZERO),a.setFromMinMax(this.maxVector,this.minVector),n[0].set(r.x,r.y,r.z),n[1].set(r.x,r.y,i.z),n[2].set(r.x,i.y,r.z),n[3].set(r.x,i.y,i.z),n[4].set(i.x,r.y,r.z),n[5].set(i.x,r.y,i.z),n[6].set(i.x,i.y,r.z),n[7].set(i.x,i.y,i.z);for(const o of n)e.transformPoint(o,o),a.expandByPoint(o);return i.copyFrom(a.max),r.copyFrom(a.min),a.setFromMinMax(r,i),a}}class c0 extends Ra{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=on().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 ge,this._boundWorld=this._bound.clone(),this._isBoundChange=!0),this._isBoundChange&&(In.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()):xe.waitStartComponent.forEach((e,t)=>{for(;e.length>0;){const a=e.shift();a.__start(),xe.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.entityChildren.forEach(t=>{t.destroy(e)}),this.removeAllChild(),this.transform.parent=null,this._dispose=!0,super.destroy())}}var B2=Object.getOwnPropertyDescriptor,v2=(s,e,t,a)=>{for(var r=a>1?void 0:a?B2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ee=class extends c0{_isScene3D;prefabRef;serializeTag;constructor(){super(),this.transform=this.addComponent(Qt),this.transform.eventDispatcher.addEventListener(Qt.LOCAL_ONCHANGE,this.onTransformLocalChange,this)}get isScene3D(){return this._isScene3D}forChild(s){this.entityChildren.forEach(e=>{s(e),e.forChild(s)})}addComponent(s,e){if(!this.components.has(s)){let t=new s;return t.object3D=this,this.components.set(s,t),t.__init(e),xe.appendWaitStart(t),t}return this.components.get(s)}getOrAddComponent(s){let e=this.components.get(s);return e||(e=this.addComponent(s)),e}removeComponent(s){if(this.components.has(s)){let e=this.components.get(s);xe.removeWaitStart(this,e),this.components.delete(s),e.__stop(),e.beforeDestroy(),e.destroy()}}hasComponent(s){return this.components.has(s)}getComponent(s){return this.components.get(s)}getComponentFromParent(s){if(!this.parent)return null;let e=this.parent.object3D.getComponent(s);return e||this.parent.object3D.getComponentFromParent(s)}getComponentsInChild(s){let e=[],t=this.components.get(s);t&&e.push(t);for(let a=0;a<this.entityChildren.length;a++){let i=this.entityChildren[a].getComponentsInChild(s);e.push(...i)}return e}getComponents(s,e,t){e||=[];let a=this.getComponent(s);a&&(a.enable||t)&&e.push(a);for(let r=0,i=this.entityChildren.length;r<i;r++){let n=this.entityChildren[r];n&&n instanceof ee&&n.getComponents(s,e,t)}return e}getComponentsExt(s,e,t){e||=[];let a=this.components.get(s);if(a&&(a.enable||t))e.push(a);else for(const r of this.entityChildren)r instanceof ee&&r.getComponentsExt(s,e,t);return e}getComponentsByProperty(s,e,t=!0,a,r){a||=[];let i;for(const n of this.components.values())n&&(n.enable||r)&&n[s]===e&&(a.push(n),i=!0);if(!(i&&t))for(const n of this.entityChildren)n instanceof ee&&n.getComponentsByProperty(s,e,t,a,r);return a}clone(){return this.instantiate()}instantiate(){let s=new ee;return s.name=this.name,s.serializeTag=this.serializeTag,s.prefabRef=this.prefabRef,this.entityChildren.forEach((e,t)=>{let a=e.instantiate();s.addChild(a)}),this.components.forEach((e,t)=>{e.cloneTo(s)}),s}get localPosition(){return this.transform.localPosition}set localPosition(s){this.transform.localPosition=s}get localRotation(){return this.transform.localRotation}set localRotation(s){this.transform.localRotation=s}get localScale(){return this.transform.localScale}set localScale(s){this.transform.localScale=s}get localQuaternion(){return this.transform.localRotQuat}set localQuaternion(s){this.transform.localRotQuat=s}notifyChange(){this.transform.notifyChange()}get parent(){return this.transform.parent}get parentObject(){return this.transform.parent.object3D}set x(s){this.transform.x=s}get x(){return this.transform.x}set y(s){this.transform.y=s}get y(){return this.transform.y}set z(s){this.transform.z=s}get z(){return this.transform.z}set scaleX(s){this.transform.scaleX=s}get scaleX(){return this.transform.scaleX}set scaleY(s){this.transform.scaleY=s}get scaleY(){return this.transform.scaleY}set scaleZ(s){this.transform.scaleZ=s}get scaleZ(){return this.transform.scaleZ}set rotationX(s){this.transform.rotationX=s}get rotationX(){return this.transform.rotationX}set rotationY(s){this.transform.rotationY=s}get rotationY(){return this.transform.rotationY}set rotationZ(s){this.transform.rotationZ=s}get rotationZ(){return this.transform.rotationZ}fixedUpdate(){}lateUpdate(){}traverse(s){s(this);for(let e=0,t=this.entityChildren.length;e<t;e++){let a=this.entityChildren[e];a instanceof ee&&a.traverse(s)}}destroy(s){this.transform.eventDispatcher.removeEventListener(Qt.LOCAL_ONCHANGE,this.onTransformLocalChange,this),super.destroy(s)}};ee=v2([U2],ee);function U2(s,e){return class extends ee{set active(t){this.transform.enable=t>0}get active(){return this.transform.enable?1:0}get materialColor(){return this.getComponent($)?.material?.shader.getDefaultColorShader().baseColor}set materialColor(t){let a=this.getComponent($)?.material;a&&(a.shader.getDefaultColorShader().baseColor=t)}notifyMaterialColorChange(t,a){this.getComponent($).materials?.[t]?.shader.getDefaultColorShader().uniforms[a].onChange()}}}class Ke{static createCamera3DObject(e,t){return this.createCamera3D(null,e,t)}static createCamera3D(e,t,a){return e||=new ee,t&&t.addChild(e),a&&(e.name=a),e.getOrAddComponent(Kr)}static UnProjection(e,t,a=1,r){let i=new u(e,t,0),n=1,o=u.HELP_0,l=k.canvas.offsetLeft,c=k.canvas.offsetTop,f=k.canvas.clientWidth,d=k.canvas.clientHeight;o.x=((i.x-l)*n/f-.5)*2,o.y=-((i.y-c)*n/d-.5)*2,o.z=a;let h=new u(0,0,0),b=E.helpMatrix2;b.copyFrom(r.projectionMatrix),b.invert();let p=E.helpMatrix;return p.identity(),p.multiply(b),p.multiply(r.transform.worldMatrix),p.perspectiveMultiplyPoint3(o,h),h}static Projection(e,t,a){let r=a||new u(0,0,0),i=E.helpMatrix;i.copyFrom(t.viewMatrix),i.multiply(t.projectionMatrix),i.perspectiveMultiplyPoint3(e,r);let n=k.canvas.clientWidth/2,o=k.canvas.clientHeight/2;return r.x=r.x*n+n,r.y=o-r.y*o,r}static UnProjection2(e,t,a,r,i){let n=i||new u(0,0,0),o=E.helpMatrix;o.copyFrom(r.pvMatrixInv);let l=k.canvas.clientWidth/2,c=k.canvas.clientHeight/2;return n.x=(e-l)/l,n.y=(c-t)/c,n.z=a,o.perspectiveMultiplyPoint3(n,n),n}}class It{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==Xe.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==Xe.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==Xe.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==Xe.DirectionLight){let a=this.directionLightList.get(e);return a||(a=[],this.directionLightList.set(e,a)),a}else if(t==Xe.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==Xe.DirectionLight){let a=this.directionLightList.get(t);if(a||(a=[],this.directionLightList.set(t,a)),!e.shadowCamera){e.shadowCamera=Ke.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==Xe.PointLight||e.lightData.lightType==Xe.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==Xe.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==Xe.PointLight||e.lightData.lightType==Xe.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=It.directionLightList.get(e.scene),r=It.pointLightList.get(e.scene),i=0,n=0,o=0,l=0;if(t.fill(0),a){let f=0;for(let d=0;d<a.length;d++){const h=a[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}n=a.length}if(r){o=n;let f=0;for(let d=o;d<r.length;d++){const h=r[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}l=o+r.length}oe.getAllCameraGroup().forEach(f=>{f.dirShadowStart=i,f.dirShadowEnd=n,f.pointShadowStart=o,f.pointShadowEnd=l,f.shadowLights.set(new Float32Array(t))})}}class Qn{uuid;usage;globalBindGroup;uniformGPUBuffer;matrixBindGroup;uniformByteLength;matrixesByteLength;shadowMatrixRaw=new Float32Array(128);csmMatrixRaw=new Float32Array(Zt.Cascades*16);csmShadowBias=new Float32Array(4);shadowLights=new Float32Array(16);dirShadowStart=0;dirShadowEnd=0;pointShadowStart=0;pointShadowEnd=0;constructor(e){this.uuid=Et(),this.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.uniformGPUBuffer=new dt(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=E.block*4*E.maxCount,this.globalBindGroup=k.device.createBindGroup({label:"global_bindGroupLayout",layout:xn.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=It.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=m.setting.shadow.shadowSize;if(Zt.Cascades>1&&e.enableCSM&&t[0])for(let l=0;l<Zt.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=m.setting.reflectionSetting,i=J.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",Ye.testObj.testValue2),this.uniformGPUBuffer.setFloat("test3",Ye.testObj.testValue3),this.uniformGPUBuffer.setFloat("test4",Ye.testObj.testValue4),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",Fe.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",Fe.time),this.uniformGPUBuffer.setFloat("delta",Fe.delta),this.uniformGPUBuffer.setFloat("shadowBias",e.getShadowBias(a)),this.uniformGPUBuffer.setFloat("skyExposure",m.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",m.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",m.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",m.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",m.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",m.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",m.setting.render.renderState_split);let n=m.inputSystem.mouseX*k.pixelRatio,o=m.inputSystem.mouseY*k.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",n),this.uniformGPUBuffer.setFloat("mouseY",o),this.uniformGPUBuffer.setFloat("windowWidth",k.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",k.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",m.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",a),this.uniformGPUBuffer.setFloat("shadowSoft",m.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",e.enableCSM?1:0),this.uniformGPUBuffer.setFloat("csmMargin",m.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",Fe.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",Fe.time),this.uniformGPUBuffer.setFloat("delta",Fe.delta),this.uniformGPUBuffer.setFloat("shadowBias",m.setting.shadow.shadowBias),this.uniformGPUBuffer.setFloat("skyExposure",m.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",m.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",m.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",m.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",m.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",m.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",m.setting.render.renderState_split);let t=m.inputSystem.mouseX*k.pixelRatio,a=m.inputSystem.mouseY*k.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",t),this.uniformGPUBuffer.setFloat("mouseY",a),this.uniformGPUBuffer.setFloat("windowWidth",k.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",k.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",m.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",m.setting.shadow.shadowSize),this.uniformGPUBuffer.setFloat("shadowSoft",m.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",0),this.uniformGPUBuffer.setFloat("csmMargin",m.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 f0{setting;probesBufferData;probesBuffer;isVolumeFrameChange=!0;randomOrientation;startPosition=new u;isVolumeChange=!0;irradianceVolumeBuffer;directionDistance=20;randomSeedCount=3;useRandomIndex=0;centerDirection=new u(0,0,this.directionDistance).normalize(1);arroundPositions=[];updateOrientation(){return this.useRandomIndex++,this.useRandomIndex>=this.arroundPositions.length&&(this.useRandomIndex=0),E.fromToRotation(this.centerDirection,this.arroundPositions[this.useRandomIndex],this.randomOrientation),this.randomOrientation}init(e){this.setting=e,this.randomOrientation=new E(!1),this.randomOrientation.identity(),this.irradianceVolumeBuffer=new dt(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 u(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 ve(e*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST)}}uploadBuffer(){this.isVolumeChange&&(this.fillIrradianceData(),this.isVolumeChange=!1,this.isVolumeFrameChange=!0),this.probesBuffer.setFloat32Array("uniformFramesBuffer",this.probesBufferData)}calcPosition(e,t,a,r){let i=this.setting,n=this.setting.probeSpace;return r=r||new u,r.x=e*n-n*(i.probeXCount-1)*.5+i.offsetX,r.y=t*n-n*(i.probeYCount-1)*.5+i.offsetY,r.z=a*n-n*(i.probeZCount-1)*.5+i.offsetZ,r}debugX=0;debugY=0;debugZ=0;fillIrradianceData(){let e=this.setting,t=this.calcPosition(0,0,0,this.startPosition);this.irradianceVolumeBuffer.setFloat("orientationIndex",this.randomOrientation.index),this.irradianceVolumeBuffer.setFloat("hysteresis",e.hysteresis),this.irradianceVolumeBuffer.setFloat("OctRTSideSize",e.octRTSideSize),this.irradianceVolumeBuffer.setFloat("OctRTMaxSize",e.octRTMaxSize),this.irradianceVolumeBuffer.setFloat("startX",t.x),this.irradianceVolumeBuffer.setFloat("startY",t.y),this.irradianceVolumeBuffer.setFloat("startZ",t.z),this.irradianceVolumeBuffer.setFloat("ProbeSpace",e.probeSpace),this.irradianceVolumeBuffer.setFloat("probeXCount",e.probeXCount),this.irradianceVolumeBuffer.setFloat("probeYCount",e.probeYCount),this.irradianceVolumeBuffer.setFloat("probeZCount",e.probeZCount),this.irradianceVolumeBuffer.setFloat("maxDistance",e.probeSpace*1.732),this.irradianceVolumeBuffer.setFloat("depthSharpness",e.depthSharpness),this.irradianceVolumeBuffer.setFloat("ProbeSourceTextureSize",e.probeSourceTextureSize),this.irradianceVolumeBuffer.setFloat("ProbeSize",e.probeSize),this.irradianceVolumeBuffer.setFloat("bounceIntensity",e.bounceIntensity),this.irradianceVolumeBuffer.setFloat("probeRoughness",e.probeRoughness),this.irradianceVolumeBuffer.setFloat("normalBias",e.normalBias),this.irradianceVolumeBuffer.setFloat("irradianceChebyshevBias",e.irradianceChebyshevBias),this.irradianceVolumeBuffer.setFloat("rayNumber",e.rayNumber),this.irradianceVolumeBuffer.setFloat("irradianceDistanceBias",e.irradianceDistanceBias),this.irradianceVolumeBuffer.setFloat("indirectIntensity",e.indirectIntensity),this.irradianceVolumeBuffer.setFloat("ddgiGamma",e.ddgiGamma),this.irradianceVolumeBuffer.setFloat("lerpHysteresis",e.lerpHysteresis),this.irradianceVolumeBuffer.setFloat("debugX",this.debugX),this.irradianceVolumeBuffer.setFloat("debugY",this.debugY),this.irradianceVolumeBuffer.setFloat("debugZ",this.debugZ),this.irradianceVolumeBuffer.apply()}}class d0{storageGPUBuffer;irradianceVolume;_lightList=[];constructor(){this.storageGPUBuffer=new ve(ms.lightSize*m.setting.light.maxLight,GPUBufferUsage.COPY_SRC),this.irradianceVolume=new f0,this.irradianceVolume.init(m.setting.gi);for(let e=0;e<m.setting.light.maxLight;e++){let t=this.storageGPUBuffer.memory.allocation_node(ms.lightSize*4);this._lightList.push(t)}this.storageGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e){this.storageGPUBuffer.clean();let t=J.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 h0{storageGPUBuffer;reflectionMap;sourceReflectionMap;count;constructor(){this.storageGPUBuffer=new ve(768)}update(e){this.storageGPUBuffer.clean();let t=J.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 u0 extends Qa{size;constructor(e,t=0,a){super(),this.bufferType=aa.StorageGPUBuffer,this.size=e,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"MatrixGPUBuffer")}writeBufferByHeap(e,t){let a;e instanceof Float64Array?a=new Float32Array(e):a=e;let r=k.device;if(a.length>0){let i=null;for(;this.mapAsyncReady.length&&(i=this.mapAsyncReady.shift(),i.usedSize!=a.byteLength);)i.destroy(),this.mapAsyncBuffersOutstanding--,i=null;i||(i=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,mappedAtCreation:!0}),i.usedSize=a.byteLength,this.mapAsyncBuffersOutstanding++,this.mapAsyncBuffersOutstanding>10&&console.warn(` Warning: mapAsync requests from ${this.mapAsyncBuffersOutstanding} frames ago have not resolved yet. MB of staging buffers allocated.`));let n=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(n),i.unmap();const l=r.createCommandEncoder();l.copyBufferToBuffer(i,0,this.buffer,0,t*4),r.queue.submit([l.finish()]),i.mapAsync(GPUMapMode.WRITE).then(()=>this.mapAsyncReady.push(i))}}}class b0{uuid;index;usage;groupBufferSize;matrixBufferDst;constructor(){this.uuid=Et(),this.groupBufferSize=0,this.usage=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.cacheWorldMatrix()}cacheWorldMatrix(){this.groupBufferSize=E.maxCount*E.blockBytes,this.matrixBufferDst=new u0(this.groupBufferSize/4),this.matrixBufferDst.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBufferDst.buffer.label=this.groupBufferSize.toString()}writeBuffer(e){const t=E.dynamicMatrixBytes;this.matrixBufferDst.mapAsyncWrite(t,e)}}class oe{static _cameraBindGroups;static _lightEntriesMap;static _reflectionEntriesMap;static modelMatrixBindGroup;static init(){this.modelMatrixBindGroup=new b0,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 Qn(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 Qn(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 d0,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 h0,this._reflectionEntriesMap.set(e,t)),this._reflectionEntriesMap.get(e)}}class y{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(y.lastShader!=t)y.lastShader=t;else return!1;y.lastPipeline!=t.pipeline&&(y.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=oe.getCameraGroup(t);e.setBindGroup(0,a.globalBindGroup)}static bindGeometryBuffer(e,t){if(this.lastGeometry!=t&&(this.lastGeometry=t,t.indicesBuffer)){e.setIndexBuffer(t.indicesBuffer.indicesGPUBuffer.buffer,t.indicesBuffer.indicesFormat);let a=t.vertexBuffer.vertexGPUBuffer,r=t.vertexBuffer.vertexBufferLayouts;for(let i=0;i<r.length;i++){const n=r[i];e.setVertexBuffer(i,a.buffer,n.offset,n.size)}}}static cleanCache(){this.lastGeometry=null,this.lastPipeline=null,this.lastShader=null}static createPipeline(e){return Ye.countStart("GPUContext","pipeline"),k.device.createRenderPipeline(e)}static beginCommandEncoder(){return Ye.countStart("GPUContext","beginCommandEncoder"),this.LastCommand&&k.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=k.device.createCommandEncoder(),this.LastCommand}static endCommandEncoder(e){this.LastCommand==e&&(k.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=null,Ye.countStart("GPUContext","endCommandEncoder"))}static recordBundleEncoder(e){return k.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=k.context.getCurrentTexture().createView()):a.view=k.context.getCurrentTexture().createView()),e.beginRenderPass(t.renderPassDescriptor)}}static drawIndexed(e,t,a,r,i,n){e.drawIndexed(t,a,r,i,n),this.drawCount++}static draw(e,t,a,r,i){e.draw(t,a,r,i),this.drawCount++}static endPass(e){e.insertDebugMarker("end"),e.end()}static computeCommand(e,t){let a=e.beginComputePass();for(let r=0;r<t.length;r++)t[r].compute(a);a.end()}static copyTexture(e,t,a){e.copyTextureToTexture({texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{width:a.width,height:a.height,depthOrArrayLayers:1})}}class g0{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 ve(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 ve(e*3,t),this.output.apply()}}}}class p0{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 g0,this._normalAttrDataGroup=new g0}initMorphTarget(e){this._collectMorphTargetData=this.collectMorphTargetList(e),this._computeShader&&this._computeShader.destroy();let t=Pt.CsMain;this._computeShader=new fe(t),this._collectMorphTargetData.mergedNormal?this._computeShader.setDefine("USE_MORPHNORMALS",!0):this._computeShader.deleteDefine("USE_MORPHNORMALS"),this._computeShaders=[this._computeShader],this._isInfluenceDirty=!0,this._morphTargetCount=this._collectMorphTargetData.mtCount,this._totalVertexCount=this._collectMorphTargetData.vCount,this._morphInfluenceArray.fill(0),this._computeWorkGroupXY=this.calcWorkGroup(this._totalVertexCount),this._positionAttrDataGroup.reset(this._collectMorphTargetData.mergedPos),this._normalAttrDataGroup.reset(this._collectMorphTargetData.mergedNormal)}applyRenderShader(e){this.uploadMorphTargetBuffer(),this.uploadConfigGBuffer(),e.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),e.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&e.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)}computeMorphTarget(e){this.uploadConfigGBuffer(),this.uploadMorphTargetBuffer(),this._computeShader.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),this._computeShader.setStorageBuffer("morphTargetInfluence",this._morphInfluenceBuffer),this._computeShader.setStorageBuffer("morphTargetPositions",this._positionAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&(this._computeShader.setStorageBuffer("morphTargetNormals",this._normalAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)),this._computeShader.workerSizeX=this._computeWorkGroupXY,this._computeShader.workerSizeY=this._computeWorkGroupXY,this._computeShader.workerSizeZ=1,y.computeCommand(e,this._computeShaders)}updateInfluence(e,t){this._isInfluenceDirty=!0,this._morphInfluenceArray[e]=t}get blendShape(){return this._blendTarget}collectMorphTargetList(e){let t=this.collectAttribute("a_morphPositions_",e),a=t.length,r=t[0].data.length/3;if(this._blendTarget={},e.blendShapeData)for(let l=0;l<e.blendShapeData.shapeIndexs.length;l++){let c=e.blendShapeData.shapeIndexs[l],f=e.blendShapeData.shapeNames[l].split("."),d=f[f.length-1];this._blendTarget[d]=h=>this.updateInfluence(c,h)}let i=new Float32Array(r*a*3);{let l=0;for(let c=0;c<a;c++){let f=t[c];i.set(f.data,l),l+=f.data.length}}let n=this.collectAttribute("a_morphNormals_",e),o;if(n&&n.length>0){let l=0;o=new Float32Array(r*a*3);for(let c=0;c<a;c++){let f=n[c];o.set(f.data,l),l+=f.data.length}}return{mtCount:a,vCount:r,mergedPos:i,mergedNormal:o}}collectAttribute(e,t){let a=[];for(let r=0;r<this.MaxMorphTargetCount;r++){let i=e+r,n=t.getAttribute(i);if(n)a[r]=n;else break}return a}uploadConfigGBuffer(){if(this._isInfluenceDirty){let e=0;for(let t=0;t<this._morphTargetCount;t++)e+=this._morphInfluenceArray[t];this._morphInfluenceBuffer.setFloat32Array("data",this._morphInfluenceArray),this._morphInfluenceBuffer.apply(),this._computeConfigArray[0]=this.morphTargetsRelative?1:1-e,this._computeConfigArray[1]=this._morphTargetCount,this._computeConfigArray[2]=this._totalVertexCount,this._computeConfigArray[3]=this._computeWorkGroupXY,this._computeConfigBuffer.setFloat32Array("data",this._computeConfigArray),this._computeConfigBuffer.apply(),this._isInfluenceDirty=!1}}calcWorkGroup(e){let t=Math.ceil(Math.sqrt(e)),a=Math.ceil(Math.log2(t));return t=Math.pow(2,a),t}uploadMorphTargetBuffer(){this._positionAttrDataGroup.output||this._positionAttrDataGroup.apply(this._totalVertexCount),this._normalAttrDataGroup.output||this._normalAttrDataGroup.apply(this._totalVertexCount)}generateGPUBuffer(){this._computeConfigArray=new Float32Array(4),this._computeConfigBuffer=new dt(4),this._morphInfluenceArray=new Float32Array(this.MaxMorphTargetCount);let e=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;this._morphInfluenceBuffer=new ve(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 x2=Object.defineProperty,y2=Object.getOwnPropertyDescriptor,Tn=(s,e,t,a)=>{for(var r=a>1?void 0:a?y2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(a?n(e,t,r):n(r))||r);return a&&r&&x2(e,t,r),r};let $=class extends Na{receiveShadow;morphData;constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(s){s.addComponent($).copyComponent(this)}copyComponent(s){return super.copyComponent(s),this.receiveShadow=s.receiveShadow,this}get geometry(){return this._geometry}set geometry(s){if(super.geometry=s,s){let e=s.morphTargetDictionary!=null;e&&(this.morphData||=new p0,this.morphData.morphTargetsRelative=s.morphTargetsRelative,this.morphData.initMorphTarget(s)),this.morphData&&(this.morphData.enable=e),this.morphData?.enable?this.addRendererMask(Be.MorphTarget):this.removeRendererMask(Be.MorphTarget),this.object3D.bound=this._geometry.bounds.clone()}else this.morphData&&(this.morphData.enable=!1),this.removeRendererMask(Be.MorphTarget);this._readyPipeline||(this.initPipeline(),this._computes&&(this.onCompute=us(this.onCompute,()=>{for(let e=0;e<this._computes.length;e++)this._computes[e].onUpdate()})))}get material(){return this._materials[0]}set material(s){this.materials=[s]}setMorphInfluence(s,e){if(this.morphData&&this.morphData.enable){let t=this._geometry.morphTargetDictionary[s];t>=0&&this.morphData.updateInfluence(t,e)}}setMorphInfluenceIndex(s,e){this.morphData&&this.morphData.enable&&s>=0&&this.morphData.updateInfluence(s,e)}onCompute(s,e){this.morphData&&this.morphData.enable&&this.morphData.computeMorphTarget(e)}nodeUpdate(s,e,t,a){if(this.morphData&&this.morphData.enable)for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++)this.morphData.applyRenderShader(n[o])}super.nodeUpdate(s,e,t,a)}destroy(s){this.morphData&&(this.morphData.destroy(s),this.morphData=null),super.destroy(s)}};Tn([jr],$.prototype,"geometry",1),Tn([jr],$.prototype,"material",1),$=Tn([Vt($,"MeshRenderer")],$);class Ua{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 m0{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]:m.res.redTexture}}class At extends He{resolveTarget;sampleCount;autoResize;clear;constructor(e,t,a=Y.rgba8unorm,r=!1,i,n=1,o=0,l=!0,c=!0){super(e,t,n),this.name=Et(),this.autoResize=c,this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.clear=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t),this.autoResize&&k.addEventListener(Ha.RESIZE,f=>{let{width:d,height:h}=f.data;this.resize(d,h),this._textureChange=!0},this)}resize(e,t){let a=k.device;this.gpuTexture&&(He.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==Y.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==Y.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==Y.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.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=Ot.clamp_to_edge,this.addressModeV=Ot.clamp_to_edge,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=k.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=y.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(l)}clone(){let e=new At(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=k.device,t=k.windowWidth,a=k.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return y.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class ke{storeOp="store";loadOp="clear";clearValue=[0,0,0,0]}class je{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 ke;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 je([],[]);return this.clone2Frame(e),e}}class ne extends je{static colorPass_GBuffer="ColorPassGBuffer";static reflections_GBuffer="reflections_GBuffer";static gui_GBuffer="gui_GBuffer";static gBufferMap=new Map;_colorBufferTex;_compressGBufferTex;constructor(){super([],[])}createGBuffer(e,t,a,r=!0,i=!0,n){let o=this.renderTargets,l=this.rtDescriptors;if(i){let f=new ke;f.loadOp="clear",this._colorBufferTex=vt.createRTTexture(e+Ua.colorBufferTex_NAME,t,a,Y.rgba16float,!0),o.push(this._colorBufferTex),l.push(f)}this._compressGBufferTex=new At(t,a,Y.rgba32float,!1,void 0,1,0,!0,!0),o.push(this._compressGBufferTex),n?this.depthTexture=n:(this.depthTexture=new At(t,a,Y.depth24plus,!1,void 0,1,0,!0,!0),this.depthTexture.name=e+"_depthTexture");let c;c=new ke,l.push(c)}getPositionMap(){return this.renderTargets[1]}getNormalMap(){return this.renderTargets[2]}getColorTexture(){return this._colorBufferTex}getCompressGBufferTexture(){return this._compressGBufferTex}static getGBufferFrame(e,t=0,a=0,r=!0,i){let n;if(ne.gBufferMap.has(e))n=ne.gBufferMap.get(e);else{n=new ne;let o=k.presentationSize;n.createGBuffer(e,t==0?o[0]:t,a==0?o[1]:a,t!=0&&a!=0,r,i),ne.gBufferMap.set(e,n)}return n}static getGUIBufferFrame(){let e=this.getGBufferFrame(this.colorPass_GBuffer);return ne.getGBufferFrame(ne.gui_GBuffer,0,0,!0,e.depthTexture)}clone(){let e=new ne;return this.clone2Frame(e),e}}class Qe{static rendererPassState=new Map;static createRendererPassState(e,t=null){let a=Qe.rendererPassState.get(e);if(a||(a=new m0,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,Qe.rendererPassState.set(e,a)),e&&e.renderTargets.length>0){a.renderTargets=e.renderTargets,a.rtTextureDescriptors=e.rtDescriptors,a.renderPassDescriptor=Qe.getRenderPassDescriptor(a),a.renderPassDescriptor.depthStencilAttachment&&(a.renderPassDescriptor.depthStencilAttachment.depthLoadOp=e.depthLoadOp),t=="load"&&e?.renderTargets[0]&&e.renderTargets[0].name.startsWith(ne.gui_GBuffer)&&(a.renderPassDescriptor.colorAttachments[0].loadOp="load"),a.depthLoadOp=e.depthLoadOp,a.renderBundleEncoderDescriptor=Qe.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(Ua.colorBufferTex_NAME)!=-1&&(a.outColor=r)}}else a.renderPassDescriptor=Qe.getRenderPassDescriptor(a,t),a.renderBundleEncoderDescriptor=Qe.getRenderBundleDescriptor(a),a.renderTargetTextures=[{format:k.presentationFormat}],a.outColor=0;return a}static getRenderPassDescriptor(e,t=null){if(e.renderPassDescriptor)return e.renderPassDescriptor;k.device,k.presentationSize;let a=[];if(e.renderTargets&&e.renderTargets.length>0){e.renderTargets[0].width,e.renderTargets[0].height;for(let i=0;i<e.renderTargets.length;i++){const n=e.renderTargets[i],o=e.rtTextureDescriptors[i];a.push({view:n.getGPUView(),resolveTarget:void 0,loadOp:o.loadOp,clearValue:o.clearValue,storeOp:o.storeOp})}}else if(!e.customSize){let i=k.canvasConfig&&k.canvasConfig.alpha?[1,1,1,0]:[0,0,0,1];e.isOutTarget==!0&&a.push({view:void 0,resolveTarget:void 0,loadOp:k.canvasConfig&&k.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;k.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 ei extends Ee{width;height;segmentW;segmentH;up;constructor(e,t,a=1,r=1,i=u.Y_AXIS){super(),this.width=e,this.height=t,this.segmentW=a,this.segmentH=r,this.up=i,this.buildGeometry(this.up)}buildGeometry(e){var t,a,r,i,n=this.segmentW+1;(this.segmentH+1)*n,this.bounds=new ge(u.ZERO.clone(),new u(this.width,1,this.height)),r=this.segmentH*this.segmentW*6;let o=(this.segmentW+1)*(this.segmentH+1),l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d;this.segmentW*this.segmentH*2*3>=Uint16Array.length?d=new Uint32Array(this.segmentW*this.segmentH*2*3):d=new Uint16Array(this.segmentW*this.segmentH*2*3),r=0;for(var b=0,p=0,g=0,A=0;A<=this.segmentH;++A)for(var D=0;D<=this.segmentW;++D){switch(t=(D/this.segmentW-.5)*this.width,a=(A/this.segmentH-.5)*this.height,e){case u.Y_AXIS:l[b++]=t,l[b++]=0,l[b++]=a,c[p++]=0,c[p++]=1,c[p++]=0;break;case u.Z_AXIS:l[b++]=t,l[b++]=-a,l[b++]=0,c[p++]=0,c[p++]=0,c[p++]=1;break;case u.X_AXIS:l[b++]=0,l[b++]=t,l[b++]=a,c[p++]=1,c[p++]=0,c[p++]=0;break;default:l[b++]=t,l[b++]=0,l[b++]=a,c[p++]=0,c[p++]=1,c[p++]=0;break}f[g++]=D/this.segmentW,f[g++]=A/this.segmentH,D!=this.segmentW&&A!=this.segmentH&&(i=D+A*n,d[r++]=i+1,d[r++]=i,d[r++]=i+n,d[r++]=i+1,d[r++]=i+n,d[r++]=i+n+1)}this.setIndices(d),this.setAttribute(V.position,l),this.setAttribute(V.normal,c),this.setAttribute(V.uv,f),this.setAttribute(V.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}var C2=Object.getOwnPropertyDescriptor,S2=(s,e,t,a)=>{for(var r=a>1?void 0:a?C2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Bi=class extends ot{constructor(s="QuadGlsl_vs",e="QuadGlsl_fs"){super();let t=new Ve(s,e);this.addRenderPass(t);let a=t.shaderState;t.blendMode=ae.NONE,a.frontFace="cw",a.depthWriteEnabled=!1,a.depthCompare=et.always,a.multisample=0,this.setTexture("baseMap",m.res.blackTexture),this.setUniformFloat("x",0),this.setUniformFloat("y",0),this.setUniformFloat("width",100),this.setUniformFloat("height",100)}};Bi=S2([Ia(Bi,"QuadShader")],Bi);class Mn extends ee{width=128;height=128;quadRenderer;material;rendererPassState;quadShader;constructor(e="QuadGlsl_vs",t="QuadGlsl_fs",a,r=0,i=!1){super();let n=a?a.renderTargets:[];this.material=new mt,this.quadShader=new Bi(e,t),this.material.shader=this.quadShader,this.quadRenderer=this.addComponent($),this.quadRenderer.material=this.material,this.quadRenderer.castGI=!1,this.quadRenderer.castShadow=!1,this.quadRenderer.drawType=i?2:0,this.quadRenderer.geometry=new ei(100,100,1,1),this.quadRenderer.material=this.material,this.quadRenderer.__start(),this.quadRenderer._enable=!0,this.quadRenderer.onEnable(),this.rendererPassState=Qe.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=k.device.createTexture({size:{width:k.presentationSize[0],height:k.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:k.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT})),k.addEventListener(Ha.RESIZE,o=>{this.rendererPassState=Qe.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=k.device.createTexture({size:{width:k.presentationSize[0],height:k.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:k.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT}))},this)}renderTarget(e,t,a){let r=e.camera,i=y.beginRenderPass(a,t.rendererPassState);y.bindCamera(i,r),t.quadRenderer.nodeUpdate(e,H.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,H.COLOR,t.rendererPassState,null,i),y.endPass(i)}renderToViewQuad(e,t,a,r){let i=e.camera;t.quadShader.setTexture("baseMap",r);let n=y.beginRenderPass(a,t.rendererPassState);y.bindCamera(n,i),t.quadRenderer.nodeUpdate(e,H.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,H.COLOR,t.rendererPassState,null,n),y.endPass(n)}}class vt{static rtTextureMap;static rtViewQuad;static init(){this.rtTextureMap=new Map,this.rtViewQuad=new Map}static createRTTexture(e,t,a,r,i=!1,n=0){let o=this.rtTextureMap.get(e);return o||(e==Ua.colorBufferTex_NAME?o=new At(t,a,r,i,void 0,1,n,!1):o=new At(t,a,r,i,void 0,1,n,!0),o.name=e,vt.rtTextureMap.set(e,o)),o}static createRTTextureArray(e,t,a,r,i=1,n=!1,o=0){let l=this.rtTextureMap.get(e);return l||(l=new At(t,a,r,n,void 0,i,o),l.name=e,vt.rtTextureMap.set(e,l)),l}static createViewQuad(e,t,a,r,i=0){let n=new je([r],[new ke]),o=new Mn(t,a,n,i);return vt.rtViewQuad.set(e,o),o}static getTexture(e){return this.rtTextureMap.get(e)}static CreateSplitTexture(e){let t=this.getTexture(Ua.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(Ua.colorBufferTex_NAME),a=this.getTexture(e+"_split");const r=y.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}),y.endCommandEncoder(r)}}class Nn{command;encoder;rendererPassStates;rtFrame;constructor(e){this.rtFrame=e,this.rendererPassStates=[]}clean(){this.rendererPassStates.length=0,y.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=Qe.createRendererPassState(a,e);return this.rendererPassStates.push(r),r}else{this.rtFrame.depthLoadOp=t;let a=Qe.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=y.beginCommandEncoder(),this.command}endCommand(){y.endCommandEncoder(this.command),this.command=null}beginNewEncoder(){return this.encoder=y.beginRenderPass(this.command,this.rendererPassState),this.encoder}endEncoder(){y.endPass(this.encoder),this.encoder=null}}class xa extends Ra{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=Qe.createRendererPassState(e);let t=e.clone();t.depthLoadOp="load";for(const a of t.rtDescriptors)a.loadOp="load";this.splitRendererPassState=Qe.createRendererPassState(t)}this.renderContext=new Nn(e)}getRenderContext(e){return this._rtFrame=e,new Nn(e)}setIrradiance(e,t){this.rendererPassState.irradianceBuffer=[e,t]}compute(e,t){}render(e,t,a,r=!1){y.cleanCache();let i=e.camera,n=e.scene;this.rendererPassState.camera3D=i;let o=J.instance.getRenderNodes(n,i),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{let f=y.beginCommandEncoder(),d=y.beginRenderPass(f,this.rendererPassState);l.length>0&&d.executeBundles(l),!r&&J.instance.sky&&(y.bindCamera(d,i),J.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,d)),this.drawRenderNodes(e,d,f,o.opaqueList,t),y.endPass(d),y.endCommandEncoder(f)}{let f=y.beginCommandEncoder(),d=y.beginRenderPass(f,this.rendererPassState);c.length>0&&d.executeBundles(c),r||(y.bindCamera(d,i),this.drawRenderNodes(e,d,f,o.transparentList,t)),y.endPass(d),y.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=J.instance.getOpRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=y.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}renderBundleTr(e,t,a,r){let i=J.instance.getTrRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=y.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}recordRenderBundleNode(e,t,a,r){y.bindCamera(t,e.camera),y.bindGeometryBuffer(t,a[0].geometry);for(let i=0;i<a.length;++i){let n=a[i];n.transform.worldMatrix.index,n.transform.enable&&n.recordRenderPass2(e,this._rendererType,this.rendererPassState,r,t)}}drawRenderNodes(e,t,a,r,i,n){y.bindCamera(t,e.camera);for(let o=m.setting.render.drawOpMin;o<Math.min(r.length,m.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)}}}class A0 extends xa{constructor(){super(),this.passType=H.COLOR}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,n=e.camera;oe.updateCameraGroup(n),this.rendererPassState.camera3D=n;let o=J.instance.getRenderNodes(i,n),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{this.renderContext.beginOpaqueRenderPass();let f=this.renderContext.encoder;l.length>0&&(J.instance.getOpRenderGroup(i),f.executeBundles(l)),!r&&J.instance.sky&&(y.bindCamera(f,n),J.instance.sky.preInit(this._rendererType)||J.instance.sky.nodeUpdate(e,this._rendererType,this.rendererPassState,a),J.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,f)),o.opaqueList&&(y.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let f=this.renderContext.encoder;c.length>0&&f.executeBundles(c),!r&&o.transparentList&&(y.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.transparentList,t,a));let d=J.instance.getGraphicList();for(let h=0;h<d.length;h++){const b=d[h];b.nodeUpdate(e,this._rendererType,this.splitRendererPassState,a),b.renderPass2(e,this._rendererType,this.splitRendererPassState,a,f)}this.renderContext.endRenderPass(),Ye.end("ColorPass Draw Transparent")}}drawNodes(e,t,a,r,i){let n=J.instance.getRenderShaderCollect(e);if(n){for(const o of n){let l=o[1];for(const c of l){let f=c[1];if(!f.isDestroyed&&f.preInit(this._rendererType)){f.nodeUpdate(e,this._rendererType,this.rendererPassState,i);break}}}for(let o=m.setting.render.drawOpMin;o<Math.min(a.length,m.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(l.hasMask(Be.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 Vn{frustumCullingList;zVisibleList;_renderList;static enable=!0;constructor(){this._renderList=new Map}occlusionRenderNodeTest(e){return m.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 ti extends Qa{constructor(e,t){super(),this.bufferType=aa.ComputeGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,e,t,"ComputeGPUBuffer")}}class D0{clusterBuffer;lightAssignBuffer;assignTableBuffer;clustersUniformBuffer;constructor(e,t){this.clusterBuffer=new ti(e*2*4),this.clustersUniformBuffer=new dt(10),this.clustersUniformBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.lightAssignBuffer=new ti(e*t),this.lightAssignBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.assignTableBuffer=new ti(e*4),this.assignTableBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e,t,a,r,i,n,o,l,c,f){this.clustersUniformBuffer.setFloat("clusterTileX",r),this.clustersUniformBuffer.setFloat("clusterTileY",i),this.clustersUniformBuffer.setFloat("clusterTileZ",n),this.clustersUniformBuffer.setFloat("numLights",o),this.clustersUniformBuffer.setFloat("maxNumLightsPerCluster",l),this.clustersUniformBuffer.setFloat("near",c),this.clustersUniformBuffer.setFloat("far",f),this.clustersUniformBuffer.setFloat("screenWidth",e),this.clustersUniformBuffer.setFloat("screenHeight",t),this.clustersUniformBuffer.setFloat("clusterPix",a),this.clustersUniformBuffer.apply()}}class gt{static clusterTileX=16;static clusterTileY=16;static clusterTileZ=32}let _0=`
|
|
5995
|
+
`;class ot{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(H.COLOR)}getDefaultColorShader(){return this.passShader.get(H.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 ot,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 p2=Object.getOwnPropertyDescriptor,m2=(s,e,t,a)=>{for(var r=a>1?void 0:a?p2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Di=class extends ot{constructor(){super();const s=new Ve("gsplat_vs_dc","gsplat_fs_dc");s.passType=H.COLOR,s.setShaderEntry("VertMain","FragMain"),s.topology=cn.triangle_list,s.depthWriteEnabled=!1,s.cullMode=wt.none,s.shaderState.transparent=!0,s.shaderState.blendMode=ae.NORMAL,s.shaderState.writeMasks=[15,15],s.shaderState.castReflection=!1,this.addRenderPass(s),this.setDefault()}setDefault(){const s=this.getDefaultColorShader(),e=new E;s.setUniform("modelMatrix",e.rawData),s.setUniform("pixelCull",new Float32Array([2,0,0,0]))}};Di=m2([Ia(Di,"GSplatShader")],Di);class e0 extends mt{_pixelCullArray=new Float32Array(4);constructor(){super(),z.register("gsplat_vs_dc",qc),z.register("gsplat_fs_dc",$c),this.shader=new Di}setSplatTextures(e,t,a,r,i){const n=this.shader.getDefaultColorShader();n.setTexture("splatColor",e),n.setTexture("transformA",t),n.setTexture("transformB",a),n.setUniformArray("tex_params",r),i&&n.setTexture("splatOrder",i),n.shaderState.depthCompare=et.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)}}class Ds extends Qa{node;constructor(e){super(),this.bufferType=aa.VertexGPUBuffer,this.createVertexBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,e)}createVertexBuffer(e,t){let a=k.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 Ka,this.memoryNodes=new Map,this.memory.allocation(this.byteSize),this.node=this.memory.allocation_node(this.byteSize)}}var bt=(s=>(s[s.split=0]="split",s[s.compose=1]="compose",s[s.compose_bin=2]="compose_bin",s))(bt||{});class t0{vertexCount=0;vertexGPUBuffer;geometryType=bt.compose;_vertexBufferLayouts;_attributeSlotLayouts;_attributeLocation;constructor(){this._vertexBufferLayouts=[],this._attributeLocation={},this._attributeSlotLayouts=[]}get vertexBufferLayouts(){return this._vertexBufferLayouts}createVertexBuffer(e,t){switch(this.geometryType){case bt.split:this.createSplitVertexBuffer(e,t);break;case bt.compose:this.createComposeVertexBuffer(e,t);break;case bt.compose_bin:this.createComposBinVertexBuffer(e,t);break}}createSplitVertexBuffer(e,t){let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:0,shaderLocation:i.location,stride:$a[i.format]};this._attributeSlotLayouts[i.location]=[n];let o=e.get(i.name);o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o));let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l,this._vertexBufferLayouts[i.location]={name:i.name,arrayStride:i.size*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[i.location],offset:a*4,size:this.vertexCount*i.size*4},a+=this.vertexCount*i.size}this.vertexGPUBuffer=new Ds(a)}createComposeVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let r=0;r<t.attributes.length;r++){const i=t.attributes[r];if(i.name=="index"||i.type=="builtin")continue;this._attributeLocation[i.name]=i.location;let n={name:i.name,format:i.format,offset:a*4,shaderLocation:i.location,stride:$a[i.format]};this._attributeSlotLayouts[0][i.location]=n;let o=e.get(i.name);if(o||(o={attribute:i.name,data:new Float32Array(i.size*this.vertexCount)},e.set(i.name,o)),o.data){let l=o.data.length/n.stride;this.vertexCount!=0&&this.vertexCount!=l&&console.error(" vertex count not match attribute count"),this.vertexCount=l}a+=i.size}this._vertexBufferLayouts[0]={name:"composeStruct",arrayStride:a*4,stepMode:"vertex",attributes:this._attributeSlotLayouts[0],offset:0,size:this.vertexCount*a*4},this.vertexGPUBuffer=new Ds(this.vertexCount*a)}createComposBinVertexBuffer(e,t){this._attributeSlotLayouts[0]=[];let a=0;for(let n=0;n<t.attributes.length;n++){const o=t.attributes[n];if(o.name=="index"||o.type=="builtin")continue;this._attributeLocation[o.name]=o.location;let l={name:o.name,format:o.format,offset:a*4,shaderLocation:o.location,stride:$a[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(V.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 Ds(this.vertexCount*a)}upload(e,t){if(this.vertexGPUBuffer){switch(this.geometryType){case bt.split:{let a=this._attributeLocation[e],r=this._vertexBufferLayouts[a];this.vertexGPUBuffer.node.setFloat32Array(r.offset/4,t.data)}break;case bt.compose:for(let a=0;a<this.vertexCount;a++){const r=this._attributeSlotLayouts[0][this._attributeLocation[e]];for(let i=0;i<r.stride;i++){let n=t.data[a*r.stride+i],o=a*(this._vertexBufferLayouts[0].arrayStride/4)+r.offset/4+i;this.vertexGPUBuffer.node.setFloat(n,o)}}break;case bt.compose_bin:this.vertexGPUBuffer.node.setFloat32Array(0,t.data);break}this.vertexGPUBuffer?.apply()}}updateAttributes(e){switch(this.geometryType){case bt.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 bt.compose:for(let t=0;t<this.vertexCount;t++)this._attributeSlotLayouts.forEach(a=>{for(let r=0;r<a.length;r++){const i=a[r];let n=e.get(i.name);for(let o=0;o<i.stride;o++){let l=n.data[t*i.stride+o],c=t*(this._vertexBufferLayouts[0].arrayStride/4)+i.offset/4+o;this.vertexGPUBuffer.node.setFloat(l,c)}}});break;case bt.compose_bin:{let t=e.get(V.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 a0 extends Qa{indicesNode;constructor(e){super(),this.bufferType=aa.IndicesGPUBuffer,this.createIndicesBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.INDEX|GPUBufferUsage.INDIRECT,e)}createIndicesBuffer(e,t){let a=k.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 Ka,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 r0{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 a0(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 i0{lodLevels}class Ee{instanceID;name;subGeometries=[];morphTargetsRelative;morphTargetDictionary;skinNames;bindPose;blendShapeData;vertexDim;vertexCount=0;_bounds;_attributeMap;_attributes;_indicesBuffer;_vertexBuffer;_onChange=!0;_wireframeLines;_isDestroyed=!1;constructor(){this.instanceID=Et(),this._attributeMap=new Map,this._attributes=[],this._vertexBuffer=new t0}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 pe(new u,new u(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(V.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 i0;return t.lodLevels=e,this.subGeometries.push(t),t}generate(e){this._onChange&&(this._onChange=!1,this._indicesBuffer.upload(this.getAttribute(V.indices).data),this._vertexBuffer.createVertexBuffer(this._attributeMap,e),this._vertexBuffer.updateAttributes(this._attributeMap),this.vertexCount=this._vertexBuffer.vertexCount)}setIndices(e){if(!this._attributeMap.has(V.indices)){let t={attribute:V.indices,data:e};this._attributeMap.set(V.indices,t),this._indicesBuffer=new r0,this._indicesBuffer.createIndicesBuffer(t)}}setAttribute(e,t){if(e==V.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==bt.split||this.geometryType==bt.compose){let e=this.getAttribute(V.position),t=this.getAttribute(V.indices);if(t&&e&&t.data.length>0){let a=e.data,r=[];for(let i=0;i<t.data.length/3;i++){const n=t.data[i*3+0],o=t.data[i*3+1],l=t.data[i*3+2];let c=new u(a[n*3+0],a[n*3+1],a[n*3+2]),f=new u(a[o*3+0],a[o*3+1],a[o*3+2]),d=new u(a[l*3+0],a[l*3+1],a[l*3+2]);r.push(c,f),r.push(f,d),r.push(d,c)}return this._wireframeLines=r,r}}else if(this.geometryType==bt.compose_bin){let e=this.getAttribute(V.all),t=this.vertexDim,a=this.getAttribute(V.indices);if(a&&e&&a.data.length>0){let r=e.data,i=[];for(let n=0;n<a.data.length/3;n++){const o=a.data[n*3+0],l=a.data[n*3+1],c=a.data[n*3+2];let f=new u(r[o*t+0],r[o*t+1],r[o*t+2]),d=new u(r[l*t+0],r[l*t+1],r[l*t+2]),h=new u(r[c*t+0],r[c*t+1],r[c*t+2]);i.push(f,d),i.push(d,h),i.push(h,f)}return this._wireframeLines=i,i}}return null}compute(){this._indicesBuffer&&this._indicesBuffer.compute(),this._vertexBuffer&&this._vertexBuffer.compute()}static crossA=u.UP.clone();static crossB=u.UP.clone();static crossRet=u.UP.clone();static point1=u.UP.clone();static point2=u.UP.clone();static point3=u.UP.clone();computeNormals(){let e=this.getAttribute(V.position),t=this.getAttribute(V.normal),a=this.getAttribute(V.indices);if(!e||!t||!a)return this;let r=a.data.length/3,i=Ee.point1,n=Ee.point2,o=Ee.point3,l=Ee.crossA,c=Ee.crossB,f=Ee.crossRet;for(let d=0;d<r;d++){let h=a.data[d*3],b=a.data[d*3+1],p=a.data[d*3+2];i.set(e.data[h*3],e.data[h*3+1],e.data[h*3+2]),n.set(e.data[b*3],e.data[b*3+1],e.data[b*3+2]),o.set(e.data[p*3],e.data[p*3+1],e.data[p*3+2]),u.sub(i,n,l).normalize(),u.sub(i,o,c).normalize();let g=l.crossProduct(c,f).normalize();t.data[h*3]=t.data[b*3]=t.data[p*3]=g.x,t.data[h*3+1]=t.data[b*3+1]=t.data[p*3+1]=g.y,t.data[h*3+2]=t.data[b*3+2]=t.data[p*3+2]=g.z}return this._vertexBuffer.upload(V.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 s0 extends Ee{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(V.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 wn extends He{_dataBuffer;create(e,t,a,r=!1){let i=k.device;const n=Math.ceil(e*4/256)*256;this.format=Y.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);const l=y.beginCommandEncoder();return l.copyBufferToTexture({buffer:o,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(l),r&&ua.webGPUGenerateMipmap(this),this}updateTexture(e,t,a){let r=k.device;const i=Math.ceil(e*4/256)*256;this.mipmapCount=Math.floor(Math.log2(e)),this._dataBuffer&&this._dataBuffer.destroy(),this._dataBuffer=null;const n=this._dataBuffer=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(n,0,a);const o=y.beginCommandEncoder();o.copyBufferToTexture({buffer:n,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(o),this.gpuSampler=r.createSampler(this),this.mipmapCount>1&&ua.webGPUGenerateMipmap(this)}}class n0 extends He{_dataBuffer;create(e,t,a){let r=k.device;const i=e*4*4;this.format=Y.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){let r=k.device;const i=e*4*4;r.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:i},{width:e,height:t,depthOrArrayLayers:1})}}class o0 extends He{_dataBuffer;create(e,t,a){let r=k.device;const i=e*4;this.format=Y.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=k.device;const i=e*4;r.queue.writeTexture({texture:this.getGPUTexture()},a.buffer,{bytesPerRow:i},{width:e,height:t,depthOrArrayLayers:1})}}const l0=new Float32Array(1),A2=new Int32Array(l0.buffer);let rr=function(s){l0[0]=s;const e=A2[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)};class Rn extends He{uint16Array;floatArray;_dataBuffer;create(e,t,a=null,r=!0){if(a==null){a=[];for(let i=0,n=e*t*4;i<n;i++)a[i]=0}return this.updateTexture(e,t,a,r),this}updateTexture(e,t,a,r=!0){(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 i=k.device;const n=e*4*2;this.format=Y.rgba16float,this.mipmapCount=Math.floor(r?Math.log2(e):1),this.createTextureDescriptor(e,t,this.mipmapCount,this.format),(!this.uint16Array||this.uint16Array.length!=a.length)&&(this.uint16Array=new Uint16Array(a.length));let o=this.uint16Array;for(let f=0,d=o.length;f<d;f++)o[f]=rr(a[f]);const l=this._dataBuffer=i.createBuffer({size:o.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});i.queue.writeBuffer(l,0,o);const c=y.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),this.useMipmap||(this.samplerBindingLayout.type="filtering",this.textureBindingLayout.sampleType="float"),y.endCommandEncoder(c),this.gpuSampler=i.createSampler(this),this.gpuTexture=this.getGPUTexture(),this.mipmapCount>1&&ua.webGPUGenerateMipmap(this)}}var D2=Object.getOwnPropertyDescriptor,_2=(s,e,t,a)=>{for(var r=a>1?void 0:a?D2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let _i=class extends Na{count=0;size=new K;splatColor;transformA;transformB;texParams;splatOrder;gsplatMaterial;_positions;get positions(){return this._positions}_worldPositions;_orderData;_sortWorker;_lastSentTime=0;_minIntervalMs=16;_centersSent=!1;_lastViewMatrixHash=0;_lastCameraSpeed=0;_adaptiveSorting=!0;_lastPixelCullParams="";_texturesInitialized=!1;_lodEnabled=!1;_lodDistances=[5,10,20,40];_lodRatios=[1,.75,.5,.25,.1];_currentLodLevel=0;_minPixelCoverage=4;_maxPixelCoverage=0;_maxPixelCullDistance=0;_mapping=null;_fullCount=0;get fullCount(){return this._fullCount}_batchSize=128;instanceCount=0;constructor(){super()}initAsset(s){this.count=s.count,this._fullCount=s.count,this.size=this.evalTextureSize(s.count),this.buildColor(s),this.buildTransform(s),this.texParams=new Float32Array([this.count,this.size.x,this.count,1]),this._positions=s.position;const e=this.size.x*this.size.y;this._orderData=new Uint32Array(e);for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;this.splatOrder=new o0().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 e0,this.geometry=new s0(this._batchSize),this.materials=[this.gsplatMaterial],this.instanceCount=0}onBeforeUpdate(s){this.count>0&&s?.camera&&(this._lodEnabled&&this.updateLOD(s),s.camera.viewMatrix&&this.scheduleOrder(s.camera.viewMatrix))}updateLOD(s){if(!this._worldPositions||this._fullCount===0)return;const t=s.camera.viewMatrix.rawData,a=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),r=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),i=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]);let n=0,o=0,l=0;const c=Math.min(100,this._fullCount);for(let g=0;g<c;g++){const A=Math.floor(g/c*this._fullCount)*3;n+=this._worldPositions[A+0],o+=this._worldPositions[A+1],l+=this._worldPositions[A+2]}n/=c,o/=c,l/=c;const f=a-n,d=r-o,h=i-l,b=Math.sqrt(f*f+d*d+h*h);let p=this._lodDistances.length;for(let g=0;g<this._lodDistances.length;g++)if(b<this._lodDistances[g]){p=g;break}if(p!==this._currentLodLevel){this._currentLodLevel=p;const g=this._lodRatios[p],A=Math.floor(this._fullCount*g);if(this._mapping){const D=this._mapping;this._mapping=new Uint32Array(Math.min(A,D.length));for(let _=0;_<this._mapping.length;_++)this._mapping[_]=D[_];this.setMapping(this._mapping)}else this.count=A,this.texParams[0]=this.count,this.texParams[2]=this.count}}setMapping(s){this._mapping=s&&s.length>0?s:null,this.count=this._mapping?this._mapping.length:this._fullCount,this.texParams[0]=this.count,this.texParams[2]=Math.min(this.texParams[0],this.count);const e=this.size.x*this.size.y;for(let t=0;t<e;t++)this._orderData[t]=t<this.count?t:this.count>0?this.count-1:0;if(this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData),this._sortWorker){const t=this._worldPositions||this._positions,a=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(t);if(this._mapping)for(let r=0;r<this._mapping.length;++r){const i=this._mapping[r]*3,n=r*3;a[n+0]=t[i+0],a[n+1]=t[i+1],a[n+2]=t[i+2]}this._sortWorker.postMessage({type:"centers",centers:a.buffer,mapping:this._mapping?this._mapping:null},[a.buffer]),this._centersSent=!0}else this._centersSent=!1;this.instanceCount=0}setVisBoost(s){this.texParams[3]=Math.max(0,s)}setSortThrottle(s){this._minIntervalMs=Math.max(0,s|0)}setAdaptiveSorting(s){this._adaptiveSorting=s}setLOD(s,e,t){this._lodEnabled=s,e&&(this._lodDistances=e),t&&(this._lodRatios=t)}getLODStats(){return{enabled:this._lodEnabled,currentLevel:this._currentLodLevel,distances:this._lodDistances,ratios:this._lodRatios,currentRatio:this._lodRatios[this._currentLodLevel],visibleCount:this._lodEnabled?Math.floor(this._fullCount*this._lodRatios[this._currentLodLevel]):this._fullCount}}setPixelCulling(s,e=0,t=0){this._minPixelCoverage=Math.max(0,s),this._maxPixelCoverage=Math.max(0,e),this._maxPixelCullDistance=Math.max(0,t)}getPixelCullingStats(){return{minPixels:this._minPixelCoverage,maxPixels:this._maxPixelCoverage,maxPixelCullDistance:this._maxPixelCullDistance,maxEnabled:this._maxPixelCoverage>0,distanceEnabled:this._maxPixelCullDistance>0}}getBatchingStats(){return{enabled:!0,batchSize:this._batchSize,instanceCount:this.instanceCount,splatCount:this.count,reduction:this.count>0?(1-this.instanceCount/this.count)*100:0}}evalTextureSize(s){let e=Math.ceil(Math.sqrt(s));const t=64;e=Math.ceil(e/t)*t;const a=Math.ceil(s/e);return new K(e,a)}buildColor(s){const e=this.size.x|0,t=this.size.y|0,a=new Uint8Array(e*t*4),r=.28209479177387814,i=s.count,n=s.sh?.coeffs,o=n?n.length/(3*i):1;for(let l=0;l<i;l++){let c=.5,f=.5,d=.5;if(n&&o>=1){const p=l*o*3;c=.5+n[p+0]*r,f=.5+n[p+o+0]*r,d=.5+n[p+2*o+0]*r}const h=s.opacity?1/(1+Math.exp(-s.opacity[l])):1,b=l*4;a[b+0]=Math.max(0,Math.min(255,Math.floor(c*255))),a[b+1]=Math.max(0,Math.min(255,Math.floor(f*255))),a[b+2]=Math.max(0,Math.min(255,Math.floor(d*255))),a[b+3]=Math.max(0,Math.min(255,Math.floor(h*255)))}this.splatColor=new wn().create(e,t,a,!1),this.splatColor.name="splatColor",this.splatColor.minFilter="nearest",this.splatColor.magFilter="nearest",this.splatColor.mipmapFilter="nearest",this.splatColor.addressModeU="clamp-to-edge",this.splatColor.addressModeV="clamp-to-edge"}buildTransform(s){const e=this.size.x|0,t=this.size.y|0,a=s.count,r=new Uint32Array(e*t*4),i=new Array(e*t*4).fill(0),n=new ArrayBuffer(4),o=new Float32Array(n),l=new Uint32Array(n),c=b=>(o[0]=b,l[0]),f=s.position,d=s.rotation,h=s.scale;for(let b=0;b<a;b++){const p=b*4,g=f[b*3+0],A=f[b*3+1],D=f[b*3+2];r[p+0]=c(g),r[p+1]=c(A),r[p+2]=c(D);let _=0,U=0,v=0,x=1;if(d){_=d[b*4+0],U=d[b*4+1],v=d[b*4+2],x=d[b*4+3];const Jt=1/Math.hypot(_,U,v,x);_*=Jt,U*=Jt,v*=Jt,x*=Jt}let C=1,F=1,w=1;h&&(C=Math.exp(h[b*3+0]),F=Math.exp(h[b*3+1]),w=Math.exp(h[b*3+2]));const S=_+_,M=U+U,T=v+v,Q=_*S,L=_*M,X=_*T,ie=U*M,q=U*T,be=v*T,Ue=x*S,Z=x*M,de=x*T,ce=1-(ie+be),De=L+de,_e=X-Z,Ne=L-de,we=1-(Q+be),Ce=q+Ue,Me=X+Z,ct=q-Ue,ga=1-(Q+ie),Mt=ce*C,Ft=De*C,kt=_e*C,Nt=Ne*F,xt=we*F,pa=Ce*F,ma=Me*w,Aa=ct*w,Da=ga*w,Dr=Mt*Mt+Nt*Nt+ma*ma,ja=Mt*Ft+Nt*xt+ma*Aa,_a=Mt*kt+Nt*pa+ma*Da,_r=Ft*Ft+xt*xt+Aa*Aa,Ya=Ft*kt+xt*pa+Aa*Da,Br=kt*kt+pa*pa+Da*Da,Ba=p;i[Ba+0]=Dr,i[Ba+1]=ja,i[Ba+2]=_a,i[Ba+3]=Br;const vr=rr(_r)&65535,Ur=rr(Ya)&65535;r[p+3]=vr|Ur<<16}this.transformA=new n0().create(e,t,r),this.transformA.name="transformA",this.transformA.minFilter="nearest",this.transformA.magFilter="nearest",this.transformA.addressModeU="clamp-to-edge",this.transformA.addressModeV="clamp-to-edge",this.transformB=new Rn().create(e,t,i,!1),this.transformB.name="transformB",this.transformB.minFilter="nearest",this.transformB.magFilter="nearest",this.transformB.mipmapFilter="nearest",this.transformB.addressModeU="clamp-to-edge",this.transformB.addressModeV="clamp-to-edge"}updateWorldPositions(){if(!this._positions)return;const s=this.object3D.transform.worldMatrix,e=this._positions,t=this._fullCount;this._worldPositions||(this._worldPositions=new Float32Array(e.length));const a=s.rawData;for(let r=0;r<t;r++){const i=r*3,n=e[i+0],o=e[i+1],l=e[i+2];this._worldPositions[i+0]=a[0]*n+a[4]*o+a[8]*l+a[12],this._worldPositions[i+1]=a[1]*n+a[5]*o+a[9]*l+a[13],this._worldPositions[i+2]=a[2]*n+a[6]*o+a[10]*l+a[14]}this._centersSent=!1}scheduleOrder(s){if(this.count===0)return;const e=this.object3D.transform.localChange;(e||!this._worldPositions)&&this.updateWorldPositions();const t=s.rawData,a=t[2],r=t[6],i=t[10],n=-(t[0]*t[12]+t[1]*t[13]+t[2]*t[14]),o=-(t[4]*t[12]+t[5]*t[13]+t[6]*t[14]),l=-(t[8]*t[12]+t[9]*t[13]+t[10]*t[14]),c=performance.now(),f=(c-this._lastSentTime)/1e3,d=Math.floor(n*1e3)^Math.floor(o*1e3)^Math.floor(l*1e3),h=Math.floor(a*1e3)^Math.floor(r*1e3)^Math.floor(i*1e3),b=d^h;if(b===this._lastViewMatrixHash&&!e)return;let p=this._minIntervalMs;if(this._adaptiveSorting&&this._minIntervalMs>0){const A=Math.abs(b-this._lastViewMatrixHash)/Math.max(f,.001);A<1e3?p=this._minIntervalMs:A<1e4?p=this._minIntervalMs*.5:p=this._minIntervalMs*.2,this._lastCameraSpeed=A}if(!(c-this._lastSentTime<p)){if(this._lastViewMatrixHash=b,this._lastSentTime=c,!this._sortWorker){this._sortWorker=this.createSortWorker(),this._sortWorker.onmessage=_=>{const U=_.data.order,v=this._orderData.buffer;this._sortWorker.postMessage({order:v},[v]);const x=new Uint32Array(U),C=this.size.x*this.size.y,F=this.count;(!this._orderData||this._orderData.length!==C)&&(this._orderData=new Uint32Array(C));const w=Math.min(F,x.length);if(this._orderData.set(x.subarray(0,w),0),w<C){const T=F>0?F-1:0;this._orderData.fill(T,w,C)}this.splatOrder.updateTexture(this.size.x,this.size.y,this._orderData);const S=Math.max(0,Math.min(this.count,_.data.count|0));this.texParams[2]=S;const M=Math.ceil(S/this._batchSize);this.instanceCount=M};const g=this._worldPositions||this._positions,A=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let _=0;_<this._mapping.length;++_){const U=this._mapping[_]*3,v=_*3;A[v+0]=g[U+0],A[v+1]=g[U+1],A[v+2]=g[U+2]}const D=new Uint32Array(this.count);for(let _=0;_<this.count;_++)D[_]=_;this._sortWorker.postMessage({order:D.buffer,centers:A.buffer,mapping:this._mapping},[D.buffer,A.buffer]),this._centersSent=!0}if(!this._centersSent&&this._sortWorker){const g=this._worldPositions||this._positions,A=this._mapping?new Float32Array(this._mapping.length*3):new Float32Array(g);if(this._mapping)for(let D=0;D<this._mapping.length;++D){const _=this._mapping[D]*3,U=D*3;A[U+0]=g[_+0],A[U+1]=g[_+1],A[U+2]=g[_+2]}this._sortWorker.postMessage({type:"centers",centers:A.buffer,mapping:this._mapping?this._mapping:null},[A.buffer]),this._centersSent=!0}this._sortWorker.postMessage({cameraPosition:{x:n,y:o,z:l},cameraDirection:{x:-a,y:-r,z:-i}})}}createSortWorker(){function s(){let n,o,l,c,f,d=!1;const h={x:0,y:0,z:0},b={x:0,y:0,z:0},p={x:0,y:0,z:0},g={x:0,y:0,z:0};let A,D;const _=(v,x,C)=>{for(;v<=x;){const F=x+v>>1,w=C(F);if(w>0)v=F+1;else if(w<0)x=F-1;else return F}return~v},U=()=>{if(!n||!o||!c||!f)return;const v=c.x,x=c.y,C=c.z,F=f.x,w=f.y,S=f.z,M=.001;if(!d&&Math.abs(v-h.x)<M&&Math.abs(x-h.y)<M&&Math.abs(C-h.z)<M&&Math.abs(F-b.x)<M&&Math.abs(w-b.y)<M&&Math.abs(S-b.z)<M)return;d=!1,h.x=v,h.y=x,h.z=C,b.x=F,b.y=w,b.z=S;const T=o.length/3;A?.length!==T&&(A=new Uint32Array(T));let Q,L;for(let Z=0;Z<8;++Z){const de=(Z&1?p.x:g.x)-v,ce=(Z&2?p.y:g.y)-x,De=(Z&4?p.z:g.z)-C,_e=de*F+ce*w+De*S;Z===0?Q=L=_e:(Q=Math.min(Q,_e),L=Math.max(L,_e))}D?D.fill(0):D=new Uint32Array(65537);const X=L-Q,ie=X<1e-6?0:1/X*2**16;for(let Z=0;Z<T;++Z){const de=Z*3,ce=o[de+0]-v,De=o[de+1]-x,_e=o[de+2]-C,Ne=ce*F+De*w+_e*S,we=Math.floor((Ne-Q)*ie);A[Z]=we,D[we]++}for(let Z=1;Z<65537;Z++)D[Z]+=D[Z-1];for(let Z=0;Z<T;Z++){const de=A[Z],ce=--D[de];n[ce]=Z}const q=Z=>A[n[Z]]/ie+Q,be=()=>{const Z=_(0,T-1,de=>-q(de));return Math.min(T,Math.abs(Z))},Ue=q(T-1)>=0?be():T;if(l)for(let Z=0;Z<T;++Z)n[Z]=l[n[Z]];self.postMessage({order:n.buffer,count:Ue},[n.buffer]),n=null};self.onmessage=v=>{if(v.data.order&&(n=new Uint32Array(v.data.order)),v.data.centers){o=new Float32Array(v.data.centers),p.x=g.x=o[0],p.y=g.y=o[1],p.z=g.z=o[2];const x=o.length/3;for(let C=1;C<x;++C){const F=o[C*3+0],w=o[C*3+1],S=o[C*3+2];p.x=Math.min(p.x,F),p.y=Math.min(p.y,w),p.z=Math.min(p.z,S),g.x=Math.max(g.x,F),g.y=Math.max(g.y,w),g.z=Math.max(g.z,S)}d=!0}v.data.hasOwnProperty("mapping")&&(l=v.data.mapping?new Uint32Array(v.data.mapping):null,d=!0),v.data.cameraPosition&&(c=v.data.cameraPosition),v.data.cameraDirection&&(f=v.data.cameraDirection),U()}}const e=`(${s.toString()})()`,t=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(t);return new Worker(a)}nodeUpdate(s,e,t,a){const r=this.object3D.transform.worldMatrix;this.gsplatMaterial.setTransformMatrix(r);const i=`${this._minPixelCoverage},${this._maxPixelCoverage},${this._maxPixelCullDistance},${this._batchSize}`;i!==this._lastPixelCullParams&&(this.gsplatMaterial.setPixelCulling(this._minPixelCoverage,this._maxPixelCoverage,this._maxPixelCullDistance,this._batchSize),this._lastPixelCullParams=i),this._texturesInitialized||(this.gsplatMaterial.setSplatTextures(this.splatColor,this.transformA,this.transformB,this.texParams,this.splatOrder),this._texturesInitialized=!0),super.nodeUpdate(s,e,t,a)}renderPass(s,e,t){const a=t.encoder;for(let r of this.materials){const i=r.getPass(e);if(!(!i||i.length===0))for(const n of i){if(!n.pipeline)continue;n.apply(this.geometry,t.rendererPassState||t),y.bindPipeline(a,n),y.bindGeometryBuffer(a,this.geometry);const l=this.geometry.subGeometries[0].lodLevels[0];this.instanceCount>0?y.drawIndexed(a,l.indexCount,this.instanceCount,l.indexStart,0,0):y.drawIndexed(a,l.indexCount,1,l.indexStart,0,0)}}}destroy(s){this._sortWorker&&(this._sortWorker.terminate(),this._sortWorker=null),this.splatColor&&(this.splatColor.destroy(s),this.splatColor=null),this.transformA&&(this.transformA.destroy(s),this.transformA=null),this.transformB&&(this.transformB.destroy(s),this.transformB=null),this.splatOrder&&(this.splatOrder.destroy(s),this.splatOrder=null),this._positions=null,this._worldPositions=null,this._orderData=null,this.texParams=null,this._mapping=null,super.destroy(s)}};_i=_2([Vt(_i,"GSplatRenderer")],_i);class In{static maxVector=new u(Number.MAX_VALUE*.1,Number.MAX_VALUE*.1,Number.MAX_VALUE*.1);static minVector=this.maxVector.clone().multiplyScalar(-1);static genMeshMaxVector=u.ZERO.clone();static genMeshMinVector=u.ZERO.clone();static genMeshVectorList8=[new u,new u,new u,new u,new u,new u,new u,new u];static genGSplatBounds(e,t){t||=new pe(u.ZERO,u.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let a=e.getComponents(_i);if(!a)return console.warn("genGSplatBounds: No GSplatRenderer found on object"),t;for(const r of a){const i=r.positions,n=r.fullCount;if(!i||n===0)return console.warn("genGSplatBounds: No position data available"),t;const o=r.object3D.transform.worldMatrix,l=new u;for(let c=0;c<n;c++){const f=c*3;l.set(i[f+0],i[f+1],i[f+2]),o.transformPoint(l,l),t.expandByPoint(l)}t.setFromMinMax(t.min,t.max)}return t}static genMeshBounds(e,t){let a=this.genMeshMinVector,r=this.genMeshMaxVector,i=this.genMeshVectorList8;t||=new pe(u.ZERO,u.ZERO),t.setFromMinMax(this.maxVector,this.minVector);let n=e.getComponents($);for(const o of n)if(o&&o.geometry){let l=o.object3D.transform.worldMatrix;a.copy(o.geometry.bounds.min),r.copy(o.geometry.bounds.max),i[0].set(a.x,a.y,a.z),i[1].set(a.x,a.y,r.z),i[2].set(a.x,r.y,a.z),i[3].set(a.x,r.y,r.z),i[4].set(r.x,a.y,a.z),i[5].set(r.x,a.y,r.z),i[6].set(r.x,r.y,a.z),i[7].set(r.x,r.y,r.z);for(const c of i)l.transformPoint(c,c),t.expandByPoint(c)}return r.copyFrom(t.max),a.copyFrom(t.min),t.setFromMinMax(a,r),t}static transformBound(e,t,a){let r=this.genMeshMinVector.copyFrom(t.min),i=this.genMeshMaxVector.copyFrom(t.max),n=this.genMeshVectorList8;a||=new pe(u.ZERO,u.ZERO),a.setFromMinMax(this.maxVector,this.minVector),n[0].set(r.x,r.y,r.z),n[1].set(r.x,r.y,i.z),n[2].set(r.x,i.y,r.z),n[3].set(r.x,i.y,i.z),n[4].set(i.x,r.y,r.z),n[5].set(i.x,r.y,i.z),n[6].set(i.x,i.y,r.z),n[7].set(i.x,i.y,i.z);for(const o of n)e.transformPoint(o,o),a.expandByPoint(o);return i.copyFrom(a.max),r.copyFrom(a.min),a.setFromMinMax(r,i),a}}class c0 extends Ra{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=on().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 pe,this._boundWorld=this._bound.clone(),this._isBoundChange=!0),this._isBoundChange&&(In.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()):xe.waitStartComponent.forEach((e,t)=>{for(;e.length>0;){const a=e.shift();a.__start(),xe.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=(s,e,t,a)=>{for(var r=a>1?void 0:a?B2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ee=class extends c0{_isScene3D;prefabRef;serializeTag;constructor(){super(),this.transform=this.addComponent(Qt),this.transform.eventDispatcher.addEventListener(Qt.LOCAL_ONCHANGE,this.onTransformLocalChange,this)}get isScene3D(){return this._isScene3D}forChild(s){this.entityChildren.forEach(e=>{s(e),e.forChild(s)})}addComponent(s,e){if(!this.components.has(s)){let t=new s;return t.object3D=this,this.components.set(s,t),t.__init(e),xe.appendWaitStart(t),t}return this.components.get(s)}getOrAddComponent(s){let e=this.components.get(s);return e||(e=this.addComponent(s)),e}removeComponent(s){if(this.components.has(s)){let e=this.components.get(s);xe.removeWaitStart(this,e),this.components.delete(s),e.__stop(),e.beforeDestroy(),e.destroy()}}hasComponent(s){return this.components.has(s)}getComponent(s){return this.components.get(s)}getComponentFromParent(s){if(!this.parent)return null;let e=this.parent.object3D.getComponent(s);return e||this.parent.object3D.getComponentFromParent(s)}getComponentsInChild(s){let e=[],t=this.components.get(s);t&&e.push(t);for(let a=0;a<this.entityChildren.length;a++){let i=this.entityChildren[a].getComponentsInChild(s);e.push(...i)}return e}getComponents(s,e,t){e||=[];let a=this.getComponent(s);a&&(a.enable||t)&&e.push(a);for(let r=0,i=this.entityChildren.length;r<i;r++){let n=this.entityChildren[r];n&&n instanceof ee&&n.getComponents(s,e,t)}return e}getComponentsExt(s,e,t){e||=[];let a=this.components.get(s);if(a&&(a.enable||t))e.push(a);else for(const r of this.entityChildren)r instanceof ee&&r.getComponentsExt(s,e,t);return e}getComponentsByProperty(s,e,t=!0,a,r){a||=[];let i;for(const n of this.components.values())n&&(n.enable||r)&&n[s]===e&&(a.push(n),i=!0);if(!(i&&t))for(const n of this.entityChildren)n instanceof ee&&n.getComponentsByProperty(s,e,t,a,r);return a}clone(){return this.instantiate()}instantiate(){let s=new ee;return s.name=this.name,s.serializeTag=this.serializeTag,s.prefabRef=this.prefabRef,this.entityChildren.forEach((e,t)=>{let a=e.instantiate();s.addChild(a)}),this.components.forEach((e,t)=>{e.cloneTo(s)}),s}get localPosition(){return this.transform.localPosition}set localPosition(s){this.transform.localPosition=s}get localRotation(){return this.transform.localRotation}set localRotation(s){this.transform.localRotation=s}get localScale(){return this.transform.localScale}set localScale(s){this.transform.localScale=s}get localQuaternion(){return this.transform.localRotQuat}set localQuaternion(s){this.transform.localRotQuat=s}notifyChange(){this.transform.notifyChange()}get parent(){return this.transform.parent}get parentObject(){return this.transform.parent.object3D}set x(s){this.transform.x=s}get x(){return this.transform.x}set y(s){this.transform.y=s}get y(){return this.transform.y}set z(s){this.transform.z=s}get z(){return this.transform.z}set scaleX(s){this.transform.scaleX=s}get scaleX(){return this.transform.scaleX}set scaleY(s){this.transform.scaleY=s}get scaleY(){return this.transform.scaleY}set scaleZ(s){this.transform.scaleZ=s}get scaleZ(){return this.transform.scaleZ}set rotationX(s){this.transform.rotationX=s}get rotationX(){return this.transform.rotationX}set rotationY(s){this.transform.rotationY=s}get rotationY(){return this.transform.rotationY}set rotationZ(s){this.transform.rotationZ=s}get rotationZ(){return this.transform.rotationZ}fixedUpdate(){}lateUpdate(){}traverse(s){s(this);for(let e=0,t=this.entityChildren.length;e<t;e++){let a=this.entityChildren[e];a instanceof ee&&a.traverse(s)}}destroy(s){this.transform.eventDispatcher.removeEventListener(Qt.LOCAL_ONCHANGE,this.onTransformLocalChange,this);const e=this.batchTable;e&&typeof e.destroy=="function"&&(e.destroy(),this.batchTable=null);const t=this.featureTable;t&&typeof t.destroy=="function"&&(t.destroy(),this.featureTable=null),super.destroy(s)}};ee=v2([U2],ee);function U2(s,e){return class extends ee{set active(t){this.transform.enable=t>0}get active(){return this.transform.enable?1:0}get materialColor(){return this.getComponent($)?.material?.shader.getDefaultColorShader().baseColor}set materialColor(t){let a=this.getComponent($)?.material;a&&(a.shader.getDefaultColorShader().baseColor=t)}notifyMaterialColorChange(t,a){this.getComponent($).materials?.[t]?.shader.getDefaultColorShader().uniforms[a].onChange()}}}class Ke{static createCamera3DObject(e,t){return this.createCamera3D(null,e,t)}static createCamera3D(e,t,a){return e||=new ee,t&&t.addChild(e),a&&(e.name=a),e.getOrAddComponent(Kr)}static UnProjection(e,t,a=1,r){let i=new u(e,t,0),n=1,o=u.HELP_0,l=k.canvas.offsetLeft,c=k.canvas.offsetTop,f=k.canvas.clientWidth,d=k.canvas.clientHeight;o.x=((i.x-l)*n/f-.5)*2,o.y=-((i.y-c)*n/d-.5)*2,o.z=a;let h=new u(0,0,0),b=E.helpMatrix2;b.copyFrom(r.projectionMatrix),b.invert();let p=E.helpMatrix;return p.identity(),p.multiply(b),p.multiply(r.transform.worldMatrix),p.perspectiveMultiplyPoint3(o,h),h}static Projection(e,t,a){let r=a||new u(0,0,0),i=E.helpMatrix;i.copyFrom(t.viewMatrix),i.multiply(t.projectionMatrix),i.perspectiveMultiplyPoint3(e,r);let n=k.canvas.clientWidth/2,o=k.canvas.clientHeight/2;return r.x=r.x*n+n,r.y=o-r.y*o,r}static UnProjection2(e,t,a,r,i){let n=i||new u(0,0,0),o=E.helpMatrix;o.copyFrom(r.pvMatrixInv);let l=k.canvas.clientWidth/2,c=k.canvas.clientHeight/2;return n.x=(e-l)/l,n.y=(c-t)/c,n.z=a,o.perspectiveMultiplyPoint3(n,n),n}}class It{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==Xe.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==Xe.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==Xe.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==Xe.DirectionLight){let a=this.directionLightList.get(e);return a||(a=[],this.directionLightList.set(e,a)),a}else if(t==Xe.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==Xe.DirectionLight){let a=this.directionLightList.get(t);if(a||(a=[],this.directionLightList.set(t,a)),!e.shadowCamera){e.shadowCamera=Ke.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==Xe.PointLight||e.lightData.lightType==Xe.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==Xe.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==Xe.PointLight||e.lightData.lightType==Xe.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=It.directionLightList.get(e.scene),r=It.pointLightList.get(e.scene),i=0,n=0,o=0,l=0;if(t.fill(0),a){let f=0;for(let d=0;d<a.length;d++){const h=a[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}n=a.length}if(r){o=n;let f=0;for(let d=o;d<r.length;d++){const h=r[d];t[d]=h.lightData.index,h.lightData.castShadowIndex=f++}l=o+r.length}oe.getAllCameraGroup().forEach(f=>{f.dirShadowStart=i,f.dirShadowEnd=n,f.pointShadowStart=o,f.pointShadowEnd=l,f.shadowLights.set(new Float32Array(t))})}}class Qn{uuid;usage;globalBindGroup;uniformGPUBuffer;matrixBindGroup;uniformByteLength;matrixesByteLength;shadowMatrixRaw=new Float32Array(128);csmMatrixRaw=new Float32Array(Zt.Cascades*16);csmShadowBias=new Float32Array(4);shadowLights=new Float32Array(16);dirShadowStart=0;dirShadowEnd=0;pointShadowStart=0;pointShadowEnd=0;constructor(e){this.uuid=Et(),this.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.uniformGPUBuffer=new dt(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=E.block*4*E.maxCount,this.globalBindGroup=k.device.createBindGroup({label:"global_bindGroupLayout",layout:xn.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=It.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=m.setting.shadow.shadowSize;if(Zt.Cascades>1&&e.enableCSM&&t[0])for(let l=0;l<Zt.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=m.setting.reflectionSetting,i=J.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",Ye.testObj.testValue2),this.uniformGPUBuffer.setFloat("test3",Ye.testObj.testValue3),this.uniformGPUBuffer.setFloat("test4",Ye.testObj.testValue4),this.uniformGPUBuffer.setVector3("CameraPos",e.transform.worldPosition),this.uniformGPUBuffer.setFloat("frame",Fe.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",Fe.time),this.uniformGPUBuffer.setFloat("delta",Fe.delta),this.uniformGPUBuffer.setFloat("shadowBias",e.getShadowBias(a)),this.uniformGPUBuffer.setFloat("skyExposure",m.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",m.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",m.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",m.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",m.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",m.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",m.setting.render.renderState_split);let n=m.inputSystem.mouseX*k.pixelRatio,o=m.inputSystem.mouseY*k.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",n),this.uniformGPUBuffer.setFloat("mouseY",o),this.uniformGPUBuffer.setFloat("windowWidth",k.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",k.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",m.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",a),this.uniformGPUBuffer.setFloat("shadowSoft",m.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",e.enableCSM?1:0),this.uniformGPUBuffer.setFloat("csmMargin",m.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",Fe.frame),this.uniformGPUBuffer.setFloat32Array("SH",e.sh),this.uniformGPUBuffer.setFloat("time",Fe.time),this.uniformGPUBuffer.setFloat("delta",Fe.delta),this.uniformGPUBuffer.setFloat("shadowBias",m.setting.shadow.shadowBias),this.uniformGPUBuffer.setFloat("skyExposure",m.setting.sky.skyExposure),this.uniformGPUBuffer.setFloat("renderPassState",m.setting.render.renderPassState),this.uniformGPUBuffer.setFloat("quadScale",m.setting.render.quadScale),this.uniformGPUBuffer.setFloat("hdrExposure",m.setting.render.hdrExposure),this.uniformGPUBuffer.setInt32("renderState_left",m.setting.render.renderState_left),this.uniformGPUBuffer.setInt32("renderState_right",m.setting.render.renderState_right),this.uniformGPUBuffer.setFloat("renderState_split",m.setting.render.renderState_split);let t=m.inputSystem.mouseX*k.pixelRatio,a=m.inputSystem.mouseY*k.pixelRatio;this.uniformGPUBuffer.setFloat("mouseX",t),this.uniformGPUBuffer.setFloat("mouseY",a),this.uniformGPUBuffer.setFloat("windowWidth",k.windowWidth),this.uniformGPUBuffer.setFloat("windowHeight",k.windowHeight),this.uniformGPUBuffer.setFloat("near",e.near),this.uniformGPUBuffer.setFloat("far",e.far),this.uniformGPUBuffer.setFloat("pointShadowBias",m.setting.shadow.pointShadowBias),this.uniformGPUBuffer.setFloat("shadowMapSize",m.setting.shadow.shadowSize),this.uniformGPUBuffer.setFloat("shadowSoft",m.setting.shadow.shadowSoft),this.uniformGPUBuffer.setFloat("enableCSM",0),this.uniformGPUBuffer.setFloat("csmMargin",m.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 f0{setting;probesBufferData;probesBuffer;isVolumeFrameChange=!0;randomOrientation;startPosition=new u;isVolumeChange=!0;irradianceVolumeBuffer;directionDistance=20;randomSeedCount=3;useRandomIndex=0;centerDirection=new u(0,0,this.directionDistance).normalize(1);arroundPositions=[];updateOrientation(){return this.useRandomIndex++,this.useRandomIndex>=this.arroundPositions.length&&(this.useRandomIndex=0),E.fromToRotation(this.centerDirection,this.arroundPositions[this.useRandomIndex],this.randomOrientation),this.randomOrientation}init(e){this.setting=e,this.randomOrientation=new E(!1),this.randomOrientation.identity(),this.irradianceVolumeBuffer=new dt(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 u(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 ve(e*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST)}}uploadBuffer(){this.isVolumeChange&&(this.fillIrradianceData(),this.isVolumeChange=!1,this.isVolumeFrameChange=!0),this.probesBuffer.setFloat32Array("uniformFramesBuffer",this.probesBufferData)}calcPosition(e,t,a,r){let i=this.setting,n=this.setting.probeSpace;return r=r||new u,r.x=e*n-n*(i.probeXCount-1)*.5+i.offsetX,r.y=t*n-n*(i.probeYCount-1)*.5+i.offsetY,r.z=a*n-n*(i.probeZCount-1)*.5+i.offsetZ,r}debugX=0;debugY=0;debugZ=0;fillIrradianceData(){let e=this.setting,t=this.calcPosition(0,0,0,this.startPosition);this.irradianceVolumeBuffer.setFloat("orientationIndex",this.randomOrientation.index),this.irradianceVolumeBuffer.setFloat("hysteresis",e.hysteresis),this.irradianceVolumeBuffer.setFloat("OctRTSideSize",e.octRTSideSize),this.irradianceVolumeBuffer.setFloat("OctRTMaxSize",e.octRTMaxSize),this.irradianceVolumeBuffer.setFloat("startX",t.x),this.irradianceVolumeBuffer.setFloat("startY",t.y),this.irradianceVolumeBuffer.setFloat("startZ",t.z),this.irradianceVolumeBuffer.setFloat("ProbeSpace",e.probeSpace),this.irradianceVolumeBuffer.setFloat("probeXCount",e.probeXCount),this.irradianceVolumeBuffer.setFloat("probeYCount",e.probeYCount),this.irradianceVolumeBuffer.setFloat("probeZCount",e.probeZCount),this.irradianceVolumeBuffer.setFloat("maxDistance",e.probeSpace*1.732),this.irradianceVolumeBuffer.setFloat("depthSharpness",e.depthSharpness),this.irradianceVolumeBuffer.setFloat("ProbeSourceTextureSize",e.probeSourceTextureSize),this.irradianceVolumeBuffer.setFloat("ProbeSize",e.probeSize),this.irradianceVolumeBuffer.setFloat("bounceIntensity",e.bounceIntensity),this.irradianceVolumeBuffer.setFloat("probeRoughness",e.probeRoughness),this.irradianceVolumeBuffer.setFloat("normalBias",e.normalBias),this.irradianceVolumeBuffer.setFloat("irradianceChebyshevBias",e.irradianceChebyshevBias),this.irradianceVolumeBuffer.setFloat("rayNumber",e.rayNumber),this.irradianceVolumeBuffer.setFloat("irradianceDistanceBias",e.irradianceDistanceBias),this.irradianceVolumeBuffer.setFloat("indirectIntensity",e.indirectIntensity),this.irradianceVolumeBuffer.setFloat("ddgiGamma",e.ddgiGamma),this.irradianceVolumeBuffer.setFloat("lerpHysteresis",e.lerpHysteresis),this.irradianceVolumeBuffer.setFloat("debugX",this.debugX),this.irradianceVolumeBuffer.setFloat("debugY",this.debugY),this.irradianceVolumeBuffer.setFloat("debugZ",this.debugZ),this.irradianceVolumeBuffer.apply()}}class d0{storageGPUBuffer;irradianceVolume;_lightList=[];constructor(){this.storageGPUBuffer=new ve(ms.lightSize*m.setting.light.maxLight,GPUBufferUsage.COPY_SRC),this.irradianceVolume=new f0,this.irradianceVolume.init(m.setting.gi);for(let e=0;e<m.setting.light.maxLight;e++){let t=this.storageGPUBuffer.memory.allocation_node(ms.lightSize*4);this._lightList.push(t)}this.storageGPUBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e){this.storageGPUBuffer.clean();let t=J.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 h0{storageGPUBuffer;reflectionMap;sourceReflectionMap;count;constructor(){this.storageGPUBuffer=new ve(768)}update(e){this.storageGPUBuffer.clean();let t=J.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 u0 extends Qa{size;constructor(e,t=0,a){super(),this.bufferType=aa.StorageGPUBuffer,this.size=e,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|t,e,a,"MatrixGPUBuffer")}writeBufferByHeap(e,t){let a;e instanceof Float64Array?a=new Float32Array(e):a=e;let r=k.device;if(a.length>0){let i=null;for(;this.mapAsyncReady.length&&(i=this.mapAsyncReady.shift(),i.usedSize!=a.byteLength);)i.destroy(),this.mapAsyncBuffersOutstanding--,i=null;i||(i=r.createBuffer({size:a.byteLength,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,mappedAtCreation:!0}),i.usedSize=a.byteLength,this.mapAsyncBuffersOutstanding++,this.mapAsyncBuffersOutstanding>10&&console.warn(` Warning: mapAsync requests from ${this.mapAsyncBuffersOutstanding} frames ago have not resolved yet. MB of staging buffers allocated.`));let n=new Float32Array(a.buffer,a.byteOffset,t);new Float32Array(i.getMappedRange(0,t*4)).set(n),i.unmap();const l=r.createCommandEncoder();l.copyBufferToBuffer(i,0,this.buffer,0,t*4),r.queue.submit([l.finish()]),i.mapAsync(GPUMapMode.WRITE).then(()=>this.mapAsyncReady.push(i))}}}class b0{uuid;index;usage;groupBufferSize;matrixBufferDst;constructor(){this.uuid=Et(),this.groupBufferSize=0,this.usage=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,this.cacheWorldMatrix()}cacheWorldMatrix(){this.groupBufferSize=E.maxCount*E.blockBytes,this.matrixBufferDst=new u0(this.groupBufferSize/4),this.matrixBufferDst.visibility=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.matrixBufferDst.buffer.label=this.groupBufferSize.toString()}writeBuffer(e){const t=E.dynamicMatrixBytes;this.matrixBufferDst.mapAsyncWrite(t,e)}}class oe{static _cameraBindGroups;static _lightEntriesMap;static _reflectionEntriesMap;static modelMatrixBindGroup;static init(){this.modelMatrixBindGroup=new b0,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 Qn(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 Qn(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 d0,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 h0,this._reflectionEntriesMap.set(e,t)),this._reflectionEntriesMap.get(e)}}class y{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(y.lastShader!=t)y.lastShader=t;else return!1;y.lastPipeline!=t.pipeline&&(y.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=oe.getCameraGroup(t);e.setBindGroup(0,a.globalBindGroup)}static bindGeometryBuffer(e,t){if(this.lastGeometry!=t&&(this.lastGeometry=t,t.indicesBuffer)){e.setIndexBuffer(t.indicesBuffer.indicesGPUBuffer.buffer,t.indicesBuffer.indicesFormat);let a=t.vertexBuffer.vertexGPUBuffer,r=t.vertexBuffer.vertexBufferLayouts;for(let i=0;i<r.length;i++){const n=r[i];e.setVertexBuffer(i,a.buffer,n.offset,n.size)}}}static cleanCache(){this.lastGeometry=null,this.lastPipeline=null,this.lastShader=null}static createPipeline(e){return Ye.countStart("GPUContext","pipeline"),k.device.createRenderPipeline(e)}static beginCommandEncoder(){return Ye.countStart("GPUContext","beginCommandEncoder"),this.LastCommand&&k.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=k.device.createCommandEncoder(),this.LastCommand}static endCommandEncoder(e){this.LastCommand==e&&(k.device.queue.submit([this.LastCommand.finish()]),this.LastCommand=null,Ye.countStart("GPUContext","endCommandEncoder"))}static recordBundleEncoder(e){return k.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=k.context.getCurrentTexture().createView()):a.view=k.context.getCurrentTexture().createView()),e.beginRenderPass(t.renderPassDescriptor)}}static drawIndexed(e,t,a,r,i,n){e.drawIndexed(t,a,r,i,n),this.drawCount++}static draw(e,t,a,r,i){e.draw(t,a,r,i),this.drawCount++}static endPass(e){e.insertDebugMarker("end"),e.end()}static computeCommand(e,t){let a=e.beginComputePass();for(let r=0;r<t.length;r++)t[r].compute(a);a.end()}static copyTexture(e,t,a){e.copyTextureToTexture({texture:t.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:a.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{width:a.width,height:a.height,depthOrArrayLayers:1})}}class g0{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 ve(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 ve(e*3,t),this.output.apply()}}}}class p0{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 g0,this._normalAttrDataGroup=new g0}initMorphTarget(e){this._collectMorphTargetData=this.collectMorphTargetList(e),this._computeShader&&this._computeShader.destroy();let t=Pt.CsMain;this._computeShader=new fe(t),this._collectMorphTargetData.mergedNormal?this._computeShader.setDefine("USE_MORPHNORMALS",!0):this._computeShader.deleteDefine("USE_MORPHNORMALS"),this._computeShaders=[this._computeShader],this._isInfluenceDirty=!0,this._morphTargetCount=this._collectMorphTargetData.mtCount,this._totalVertexCount=this._collectMorphTargetData.vCount,this._morphInfluenceArray.fill(0),this._computeWorkGroupXY=this.calcWorkGroup(this._totalVertexCount),this._positionAttrDataGroup.reset(this._collectMorphTargetData.mergedPos),this._normalAttrDataGroup.reset(this._collectMorphTargetData.mergedNormal)}applyRenderShader(e){this.uploadMorphTargetBuffer(),this.uploadConfigGBuffer(),e.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),e.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&e.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)}computeMorphTarget(e){this.uploadConfigGBuffer(),this.uploadMorphTargetBuffer(),this._computeShader.setUniformBuffer("morphTargetConfig",this._computeConfigBuffer),this._computeShader.setStorageBuffer("morphTargetInfluence",this._morphInfluenceBuffer),this._computeShader.setStorageBuffer("morphTargetPositions",this._positionAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpPositions",this._positionAttrDataGroup.output),this._collectMorphTargetData.mergedNormal&&(this._computeShader.setStorageBuffer("morphTargetNormals",this._normalAttrDataGroup.input),this._computeShader.setStorageBuffer("morphTargetOpNormals",this._normalAttrDataGroup.output)),this._computeShader.workerSizeX=this._computeWorkGroupXY,this._computeShader.workerSizeY=this._computeWorkGroupXY,this._computeShader.workerSizeZ=1,y.computeCommand(e,this._computeShaders)}updateInfluence(e,t){this._isInfluenceDirty=!0,this._morphInfluenceArray[e]=t}get blendShape(){return this._blendTarget}collectMorphTargetList(e){let t=this.collectAttribute("a_morphPositions_",e),a=t.length,r=t[0].data.length/3;if(this._blendTarget={},e.blendShapeData)for(let l=0;l<e.blendShapeData.shapeIndexs.length;l++){let c=e.blendShapeData.shapeIndexs[l],f=e.blendShapeData.shapeNames[l].split("."),d=f[f.length-1];this._blendTarget[d]=h=>this.updateInfluence(c,h)}let i=new Float32Array(r*a*3);{let l=0;for(let c=0;c<a;c++){let f=t[c];i.set(f.data,l),l+=f.data.length}}let n=this.collectAttribute("a_morphNormals_",e),o;if(n&&n.length>0){let l=0;o=new Float32Array(r*a*3);for(let c=0;c<a;c++){let f=n[c];o.set(f.data,l),l+=f.data.length}}return{mtCount:a,vCount:r,mergedPos:i,mergedNormal:o}}collectAttribute(e,t){let a=[];for(let r=0;r<this.MaxMorphTargetCount;r++){let i=e+r,n=t.getAttribute(i);if(n)a[r]=n;else break}return a}uploadConfigGBuffer(){if(this._isInfluenceDirty){let e=0;for(let t=0;t<this._morphTargetCount;t++)e+=this._morphInfluenceArray[t];this._morphInfluenceBuffer.setFloat32Array("data",this._morphInfluenceArray),this._morphInfluenceBuffer.apply(),this._computeConfigArray[0]=this.morphTargetsRelative?1:1-e,this._computeConfigArray[1]=this._morphTargetCount,this._computeConfigArray[2]=this._totalVertexCount,this._computeConfigArray[3]=this._computeWorkGroupXY,this._computeConfigBuffer.setFloat32Array("data",this._computeConfigArray),this._computeConfigBuffer.apply(),this._isInfluenceDirty=!1}}calcWorkGroup(e){let t=Math.ceil(Math.sqrt(e)),a=Math.ceil(Math.log2(t));return t=Math.pow(2,a),t}uploadMorphTargetBuffer(){this._positionAttrDataGroup.output||this._positionAttrDataGroup.apply(this._totalVertexCount),this._normalAttrDataGroup.output||this._normalAttrDataGroup.apply(this._totalVertexCount)}generateGPUBuffer(){this._computeConfigArray=new Float32Array(4),this._computeConfigBuffer=new dt(4),this._morphInfluenceArray=new Float32Array(this.MaxMorphTargetCount);let e=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;this._morphInfluenceBuffer=new ve(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 x2=Object.defineProperty,y2=Object.getOwnPropertyDescriptor,Tn=(s,e,t,a)=>{for(var r=a>1?void 0:a?y2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(a?n(e,t,r):n(r))||r);return a&&r&&x2(e,t,r),r};let $=class extends Na{receiveShadow;morphData;constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(s){s.addComponent($).copyComponent(this)}copyComponent(s){return super.copyComponent(s),this.receiveShadow=s.receiveShadow,this}get geometry(){return this._geometry}set geometry(s){if(super.geometry=s,s){let e=s.morphTargetDictionary!=null;e&&(this.morphData||=new p0,this.morphData.morphTargetsRelative=s.morphTargetsRelative,this.morphData.initMorphTarget(s)),this.morphData&&(this.morphData.enable=e),this.morphData?.enable?this.addRendererMask(Be.MorphTarget):this.removeRendererMask(Be.MorphTarget),this.object3D.bound=this._geometry.bounds.clone()}else this.morphData&&(this.morphData.enable=!1),this.removeRendererMask(Be.MorphTarget);this._readyPipeline||(this.initPipeline(),this._computes&&(this.onCompute=us(this.onCompute,()=>{for(let e=0;e<this._computes.length;e++)this._computes[e].onUpdate()})))}get material(){return this._materials[0]}set material(s){this.materials=[s]}setMorphInfluence(s,e){if(this.morphData&&this.morphData.enable){let t=this._geometry.morphTargetDictionary[s];t>=0&&this.morphData.updateInfluence(t,e)}}setMorphInfluenceIndex(s,e){this.morphData&&this.morphData.enable&&s>=0&&this.morphData.updateInfluence(s,e)}onCompute(s,e){this.morphData&&this.morphData.enable&&this.morphData.computeMorphTarget(e)}nodeUpdate(s,e,t,a){if(this.morphData&&this.morphData.enable)for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++)this.morphData.applyRenderShader(n[o])}super.nodeUpdate(s,e,t,a)}destroy(s){this.morphData&&(this.morphData.destroy(s),this.morphData=null),super.destroy(s)}};Tn([jr],$.prototype,"geometry",1),Tn([jr],$.prototype,"material",1),$=Tn([Vt($,"MeshRenderer")],$);class Ua{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 m0{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]:m.res.redTexture}}class At extends He{resolveTarget;sampleCount;autoResize;clear;constructor(e,t,a=Y.rgba8unorm,r=!1,i,n=1,o=0,l=!0,c=!0){super(e,t,n),this.name=Et(),this.autoResize=c,this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.clear=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t),this.autoResize&&k.addEventListener(Ha.RESIZE,f=>{let{width:d,height:h}=f.data;this.resize(d,h),this._textureChange=!0},this)}resize(e,t){let a=k.device;this.gpuTexture&&(He.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==Y.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==Y.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==Y.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.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=Ot.clamp_to_edge,this.addressModeV=Ot.clamp_to_edge,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=k.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=y.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(l)}clone(){let e=new At(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=k.device,t=k.windowWidth,a=k.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return y.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class ke{storeOp="store";loadOp="clear";clearValue=[0,0,0,0]}class je{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 ke;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 je([],[]);return this.clone2Frame(e),e}}class ne extends je{static colorPass_GBuffer="ColorPassGBuffer";static reflections_GBuffer="reflections_GBuffer";static gui_GBuffer="gui_GBuffer";static gBufferMap=new Map;_colorBufferTex;_compressGBufferTex;constructor(){super([],[])}createGBuffer(e,t,a,r=!0,i=!0,n){let o=this.renderTargets,l=this.rtDescriptors;if(i){let f=new ke;f.loadOp="clear",this._colorBufferTex=vt.createRTTexture(e+Ua.colorBufferTex_NAME,t,a,Y.rgba16float,!0),o.push(this._colorBufferTex),l.push(f)}this._compressGBufferTex=new At(t,a,Y.rgba32float,!1,void 0,1,0,!0,!0),o.push(this._compressGBufferTex),n?this.depthTexture=n:(this.depthTexture=new At(t,a,Y.depth24plus,!1,void 0,1,0,!0,!0),this.depthTexture.name=e+"_depthTexture");let c;c=new ke,l.push(c)}getPositionMap(){return this.renderTargets[1]}getNormalMap(){return this.renderTargets[2]}getColorTexture(){return this._colorBufferTex}getCompressGBufferTexture(){return this._compressGBufferTex}static getGBufferFrame(e,t=0,a=0,r=!0,i){let n;if(ne.gBufferMap.has(e))n=ne.gBufferMap.get(e);else{n=new ne;let o=k.presentationSize;n.createGBuffer(e,t==0?o[0]:t,a==0?o[1]:a,t!=0&&a!=0,r,i),ne.gBufferMap.set(e,n)}return n}static getGUIBufferFrame(){let e=this.getGBufferFrame(this.colorPass_GBuffer);return ne.getGBufferFrame(ne.gui_GBuffer,0,0,!0,e.depthTexture)}clone(){let e=new ne;return this.clone2Frame(e),e}}class Qe{static rendererPassState=new Map;static createRendererPassState(e,t=null){let a=Qe.rendererPassState.get(e);if(a||(a=new m0,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,Qe.rendererPassState.set(e,a)),e&&e.renderTargets.length>0){a.renderTargets=e.renderTargets,a.rtTextureDescriptors=e.rtDescriptors,a.renderPassDescriptor=Qe.getRenderPassDescriptor(a),a.renderPassDescriptor.depthStencilAttachment&&(a.renderPassDescriptor.depthStencilAttachment.depthLoadOp=e.depthLoadOp),t=="load"&&e?.renderTargets[0]&&e.renderTargets[0].name.startsWith(ne.gui_GBuffer)&&(a.renderPassDescriptor.colorAttachments[0].loadOp="load"),a.depthLoadOp=e.depthLoadOp,a.renderBundleEncoderDescriptor=Qe.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(Ua.colorBufferTex_NAME)!=-1&&(a.outColor=r)}}else a.renderPassDescriptor=Qe.getRenderPassDescriptor(a,t),a.renderBundleEncoderDescriptor=Qe.getRenderBundleDescriptor(a),a.renderTargetTextures=[{format:k.presentationFormat}],a.outColor=0;return a}static getRenderPassDescriptor(e,t=null){if(e.renderPassDescriptor)return e.renderPassDescriptor;k.device,k.presentationSize;let a=[];if(e.renderTargets&&e.renderTargets.length>0){e.renderTargets[0].width,e.renderTargets[0].height;for(let i=0;i<e.renderTargets.length;i++){const n=e.renderTargets[i],o=e.rtTextureDescriptors[i];a.push({view:n.getGPUView(),resolveTarget:void 0,loadOp:o.loadOp,clearValue:o.clearValue,storeOp:o.storeOp})}}else if(!e.customSize){let i=k.canvasConfig&&k.canvasConfig.alpha?[1,1,1,0]:[0,0,0,1];e.isOutTarget==!0&&a.push({view:void 0,resolveTarget:void 0,loadOp:k.canvasConfig&&k.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;k.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 ei extends Ee{width;height;segmentW;segmentH;up;constructor(e,t,a=1,r=1,i=u.Y_AXIS){super(),this.width=e,this.height=t,this.segmentW=a,this.segmentH=r,this.up=i,this.buildGeometry(this.up)}buildGeometry(e){var t,a,r,i,n=this.segmentW+1;(this.segmentH+1)*n,this.bounds=new pe(u.ZERO.clone(),new u(this.width,1,this.height)),r=this.segmentH*this.segmentW*6;let o=(this.segmentW+1)*(this.segmentH+1),l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d;this.segmentW*this.segmentH*2*3>=Uint16Array.length?d=new Uint32Array(this.segmentW*this.segmentH*2*3):d=new Uint16Array(this.segmentW*this.segmentH*2*3),r=0;for(var b=0,p=0,g=0,A=0;A<=this.segmentH;++A)for(var D=0;D<=this.segmentW;++D){switch(t=(D/this.segmentW-.5)*this.width,a=(A/this.segmentH-.5)*this.height,e){case u.Y_AXIS:l[b++]=t,l[b++]=0,l[b++]=a,c[p++]=0,c[p++]=1,c[p++]=0;break;case u.Z_AXIS:l[b++]=t,l[b++]=-a,l[b++]=0,c[p++]=0,c[p++]=0,c[p++]=1;break;case u.X_AXIS:l[b++]=0,l[b++]=t,l[b++]=a,c[p++]=1,c[p++]=0,c[p++]=0;break;default:l[b++]=t,l[b++]=0,l[b++]=a,c[p++]=0,c[p++]=1,c[p++]=0;break}f[g++]=D/this.segmentW,f[g++]=A/this.segmentH,D!=this.segmentW&&A!=this.segmentH&&(i=D+A*n,d[r++]=i+1,d[r++]=i,d[r++]=i+n,d[r++]=i+1,d[r++]=i+n,d[r++]=i+n+1)}this.setIndices(d),this.setAttribute(V.position,l),this.setAttribute(V.normal,c),this.setAttribute(V.uv,f),this.setAttribute(V.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}var C2=Object.getOwnPropertyDescriptor,S2=(s,e,t,a)=>{for(var r=a>1?void 0:a?C2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Bi=class extends ot{constructor(s="QuadGlsl_vs",e="QuadGlsl_fs"){super();let t=new Ve(s,e);this.addRenderPass(t);let a=t.shaderState;t.blendMode=ae.NONE,a.frontFace="cw",a.depthWriteEnabled=!1,a.depthCompare=et.always,a.multisample=0,this.setTexture("baseMap",m.res.blackTexture),this.setUniformFloat("x",0),this.setUniformFloat("y",0),this.setUniformFloat("width",100),this.setUniformFloat("height",100)}};Bi=S2([Ia(Bi,"QuadShader")],Bi);class Mn extends ee{width=128;height=128;quadRenderer;material;rendererPassState;quadShader;constructor(e="QuadGlsl_vs",t="QuadGlsl_fs",a,r=0,i=!1){super();let n=a?a.renderTargets:[];this.material=new mt,this.quadShader=new Bi(e,t),this.material.shader=this.quadShader,this.quadRenderer=this.addComponent($),this.quadRenderer.material=this.material,this.quadRenderer.castGI=!1,this.quadRenderer.castShadow=!1,this.quadRenderer.drawType=i?2:0,this.quadRenderer.geometry=new ei(100,100,1,1),this.quadRenderer.material=this.material,this.quadRenderer.__start(),this.quadRenderer._enable=!0,this.quadRenderer.onEnable(),this.rendererPassState=Qe.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=k.device.createTexture({size:{width:k.presentationSize[0],height:k.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:k.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT})),k.addEventListener(Ha.RESIZE,o=>{this.rendererPassState=Qe.createRendererPassState(a,"load"),r>0&&(this.rendererPassState.multisample=this.quadShader.getDefaultColorShader().shaderState.multisample,this.rendererPassState.multiTexture=k.device.createTexture({size:{width:k.presentationSize[0],height:k.presentationSize[1]},sampleCount:r,format:n.length>0?n[0].format:k.presentationFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT}))},this)}renderTarget(e,t,a){let r=e.camera,i=y.beginRenderPass(a,t.rendererPassState);y.bindCamera(i,r),t.quadRenderer.nodeUpdate(e,H.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,H.COLOR,t.rendererPassState,null,i),y.endPass(i)}renderToViewQuad(e,t,a,r){let i=e.camera;t.quadShader.setTexture("baseMap",r);let n=y.beginRenderPass(a,t.rendererPassState);y.bindCamera(n,i),t.quadRenderer.nodeUpdate(e,H.COLOR,t.rendererPassState,null),t.quadRenderer.renderPass2(e,H.COLOR,t.rendererPassState,null,n),y.endPass(n)}}class vt{static rtTextureMap;static rtViewQuad;static init(){this.rtTextureMap=new Map,this.rtViewQuad=new Map}static createRTTexture(e,t,a,r,i=!1,n=0){let o=this.rtTextureMap.get(e);return o||(e==Ua.colorBufferTex_NAME?o=new At(t,a,r,i,void 0,1,n,!1):o=new At(t,a,r,i,void 0,1,n,!0),o.name=e,vt.rtTextureMap.set(e,o)),o}static createRTTextureArray(e,t,a,r,i=1,n=!1,o=0){let l=this.rtTextureMap.get(e);return l||(l=new At(t,a,r,n,void 0,i,o),l.name=e,vt.rtTextureMap.set(e,l)),l}static createViewQuad(e,t,a,r,i=0){let n=new je([r],[new ke]),o=new Mn(t,a,n,i);return vt.rtViewQuad.set(e,o),o}static getTexture(e){return this.rtTextureMap.get(e)}static CreateSplitTexture(e){let t=this.getTexture(Ua.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(Ua.colorBufferTex_NAME),a=this.getTexture(e+"_split");const r=y.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}),y.endCommandEncoder(r)}}class Nn{command;encoder;rendererPassStates;rtFrame;constructor(e){this.rtFrame=e,this.rendererPassStates=[]}clean(){this.rendererPassStates.length=0,y.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=Qe.createRendererPassState(a,e);return this.rendererPassStates.push(r),r}else{this.rtFrame.depthLoadOp=t;let a=Qe.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=y.beginCommandEncoder(),this.command}endCommand(){y.endCommandEncoder(this.command),this.command=null}beginNewEncoder(){return this.encoder=y.beginRenderPass(this.command,this.rendererPassState),this.encoder}endEncoder(){y.endPass(this.encoder),this.encoder=null}}class xa extends Ra{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=Qe.createRendererPassState(e);let t=e.clone();t.depthLoadOp="load";for(const a of t.rtDescriptors)a.loadOp="load";this.splitRendererPassState=Qe.createRendererPassState(t)}this.renderContext=new Nn(e)}getRenderContext(e){return this._rtFrame=e,new Nn(e)}setIrradiance(e,t){this.rendererPassState.irradianceBuffer=[e,t]}compute(e,t){}render(e,t,a,r=!1){y.cleanCache();let i=e.camera,n=e.scene;this.rendererPassState.camera3D=i;let o=J.instance.getRenderNodes(n,i),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{let f=y.beginCommandEncoder(),d=y.beginRenderPass(f,this.rendererPassState);l.length>0&&d.executeBundles(l),!r&&J.instance.sky&&(y.bindCamera(d,i),J.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,d)),this.drawRenderNodes(e,d,f,o.opaqueList,t),y.endPass(d),y.endCommandEncoder(f)}{let f=y.beginCommandEncoder(),d=y.beginRenderPass(f,this.rendererPassState);c.length>0&&d.executeBundles(c),r||(y.bindCamera(d,i),this.drawRenderNodes(e,d,f,o.transparentList,t)),y.endPass(d),y.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=J.instance.getOpRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=y.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}renderBundleTr(e,t,a,r){let i=J.instance.getTrRenderGroup(e.scene);if(i){let n=[];return i.renderGroup.forEach(o=>{if(o.bundleMap.has(this._rendererType))n.push(o.bundleMap.get(this._rendererType));else{let l=y.recordBundleEncoder(this.rendererPassState.renderBundleEncoderDescriptor);this.recordRenderBundleNode(e,l,o.renderNodes,r);let c=l.finish();o.bundleMap.set(this._rendererType,c),n.push(c)}}),n}return[]}recordRenderBundleNode(e,t,a,r){y.bindCamera(t,e.camera),y.bindGeometryBuffer(t,a[0].geometry);for(let i=0;i<a.length;++i){let n=a[i];n.transform.worldMatrix.index,n.transform.enable&&n.recordRenderPass2(e,this._rendererType,this.rendererPassState,r,t)}}drawRenderNodes(e,t,a,r,i,n){y.bindCamera(t,e.camera);for(let o=m.setting.render.drawOpMin;o<Math.min(r.length,m.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)}}}class A0 extends xa{constructor(){super(),this.passType=H.COLOR}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,n=e.camera;oe.updateCameraGroup(n),this.rendererPassState.camera3D=n;let o=J.instance.getRenderNodes(i,n),l=this.renderBundleOp(e,o,t,a),c=r?[]:this.renderBundleTr(e,o,t,a);{this.renderContext.beginOpaqueRenderPass();let f=this.renderContext.encoder;l.length>0&&(J.instance.getOpRenderGroup(i),f.executeBundles(l)),!r&&J.instance.sky&&(y.bindCamera(f,n),J.instance.sky.preInit(this._rendererType)||J.instance.sky.nodeUpdate(e,this._rendererType,this.rendererPassState,a),J.instance.sky.renderPass2(e,this._rendererType,this.rendererPassState,a,f)),o.opaqueList&&(y.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let f=this.renderContext.encoder;c.length>0&&f.executeBundles(c),!r&&o.transparentList&&(y.bindCamera(f,n),this.drawNodes(e,this.renderContext,o.transparentList,t,a));let d=J.instance.getGraphicList();for(let h=0;h<d.length;h++){const b=d[h];b.nodeUpdate(e,this._rendererType,this.splitRendererPassState,a),b.renderPass2(e,this._rendererType,this.splitRendererPassState,a,f)}this.renderContext.endRenderPass(),Ye.end("ColorPass Draw Transparent")}}drawNodes(e,t,a,r,i){let n=J.instance.getRenderShaderCollect(e);if(n){for(const o of n){let l=o[1];for(const c of l){let f=c[1];if(!f.isDestroyed&&f.preInit(this._rendererType)){f.nodeUpdate(e,this._rendererType,this.rendererPassState,i);break}}}for(let o=m.setting.render.drawOpMin;o<Math.min(a.length,m.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(l.hasMask(Be.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 Vn{frustumCullingList;zVisibleList;_renderList;static enable=!0;constructor(){this._renderList=new Map}occlusionRenderNodeTest(e){return m.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 ti extends Qa{constructor(e,t){super(),this.bufferType=aa.ComputeGPUBuffer,this.createBuffer(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,e,t,"ComputeGPUBuffer")}}class D0{clusterBuffer;lightAssignBuffer;assignTableBuffer;clustersUniformBuffer;constructor(e,t){this.clusterBuffer=new ti(e*2*4),this.clustersUniformBuffer=new dt(10),this.clustersUniformBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.lightAssignBuffer=new ti(e*t),this.lightAssignBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE,this.assignTableBuffer=new ti(e*4),this.assignTableBuffer.visibility=GPUShaderStage.FRAGMENT|GPUShaderStage.COMPUTE}update(e,t,a,r,i,n,o,l,c,f){this.clustersUniformBuffer.setFloat("clusterTileX",r),this.clustersUniformBuffer.setFloat("clusterTileY",i),this.clustersUniformBuffer.setFloat("clusterTileZ",n),this.clustersUniformBuffer.setFloat("numLights",o),this.clustersUniformBuffer.setFloat("maxNumLightsPerCluster",l),this.clustersUniformBuffer.setFloat("near",c),this.clustersUniformBuffer.setFloat("far",f),this.clustersUniformBuffer.setFloat("screenWidth",e),this.clustersUniformBuffer.setFloat("screenHeight",t),this.clustersUniformBuffer.setFloat("clusterPix",a),this.clustersUniformBuffer.apply()}}class gt{static clusterTileX=16;static clusterTileY=16;static clusterTileZ=32}let _0=`
|
|
5996
5996
|
#include "GlobalUniform"
|
|
5997
5997
|
|
|
5998
5998
|
struct ClusterBox{
|
|
@@ -6203,7 +6203,7 @@ struct InstanceData {
|
|
|
6203
6203
|
idx.empty1 = f32(clustersUniform.maxNumLightsPerCluster);
|
|
6204
6204
|
assignTable[clusterId_1D] = idx;
|
|
6205
6205
|
}
|
|
6206
|
-
`;class v0 extends xa{maxNumLightsPerCluster=64;clusterPix=1;clusterLightingBuffer;_currentLightCount=0;_clusterGenerateCompute;_clusterLightingCompute;_useCamera;resize=!1;constructor(e){super(),this.passType=H.Cluster,this.initCompute(e)}initCompute(e){this._clusterGenerateCompute=new fe(_0),this._clusterLightingCompute=new fe(B0);let t=k.presentationSize,a=gt.clusterTileX*gt.clusterTileY*gt.clusterTileZ,r=e.camera,i=r.near,n=r.far;this.clusterLightingBuffer=new D0(a,this.maxNumLightsPerCluster),this.clusterLightingBuffer.update(t[0],t[1],this.clusterPix,gt.clusterTileX,gt.clusterTileY,gt.clusterTileZ,0,this.maxNumLightsPerCluster,i,n),this._clusterGenerateCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterGenerateCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer);let o=oe.getLightEntries(e.scene);this._clusterLightingCompute.setStorageBuffer("models",oe.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=J.instance.getLights(a);if(this._useCamera!=e.camera){this._useCamera=e.camera;let o=oe.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=gt.clusterTileZ,this._clusterLightingCompute.workerSizeX=gt.clusterTileZ);let i=k.presentationSize;this.clusterLightingBuffer.update(i[0],i[1],this.clusterPix,gt.clusterTileX,gt.clusterTileY,gt.clusterTileZ,r.length,this.maxNumLightsPerCluster,e.camera.near,e.camera.far),this.resize=!1;let n=y.beginCommandEncoder();y.computeCommand(n,[this._clusterGenerateCompute,this._clusterLightingCompute]),y.endCommandEncoder(n)}}class Ae extends He{resolveTarget;sampleCount;clone(){let e=new Ae(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=Y.rgba8unorm,r=!1,i,n=1,o=0,l=1){super(e,t,n),k.device,this.name=Et(),this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.mipmapCount=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t)}resize(e,t){let a=k.device;this.gpuTexture&&(He.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==Y.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==Y.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==Y.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.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=Ot.mirror_repeat,this.addressModeV=Ot.mirror_repeat,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=k.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=y.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(l)}readTextureToImage(){let e=k.device,t=k.windowWidth,a=k.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return y.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class U0 extends ee{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=Ke.createCamera3DObject(this,"up"),this.down_camera=Ke.createCamera3DObject(this,"down"),this.left_camera=Ke.createCamera3DObject(this,"left"),this.right_camera=Ke.createCamera3DObject(this,"right"),this.front_camera=Ke.createCamera3DObject(this,"front"),this.back_camera=Ke.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(u.ZERO,u.UP,u.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(u.ZERO,u.DOWN,u.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(u.ZERO,u.LEFT),this.left_camera.object3D.scaleX=-1,this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(u.ZERO,u.RIGHT),this.right_camera.object3D.scaleX=-1,this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(u.ZERO,u.FORWARD),this.front_camera.object3D.scaleX=-1,this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(u.ZERO,u.BACK),this.back_camera.object3D.scaleX=-1,this.up_camera.type=We.shadow,this.down_camera.type=We.shadow,this.left_camera.type=We.shadow,this.right_camera.type=We.shadow,this.front_camera.type=We.shadow,this.back_camera.type=We.shadow}}class x0 extends He{constructor(e,t,a){super(e,t,a),this.format=Y.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=k.device.createSampler({minFilter:er.linear,magFilter:er.linear}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})}}class y0 extends xa{shadowPassCount;_forceUpdate=!1;_shadowCameraDic;shadowCamera;cubeArrayTexture;colorTexture;shadowSize=1024;constructor(){super(),this.passType=H.POINT_SHADOW,this._shadowCameraDic=new Map,this.cubeArrayTexture=new x0(this.shadowSize,this.shadowSize,8),this.colorTexture=new Ae(this.shadowSize,this.shadowSize,Y.bgra8unorm,!1),me.getInstance().attached(this.cubeArrayTexture,this)}getShadowCamera(e,t){let a;if(this._shadowCameraDic.has(t))a=this._shadowCameraDic.get(t);else{let r=new U0(e.camera.near,e.camera.far,90,!0);r.label=t.name;let i=[],n=[];for(let o=0;o<6;o++){let l=new Ae(this.shadowSize,this.shadowSize,this.cubeArrayTexture.format,!1),c=new je([this.colorTexture],[new ke]);l.name="shadowDepthTexture_"+t.name+o+"_face",i[o]=l,c.depthTexture=l,c.label="shadowRender",c.customSize=!0,n[o]=this.getRenderContext(c)}a={cubeCamera:r,depthTexture:i,renderContext:n},this._shadowCameraDic.set(t,a)}return a}render(e,t){if(!m.setting.shadow.enable)return;this.shadowPassCount=0,e.camera;let a=e.scene,r=It.getPointShadowLightWhichScene(a),i=r.length;for(let n=0;n<i;n++){let o=r[n];if(o.lightData.lightType!=Xe.DirectionLight&&o.lightData.castShadowIndex>-1&&(o.needUpdateShadow||this._forceUpdate||Fe.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=J.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=J.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=J.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=J.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=J.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=J.instance.getRenderNodes(a,l.cubeCamera.back_camera),this.renderSceneOnce(5,l,e,l.cubeCamera.back_camera,f,t);let d=y.beginCommandEncoder();for(let h=0;h<6;h++)d.copyTextureToTexture({texture:l.depthTexture[h].getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:this.cubeArrayTexture.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:o.shadowIndex*6+h}},{width:this.shadowSize,height:this.shadowSize,depthOrArrayLayers:1});y.endCommandEncoder(d)}}this._forceUpdate=!1}renderSceneOnce(e,t,a,r,i,n){let o=t.renderContext[e];o.clean(),o.beginOpaqueRenderPass(),o.encoder.setViewport(0,0,this.shadowSize,this.shadowSize,0,1),o.encoder.setScissorRect(0,0,this.shadowSize,this.shadowSize),r.onUpdate(),r.transform.updateWorldMatrix(!0);for(const l of i.opaqueList){let c=l;if(!c.isDestroyed&&c.preInit(this._rendererType)){c.nodeUpdate(a,this._rendererType,o.rendererPassState,null);break}}this.drawShadowRenderNodes(a,r,o,i.opaqueList,n),this.drawShadowRenderNodes(a,r,o,i.transparentList,n),o.endRenderPass()}drawShadowRenderNodes(e,t,a,r,i){oe.updateCameraGroup(t),y.bindCamera(a.encoder,t),this.drawNodes(e,t,a,r,i,null)}drawNodes(e,t,a,r,i,n){let o=J.instance.getRenderShaderCollect(e);if(o){for(const l of o){let c=l[1];for(const f of c){let d=f[1];if(!d.isDestroyed&&d.preInit(this._rendererType)){d.nodeUpdate(e,this._rendererType,a.rendererPassState,n);break}}}for(let l=m.setting.render.drawOpMin;l<Math.min(r.length,m.setting.render.drawOpMax);++l){let c=r[l];if(c.transform.enable&&c.enable&&c.castShadow&&!c.isDestroyed){c.preInit(this._rendererType)||c.nodeUpdate(e,this._rendererType,a.rendererPassState,n);for(let f of c.materials){let d=f.getPass(this._rendererType);if(!(!d||d.length==0))for(let h of d){const b=h;b.pipeline&&(b.setUniformFloat("cameraFar",t.far),b.setUniformVector3("lightWorldPos",t.transform.worldPosition),b.materialDataUniformBuffer.apply())}}c.renderPass(e,this.passType,a)}}}}}class C0 extends He{constructor(e,t,a=Y.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=k.device.createSampler({}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})}}class S0 extends xa{shadowPassCount;depth2DArrayTexture;rendererPassStates;_forceUpdate=!1;constructor(){super(),this.setShadowMap(m.setting.shadow.shadowSize,Zt.Cascades),this.passType=H.SHADOW}setShadowMap(e,t){this.rendererPassStates=[],this.depth2DArrayTexture=new C0(e,e,Y.depth32float,8),me.getInstance().attached(this.depth2DArrayTexture,this);for(let a=0;a<8;a++){let r=new je([],[]);const i=new Ae(e,e,Y.depth32float,!1);i.name=`shadowDepthTexture_${a}`,r.depthTexture=i,r.label="shadowRender",r.customSize=!0,r.depthCleanValue=1;let n=Qe.createRendererPassState(r);this.rendererPassStates[a]=n}}render(e,t){let a=m.setting.shadow;if(!a.enable)return;let r=e.camera,i=e.scene;if(this.shadowPassCount=0,!a.needUpdate||Fe.frame%a.updateFrameRate!=0)return;let n=It.getDirectShadowLightWhichScene(i),o=a.shadowSize;const l=Zt.Cascades;for(let c of n){const f=c;let d=f.shadowIndex;this.rendererPassState=this.rendererPassStates[d],o=this.rendererPassState.depthTexture.width;let h=J.instance.getRenderShaderCollect(e);for(const b of h){let p=b[1];for(const g of p){let A=g[1];if(!A.isDestroyed&&A.preInit(this._rendererType)){A.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}if(f.castShadow&&f.needUpdateShadow||this._forceUpdate||f.castShadow&&a.autoUpdate)if(f.needUpdateShadow=!1,r.enableCSM&&d==0)for(let b=0;b<l;b++){this.rendererPassState=this.rendererPassStates[b];let p=r.csm.children[b],g=r.getCSMShadowWorldExtents(b);this.poseShadowCamera(r,f.direction,p.shadowCamera,g,p.bound.center),this.renderShadow(e,p.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,b,o)}else{r.enableCSM&&(d+=l-1);let b=r.getShadowWorldExtents();this.rendererPassState=this.rendererPassStates[d],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,d,o)}}this._forceUpdate=!1}copyDepthTexture(e,t,a,r){let i=y.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}),y.endCommandEncoder(i)}_shadowPos=new u;_shadowCameraTarget=new u;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=J.instance.getRenderNodes(e.scene,t),n=y.beginCommandEncoder(),o=y.beginRenderPass(n,r);t.transform.updateWorldMatrix(),Vn.enable&&(a.update(t,e.scene),a.collect(i,t)),oe.updateCameraGroup(t),y.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),y.endPass(o),y.endCommandEncoder(n)}renderShadowBundleOp(e,t,a){let r=J.instance.getOpRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=y.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}renderShadowBundleTr(e,t,a){let r=J.instance.getTrRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=y.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}recordShadowRenderBundleNode(e,t,a,r,i){if(oe.updateCameraGroup(t),y.bindCamera(a,t),r){y.bindGeometryBuffer(a,r[0].geometry);for(let n=0;n<r.length;++n){let o=r[n];o.transform.enable&&o.recordRenderPass2(e,this._rendererType,this.rendererPassState,i,a)}}}drawShadowRenderNodes(e,t,a,r,i){if(oe.updateCameraGroup(t),y.bindCamera(a,t),r)for(let n=m.setting.render.drawOpMin;n<Math.min(r.length,m.setting.render.drawOpMax);++n){let o=r[n];o.transform.enable&&o.enable&&o.castShadow&&(o.isDestroyed||(o.preInit(this._rendererType)||o.nodeUpdate(e,this._rendererType,this.rendererPassState,i),o.renderPass2(e,this._rendererType,this.rendererPassState,i,a)))}}}class F0 extends xa{zBufferTexture;useRenderBundle=!1;shadowPassCount;zCullingCompute;constructor(){super(),this.passType=H.DEPTH;let e=k.presentationSize,t=1;this.zBufferTexture=vt.createRTTexture(Ua.zBufferTexture_NAME,Math.floor(e[0]*t),Math.floor(e[1]*t),Y.rgba16float,!1);let a=new ke;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=new je([],[],vt.createRTTexture(Ua.zPreDepthTexture_NAME,Math.floor(e[0]),Math.floor(e[1]),Y.depth32float,!1),null,!1);this.setRenderStates(r)}render(e,t){let a=e.camera,r=e.scene;y.cleanCache(),Ye.start("DepthPass Renderer");let i=r;this.rendererPassState.camera3D=a;let n=J.instance.getRenderNodes(i,a);this.compute(e,t);let o=this.renderBundleOp(e,n,t),l=[],c=y.beginCommandEncoder(),f=y.beginRenderPass(c,this.rendererPassState);o.length>0&&f.executeBundles(o);let d=J.instance.getRenderShaderCollect(e);for(const h of d){let b=h[1];for(const p of b){let g=p[1];if(!g.isDestroyed&&g.preInit(this._rendererType)){g.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}this.drawRenderNodes(e,f,c,n.opaqueList,t),l.length>0&&f.executeBundles(l),y.endPass(f),y.endCommandEncoder(c),Ye.end("DepthPass Renderer")}drawRenderNodes(e,t,a,r,i,n){y.bindCamera(t,e.camera);for(let o=m.setting.render.drawOpMin;o<Math.min(r.length,m.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&(l.isDestroyed||(l.preInit(this._rendererType)||l.nodeUpdate(e,this._rendererType,this.rendererPassState),l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)))}}}class k0{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 E0 extends xa{finalQuadView;postList;constructor(){super(),this._rendererType=H.POST,this.postList=new Map,this.initRenderer()}initRenderer(){z.register("FullQuad_vert_wgsl",zl),this.finalQuadView=new Mn("Quad_vert_wgsl","Quad_frag_wgsl",new je([],[]),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=y.beginCommandEncoder();this.postList.forEach(a=>{a.enable&&a.render(e,t)}),y.endCommandEncoder(t)}presentContent(e,t){let a=y.beginCommandEncoder();this.finalQuadView.renderToViewQuad(e,this.finalQuadView,a,t),y.endCommandEncoder(a)}}class Rt{enable=!0;postRenderer;rtViewQuad;virtualTexture;constructor(){this.rtViewQuad=new Map,this.virtualTexture=new Map,k.addEventListener(Ha.RESIZE,this.onResize,this)}createRTTexture(e,t,a,r,i=!1,n=0){let o=vt.createRTTexture(e,t,a,r,i,n);return o.name=e,this.virtualTexture.set(e,o),me.getInstance().attached(o,this),o}createViewQuad(e,t,a,r=0){let i=vt.createViewQuad(e,"Quad_vert_wgsl",t,a,r);return this.rtViewQuad.set(e,i),i}getOutTexture(){let e,t=y.lastRenderPassState.renderTargets;return t.length>0?e=t[0]:e=vt.getTexture(Ua.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=y.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];me.getInstance().detached(a,this),a.destroy(e)}}}class Pn extends ee{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=Ke.createCamera3DObject(this,"up"),this.down_camera=Ke.createCamera3DObject(this,"down"),this.left_camera=Ke.createCamera3DObject(this,"left"),this.right_camera=Ke.createCamera3DObject(this,"right"),this.front_camera=Ke.createCamera3DObject(this,"front"),this.back_camera=Ke.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(u.ZERO,u.UP,u.DOWN),this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(u.ZERO,u.DOWN,u.DOWN),this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(u.ZERO,u.LEFT),this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(u.ZERO,u.RIGHT),this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(u.ZERO,u.FORWARD),this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(u.ZERO,u.BACK),this.up_camera.type=We.shadow,this.down_camera.type=We.shadow,this.left_camera.type=We.shadow,this.right_camera.type=We.shadow,this.front_camera.type=We.shadow,this.back_camera.type=We.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 w0=`
|
|
6206
|
+
`;class v0 extends xa{maxNumLightsPerCluster=64;clusterPix=1;clusterLightingBuffer;_currentLightCount=0;_clusterGenerateCompute;_clusterLightingCompute;_useCamera;resize=!1;constructor(e){super(),this.passType=H.Cluster,this.initCompute(e)}initCompute(e){this._clusterGenerateCompute=new fe(_0),this._clusterLightingCompute=new fe(B0);let t=k.presentationSize,a=gt.clusterTileX*gt.clusterTileY*gt.clusterTileZ,r=e.camera,i=r.near,n=r.far;this.clusterLightingBuffer=new D0(a,this.maxNumLightsPerCluster),this.clusterLightingBuffer.update(t[0],t[1],this.clusterPix,gt.clusterTileX,gt.clusterTileY,gt.clusterTileZ,0,this.maxNumLightsPerCluster,i,n),this._clusterGenerateCompute.setUniformBuffer("clustersUniform",this.clusterLightingBuffer.clustersUniformBuffer),this._clusterGenerateCompute.setStorageBuffer("clusterBuffer",this.clusterLightingBuffer.clusterBuffer);let o=oe.getLightEntries(e.scene);this._clusterLightingCompute.setStorageBuffer("models",oe.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=J.instance.getLights(a);if(this._useCamera!=e.camera){this._useCamera=e.camera;let o=oe.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=gt.clusterTileZ,this._clusterLightingCompute.workerSizeX=gt.clusterTileZ);let i=k.presentationSize;this.clusterLightingBuffer.update(i[0],i[1],this.clusterPix,gt.clusterTileX,gt.clusterTileY,gt.clusterTileZ,r.length,this.maxNumLightsPerCluster,e.camera.near,e.camera.far),this.resize=!1;let n=y.beginCommandEncoder();y.computeCommand(n,[this._clusterGenerateCompute,this._clusterLightingCompute]),y.endCommandEncoder(n)}}class Ae extends He{resolveTarget;sampleCount;clone(){let e=new Ae(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=Y.rgba8unorm,r=!1,i,n=1,o=0,l=1){super(e,t,n),k.device,this.name=Et(),this.useMipmap=r,this.sampleCount=o,this.format=a,this.numberLayer=n,this.mipmapCount=l,i!=null?this.usage=i:this.usage=i|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,this.resize(e,t)}resize(e,t){let a=k.device;this.gpuTexture&&(He.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==Y.rgba32float?(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=a.createSampler({})):this.format==Y.depth32float?(this.samplerBindingLayout.type="filtering",this.sampler_comparisonBindingLayout.type="comparison",this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})):this.format==Y.depth24plus?(this.samplerBindingLayout={type:"filtering"},this.sampler_comparisonBindingLayout={type:"comparison"},this.textureBindingLayout.sampleType="depth",this.gpuSampler=k.device.createSampler({}),this.gpuSampler_comparison=k.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=Ot.mirror_repeat,this.addressModeV=Ot.mirror_repeat,this.gpuSampler=a.createSampler(this)),this._textureChange=!0}create(e,t,a=!0){let r=k.device;const i=e*4;let n=new Float32Array(e*t*4);const o=r.createBuffer({size:n.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});r.queue.writeBuffer(o,0,n);const l=y.beginCommandEncoder();l.copyBufferToTexture({buffer:o,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(l)}readTextureToImage(){let e=k.device,t=k.windowWidth,a=k.windowHeight,r=new Float32Array(t*a*4);const i=e.createBuffer({size:r.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});return y.beginCommandEncoder().copyTextureToBuffer({texture:this.getGPUTexture()},{buffer:i},[t,a]),i.getMappedRange(0,r.byteLength)}}class U0 extends ee{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=Ke.createCamera3DObject(this,"up"),this.down_camera=Ke.createCamera3DObject(this,"down"),this.left_camera=Ke.createCamera3DObject(this,"left"),this.right_camera=Ke.createCamera3DObject(this,"right"),this.front_camera=Ke.createCamera3DObject(this,"front"),this.back_camera=Ke.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(u.ZERO,u.UP,u.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(u.ZERO,u.DOWN,u.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(u.ZERO,u.LEFT),this.left_camera.object3D.scaleX=-1,this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(u.ZERO,u.RIGHT),this.right_camera.object3D.scaleX=-1,this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(u.ZERO,u.FORWARD),this.front_camera.object3D.scaleX=-1,this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(u.ZERO,u.BACK),this.back_camera.object3D.scaleX=-1,this.up_camera.type=We.shadow,this.down_camera.type=We.shadow,this.left_camera.type=We.shadow,this.right_camera.type=We.shadow,this.front_camera.type=We.shadow,this.back_camera.type=We.shadow}}class x0 extends He{constructor(e,t,a){super(e,t,a),this.format=Y.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=k.device.createSampler({minFilter:er.linear,magFilter:er.linear}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})}}class y0 extends xa{shadowPassCount;_forceUpdate=!1;_shadowCameraDic;shadowCamera;cubeArrayTexture;colorTexture;shadowSize=1024;constructor(){super(),this.passType=H.POINT_SHADOW,this._shadowCameraDic=new Map,this.cubeArrayTexture=new x0(this.shadowSize,this.shadowSize,8),this.colorTexture=new Ae(this.shadowSize,this.shadowSize,Y.bgra8unorm,!1),ge.getInstance().attached(this.cubeArrayTexture,this)}getShadowCamera(e,t){let a;if(this._shadowCameraDic.has(t))a=this._shadowCameraDic.get(t);else{let r=new U0(e.camera.near,e.camera.far,90,!0);r.label=t.name;let i=[],n=[];for(let o=0;o<6;o++){let l=new Ae(this.shadowSize,this.shadowSize,this.cubeArrayTexture.format,!1),c=new je([this.colorTexture],[new ke]);l.name="shadowDepthTexture_"+t.name+o+"_face",i[o]=l,c.depthTexture=l,c.label="shadowRender",c.customSize=!0,n[o]=this.getRenderContext(c)}a={cubeCamera:r,depthTexture:i,renderContext:n},this._shadowCameraDic.set(t,a)}return a}render(e,t){if(!m.setting.shadow.enable)return;this.shadowPassCount=0,e.camera;let a=e.scene,r=It.getPointShadowLightWhichScene(a),i=r.length;for(let n=0;n<i;n++){let o=r[n];if(o.lightData.lightType!=Xe.DirectionLight&&o.lightData.castShadowIndex>-1&&(o.needUpdateShadow||this._forceUpdate||Fe.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=J.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=J.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=J.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=J.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=J.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=J.instance.getRenderNodes(a,l.cubeCamera.back_camera),this.renderSceneOnce(5,l,e,l.cubeCamera.back_camera,f,t);let d=y.beginCommandEncoder();for(let h=0;h<6;h++)d.copyTextureToTexture({texture:l.depthTexture[h].getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:0}},{texture:this.cubeArrayTexture.getGPUTexture(),mipLevel:0,origin:{x:0,y:0,z:o.shadowIndex*6+h}},{width:this.shadowSize,height:this.shadowSize,depthOrArrayLayers:1});y.endCommandEncoder(d)}}this._forceUpdate=!1}renderSceneOnce(e,t,a,r,i,n){let o=t.renderContext[e];o.clean(),o.beginOpaqueRenderPass(),o.encoder.setViewport(0,0,this.shadowSize,this.shadowSize,0,1),o.encoder.setScissorRect(0,0,this.shadowSize,this.shadowSize),r.onUpdate(),r.transform.updateWorldMatrix(!0);for(const l of i.opaqueList){let c=l;if(!c.isDestroyed&&c.preInit(this._rendererType)){c.nodeUpdate(a,this._rendererType,o.rendererPassState,null);break}}this.drawShadowRenderNodes(a,r,o,i.opaqueList,n),this.drawShadowRenderNodes(a,r,o,i.transparentList,n),o.endRenderPass()}drawShadowRenderNodes(e,t,a,r,i){oe.updateCameraGroup(t),y.bindCamera(a.encoder,t),this.drawNodes(e,t,a,r,i,null)}drawNodes(e,t,a,r,i,n){let o=J.instance.getRenderShaderCollect(e);if(o){for(const l of o){let c=l[1];for(const f of c){let d=f[1];if(!d.isDestroyed&&d.preInit(this._rendererType)){d.nodeUpdate(e,this._rendererType,a.rendererPassState,n);break}}}for(let l=m.setting.render.drawOpMin;l<Math.min(r.length,m.setting.render.drawOpMax);++l){let c=r[l];if(c.transform.enable&&c.enable&&c.castShadow&&!c.isDestroyed){c.preInit(this._rendererType)||c.nodeUpdate(e,this._rendererType,a.rendererPassState,n);for(let f of c.materials){let d=f.getPass(this._rendererType);if(!(!d||d.length==0))for(let h of d){const b=h;b.pipeline&&(b.setUniformFloat("cameraFar",t.far),b.setUniformVector3("lightWorldPos",t.transform.worldPosition),b.materialDataUniformBuffer.apply())}}c.renderPass(e,this.passType,a)}}}}}class C0 extends He{constructor(e,t,a=Y.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=k.device.createSampler({}),this.gpuSampler_comparison=k.device.createSampler({compare:"less",label:"sampler_comparison"})}}class S0 extends xa{shadowPassCount;depth2DArrayTexture;rendererPassStates;_forceUpdate=!1;constructor(){super(),this.setShadowMap(m.setting.shadow.shadowSize,Zt.Cascades),this.passType=H.SHADOW}setShadowMap(e,t){this.rendererPassStates=[],this.depth2DArrayTexture=new C0(e,e,Y.depth32float,8),ge.getInstance().attached(this.depth2DArrayTexture,this);for(let a=0;a<8;a++){let r=new je([],[]);const i=new Ae(e,e,Y.depth32float,!1);i.name=`shadowDepthTexture_${a}`,r.depthTexture=i,r.label="shadowRender",r.customSize=!0,r.depthCleanValue=1;let n=Qe.createRendererPassState(r);this.rendererPassStates[a]=n}}render(e,t){let a=m.setting.shadow;if(!a.enable)return;let r=e.camera,i=e.scene;if(this.shadowPassCount=0,!a.needUpdate||Fe.frame%a.updateFrameRate!=0)return;let n=It.getDirectShadowLightWhichScene(i),o=a.shadowSize;const l=Zt.Cascades;for(let c of n){const f=c;let d=f.shadowIndex;this.rendererPassState=this.rendererPassStates[d],o=this.rendererPassState.depthTexture.width;let h=J.instance.getRenderShaderCollect(e);for(const b of h){let p=b[1];for(const g of p){let A=g[1];if(!A.isDestroyed&&A.preInit(this._rendererType)){A.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}if(f.castShadow&&f.needUpdateShadow||this._forceUpdate||f.castShadow&&a.autoUpdate)if(f.needUpdateShadow=!1,r.enableCSM&&d==0)for(let b=0;b<l;b++){this.rendererPassState=this.rendererPassStates[b];let p=r.csm.children[b],g=r.getCSMShadowWorldExtents(b);this.poseShadowCamera(r,f.direction,p.shadowCamera,g,p.bound.center),this.renderShadow(e,p.shadowCamera,t,this.rendererPassState),this.copyDepthTexture(this.rendererPassState.depthTexture,this.depth2DArrayTexture,b,o)}else{r.enableCSM&&(d+=l-1);let b=r.getShadowWorldExtents();this.rendererPassState=this.rendererPassStates[d],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,d,o)}}this._forceUpdate=!1}copyDepthTexture(e,t,a,r){let i=y.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}),y.endCommandEncoder(i)}_shadowPos=new u;_shadowCameraTarget=new u;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=J.instance.getRenderNodes(e.scene,t),n=y.beginCommandEncoder(),o=y.beginRenderPass(n,r);t.transform.updateWorldMatrix(),Vn.enable&&(a.update(t,e.scene),a.collect(i,t)),oe.updateCameraGroup(t),y.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),y.endPass(o),y.endCommandEncoder(n)}renderShadowBundleOp(e,t,a){let r=J.instance.getOpRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=y.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}renderShadowBundleTr(e,t,a){let r=J.instance.getTrRenderGroup(e.scene);if(r){let i=[];return r.renderGroup.forEach(n=>{if(n.bundleMap.has(this._rendererType))i.push(n.bundleMap.get(this._rendererType));else{let o=y.recordBundleEncoder(a.renderBundleEncoderDescriptor);this.recordShadowRenderBundleNode(e,t,o,n.renderNodes);let l=o.finish();n.bundleMap.set(this._rendererType,l),i.push(l)}}),i}return[]}recordShadowRenderBundleNode(e,t,a,r,i){if(oe.updateCameraGroup(t),y.bindCamera(a,t),r){y.bindGeometryBuffer(a,r[0].geometry);for(let n=0;n<r.length;++n){let o=r[n];o.transform.enable&&o.recordRenderPass2(e,this._rendererType,this.rendererPassState,i,a)}}}drawShadowRenderNodes(e,t,a,r,i){if(oe.updateCameraGroup(t),y.bindCamera(a,t),r)for(let n=m.setting.render.drawOpMin;n<Math.min(r.length,m.setting.render.drawOpMax);++n){let o=r[n];o.transform.enable&&o.enable&&o.castShadow&&(o.isDestroyed||(o.preInit(this._rendererType)||o.nodeUpdate(e,this._rendererType,this.rendererPassState,i),o.renderPass2(e,this._rendererType,this.rendererPassState,i,a)))}}}class F0 extends xa{zBufferTexture;useRenderBundle=!1;shadowPassCount;zCullingCompute;constructor(){super(),this.passType=H.DEPTH;let e=k.presentationSize,t=1;this.zBufferTexture=vt.createRTTexture(Ua.zBufferTexture_NAME,Math.floor(e[0]*t),Math.floor(e[1]*t),Y.rgba16float,!1);let a=new ke;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=new je([],[],vt.createRTTexture(Ua.zPreDepthTexture_NAME,Math.floor(e[0]),Math.floor(e[1]),Y.depth32float,!1),null,!1);this.setRenderStates(r)}render(e,t){let a=e.camera,r=e.scene;y.cleanCache(),Ye.start("DepthPass Renderer");let i=r;this.rendererPassState.camera3D=a;let n=J.instance.getRenderNodes(i,a);this.compute(e,t);let o=this.renderBundleOp(e,n,t),l=[],c=y.beginCommandEncoder(),f=y.beginRenderPass(c,this.rendererPassState);o.length>0&&f.executeBundles(o);let d=J.instance.getRenderShaderCollect(e);for(const h of d){let b=h[1];for(const p of b){let g=p[1];if(!g.isDestroyed&&g.preInit(this._rendererType)){g.nodeUpdate(e,this._rendererType,this.rendererPassState,null);break}}}this.drawRenderNodes(e,f,c,n.opaqueList,t),l.length>0&&f.executeBundles(l),y.endPass(f),y.endCommandEncoder(c),Ye.end("DepthPass Renderer")}drawRenderNodes(e,t,a,r,i,n){y.bindCamera(t,e.camera);for(let o=m.setting.render.drawOpMin;o<Math.min(r.length,m.setting.render.drawOpMax);++o){let l=r[o];l.transform.enable&&l.enable&&(l.isDestroyed||(l.preInit(this._rendererType)||l.nodeUpdate(e,this._rendererType,this.rendererPassState),l.renderPass2(e,this._rendererType,this.rendererPassState,n,t)))}}}class k0{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 E0 extends xa{finalQuadView;postList;constructor(){super(),this._rendererType=H.POST,this.postList=new Map,this.initRenderer()}initRenderer(){z.register("FullQuad_vert_wgsl",zl),this.finalQuadView=new Mn("Quad_vert_wgsl","Quad_frag_wgsl",new je([],[]),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=y.beginCommandEncoder();this.postList.forEach(a=>{a.enable&&a.render(e,t)}),y.endCommandEncoder(t)}presentContent(e,t){let a=y.beginCommandEncoder();this.finalQuadView.renderToViewQuad(e,this.finalQuadView,a,t),y.endCommandEncoder(a)}}class Rt{enable=!0;postRenderer;rtViewQuad;virtualTexture;constructor(){this.rtViewQuad=new Map,this.virtualTexture=new Map,k.addEventListener(Ha.RESIZE,this.onResize,this)}createRTTexture(e,t,a,r,i=!1,n=0){let o=vt.createRTTexture(e,t,a,r,i,n);return o.name=e,this.virtualTexture.set(e,o),ge.getInstance().attached(o,this),o}createViewQuad(e,t,a,r=0){let i=vt.createViewQuad(e,"Quad_vert_wgsl",t,a,r);return this.rtViewQuad.set(e,i),i}getOutTexture(){let e,t=y.lastRenderPassState.renderTargets;return t.length>0?e=t[0]:e=vt.getTexture(Ua.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=y.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];ge.getInstance().detached(a,this),a.destroy(e)}}}class Pn extends ee{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=Ke.createCamera3DObject(this,"up"),this.down_camera=Ke.createCamera3DObject(this,"down"),this.left_camera=Ke.createCamera3DObject(this,"left"),this.right_camera=Ke.createCamera3DObject(this,"right"),this.front_camera=Ke.createCamera3DObject(this,"front"),this.back_camera=Ke.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(u.ZERO,u.UP,u.DOWN),this.down_camera.perspective(a,i,e,t),this.down_camera.lookAt(u.ZERO,u.DOWN,u.DOWN),this.left_camera.perspective(a,i,e,t),this.left_camera.lookAt(u.ZERO,u.LEFT),this.right_camera.perspective(a,i,e,t),this.right_camera.lookAt(u.ZERO,u.RIGHT),this.front_camera.perspective(a,i,e,t),this.front_camera.lookAt(u.ZERO,u.FORWARD),this.back_camera.perspective(a,i,e,t),this.back_camera.lookAt(u.ZERO,u.BACK),this.up_camera.type=We.shadow,this.down_camera.type=We.shadow,this.left_camera.type=We.shadow,this.right_camera.type=We.shadow,this.front_camera.type=We.shadow,this.back_camera.type=We.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 w0=`
|
|
6207
6207
|
#include "GenerayRandomDir"
|
|
6208
6208
|
#include "BitUtil"
|
|
6209
6209
|
#include "MathShader"
|
|
@@ -7228,7 +7228,7 @@ fn CsMain( @builtin(workgroup_id) workgroup_id : vec3<u32> , @builtin(global_inv
|
|
|
7228
7228
|
}
|
|
7229
7229
|
`;class L0{computeShader;worldPosMap;worldNormalMap;colorMap;shadowMap;pointShadowMap;lightingTexture;constructor(){let e=m.setting.gi;this.lightingTexture=new At(e.probeSourceTextureSize,e.probeSourceTextureSize,Y.rgba16float,!1,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING)}create(e){let t=oe.getLightEntries(e.scene);this.computeShader=new fe(O0);let a=oe.getCameraGroup(e.camera);this.computeShader.setUniformBuffer("globalUniform",a.uniformGPUBuffer),this.computeShader.setStorageTexture("outputBuffer",this.lightingTexture),this.computeShader.setStorageBuffer("lightBuffer",t.storageGPUBuffer),this.computeShader.setStorageBuffer("models",oe.modelMatrixBindGroup.matrixBufferDst),this.computeShader.setSamplerTexture("positionMap",this.worldPosMap),this.computeShader.setSamplerTexture("normalMap",this.worldNormalMap),this.computeShader.setSamplerTexture("colorMap",this.colorMap),this.computeShader.setSamplerTexture("shadowMap",this.shadowMap),this.computeShader.setSamplerTexture("pointShadowMap",this.pointShadowMap),this.computeShader.setSamplerTexture("prefilterMap",m.res.defaultSky)}setInputs(e){this.worldPosMap=e[0],this.worldNormalMap=e[1],this.colorMap=e[2],this.shadowMap=e[3],this.pointShadowMap=e[4]}compute(e,t){this.computeShader||this.create(e);let a=y.beginCommandEncoder(),r=m.setting.gi;this.computeShader.workerSizeX=r.probeSourceTextureSize/8,this.computeShader.workerSizeY=r.probeSourceTextureSize/8,this.computeShader.workerSizeZ=1,y.computeCommand(a,[this.computeShader]),y.endCommandEncoder(a)}}let _s=new $e("GIRenderStartEvent"),Ln=new $e("GIRenderCompleteEvent");class F2{count;complete}class G0 extends xa{cubeCamera;volume;probeCountPerFrame=1;nextProbeIndex=-1;tempProbeList=[];isRenderCloudGI;probeRenderResult;renderStatus="none";positionMap;normalMap;colorMap;probeNext=128;sizeW;sizeH;lightingPass;bouncePass;irradianceComputePass;irradianceDepthMap;irradianceColorMap;constructor(e){super(),this.passType=H.GI,this.volume=e;let t=e.setting;this.cubeCamera=new Pn(.01,5e3),this.sizeW=t.probeSourceTextureSize,this.sizeH=t.probeSourceTextureSize,this.probeNext=t.probeSourceTextureSize/t.probeSize,this.initIrradianceMap(e),this.probeRenderResult=new F2;let a=new T0(this.sizeW,this.sizeH,!1);this.positionMap=a.renderTargets[0],this.normalMap=a.renderTargets[1],this.colorMap=a.renderTargets[2],this.setRenderStates(a)}setInputTexture(e){this.lightingPass=new L0,this.bouncePass=new P0(this.volume),this.irradianceComputePass=new N0(this.volume),this.lightingPass.setInputs([this.positionMap,this.normalMap,this.colorMap,e[0],e[1]]),this.bouncePass.setInputs([this.normalMap,this.colorMap,this.lightingPass.lightingTexture,this.irradianceColorMap]),this.irradianceComputePass.setTextures([this.positionMap,this.normalMap,this.bouncePass.blendTexture],this.irradianceColorMap,this.irradianceDepthMap)}setIrradianceData(e,t,a,r){if(a!=this.irradianceColorMap.width||r!=this.irradianceColorMap.height){console.error("irradiance image size not match !");return}this.writeToTexture(this.irradianceColorMap,e,a,r),this.writeToTexture(this.irradianceDepthMap,t,a,r)}updateProbe(e,t,a){let r=J.instance.getLights(e.scene),i=this.volume.setting.probeSize;t.drawCallFrame+=1,this.cubeCamera.x=t.x,this.cubeCamera.y=t.y,this.cubeCamera.z=t.z,this.volume.setting.debugCamera?(this.cubeCamera.x=e.camera.transform.x,this.cubeCamera.y=e.camera.transform.y,this.cubeCamera.z=e.camera.transform.z,this.cubeCamera.rotationX=e.camera.transform.rotationX,this.cubeCamera.rotationY=e.camera.transform.rotationY,this.cubeCamera.rotationZ=e.camera.transform.rotationZ):(this.cubeCamera.rotationX=t.rotationX,this.cubeCamera.rotationY=t.rotationY,this.cubeCamera.rotationZ=t.rotationZ);let n=this.cubeCamera,o=Math.floor(t.index/this.probeNext)*(i*6),l=Math.floor(t.index%this.probeNext)*i;a.setViewport(0+o,l,i,i,0,1),this.renderSceneOnce(e,n.right_camera,a,r),a.setViewport(i+o,l,i,i,0,1),this.renderSceneOnce(e,n.left_camera,a,r),a.setViewport(i*2+o,l,i,i,0,1),this.renderSceneOnce(e,n.up_camera,a,r),a.setViewport(i*3+o,l,i,i,0,1),this.renderSceneOnce(e,n.down_camera,a,r),a.setViewport(i*4+o,l,i,i,0,1),this.renderSceneOnce(e,n.front_camera,a,r),a.setViewport(i*5+o,l,i,i,0,1),this.renderSceneOnce(e,n.back_camera,a,r)}renderSceneOnce(e,t,a,r){this.volume.uploadBuffer();let i=J.instance.getRenderNodes(e.scene,t);y.bindCamera(a,t);let n=Math.max(0,m.setting.render.drawOpMin),o=Math.min(m.setting.render.drawOpMax,i.opaqueList.length),l=J.instance.getRenderShaderCollect(e);for(const c of l){let f=c[1];for(const d of f){let h=d[1];if(!h.isDestroyed&&h.preInit(this.passType)){h.nodeUpdate(e,this.passType,this.rendererPassState,null);break}}}for(let c=n;c<o;++c){let f=i.opaqueList[c];f.enable&&f.transform.enable&&!f.isDestroyed&&(f.preInit(this.passType)||f.nodeUpdate(e,this.passType,this.rendererPassState,null),f.renderPass2(e,this.passType,this.rendererPassState,null,a))}J.instance.sky&&(J.instance.sky.preInit(this.passType)||J.instance.sky.nodeUpdate(e,this.passType,this.rendererPassState,null),J.instance.sky.renderPass2(e,this.passType,this.rendererPassState,null,a)),n=Math.max(0,m.setting.render.drawTrMin),o=Math.min(m.setting.render.drawTrMax,i.transparentList.length);for(let c=n;c<o;++c){let f=i.transparentList[c];f.enable&&f.transform.enable&&!f.isDestroyed&&(f.preInit(this.passType)||f.nodeUpdate(e,this.passType,this.rendererPassState,null),f.renderPass2(e,this.passType,this.rendererPassState,null,a))}}render(e,t){if(!m.setting.gi.enable)return;this.volume.updateOrientation(),this.volume.isVolumeFrameChange=!1,this.volume.uploadBuffer(),this.rendProbe(e);let a=this.probeRenderResult.count>0;(J.instance.state.giLightingChange||a||m.setting.gi.realTimeGI)&&(J.instance.state.giLightingChange=!1,this.lightingPass.compute(e,this.rendererPassState),this.bouncePass.compute(e,this.rendererPassState),this.irradianceComputePass.compute(e,this.rendererPassState)),this.probeRenderResult.complete&&this.dispatchEvent(Ln)}startRenderGI(e=0){this.nextProbeIndex==-1&&e==0&&this.dispatchEvent(_s),this.nextProbeIndex=e,this.renderStatus="rendering"}startRenderCloudGI(){this.dispatchEvent(_s),this.nextProbeIndex=0,this.renderStatus="rendering",this.isRenderCloudGI=!0}rendProbe(e){let t=m.setting.gi.autoRenderProbe,a=!1;if(t?(this.nextProbeIndex==-1&&this.startRenderGI(),a=!0):a=this.renderStatus=="rendering",this.probeRenderResult.count=0,this.probeRenderResult.complete=!1,a){let r=J.instance.getProbes(e.scene);this.renderContext.clean(),this.renderContext.beginOpaqueRenderPass(),this.tempProbeList.length=0;let i=Math.min(this.probeCountPerFrame,r.length);for(this.probeRenderResult.count=i;i>0;){const o=r[this.nextProbeIndex];this.updateProbe(e,o,this.renderContext.encoder),i--,this.nextProbeIndex++,o.drawCallFrame<3&&this.tempProbeList.push(o)}this.tempProbeList.length>0&&this.volume.updateProbes(this.tempProbeList);let n=this.nextProbeIndex>=r.length;this.nextProbeIndex>=r.length&&this.isRenderCloudGI&&this.updateProbe(e,r[0],this.renderContext.encoder),this.renderContext.endRenderPass(),n&&(this.nextProbeIndex=-1,this.renderStatus="complete",this.probeRenderResult.complete=!0)}}initIrradianceMap(e){let t=e.setting,a=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST;this.irradianceDepthMap=new At(t.octRTMaxSize,t.octRTMaxSize,Y.rgba16float,!1,a),this.irradianceDepthMap.name="irradianceDepthMap",this.irradianceColorMap=new At(t.octRTMaxSize,t.octRTMaxSize,Y.rgba16float,!1,a),this.irradianceColorMap.name="irradianceColorMap"}writeToTexture(e,t,a,r){console.log(e.name);const i=k.device.createBuffer({size:t.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});k.device.queue.writeBuffer(i,0,t);const n=y.beginCommandEncoder();n.copyBufferToTexture({buffer:i,bytesPerRow:a*16},{texture:e.getGPUTexture()},{width:a,height:r,depthOrArrayLayers:1}),y.endCommandEncoder(n)}}class z0 extends xa{constructor(){super(),this.passType=H.UI}compute(e,t){let a=y.beginCommandEncoder(),r=y.lastRenderPassState.getLastRenderTexture(),i=ne.getGUIBufferFrame().getColorTexture();y.copyTexture(a,r,i),y.endCommandEncoder(a)}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,n=e.camera;oe.updateCameraGroup(n),this.rendererPassState.camera3D=n;let o=J.instance.getRenderNodes(i,n);{this.renderContext.specialtRenderPass();let l=this.renderContext.encoder;o.opaqueList&&(y.bindCamera(l,n),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let l=this.renderContext.encoder;!r&&o.transparentList&&(y.bindCamera(l,n),this.drawNodes(e,this.renderContext,o.transparentList,t,a)),this.renderContext.endRenderPass()}}drawNodes(e,t,a,r,i){let n=J.instance.getRenderShaderCollect(e);if(n){for(const o of n){let l=o[1];for(const c of l){let f=c[1];if(!f.isDestroyed&&f.preInit(this._rendererType)){f.nodeUpdate(e,this._rendererType,this.rendererPassState,i);break}}}for(let o=m.setting.render.drawOpMin;o<Math.min(a.length,m.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(!l.hasMask(Be.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 J0 extends Q0{constructor(e){super(e)}start(){super.start();{let e=new A0,t=ne.getGBufferFrame(ne.colorPass_GBuffer);if(m.setting.render.zPrePass&&(t.zPreTexture=this.depthPassRenderer.rendererPassState.depthTexture),e.setRenderStates(t),m.setting.gi.enable){let a=oe.getLightEntries(this.view.scene);this.ddgiProbeRenderer=new G0(a.irradianceVolume),this.ddgiProbeRenderer.setInputTexture([this.shadowMapPassRenderer.depth2DArrayTexture,this.pointLightShadowRenderer.cubeArrayTexture]),e.setIrradiance(this.ddgiProbeRenderer.irradianceColorMap,this.ddgiProbeRenderer.irradianceDepthMap),this.rendererMap.addRenderer(this.ddgiProbeRenderer)}this.rendererMap.addRenderer(e)}{let e=ne.getGUIBufferFrame(),t=new z0;t.setRenderStates(e),this.rendererMap.addRenderer(t)}m.setting.render.debug&&this.debug()}debug(){}}class W0{_factor;_doubleFactor;constructor(){this._factor=1,this._doubleFactor=2}get accelerateInterpolator(){return this._factor}set accelerateInterpolator(e){this._factor=e,this._doubleFactor=2*this._factor}getInterpolation(e){return this._factor==1?e*e:Math.pow(e,this._doubleFactor)}}class Z0{_factor=1;constructor(){}get decelerateInterpolator(){return this._factor}set decelerateInterpolator(e){this._factor=e}getInterpolation(e){let t;return this._factor==1?t=1-(1-e)*(1-e):t=1-Math.pow(1-e,2*this._factor),t}}class j0{_factor=1;constructor(){}getInterpolation(e){return Math.cos((e+1)*Math.PI)/2+.5}}class Y0{getInterpolation(e){return e}}class X0{getInterpolation(e){return 4.9*e+4.9*e}}class zt{constructor(){}static bounce(e){return e*e*9.8}getInterpolation(e){return e*=1.1226,e<.3535?zt.bounce(e):e<.7408?zt.bounce(e-.54719)+.7:e<.9644?zt.bounce(e-.8526)+.9:zt.bounce(e-1.0435)+.95}getBounceInterpolation(e){return e<.5?zt.bounce(e):zt.bounce(e-1)}geJumpUp(e,t){return t<.5?(t=t/.5,e*t-zt.bounce(t)):t<.8?(t=(t-.5)/(.8-.5),(e*t-zt.bounce(t))*.3):t<1?(t=(t-.8)/(1-.8),(e*t-zt.bounce(t))*.15):e*t-zt.bounce(t)}}class H0{_tension;constructor(){this._tension=2}get anticipateInterpolator(){return this._tension}set anticipateInterpolator(e){this._tension=e}getInterpolation(e){return e*e*((this._tension+1)*e-this._tension)}}class ns{_tension;constructor(){this._tension=1*1.5}anticipateOvershootInterpolator(e){this._tension=e*1.5}anticipateOvershootInterpolator2(e,t){this._tension=e*t}getInterpolation(e){return e<.5?.5*ns.a(e*2,this._tension):.5*(ns.o(e*2-2,this._tension)+2)}static a(e,t){return e*e*((t+1)*e-t)}static o(e,t){return e*e*((t+1)*e+t)}}class K0{_cycles;constructor(e){this._cycles=e}getInterpolation(e){return Math.sin(2*this._cycles*Math.PI*e)}}class q0{_tension;constructor(){this._tension=2}getInterpolation(e){return e-=1,e*e*((this._tension+1)*e+this._tension)+1}}var Gn=(s=>(s[s.AccelerateInterpolator=0]="AccelerateInterpolator",s[s.DecelerateInterpolator=1]="DecelerateInterpolator",s[s.AccelerateDecelerateInterpolator=2]="AccelerateDecelerateInterpolator",s[s.LinearInterpolator=3]="LinearInterpolator",s[s.BounceInterpolator=4]="BounceInterpolator",s[s.AnticipateInterpolator=5]="AnticipateInterpolator",s[s.AnticipateOvershootInterpolator=6]="AnticipateOvershootInterpolator",s[s.CycleInterpolator=7]="CycleInterpolator",s[s.OvershootInterpolator=8]="OvershootInterpolator",s[s.JumperInterpolator=9]="JumperInterpolator",s))(Gn||{});class pr{static interpolators=[];complete=!1;onComplete;onProgress;target;property;targetProperty;durtion;interpolatorEnum;delayTime=0;_interpolator;_ct=0;_p=0;static to(e,t,a,r=0){var i=new pr;return i.target=e,i.property=t,i.durtion=a,i.interpolatorEnum=r,i.start(),i.delayTime=t.delayTime?t.delayTime:0,t.onComplete&&(i.onComplete=t.onComplete),t.onProgress&&(i.onProgress=t.onProgress),this.interpolators.push(i),i}static tick(e){let t=pr.interpolators;for(let a of t)a.complete?pr.remove(a,!0):a.tick(e)}static remove(e,t){let a=pr.interpolators,r=a.indexOf(e);r!=-1&&a.splice(r,1),t&&e.dispose()}static removeList(e,t){e.forEach(a=>{this.remove(a,t)})}start(){window.AccelerateInterpolator=W0,window.DecelerateInterpolator=Z0,window.AccelerateDecelerateInterpolator=j0,window.LinearInterpolator=Y0,window.BounceInterpolator=zt,window.AnticipateInterpolator=H0,window.AnticipateOvershootInterpolator=ns,window.CycleInterpolator=K0,window.OvershootInterpolator=q0,window.JumperInterpolator=X0,this._interpolator=new window[Gn[this.interpolatorEnum]],this.targetProperty={};for(let e in this.property)this.targetProperty[e]=this.target[e]}tick(e){if(this.delayTime<=0){this._p=Math.min(this._ct/this.durtion,1);let t=this._interpolator.getInterpolation(this._p),a=this.property,r=this.target,i=this.targetProperty,n,o;for(let l in a)o=a[l],n=i[l],r[l]=n+(o-n)*t;this.onProgress!=null&&this.onProgress(this._p),this._ct>=this.durtion&&(this.complete=!0,this.onComplete!=null&&this.onComplete(this.target)),this._ct+=e}else this.delayTime-=e}dispose(){this.onComplete=null,this.onProgress=null,this.target=null,this.property=null,this.targetProperty=null,this.interpolatorEnum=null,this._interpolator=null,pr.remove(this)}}class Ct{static _filterChar=[" "," ",";",`
|
|
7230
7230
|
`,"\r"," ",`
|
|
7231
|
-
`,"\r"," "];static hasString(e,t){for(var a=0;a<e.length;++a)if(e[a]==t)return a;return-1}static getEllipsis(e,t=4){let a=e;return a.length>t&&(a=a.slice(0,t)+"..."),a}static getURLName(e){var t;t=e.split("/");let a=t[t.length-1];return a=a.split(".")[0],a}static getFileFormat(e){var t=e.lastIndexOf(".");t++;var a=e.length;e.indexOf("?",t)!==-1&&(a=e.indexOf("?",t));var r=e.substr(t,a-t);return r=r.toLowerCase(),r}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let n=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,n)&&(o.indexOf('"')==-1?t[n]=parseFloat(i[1]):t[n]=o.replace('"',"").replace('"',""))}})}static getPath(e){var t=e.lastIndexOf("/");return t++,e.substring(0,t)}static normalizePath(e){
|
|
7231
|
+
`,"\r"," "];static hasString(e,t){for(var a=0;a<e.length;++a)if(e[a]==t)return a;return-1}static getEllipsis(e,t=4){let a=e;return a.length>t&&(a=a.slice(0,t)+"..."),a}static getURLName(e){var t;t=e.split("/");let a=t[t.length-1];return a=a.split(".")[0],a}static getFileFormat(e){var t=e.lastIndexOf(".");t++;var a=e.length;e.indexOf("?",t)!==-1&&(a=e.indexOf("?",t));var r=e.substr(t,a-t);return r=r.toLowerCase(),r}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let n=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,n)&&(o.indexOf('"')==-1?t[n]=parseFloat(i[1]):t[n]=o.replace('"',"").replace('"',""))}})}static getPath(e){var t=e.lastIndexOf("/");return t++,e.substring(0,t)}static normalizePath(e){if(!e)return e;let t=e.replace(/\\/g,"/");const a=t.startsWith("//"),r=[];let i=0;return t=t.replace(/([a-zA-Z][a-zA-Z0-9+\-.]*):\/{2}/g,(n,o,l)=>{if(o.length===1&&l===0)return n;const c=`__SCHEME_SLASH_${i++}__`;return r.push(c),`${o}:${c}`}),t=t.replace(/\/{2,}/g,"/"),r.forEach(n=>{t=t.replace(n,"//")}),a&&(t=`//${t.replace(/^\/+/,"")}`),t}static getStringList(e,t=";"){return e.split(t)}static formatTime(e){let a=e/1e3/60,r=Math.floor(a),i=Math.floor(a-r);return[r.toString(),i.toString()]}static trim(e){return e.replace(/^\s+/g,"").replace(/\s+$/g,"")}static isEmpty(e){return!e||typeof e>"u"||e==null||typeof e=="string"&&this.trim(e)===""||e==="null"}static strCut(e,t){if(e.length*2<=t)return e;for(var a=0,r="",i=0;i<e.length;i++)if(r=r+e.charAt(i),e.charCodeAt(i)>128){if(a=a+2,a>=t)return r.substring(0,r.length-1)+"..."}else if(a=a+1,a>=t)return r.substring(0,r.length-2)+"...";return r}static toQueryPair(e,t,a=!1){return e+"="+(a?encodeURIComponent(t):t)}static stringFormat(e,...t){if(arguments.length===0)throw new Error("please give arg at least one !");if(arguments.length===2&&typeof arguments[1]=="object")for(let a in arguments[1]){let r=new RegExp("({"+a+"})","g");e=e.replace(r,arguments[1][a])}else for(let a=0;a<t.length;a++){if(t[a]==null)return e;{let r=new RegExp("({["+a+"]})","g");e=e.replace(r,t[a])}}return e}static parseJson2String(e,t){let a=null,r="",i=0,n=" ";return t=t||{},t.newlineAfterColonIfBeforeBraceOrBracket=t.newlineAfterColonIfBeforeBraceOrBracket===!0,t.spaceAfterColon=t.spaceAfterColon!==!1,typeof e!="string"||(e=JSON.parse(e)),e=JSON.stringify(e),a=/([\{\}])/g,e=e.replace(a,`\r
|
|
7232
7232
|
$1\r
|
|
7233
7233
|
`),a=/([\[\]])/g,e=e.replace(a,`\r
|
|
7234
7234
|
$1\r
|
|
@@ -7236,7 +7236,7 @@ $1\r
|
|
|
7236
7236
|
`),a=/(\r\n\r\n)/g,e=e.replace(a,`\r
|
|
7237
7237
|
`),a=/\r\n\,/g,e=e.replace(a,","),t.newlineAfterColonIfBeforeBraceOrBracket||(a=/\:\r\n\{/g,e=e.replace(a,":{"),a=/\:\r\n\[/g,e=e.replace(a,":[")),t.spaceAfterColon&&(a=/\:/g,e=e.replace(a,":")),e.split(`\r
|
|
7238
7238
|
`).forEach(function(o,l){let c=0,f=0,d="";for(o.match(/\{$/)||o.match(/\[$/)?f=1:o.match(/\}/)||o.match(/\]/)?i!==0&&(i-=1):f=0,c=0;c<i;c++)d+=n;r+=d+o+`\r
|
|
7239
|
-
`,i+=f}),r}static compareVersion(e,t){e=e.split("."),t=t.split(".");let a=Math.max(e.length,t.length);for(;e.length<a;)e.push("0");for(;t.length<a;)t.push("0");for(let r=0;r<a;r++){let i=parseInt(e[r]),n=parseInt(t[r]);if(i>n)return 1;if(i<n)return-1}return 0}static buildRandomCode(){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",t=e.length,a="";for(let i=0;i<26;i++){let n=Math.floor(Math.random()*t);a+=e.charAt(n)}return`${new Date().getTime()}-${a}`}static UUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,a=e=="x"?t:t&3|8;return a.toString(16)})}static stringToHash(e){let t=0;if(e.length==0)return t;for(let a=0;a<e.length;a++){const r=e.charCodeAt(a);t=(t<<5)-t+r,t=t&t}return t}static parseUrl(e,t){return t.match(/^(blob|http|https):/)?t:e+t}}class Va extends He{_source;premultiplyAlpha="none";constructor(e=!0){super(),this.useMipmap=e,this.lodMinClamp=0,this.lodMaxClamp=4}get source(){return this._source}set source(e){this._source=e,this._source instanceof HTMLImageElement?this._source.decode().then(async()=>{if(this._source instanceof HTMLImageElement){const t=await createImageBitmap(this._source,{imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"});this.generate(t)}}):(this._source instanceof HTMLCanvasElement||this._source instanceof ImageBitmap)&&this.generate(this._source)}async load(e,t){if(this.name=Ct.getURLName(e),e.indexOf(";base64")!=-1){const a=document.createElement("img");let r=e.indexOf("data:image"),i=e.substring(r,e.length);a.src=i,await a.decode(),a.width=Math.max(a.width,32),a.height=Math.max(a.height,32);const n=await createImageBitmap(a,{resizeWidth:a.width,resizeHeight:a.height,imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"});this.format=Y.rgba8unorm,this.generate(n)}else return new Promise((a,r)=>{fetch(e,{headers:Object.assign({Accept:"image/avif,image/webp,*/*"},t?.headers)}).then(i=>{Jr.read(e,i,t).then(n=>{let o=new Blob([n],{type:"image/jpeg"});n=null,this.loadFromBlob(o).then(()=>{a(!0)})})})});return!0}imageData;async loadFromBlob(e){this.imageData=e;let t=await createImageBitmap(e,{imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"});if(t.width<32||t.height<32){let a=Math.max(t.width,32),r=Math.max(t.height,32);t=await createImageBitmap(t,{resizeWidth:a,resizeHeight:r,imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"})}return this.format=Y.rgba8unorm,this.generate(t),!0}}class Jr{baseUrl="";initUrl;_progress=0;constructor(){}async loadBinData(e,t){return this.baseUrl=Ct.getPath(e),this.initUrl=e,new Promise(async(a,r)=>{fetch(e,{headers:t?.headers}).then(async i=>{if(i.ok){let n=await Jr.read(e,i,t),o=n.buffer;n=null,a(o)}else throw Error("request rejected with status "+i.status)}).catch(i=>{t.onError&&t.onError(i),r(i)})})}async loadAsyncBitmapTexture(e,t){this.baseUrl=Ct.getPath(e),this.initUrl=e;let a=new Va;return a.url=e,a.name=Ct.getURLName(e),await a.load(e,t),m.res.addTexture(e,a),a}async loadJson(e,t){return this.baseUrl=Ct.getPath(e),this.initUrl=e,new Promise(async(a,r)=>{fetch(e,{headers:t?.headers}).then(async i=>{if(i.ok){let n=await Jr.read(e,i,t);const l=new TextDecoder("utf-8").decode(n);n=null,a(JSON.parse(l))}else throw Error("request rejected with status"+i.status)}).catch(i=>{t.onError&&t.onError(i),r(i)})})}async loadTxt(e,t){return this.baseUrl=Ct.getPath(e),new Promise(async(a,r)=>{fetch(e).then(async i=>{if(i.ok){let n=await Jr.read(e,i,t);const l=new TextDecoder("utf-8").decode(n);n=null,a({data:l})}else throw Error("request rejected with status"+i.status)}).catch(i=>{t.onError&&t.onError(i),r(i)})})}static async read(e,t,a){const r=t.body.getReader(),i=+t.headers.get("Content-Length");let n=0,o=[],l=[];for(;;){const{done:d,value:h}=await r.read();if(d){i>0&&a&&a.onComplete&&a.onComplete.call(this,e);break}o.push(h),n+=h.length,i>0?a&&a.onProgress&&a.onProgress.call(this,n,i,e):l.push(h.length)}if(l.length>0)for(let d=0;d<o.length;d++)a&&a.onProgress&&a.onProgress.call(this,l[d],n,e),l[d]==n&&a&&a.onComplete&&a.onComplete.call(this,e);let c=new Uint8Array(n),f=0;for(let d of o)c.set(d,f),f+=d.length;return c}}var ze=(s=>(s[s.TEXT=0]="TEXT",s[s.BIN=1]="BIN",s[s.JSON=2]="JSON",s))(ze||{});class pt extends Jr{async load(e,t,a,r){switch(t.format){case ze.BIN:return new Promise(async(i,n)=>{this.loadBinData(e,a).then(async o=>{let l=new t;if(l.userData=r,l.baseUrl=this.baseUrl,l.initUrl=e,l.loaderFunctions=a,await l.parseBuffer(o),l.verification())i(l);else throw new Error("parser error")}).catch(o=>{n(o)})});case ze.JSON:return new Promise((i,n)=>{this.loadJson(e,a).then(async o=>{let l=new t;l.userData=r,l.baseUrl=this.baseUrl,l.initUrl=e,l.loaderFunctions=a,await l.parseJson(o),i(l)}).catch(o=>{n(o)})});case ze.TEXT:return new Promise((i,n)=>{this.loadTxt(e,a).then(async o=>{let l=new t;l.userData=r,l.baseUrl=this.baseUrl,l.initUrl=e,l.loaderFunctions=a,o.data?(await l.parseString(o.data),i(l)):n("text load is empty!")}).catch(o=>{n(o)})})}}}class st{static format=ze.BIN;baseUrl;initUrl;loaderFunctions;userData;data;parseString(e){}parseJson(e){}parseBuffer(e){}parseTexture(e){throw this.parserError("Method not implemented.",-1)}parse(e){}verification(e){throw this.parserError("Method not implemented.",-1)}parserError(e,t){console.error(`error id:${t} ${e}`)}}class Bs{asset;accessors;buffers;bufferViews;materials;meshes;nodes;scene=0;scenes;textures;cameras;skins;resources;images;samplers;animations;extensions}class k2{nodes}class E2{name;type;color;intensity;range;spot;isParsed}class w2{name;rotation;scale;translation;children;matrix;mesh=-1;isParsed;dnode;camera;skin;nodeId;primitives;extensions;light}class R2{attributes;indices;material;mode;name;targets;extensions;morphTargetsRelative}class I2{name;primitives;isParsed;dprimitives;weights;extras}class Q2{bufferView;componentType;count;type;max;min;isParsed;daccessor;normalized;sparse;byteOffset;computeResult}const T2=window.SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof window.SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer},zn=5120,vi=5121,Jn=5122,Wn=5123,Zn=5124,jn=5125,Yn=5126,M2=32819,N2=32820,V2=33635,P2=5131,O2=33640,L2=35899,G2=35902,z2=36269,J2=34042,$0={};{const s=$0;s[zn]=Int8Array,s[vi]=Uint8Array,s[Jn]=Int16Array,s[Wn]=Uint16Array,s[Zn]=Int32Array,s[jn]=Uint32Array,s[Yn]=Float32Array,s[M2]=Uint16Array,s[N2]=Uint16Array,s[V2]=Uint16Array,s[P2]=Uint16Array,s[O2]=Uint32Array,s[L2]=Uint32Array,s[G2]=Uint32Array,s[z2]=Uint32Array,s[J2]=Uint32Array}function W2(s){switch(s){case Int8Array:return zn;case Uint8Array:return vi;case Uint8ClampedArray:return vi;case Int16Array:return Jn;case Uint16Array:return Wn;case Int32Array:return Zn;case Uint32Array:return jn;case Float32Array:return Yn;default:throw new Error("unsupported typed array type")}}function Z2(s){if(s instanceof Int8Array)return zn;if(s instanceof Uint8Array||s instanceof Uint8ClampedArray)return vi;if(s instanceof Int16Array)return Jn;if(s instanceof Uint16Array)return Wn;if(s instanceof Int32Array)return Zn;if(s instanceof Uint32Array)return jn;if(s instanceof Float32Array)return Yn;throw new Error("unsupported typed array type")}function Xn(s){const e=$0[s];if(!e)throw new Error("unkonw gl type");return e}function j2(s,e=Float32Array){return T2(s)?s:new e(s)}const ef=`
|
|
7239
|
+
`,i+=f}),r}static compareVersion(e,t){e=e.split("."),t=t.split(".");let a=Math.max(e.length,t.length);for(;e.length<a;)e.push("0");for(;t.length<a;)t.push("0");for(let r=0;r<a;r++){let i=parseInt(e[r]),n=parseInt(t[r]);if(i>n)return 1;if(i<n)return-1}return 0}static buildRandomCode(){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",t=e.length,a="";for(let i=0;i<26;i++){let n=Math.floor(Math.random()*t);a+=e.charAt(n)}return`${new Date().getTime()}-${a}`}static UUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,a=e=="x"?t:t&3|8;return a.toString(16)})}static stringToHash(e){let t=0;if(e.length==0)return t;for(let a=0;a<e.length;a++){const r=e.charCodeAt(a);t=(t<<5)-t+r,t=t&t}return t}static parseUrl(e,t){return t.match(/^(blob|http|https):/)?t:e+t}}class Va extends He{_source;premultiplyAlpha="none";constructor(e=!0){super(),this.useMipmap=e,this.lodMinClamp=0,this.lodMaxClamp=4}get source(){return this._source}set source(e){if(this._source&&this._source instanceof ImageBitmap)try{this._source.close()}catch{}this._source=e,this._source instanceof HTMLImageElement?this._source.decode().then(async()=>{if(this._source instanceof HTMLImageElement){const t=await createImageBitmap(this._source,{imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"});this.generate(t)}}):(this._source instanceof HTMLCanvasElement||this._source instanceof ImageBitmap)&&this.generate(this._source)}async load(e,t){if(this.name=Ct.getURLName(e),e.indexOf(";base64")!=-1){const a=document.createElement("img");let r=e.indexOf("data:image"),i=e.substring(r,e.length);a.src=i,await a.decode(),a.width=Math.max(a.width,32),a.height=Math.max(a.height,32);const n=await createImageBitmap(a,{resizeWidth:a.width,resizeHeight:a.height,imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"});this.format=Y.rgba8unorm,this.generate(n)}else return new Promise((a,r)=>{fetch(e,{headers:Object.assign({Accept:"image/avif,image/webp,*/*"},t?.headers)}).then(i=>{Jr.read(e,i,t).then(n=>{let o=new Blob([n],{type:"image/jpeg"});n=null,this.loadFromBlob(o).then(()=>{a(!0)})})})});return!0}imageData;async loadFromBlob(e){this.imageData=e;let t=await createImageBitmap(e,{imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"});if(t.width<32||t.height<32){let a=Math.max(t.width,32),r=Math.max(t.height,32);const i=t;t=await createImageBitmap(t,{resizeWidth:a,resizeHeight:r,imageOrientation:this.flipY?"flipY":"from-image",premultiplyAlpha:"none"});try{i.close()}catch{}}return this.format=Y.rgba8unorm,this.generate(t),!0}destroy(e){if(this._source&&this._source instanceof ImageBitmap){try{this._source.close()}catch{}this._source=null}super.destroy(e)}}class Jr{baseUrl="";initUrl;_progress=0;constructor(){}async loadBinData(e,t){return this.baseUrl=Ct.getPath(e),this.initUrl=e,new Promise(async(a,r)=>{fetch(e,{headers:t?.headers}).then(async i=>{if(i.ok){let n=await Jr.read(e,i,t),o=n.buffer;n=null,a(o)}else throw Error("request rejected with status "+i.status)}).catch(i=>{t.onError&&t.onError(i),r(i)})})}async loadAsyncBitmapTexture(e,t){this.baseUrl=Ct.getPath(e),this.initUrl=e;let a=new Va;return a.url=e,a.name=Ct.getURLName(e),await a.load(e,t),m.res.addTexture(e,a),a}async loadJson(e,t){return this.baseUrl=Ct.getPath(e),this.initUrl=e,new Promise(async(a,r)=>{fetch(e,{headers:t?.headers}).then(async i=>{if(i.ok){let n=await Jr.read(e,i,t);const l=new TextDecoder("utf-8").decode(n);n=null,a(JSON.parse(l))}else throw Error("request rejected with status"+i.status)}).catch(i=>{t.onError&&t.onError(i),r(i)})})}async loadTxt(e,t){return this.baseUrl=Ct.getPath(e),new Promise(async(a,r)=>{fetch(e).then(async i=>{if(i.ok){let n=await Jr.read(e,i,t);const l=new TextDecoder("utf-8").decode(n);n=null,a({data:l})}else throw Error("request rejected with status"+i.status)}).catch(i=>{t.onError&&t.onError(i),r(i)})})}static async read(e,t,a){const r=t.body.getReader(),i=+t.headers.get("Content-Length");let n=0,o=[],l=[];for(;;){const{done:d,value:h}=await r.read();if(d){i>0&&a&&a.onComplete&&a.onComplete.call(this,e);break}o.push(h),n+=h.length,i>0?a&&a.onProgress&&a.onProgress.call(this,n,i,e):l.push(h.length)}if(l.length>0)for(let d=0;d<o.length;d++)a&&a.onProgress&&a.onProgress.call(this,l[d],n,e),l[d]==n&&a&&a.onComplete&&a.onComplete.call(this,e);let c=new Uint8Array(n),f=0;for(let d of o)c.set(d,f),f+=d.length;return c}}var ze=(s=>(s[s.TEXT=0]="TEXT",s[s.BIN=1]="BIN",s[s.JSON=2]="JSON",s))(ze||{});class pt extends Jr{async load(e,t,a,r){switch(t.format){case ze.BIN:return new Promise(async(i,n)=>{this.loadBinData(e,a).then(async o=>{let l=new t;if(l.userData=r,l.baseUrl=this.baseUrl,l.initUrl=e,l.loaderFunctions=a,await l.parseBuffer(o),l.verification())i(l);else throw new Error("parser error")}).catch(o=>{n(o)})});case ze.JSON:return new Promise((i,n)=>{this.loadJson(e,a).then(async o=>{let l=new t;l.userData=r,l.baseUrl=this.baseUrl,l.initUrl=e,l.loaderFunctions=a,await l.parseJson(o),i(l)}).catch(o=>{n(o)})});case ze.TEXT:return new Promise((i,n)=>{this.loadTxt(e,a).then(async o=>{let l=new t;l.userData=r,l.baseUrl=this.baseUrl,l.initUrl=e,l.loaderFunctions=a,o.data?(await l.parseString(o.data),i(l)):n("text load is empty!")}).catch(o=>{n(o)})})}}}class st{static format=ze.BIN;baseUrl;initUrl;loaderFunctions;userData;data;parseString(e){}parseJson(e){}parseBuffer(e){}parseTexture(e){throw this.parserError("Method not implemented.",-1)}parse(e){}verification(e){throw this.parserError("Method not implemented.",-1)}parserError(e,t){console.error(`error id:${t} ${e}`)}}class Bs{asset;accessors;buffers;bufferViews;materials;meshes;nodes;scene=0;scenes;textures;cameras;skins;resources;images;samplers;animations;extensions}class k2{nodes}class E2{name;type;color;intensity;range;spot;isParsed}class w2{name;rotation;scale;translation;children;matrix;mesh=-1;isParsed;dnode;camera;skin;nodeId;primitives;extensions;light}class R2{attributes;indices;material;mode;name;targets;extensions;morphTargetsRelative}class I2{name;primitives;isParsed;dprimitives;weights;extras}class Q2{bufferView;componentType;count;type;max;min;isParsed;daccessor;normalized;sparse;byteOffset;computeResult}const T2=window.SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof window.SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer},zn=5120,vi=5121,Jn=5122,Wn=5123,Zn=5124,jn=5125,Yn=5126,M2=32819,N2=32820,V2=33635,P2=5131,O2=33640,L2=35899,G2=35902,z2=36269,J2=34042,$0={};{const s=$0;s[zn]=Int8Array,s[vi]=Uint8Array,s[Jn]=Int16Array,s[Wn]=Uint16Array,s[Zn]=Int32Array,s[jn]=Uint32Array,s[Yn]=Float32Array,s[M2]=Uint16Array,s[N2]=Uint16Array,s[V2]=Uint16Array,s[P2]=Uint16Array,s[O2]=Uint32Array,s[L2]=Uint32Array,s[G2]=Uint32Array,s[z2]=Uint32Array,s[J2]=Uint32Array}function W2(s){switch(s){case Int8Array:return zn;case Uint8Array:return vi;case Uint8ClampedArray:return vi;case Int16Array:return Jn;case Uint16Array:return Wn;case Int32Array:return Zn;case Uint32Array:return jn;case Float32Array:return Yn;default:throw new Error("unsupported typed array type")}}function Z2(s){if(s instanceof Int8Array)return zn;if(s instanceof Uint8Array||s instanceof Uint8ClampedArray)return vi;if(s instanceof Int16Array)return Jn;if(s instanceof Uint16Array)return Wn;if(s instanceof Int32Array)return Zn;if(s instanceof Uint32Array)return jn;if(s instanceof Float32Array)return Yn;throw new Error("unsupported typed array type")}function Xn(s){const e=$0[s];if(!e)throw new Error("unkonw gl type");return e}function j2(s,e=Float32Array){return T2(s)?s:new e(s)}const ef=`
|
|
7240
7240
|
var DracoDecoderModule = (() => {
|
|
7241
7241
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
|
7242
7242
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
|
@@ -7272,7 +7272,7 @@ else if (typeof define === 'function' && define['amd'])
|
|
|
7272
7272
|
define([], function() { return DracoDecoderModule; });
|
|
7273
7273
|
else if (typeof exports === 'object')
|
|
7274
7274
|
exports["DracoDecoderModule"] = DracoDecoderModule;
|
|
7275
|
-
`;class Hn{static _workerCode;static _workers=new Map;static async apply(e,t){if(!t.extensions)return;const a=t.extensions.KHR_draco_mesh_compression;if(!a)return;let r=this._workers.get(e.gltf);r||(r=new Worker(await this.initDecoder()),this._workers.set(e.gltf,r)),r.postMessage({type:"init",decoderConfig:{}});let i=e.parseBufferView(a.bufferView);if(!i.result){let n=await new Promise((o,l)=>{r.onmessage=c=>{const f=c.data;f.type=="decode"?o(f.result):f.type=="error"&&l(f.error)},r.postMessage({type:"decoder",buffer:i,attributes:a.attributes},[i])});i.result=n}return i.result}static unload(e){let t=this._workers.get(e);t&&(t.terminate(),this._workers.delete(e))}static async initDecoder(){if(!this._workerCode){const e=new Blob([ef,"",`(${Y2})()`],{type:"application/javascript"});this._workerCode=URL.createObjectURL(e)}return this._workerCode}}function Y2(){let s,e;onmessage=t=>{const a=t.data;switch(a.type){case"init":s=a.decoderConfig,e=new Promise((n,o)=>{s.onModuleLoaded=l=>{n({draco:l})},DracoDecoderModule(s)});break;case"decoder":const r=a.buffer,i=a.attributes;e.then(n=>{const o=n.draco;let l=new o.Decoder,c=new o.DecoderBuffer;c.Init(new Int8Array(r),r.byteLength);let f,d;try{const h=l.GetEncodedGeometryType(c);h==o.TRIANGULAR_MESH?(d=new o.Mesh,f=l.DecodeBufferToMesh(c,d)):self.postMessage(new Error("INVALID_GEOMETRY_TYPE:"+h)),f.ok()||self.postMessage(new Error("DracoDecode:"+f.error_msg()));let b={};for(const p in i){let g=l.GetAttributeByUniqueId(d,i[p]);const A=g.num_components(),_=d.num_points()*A,U=_*Float32Array.BYTES_PER_ELEMENT,v=o.DT_FLOAT32,x=o._malloc(U);l.GetAttributeDataArrayForAllPoints(d,g,v,U,x);const C=new Float32Array(o.HEAPF32.buffer,x,_).slice();o._free(x),b[p]={data:C,numComponents:A,normalize:!1}}{const g=d.num_faces()*3,A=g*4,D=o._malloc(A);l.GetTrianglesUInt32Array(d,A,D);const _=new Uint32Array(o.HEAPF32.buffer,D,g).slice();o._free(D),b.indices={data:_,numComponents:1,normalize:!1}}self.postMessage({type:"decode",result:b})}catch(h){self.postMessage({type:"error",error:h.message})}finally{o.destroy(d),o.destroy(l),o.destroy(c)}});break}}}class tf{gltf;constructor(e){this.gltf=e}parse(e){const t=this.gltf.cameras[e];if(!t)return this.errorMiss("camera",e);if(t.isParsed)return t.dcamera;t.isParsed=!0,t.dcamera=!1;const{name:a,type:r,perspective:i,orthographic:n}=t;if(r==="perspective"&&i){const{aspectRatio:o,yfov:l,zfar:c,znear:f}=i;t.dcamera=Object.assign({},{name:a,type:r,yfov:l,znear:f,aspectRatio:o,zfar:c})}else if(r==="orthographic"&&n){const{xmag:o,ymag:l,zfar:c,znear:f}=n;t.dcamera=Object.assign({},{name:a,type:r,xmag:o,ymag:l,zfar:c,znear:f})}return t.dcamera}errorMiss(e,t){throw new Error(e+t)}}class Dt extends st{static format=ze.JSON;_gltf;async parseJson(e){this._gltf=new Bs,this._gltf={...this._gltf,...e},this._gltf.resources={},await Promise.all([this.load_gltf_bin(),this.load_gltf_textures()]);let t=new vs,a=await t.parse(this.initUrl,this._gltf,this._gltf.scene);return t.destroy(),t=null,a?(this.data=a.rootNode,a.rootNode):(this._gltf=null,null)}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}static _counter=0;static getMeshNameCounter(){return function(){return`GLTF_NO_NAME_PRIMITIVE_${Dt._counter++}`}}static getModelNameCounter(){let e=0;return function(){return`GLTF_NO_NAME_MESH_${e++}`}}static getTexCoordDefine(e){return`UV_NUM ${e}`}static getVertexColorDefine(e){return`HAS_VERTEXCOLOR ${e}`}static getBaseColorTextureDefine(){return"HAS_BASECOLORMAP"}static getMetalRoughnessDefine(){return"HAS_METALROUGHNESSMAP"}static getNormalMapDefine(){return"HAS_NORMALMAP"}static getEmissiveMapDefine(){return"HAS_EMISSIVEMAP"}static getOcclusionMapDefine(){return"HAS_OCCLUSIONMAP"}static getMorphTargetsDefine(e){return`MORPH_TARGET_NUM ${e}`}static getMorphtargetPositionDefine(){return"HAS_MORPH_POSITION"}static getMorphtargetNormalDefine(){return"HAS_MORPH_NORMAL"}static getMorphtargetTangentDefine(){return"HAS_MORPH_TANGENT"}static getJointsNumDefine(e){return`JOINTS_NUM ${e}`}static getJointVec8Define(){return"JOINT_VEC8"}static getHasNormalDefine(){return"HAS_NORMAL"}static getHasTangentDefine(){return"HAS_TANGENT"}static getHasNormalMapDefine(){return"HAS_NORMAL_MAP"}static getAlphaMaskDefine(){return"ALPHA_MASK"}static getAlphaBlendDefine(){return"ALPHA_BLEND"}static defaultMaterial={name:"GLTF_DEFAULT_MATERIAL",alphaCutoff:.33,alphaMode:"MASK",pbrMetallicRoughness:{name:"GLTF_DEFAULT_MATERIAL",defines:[],doubleSided:!1,baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1,emissiveFactor:[0,0,0]}};async load_gltf_bin(){if(this._gltf.buffers&&this._gltf.buffers.length>0){let e=[];for(let t=0;t<this._gltf.buffers.length;t++){const a=this._gltf.buffers[t];if(a.uri.substring(0,5)!=="data:"){let r=Ct.parseUrl(this.baseUrl,a.uri);this.loaderFunctions?.onUrl&&(r=await this.loaderFunctions.onUrl(r));let i=new pt().loadBinData(r,this.loaderFunctions).then(n=>{this._gltf.resources[a.uri]=n});e.push(i)}}await Promise.all(e)}}async load_gltf_textures(){if(this._gltf,this._gltf.images){let e=[];for(let t=0;t<this._gltf.images.length;t++){const a=this._gltf.images[t];if(a.uri){let r=Ct.parseUrl(this.baseUrl,a.uri);this.loaderFunctions?.onUrl&&(r=await this.loaderFunctions.onUrl(r));let i=new pt().loadAsyncBitmapTexture(r,this.loaderFunctions).then(n=>{n.name=Ct.getURLName(a.uri),this._gltf.resources[n.name]=n});e.push(i)}}await Promise.all(e)}}}class af{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}async parse(e){const t=this.gltf.meshes[e];if(!t)return this.errorMiss("mesh",e);if(t.isParsed)return t.dprimitives;const a=t.primitives,r=t.extras,i=[];for(let n=0;n<a.length;n++){const o=a[n],{attributes:l,indices:c,material:f,mode:d,name:h,targets:b,morphTargetsRelative:p,extensions:g}=o;let A=t.name;for(let F in l)A+=F;A+=`indices:${c}`,A+=`material:${f}`;const D={attribArrays:{indices:[]},weights:[],defines:[],material:null,drawMode:null,meshName:null,modelName:null,morphTargetsRelative:!1,targetNames:r?r.targetNames:null};let _=!1,U=0,v=!1,x;g&&g.KHR_draco_mesh_compression&&(x=await Hn.apply(this.subParser,o));for(const F in l){const w=x?x[F]:this.parseAccessor(l[F]);if(w){let S;switch(F){case"POSITION":S=V.position;break;case"NORMAL":S=V.normal,_=!0;break;case"TEXCOORD_0":S=V.uv,U++;break;case"JOINTS_0":S=V.joints0;break;case"JOINTS_1":S=V.joints1,v=!0;break;case"WEIGHTS_0":S=V.weights0;break;case"WEIGHTS_1":S=V.weights1;break;default:S=F}D.attribArrays[S]=w}}if(_&&D.defines.push(Dt.getHasNormalDefine()),U&&D.defines.push(Dt.getTexCoordDefine(U)),v&&D.defines.push(Dt.getJointVec8Define()),c!==void 0){const F=x?x.indices:this.parseAccessor(c);F&&(D.attribArrays.indices=F)}const C=await this.parseMaterial(f);if(C&&(D.material=C,D.defines=D.defines.concat(C.defines)),D.drawMode=d===void 0?4:d,D.meshName=()=>A,D.modelName=t.name||Dt.getModelNameCounter(),b){D.defines.push(Dt.getMorphTargetsDefine(b.length)),D.morphTargetsRelative=!0;let F=!1,w=!1,S=!1;for(let M=0;M<b.length;M++){const T=b[M];Object.keys(T).forEach(Q=>{const L=this.parseAccessor(T[Q]);if(L){let X;switch(Q){case"POSITION":X=Yt.MORPH_POSITION_PREFIX+M,F=!0;break;case"NORMAL":X=Yt.MORPH_NORMAL_PREFIX+M,w=!0;break;case"TANGENT":X=Yt.MORPH_TANGENT_PREFIX+M,S=!0;break;default:X=!1}X?D.attribArrays[X]=L:console.error(`glTF has unsupported morph target attribute ${Q}`)}})}F&&D.defines.push(Dt.getMorphtargetPositionDefine()),w&&D.defines.push(Dt.getMorphtargetNormalDefine()),S&&D.defines.push(Dt.getMorphtargetTangentDefine()),D.weights=t.weights||new Array(b.length).fill(0)}i.push(D)}return t.dprimitives=i,t.isParsed=!0,t.dprimitives}parseAccessor(e){return this.subParser.parseAccessor(e)}parseMaterial(e){return this.subParser.parseMaterial(e)}errorMiss(e,t){throw new Error(e+t)}}class rf{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}async parse(e){let t;if(e==null?t=Dt.defaultMaterial:t=this.gltf.materials[e],!t)return this.errorMiss("material",e);if(t.isParsed)return t.dmaterial;let{name:a,pbrMetallicRoughness:r,normalTexture:i,occlusionTexture:n,emissiveTexture:o,emissiveFactor:l,alphaMode:c,alphaCutoff:f,doubleSided:d,extensions:h}=t;const b={name:a,defines:[],doubleSided:!!d,baseColorFactor:[1,1,1,1],emissiveFactor:null,alphaCutoff:0,enableBlend:!1,baseColorTexture:null,metallicRoughnessTexture:null,normalTexture:null,occlusionTexture:null,emissiveTexture:null,extensions:null,baseMapOffsetSize:null,normalMapOffsetSize:null,emissiveMapOffsetSize:null,roughnessMapOffsetSize:null,metallicMapOffsetSize:null,aoMapOffsetSize:null,metallicFactor:0,roughnessFactor:1};if(r){const{baseColorFactor:p,metallicFactor:g,roughnessFactor:A,baseColorTexture:D,metallicRoughnessTexture:_}=r;if(Object.assign(b,{baseColorFactor:p||[1,1,1,1],metallicFactor:g===void 0?1:g,roughnessFactor:A===void 0?.5:A}),D){let U=D.extensions;if(U){let x=U.KHR_texture_transform;if(x){let C=new te(x.offset?x.offset[0]:0,x.offset?x.offset[1]:0,x.scale?x.scale[0]:1,x.scale?x.scale[1]:1);b.baseMapOffsetSize=C}}const v=await this.parseTexture(D.index);v?b.baseColorTexture=v:b.baseColorTexture=m.res.redTexture}if(i){let U=i.extensions;if(U){let x=U.KHR_texture_transform;if(x){let C=new te(x.offset?x.offset[0]:0,x.offset?x.offset[1]:0,x.scale?x.scale[0]:1,x.scale?x.scale[1]:1);b.normalMapOffsetSize=C}}const v=await this.parseTexture(i.index);v?b.normalTexture=v:b.normalTexture=m.res.normalTexture}if(_){let U=_.extensions;if(U){let x=U.KHR_texture_transform;if(x){let C=new te(x.offset?x.offset[0]:0,x.offset?x.offset[1]:0,x.scale?x.scale[0]:1,x.scale?x.scale[1]:1);b.roughnessMapOffsetSize=C}}const v=await this.parseTexture(_.index);v?b.metallicRoughnessTexture=v:b.metallicRoughnessTexture=m.res.blackTexture}}else Object.assign(b,{baseColorFactor:[1,1,1,1],metallicFactor:0,roughnessFactor:.5});if(b.baseColorFactor&&b.baseColorFactor[3]<1&&(c=c==="MASK"?"MASK":"BLEND"),c&&c!=="OPAQUE"&&(c==="MASK"&&(b.defines.push(Dt.getAlphaMaskDefine()),b.alphaCutoff=f===void 0?.5:f),c==="BLEND"&&(b.defines.push(Dt.getAlphaBlendDefine()),b.enableBlend=!0)),i){const p=await this.parseTexture(i.index);p?b.normalTexture=p:b.normalTexture=m.res.normalTexture}if(n){const p=await this.parseTexture(n.index);p&&(b.occlusionTexture=p)}if(l&&(b.emissiveFactor=l),o){const p=await this.parseTexture(o.index);p?b.emissiveTexture=p:b.emissiveTexture=m.res.blackTexture}return h&&(b.extensions=h),t.isParsed=!0,t.dmaterial=b,b}async parseTexture(e){return this.subParser.parseTexture(e)}errorMiss(e,t){throw new Error(e+t)}}class sf{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}parse(e){const t=this.gltf.skins[e];if(!t)return this.errorMiss("skin",e);if(t.isParsed)return t.dskin;const{name:a,joints:r,inverseBindMatrices:i,skeleton:n}=t;if(!r)return this.errorMiss("skin.joints",e);t.isParsed=!0,t.dskin=!1;let o={name:a,skeleton:null,inverseBindMatrices:null,joints:r,defines:[Dt.getJointsNumDefine(r.length)]};if(n)o.skeleton=n;else{var l=-1;for(let c=0;c<this.gltf.nodes.length;c++)if(this.gltf.nodes[c].name=="root"){l=c;break}if(l==-1){let c=this.gltf.scenes[this.gltf.scene];l=c.nodes[c.nodes.length-1]}o.skeleton=l}if(o.inverseBindMatrices=Yt.IDENTITY_INVERSE_BIND_MATRICES,i!==void 0){const c=this.parseAccessor(i);if(c){const f=c.data,d=[];for(let h=0;h<f.length;h+=16)d.push(f.slice(h,h+16));o.inverseBindMatrices=d}else o=null}return t.dskin=o,t.dskin}parseAccessor(e){return this.subParser.parseAccessor(e)}errorMiss(e,t){throw new Error(e+t)}}class nf{name="";index=0;instanceID="";parent=null;scale=new u;rotation=new j;translation=new u;constructor(e=""){this.name=e}}class Kn{index;worldMatrix;constructor(e,t=!1){this.index=e,this.worldMatrix=new E(!t)}}class Ui{time;_skeleton;_jointsPose;mJointMatrixIndexTable;constructor(e,t=!1){this._skeleton=e,this._jointsPose=new Array(e.numJoint),this.mJointMatrixIndexTable=new Array(e.numJoint);for(let a=0;a<e.numJoint;a++){let r=new Kn(a,t);this._jointsPose[a]=r,this.mJointMatrixIndexTable[a]=r.worldMatrix.index}}buildSkeletonPose(e){let t=new u,a=new j,r=new u,i=new Array(this._skeleton.numJoint);this.time=e[11]>0?e[11]:e[24];for(let n=0;n<this._skeleton.numJoint;n++){let o=12*n*4,l=new Float32Array(e.buffer,e.byteOffset+o,12),c=new E;t.set(l[0],l[1],l[2]),a.set(l[4],l[5],l[6],l[7]),r.set(l[8],l[9],l[10]),ps(a.getEulerAngles(),r,t,c),i[n]=c;let f=new Kn(n);const d=this._skeleton.getJointParentIndex(n);if(d<0)f.worldMatrix.copyFrom(c);else{let h=this._jointsPose[d];yc(h.worldMatrix,c,f.worldMatrix)}this._jointsPose[n]=f}}get numJoint(){return this._skeleton.numJoint}get joints(){return this._jointsPose}get jointMatrixIndexTable(){return this.mJointMatrixIndexTable}lerp(e,t,a){if(e&&t)for(let r=0;r<this._jointsPose.length;r++){let i=e._jointsPose[r],n=t._jointsPose[r];this._jointsPose[r].worldMatrix.lerp(i.worldMatrix,n.worldMatrix,a)}else for(let r=0;r<this._jointsPose.length;r++){let i=e._jointsPose[r];this._jointsPose[r].worldMatrix.copyFrom(i.worldMatrix)}}copyFrom(e){for(let t=0;t<this._jointsPose.length;t++)this._jointsPose[t].worldMatrix.copyFrom(e._jointsPose[t].worldMatrix)}reset(){for(let e=0;e<this._jointsPose.length;e++)this._jointsPose[e].worldMatrix.identity()}}class of extends $e{skeletonAnimation;constructor(e,t){super(),this.type=e,this.time=t}}class js{name="";_skeleton;_skeletonPoses;_animationClipData;_events;constructor(e,t,a,r){if(this.name=e,this._skeleton=t,this._animationClipData=r,a>0&&r){this._skeletonPoses=new Array(a);let i=12*t.numJoint;for(let n=0;n<a;n++){let o=i*n*4;const l=r.buffer instanceof ArrayBuffer?r.buffer:new Uint8Array(r.buffer).buffer;let c=new Float32Array(l,o,i),f=new Ui(t);f.buildSkeletonPose(c),this._skeletonPoses[n]=f}}}get totalTime(){return this._skeletonPoses[this._skeletonPoses.length-1].time}get frameRate(){return this.totalTime/this._skeletonPoses.length}get skeleton(){return this._skeleton}get numFrame(){return this._skeletonPoses.length-1}get animationClipData(){return this._animationClipData}getSkeletonPose(e){return this._skeletonPoses[e]}getLerpSkeletonPose(e,t,a,r){let i=this.getSkeletonPose(e),n=this.getSkeletonPose(t);return r.lerp(i,n,a),r}createSubClip(e,t,a){var r=new js(e,this._skeleton,0,null);const i=Math.max(Math.floor(t/this.frameRate),0),n=Math.min(Math.floor(a/this.frameRate),this._skeletonPoses.length-1);r._skeletonPoses=this._skeletonPoses.slice(i,n);const o=12*this._skeleton.numJoint*4,l=this._animationClipData.buffer instanceof ArrayBuffer?this._animationClipData.buffer:new Uint8Array(this._animationClipData.buffer).buffer;return this._animationClipData=new Float32Array(l,i*o,(n-i)*o),r}addEvent(e,t){this._events||(this._events=new Array),this._events.push(new of(e,t))}removeEvent(e){this._events&&(this._events=this._events.filter(t=>t.type!=e))}getEvents(){return this._events}}class qn{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}parse(e){let t=new Eo;return t.name="Id:"+e,t.count=0,t.boneData=[],t.boneMap=new Map,this.buildSkeleton(t,void 0,e),t}parseSkeletonAnimation(e,t){let a=new Jo;a.clipName=t.name,a.useSkeletonPos=!1,a.useSkeletonScale=!1;for(let r of t.channels){let i=t.samplers[r.sampler];const n=this.subParser.parseAccessor(i.input),o=this.subParser.parseAccessor(i.output);let l=r.target.node,c=r.target.path,f=this.gltf.nodes[l];if(!f||!e.boneMap.has(f.name))continue;let d=e.boneMap.get(f.name);switch(c){case"scale":{let h=new hr(o.numComponents);h.path="",h.attribute="",h.propertys=h.attribute.split("."),h.preInfinity=0,h.postInfinity=0,h.rotationOrder=0,a.useSkeletonScale=!0,a.scaleCurves.set(d.bonePath,h);for(let b=0;b<n.data.length;b++){const p=n.data[b],g=b*o.numComponents;let A=new Ji(0);A.time=p;const D=new u().set(o.data[g+0],o.data[g+1],o.data[g+2]);A.split(G.vector3,D,"value"),h.addKeyFrame(A)}}break;case"rotation":{let h=new hr(o.numComponents);h.path="",h.attribute="",h.propertys=h.attribute.split("."),h.preInfinity=0,h.postInfinity=0,h.rotationOrder=0,a.rotationCurves.set(d.bonePath,h);for(let b=0;b<n.data.length;b++){const p=n.data[b],g=b*o.numComponents;let A=new Ji(0);A.time=p;const D=new j().set(o.data[g+0],o.data[g+1],o.data[g+2],o.data[g+3]);A.split(G.quaternion,D,"value"),h.addKeyFrame(A)}}break;case"translation":{let h=new hr(o.numComponents);h.path="",h.attribute="",h.propertys=h.attribute.split("."),h.preInfinity=0,h.postInfinity=0,h.rotationOrder=0,a.useSkeletonPos=!0,a.positionCurves.set(d.bonePath,h);for(let b=0;b<n.data.length;b++){const p=n.data[b],g=b*o.numComponents;let A=new Ji(0);A.time=p;const D=new u().set(o.data[g+0],o.data[g+1],o.data[g+2]);A.split(G.vector3,D,"value"),h.addKeyFrame(A)}}break}}return a}parseSkeletonAnimationOld(e,t){let a=this.subParser.parseAccessor(t.samplers[0].input),r=a.data.length,i=a.data[1]-a.data[0];a.data[a.data.length-1];let n=12*e.numJoint,o=new Float32Array(n*r);for(var l=0;l<e.numJoint;l++)for(var c=0;c<r;c++){var f=n*c+12*l;o[f+0]=1,o[f+1]=1,o[f+2]=1,o[f+3]=1}for(let g of t.channels){let A=t.samplers[g.sampler];const D=this.subParser.parseAccessor(A.input),_=this.subParser.parseAccessor(A.output);let U=g.target.node,v=g.target.path,x=this.gltf.nodes[U];if(!x)continue;let C=e.getJointByName(x.name);if(C)switch(v){case"scale":if(r*_.numComponents==_.data.length)for(var c=0;c<r;c++){var d=c*_.numComponents,f=n*c+12*C.index;o[f+0]=_.data[d+0],o[f+1]=_.data[d+1],o[f+2]=_.data[d+2],o[f+3]=1}else if(D.data.length==2){let F=0;D.data[0];let w=D.data[1];var h=0*_.numComponents;u.HELP_0.set(_.data[h+0],_.data[h+1],_.data[h+2]);var b=1*_.numComponents;u.HELP_1.set(_.data[b+0],_.data[b+1],_.data[b+2]);for(var c=0;c<r;c++){let M=F/w;u.HELP_2.lerp(u.HELP_0,u.HELP_1,M);var f=n*c+12*C.index;o[f+0]=u.HELP_2.x,o[f+1]=u.HELP_2.y,o[f+2]=u.HELP_2.z,o[f+3]=1,F+=i}}else throw new Error("Unsupported animation sampler interpolation.");break;case"rotation":if(r*_.numComponents==_.data.length)for(var c=0;c<r;c++){var d=c*_.numComponents,f=n*c+12*C.index+4;o[f+0]=_.data[d+0],o[f+1]=_.data[d+1],o[f+2]=_.data[d+2],o[f+3]=_.data[d+3]}else if(D.data.length==2){let F=0;D.data[0];let w=D.data[1];var h=0*_.numComponents;u.HELP_0.set(_.data[h+0],_.data[h+1],_.data[h+2],_.data[h+3]);var b=1*_.numComponents;u.HELP_1.set(_.data[b+0],_.data[b+1],_.data[b+2],_.data[b+3]);for(var c=0;c<r;c++){let Q=F/w;u.HELP_2.lerp(u.HELP_0,u.HELP_1,Q);var f=n*c+12*C.index+4;o[f+0]=u.HELP_2.x,o[f+1]=u.HELP_2.y,o[f+2]=u.HELP_2.z,o[f+3]=u.HELP_2.w,F+=i}}else throw new Error("Unsupported animation sampler interpolation.");break;case"translation":if(r*_.numComponents==_.data.length)for(var c=0;c<r;c++){var d=c*_.numComponents,f=n*c+12*C.index+8;o[f+0]=_.data[d+0],o[f+1]=_.data[d+1],o[f+2]=_.data[d+2],o[f+3]=D.data[c*D.numComponents]}else if(D.data.length==2){let F=0;D.data[0];let w=D.data[1];var h=0*_.numComponents;u.HELP_0.set(_.data[h+0],_.data[h+1],_.data[h+2]);var b=1*_.numComponents;u.HELP_1.set(_.data[b+0],_.data[b+1],_.data[b+2]);for(var c=0;c<r;c++){let Q=F/w;u.HELP_2.lerp(u.HELP_0,u.HELP_1,Q);var f=n*c+12*C.index+8;o[f+0]=u.HELP_2.x,o[f+1]=u.HELP_2.y,o[f+2]=u.HELP_2.z,o[f+3]=F,F+=i}}else throw new Error("Unsupported animation sampler interpolation.");break}}return new js(t.name,e,r,o)}buildSkeleton(e,t,a){let r=this.gltf.nodes[a];r.name||(r.name="Bone"+e.count);let i=new ko;if(i.boneName=r.name,i.bonePath=t?t.bonePath+"/"+r.name:r.name,i.parentBoneName=t?t.boneName:"",i.boneID=e.count++,i.parentBoneID=t?t.boneID:-1,i.instanceID="",i.parentInstanceID="",i.s=new u(1,1,1),r.scale&&i.s.set(r.scale[0],r.scale[1],r.scale[2]),i.q=new j,r.rotation&&i.q.set(r.rotation[0],r.rotation[1],r.rotation[2],r.rotation[3]),i.t=new u,r.translation&&i.t.set(r.translation[0],r.translation[1],r.translation[2]),e.boneData.push(i),e.boneMap.set(i.boneName,i),r.children)for(let n of r.children)this.buildSkeleton(e,i,n)}buildSkeletonOld(e,t,a,r=0){let i=this.gltf.nodes[a];i.name||(i.name="Node_"+a);let n=new nf(i.name);if(n.parent=t,i.scale&&n.scale.set(i.scale[0],i.scale[1],i.scale[2]),i.rotation&&n.rotation.set(i.rotation[0],i.rotation[1],i.rotation[2],i.rotation[3]),i.translation&&n.translation.set(i.translation[0],i.translation[1],i.translation[2]),e.addJoint(n),i.children)for(let o of i.children)this.buildSkeletonOld(e,n,o,r+1)}}class $n{static list=[];static add(e){this.list.indexOf(e)==-1&&this.list.push(e)}static remove(e){let t=this.list.indexOf(e);t!=-1&&this.list.splice(t,1)}}class xi extends Pe{name;size=1;lightData;dirFix=1;bindOnChange;needUpdateShadow=!0;realTimeShadow=!0;_castGI=!1;_castShadow=!1;_iesProfiles;constructor(){super()}init(){this.transform.object3D.bound=new ge(new u,new u),this.lightData=new ms,this.lightData.lightMatrixIndex=this.transform.worldMatrix.index}onChange(){this.bindOnChange&&this.bindOnChange(),this.transform.object3D.bound.setFromCenterAndSize(this.transform.worldPosition,new u(this.size,this.size,this.size)),this._castGI&&(J.instance.state.giLightingChange=!0),this._castShadow?(this.needUpdateShadow=!0,It.addShadowLight(this)):It.removeShadowLight(this),this.transform.view3D&&m.renderJobs&&m.renderJobs.get(this.transform.view3D).reflectionRenderer&&m.renderJobs.get(this.transform.view3D).reflectionRenderer.forceUpdate()}start(){this.transform.onPositionChange=()=>this.onPositionChange(),this.transform.onRotationChange=()=>this.onRotChange(),this.onPositionChange(),this.onRotChange()}onPositionChange(){this.lightData.lightPosition.copyFrom(this.transform.worldPosition),this.onChange()}onRotChange(){this.dirFix==1?this.lightData.direction.copyFrom(this.transform.forward):this.lightData.direction.copyFrom(this.transform.back),this.lightData.lightTangent.copyFrom(this.transform.up),this.onChange()}onScaleChange(){this.onChange()}onEnable(){this.onChange(),J.instance.addLight(this.transform.scene3D,this)}onDisable(){this.onChange(),J.instance.removeLight(this.transform.scene3D,this),It.removeShadowLight(this)}set iesProfiles(e){this._iesProfiles=e,this.lightData.iesIndex=e.index,ba.use=!0,this.onChange()}get iesProfile(){return this._iesProfiles}get r(){return this.lightData.lightColor.r}set r(e){this.lightData.lightColor.r=e,this.onChange()}get g(){return this.lightData.lightColor.g}set g(e){this.lightData.lightColor.g=e,this.onChange()}get b(){return this.lightData.lightColor.b}set b(e){this.lightData.lightColor.b=e,this.onChange()}get lightColor(){return this.lightData.lightColor}set lightColor(e){this.lightData.lightColor=e,this.onChange()}get color(){return this.lightData.lightColor}set color(e){this.lightData.lightColor=e,this.onChange()}get intensity(){return this.lightData.intensity}set intensity(e){this.lightData.intensity=e,this.onChange()}set castShadow(e){e!=this._castShadow&&(this._castShadow=e,this.onChange())}get castShadow(){return this._castShadow}get shadowIndex(){return this.lightData.castShadowIndex}get castGI(){return this._castGI}set castGI(e){e?$n.add(this):$n.remove(this),this._castGI=e,e&&this.onChange()}get direction(){return this.lightData.direction}destroy(e){this.bindOnChange=null,J.instance.removeLight(this.transform.scene3D,this),It.removeShadowLight(this),this.transform.eventDispatcher.removeEventListener(Qt.ROTATION_ONCHANGE,this.onRotChange,this),this.transform.eventDispatcher.removeEventListener(Qt.SCALE_ONCHANGE,this.onScaleChange,this),super.destroy(e)}}var X2=Object.getOwnPropertyDescriptor,H2=(s,e,t,a)=>{for(var r=a>1?void 0:a?X2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let yi=class extends xi{shadowCamera;constructor(){super()}init(){super.init(),this.object3D.name==""&&(this.object3D.name="DirectionLight_"+Et()),this.radius=Number.MAX_SAFE_INTEGER,this.lightData.lightType=Xe.DirectionLight,this.lightData.linear=0,this.lightData.quadratic=.3}start(){super.start(),this.castGI=!0}get radius(){return this.lightData.range}set radius(s){this.lightData.range=s,this.onChange()}get indirect(){return this.lightData.quadratic}set indirect(s){this.lightData.quadratic=s,this.onChange()}debug(){}};yi=H2([Vt(yi,"DirectLight")],yi);var K2=Object.getOwnPropertyDescriptor,q2=(s,e,t,a)=>{for(var r=a>1?void 0:a?K2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ai=class extends xi{constructor(){super()}init(){super.init(),this.lightData.lightType=Xe.PointLight,this.object3D.name==""&&(this.object3D.name="PointLight"+Et())}get range(){return this.lightData.range}set range(s){this.lightData.range=s,this.onChange()}get at(){return this.lightData.linear}set at(s){this.lightData.linear=s,this.onChange()}get radius(){return this.lightData.radius}set radius(s){this.lightData.radius=s,this.onChange()}get quadratic(){return this.lightData.quadratic}set quadratic(s){this.lightData.quadratic=s,this.onChange()}start(){this.transform.rotationX=90,super.start()}onUpdate(){}onGraphic(s){}debug(){}debugDraw(s){}};ai=q2([Vt(ai,"PointLight")],ai);var $2=Object.getOwnPropertyDescriptor,eb=(s,e,t,a)=>{for(var r=a>1?void 0:a?$2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ci=class extends xi{constructor(){super()}init(){super.init(),this.lightData.lightType=Xe.SpotLight,this.object3D.name==""&&(this.object3D.name="SpotLight"+Et())}get innerAngle(){return this.lightData.innerAngle/this.lightData.outerAngle*100}set innerAngle(s){this.lightData.innerAngle=se(s,0,100)/100*this.lightData.outerAngle,this.onChange()}get outerAngle(){return this.lightData.outerAngle*Xr*2}set outerAngle(s){this.lightData.outerAngle=se(s,1,179)*rt*.5,this.onChange()}get radius(){return this.lightData.radius}set radius(s){this.lightData.radius=s,this.onChange()}get range(){return this.lightData.range}set range(s){this.lightData.range=s,this.onChange()}get at(){return this.lightData.linear}set at(s){this.lightData.linear=s,this.onChange()}start(){super.start(),this.lightData.lightType=Xe.SpotLight}onUpdate(){}onGraphic(s){}debug(){}debugDraw(s){}};Ci=eb([Vt(Ci,"SpotLight")],Ci);class lf{static apply(e,t,a){let r=t.extensions;if(r&&r.KHR_materials_clearcoat){a.shader.getDefaultColorShader().setDefine("USE_CLEARCOAT",!0);let i=r.KHR_materials_clearcoat;"clearcoatFactor"in i&&(t.clearcoatFactor=i.clearcoatFactor,a.clearcoatFactor=t.clearcoatFactor),"clearcoatRoughnessFactor"in i&&(t.clearcoatRoughnessFactor=i.clearcoatRoughnessFactor,a.clearcoatRoughnessFactor=t.clearcoatRoughnessFactor)}}}class cf{static apply(e,t,a){let r=t.extensions;r&&r.KHR_materials_emissive_strength?(a.emissiveIntensity=r.KHR_materials_emissive_strength.emissiveStrength,a.emissiveMap==m.res.blackTexture&&(a.emissiveMap=m.res.whiteTexture)):a.emissiveIntensity=1}}class ff{static apply(e,t,a){let r=t.extensions;r&&r.KHR_materials_unlit?a.supportLight=!1:a.supportLight=!0}}class df{gltf;subParser;_testCount=8;_hasCastShadow=!1;constructor(e){this.gltf=e.gltf,this.subParser=e}async convertNodeToObject3D(e,t){const a=new ee;if(a.name=e.name,a[Yt.GLTF_NODE_INDEX_PROPERTY]=e.nodeId,e.nodeObj=a,e.matrix&&(e.translation=[0,0,0],e.rotation=[0,0,0,1],e.scale=[1,1,1]),e.translation&&(a.transform.x=e.translation[0],a.transform.y=e.translation[1],a.transform.z=e.translation[2]),e.rotation){let r=new j;r.setFromArray(e.rotation),a.transform.localRotQuat=r}return e.scale&&(a.transform.scaleX=e.scale[0],a.transform.scaleY=e.scale[1],a.transform.scaleZ=e.scale[2]),t.addChild(a),e.light&&this.convertLight(e,a),e.primitives&&this.convertprimitives(e,a),e.skeleton&&this.convertSkeletonAnim(a,e.skeleton),a}convertSkeletonAnim(e,t){let a=this.subParser.parseSkeleton(t.skeleton);m.res.addObj(a.name,a);let r=[];for(let n=0;n<this.gltf.animations.length;n++){let o=this.gltf.animations[n];o.name||(o.name=n.toString());let l=this.subParser.parseSkeletonAnimation(a,o);r.push(l)}let i=e.addComponent(Pa);i.avatar=a.name,i.clips=r}convertLight(e,t){switch(e.light.type){case"directional":let a=t.addComponent(yi);t.name=e.light.name,a.intensity=e.light.intensity*.1,a.radius=Number.MAX_SAFE_INTEGER,a.dirFix=-1,this._hasCastShadow||(this._hasCastShadow=!0,a.castShadow=this._hasCastShadow),a.lightColor=e.light.color?new P(e.light.color[0],e.light.color[1],e.light.color[2]):new P(1,1,1,1),a.debug();break;case"point":if(this._testCount>0){let i=t.addComponent(ai);i.name=e.light.name,i.intensity=e.light.intensity?e.light.intensity*8*2:1,i.radius=8,i.at=2,i.range=e.light.range?e.light.range:8,i.lightColor=e.light.color?new P(e.light.color[0],e.light.color[1],e.light.color[2]):new P(1,1,1,1)}this._testCount--;break;case"spot":let r=t.addComponent(Ci);r.name=e.light.name,r.intensity=e.light.intensity*5,r.radius=1,r.dirFix=-1,r.at=2,r.range=e.light.range?e.light.range:8,r.outerAngle=e.light.spot.outerConeAngle*Xr,r.lightColor=e.light.color?new P(e.light.color[0],e.light.color[1],e.light.color[2]):new P(1,1,1,1);break}}convertprimitives(e,t){for(let a=0;a<e.primitives.length;a++){const r=e.primitives[a];r.modelName;let i=r.material;i.name==null&&(i.name=Et());let n,o=`matkey_${i.name}`;if(i&&this.gltf.resources[o])n=this.gltf.resources[o];else{let b=i;const p=b?.extensions?.KHR_materials_unlit!==void 0;let g=p?new nt:new ka;if(n=g,this.gltf.resources[o]=g,g.name=i.name,b){const{baseColorTexture:A,baseColorFactor:D,metallicFactor:_,roughnessFactor:U,doubleSided:v,metallicRoughnessTexture:x,normalTexture:C,occlusionTexture:F,emissiveTexture:w,emissiveFactor:S,enableBlend:M,alphaCutoff:T}=b;let Q=g=this.applyMaterialExtensions(b,g);if(p){const L=Q;L.baseColor=new P(D[0],D[1],D[2],D[3]),A&&(L.baseMap=A),Q.doubleSide=v,"enableBlend"in b&&(b.enableBlend?(b.defines?.includes("ALPHA_BLEND")?Q.blendMode=ae.ALPHA:Q.blendMode=ae.NORMAL,Q.castShadow=!1):Q.blendMode=ae.NONE),"alphaCutoff"in b&&T>0&&T<1&&(Q.setUniformFloat("alphaCutoff",T),Q.blendMode=ae.NORMAL,Q.transparent=!0)}else if("enableBlend"in b&&(b.enableBlend?(b.defines?.includes("ALPHA_BLEND")?Q.blendMode=ae.ALPHA:Q.blendMode=ae.NORMAL,Q.castShadow=!1):Q.blendMode=ae.NONE),"alphaCutoff"in b&&T>0&&T<1&&(Q.setUniformFloat("alphaCutoff",T),Q.blendMode=ae.NORMAL,Q.transparent=!0),b.baseMapOffsetSize&&Q.setUniformVector4("baseMapOffsetSize",b.baseMapOffsetSize),b.normalMapOffsetSize&&Q.setUniformVector4("normalMapOffsetSize",b.normalMapOffsetSize),b.emissiveMapOffsetSize&&Q.setUniformVector4("emissiveMapOffsetSize",b.emissiveMapOffsetSize),b.roughnessMapOffsetSize&&Q.setUniformVector4("roughnessMapOffsetSize",b.roughnessMapOffsetSize),b.metallicMapOffsetSize&&Q.setUniformVector4("metallicMapOffsetSize",b.metallicMapOffsetSize),b.aoMapOffsetSize&&Q.setUniformVector4("aoMapOffsetSize",b.aoMapOffsetSize),Q.setUniformColor("baseColor",new P(D[0],D[1],D[2],D[3])),Q.setUniformFloat("roughness",U??1),Q.setUniformFloat("metallic",_??0),Q.setUniformFloat("ao",1),Q.doubleSide=v,A&&Q.setTexture("baseMap",A),C&&Q.setTexture("normalMap",C),x?(Q.setTexture("maskMap",x),Q.shader.setDefine("USE_ROUGHNESS_G",!0),Q.shader.setDefine("USE_METALLIC_B",!0)):(Q.shader.setDefine("USE_ROUGHNESS_G",!1),Q.shader.setDefine("USE_METALLIC_B",!1)),w&&Q.setTexture("emissiveMap",w),S&&(S[0]>0||S[1]>0||S[2]>0)){Q.shader.getTexture("emissiveMap")||Q.shader.setTexture("emissiveMap",m.res.whiteTexture),Q.shader.setDefine("USE_EMISSIVEMAP",!0),Q.setUniformColor("emissiveColor",new P(S[0],S[1],S[2],S[3])),Q.blendMode!=ae.NONE&&(Q.blendMode=ae.ADD);let L=n.getUniformFloat("emissiveIntensity");(!L||L<=0)&&n.setUniformFloat("emissiveIntensity",1)}}}const{attribArrays:l,modelName:c,drawMode:f}=r;let d;if(!l.indices.data){let b=[],p=l.position.data.length/3/3;for(let g=0;g<p;g++){let A=g*3;b.push(A+2),b.push(A+0),b.push(A+1)}l.indices={data:new Uint8Array(b),normalize:!1,numComponents:1}}let h=!l.normal;if(h){let b=[],p=l.position.data.length/3;for(let g=0;g<p;g++)b.push(0),b.push(0),b.push(0);l.normal={data:new Float32Array(b),normalize:!1,numComponents:3}}if(l.indices.data&&l.indices.data.length>3){let b=r.meshName();this.gltf.resources[b]&&(d=this.gltf.resources[b]);const p=new ee;if(p.name=c+a,this.gltf.animations&&l[V.joints0]!=null){d||=this.createGeometryBase(c,l,r,e.skin),this.gltf.resources[b]=d,h&&l.indices?.data&&l.indices.data.length>0&&d.computeNormals();let g=this.gltf.nodes[e.skin.skeleton];g.dnode&&g.dnode.nodeObj?this.convertSkeletonAnim(t,e.skin):g.dnode.skeleton=e.skin;let A=p.addComponent(lr);A.geometry=d,A.material=n}else{d||=this.createGeometryBase(c,l,r),this.gltf.resources[b]=d,h&&l.indices?.data&&l.indices.data.length>0&&d.computeNormals(),d.hasAttribute(V.joints0)&&d.vertexAttributeMap.delete(V.joints0);let g=p.addComponent($);g.castShadow=!0,g.castGI=!0,g.geometry=d,g.material=n}e.skin&&e.skin.defines,t.addChild(p)}}}createGeometryBase(e,t,a,r){"indices"in t&&(t.indices.data.length>65534?t.indices.data=new Uint32Array(t.indices.data):t.indices.data=new Uint16Array(t.indices.data));let i=new Ee;if(i.name=e,"indices"in t&&(t.indices.data.length>65535?t.indices.data=new Uint32Array(t.indices.data):t.indices.data=new Uint16Array(t.indices.data)),a.morphTargetsRelative){let l=new Io,c=a.targetNames;if(c&&c.length>0){l.shapeNames=[],l.shapeIndexs=[];for(let f=0;f<c.length;f++)l.shapeNames.push(c[f]),l.shapeIndexs.push(f)}l.vertexCount=t.position.data.length/3,l.blendCount=l.shapeNames.length,l.blendShapePropertyDatas=[],l.blendShapeMap=new Map;for(let f=0;f<l.blendCount;f++){let d=new Ro;d.shapeName=l.shapeNames[f],d.shapeIndex=l.shapeIndexs[f],d.frameCount=1,d.blendPositionList=t[Yt.MORPH_POSITION_PREFIX+f].data,d.blendNormalList=t[Yt.MORPH_NORMAL_PREFIX+f].data,l.blendShapePropertyDatas.push(d),l.blendShapeMap.set(d.shapeName,d)}i.blendShapeData=l}i.morphTargetsRelative=a.morphTargetsRelative;let n=a.targetNames;if(n&&n.length>0){let l=i.morphTargetDictionary={};for(let c=0;c<n.length;c++)l[n[c]]=c}if(i.morphTargetDictionary){let l=t.position.data.length/3,c=new Float32Array(l);for(let f=0;f<l;f++)c[f]=f;t.vIndex={data:c,normalize:!1,numComponents:1}}for(const l in t){let c=t[l];i.setAttribute(l,c.data)}if(r){i.skinNames=new Array(r.joints.length);for(let l=0;l<r.joints.length;l++){const c=r.joints[l],f=this.gltf.nodes[c];i.skinNames[l]=f.name}i.bindPose=new Array(r.inverseBindMatrices.length);for(let l=0;l<r.inverseBindMatrices.length;l++){const c=r.inverseBindMatrices[l];let f=new E;f.rawData.set(c),i.bindPose[l]=f}}let o=i.getAttribute(V.indices);return i.addSubGeometry({indexStart:0,indexCount:o.data.length,vertexStart:0,index:0,vertexCount:0,firstStart:0,topology:0}),i}applyMaterialExtensions(e,t){return e.extensions&&(lf.apply(this.gltf,e,t),ff.apply(this.gltf,e,t),cf.apply(this.gltf,e,t)),t}parseSkinJoints(e){let t=[];for(let a of e.joints){let r=this.gltf.nodes[a];t.push(r.name)}return t}}class vs{currentSceneName;gltf;initUrl;_generator;_version;_BASE64_MARKER=";base64,";_cameraParser=null;_meshParser=null;_materialParser=null;_skinParser=null;_skeletonParser=null;_converter=null;constructor(){}get version(){return this.version?this.version:this.gltf?this.gltf.asset?(this._version=this.gltf.asset.version,this.gltf.asset.minVersion&&(this._version+=`\r minVersion${this.gltf.asset.minVersion}`),this.version):this.errorMiss("asset"):(console.warn("glTF not loaded."),null)}async parse(e,t,a){this.gltf=t,this.initUrl=e;const{version:r,generator:i}=this.gltf.asset;if(this._generator=i,r!=="2.0")return console.error(`GLTFParser only support glTF 2.0 for now! Received glTF version: ${this.version}`),!1;const n={nodes:await this.parseScene(a),animations:this.parseAnimations(),name:this.currentSceneName};return await this.convertToNode(n)}destroy(){Hn.unload(this.gltf),this.gltf=null}async parseScene(e){const t=e||this.gltf.scene||0,a=this.gltf.scenes[t];if(typeof a>"u")return this.errorMiss("scene",t);this.currentSceneName=a.name||"GLTF_NO_NAME_SCENE";const r=[],i=a.nodes;for(let n=0;n<i.length;n++){const o=await this.parseNode(i[n]);o&&r.push(o)}return r}async parseNode(e){const t=this.gltf.nodes[e];if(!t)return this.errorMiss("node",e);if(t.isParsed)return t.dnode;const{name:a,matrix:r,translation:i,rotation:n,scale:o}=t,l={name:a,matrix:r,translation:i,rotation:n,scale:o,nodeId:e,camera:null,primitives:null,skin:null,children:null,light:null};if(t.camera!==void 0&&(l.camera=this.parseCamera(t.camera)),t.mesh!==void 0&&(l.primitives=await this.parseMesh(t.mesh)),t.extensions!==void 0&&this.applyNodeExtensions(t,l),t.skin!==void 0){const c=this.parseSkin(t.skin);c&&(l.skin=c)}if(l.children=[],t.children)for(let c=0;c<t.children.length;c++)l.children.push(await this.parseNode(t.children[c]));return t.dnode=l,t.isParsed=!0,t.dnode}errorMiss(e,t){throw new Error(e+t)}parseCamera(e){return this._cameraParser||(this._cameraParser=new tf(this.gltf)),this._cameraParser.parse(e)}async parseMesh(e){return this._meshParser||(this._meshParser=new af(this)),this._meshParser.parse(e)}async parseTexture(e){let t=this.gltf.textures[e];if(t&&!t.dtexture){if(t&&t.source!=null){let a=this.gltf.images[t.source];if(a.uri){let r=a.uri;r=Ct.getURLName(r),t.dtexture=this.gltf.resources[r]}else if(a.bufferView){let r=this.parseBufferView(a.bufferView),i=new Va,n=new Blob([r],{type:a.mimeType});await i.loadFromBlob(n),t.dtexture=i}else t.dtexture=this.gltf.resources[a.name]}else if(t.name){let a=Ct.getURLName(t.name);t.dtexture=this.gltf.resources[a]}}return t.dtexture||console.log("miss texture , please check texture!",e,t),t.dtexture}async parseMaterial(e){return this._materialParser||(this._materialParser=new rf(this)),this._materialParser.parse(e)}parseAnimations(){return[]}async parseObject3D(e,t){return this._converter||(this._converter=new df(this)),this._converter.convertNodeToObject3D(e,t)}parseSkeleton(e){return this._skeletonParser||(this._skeletonParser=new qn(this)),this._skeletonParser.parse(e)}parseSkeletonAnimation(e,t){return this._skeletonParser||(this._skeletonParser=new qn(this)),this._skeletonParser.parseSkeletonAnimation(e,t)}async traverse(e,t){for(let a=0;a<t.length;a++){const r=await this.parseObject3D(t[a],e);await this.traverse(r,t[a].children)}}async convertToNode(e){const t=new ee;t.name=e.name;const a=e.nodes;e.animations;const r=[],i=[];return await this.traverse(t,a),{rootNode:t,textures:r,animations:void 0,cameras:i}}parseSkin(e){return this._skinParser||(this._skinParser=new sf(this)),this._skinParser.parse(e)}parseAccessor(e){const t=this.gltf.accessors[e];if(!t)return this.errorMiss("accessor",e);if(t.isParsed)return t.daccessor;t.isParsed=!0,t.daccessor=!1;const a=!!t.normalized,r=this.gltf.bufferViews[t.bufferView],i=r&&r.byteStride,n=Xn(t.componentType);let o=1;switch(t.type){case"SCALAR":o=1;break;case"VEC2":o=2;break;case"VEC3":o=3;break;case"VEC4":case"MAT2":o=4;break;case"MAT3":o=9;break;case"MAT4":o=16;break;default:o=0;break}if(o===0)return console.error(`glTF has unknown data type in accessor: ${t.type}`),!1;const l=o*n.BYTES_PER_ELEMENT;let c;if(r!==void 0){if(c=this.parseBufferView(t.bufferView),!c)return t.daccessor}else c=new Uint8Array(l*t.count).buffer;let f=this.getTypedArrayFromArrayBuffer(c,i,t.byteOffset||0,n,o,t.count);if(t.sparse){const{count:d,indices:h,values:b}=t.sparse;f=new n(f);const p=h.byteOffset||0,g=this.gltf.bufferViews[h.bufferView],A=Xn(h.componentType),D=this.parseBufferView(h.bufferView),_=this.getTypedArrayFromArrayBuffer(D,g.byteStride,p,A,1,d),U=b.byteOffset||0,v=this.gltf.bufferViews[b.bufferView],x=this.parseBufferView(b.bufferView),C=this.getTypedArrayFromArrayBuffer(x,v.byteStride,U,n,o,d);for(let F=0;F<_.length;F++)f.set(C.slice(F*o,F*o+o),_[F]*o)}return t.computeResult={typedArray:f,arrayType:n,numComponents:o},t.daccessor={data:f,numComponents:o,normalize:a},t.daccessor}getTypedArrayFromArrayBuffer(e,t,a,r,i,n){let o;const l=i*r.BYTES_PER_ELEMENT;if(t&&l!==t){const c=i*n;o=new r(c);for(let f=0;f<n;f++){const d=new r(e,a+f*t,i);for(let h=0;h<i;h++)o[f*i+h]=d[h]}}else o=new r(e,a,n*i);return o}parseBufferView(e){const t=this.gltf.bufferViews[e];if(!t)return this.errorMiss("bufferView",e);if(t.isParsed)return t.dbufferView;t.isParsed=!0,t.dbufferView=!1;const a=this.parseBuffer(t.buffer);if(a){const{byteOffset:r,byteLength:i}=t,n=new Uint8Array(a,r||0,i);t.dbufferView=new Uint8Array(n).buffer}return t.dbufferView}parseBuffer(e){const t=this.gltf.buffers[e];if(!t)return this.errorMiss("buffer",e);if(t.isParsed)return t.dbuffer;if(t.isParsed=!0,t.dbuffer=!1,t.uri.substring(0,5)!=="data:"){const a=t.uri,r=this.gltf.resources[a];r?r.byteLength===t.byteLength?t.dbuffer=this.gltf.resources[a]:console.error(`load gltf resource "${a}" at buffers[${e} failed, ArrayBuffer.byteLength not equals buffer's byteLength]`):console.error(`load gltf resource "${a}" at buffers[${e}] failed`)}else{const a=t.uri.indexOf(this._BASE64_MARKER)+this._BASE64_MARKER.length,r=window.atob(t.uri.substring(a)),i=new Uint8Array(r.length);for(let n=0;n<r.length;n++)i[n]=r.charCodeAt(n);t.dbuffer=i.buffer}return t.dbuffer}getLight(e){return this.gltf.extensions.KHR_lights_punctual.lights[e]}applyNodeExtensions(e,t){let a=e.extensions;a.KHR_lights_punctual&&this.gltf.extensions.KHR_lights_punctual&&(t.light=this.getLight(a.KHR_lights_punctual.light))}}class hf{magic;version;length}class uf{chunkLength;chunkType;chunkData}class eo extends st{static format=ze.BIN;_gltf;async parseBuffer(e){let t=new Uint8Array(e);t.pos=0;const a=this.parseHeader(t);if(a.magic!=1179937895)return console.error("invalid GLB file"),!1;if(a.version!==2)return console.error(`GLBParser only support glTF 2.0 for now! Received glTF version: ${a.version}`),!1;let r=[];for(;t.pos<t.length;){let d=this.parseChunk(t);r.push(d)}if(r[0].chunkType!=1313821514)return console.error("invalid GLBChunk"),!1;let i="",n=65535,o=r[0].chunkData;for(let d=0;d<o.length;d+=n){let h=o.length-d;h=Math.min(h,n);let b=o.subarray(d,d+h);i+=String.fromCharCode(...b)}let l=JSON.parse(i);this._gltf=new Bs,this._gltf={...this._gltf,...l},this._gltf.resources={};for(let d=0;d<this._gltf.buffers.length;d++){let h=this._gltf.buffers[d];h.isParsed=!0,h.dbuffer=r[d+1].chunkData.buffer}if(this._gltf.images)for(let d=0;d<this._gltf.images.length;d++){let h=this._gltf.images[d];h.name=h.name||"bufferView_"+h.bufferView.toString();const b=this._gltf.bufferViews[h.bufferView],p=this._gltf.buffers[b.buffer];let g=new Uint8Array(p.dbuffer,b.byteOffset,b.byteLength),A=new Blob([g],{type:h.mimeType}),D=new Va;await D.loadFromBlob(A),D.name=h.name,this._gltf.resources[h.name]=D}let f=await new vs().parse(this.initUrl,this._gltf,this._gltf.scene);return f?(this.data=f.rootNode,f.rootNode):null}async parseJsonAndBuffer(e,t){this._gltf=new Bs,this._gltf={...this._gltf,...e},this._gltf.resources={};let a=this._gltf.buffers[0];if(a.isParsed=!0,a.dbuffer=t,this._gltf.images)for(let n=0;n<this._gltf.images.length;n++){let o=this._gltf.images[n];o.name=o.name||"bufferView_"+o.bufferView.toString();const l=this._gltf.bufferViews[o.bufferView],c=this._gltf.buffers[l.buffer];let f=new Uint8Array(c.dbuffer,l.byteOffset,l.byteLength),d=new Blob([f],{type:o.mimeType}),h=new Va;await h.loadFromBlob(d),h.name=o.name,this._gltf.resources[o.name]=h}let i=await new vs().parse(this.initUrl,this._gltf,this._gltf.scene);return i?(this.data=i.rootNode,i.rootNode):null}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}parseHeader(e){let t=e.pos,a=new hf,r=new Uint32Array(e.buffer,t,3);return e.pos+=r.byteLength,a.magic=r[0],a.version=r[1],a.length=r[2],a}parseChunk(e){let t=e.pos,a=new uf,r=new Uint32Array(e.buffer,t,2);t=e.pos+=r.byteLength,a.chunkLength=r[0],a.chunkType=r[1],a.chunkData=new Uint8Array(e.buffer,t,a.chunkLength);const i=new Uint8Array(a.chunkLength);for(let n=0;n<a.chunkLength;n++)i[n]=a.chunkData[n];return a.chunkData=i,e.pos+=a.chunkLength,a}}class bf extends ot{constructor(){super();let e=new Ve("PBRLItShader","PBRLItShader");e.setShaderEntry("VertMain","FragMain"),e.passType=H.COLOR,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.setUniformColor("baseColor",new P(.75,.75,.75,1)),this.setUniformColor("emissiveColor",new P(0,0,0)),this.setUniformVector4("materialF0",new te(.04,.04,.04,1)),this.setUniformColor("specularColor",new P(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",1),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 P(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformFloat("clearcoatIor",1.5),this.setUniformVector4("baseMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("normalMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("emissiveMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("roughnessMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("metallicMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("aoMapOffsetSize",new te(0,0,1,1)),this.baseMap=m.res.whiteTexture,this.normalMap=m.res.normalTexture,this.maskMap=m.res.maskTexture}get baseMap(){return this.getDefaultColorShader().getTexture("baseMap")}set baseMap(e){this.getDefaultColorShader().setTexture("baseMap",e)}get baseColor(){return this.getDefaultColorShader().getUniform("baseColor")}set baseColor(e){this.getDefaultColorShader().setUniformColor("baseColor",e)}get normalMap(){return this.getDefaultColorShader().getTexture("normalMap")}set normalMap(e){this.getDefaultColorShader().setTexture("normalMap",e)}get doubleSide(){return this.getDefaultColorShader().doubleSide}set doubleSide(e){this.getDefaultColorShader().doubleSide=e}get alphaCutoff(){return this.getDefaultColorShader().shaderState.alphaCutoff}set alphaCutoff(e){this.getDefaultColorShader().setDefine("USE_ALPHACUT",!0),this.getDefaultColorShader().shaderState.alphaCutoff=e,this.getDefaultColorShader().setUniform("alphaCutoff",e)}get emissiveColor(){return this.getDefaultColorShader().getUniform("emissiveColor")}set emissiveColor(e){this.getDefaultColorShader().setUniform("emissiveColor",e)}get emissiveIntensity(){return this.getDefaultColorShader().getUniform("emissiveIntensity")}set emissiveIntensity(e){this.getDefaultColorShader().setUniform("emissiveIntensity",e)}get transformUV1(){return this.getDefaultColorShader().uniforms.transformUV1.vector4}set transformUV1(e){this.getDefaultColorShader().setUniform("transformUV1",e)}get uvTransform_2(){return this.getDefaultColorShader().uniforms.transformUV2.vector4}set uvTransform_2(e){this.getDefaultColorShader().setUniform("transformUV2",e)}get depthWriteEnabled(){return this.getDefaultColorShader().shaderState.depthWriteEnabled}set depthWriteEnabled(e){this.getDefaultColorShader().shaderState.depthWriteEnabled=e}get materialF0(){return this.getDefaultColorShader().uniforms.materialF0.vector4}set materialF0(e){this.getDefaultColorShader().setUniform("materialF0",e)}get specularColor(){return this.getDefaultColorShader().uniforms.specularColor.color}set specularColor(e){this.getDefaultColorShader().setUniform("specularColor",e)}get roughness(){return this.getDefaultColorShader().uniforms.roughness.value}set roughness(e){this.getDefaultColorShader().setUniform("roughness",e)}get metallic(){return this.getDefaultColorShader().uniforms.metallic.value}set metallic(e){this.getDefaultColorShader().setUniform("metallic",e)}get ao(){return this.getDefaultColorShader().uniforms.ao.value}set ao(e){this.getDefaultColorShader().setUniform("ao",e)}get metallic_min(){return this.getDefaultColorShader().uniforms.metallic_min.value}set metallic_min(e){this.getDefaultColorShader().setUniform("metallic_min",e)}get metallic_max(){return this.getDefaultColorShader().uniforms.metallic_max.value}set metallic_max(e){this.getDefaultColorShader().setUniform("metallic_max",e)}get roughness_min(){return this.getDefaultColorShader().uniforms.roughness_min.value}set roughness_min(e){this.getDefaultColorShader().setUniform("roughness_min",e)}get roughness_max(){return this.getDefaultColorShader().uniforms.roughness_max.value}set roughness_max(e){this.getDefaultColorShader().setUniform("roughness_max",e)}get normalScale(){return this.getDefaultColorShader().uniforms.normalScale.value}set normalScale(e){this.getDefaultColorShader().setUniform("normalScale",e)}get maskMap(){return this.getDefaultColorShader().textures.maskMap}set maskMap(e){this.getDefaultColorShader().setDefine("USE_MR",!0),this.getDefaultColorShader().setTexture("maskMap",e)}set aoMap(e){e&&(this.getDefaultColorShader().setTexture("aoMap",e),e!=m.res.whiteTexture&&this.getDefaultColorShader().setDefine("USE_AOTEX",!0))}get aoMap(){return this.getDefaultColorShader().textures.aoMap}set clearCoatRoughnessMap(e){e&&(console.log("USE_CLEARCOAT_ROUGHNESS"),this.getDefaultColorShader().setTexture("clearCoatRoughnessMap",e),this.getDefaultColorShader().setDefine("USE_CLEARCOAT_ROUGHNESS",!0))}get clearCoatRoughnessMap(){return this.getDefaultColorShader().textures.clearCoatRoughnessMap}get brdfLUT(){return this.getDefaultColorShader().textures.brdfLUT}set brdfLUT(e){this.getDefaultColorShader().setTexture("brdfLUT",e),this.getDefaultColorShader().setTexture("brdflutMap",e)}get emissiveMap(){return this.getDefaultColorShader().textures.emissiveMap}set emissiveMap(e){this.getDefaultColorShader().setTexture("emissiveMap",e)}set envIntensity(e){this.getDefaultColorShader().setUniformFloat("envIntensity",e)}get envIntensity(){return this.getDefaultColorShader().uniforms.envIntensity.value}set ior(e){this.getDefaultColorShader().setUniformFloat("ior",e)}get ior(){return this.getDefaultColorShader().uniforms.ior.value}useCleanCoat(){this.getDefaultColorShader().setDefine("USE_CLEARCOAT",!0)}set clearcoatFactor(e){this.getDefaultColorShader().setUniformFloat("clearcoatFactor",e),this.useCleanCoat()}get clearcoatFactor(){return this.getDefaultColorShader().uniforms.clearcoatFactor.value}set clearcoatRoughnessFactor(e){this.getDefaultColorShader().setUniformFloat("clearcoatRoughnessFactor",e),this.useCleanCoat()}get clearcoatRoughnessFactor(){return this.getDefaultColorShader().uniforms.clearcoatRoughnessFactor.value}set clearcoatWeight(e){this.getDefaultColorShader().setUniformFloat("clearcoatWeight",e),this.useCleanCoat()}get clearcoatWeight(){return this.getDefaultColorShader().uniforms.clearcoatWeight.value}set clearcoatColor(e){this.getDefaultColorShader().setUniformColor("clearcoatColor",e),this.useCleanCoat()}get clearcoatColor(){return this.getDefaultColorShader().uniforms.clearcoatColor.color}}class ka extends mt{constructor(){super();let e=new bf;this.shader=e}clone(){let e=new ka,t=e.shader.getDefaultColorShader(),a=this.shader.getDefaultColorShader();return t.defineValue={...a.defineValue},t.setUniform("shadowBias",a.getUniform("shadowBias")),t.setUniform("baseColor",a.getUniform("baseColor")),t.setUniform("specularColor",a.getUniform("specularColor")),t.setUniform("emissiveColor",a.getUniform("emissiveColor")),t.setUniform("materialF0",a.getUniform("materialF0")),t.setUniform("envIntensity",a.getUniform("envIntensity")),t.setUniform("normalScale",a.getUniform("normalScale")),t.setUniform("roughness",a.getUniform("roughness")),t.setUniform("metallic",a.getUniform("metallic")),t.setUniform("ao",a.getUniform("ao")),t.setUniform("roughness_min",a.getUniform("roughness_min")),t.setUniform("roughness_max",a.getUniform("roughness_max")),t.setUniform("metallic_min",a.getUniform("metallic_min")),t.setUniform("metallic_max",a.getUniform("metallic_max")),t.setUniform("emissiveIntensity",a.getUniform("emissiveIntensity")),t.setUniform("alphaCutoff",a.getUniform("alphaCutoff")),t.setUniform("ior",a.getUniform("ior")),t.setUniform("clearcoatFactor",a.getUniform("clearcoatFactor")),t.setUniform("clearcoatRoughnessFactor",a.getUniform("clearcoatRoughnessFactor")),t.setUniform("clearcoatColor",a.getUniform("clearcoatColor")),t.setUniform("clearcoatWeight",a.getUniform("clearcoatWeight")),t.setUniform("clearcoatIor",a.getUniform("clearcoatIor")),t.setTexture("baseMap",a.getTexture("baseMap")),t.setTexture("normalMap",a.getTexture("normalMap")),t.setTexture("emissiveMap",a.getTexture("emissiveMap")),t.setTexture("aoMap",a.getTexture("aoMap")),t.setTexture("maskMap",a.getTexture("maskMap")),t.setTexture("empty",a.getTexture("empty")),t.setUniform("baseMapOffsetSize",a.getUniform("baseMapOffsetSize")),t.setUniform("normalMapOffsetSize",a.getUniform("normalMapOffsetSize")),t.setUniform("emissiveMapOffsetSize",a.getUniform("emissiveMapOffsetSize")),t.setUniform("roughnessMapOffsetSize",a.getUniform("roughnessMapOffsetSize")),t.setUniform("metallicMapOffsetSize",a.getUniform("metallicMapOffsetSize")),t.setUniform("aoMapOffsetSize",a.getUniform("aoMapOffsetSize")),e}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set maskMap(e){this.shader.setTexture("maskMap",e)}get maskMap(){return this.shader.getTexture("maskMap")}set normalMap(e){this.shader.setTexture("normalMap",e)}get normalMap(){return this.shader.getTexture("normalMap")}set emissiveMap(e){this.shader.setTexture("emissiveMap",e)}get emissiveMap(){return this.shader.getTexture("emissiveMap")}set aoMap(e){this.shader.setTexture("aoMap",e)}get aoMap(){return this.shader.getTexture("aoMap")}set clearCoatRoughnessMap(e){this.shader.setTexture("clearCoatRoughnessMap",e),this.shader.setDefine("USE_CLEARCOAT",!0),this.shader.setDefine("USE_CLEARCOAT_ROUGHNESS",!0)}get clearCoatRoughnessMap(){return this.shader.getTexture("clearCoatRoughnessMap")}set clearcoatColor(e){this.shader.setUniformColor("clearcoatColor",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatColor(){return this.shader.getUniformColor("clearcoatColor")}set clearcoatWeight(e){this.shader.setUniformFloat("clearcoatWeight",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatWeight(){return this.shader.getUniformFloat("clearcoatWeight")}set clearcoatFactor(e){this.shader.setUniformFloat("clearcoatFactor",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatFactor(){return this.shader.getUniformFloat("clearcoatFactor")}set clearcoatRoughnessFactor(e){this.shader.setUniformFloat("clearcoatRoughnessFactor",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatRoughnessFactor(){return this.shader.getUniformFloat("clearcoatRoughnessFactor")}set ior(e){this.shader.setUniformFloat("clearcoatIor",e)}get ior(){return this.shader.getUniformFloat("clearcoatIor")}set alphaCutoff(e){this.shader.setUniform("alphaCutoff",e)}get alphaCutoff(){return this.shader.getUniform("alphaCutoff")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}get roughness(){return this.shader.getUniformFloat("roughness")}set roughness(e){this.shader.setUniformFloat("roughness",e)}get metallic(){return this.shader.getUniformFloat("metallic")}set metallic(e){this.shader.setUniformFloat("metallic",e)}get emissiveColor(){return this.shader.getUniformColor("emissiveColor")}set emissiveColor(e){this.shader.setUniformColor("emissiveColor",e)}get emissiveIntensity(){return this.shader.getUniformFloat("emissiveIntensity")}set emissiveIntensity(e){this.shader.setUniformFloat("emissiveIntensity",e)}get ao(){return this.shader.getUniform("ao")}set ao(e){this.shader.setUniform("ao",e)}}class gf extends st{static format=ze.TEXT;textData="";source_vertices;source_normals;source_tangents;source_textureCoords;matLibs;geometrys;activeGeo;currentObjectName;currentMaterialName;facesMaterialsIndex;mtl;mtlUrl;async parseString(e){return this.source_vertices=[],this.source_normals=[],this.source_tangents=[],this.source_textureCoords=[],this.currentObjectName="default",this.currentMaterialName="",this.matLibs={},this.geometrys={},this.activeGeo=void 0,this.textData=e,await Promise.all([this.parserOBJ(),this.loadMTL()]),this.parser_mesh(),"null"}applyVector2(e,t,a){e>=0&&t[e]&&t[e].length>0?(a.push(t[e][0]),a.push(-t[e][1])):(a.push(0),a.push(0))}applyVector3(e,t,a){e>=0&&t[e]&&t[e].length>0?(a.push(t[e][0]),a.push(t[e][1]),a.push(t[e][2])):(a.push(0),a.push(0),a.push(0))}applyVector4(e,t,a){a.push(t[e][0]),a.push(t[e][1]),a.push(t[e][2]),a.push(t[e][3])}parseUVIndex(e,t){const a=parseInt(e,10);return a>=0?a-1:t+a}parseVertexIndex(e,t){const a=parseInt(e,10);return a>=0?a-1:t+a}parseNormalIndex(e,t){const a=parseInt(e,10);return a>=0?a-1:t+a}calculateFaceNormal(e,t,a){const r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=[a[0]-e[0],a[1]-e[1],a[2]-e[2]],n=[r[1]*i[2]-r[2]*i[1],r[2]*i[0]-r[0]*i[2],r[0]*i[1]-r[1]*i[0]],o=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);return o>0&&(n[0]/=o,n[1]/=o,n[2]/=o),n}async loadMTL(){let t=await new pt().loadTxt(this.baseUrl+this.mtlUrl),a=t.data,r,i=a.split(/\r?\n/);for(let c=0;c<i.length;c++){let f=i[c];var n=f.indexOf("#");n!=-1&&(f=f.substring(0,n)),f=f.trim();var o=f.split(/\s+/);o[0]==="newmtl"?(r={name:o[1]},this.matLibs[o[1]]=r):o[0].indexOf("map_")!=-1?(r[o[0]]=o[1],r.textures||(r.textures=[o[o.length-1]]),r.textures.push(o[o.length-1])):o.length==2?r[o[0]]=Number(o[1]):o.length==3?r[o[0]]=[Number(o[1]),Number(o[2])]:o.length==4&&(r[o[0]]=[Number(o[1]),Number(o[2]),Number(o[3])])}const l=[];for(const c in this.matLibs){const f=this.matLibs[c];if(f.textures&&f.textures.length>0)for(let d=0;d<f.textures.length;d++){const h=Ct.normalizePath(this.baseUrl+f.textures[d]);l.push(m.res.loadTexture(h).catch(b=>(console.error(`Failed to load texture: ${h}`,b),null)))}}return await Promise.all(l),t=null,!0}async load_textures(){}getGeometryKey(e,t){const a=(e??this.currentObjectName??"default")||"default",r=t??this.currentMaterialName??"",i=r.length>0?r:"default";return`${a}::${i}`}ensureActiveGeo(e,t){const a=(e??this.currentObjectName??"default")||"default",r=t??this.currentMaterialName??"",i=this.getGeometryKey(a,r);this.geometrys[i]?this.geometrys[i].source_mat!==r&&(this.geometrys[i].source_mat=r):this.geometrys[i]={type:a,name:i,source_mat:r,source_faces:[]},this.activeGeo=this.geometrys[i]}parserLine(e){var t=e.indexOf("#");if(t!=-1){if(e.indexOf("# object")!=-1){const p=e.split(/\s+/),g=p[1]||"default",A=p[2]||"default";this.currentObjectName=A,this.activeGeo=void 0,this.ensureActiveGeo(A,this.currentMaterialName),this.activeGeo&&(this.activeGeo.type=g)}e=e.substring(0,t)}e=e.trim();var a=e.split(/\s+/);if(a[0]==="v"){var r=[Number(a[1]),Number(a[2]),Number(a[3]),a[4]?1:Number(a[4])];this.source_vertices.push(r)}else if(a[0]==="vt"){var i=[Number(a[1]),Number(a[2]),a[3]?1:Number(a[3])];this.source_textureCoords.push(i)}else if(a[0]==="vn"){var n=[Number(a[1]),Number(a[2]),Number(a[3])];this.source_normals.push(n)}else if(a[0]==="f"){for(var o={indices:[],texture:[],normal:[]},l=1;l<a.length;++l){var c=a[l];if(c.length!==0){var f=c.split("/"),d=f[0]||"",h=f.length>=2&&f[1]||"",b=f.length>=3&&f[2]||"";d.length!==0&&(o.indices.push(d),o.texture.push(h),o.normal.push(b))}}this.ensureActiveGeo(),this.activeGeo.source_faces.push(o)}else a[0]==="usemtl"?(this.currentMaterialName=a[1]||"",this.ensureActiveGeo(this.currentObjectName,this.currentMaterialName)):a[0]==="mtllib"&&(this.mtlUrl=a[1])}async parserOBJ(){let e=this.textData.split(/\r?\n/);for(let t=0;t<e.length;t++){const a=e[t];this.parserLine(a)}return this.textData="",!0}async parser_mesh(){let e=new ee;for(const t in this.geometrys){const a=this.geometrys[t];a.vertex_arr=[],a.normal_arr=[],a.uv_arr=[],a.indeice_arr=[];let r=0;const i=this.source_vertices.length,n=this.source_normals.length,o=this.source_textureCoords.length;for(let p=0;p<a.source_faces.length;p++){const g=a.source_faces[p];let A=this.parseVertexIndex(g.indices[0],i),D=this.parseVertexIndex(g.indices[1],i),_=this.parseVertexIndex(g.indices[2],i);const U=L=>{if(!L||L.length===0)return-1;const X=this.parseNormalIndex(L,n);return Number.isFinite(X)&&X>=0&&X<n?X:-1},v=L=>{if(!L||L.length===0)return-1;const X=this.parseUVIndex(L,o);return Number.isFinite(X)&&X>=0&&X<o?X:-1};let x=U(g.normal[0]),C=U(g.normal[1]),F=U(g.normal[2]);const w=x<0||C<0||F<0;let S=null;w&&A>=0&&D>=0&&_>=0&&this.source_vertices[A]&&this.source_vertices[D]&&this.source_vertices[_]&&(S=this.calculateFaceNormal(this.source_vertices[A],this.source_vertices[D],this.source_vertices[_]));let M=v(g.texture[0]),T=v(g.texture[1]),Q=v(g.texture[2]);if(this.applyVector3(A,this.source_vertices,a.vertex_arr),x>=0?this.applyVector3(x,this.source_normals,a.normal_arr):S?a.normal_arr.push(S[0],S[1],S[2]):a.normal_arr.push(0,0,0),M>=0?this.applyVector2(M,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(D,this.source_vertices,a.vertex_arr),C>=0?this.applyVector3(C,this.source_normals,a.normal_arr):S?a.normal_arr.push(S[0],S[1],S[2]):a.normal_arr.push(0,0,0),T>=0?this.applyVector2(T,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(_,this.source_vertices,a.vertex_arr),F>=0?this.applyVector3(F,this.source_normals,a.normal_arr):S?a.normal_arr.push(S[0],S[1],S[2]):a.normal_arr.push(0,0,0),Q>=0?this.applyVector2(Q,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,g.indices.length>3){let L=this.parseVertexIndex(g.indices[3],i),X=U(g.normal[3]),ie=v(g.texture[3]),q=null;(x<0||F<0||X<0)&&A>=0&&_>=0&&L>=0&&this.source_vertices[A]&&this.source_vertices[_]&&this.source_vertices[L]&&(q=this.calculateFaceNormal(this.source_vertices[A],this.source_vertices[_],this.source_vertices[L])),this.applyVector3(A,this.source_vertices,a.vertex_arr),x>=0?this.applyVector3(x,this.source_normals,a.normal_arr):q?a.normal_arr.push(q[0],q[1],q[2]):a.normal_arr.push(0,0,0),M>=0?this.applyVector2(M,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(_,this.source_vertices,a.vertex_arr),F>=0?this.applyVector3(F,this.source_normals,a.normal_arr):q?a.normal_arr.push(q[0],q[1],q[2]):a.normal_arr.push(0,0,0),Q>=0?this.applyVector2(Q,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(L,this.source_vertices,a.vertex_arr),X>=0?this.applyVector3(X,this.source_normals,a.normal_arr):q?a.normal_arr.push(q[0],q[1],q[2]):a.normal_arr.push(0,0,0),ie>=0?this.applyVector2(ie,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++}}let l=new Ee;l.setIndices(new Uint32Array(a.indeice_arr)),l.setAttribute(V.position,new Float32Array(a.vertex_arr)),l.setAttribute(V.normal,new Float32Array(a.normal_arr)),l.setAttribute(V.uv,new Float32Array(a.uv_arr)),l.setAttribute(V.TEXCOORD_1,new Float32Array(a.uv_arr)),l.addSubGeometry({indexStart:0,indexCount:a.indeice_arr.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let c=new ka;const f=a.source_mat,d=f?this.matLibs[f]:void 0;if(d&&d.map_Kd){const p=Ct.normalizePath(this.baseUrl+d.map_Kd),g=m.res.getTexture(p);g&&(c.baseMap=g)}let h=new ee,b=h.addComponent($);b.geometry=l,b.material=c,e.addChild(h)}this.data=e}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}}let pf=`
|
|
7275
|
+
`;class Hn{static _workerCode;static _workers=new Map;static async apply(e,t){if(!t.extensions)return;const a=t.extensions.KHR_draco_mesh_compression;if(!a)return;let r=this._workers.get(e.gltf);r||(r=new Worker(await this.initDecoder()),this._workers.set(e.gltf,r)),r.postMessage({type:"init",decoderConfig:{}});let i=e.parseBufferView(a.bufferView);if(!i.result){let n=await new Promise((o,l)=>{r.onmessage=c=>{const f=c.data;f.type=="decode"?o(f.result):f.type=="error"&&l(f.error)},r.postMessage({type:"decoder",buffer:i,attributes:a.attributes},[i])});i.result=n}return i.result}static unload(e){let t=this._workers.get(e);t&&(t.terminate(),this._workers.delete(e))}static async initDecoder(){if(!this._workerCode){const e=new Blob([ef,"",`(${Y2})()`],{type:"application/javascript"});this._workerCode=URL.createObjectURL(e)}return this._workerCode}}function Y2(){let s,e;onmessage=t=>{const a=t.data;switch(a.type){case"init":s=a.decoderConfig,e=new Promise((n,o)=>{s.onModuleLoaded=l=>{n({draco:l})},DracoDecoderModule(s)});break;case"decoder":const r=a.buffer,i=a.attributes;e.then(n=>{const o=n.draco;let l=new o.Decoder,c=new o.DecoderBuffer;c.Init(new Int8Array(r),r.byteLength);let f,d;try{const h=l.GetEncodedGeometryType(c);h==o.TRIANGULAR_MESH?(d=new o.Mesh,f=l.DecodeBufferToMesh(c,d)):self.postMessage(new Error("INVALID_GEOMETRY_TYPE:"+h)),f.ok()||self.postMessage(new Error("DracoDecode:"+f.error_msg()));let b={};for(const p in i){let g=l.GetAttributeByUniqueId(d,i[p]);const A=g.num_components(),_=d.num_points()*A,U=_*Float32Array.BYTES_PER_ELEMENT,v=o.DT_FLOAT32,x=o._malloc(U);l.GetAttributeDataArrayForAllPoints(d,g,v,U,x);const C=new Float32Array(o.HEAPF32.buffer,x,_).slice();o._free(x),b[p]={data:C,numComponents:A,normalize:!1}}{const g=d.num_faces()*3,A=g*4,D=o._malloc(A);l.GetTrianglesUInt32Array(d,A,D);const _=new Uint32Array(o.HEAPF32.buffer,D,g).slice();o._free(D),b.indices={data:_,numComponents:1,normalize:!1}}self.postMessage({type:"decode",result:b})}catch(h){self.postMessage({type:"error",error:h.message})}finally{o.destroy(d),o.destroy(l),o.destroy(c)}});break}}}class tf{gltf;constructor(e){this.gltf=e}parse(e){const t=this.gltf.cameras[e];if(!t)return this.errorMiss("camera",e);if(t.isParsed)return t.dcamera;t.isParsed=!0,t.dcamera=!1;const{name:a,type:r,perspective:i,orthographic:n}=t;if(r==="perspective"&&i){const{aspectRatio:o,yfov:l,zfar:c,znear:f}=i;t.dcamera=Object.assign({},{name:a,type:r,yfov:l,znear:f,aspectRatio:o,zfar:c})}else if(r==="orthographic"&&n){const{xmag:o,ymag:l,zfar:c,znear:f}=n;t.dcamera=Object.assign({},{name:a,type:r,xmag:o,ymag:l,zfar:c,znear:f})}return t.dcamera}errorMiss(e,t){throw new Error(e+t)}}class Dt extends st{static format=ze.JSON;_gltf;async parseJson(e){this._gltf=new Bs,this._gltf={...this._gltf,...e},this._gltf.resources={},await Promise.all([this.load_gltf_bin(),this.load_gltf_textures()]);let t=new vs,a=await t.parse(this.initUrl,this._gltf,this._gltf.scene);return t.destroy(),t=null,a?(this.data=a.rootNode,a.rootNode):(this._gltf=null,null)}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}static _counter=0;static getMeshNameCounter(){return function(){return`GLTF_NO_NAME_PRIMITIVE_${Dt._counter++}`}}static getModelNameCounter(){let e=0;return function(){return`GLTF_NO_NAME_MESH_${e++}`}}static getTexCoordDefine(e){return`UV_NUM ${e}`}static getVertexColorDefine(e){return`HAS_VERTEXCOLOR ${e}`}static getBaseColorTextureDefine(){return"HAS_BASECOLORMAP"}static getMetalRoughnessDefine(){return"HAS_METALROUGHNESSMAP"}static getNormalMapDefine(){return"HAS_NORMALMAP"}static getEmissiveMapDefine(){return"HAS_EMISSIVEMAP"}static getOcclusionMapDefine(){return"HAS_OCCLUSIONMAP"}static getMorphTargetsDefine(e){return`MORPH_TARGET_NUM ${e}`}static getMorphtargetPositionDefine(){return"HAS_MORPH_POSITION"}static getMorphtargetNormalDefine(){return"HAS_MORPH_NORMAL"}static getMorphtargetTangentDefine(){return"HAS_MORPH_TANGENT"}static getJointsNumDefine(e){return`JOINTS_NUM ${e}`}static getJointVec8Define(){return"JOINT_VEC8"}static getHasNormalDefine(){return"HAS_NORMAL"}static getHasTangentDefine(){return"HAS_TANGENT"}static getHasNormalMapDefine(){return"HAS_NORMAL_MAP"}static getAlphaMaskDefine(){return"ALPHA_MASK"}static getAlphaBlendDefine(){return"ALPHA_BLEND"}static defaultMaterial={name:"GLTF_DEFAULT_MATERIAL",alphaCutoff:.33,alphaMode:"MASK",pbrMetallicRoughness:{name:"GLTF_DEFAULT_MATERIAL",defines:[],doubleSided:!1,baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1,emissiveFactor:[0,0,0]}};async load_gltf_bin(){if(this._gltf.buffers&&this._gltf.buffers.length>0){let e=[];for(let t=0;t<this._gltf.buffers.length;t++){const a=this._gltf.buffers[t];if(a.uri.substring(0,5)!=="data:"){let r=Ct.parseUrl(this.baseUrl,a.uri);this.loaderFunctions?.onUrl&&(r=await this.loaderFunctions.onUrl(r));let i=new pt().loadBinData(r,this.loaderFunctions).then(n=>{this._gltf.resources[a.uri]=n});e.push(i)}}await Promise.all(e)}}async load_gltf_textures(){if(this._gltf,this._gltf.images){let e=[];for(let t=0;t<this._gltf.images.length;t++){const a=this._gltf.images[t];if(a.uri){let r=Ct.parseUrl(this.baseUrl,a.uri);this.loaderFunctions?.onUrl&&(r=await this.loaderFunctions.onUrl(r));let i=new pt().loadAsyncBitmapTexture(r,this.loaderFunctions).then(n=>{n.name=Ct.getURLName(a.uri),this._gltf.resources[n.name]=n});e.push(i)}}await Promise.all(e)}}}class af{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}async parse(e){const t=this.gltf.meshes[e];if(!t)return this.errorMiss("mesh",e);if(t.isParsed)return t.dprimitives;const a=t.primitives,r=t.extras,i=[];for(let n=0;n<a.length;n++){const o=a[n],{attributes:l,indices:c,material:f,mode:d,name:h,targets:b,morphTargetsRelative:p,extensions:g}=o;let A=t.name;for(let F in l)A+=F;A+=`indices:${c}`,A+=`material:${f}`;const D={attribArrays:{indices:[]},weights:[],defines:[],material:null,drawMode:null,meshName:null,modelName:null,morphTargetsRelative:!1,targetNames:r?r.targetNames:null};let _=!1,U=0,v=!1,x;g&&g.KHR_draco_mesh_compression&&(x=await Hn.apply(this.subParser,o));for(const F in l){const w=x?x[F]:this.parseAccessor(l[F]);if(w){let S;switch(F){case"POSITION":S=V.position;break;case"NORMAL":S=V.normal,_=!0;break;case"TEXCOORD_0":S=V.uv,U++;break;case"JOINTS_0":S=V.joints0;break;case"JOINTS_1":S=V.joints1,v=!0;break;case"WEIGHTS_0":S=V.weights0;break;case"WEIGHTS_1":S=V.weights1;break;default:S=F}D.attribArrays[S]=w}}if(_&&D.defines.push(Dt.getHasNormalDefine()),U&&D.defines.push(Dt.getTexCoordDefine(U)),v&&D.defines.push(Dt.getJointVec8Define()),c!==void 0){const F=x?x.indices:this.parseAccessor(c);F&&(D.attribArrays.indices=F)}const C=await this.parseMaterial(f);if(C&&(D.material=C,D.defines=D.defines.concat(C.defines)),D.drawMode=d===void 0?4:d,D.meshName=()=>A,D.modelName=t.name||Dt.getModelNameCounter(),b){D.defines.push(Dt.getMorphTargetsDefine(b.length)),D.morphTargetsRelative=!0;let F=!1,w=!1,S=!1;for(let M=0;M<b.length;M++){const T=b[M];Object.keys(T).forEach(Q=>{const L=this.parseAccessor(T[Q]);if(L){let X;switch(Q){case"POSITION":X=Yt.MORPH_POSITION_PREFIX+M,F=!0;break;case"NORMAL":X=Yt.MORPH_NORMAL_PREFIX+M,w=!0;break;case"TANGENT":X=Yt.MORPH_TANGENT_PREFIX+M,S=!0;break;default:X=!1}X?D.attribArrays[X]=L:console.error(`glTF has unsupported morph target attribute ${Q}`)}})}F&&D.defines.push(Dt.getMorphtargetPositionDefine()),w&&D.defines.push(Dt.getMorphtargetNormalDefine()),S&&D.defines.push(Dt.getMorphtargetTangentDefine()),D.weights=t.weights||new Array(b.length).fill(0)}i.push(D)}return t.dprimitives=i,t.isParsed=!0,t.dprimitives}parseAccessor(e){return this.subParser.parseAccessor(e)}parseMaterial(e){return this.subParser.parseMaterial(e)}errorMiss(e,t){throw new Error(e+t)}}class rf{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}async parse(e){let t;if(e==null?t=Dt.defaultMaterial:t=this.gltf.materials[e],!t)return this.errorMiss("material",e);if(t.isParsed)return t.dmaterial;let{name:a,pbrMetallicRoughness:r,normalTexture:i,occlusionTexture:n,emissiveTexture:o,emissiveFactor:l,alphaMode:c,alphaCutoff:f,doubleSided:d,extensions:h}=t;const b={name:a,defines:[],doubleSided:!!d,baseColorFactor:[1,1,1,1],emissiveFactor:null,alphaCutoff:0,enableBlend:!1,baseColorTexture:null,metallicRoughnessTexture:null,normalTexture:null,occlusionTexture:null,emissiveTexture:null,extensions:null,baseMapOffsetSize:null,normalMapOffsetSize:null,emissiveMapOffsetSize:null,roughnessMapOffsetSize:null,metallicMapOffsetSize:null,aoMapOffsetSize:null,metallicFactor:0,roughnessFactor:1};if(r){const{baseColorFactor:p,metallicFactor:g,roughnessFactor:A,baseColorTexture:D,metallicRoughnessTexture:_}=r;if(Object.assign(b,{baseColorFactor:p||[1,1,1,1],metallicFactor:g===void 0?1:g,roughnessFactor:A===void 0?.5:A}),D){let U=D.extensions;if(U){let x=U.KHR_texture_transform;if(x){let C=new te(x.offset?x.offset[0]:0,x.offset?x.offset[1]:0,x.scale?x.scale[0]:1,x.scale?x.scale[1]:1);b.baseMapOffsetSize=C}}const v=await this.parseTexture(D.index);v?b.baseColorTexture=v:b.baseColorTexture=m.res.redTexture}if(i){let U=i.extensions;if(U){let x=U.KHR_texture_transform;if(x){let C=new te(x.offset?x.offset[0]:0,x.offset?x.offset[1]:0,x.scale?x.scale[0]:1,x.scale?x.scale[1]:1);b.normalMapOffsetSize=C}}const v=await this.parseTexture(i.index);v?b.normalTexture=v:b.normalTexture=m.res.normalTexture}if(_){let U=_.extensions;if(U){let x=U.KHR_texture_transform;if(x){let C=new te(x.offset?x.offset[0]:0,x.offset?x.offset[1]:0,x.scale?x.scale[0]:1,x.scale?x.scale[1]:1);b.roughnessMapOffsetSize=C}}const v=await this.parseTexture(_.index);v?b.metallicRoughnessTexture=v:b.metallicRoughnessTexture=m.res.blackTexture}}else Object.assign(b,{baseColorFactor:[1,1,1,1],metallicFactor:0,roughnessFactor:.5});if(b.baseColorFactor&&b.baseColorFactor[3]<1&&(c=c==="MASK"?"MASK":"BLEND"),c&&c!=="OPAQUE"&&(c==="MASK"&&(b.defines.push(Dt.getAlphaMaskDefine()),b.alphaCutoff=f===void 0?.5:f),c==="BLEND"&&(b.defines.push(Dt.getAlphaBlendDefine()),b.enableBlend=!0)),i){const p=await this.parseTexture(i.index);p?b.normalTexture=p:b.normalTexture=m.res.normalTexture}if(n){const p=await this.parseTexture(n.index);p&&(b.occlusionTexture=p)}if(l&&(b.emissiveFactor=l),o){const p=await this.parseTexture(o.index);p?b.emissiveTexture=p:b.emissiveTexture=m.res.blackTexture}return h&&(b.extensions=h),t.isParsed=!0,t.dmaterial=b,b}async parseTexture(e){return this.subParser.parseTexture(e)}errorMiss(e,t){throw new Error(e+t)}}class sf{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}parse(e){const t=this.gltf.skins[e];if(!t)return this.errorMiss("skin",e);if(t.isParsed)return t.dskin;const{name:a,joints:r,inverseBindMatrices:i,skeleton:n}=t;if(!r)return this.errorMiss("skin.joints",e);t.isParsed=!0,t.dskin=!1;let o={name:a,skeleton:null,inverseBindMatrices:null,joints:r,defines:[Dt.getJointsNumDefine(r.length)]};if(n)o.skeleton=n;else{var l=-1;for(let c=0;c<this.gltf.nodes.length;c++)if(this.gltf.nodes[c].name=="root"){l=c;break}if(l==-1){let c=this.gltf.scenes[this.gltf.scene];l=c.nodes[c.nodes.length-1]}o.skeleton=l}if(o.inverseBindMatrices=Yt.IDENTITY_INVERSE_BIND_MATRICES,i!==void 0){const c=this.parseAccessor(i);if(c){const f=c.data,d=[];for(let h=0;h<f.length;h+=16)d.push(f.slice(h,h+16));o.inverseBindMatrices=d}else o=null}return t.dskin=o,t.dskin}parseAccessor(e){return this.subParser.parseAccessor(e)}errorMiss(e,t){throw new Error(e+t)}}class nf{name="";index=0;instanceID="";parent=null;scale=new u;rotation=new j;translation=new u;constructor(e=""){this.name=e}}class Kn{index;worldMatrix;constructor(e,t=!1){this.index=e,this.worldMatrix=new E(!t)}}class Ui{time;_skeleton;_jointsPose;mJointMatrixIndexTable;constructor(e,t=!1){this._skeleton=e,this._jointsPose=new Array(e.numJoint),this.mJointMatrixIndexTable=new Array(e.numJoint);for(let a=0;a<e.numJoint;a++){let r=new Kn(a,t);this._jointsPose[a]=r,this.mJointMatrixIndexTable[a]=r.worldMatrix.index}}buildSkeletonPose(e){let t=new u,a=new j,r=new u,i=new Array(this._skeleton.numJoint);this.time=e[11]>0?e[11]:e[24];for(let n=0;n<this._skeleton.numJoint;n++){let o=12*n*4,l=new Float32Array(e.buffer,e.byteOffset+o,12),c=new E;t.set(l[0],l[1],l[2]),a.set(l[4],l[5],l[6],l[7]),r.set(l[8],l[9],l[10]),ps(a.getEulerAngles(),r,t,c),i[n]=c;let f=new Kn(n);const d=this._skeleton.getJointParentIndex(n);if(d<0)f.worldMatrix.copyFrom(c);else{let h=this._jointsPose[d];yc(h.worldMatrix,c,f.worldMatrix)}this._jointsPose[n]=f}}get numJoint(){return this._skeleton.numJoint}get joints(){return this._jointsPose}get jointMatrixIndexTable(){return this.mJointMatrixIndexTable}lerp(e,t,a){if(e&&t)for(let r=0;r<this._jointsPose.length;r++){let i=e._jointsPose[r],n=t._jointsPose[r];this._jointsPose[r].worldMatrix.lerp(i.worldMatrix,n.worldMatrix,a)}else for(let r=0;r<this._jointsPose.length;r++){let i=e._jointsPose[r];this._jointsPose[r].worldMatrix.copyFrom(i.worldMatrix)}}copyFrom(e){for(let t=0;t<this._jointsPose.length;t++)this._jointsPose[t].worldMatrix.copyFrom(e._jointsPose[t].worldMatrix)}reset(){for(let e=0;e<this._jointsPose.length;e++)this._jointsPose[e].worldMatrix.identity()}}class of extends $e{skeletonAnimation;constructor(e,t){super(),this.type=e,this.time=t}}class js{name="";_skeleton;_skeletonPoses;_animationClipData;_events;constructor(e,t,a,r){if(this.name=e,this._skeleton=t,this._animationClipData=r,a>0&&r){this._skeletonPoses=new Array(a);let i=12*t.numJoint;for(let n=0;n<a;n++){let o=i*n*4;const l=r.buffer instanceof ArrayBuffer?r.buffer:new Uint8Array(r.buffer).buffer;let c=new Float32Array(l,o,i),f=new Ui(t);f.buildSkeletonPose(c),this._skeletonPoses[n]=f}}}get totalTime(){return this._skeletonPoses[this._skeletonPoses.length-1].time}get frameRate(){return this.totalTime/this._skeletonPoses.length}get skeleton(){return this._skeleton}get numFrame(){return this._skeletonPoses.length-1}get animationClipData(){return this._animationClipData}getSkeletonPose(e){return this._skeletonPoses[e]}getLerpSkeletonPose(e,t,a,r){let i=this.getSkeletonPose(e),n=this.getSkeletonPose(t);return r.lerp(i,n,a),r}createSubClip(e,t,a){var r=new js(e,this._skeleton,0,null);const i=Math.max(Math.floor(t/this.frameRate),0),n=Math.min(Math.floor(a/this.frameRate),this._skeletonPoses.length-1);r._skeletonPoses=this._skeletonPoses.slice(i,n);const o=12*this._skeleton.numJoint*4,l=this._animationClipData.buffer instanceof ArrayBuffer?this._animationClipData.buffer:new Uint8Array(this._animationClipData.buffer).buffer;return this._animationClipData=new Float32Array(l,i*o,(n-i)*o),r}addEvent(e,t){this._events||(this._events=new Array),this._events.push(new of(e,t))}removeEvent(e){this._events&&(this._events=this._events.filter(t=>t.type!=e))}getEvents(){return this._events}}class qn{gltf;subParser;constructor(e){this.gltf=e.gltf,this.subParser=e}parse(e){let t=new Eo;return t.name="Id:"+e,t.count=0,t.boneData=[],t.boneMap=new Map,this.buildSkeleton(t,void 0,e),t}parseSkeletonAnimation(e,t){let a=new Jo;a.clipName=t.name,a.useSkeletonPos=!1,a.useSkeletonScale=!1;for(let r of t.channels){let i=t.samplers[r.sampler];const n=this.subParser.parseAccessor(i.input),o=this.subParser.parseAccessor(i.output);let l=r.target.node,c=r.target.path,f=this.gltf.nodes[l];if(!f||!e.boneMap.has(f.name))continue;let d=e.boneMap.get(f.name);switch(c){case"scale":{let h=new hr(o.numComponents);h.path="",h.attribute="",h.propertys=h.attribute.split("."),h.preInfinity=0,h.postInfinity=0,h.rotationOrder=0,a.useSkeletonScale=!0,a.scaleCurves.set(d.bonePath,h);for(let b=0;b<n.data.length;b++){const p=n.data[b],g=b*o.numComponents;let A=new Ji(0);A.time=p;const D=new u().set(o.data[g+0],o.data[g+1],o.data[g+2]);A.split(G.vector3,D,"value"),h.addKeyFrame(A)}}break;case"rotation":{let h=new hr(o.numComponents);h.path="",h.attribute="",h.propertys=h.attribute.split("."),h.preInfinity=0,h.postInfinity=0,h.rotationOrder=0,a.rotationCurves.set(d.bonePath,h);for(let b=0;b<n.data.length;b++){const p=n.data[b],g=b*o.numComponents;let A=new Ji(0);A.time=p;const D=new j().set(o.data[g+0],o.data[g+1],o.data[g+2],o.data[g+3]);A.split(G.quaternion,D,"value"),h.addKeyFrame(A)}}break;case"translation":{let h=new hr(o.numComponents);h.path="",h.attribute="",h.propertys=h.attribute.split("."),h.preInfinity=0,h.postInfinity=0,h.rotationOrder=0,a.useSkeletonPos=!0,a.positionCurves.set(d.bonePath,h);for(let b=0;b<n.data.length;b++){const p=n.data[b],g=b*o.numComponents;let A=new Ji(0);A.time=p;const D=new u().set(o.data[g+0],o.data[g+1],o.data[g+2]);A.split(G.vector3,D,"value"),h.addKeyFrame(A)}}break}}return a}parseSkeletonAnimationOld(e,t){let a=this.subParser.parseAccessor(t.samplers[0].input),r=a.data.length,i=a.data[1]-a.data[0];a.data[a.data.length-1];let n=12*e.numJoint,o=new Float32Array(n*r);for(var l=0;l<e.numJoint;l++)for(var c=0;c<r;c++){var f=n*c+12*l;o[f+0]=1,o[f+1]=1,o[f+2]=1,o[f+3]=1}for(let g of t.channels){let A=t.samplers[g.sampler];const D=this.subParser.parseAccessor(A.input),_=this.subParser.parseAccessor(A.output);let U=g.target.node,v=g.target.path,x=this.gltf.nodes[U];if(!x)continue;let C=e.getJointByName(x.name);if(C)switch(v){case"scale":if(r*_.numComponents==_.data.length)for(var c=0;c<r;c++){var d=c*_.numComponents,f=n*c+12*C.index;o[f+0]=_.data[d+0],o[f+1]=_.data[d+1],o[f+2]=_.data[d+2],o[f+3]=1}else if(D.data.length==2){let F=0;D.data[0];let w=D.data[1];var h=0*_.numComponents;u.HELP_0.set(_.data[h+0],_.data[h+1],_.data[h+2]);var b=1*_.numComponents;u.HELP_1.set(_.data[b+0],_.data[b+1],_.data[b+2]);for(var c=0;c<r;c++){let M=F/w;u.HELP_2.lerp(u.HELP_0,u.HELP_1,M);var f=n*c+12*C.index;o[f+0]=u.HELP_2.x,o[f+1]=u.HELP_2.y,o[f+2]=u.HELP_2.z,o[f+3]=1,F+=i}}else throw new Error("Unsupported animation sampler interpolation.");break;case"rotation":if(r*_.numComponents==_.data.length)for(var c=0;c<r;c++){var d=c*_.numComponents,f=n*c+12*C.index+4;o[f+0]=_.data[d+0],o[f+1]=_.data[d+1],o[f+2]=_.data[d+2],o[f+3]=_.data[d+3]}else if(D.data.length==2){let F=0;D.data[0];let w=D.data[1];var h=0*_.numComponents;u.HELP_0.set(_.data[h+0],_.data[h+1],_.data[h+2],_.data[h+3]);var b=1*_.numComponents;u.HELP_1.set(_.data[b+0],_.data[b+1],_.data[b+2],_.data[b+3]);for(var c=0;c<r;c++){let Q=F/w;u.HELP_2.lerp(u.HELP_0,u.HELP_1,Q);var f=n*c+12*C.index+4;o[f+0]=u.HELP_2.x,o[f+1]=u.HELP_2.y,o[f+2]=u.HELP_2.z,o[f+3]=u.HELP_2.w,F+=i}}else throw new Error("Unsupported animation sampler interpolation.");break;case"translation":if(r*_.numComponents==_.data.length)for(var c=0;c<r;c++){var d=c*_.numComponents,f=n*c+12*C.index+8;o[f+0]=_.data[d+0],o[f+1]=_.data[d+1],o[f+2]=_.data[d+2],o[f+3]=D.data[c*D.numComponents]}else if(D.data.length==2){let F=0;D.data[0];let w=D.data[1];var h=0*_.numComponents;u.HELP_0.set(_.data[h+0],_.data[h+1],_.data[h+2]);var b=1*_.numComponents;u.HELP_1.set(_.data[b+0],_.data[b+1],_.data[b+2]);for(var c=0;c<r;c++){let Q=F/w;u.HELP_2.lerp(u.HELP_0,u.HELP_1,Q);var f=n*c+12*C.index+8;o[f+0]=u.HELP_2.x,o[f+1]=u.HELP_2.y,o[f+2]=u.HELP_2.z,o[f+3]=F,F+=i}}else throw new Error("Unsupported animation sampler interpolation.");break}}return new js(t.name,e,r,o)}buildSkeleton(e,t,a){let r=this.gltf.nodes[a];r.name||(r.name="Bone"+e.count);let i=new ko;if(i.boneName=r.name,i.bonePath=t?t.bonePath+"/"+r.name:r.name,i.parentBoneName=t?t.boneName:"",i.boneID=e.count++,i.parentBoneID=t?t.boneID:-1,i.instanceID="",i.parentInstanceID="",i.s=new u(1,1,1),r.scale&&i.s.set(r.scale[0],r.scale[1],r.scale[2]),i.q=new j,r.rotation&&i.q.set(r.rotation[0],r.rotation[1],r.rotation[2],r.rotation[3]),i.t=new u,r.translation&&i.t.set(r.translation[0],r.translation[1],r.translation[2]),e.boneData.push(i),e.boneMap.set(i.boneName,i),r.children)for(let n of r.children)this.buildSkeleton(e,i,n)}buildSkeletonOld(e,t,a,r=0){let i=this.gltf.nodes[a];i.name||(i.name="Node_"+a);let n=new nf(i.name);if(n.parent=t,i.scale&&n.scale.set(i.scale[0],i.scale[1],i.scale[2]),i.rotation&&n.rotation.set(i.rotation[0],i.rotation[1],i.rotation[2],i.rotation[3]),i.translation&&n.translation.set(i.translation[0],i.translation[1],i.translation[2]),e.addJoint(n),i.children)for(let o of i.children)this.buildSkeletonOld(e,n,o,r+1)}}class $n{static list=[];static add(e){this.list.indexOf(e)==-1&&this.list.push(e)}static remove(e){let t=this.list.indexOf(e);t!=-1&&this.list.splice(t,1)}}class xi extends Pe{name;size=1;lightData;dirFix=1;bindOnChange;needUpdateShadow=!0;realTimeShadow=!0;_castGI=!1;_castShadow=!1;_iesProfiles;constructor(){super()}init(){this.transform.object3D.bound=new pe(new u,new u),this.lightData=new ms,this.lightData.lightMatrixIndex=this.transform.worldMatrix.index}onChange(){this.bindOnChange&&this.bindOnChange(),this.transform.object3D.bound.setFromCenterAndSize(this.transform.worldPosition,new u(this.size,this.size,this.size)),this._castGI&&(J.instance.state.giLightingChange=!0),this._castShadow?(this.needUpdateShadow=!0,It.addShadowLight(this)):It.removeShadowLight(this),this.transform.view3D&&m.renderJobs&&m.renderJobs.get(this.transform.view3D).reflectionRenderer&&m.renderJobs.get(this.transform.view3D).reflectionRenderer.forceUpdate()}start(){this.transform.onPositionChange=()=>this.onPositionChange(),this.transform.onRotationChange=()=>this.onRotChange(),this.onPositionChange(),this.onRotChange()}onPositionChange(){this.lightData.lightPosition.copyFrom(this.transform.worldPosition),this.onChange()}onRotChange(){this.dirFix==1?this.lightData.direction.copyFrom(this.transform.forward):this.lightData.direction.copyFrom(this.transform.back),this.lightData.lightTangent.copyFrom(this.transform.up),this.onChange()}onScaleChange(){this.onChange()}onEnable(){this.onChange(),J.instance.addLight(this.transform.scene3D,this)}onDisable(){this.onChange(),J.instance.removeLight(this.transform.scene3D,this),It.removeShadowLight(this)}set iesProfiles(e){this._iesProfiles=e,this.lightData.iesIndex=e.index,ba.use=!0,this.onChange()}get iesProfile(){return this._iesProfiles}get r(){return this.lightData.lightColor.r}set r(e){this.lightData.lightColor.r=e,this.onChange()}get g(){return this.lightData.lightColor.g}set g(e){this.lightData.lightColor.g=e,this.onChange()}get b(){return this.lightData.lightColor.b}set b(e){this.lightData.lightColor.b=e,this.onChange()}get lightColor(){return this.lightData.lightColor}set lightColor(e){this.lightData.lightColor=e,this.onChange()}get color(){return this.lightData.lightColor}set color(e){this.lightData.lightColor=e,this.onChange()}get intensity(){return this.lightData.intensity}set intensity(e){this.lightData.intensity=e,this.onChange()}set castShadow(e){e!=this._castShadow&&(this._castShadow=e,this.onChange())}get castShadow(){return this._castShadow}get shadowIndex(){return this.lightData.castShadowIndex}get castGI(){return this._castGI}set castGI(e){e?$n.add(this):$n.remove(this),this._castGI=e,e&&this.onChange()}get direction(){return this.lightData.direction}destroy(e){this.bindOnChange=null,J.instance.removeLight(this.transform.scene3D,this),It.removeShadowLight(this),this.transform.eventDispatcher.removeEventListener(Qt.ROTATION_ONCHANGE,this.onRotChange,this),this.transform.eventDispatcher.removeEventListener(Qt.SCALE_ONCHANGE,this.onScaleChange,this),super.destroy(e)}}var X2=Object.getOwnPropertyDescriptor,H2=(s,e,t,a)=>{for(var r=a>1?void 0:a?X2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let yi=class extends xi{shadowCamera;constructor(){super()}init(){super.init(),this.object3D.name==""&&(this.object3D.name="DirectionLight_"+Et()),this.radius=Number.MAX_SAFE_INTEGER,this.lightData.lightType=Xe.DirectionLight,this.lightData.linear=0,this.lightData.quadratic=.3}start(){super.start(),this.castGI=!0}get radius(){return this.lightData.range}set radius(s){this.lightData.range=s,this.onChange()}get indirect(){return this.lightData.quadratic}set indirect(s){this.lightData.quadratic=s,this.onChange()}debug(){}};yi=H2([Vt(yi,"DirectLight")],yi);var K2=Object.getOwnPropertyDescriptor,q2=(s,e,t,a)=>{for(var r=a>1?void 0:a?K2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ai=class extends xi{constructor(){super()}init(){super.init(),this.lightData.lightType=Xe.PointLight,this.object3D.name==""&&(this.object3D.name="PointLight"+Et())}get range(){return this.lightData.range}set range(s){this.lightData.range=s,this.onChange()}get at(){return this.lightData.linear}set at(s){this.lightData.linear=s,this.onChange()}get radius(){return this.lightData.radius}set radius(s){this.lightData.radius=s,this.onChange()}get quadratic(){return this.lightData.quadratic}set quadratic(s){this.lightData.quadratic=s,this.onChange()}start(){this.transform.rotationX=90,super.start()}onUpdate(){}onGraphic(s){}debug(){}debugDraw(s){}};ai=q2([Vt(ai,"PointLight")],ai);var $2=Object.getOwnPropertyDescriptor,eb=(s,e,t,a)=>{for(var r=a>1?void 0:a?$2(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ci=class extends xi{constructor(){super()}init(){super.init(),this.lightData.lightType=Xe.SpotLight,this.object3D.name==""&&(this.object3D.name="SpotLight"+Et())}get innerAngle(){return this.lightData.innerAngle/this.lightData.outerAngle*100}set innerAngle(s){this.lightData.innerAngle=se(s,0,100)/100*this.lightData.outerAngle,this.onChange()}get outerAngle(){return this.lightData.outerAngle*Xr*2}set outerAngle(s){this.lightData.outerAngle=se(s,1,179)*rt*.5,this.onChange()}get radius(){return this.lightData.radius}set radius(s){this.lightData.radius=s,this.onChange()}get range(){return this.lightData.range}set range(s){this.lightData.range=s,this.onChange()}get at(){return this.lightData.linear}set at(s){this.lightData.linear=s,this.onChange()}start(){super.start(),this.lightData.lightType=Xe.SpotLight}onUpdate(){}onGraphic(s){}debug(){}debugDraw(s){}};Ci=eb([Vt(Ci,"SpotLight")],Ci);class lf{static apply(e,t,a){let r=t.extensions;if(r&&r.KHR_materials_clearcoat){a.shader.getDefaultColorShader().setDefine("USE_CLEARCOAT",!0);let i=r.KHR_materials_clearcoat;"clearcoatFactor"in i&&(t.clearcoatFactor=i.clearcoatFactor,a.clearcoatFactor=t.clearcoatFactor),"clearcoatRoughnessFactor"in i&&(t.clearcoatRoughnessFactor=i.clearcoatRoughnessFactor,a.clearcoatRoughnessFactor=t.clearcoatRoughnessFactor)}}}class cf{static apply(e,t,a){let r=t.extensions;r&&r.KHR_materials_emissive_strength?(a.emissiveIntensity=r.KHR_materials_emissive_strength.emissiveStrength,a.emissiveMap==m.res.blackTexture&&(a.emissiveMap=m.res.whiteTexture)):a.emissiveIntensity=1}}class ff{static apply(e,t,a){let r=t.extensions;r&&r.KHR_materials_unlit?a.supportLight=!1:a.supportLight=!0}}class df{gltf;subParser;_testCount=8;_hasCastShadow=!1;constructor(e){this.gltf=e.gltf,this.subParser=e}async convertNodeToObject3D(e,t){const a=new ee;if(a.name=e.name,a[Yt.GLTF_NODE_INDEX_PROPERTY]=e.nodeId,e.nodeObj=a,e.matrix&&(e.translation=[0,0,0],e.rotation=[0,0,0,1],e.scale=[1,1,1]),e.translation&&(a.transform.x=e.translation[0],a.transform.y=e.translation[1],a.transform.z=e.translation[2]),e.rotation){let r=new j;r.setFromArray(e.rotation),a.transform.localRotQuat=r}return e.scale&&(a.transform.scaleX=e.scale[0],a.transform.scaleY=e.scale[1],a.transform.scaleZ=e.scale[2]),t.addChild(a),e.light&&this.convertLight(e,a),e.primitives&&this.convertprimitives(e,a),e.skeleton&&this.convertSkeletonAnim(a,e.skeleton),a}convertSkeletonAnim(e,t){let a=this.subParser.parseSkeleton(t.skeleton);m.res.addObj(a.name,a);let r=[];for(let n=0;n<this.gltf.animations.length;n++){let o=this.gltf.animations[n];o.name||(o.name=n.toString());let l=this.subParser.parseSkeletonAnimation(a,o);r.push(l)}let i=e.addComponent(Pa);i.avatar=a.name,i.clips=r}convertLight(e,t){switch(e.light.type){case"directional":let a=t.addComponent(yi);t.name=e.light.name,a.intensity=e.light.intensity*.1,a.radius=Number.MAX_SAFE_INTEGER,a.dirFix=-1,this._hasCastShadow||(this._hasCastShadow=!0,a.castShadow=this._hasCastShadow),a.lightColor=e.light.color?new P(e.light.color[0],e.light.color[1],e.light.color[2]):new P(1,1,1,1),a.debug();break;case"point":if(this._testCount>0){let i=t.addComponent(ai);i.name=e.light.name,i.intensity=e.light.intensity?e.light.intensity*8*2:1,i.radius=8,i.at=2,i.range=e.light.range?e.light.range:8,i.lightColor=e.light.color?new P(e.light.color[0],e.light.color[1],e.light.color[2]):new P(1,1,1,1)}this._testCount--;break;case"spot":let r=t.addComponent(Ci);r.name=e.light.name,r.intensity=e.light.intensity*5,r.radius=1,r.dirFix=-1,r.at=2,r.range=e.light.range?e.light.range:8,r.outerAngle=e.light.spot.outerConeAngle*Xr,r.lightColor=e.light.color?new P(e.light.color[0],e.light.color[1],e.light.color[2]):new P(1,1,1,1);break}}convertprimitives(e,t){for(let a=0;a<e.primitives.length;a++){const r=e.primitives[a];r.modelName;let i=r.material;i.name==null&&(i.name=Et());let n,o=`matkey_${i.name}`;if(i&&this.gltf.resources[o])n=this.gltf.resources[o];else{let b=i;const p=b?.extensions?.KHR_materials_unlit!==void 0;let g=p?new nt:new ka;if(n=g,this.gltf.resources[o]=g,g.name=i.name,b){const{baseColorTexture:A,baseColorFactor:D,metallicFactor:_,roughnessFactor:U,doubleSided:v,metallicRoughnessTexture:x,normalTexture:C,occlusionTexture:F,emissiveTexture:w,emissiveFactor:S,enableBlend:M,alphaCutoff:T}=b;let Q=g=this.applyMaterialExtensions(b,g);if(p){const L=Q;L.baseColor=new P(D[0],D[1],D[2],D[3]),A&&(L.baseMap=A),Q.doubleSide=v,"enableBlend"in b&&(b.enableBlend?(b.defines?.includes("ALPHA_BLEND")?Q.blendMode=ae.ALPHA:Q.blendMode=ae.NORMAL,Q.castShadow=!1):Q.blendMode=ae.NONE),"alphaCutoff"in b&&T>0&&T<1&&(Q.setUniformFloat("alphaCutoff",T),Q.blendMode=ae.NORMAL,Q.transparent=!0)}else if("enableBlend"in b&&(b.enableBlend?(b.defines?.includes("ALPHA_BLEND")?Q.blendMode=ae.ALPHA:Q.blendMode=ae.NORMAL,Q.castShadow=!1):Q.blendMode=ae.NONE),"alphaCutoff"in b&&T>0&&T<1&&(Q.setUniformFloat("alphaCutoff",T),Q.blendMode=ae.NORMAL,Q.transparent=!0),b.baseMapOffsetSize&&Q.setUniformVector4("baseMapOffsetSize",b.baseMapOffsetSize),b.normalMapOffsetSize&&Q.setUniformVector4("normalMapOffsetSize",b.normalMapOffsetSize),b.emissiveMapOffsetSize&&Q.setUniformVector4("emissiveMapOffsetSize",b.emissiveMapOffsetSize),b.roughnessMapOffsetSize&&Q.setUniformVector4("roughnessMapOffsetSize",b.roughnessMapOffsetSize),b.metallicMapOffsetSize&&Q.setUniformVector4("metallicMapOffsetSize",b.metallicMapOffsetSize),b.aoMapOffsetSize&&Q.setUniformVector4("aoMapOffsetSize",b.aoMapOffsetSize),Q.setUniformColor("baseColor",new P(D[0],D[1],D[2],D[3])),Q.setUniformFloat("roughness",U??1),Q.setUniformFloat("metallic",_??0),Q.setUniformFloat("ao",1),Q.doubleSide=v,A&&Q.setTexture("baseMap",A),C&&Q.setTexture("normalMap",C),x?(Q.setTexture("maskMap",x),Q.shader.setDefine("USE_ROUGHNESS_G",!0),Q.shader.setDefine("USE_METALLIC_B",!0)):(Q.shader.setDefine("USE_ROUGHNESS_G",!1),Q.shader.setDefine("USE_METALLIC_B",!1)),w&&Q.setTexture("emissiveMap",w),S&&(S[0]>0||S[1]>0||S[2]>0)){Q.shader.getTexture("emissiveMap")||Q.shader.setTexture("emissiveMap",m.res.whiteTexture),Q.shader.setDefine("USE_EMISSIVEMAP",!0),Q.setUniformColor("emissiveColor",new P(S[0],S[1],S[2],S[3])),Q.blendMode!=ae.NONE&&(Q.blendMode=ae.ADD);let L=n.getUniformFloat("emissiveIntensity");(!L||L<=0)&&n.setUniformFloat("emissiveIntensity",1)}}}const{attribArrays:l,modelName:c,drawMode:f}=r;let d;if(!l.indices.data){let b=[],p=l.position.data.length/3/3;for(let g=0;g<p;g++){let A=g*3;b.push(A+2),b.push(A+0),b.push(A+1)}l.indices={data:new Uint8Array(b),normalize:!1,numComponents:1}}let h=!l.normal;if(h){let b=[],p=l.position.data.length/3;for(let g=0;g<p;g++)b.push(0),b.push(0),b.push(0);l.normal={data:new Float32Array(b),normalize:!1,numComponents:3}}if(l.indices.data&&l.indices.data.length>3){let b=r.meshName();this.gltf.resources[b]&&(d=this.gltf.resources[b]);const p=new ee;if(p.name=c+a,this.gltf.animations&&l[V.joints0]!=null){d||=this.createGeometryBase(c,l,r,e.skin),this.gltf.resources[b]=d,h&&l.indices?.data&&l.indices.data.length>0&&d.computeNormals();let g=this.gltf.nodes[e.skin.skeleton];g.dnode&&g.dnode.nodeObj?this.convertSkeletonAnim(t,e.skin):g.dnode.skeleton=e.skin;let A=p.addComponent(lr);A.geometry=d,A.material=n}else{d||=this.createGeometryBase(c,l,r),this.gltf.resources[b]=d,h&&l.indices?.data&&l.indices.data.length>0&&d.computeNormals(),d.hasAttribute(V.joints0)&&d.vertexAttributeMap.delete(V.joints0);let g=p.addComponent($);g.castShadow=!0,g.castGI=!0,g.geometry=d,g.material=n}e.skin&&e.skin.defines,t.addChild(p)}}}createGeometryBase(e,t,a,r){"indices"in t&&(t.indices.data.length>65534?t.indices.data=new Uint32Array(t.indices.data):t.indices.data=new Uint16Array(t.indices.data));let i=new Ee;if(i.name=e,"indices"in t&&(t.indices.data.length>65535?t.indices.data=new Uint32Array(t.indices.data):t.indices.data=new Uint16Array(t.indices.data)),a.morphTargetsRelative){let l=new Io,c=a.targetNames;if(c&&c.length>0){l.shapeNames=[],l.shapeIndexs=[];for(let f=0;f<c.length;f++)l.shapeNames.push(c[f]),l.shapeIndexs.push(f)}l.vertexCount=t.position.data.length/3,l.blendCount=l.shapeNames.length,l.blendShapePropertyDatas=[],l.blendShapeMap=new Map;for(let f=0;f<l.blendCount;f++){let d=new Ro;d.shapeName=l.shapeNames[f],d.shapeIndex=l.shapeIndexs[f],d.frameCount=1,d.blendPositionList=t[Yt.MORPH_POSITION_PREFIX+f].data,d.blendNormalList=t[Yt.MORPH_NORMAL_PREFIX+f].data,l.blendShapePropertyDatas.push(d),l.blendShapeMap.set(d.shapeName,d)}i.blendShapeData=l}i.morphTargetsRelative=a.morphTargetsRelative;let n=a.targetNames;if(n&&n.length>0){let l=i.morphTargetDictionary={};for(let c=0;c<n.length;c++)l[n[c]]=c}if(i.morphTargetDictionary){let l=t.position.data.length/3,c=new Float32Array(l);for(let f=0;f<l;f++)c[f]=f;t.vIndex={data:c,normalize:!1,numComponents:1}}for(const l in t){let c=t[l];i.setAttribute(l,c.data)}if(r){i.skinNames=new Array(r.joints.length);for(let l=0;l<r.joints.length;l++){const c=r.joints[l],f=this.gltf.nodes[c];i.skinNames[l]=f.name}i.bindPose=new Array(r.inverseBindMatrices.length);for(let l=0;l<r.inverseBindMatrices.length;l++){const c=r.inverseBindMatrices[l];let f=new E;f.rawData.set(c),i.bindPose[l]=f}}let o=i.getAttribute(V.indices);return i.addSubGeometry({indexStart:0,indexCount:o.data.length,vertexStart:0,index:0,vertexCount:0,firstStart:0,topology:0}),i}applyMaterialExtensions(e,t){return e.extensions&&(lf.apply(this.gltf,e,t),ff.apply(this.gltf,e,t),cf.apply(this.gltf,e,t)),t}parseSkinJoints(e){let t=[];for(let a of e.joints){let r=this.gltf.nodes[a];t.push(r.name)}return t}}class vs{currentSceneName;gltf;initUrl;_generator;_version;_BASE64_MARKER=";base64,";_cameraParser=null;_meshParser=null;_materialParser=null;_skinParser=null;_skeletonParser=null;_converter=null;constructor(){}get version(){return this.version?this.version:this.gltf?this.gltf.asset?(this._version=this.gltf.asset.version,this.gltf.asset.minVersion&&(this._version+=`\r minVersion${this.gltf.asset.minVersion}`),this.version):this.errorMiss("asset"):(console.warn("glTF not loaded."),null)}async parse(e,t,a){this.gltf=t,this.initUrl=e;const{version:r,generator:i}=this.gltf.asset;if(this._generator=i,r!=="2.0")return console.error(`GLTFParser only support glTF 2.0 for now! Received glTF version: ${this.version}`),!1;const n={nodes:await this.parseScene(a),animations:this.parseAnimations(),name:this.currentSceneName};return await this.convertToNode(n)}destroy(){Hn.unload(this.gltf),this.gltf=null}async parseScene(e){const t=e||this.gltf.scene||0,a=this.gltf.scenes[t];if(typeof a>"u")return this.errorMiss("scene",t);this.currentSceneName=a.name||"GLTF_NO_NAME_SCENE";const r=[],i=a.nodes;for(let n=0;n<i.length;n++){const o=await this.parseNode(i[n]);o&&r.push(o)}return r}async parseNode(e){const t=this.gltf.nodes[e];if(!t)return this.errorMiss("node",e);if(t.isParsed)return t.dnode;const{name:a,matrix:r,translation:i,rotation:n,scale:o}=t,l={name:a,matrix:r,translation:i,rotation:n,scale:o,nodeId:e,camera:null,primitives:null,skin:null,children:null,light:null};if(t.camera!==void 0&&(l.camera=this.parseCamera(t.camera)),t.mesh!==void 0&&(l.primitives=await this.parseMesh(t.mesh)),t.extensions!==void 0&&this.applyNodeExtensions(t,l),t.skin!==void 0){const c=this.parseSkin(t.skin);c&&(l.skin=c)}if(l.children=[],t.children)for(let c=0;c<t.children.length;c++)l.children.push(await this.parseNode(t.children[c]));return t.dnode=l,t.isParsed=!0,t.dnode}errorMiss(e,t){throw new Error(e+t)}parseCamera(e){return this._cameraParser||(this._cameraParser=new tf(this.gltf)),this._cameraParser.parse(e)}async parseMesh(e){return this._meshParser||(this._meshParser=new af(this)),this._meshParser.parse(e)}async parseTexture(e){let t=this.gltf.textures[e];if(t&&!t.dtexture){if(t&&t.source!=null){let a=this.gltf.images[t.source];if(a.uri){let r=a.uri;r=Ct.getURLName(r),t.dtexture=this.gltf.resources[r]}else if(a.bufferView){let r=this.parseBufferView(a.bufferView),i=new Va,n=new Blob([r],{type:a.mimeType});await i.loadFromBlob(n),t.dtexture=i}else t.dtexture=this.gltf.resources[a.name]}else if(t.name){let a=Ct.getURLName(t.name);t.dtexture=this.gltf.resources[a]}}return t.dtexture||console.log("miss texture , please check texture!",e,t),t.dtexture}async parseMaterial(e){return this._materialParser||(this._materialParser=new rf(this)),this._materialParser.parse(e)}parseAnimations(){return[]}async parseObject3D(e,t){return this._converter||(this._converter=new df(this)),this._converter.convertNodeToObject3D(e,t)}parseSkeleton(e){return this._skeletonParser||(this._skeletonParser=new qn(this)),this._skeletonParser.parse(e)}parseSkeletonAnimation(e,t){return this._skeletonParser||(this._skeletonParser=new qn(this)),this._skeletonParser.parseSkeletonAnimation(e,t)}async traverse(e,t){for(let a=0;a<t.length;a++){const r=await this.parseObject3D(t[a],e);await this.traverse(r,t[a].children)}}async convertToNode(e){const t=new ee;t.name=e.name;const a=e.nodes;e.animations;const r=[],i=[];return await this.traverse(t,a),{rootNode:t,textures:r,animations:void 0,cameras:i}}parseSkin(e){return this._skinParser||(this._skinParser=new sf(this)),this._skinParser.parse(e)}parseAccessor(e){const t=this.gltf.accessors[e];if(!t)return this.errorMiss("accessor",e);if(t.isParsed)return t.daccessor;t.isParsed=!0,t.daccessor=!1;const a=!!t.normalized,r=this.gltf.bufferViews[t.bufferView],i=r&&r.byteStride,n=Xn(t.componentType);let o=1;switch(t.type){case"SCALAR":o=1;break;case"VEC2":o=2;break;case"VEC3":o=3;break;case"VEC4":case"MAT2":o=4;break;case"MAT3":o=9;break;case"MAT4":o=16;break;default:o=0;break}if(o===0)return console.error(`glTF has unknown data type in accessor: ${t.type}`),!1;const l=o*n.BYTES_PER_ELEMENT;let c;if(r!==void 0){if(c=this.parseBufferView(t.bufferView),!c)return t.daccessor}else c=new Uint8Array(l*t.count).buffer;let f=this.getTypedArrayFromArrayBuffer(c,i,t.byteOffset||0,n,o,t.count);if(t.sparse){const{count:d,indices:h,values:b}=t.sparse;f=new n(f);const p=h.byteOffset||0,g=this.gltf.bufferViews[h.bufferView],A=Xn(h.componentType),D=this.parseBufferView(h.bufferView),_=this.getTypedArrayFromArrayBuffer(D,g.byteStride,p,A,1,d),U=b.byteOffset||0,v=this.gltf.bufferViews[b.bufferView],x=this.parseBufferView(b.bufferView),C=this.getTypedArrayFromArrayBuffer(x,v.byteStride,U,n,o,d);for(let F=0;F<_.length;F++)f.set(C.slice(F*o,F*o+o),_[F]*o)}return t.computeResult={typedArray:f,arrayType:n,numComponents:o},t.daccessor={data:f,numComponents:o,normalize:a},t.daccessor}getTypedArrayFromArrayBuffer(e,t,a,r,i,n){let o;const l=i*r.BYTES_PER_ELEMENT;if(t&&l!==t){const c=i*n;o=new r(c);for(let f=0;f<n;f++){const d=new r(e,a+f*t,i);for(let h=0;h<i;h++)o[f*i+h]=d[h]}}else o=new r(e,a,n*i);return o}parseBufferView(e){const t=this.gltf.bufferViews[e];if(!t)return this.errorMiss("bufferView",e);if(t.isParsed)return t.dbufferView;t.isParsed=!0,t.dbufferView=!1;const a=this.parseBuffer(t.buffer);if(a){const{byteOffset:r,byteLength:i}=t,n=new Uint8Array(a,r||0,i);t.dbufferView=new Uint8Array(n).buffer}return t.dbufferView}parseBuffer(e){const t=this.gltf.buffers[e];if(!t)return this.errorMiss("buffer",e);if(t.isParsed)return t.dbuffer;if(t.isParsed=!0,t.dbuffer=!1,t.uri.substring(0,5)!=="data:"){const a=t.uri,r=this.gltf.resources[a];r?r.byteLength===t.byteLength?t.dbuffer=this.gltf.resources[a]:console.error(`load gltf resource "${a}" at buffers[${e} failed, ArrayBuffer.byteLength not equals buffer's byteLength]`):console.error(`load gltf resource "${a}" at buffers[${e}] failed`)}else{const a=t.uri.indexOf(this._BASE64_MARKER)+this._BASE64_MARKER.length,r=window.atob(t.uri.substring(a)),i=new Uint8Array(r.length);for(let n=0;n<r.length;n++)i[n]=r.charCodeAt(n);t.dbuffer=i.buffer}return t.dbuffer}getLight(e){return this.gltf.extensions.KHR_lights_punctual.lights[e]}applyNodeExtensions(e,t){let a=e.extensions;a.KHR_lights_punctual&&this.gltf.extensions.KHR_lights_punctual&&(t.light=this.getLight(a.KHR_lights_punctual.light))}}class hf{magic;version;length}class uf{chunkLength;chunkType;chunkData}class eo extends st{static format=ze.BIN;_gltf;async parseBuffer(e){let t=new Uint8Array(e);t.pos=0;const a=this.parseHeader(t);if(a.magic!=1179937895)return console.error("invalid GLB file"),!1;if(a.version!==2)return console.error(`GLBParser only support glTF 2.0 for now! Received glTF version: ${a.version}`),!1;let r=[];for(;t.pos<t.length;){let d=this.parseChunk(t);r.push(d)}if(r[0].chunkType!=1313821514)return console.error("invalid GLBChunk"),!1;let i="",n=65535,o=r[0].chunkData;for(let d=0;d<o.length;d+=n){let h=o.length-d;h=Math.min(h,n);let b=o.subarray(d,d+h);i+=String.fromCharCode(...b)}let l=JSON.parse(i);this._gltf=new Bs,this._gltf={...this._gltf,...l},this._gltf.resources={};for(let d=0;d<this._gltf.buffers.length;d++){let h=this._gltf.buffers[d];h.isParsed=!0,h.dbuffer=r[d+1].chunkData.buffer}if(this._gltf.images)for(let d=0;d<this._gltf.images.length;d++){let h=this._gltf.images[d];h.name=h.name||"bufferView_"+h.bufferView.toString();const b=this._gltf.bufferViews[h.bufferView],p=this._gltf.buffers[b.buffer];let g=new Uint8Array(p.dbuffer,b.byteOffset,b.byteLength),A=new Blob([g],{type:h.mimeType}),D=new Va;await D.loadFromBlob(A),D.name=h.name,this._gltf.resources[h.name]=D}let c=new vs,f=await c.parse(this.initUrl,this._gltf,this._gltf.scene);return c.destroy(),f?(this.data=f.rootNode,f.rootNode):null}async parseJsonAndBuffer(e,t){this._gltf=new Bs,this._gltf={...this._gltf,...e},this._gltf.resources={};let a=this._gltf.buffers[0];if(a.isParsed=!0,a.dbuffer=t,this._gltf.images)for(let n=0;n<this._gltf.images.length;n++){let o=this._gltf.images[n];o.name=o.name||"bufferView_"+o.bufferView.toString();const l=this._gltf.bufferViews[o.bufferView],c=this._gltf.buffers[l.buffer];let f=new Uint8Array(c.dbuffer,l.byteOffset,l.byteLength),d=new Blob([f],{type:o.mimeType}),h=new Va;await h.loadFromBlob(d),h.name=o.name,this._gltf.resources[o.name]=h}let r=new vs,i=await r.parse(this.initUrl,this._gltf,this._gltf.scene);return r.destroy(),i?(this.data=i.rootNode,i.rootNode):null}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}parseHeader(e){let t=e.pos,a=new hf,r=new Uint32Array(e.buffer,t,3);return e.pos+=r.byteLength,a.magic=r[0],a.version=r[1],a.length=r[2],a}parseChunk(e){let t=e.pos,a=new uf,r=new Uint32Array(e.buffer,t,2);t=e.pos+=r.byteLength,a.chunkLength=r[0],a.chunkType=r[1],a.chunkData=new Uint8Array(e.buffer,t,a.chunkLength);const i=new Uint8Array(a.chunkLength);for(let n=0;n<a.chunkLength;n++)i[n]=a.chunkData[n];return a.chunkData=i,e.pos+=a.chunkLength,a}}class bf extends ot{constructor(){super();let e=new Ve("PBRLItShader","PBRLItShader");e.setShaderEntry("VertMain","FragMain"),e.passType=H.COLOR,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.setUniformColor("baseColor",new P(.75,.75,.75,1)),this.setUniformColor("emissiveColor",new P(0,0,0)),this.setUniformVector4("materialF0",new te(.04,.04,.04,1)),this.setUniformColor("specularColor",new P(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",1),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 P(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformFloat("clearcoatIor",1.5),this.setUniformVector4("baseMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("normalMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("emissiveMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("roughnessMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("metallicMapOffsetSize",new te(0,0,1,1)),this.setUniformVector4("aoMapOffsetSize",new te(0,0,1,1)),this.baseMap=m.res.whiteTexture,this.normalMap=m.res.normalTexture,this.maskMap=m.res.maskTexture}get baseMap(){return this.getDefaultColorShader().getTexture("baseMap")}set baseMap(e){this.getDefaultColorShader().setTexture("baseMap",e)}get baseColor(){return this.getDefaultColorShader().getUniform("baseColor")}set baseColor(e){this.getDefaultColorShader().setUniformColor("baseColor",e)}get normalMap(){return this.getDefaultColorShader().getTexture("normalMap")}set normalMap(e){this.getDefaultColorShader().setTexture("normalMap",e)}get doubleSide(){return this.getDefaultColorShader().doubleSide}set doubleSide(e){this.getDefaultColorShader().doubleSide=e}get alphaCutoff(){return this.getDefaultColorShader().shaderState.alphaCutoff}set alphaCutoff(e){this.getDefaultColorShader().setDefine("USE_ALPHACUT",!0),this.getDefaultColorShader().shaderState.alphaCutoff=e,this.getDefaultColorShader().setUniform("alphaCutoff",e)}get emissiveColor(){return this.getDefaultColorShader().getUniform("emissiveColor")}set emissiveColor(e){this.getDefaultColorShader().setUniform("emissiveColor",e)}get emissiveIntensity(){return this.getDefaultColorShader().getUniform("emissiveIntensity")}set emissiveIntensity(e){this.getDefaultColorShader().setUniform("emissiveIntensity",e)}get transformUV1(){return this.getDefaultColorShader().uniforms.transformUV1.vector4}set transformUV1(e){this.getDefaultColorShader().setUniform("transformUV1",e)}get uvTransform_2(){return this.getDefaultColorShader().uniforms.transformUV2.vector4}set uvTransform_2(e){this.getDefaultColorShader().setUniform("transformUV2",e)}get depthWriteEnabled(){return this.getDefaultColorShader().shaderState.depthWriteEnabled}set depthWriteEnabled(e){this.getDefaultColorShader().shaderState.depthWriteEnabled=e}get materialF0(){return this.getDefaultColorShader().uniforms.materialF0.vector4}set materialF0(e){this.getDefaultColorShader().setUniform("materialF0",e)}get specularColor(){return this.getDefaultColorShader().uniforms.specularColor.color}set specularColor(e){this.getDefaultColorShader().setUniform("specularColor",e)}get roughness(){return this.getDefaultColorShader().uniforms.roughness.value}set roughness(e){this.getDefaultColorShader().setUniform("roughness",e)}get metallic(){return this.getDefaultColorShader().uniforms.metallic.value}set metallic(e){this.getDefaultColorShader().setUniform("metallic",e)}get ao(){return this.getDefaultColorShader().uniforms.ao.value}set ao(e){this.getDefaultColorShader().setUniform("ao",e)}get metallic_min(){return this.getDefaultColorShader().uniforms.metallic_min.value}set metallic_min(e){this.getDefaultColorShader().setUniform("metallic_min",e)}get metallic_max(){return this.getDefaultColorShader().uniforms.metallic_max.value}set metallic_max(e){this.getDefaultColorShader().setUniform("metallic_max",e)}get roughness_min(){return this.getDefaultColorShader().uniforms.roughness_min.value}set roughness_min(e){this.getDefaultColorShader().setUniform("roughness_min",e)}get roughness_max(){return this.getDefaultColorShader().uniforms.roughness_max.value}set roughness_max(e){this.getDefaultColorShader().setUniform("roughness_max",e)}get normalScale(){return this.getDefaultColorShader().uniforms.normalScale.value}set normalScale(e){this.getDefaultColorShader().setUniform("normalScale",e)}get maskMap(){return this.getDefaultColorShader().textures.maskMap}set maskMap(e){this.getDefaultColorShader().setDefine("USE_MR",!0),this.getDefaultColorShader().setTexture("maskMap",e)}set aoMap(e){e&&(this.getDefaultColorShader().setTexture("aoMap",e),e!=m.res.whiteTexture&&this.getDefaultColorShader().setDefine("USE_AOTEX",!0))}get aoMap(){return this.getDefaultColorShader().textures.aoMap}set clearCoatRoughnessMap(e){e&&(console.log("USE_CLEARCOAT_ROUGHNESS"),this.getDefaultColorShader().setTexture("clearCoatRoughnessMap",e),this.getDefaultColorShader().setDefine("USE_CLEARCOAT_ROUGHNESS",!0))}get clearCoatRoughnessMap(){return this.getDefaultColorShader().textures.clearCoatRoughnessMap}get brdfLUT(){return this.getDefaultColorShader().textures.brdfLUT}set brdfLUT(e){this.getDefaultColorShader().setTexture("brdfLUT",e),this.getDefaultColorShader().setTexture("brdflutMap",e)}get emissiveMap(){return this.getDefaultColorShader().textures.emissiveMap}set emissiveMap(e){this.getDefaultColorShader().setTexture("emissiveMap",e)}set envIntensity(e){this.getDefaultColorShader().setUniformFloat("envIntensity",e)}get envIntensity(){return this.getDefaultColorShader().uniforms.envIntensity.value}set ior(e){this.getDefaultColorShader().setUniformFloat("ior",e)}get ior(){return this.getDefaultColorShader().uniforms.ior.value}useCleanCoat(){this.getDefaultColorShader().setDefine("USE_CLEARCOAT",!0)}set clearcoatFactor(e){this.getDefaultColorShader().setUniformFloat("clearcoatFactor",e),this.useCleanCoat()}get clearcoatFactor(){return this.getDefaultColorShader().uniforms.clearcoatFactor.value}set clearcoatRoughnessFactor(e){this.getDefaultColorShader().setUniformFloat("clearcoatRoughnessFactor",e),this.useCleanCoat()}get clearcoatRoughnessFactor(){return this.getDefaultColorShader().uniforms.clearcoatRoughnessFactor.value}set clearcoatWeight(e){this.getDefaultColorShader().setUniformFloat("clearcoatWeight",e),this.useCleanCoat()}get clearcoatWeight(){return this.getDefaultColorShader().uniforms.clearcoatWeight.value}set clearcoatColor(e){this.getDefaultColorShader().setUniformColor("clearcoatColor",e),this.useCleanCoat()}get clearcoatColor(){return this.getDefaultColorShader().uniforms.clearcoatColor.color}}class ka extends mt{constructor(){super();let e=new bf;this.shader=e}clone(){let e=new ka,t=e.shader.getDefaultColorShader(),a=this.shader.getDefaultColorShader();return t.defineValue={...a.defineValue},t.setUniform("shadowBias",a.getUniform("shadowBias")),t.setUniform("baseColor",a.getUniform("baseColor")),t.setUniform("specularColor",a.getUniform("specularColor")),t.setUniform("emissiveColor",a.getUniform("emissiveColor")),t.setUniform("materialF0",a.getUniform("materialF0")),t.setUniform("envIntensity",a.getUniform("envIntensity")),t.setUniform("normalScale",a.getUniform("normalScale")),t.setUniform("roughness",a.getUniform("roughness")),t.setUniform("metallic",a.getUniform("metallic")),t.setUniform("ao",a.getUniform("ao")),t.setUniform("roughness_min",a.getUniform("roughness_min")),t.setUniform("roughness_max",a.getUniform("roughness_max")),t.setUniform("metallic_min",a.getUniform("metallic_min")),t.setUniform("metallic_max",a.getUniform("metallic_max")),t.setUniform("emissiveIntensity",a.getUniform("emissiveIntensity")),t.setUniform("alphaCutoff",a.getUniform("alphaCutoff")),t.setUniform("ior",a.getUniform("ior")),t.setUniform("clearcoatFactor",a.getUniform("clearcoatFactor")),t.setUniform("clearcoatRoughnessFactor",a.getUniform("clearcoatRoughnessFactor")),t.setUniform("clearcoatColor",a.getUniform("clearcoatColor")),t.setUniform("clearcoatWeight",a.getUniform("clearcoatWeight")),t.setUniform("clearcoatIor",a.getUniform("clearcoatIor")),t.setTexture("baseMap",a.getTexture("baseMap")),t.setTexture("normalMap",a.getTexture("normalMap")),t.setTexture("emissiveMap",a.getTexture("emissiveMap")),t.setTexture("aoMap",a.getTexture("aoMap")),t.setTexture("maskMap",a.getTexture("maskMap")),t.setTexture("empty",a.getTexture("empty")),t.setUniform("baseMapOffsetSize",a.getUniform("baseMapOffsetSize")),t.setUniform("normalMapOffsetSize",a.getUniform("normalMapOffsetSize")),t.setUniform("emissiveMapOffsetSize",a.getUniform("emissiveMapOffsetSize")),t.setUniform("roughnessMapOffsetSize",a.getUniform("roughnessMapOffsetSize")),t.setUniform("metallicMapOffsetSize",a.getUniform("metallicMapOffsetSize")),t.setUniform("aoMapOffsetSize",a.getUniform("aoMapOffsetSize")),e}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set maskMap(e){this.shader.setTexture("maskMap",e)}get maskMap(){return this.shader.getTexture("maskMap")}set normalMap(e){this.shader.setTexture("normalMap",e)}get normalMap(){return this.shader.getTexture("normalMap")}set emissiveMap(e){this.shader.setTexture("emissiveMap",e)}get emissiveMap(){return this.shader.getTexture("emissiveMap")}set aoMap(e){this.shader.setTexture("aoMap",e)}get aoMap(){return this.shader.getTexture("aoMap")}set clearCoatRoughnessMap(e){this.shader.setTexture("clearCoatRoughnessMap",e),this.shader.setDefine("USE_CLEARCOAT",!0),this.shader.setDefine("USE_CLEARCOAT_ROUGHNESS",!0)}get clearCoatRoughnessMap(){return this.shader.getTexture("clearCoatRoughnessMap")}set clearcoatColor(e){this.shader.setUniformColor("clearcoatColor",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatColor(){return this.shader.getUniformColor("clearcoatColor")}set clearcoatWeight(e){this.shader.setUniformFloat("clearcoatWeight",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatWeight(){return this.shader.getUniformFloat("clearcoatWeight")}set clearcoatFactor(e){this.shader.setUniformFloat("clearcoatFactor",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatFactor(){return this.shader.getUniformFloat("clearcoatFactor")}set clearcoatRoughnessFactor(e){this.shader.setUniformFloat("clearcoatRoughnessFactor",e),this.shader.setDefine("USE_CLEARCOAT",!0)}get clearcoatRoughnessFactor(){return this.shader.getUniformFloat("clearcoatRoughnessFactor")}set ior(e){this.shader.setUniformFloat("clearcoatIor",e)}get ior(){return this.shader.getUniformFloat("clearcoatIor")}set alphaCutoff(e){this.shader.setUniform("alphaCutoff",e)}get alphaCutoff(){return this.shader.getUniform("alphaCutoff")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}get roughness(){return this.shader.getUniformFloat("roughness")}set roughness(e){this.shader.setUniformFloat("roughness",e)}get metallic(){return this.shader.getUniformFloat("metallic")}set metallic(e){this.shader.setUniformFloat("metallic",e)}get emissiveColor(){return this.shader.getUniformColor("emissiveColor")}set emissiveColor(e){this.shader.setUniformColor("emissiveColor",e)}get emissiveIntensity(){return this.shader.getUniformFloat("emissiveIntensity")}set emissiveIntensity(e){this.shader.setUniformFloat("emissiveIntensity",e)}get ao(){return this.shader.getUniform("ao")}set ao(e){this.shader.setUniform("ao",e)}}class gf extends st{static format=ze.TEXT;textData="";source_vertices;source_normals;source_tangents;source_textureCoords;matLibs;geometrys;activeGeo;currentObjectName;currentMaterialName;facesMaterialsIndex;mtl;mtlUrl;async parseString(e){return this.source_vertices=[],this.source_normals=[],this.source_tangents=[],this.source_textureCoords=[],this.currentObjectName="default",this.currentMaterialName="",this.matLibs={},this.geometrys={},this.activeGeo=void 0,this.textData=e,await Promise.all([this.parserOBJ(),this.loadMTL()]),this.parser_mesh(),"null"}applyVector2(e,t,a){e>=0&&t[e]&&t[e].length>0?(a.push(t[e][0]),a.push(-t[e][1])):(a.push(0),a.push(0))}applyVector3(e,t,a){e>=0&&t[e]&&t[e].length>0?(a.push(t[e][0]),a.push(t[e][1]),a.push(t[e][2])):(a.push(0),a.push(0),a.push(0))}applyVector4(e,t,a){a.push(t[e][0]),a.push(t[e][1]),a.push(t[e][2]),a.push(t[e][3])}parseUVIndex(e,t){const a=parseInt(e,10);return a>=0?a-1:t+a}parseVertexIndex(e,t){const a=parseInt(e,10);return a>=0?a-1:t+a}parseNormalIndex(e,t){const a=parseInt(e,10);return a>=0?a-1:t+a}calculateFaceNormal(e,t,a){const r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=[a[0]-e[0],a[1]-e[1],a[2]-e[2]],n=[r[1]*i[2]-r[2]*i[1],r[2]*i[0]-r[0]*i[2],r[0]*i[1]-r[1]*i[0]],o=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);return o>0&&(n[0]/=o,n[1]/=o,n[2]/=o),n}async loadMTL(){let t=await new pt().loadTxt(this.baseUrl+this.mtlUrl),a=t.data,r,i=a.split(/\r?\n/);for(let c=0;c<i.length;c++){let f=i[c];var n=f.indexOf("#");n!=-1&&(f=f.substring(0,n)),f=f.trim();var o=f.split(/\s+/);o[0]==="newmtl"?(r={name:o[1]},this.matLibs[o[1]]=r):o[0].indexOf("map_")!=-1?(r[o[0]]=o[1],r.textures||(r.textures=[o[o.length-1]]),r.textures.push(o[o.length-1])):o.length==2?r[o[0]]=Number(o[1]):o.length==3?r[o[0]]=[Number(o[1]),Number(o[2])]:o.length==4&&(r[o[0]]=[Number(o[1]),Number(o[2]),Number(o[3])])}const l=[];for(const c in this.matLibs){const f=this.matLibs[c];if(f.textures&&f.textures.length>0)for(let d=0;d<f.textures.length;d++){const h=Ct.normalizePath(this.baseUrl+f.textures[d]);l.push(m.res.loadTexture(h).catch(b=>(console.error(`Failed to load texture: ${h}`,b),null)))}}return await Promise.all(l),t=null,!0}async load_textures(){}getGeometryKey(e,t){const a=(e??this.currentObjectName??"default")||"default",r=t??this.currentMaterialName??"",i=r.length>0?r:"default";return`${a}::${i}`}ensureActiveGeo(e,t){const a=(e??this.currentObjectName??"default")||"default",r=t??this.currentMaterialName??"",i=this.getGeometryKey(a,r);this.geometrys[i]?this.geometrys[i].source_mat!==r&&(this.geometrys[i].source_mat=r):this.geometrys[i]={type:a,name:i,source_mat:r,source_faces:[]},this.activeGeo=this.geometrys[i]}parserLine(e){var t=e.indexOf("#");if(t!=-1){if(e.indexOf("# object")!=-1){const p=e.split(/\s+/),g=p[1]||"default",A=p[2]||"default";this.currentObjectName=A,this.activeGeo=void 0,this.ensureActiveGeo(A,this.currentMaterialName),this.activeGeo&&(this.activeGeo.type=g)}e=e.substring(0,t)}e=e.trim();var a=e.split(/\s+/);if(a[0]==="v"){var r=[Number(a[1]),Number(a[2]),Number(a[3]),a[4]?1:Number(a[4])];this.source_vertices.push(r)}else if(a[0]==="vt"){var i=[Number(a[1]),Number(a[2]),a[3]?1:Number(a[3])];this.source_textureCoords.push(i)}else if(a[0]==="vn"){var n=[Number(a[1]),Number(a[2]),Number(a[3])];this.source_normals.push(n)}else if(a[0]==="f"){for(var o={indices:[],texture:[],normal:[]},l=1;l<a.length;++l){var c=a[l];if(c.length!==0){var f=c.split("/"),d=f[0]||"",h=f.length>=2&&f[1]||"",b=f.length>=3&&f[2]||"";d.length!==0&&(o.indices.push(d),o.texture.push(h),o.normal.push(b))}}this.ensureActiveGeo(),this.activeGeo.source_faces.push(o)}else a[0]==="usemtl"?(this.currentMaterialName=a[1]||"",this.ensureActiveGeo(this.currentObjectName,this.currentMaterialName)):a[0]==="mtllib"&&(this.mtlUrl=a[1])}async parserOBJ(){let e=this.textData.split(/\r?\n/);for(let t=0;t<e.length;t++){const a=e[t];this.parserLine(a)}return this.textData="",!0}async parser_mesh(){let e=new ee;for(const t in this.geometrys){const a=this.geometrys[t];a.vertex_arr=[],a.normal_arr=[],a.uv_arr=[],a.indeice_arr=[];let r=0;const i=this.source_vertices.length,n=this.source_normals.length,o=this.source_textureCoords.length;for(let p=0;p<a.source_faces.length;p++){const g=a.source_faces[p];let A=this.parseVertexIndex(g.indices[0],i),D=this.parseVertexIndex(g.indices[1],i),_=this.parseVertexIndex(g.indices[2],i);const U=L=>{if(!L||L.length===0)return-1;const X=this.parseNormalIndex(L,n);return Number.isFinite(X)&&X>=0&&X<n?X:-1},v=L=>{if(!L||L.length===0)return-1;const X=this.parseUVIndex(L,o);return Number.isFinite(X)&&X>=0&&X<o?X:-1};let x=U(g.normal[0]),C=U(g.normal[1]),F=U(g.normal[2]);const w=x<0||C<0||F<0;let S=null;w&&A>=0&&D>=0&&_>=0&&this.source_vertices[A]&&this.source_vertices[D]&&this.source_vertices[_]&&(S=this.calculateFaceNormal(this.source_vertices[A],this.source_vertices[D],this.source_vertices[_]));let M=v(g.texture[0]),T=v(g.texture[1]),Q=v(g.texture[2]);if(this.applyVector3(A,this.source_vertices,a.vertex_arr),x>=0?this.applyVector3(x,this.source_normals,a.normal_arr):S?a.normal_arr.push(S[0],S[1],S[2]):a.normal_arr.push(0,0,0),M>=0?this.applyVector2(M,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(D,this.source_vertices,a.vertex_arr),C>=0?this.applyVector3(C,this.source_normals,a.normal_arr):S?a.normal_arr.push(S[0],S[1],S[2]):a.normal_arr.push(0,0,0),T>=0?this.applyVector2(T,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(_,this.source_vertices,a.vertex_arr),F>=0?this.applyVector3(F,this.source_normals,a.normal_arr):S?a.normal_arr.push(S[0],S[1],S[2]):a.normal_arr.push(0,0,0),Q>=0?this.applyVector2(Q,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,g.indices.length>3){let L=this.parseVertexIndex(g.indices[3],i),X=U(g.normal[3]),ie=v(g.texture[3]),q=null;(x<0||F<0||X<0)&&A>=0&&_>=0&&L>=0&&this.source_vertices[A]&&this.source_vertices[_]&&this.source_vertices[L]&&(q=this.calculateFaceNormal(this.source_vertices[A],this.source_vertices[_],this.source_vertices[L])),this.applyVector3(A,this.source_vertices,a.vertex_arr),x>=0?this.applyVector3(x,this.source_normals,a.normal_arr):q?a.normal_arr.push(q[0],q[1],q[2]):a.normal_arr.push(0,0,0),M>=0?this.applyVector2(M,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(_,this.source_vertices,a.vertex_arr),F>=0?this.applyVector3(F,this.source_normals,a.normal_arr):q?a.normal_arr.push(q[0],q[1],q[2]):a.normal_arr.push(0,0,0),Q>=0?this.applyVector2(Q,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++,this.applyVector3(L,this.source_vertices,a.vertex_arr),X>=0?this.applyVector3(X,this.source_normals,a.normal_arr):q?a.normal_arr.push(q[0],q[1],q[2]):a.normal_arr.push(0,0,0),ie>=0?this.applyVector2(ie,this.source_textureCoords,a.uv_arr):a.uv_arr.push(0,0),a.indeice_arr[r]=r++}}let l=new Ee;l.setIndices(new Uint32Array(a.indeice_arr)),l.setAttribute(V.position,new Float32Array(a.vertex_arr)),l.setAttribute(V.normal,new Float32Array(a.normal_arr)),l.setAttribute(V.uv,new Float32Array(a.uv_arr)),l.setAttribute(V.TEXCOORD_1,new Float32Array(a.uv_arr)),l.addSubGeometry({indexStart:0,indexCount:a.indeice_arr.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let c=new ka;const f=a.source_mat,d=f?this.matLibs[f]:void 0;if(d&&d.map_Kd){const p=Ct.normalizePath(this.baseUrl+d.map_Kd),g=m.res.getTexture(p);g&&(c.baseMap=g)}let h=new ee,b=h.addComponent($);b.geometry=l,b.material=c,e.addChild(h)}this.data=e}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}}let pf=`
|
|
7276
7276
|
struct ImageSize {
|
|
7277
7277
|
srcWidth: i32,
|
|
7278
7278
|
srcHeight: i32,
|
|
@@ -7670,7 +7670,7 @@ else if (typeof exports === 'object')
|
|
|
7670
7670
|
var oc:vec4<f32> = multiSample(worldDirection, blurSetting.x);
|
|
7671
7671
|
textureStore(outputBuffer0, coord, i32(GlobalInvocationID.z), oc);
|
|
7672
7672
|
}
|
|
7673
|
-
`;class xf{static configBuffer=null;static quaternionBuffer=null;static blurSettingBuffer=null;static pipeline;static importantSample(e,t,a,r){const i=k.device;this.pipeline==null&&(this.pipeline=i.createComputePipeline({layout:"auto",compute:{module:i.createShaderModule({code:Uf}),entryPoint:"main"}}));const n=this.pipeline,o=16;this.configBuffer||=i.createBuffer({size:o,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),i.queue.writeBuffer(this.configBuffer,0,new Uint32Array([e.width,e.height,t,t]));const l=24;if(!this.quaternionBuffer){this.quaternionBuffer=i.createBuffer({size:l*4*6,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});let A=new Float32Array(24);for(let D=0;D<6;D++){let _=ao.getRotationToFace(D);A[D*4+0]=_.x,A[D*4+1]=_.y,A[D*4+2]=_.z,A[D*4+3]=_.w}i.queue.writeBuffer(this.quaternionBuffer,0,A)}this.blurSettingBuffer||=i.createBuffer({size:o,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),i.queue.writeBuffer(this.blurSettingBuffer,0,new Float32Array([a,0,0,0]));const c=e.erpTexture;let f=[{binding:0,resource:{buffer:this.configBuffer,size:16}},{binding:1,resource:{buffer:this.quaternionBuffer,size:l*4}},{binding:2,resource:c.gpuSampler},{binding:3,resource:c.getGPUView()}],d=[{binding:0,resource:{buffer:this.blurSettingBuffer,size:16}},{binding:1,resource:r}];const h=i.createBindGroup({layout:n.getBindGroupLayout(0),entries:f}),b=i.createBindGroup({layout:n.getBindGroupLayout(1),entries:d}),p=y.beginCommandEncoder(),g=p.beginComputePass();g.setPipeline(n),g.setBindGroup(0,h),g.setBindGroup(1,b),g.dispatchWorkgroups(t/8,t/8,6),g.end(),y.endCommandEncoder(p)}}class no{faceTextureRef;_texture;constructor(e){this._texture=e,this.faceTextureRef={}}uploadTexture(e,t){let a=this.getGpuSource(e);return Tt.makeTextureCube(t,this._texture.width,a.v),this}uploadErpTexture(e){let t=this.getGpuSource(0);return Tt.makeTextureCube(e,this._texture.width,t.v),this.generateMipmap(e),this}getGpuSource(e){let t=this.faceTextureRef[e];return t||(t={t:this._texture.getGPUTexture(),v:this._texture.getGPUTexture().createView({format:this._texture.format,dimension:"2d-array",baseMipLevel:e,mipLevelCount:1,arrayLayerCount:6})},this.faceTextureRef[e]=t),t}generateMipmap(e){let t=1;for(;t<this._texture.mipmapCount;)this.generateMipmapAtLevel(t,e),t++}generateMipmapAtLevel(e,t,a=3){let r=this._texture.width/Math.pow(2,e),i={width:r,height:r,erpTexture:t},n=(e+1)/this._texture.mipmapCount;n=Math.pow(n,a);let o=this.getGpuSource(e);xf.importantSample(i,r,n,o.v)}}class xs extends Us{_url;_faceData;constructor(){super(),this.useMipmap=!0,this.format=Y.rgba16float,this.isHDRTexture=!0,this._faceData=new no(this)}createFromHDRData(e,t){let a=new Ae(t.width,t.height,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),r=new Float32Array(t.array);return Tt.convertRGBE2RGBA(a,r),this.createFromTexture(e,a),this}createFromTexture(e,t){this.width=this.height=e,this.textureBindingLayout.viewDimension="cube";let a=this.width;for(this.mipmapCount=1;a>16;)a/=2,this.mipmapCount++;return this.createTextureDescriptor(e,e,this.mipmapCount,this.format),this.textureDescriptor.size={width:e,height:e,depthOrArrayLayers:6},this.textureDescriptor.dimension="2d",this.gpuSampler=k.device.createSampler(this),this._faceData.uploadErpTexture(t),this}async load(e,t){return this._url=e,(await new pt().load(e,so,t)).getCubeTexture()}}function yf(s){return new TextDecoder().decode(s)}class ys{buffer;binOffset;binLength;header;constructor(e,t,a,r){this.buffer=e,this.binOffset=t+a,this.binLength=r;let i=null;if(a!==0){const n=new Uint8Array(e,t,a);i=JSON.parse(yf(n))}else i={};this.header=i}getKeys(){return Object.keys(this.header)}getData(e,t,a=null,r=null){const i=this.header;if(!(e in i))return null;const n=i[e];if(n instanceof Object){if(Array.isArray(n))return n;{const{buffer:o,binOffset:l,binLength:c}=this,f=n.byteOffset||0,d=n.type||r,h=n.componentType||a;if("type"in n&&r&&n.type!==r)throw new Error("FeatureTable: Specified type does not match expected type.");let b;switch(d){case"SCALAR":b=1;break;case"VEC2":b=2;break;case"VEC3":b=3;break;case"VEC4":b=4;break;default:throw new Error(`FeatureTable : Feature type not provided for "${e}".`)}let p;const g=l+f,A=t*b;switch(h){case"BYTE":p=new Int8Array(o,g,A);break;case"UNSIGNED_BYTE":p=new Uint8Array(o,g,A);break;case"SHORT":p=new Int16Array(o,g,A);break;case"UNSIGNED_SHORT":p=new Uint16Array(o,g,A);break;case"INT":p=new Int32Array(o,g,A);break;case"UNSIGNED_INT":p=new Uint32Array(o,g,A);break;case"FLOAT":p=new Float32Array(o,g,A);break;case"DOUBLE":p=new Float64Array(o,g,A);break;default:throw new Error(`FeatureTable : Feature component type not provided for "${e}".`)}if(g+A*p.BYTES_PER_ELEMENT>l+c)throw new Error("FeatureTable: Feature data read outside binary body length.");return p}}else return n}}class oo extends ys{batchSize;constructor(e,t,a,r,i){super(e,a,r,i),this.batchSize=t}getData(e,t=null,a=null){return super.getData(e,this.batchSize,t,a)}}function lo(s){let e;if(s instanceof DataView?e=s:e=new DataView(s),String.fromCharCode(e.getUint8(0))==="{")return null;let t="";for(let a=0;a<4;a++)t+=String.fromCharCode(e.getUint8(a));return t}class Cf{async parse(e){const t=new DataView(e),a=lo(t);console.assert(a==="b3dm");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const n=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,d=new ys(e,f,n,o),h=f+n+o,b=new oo(e,d.getData("BATCH_LENGTH"),h,l,c),p=h+l+c,g=new Uint8Array(e,p,i-p);return{version:r,featureTable:d,batchTable:b,glbBytes:g}}}class Ga extends Cf{adjustmentTransform;gltfBuffer;static tempMatrix;constructor(){super(),this.adjustmentTransform=new E().identity(),Ga.tempMatrix||=new E().identity()}async parse(e){const t=await super.parse(e);this.gltfBuffer=t.glbBytes.slice().buffer;let r=await new ho().parseBinary(this.gltfBuffer),{batchTable:i,featureTable:n}=t;const o=n.getData("RTC_CENTER");o&&(r.x+=o[0],r.y+=o[1],r.z+=o[2]);let l=r.getComponent(Qt);l.updateWorldMatrix();let c=Ga.tempMatrix;c.compose(l.localPosition,l.localRotQuat,l.localScale),c.multiply(this.adjustmentTransform);let f=c.decompose(jt.QUATERNION);return l.localRotQuat.copyFrom(f[1]),l.localRotQuat=l.localRotQuat,l.localPosition.copyFrom(f[0]),l.localPosition=l.localPosition,l.localScale.copyFrom(f[2]),l.localScale=l.localScale,l.updateWorldMatrix(),r.batchTable=i,r.featureTable=n,r}static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let a=0,r=e.length;a<r;a++)t+=String.fromCharCode(e[a]);try{return decodeURIComponent(escape(t))}catch{return t}}}class co extends st{static format=ze.BIN;async parseBuffer(e){let t=new Ga;this.userData&&(t.adjustmentTransform=this.userData),this.data=await t.parse(e)}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}}const Sf="glTF",Si=12,Ff={JSON:1313821514,BIN:5130562},fo={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class kf{name;content;body;header;constructor(e){this.name=fo.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Si);if(this.header={magic:Ga.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Sf)throw new Error("GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("GLTFLoader: Legacy binary file detected.");const a=this.header.length-Si,r=new DataView(e,Si);let i=0;for(;i<a;){const n=r.getUint32(i,!0);i+=4;const o=r.getUint32(i,!0);if(i+=4,o===Ff.JSON){const l=new Uint8Array(e,Si+i,n);this.content=Ga.decodeText(l)}else if(o===Ff.BIN){const l=Si+i;this.body=e.slice(l,l+n)}i+=n}if(this.content===null)throw new Error("GLTFLoader: JSON content not found.")}}class ho{_binary;async parseBinary(e){this._binary=e;const t=Ga.decodeText(new Uint8Array(this._binary,0,4)),a={};let r,i;if(t===Sf){try{i=a[fo.KHR_BINARY_GLTF]=new kf(this._binary)}catch{return}r=a[fo.KHR_BINARY_GLTF].content}else r=Ga.decodeText(new Uint8Array(this._binary));const n=JSON.parse(r);return await this.parseGLB(n,i.body)}async parseGLB(e,t){return await new eo().parseJsonAndBuffer(e,t)}}class Ef{async parse(e){const t=new DataView(e),a=lo(t);console.assert(a==="i3dm");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const n=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0);t.getUint32(28,!0);const f=32,d=new ys(e,f,n,o),h=f+n+o,b=new oo(e,d.getData("INSTANCES_LENGTH"),h,l,c),p=h+l+c,g=new Uint8Array(e,p,i-p);return{version:r,featureTable:d,batchTable:b,glbBytes:g}}}class wf extends ee{_geometry;_material;_instanceList;constructor(e,t,a){super(),this._geometry=e,this._material=t,this._instanceList=[];for(let r=0;r<a;r++){let i,n=new ee;i=n.addComponent($),i.geometry=this._geometry,i.material=this._material,this.addChild(n),this._instanceList.push(n)}}setMatrixAt(e,t){let a=this._instanceList[e],r=t.decompose(jt.QUATERNION),i=a.transform;return i.localRotQuat.copyFrom(r[1]),i.localRotQuat=i.localRotQuat,i.localPosition.copyFrom(r[0]),i.localPosition=i.localPosition,i.localScale.copyFrom(r[2]),i.localScale=i.localScale,this}}class da extends Ef{static tempFwd;static tempUp;static tempRight;static tempPos;static tempQuat;static tempSca;static tempMat;adjustmentTransform;_gltfBuffer;constructor(){super(),da.tempFwd||=new u,da.tempUp||=new u,da.tempRight||=new u,da.tempPos||=new u,da.tempQuat||=new j,da.tempSca||=new u,da.tempMat||=new E,this.adjustmentTransform=new E().identity()}async parse(e){const t=await super.parse(e);this._gltfBuffer=t.glbBytes.slice().buffer;let r=await new ho().parseBinary(this._gltfBuffer),{batchTable:i,featureTable:n}=t;const o=this.adjustmentTransform,l=n.getData("INSTANCES_LENGTH"),c=n.getData("POSITION",l,"FLOAT","VEC3"),f=n.getData("NORMAL_UP",l,"FLOAT","VEC3"),d=n.getData("NORMAL_RIGHT",l,"FLOAT","VEC3"),h=n.getData("SCALE_NON_UNIFORM",l,"FLOAT","VEC3"),b=n.getData("SCALE",l,"FLOAT","SCALAR"),p=new Map,g=[];r.traverse(_=>{let U;if(U=_?_.getComponent($):null,U){const{geometry:v,material:x}=U,C=new wf(v,x,l);C.localPosition=C.localPosition.copy(_.localPosition),C.localRotation=C.localRotation.copy(_.localRotation),C.localScale=C.localScale.copy(_.localScale),g.push(C),p.set(_,C)}});const A=new u;for(let _=0;_<l;_++)A.x+=c[_*3+0]/l,A.y+=c[_*3+1]/l,A.z+=c[_*3+2]/l;p.forEach((_,U)=>{const v=U.parent?U.parentObject:null;v&&(v.removeChild(U),v.addChild(_),_.transform.updateWorldMatrix(),_.transform.worldMatrix.transformVector4(A,_.localPosition))});const D=da;for(let _=0;_<l;_++){D.tempMat.identity(),D.tempPos.set(c[_*3+0]-A.x,c[_*3+1]-A.y,c[_*3+2]-A.z),f?(D.tempUp.set(f[_*3+0],f[_*3+1],f[_*3+2]),D.tempRight.set(d[_*3+0],d[_*3+1],d[_*3+2]),D.tempRight.crossProduct(D.tempUp,D.tempFwd).normalize(),D.tempMat.makeBasis(D.tempRight,D.tempUp,D.tempFwd),D.tempQuat.setFromRotationMatrix(D.tempMat)):D.tempQuat.set(0,0,0,1),b?D.tempSca.setScalar(b[_]):h?D.tempSca.set(h[_*3+0],h[_*3+1],h[_*3+2]):D.tempSca.set(1,1,1),D.tempMat.compose(D.tempPos,D.tempQuat,D.tempSca),D.tempMat.multiplyMatrices(D.tempMat,o);for(let U=0,v=g.length;U<v;U++)g[U].setMatrixAt(_,D.tempMat)}return r.batchTable=i,r.featureTable=n,r}}class Rf extends st{static format=ze.BIN;async parseBuffer(e){let t=new da;t.adjustmentTransform=this.userData,this.data=await t.parse(e)}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}}class Cs extends Us{_faceData;_url;get ldrImageUrl(){return this._url}constructor(){super(),this.useMipmap=!0,this.format=Y.rgba16float,this._faceData=new no(this)}async load(e,t){this._url=e;let a=new Va(!1);return await a.load(e,t),this.createFromLDRTexture(a),this}createFromLDRTexture(e){let t=Math.log2(e.width/4);return t=Math.pow(2,Math.round(t)),this.createFromTexture(t,e),this}createFromTexture(e,t){this.width=this.height=e,this.textureBindingLayout.viewDimension="cube";let a=this.width;for(this.mipmapCount=1;a>16;)a/=2,this.mipmapCount++;return this.createTextureDescriptor(e,e,this.mipmapCount,this.format),this.textureDescriptor.size={width:e,height:e,depthOrArrayLayers:6},this.textureDescriptor.dimension="2d",this.gpuSampler=k.device.createSampler(this),this._faceData.uploadErpTexture(t),this}}let If=`
|
|
7673
|
+
`;class xf{static configBuffer=null;static quaternionBuffer=null;static blurSettingBuffer=null;static pipeline;static importantSample(e,t,a,r){const i=k.device;this.pipeline==null&&(this.pipeline=i.createComputePipeline({layout:"auto",compute:{module:i.createShaderModule({code:Uf}),entryPoint:"main"}}));const n=this.pipeline,o=16;this.configBuffer||=i.createBuffer({size:o,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),i.queue.writeBuffer(this.configBuffer,0,new Uint32Array([e.width,e.height,t,t]));const l=24;if(!this.quaternionBuffer){this.quaternionBuffer=i.createBuffer({size:l*4*6,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});let A=new Float32Array(24);for(let D=0;D<6;D++){let _=ao.getRotationToFace(D);A[D*4+0]=_.x,A[D*4+1]=_.y,A[D*4+2]=_.z,A[D*4+3]=_.w}i.queue.writeBuffer(this.quaternionBuffer,0,A)}this.blurSettingBuffer||=i.createBuffer({size:o,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),i.queue.writeBuffer(this.blurSettingBuffer,0,new Float32Array([a,0,0,0]));const c=e.erpTexture;let f=[{binding:0,resource:{buffer:this.configBuffer,size:16}},{binding:1,resource:{buffer:this.quaternionBuffer,size:l*4}},{binding:2,resource:c.gpuSampler},{binding:3,resource:c.getGPUView()}],d=[{binding:0,resource:{buffer:this.blurSettingBuffer,size:16}},{binding:1,resource:r}];const h=i.createBindGroup({layout:n.getBindGroupLayout(0),entries:f}),b=i.createBindGroup({layout:n.getBindGroupLayout(1),entries:d}),p=y.beginCommandEncoder(),g=p.beginComputePass();g.setPipeline(n),g.setBindGroup(0,h),g.setBindGroup(1,b),g.dispatchWorkgroups(t/8,t/8,6),g.end(),y.endCommandEncoder(p)}}class no{faceTextureRef;_texture;constructor(e){this._texture=e,this.faceTextureRef={}}uploadTexture(e,t){let a=this.getGpuSource(e);return Tt.makeTextureCube(t,this._texture.width,a.v),this}uploadErpTexture(e){let t=this.getGpuSource(0);return Tt.makeTextureCube(e,this._texture.width,t.v),this.generateMipmap(e),this}getGpuSource(e){let t=this.faceTextureRef[e];return t||(t={t:this._texture.getGPUTexture(),v:this._texture.getGPUTexture().createView({format:this._texture.format,dimension:"2d-array",baseMipLevel:e,mipLevelCount:1,arrayLayerCount:6})},this.faceTextureRef[e]=t),t}generateMipmap(e){let t=1;for(;t<this._texture.mipmapCount;)this.generateMipmapAtLevel(t,e),t++}generateMipmapAtLevel(e,t,a=3){let r=this._texture.width/Math.pow(2,e),i={width:r,height:r,erpTexture:t},n=(e+1)/this._texture.mipmapCount;n=Math.pow(n,a);let o=this.getGpuSource(e);xf.importantSample(i,r,n,o.v)}}class xs extends Us{_url;_faceData;constructor(){super(),this.useMipmap=!0,this.format=Y.rgba16float,this.isHDRTexture=!0,this._faceData=new no(this)}createFromHDRData(e,t){let a=new Ae(t.width,t.height,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),r=new Float32Array(t.array);return Tt.convertRGBE2RGBA(a,r),this.createFromTexture(e,a),this}createFromTexture(e,t){this.width=this.height=e,this.textureBindingLayout.viewDimension="cube";let a=this.width;for(this.mipmapCount=1;a>16;)a/=2,this.mipmapCount++;return this.createTextureDescriptor(e,e,this.mipmapCount,this.format),this.textureDescriptor.size={width:e,height:e,depthOrArrayLayers:6},this.textureDescriptor.dimension="2d",this.gpuSampler=k.device.createSampler(this),this._faceData.uploadErpTexture(t),this}async load(e,t){return this._url=e,(await new pt().load(e,so,t)).getCubeTexture()}}function yf(s){return new TextDecoder().decode(s)}class ys{buffer;binOffset;binLength;header;constructor(e,t,a,r){this.buffer=e,this.binOffset=t+a,this.binLength=r;let i=null;if(a!==0){const n=new Uint8Array(e,t,a);i=JSON.parse(yf(n))}else i={};this.header=i}getKeys(){return Object.keys(this.header)}getData(e,t,a=null,r=null){const i=this.header;if(!(e in i))return null;const n=i[e];if(n instanceof Object){if(Array.isArray(n))return n;{const{buffer:o,binOffset:l,binLength:c}=this,f=n.byteOffset||0,d=n.type||r,h=n.componentType||a;if("type"in n&&r&&n.type!==r)throw new Error("FeatureTable: Specified type does not match expected type.");let b;switch(d){case"SCALAR":b=1;break;case"VEC2":b=2;break;case"VEC3":b=3;break;case"VEC4":b=4;break;default:throw new Error(`FeatureTable : Feature type not provided for "${e}".`)}let p;const g=l+f,A=t*b;switch(h){case"BYTE":p=new Int8Array(o,g,A);break;case"UNSIGNED_BYTE":p=new Uint8Array(o,g,A);break;case"SHORT":p=new Int16Array(o,g,A);break;case"UNSIGNED_SHORT":p=new Uint16Array(o,g,A);break;case"INT":p=new Int32Array(o,g,A);break;case"UNSIGNED_INT":p=new Uint32Array(o,g,A);break;case"FLOAT":p=new Float32Array(o,g,A);break;case"DOUBLE":p=new Float64Array(o,g,A);break;default:throw new Error(`FeatureTable : Feature component type not provided for "${e}".`)}if(g+A*p.BYTES_PER_ELEMENT>l+c)throw new Error("FeatureTable: Feature data read outside binary body length.");return p}}else return n}destroy(){this.buffer=null,this.header=null,this.binOffset=null,this.binLength=null}}class oo extends ys{batchSize;constructor(e,t,a,r,i){super(e,a,r,i),this.batchSize=t}getData(e,t=null,a=null){return super.getData(e,this.batchSize,t,a)}}function lo(s){let e;if(s instanceof DataView?e=s:e=new DataView(s),String.fromCharCode(e.getUint8(0))==="{")return null;let t="";for(let a=0;a<4;a++)t+=String.fromCharCode(e.getUint8(a));return t}class Cf{async parse(e){const t=new DataView(e),a=lo(t);console.assert(a==="b3dm");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const n=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,d=new ys(e,f,n,o),h=f+n+o,b=new oo(e,d.getData("BATCH_LENGTH"),h,l,c),p=h+l+c,g=new Uint8Array(e,p,i-p);return{version:r,featureTable:d,batchTable:b,glbBytes:g}}}class Ga extends Cf{adjustmentTransform;gltfBuffer;static tempMatrix;constructor(){super(),this.adjustmentTransform=new E().identity(),Ga.tempMatrix||=new E().identity()}async parse(e){const t=await super.parse(e);this.gltfBuffer=t.glbBytes.slice().buffer;let r=await new ho().parseBinary(this.gltfBuffer),{batchTable:i,featureTable:n}=t;const o=n.getData("RTC_CENTER");o&&(r.x+=o[0],r.y+=o[1],r.z+=o[2]);let l=r.getComponent(Qt);l.updateWorldMatrix();let c=Ga.tempMatrix;c.compose(l.localPosition,l.localRotQuat,l.localScale),c.multiply(this.adjustmentTransform);let f=c.decompose(jt.QUATERNION);return l.localRotQuat.copyFrom(f[1]),l.localRotQuat=l.localRotQuat,l.localPosition.copyFrom(f[0]),l.localPosition=l.localPosition,l.localScale.copyFrom(f[2]),l.localScale=l.localScale,l.updateWorldMatrix(),r.batchTable=i,r.featureTable=n,r}static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let a=0,r=e.length;a<r;a++)t+=String.fromCharCode(e[a]);try{return decodeURIComponent(escape(t))}catch{return t}}}class co extends st{static format=ze.BIN;async parseBuffer(e){let t=new Ga;this.userData&&(t.adjustmentTransform=this.userData),this.data=await t.parse(e)}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}}const Sf="glTF",Si=12,Ff={JSON:1313821514,BIN:5130562},fo={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class kf{name;content;body;header;constructor(e){this.name=fo.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Si);if(this.header={magic:Ga.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Sf)throw new Error("GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("GLTFLoader: Legacy binary file detected.");const a=this.header.length-Si,r=new DataView(e,Si);let i=0;for(;i<a;){const n=r.getUint32(i,!0);i+=4;const o=r.getUint32(i,!0);if(i+=4,o===Ff.JSON){const l=new Uint8Array(e,Si+i,n);this.content=Ga.decodeText(l)}else if(o===Ff.BIN){const l=Si+i;this.body=e.slice(l,l+n)}i+=n}if(this.content===null)throw new Error("GLTFLoader: JSON content not found.")}}class ho{_binary;async parseBinary(e){this._binary=e;const t=Ga.decodeText(new Uint8Array(this._binary,0,4)),a={};let r,i;if(t===Sf){try{i=a[fo.KHR_BINARY_GLTF]=new kf(this._binary)}catch{return}r=a[fo.KHR_BINARY_GLTF].content}else r=Ga.decodeText(new Uint8Array(this._binary));const n=JSON.parse(r);return await this.parseGLB(n,i.body)}async parseGLB(e,t){return await new eo().parseJsonAndBuffer(e,t)}}class Ef{async parse(e){const t=new DataView(e),a=lo(t);console.assert(a==="i3dm");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const n=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0);t.getUint32(28,!0);const f=32,d=new ys(e,f,n,o),h=f+n+o,b=new oo(e,d.getData("INSTANCES_LENGTH"),h,l,c),p=h+l+c,g=new Uint8Array(e,p,i-p);return{version:r,featureTable:d,batchTable:b,glbBytes:g}}}class wf extends ee{_geometry;_material;_instanceList;constructor(e,t,a){super(),this._geometry=e,this._material=t,this._instanceList=[];for(let r=0;r<a;r++){let i,n=new ee;i=n.addComponent($),i.geometry=this._geometry,i.material=this._material,this.addChild(n),this._instanceList.push(n)}}setMatrixAt(e,t){let a=this._instanceList[e],r=t.decompose(jt.QUATERNION),i=a.transform;return i.localRotQuat.copyFrom(r[1]),i.localRotQuat=i.localRotQuat,i.localPosition.copyFrom(r[0]),i.localPosition=i.localPosition,i.localScale.copyFrom(r[2]),i.localScale=i.localScale,this}}class da extends Ef{static tempFwd;static tempUp;static tempRight;static tempPos;static tempQuat;static tempSca;static tempMat;adjustmentTransform;_gltfBuffer;constructor(){super(),da.tempFwd||=new u,da.tempUp||=new u,da.tempRight||=new u,da.tempPos||=new u,da.tempQuat||=new j,da.tempSca||=new u,da.tempMat||=new E,this.adjustmentTransform=new E().identity()}async parse(e){const t=await super.parse(e);this._gltfBuffer=t.glbBytes.slice().buffer;let r=await new ho().parseBinary(this._gltfBuffer),{batchTable:i,featureTable:n}=t;const o=this.adjustmentTransform,l=n.getData("INSTANCES_LENGTH"),c=n.getData("POSITION",l,"FLOAT","VEC3"),f=n.getData("NORMAL_UP",l,"FLOAT","VEC3"),d=n.getData("NORMAL_RIGHT",l,"FLOAT","VEC3"),h=n.getData("SCALE_NON_UNIFORM",l,"FLOAT","VEC3"),b=n.getData("SCALE",l,"FLOAT","SCALAR"),p=new Map,g=[];r.traverse(_=>{let U;if(U=_?_.getComponent($):null,U){const{geometry:v,material:x}=U,C=new wf(v,x,l);C.localPosition=C.localPosition.copy(_.localPosition),C.localRotation=C.localRotation.copy(_.localRotation),C.localScale=C.localScale.copy(_.localScale),g.push(C),p.set(_,C)}});const A=new u;for(let _=0;_<l;_++)A.x+=c[_*3+0]/l,A.y+=c[_*3+1]/l,A.z+=c[_*3+2]/l;p.forEach((_,U)=>{const v=U.parent?U.parentObject:null;v&&(v.removeChild(U),v.addChild(_),_.transform.updateWorldMatrix(),_.transform.worldMatrix.transformVector4(A,_.localPosition))});const D=da;for(let _=0;_<l;_++){D.tempMat.identity(),D.tempPos.set(c[_*3+0]-A.x,c[_*3+1]-A.y,c[_*3+2]-A.z),f?(D.tempUp.set(f[_*3+0],f[_*3+1],f[_*3+2]),D.tempRight.set(d[_*3+0],d[_*3+1],d[_*3+2]),D.tempRight.crossProduct(D.tempUp,D.tempFwd).normalize(),D.tempMat.makeBasis(D.tempRight,D.tempUp,D.tempFwd),D.tempQuat.setFromRotationMatrix(D.tempMat)):D.tempQuat.set(0,0,0,1),b?D.tempSca.setScalar(b[_]):h?D.tempSca.set(h[_*3+0],h[_*3+1],h[_*3+2]):D.tempSca.set(1,1,1),D.tempMat.compose(D.tempPos,D.tempQuat,D.tempSca),D.tempMat.multiplyMatrices(D.tempMat,o);for(let U=0,v=g.length;U<v;U++)g[U].setMatrixAt(_,D.tempMat)}return r.batchTable=i,r.featureTable=n,r}}class Rf extends st{static format=ze.BIN;async parseBuffer(e){let t=new da;t.adjustmentTransform=this.userData,this.data=await t.parse(e)}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}}class Cs extends Us{_faceData;_url;get ldrImageUrl(){return this._url}constructor(){super(),this.useMipmap=!0,this.format=Y.rgba16float,this._faceData=new no(this)}async load(e,t){this._url=e;let a=new Va(!1);return await a.load(e,t),this.createFromLDRTexture(a),this}createFromLDRTexture(e){let t=Math.log2(e.width/4);return t=Math.pow(2,Math.round(t)),this.createFromTexture(t,e),this}createFromTexture(e,t){this.width=this.height=e,this.textureBindingLayout.viewDimension="cube";let a=this.width;for(this.mipmapCount=1;a>16;)a/=2,this.mipmapCount++;return this.createTextureDescriptor(e,e,this.mipmapCount,this.format),this.textureDescriptor.size={width:e,height:e,depthOrArrayLayers:6},this.textureDescriptor.dimension="2d",this.gpuSampler=k.device.createSampler(this),this._faceData.uploadErpTexture(t),this}}let If=`
|
|
7674
7674
|
var<private>PI: f32 = 3.141592653589793;
|
|
7675
7675
|
|
|
7676
7676
|
fn hammersley(i : u32, N : u32) -> vec2<f32>{
|
|
@@ -7762,7 +7762,7 @@ else if (typeof exports === 'object')
|
|
|
7762
7762
|
`;class Qf{compute;constructor(){this.compute=new fe(If)}generateBRDFLUTTexture(){let e=new Ae(256,256,Y.rgba8unorm,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING);this.compute.setStorageTexture("brdflutTexture",e),this.compute.workerSizeX=256/8,this.compute.workerSizeY=256/8;let t=y.beginCommandEncoder();return y.computeCommand(t,[this.compute]),y.endCommandEncoder(t),e}}class ri{id;guiTexture;uvRec=new te(0,0,1,1);uvBorder=new te(0,0,0,0);offsetSize=new te(0,0,4,4);borderSize=new te(0,0,0,0);trimSize=new K;isSliced=!1;height=4;width=4;xadvance=0;xoffset=0;yoffset=0;constructor(e){this.guiTexture=e||m.res.defaultGUITexture}}class mr{static _maxUid=-1;_staticId=-1;dynamicId=-1;texture;width=1;height=1;get staticId(){return this._staticId}constructor(e){e||=m.res.whiteTexture,e.addressModeU="clamp-to-edge",e.addressModeV="clamp-to-edge",this.texture=e,mr._maxUid++,this._staticId=mr._maxUid,this.init()}init(){this.dynamicId=-1,this.width=this.texture.width,this.height=this.texture.height}}class tb{fntCache={};fntData={};addFontData(e,t,a){this.fntData[`${e}${t}`]=a}getFontData(e,t){return this.fntData[`${e}${t}`]}addFnt(e,t,a,r){let i=`${e}${t}`;this.fntCache[i]||(this.fntCache[i]={}),this.fntCache[i][a]=r}getFnt(e,t,a){let r=`${e}${t}`,i=this.fntCache[r];return i?i[a]:this.fntCache[" "]}}let ii=new tb;class Tf{face="";size=0;bold=!1;italic=!1;stretchH=0;spacing="";outline=0;lineHeight=0;base=0;scaleW=0;scaleH=0;pages=0;packed=0;alphaChnl=0;redChnl=0;greenChnl=0;blueChnl=0;count=0;fontPage=[];fontChar={};constructor(){}}class Mf{id=0;file=""}class Nf{id=-1;x=0;y=0;width=0;height=0;xoffset=0;yoffset=0;xadvance=0;page=0;chnl=0}class za extends st{static format=ze.TEXT;static parseSprite(e,t){for(const a in t.fontChar)if(Object.prototype.hasOwnProperty.call(t.fontChar,a)){const r=t.fontChar[a];let i=new ri;i.id=r.id.toString(),i.offsetSize.set(0,0,r.width,r.height),i.trimSize.set(r.width,r.height),i.width=r.width,i.height=r.height,i.xadvance=r.xadvance,i.xoffset=r.xoffset,i.yoffset=r.yoffset,i.guiTexture=e[r.page],i.uvRec.set(r.x/t.scaleW,(t.scaleH-(r.y+r.height))/t.scaleH,r.width/t.scaleW,r.height/t.scaleH),ii.addFnt(t.face,t.size,i.id,i)}}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}async parseString(e){let t=this.getNewLine(e),a=e,r=new Tf;a.trim().split(t).forEach((i,n)=>{if(n<2)za.readLineProperty(i,r);else if(n<r.pages+2){let o=new Mf;za.readLineProperty(i,o),r.fontPage.push(o)}else if(n<r.pages+3)za.readLineProperty(i,r);else if(r.count>0){let o=new Nf;za.readLineProperty(i,o),r.fontChar[o.id]=o,r.count--}}),a="",this.data=r,await this.loadFontTextures()}getNewLine(e){return e.indexOf(`\r
|
|
7763
7763
|
`)!=-1?`\r
|
|
7764
7764
|
`:e.indexOf("\r")!=-1?"\r":`
|
|
7765
|
-
`}async loadFontTextures(){let e=[],t=this.data;for(const a of t.fontPage){let r=this.baseUrl+a.file;await m.res.loadTexture(r,null,!0);let i=m.res.getTexture(r),n=new mr(i);e.push(n)}za.parseSprite(e,t),t.fontChar[" "]||za.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new ri,r=e.size*.5,i=e.lineHeight*.5;a.id=" ",a.offsetSize.set(0,0,e.size,e.size),a.trimSize.set(r,i),a.width=r,a.height=i,a.xadvance=0,a.xoffset=0,a.yoffset=0,a.guiTexture=t,a.uvRec.set(0,0,1e-6,1e-6),ii.addFnt(e.face,e.size,a.id,a)}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let n=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,n)&&(o.indexOf('"')==-1?t[n]=parseFloat(i[1]):t[n]=o.replace('"',"").replace('"',""))}})}}function ab(s,e){let t=new ri;return t.id=s,t.offsetSize.set(0,0,e.width,e.height),t.trimSize.set(e.width,e.height),t.width=e.width,t.height=e.height,t.xadvance=0,t.xoffset=0,t.yoffset=0,t.guiTexture=new mr(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function Vf(s,e,t){let a=new ri;a.guiTexture=s,a.id=e,a.uvRec.copyFrom(t.textureRect),a.trimSize.x=t.textureRect.z,a.trimSize.y=t.textureRect.w,a.offsetSize.x=t.textureRectOffset.x,a.offsetSize.y=t.textureRectOffset.y,a.offsetSize.z=t.size.x,a.offsetSize.w=t.size.y,a.width=t.size.x,a.height=t.size.y;let r=1/s.width,i=1/s.height;a.uvRec.set(a.uvRec.x*r,a.uvRec.y*i,a.uvRec.z*r,a.uvRec.w*i);let n=.1;return t.border.x<=n&&t.border.y<=n&&t.border.z<=n&&t.border.x<=n?a.isSliced=!1:(a.borderSize.copyFrom(t.border),a.uvBorder.copyFrom(t.border),a.uvBorder.x-=t.textureRectOffset.x,a.uvBorder.y-=t.textureRectOffset.y,a.uvBorder.z=t.border.z-(t.size.x-t.textureRect.z-t.textureRectOffset.x),a.uvBorder.w=t.border.w-(t.size.y-t.textureRect.w-t.textureRectOffset.y),a.uvBorder.x/=t.textureRect.z,a.uvBorder.z/=t.textureRect.z,a.uvBorder.y/=t.textureRect.w,a.uvBorder.w/=t.textureRect.w,a.isSliced=!0),a}class Pf{_spriteMap=new Map;_spriteList=[];textureSize=new K;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=Vf(e,t,a);return this._spriteMap.set(r.id,r),this._spriteList.push(r),r}getSprite(e){return this._spriteMap.get(e)}get spriteList(){return this._spriteList}}class Of extends st{static format=ze.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await m.res.loadTexture(t,null,!0),this.data={json:this._json,texture:this._texture},this.parseAtlas()}verification(){if(this.data)return!0;throw new Error("verify failed.")}parseAtlas(){let e=new Pf(this._json.size),t=new mr(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);m.res.addAtlas(this.baseUrl,e),this.data=e}}var Lt=Uint8Array,si=Uint16Array,rb=Int32Array,Lf=new Lt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gf=new Lt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ib=new Lt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zf=function(s,e){for(var t=new si(31),a=0;a<31;++a)t[a]=e+=1<<s[a-1];for(var r=new rb(t[30]),a=1;a<30;++a)for(var i=t[a];i<t[a+1];++i)r[i]=i-t[a]<<5|a;return{b:t,r}},Jf=zf(Lf,2),Wf=Jf.b,sb=Jf.r;Wf[28]=258,sb[258]=28;for(var nb=zf(Gf,0),ob=nb.b,uo=new si(32768),Te=0;Te<32768;++Te){var ir=(Te&43690)>>1|(Te&21845)<<1;ir=(ir&52428)>>2|(ir&13107)<<2,ir=(ir&61680)>>4|(ir&3855)<<4,uo[Te]=((ir&65280)>>8|(ir&255)<<8)>>1}for(var Fi=(function(s,e,t){for(var a=s.length,r=0,i=new si(e);r<a;++r)s[r]&&++i[s[r]-1];var n=new si(e);for(r=1;r<e;++r)n[r]=n[r-1]+i[r-1]<<1;var o;if(t){o=new si(1<<e);var l=15-e;for(r=0;r<a;++r)if(s[r])for(var c=r<<4|s[r],f=e-s[r],d=n[s[r]-1]++<<f,h=d|(1<<f)-1;d<=h;++d)o[uo[d]>>l]=c}else for(o=new si(a),r=0;r<a;++r)s[r]&&(o[r]=uo[n[s[r]-1]++]>>15-s[r]);return o}),ki=new Lt(288),Te=0;Te<144;++Te)ki[Te]=8;for(var Te=144;Te<256;++Te)ki[Te]=9;for(var Te=256;Te<280;++Te)ki[Te]=7;for(var Te=280;Te<288;++Te)ki[Te]=8;for(var Zf=new Lt(32),Te=0;Te<32;++Te)Zf[Te]=5;var lb=Fi(ki,9,1),cb=Fi(Zf,5,1),bo=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},sa=function(s,e,t){var a=e/8|0;return(s[a]|s[a+1]<<8)>>(e&7)&t},go=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},fb=function(s){return(s+7)/8|0},po=function(s,e,t){return(e==null||e<0)&&(e=0),(t==null||t>s.length)&&(t=s.length),new Lt(s.subarray(e,t))},db=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ht=function(s,e,t){var a=new Error(e||db[s]);if(a.code=s,Error.captureStackTrace&&Error.captureStackTrace(a,Ht),!t)throw a;return a},hb=function(s,e,t,a){var r=s.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new Lt(0);var n=!t,o=n||e.i!=2,l=e.i;n&&(t=new Lt(r*3));var c=function(Ft){var kt=t.length;if(Ft>kt){var Nt=new Lt(Math.max(kt*2,Ft));Nt.set(t),t=Nt}},f=e.f||0,d=e.p||0,h=e.b||0,b=e.l,p=e.d,g=e.m,A=e.n,D=r*8;do{if(!b){f=sa(s,d,1);var _=sa(s,d+1,3);if(d+=3,_)if(_==1)b=lb,p=cb,g=9,A=5;else if(_==2){var C=sa(s,d,31)+257,F=sa(s,d+10,15)+4,w=C+sa(s,d+5,31)+1;d+=14;for(var S=new Lt(w),M=new Lt(19),T=0;T<F;++T)M[ib[T]]=sa(s,d+T*3,7);d+=F*3;for(var Q=bo(M),L=(1<<Q)-1,X=Fi(M,Q,1),T=0;T<w;){var ie=X[sa(s,d,L)];d+=ie&15;var U=ie>>4;if(U<16)S[T++]=U;else{var q=0,be=0;for(U==16?(be=3+sa(s,d,3),d+=2,q=S[T-1]):U==17?(be=3+sa(s,d,7),d+=3):U==18&&(be=11+sa(s,d,127),d+=7);be--;)S[T++]=q}}var Ue=S.subarray(0,C),Z=S.subarray(C);g=bo(Ue),A=bo(Z),b=Fi(Ue,g,1),p=Fi(Z,A,1)}else Ht(1);else{var U=fb(d)+4,v=s[U-4]|s[U-3]<<8,x=U+v;if(x>r){l&&Ht(0);break}o&&c(h+v),t.set(s.subarray(U,x),h),e.b=h+=v,e.p=d=x*8,e.f=f;continue}if(d>D){l&&Ht(0);break}}o&&c(h+131072);for(var de=(1<<g)-1,ce=(1<<A)-1,De=d;;De=d){var q=b[go(s,d)&de],_e=q>>4;if(d+=q&15,d>D){l&&Ht(0);break}if(q||Ht(2),_e<256)t[h++]=_e;else if(_e==256){De=d,b=null;break}else{var Ne=_e-254;if(_e>264){var T=_e-257,we=Lf[T];Ne=sa(s,d,(1<<we)-1)+Wf[T],d+=we}var Ce=p[go(s,d)&ce],Me=Ce>>4;Ce||Ht(3),d+=Ce&15;var Z=ob[Me];if(Me>3){var we=Gf[Me];Z+=go(s,d)&(1<<we)-1,d+=we}if(d>D){l&&Ht(0);break}o&&c(h+131072);var ct=h+Ne;if(h<Z){var ga=i-Z,Mt=Math.min(Z,ct);for(ga+h<0&&Ht(3);h<Mt;++h)t[h]=a[ga+h]}for(;h<ct;++h)t[h]=t[h-Z]}}e.l=b,e.p=De,e.b=h,e.f=f,b&&(f=1,e.m=g,e.d=p,e.n=A)}while(!f);return h!=t.length&&n?po(t,0,h):t.subarray(0,h)},ub=new Lt(0),ya=function(s,e){return s[e]|s[e+1]<<8},na=function(s,e){return(s[e]|s[e+1]<<8|s[e+2]<<16|s[e+3]<<24)>>>0},mo=function(s,e){return na(s,e)+na(s,e+4)*4294967296};function bb(s,e){return hb(s,{i:2},e&&e.out,e&&e.dictionary)}var Ao=typeof TextDecoder<"u"&&new TextDecoder,gb=0;try{Ao.decode(ub,{stream:!0}),gb=1}catch{}var pb=function(s){for(var e="",t=0;;){var a=s[t++],r=(a>127)+(a>223)+(a>239);if(t+r>s.length)return{s:e,r:po(s,t-1)};r?r==3?(a=((a&15)<<18|(s[t++]&63)<<12|(s[t++]&63)<<6|s[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):r&1?e+=String.fromCharCode((a&31)<<6|s[t++]&63):e+=String.fromCharCode((a&15)<<12|(s[t++]&63)<<6|s[t++]&63):e+=String.fromCharCode(a)}};function jf(s,e){if(e){for(var t="",a=0;a<s.length;a+=16384)t+=String.fromCharCode.apply(null,s.subarray(a,a+16384));return t}else{if(Ao)return Ao.decode(s);var r=pb(s),i=r.s,t=r.r;return t.length&&Ht(8),i}}var mb=function(s,e){return e+30+ya(s,e+26)+ya(s,e+28)},Ab=function(s,e,t){var a=ya(s,e+28),r=jf(s.subarray(e+46,e+46+a),!(ya(s,e+8)&2048)),i=e+46+a,n=na(s,e+20),o=t&&n==4294967295?Db(s,i):[n,na(s,e+24),na(s,e+42)],l=o[0],c=o[1],f=o[2];return[ya(s,e+10),l,c,r,i+ya(s,e+30)+ya(s,e+32),f]},Db=function(s,e){for(;ya(s,e)!=1;e+=4+ya(s,e+2));return[mo(s,e+12),mo(s,e+4),mo(s,e+20)]};function _b(s,e){for(var t={},a=s.length-22;na(s,a)!=101010256;--a)(!a||s.length-a>65558)&&Ht(13);var r=ya(s,a+8);if(!r)return{};var i=na(s,a+16),n=i==4294967295||r==65535;if(n){var o=na(s,a-12);n=na(s,o)==101075792,n&&(r=na(s,o+32),i=na(s,o+48))}for(var l=0;l<r;++l){var c=Ab(s,i,n),f=c[0],d=c[1],h=c[2],b=c[3],p=c[4],g=c[5],A=mb(s,g);i=p,f?f==8?t[b]=bb(s.subarray(A,A+d),{out:new Lt(h)}):Ht(14,"unknown compression type "+f):t[b]=po(s,A,A+d)}return t}class nt extends mt{constructor(){super(),this.shader=new Oi,this.baseMap=m.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Rr extends Ee{shape_vertices=[];shape_indices=[];radius;widthSegments;heightSegments;phiStart;phiLength;thetaStart;thetaLength;constructor(e,t,a,r,i,n,o){super(),this.radius=e,this.widthSegments=t,this.heightSegments=a,this.phiStart=r,this.phiLength=i,this.thetaStart=n,this.thetaLength=o,this.buildGeometry()}buildGeometry(){var e,t,a=0;let r=this.heightSegments,i=this.widthSegments,n=this.radius;var o=(r+1)*(i+1);let l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d=new Uint16Array(i*r*2*3),h=0,b=0,p=0;for(t=0;t<=r;++t){var g=Math.PI*t/r,A=n*Math.cos(g),D=n*Math.sin(g);for(e=0;e<=i;++e){var _=2*Math.PI*e/i,U=D*Math.cos(_),v=D*Math.sin(_),x=1/Math.sqrt(U*U+A*A+v*v);if(l[h++]=U,l[h++]=A,l[h++]=v,c[b++]=U*x,c[b++]=A*x,c[b++]=v*x,f[p++]=e/i,f[p++]=t/r,e>0&&t>0){var C=(i+1)*t+e,F=(i+1)*t+e-1,w=(i+1)*(t-1)+e-1,S=(i+1)*(t-1)+e;t==r?(d[a++]=C,d[a++]=w,d[a++]=S):t==1?(d[a++]=C,d[a++]=F,d[a++]=w):(d[a++]=C,d[a++]=F,d[a++]=w,d[a++]=C,d[a++]=w,d[a++]=S)}}}this.setIndices(d),this.setAttribute(V.position,l),this.setAttribute(V.normal,c),this.setAttribute(V.uv,f),this.setAttribute(V.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new ge(u.ZERO,new u(this.radius*2,this.radius*2,this.radius*2))}}class os extends ee{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new u(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),os.register3DRepresentation)this.marker=os.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new ee;const e=this.marker.addComponent($);e.geometry=new Rr(.1,32,16),e.material=new nt,e.material.baseColor=this.positionValid?new P(0,1,0,1):new P(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class ls extends ee{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new os(t);this.addChild(a)}this.entityChildren=this.entityChildren.sort((t,a)=>t.positionIndex-a.positionIndex)}setup3DRepresentation(){this.line&&(this.removeChild(this.line),this.line=null),ls.register3DRepresentation?(this.line=ls.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new P(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Ee,r=new Float32Array(e.length*3);for(let c=0;c<e.length;c++)r[c*3]=e[c].x,r[c*3+1]=e[c].y,r[c*3+2]=e[c].z;const i=new Uint16Array((e.length-1)*2);for(let c=0;c<e.length-1;c++)i[c*2]=c,i[c*2+1]=c+1;a.setIndices(i),a.setAttribute(V.position,r),a.addSubGeometry({indexStart:0,indexCount:i.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});const n=new ee,o=n.addComponent($),l=new nt;return l.topology="line-list",l.baseColor=t,l.blendMode=ae.ADD,l.castReflection=!1,o.geometry=a,o.material=l,n}}class Yf extends st{static format=ze.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=_b(new Uint8Array(e));for(const i in a){const n=a[i],l=new DOMParser().parseFromString(jf(n),"application/xml"),c={};this.parseNode(l,c);const f=i.replace("wpmz/","").split(".")[0];Object.assign(t,{[f]:c["#document"].kml.Document})}const r=new ls(t.waylines);this.data=r}catch(t){this.parserError(`KMZ parsing failed: ${t}`,-1)}}parseNode(e,t){const a=["Placemark","actionGroup","action"],r=e.nodeName.replace("wpml:","");if(!e.childNodes.length)t[r]=void 0;else{let i=null,n=!1;for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];if(l.nodeType==Node.TEXT_NODE){const c=l.nodeValue?.trim();c&&c.length>0&&(i=c)}else l.nodeType==Node.ELEMENT_NODE&&(n=!0)}if(i&&!n)t[r]=i;else if(n){a.includes(r)?t[r]?.length?t[r].push({}):t[r]=[{}]:t[r]={};for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];l.nodeType==Node.ELEMENT_NODE&&this.parseNode(l,Array.isArray(t[r])?t[r].at(-1):t[r])}}else t[r]=void 0}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Xf{_texturePool;_materialPool;_prefabPool;_gltfPool;_geometryPool;_atlasList;_obj;constructor(){this._texturePool=new Map,this._materialPool=new Map,this._prefabPool=new Map,this._geometryPool=new Map,this._gltfPool=new Map,this._atlasList=new Map,this._obj=new Map}getGltf(e){return this._gltfPool.get(e)}addObj(e,t){this._obj.set(e,t)}getObj(e){return this._obj.get(e)}addTexture(e,t){this._texturePool.set(e,t)}getTexture(e){return this._texturePool.get(e)}addGeometry(e,t){this._geometryPool.set(e,t)}getGeometry(e){return this._geometryPool.get(e)}addMat(e,t){return this._materialPool.set(e,t)}getMat(e){return this._materialPool.get(e)}addPrefab(e,t){this._prefabPool.set(e,t)}getPrefab(e){return this._prefabPool.get(e).instantiate()}addAtlas(e,t){t.name=e,this._atlasList.set(e,t)}getAtlas(e){return this._atlasList.get(e)}getGUISprite(e){for(let t of this._atlasList.values()){let a=t.getSprite(e);if(a)return a}return null}async load(e,t,a){return(await new pt().load(e,t,a)).data}async loadGltf(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new pt;r==".gltf"?a=await i.load(e,Dt,t):a=await i.load(e,eo,t);let n=a.data;return this._prefabPool.set(e,n),this._gltfPool.set(e,a.gltf),n}async loadObj(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new pt;r==".obj"&&(a=await i.load(e,gf,t));let n=a.data;return this._prefabPool.set(e,n),n}async loadB3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new pt().load(e,co,t,a)).data;return this._prefabPool.set(e,n),n}async loadI3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new pt().load(e,Rf,t,a)).data;return this._prefabPool.set(e,n),n}async loadTexture(e,t,a){if(this._texturePool.has(e))return this._texturePool.get(e);let r=new Va;r.flipY=a;try{await r.load(e,t)}catch(i){return console.error(`Failed to load texture: ${e}`,i),null}return this._texturePool.set(e,r),r}async loadTextureCount(e,t,a,r){return new Promise(async(i,n)=>{let o=0,l=[];t==0&&i(l);for(let c=0;c<t;c++){const f=e.shift();this.loadTexture(f,a,r).then(d=>{l.push(d),o++,o==t&&i(l)})}})}async loadBitmapTextures(e,t=5,a,r){let i=[],n=Math.floor(e.length/t)+1,o=Math.floor(e.length%t);for(let l=0;l<n;l++){let c=await this.loadTextureCount(e,l==n-1?o:t,a,r);i.push(...c)}return i}async loadHDRTexture(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new ro;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadHDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new xs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadLDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Cs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadTextureCubeMaps(e){let t=e[0];if(this._texturePool.has(t))return this._texturePool.get(t);let a=new to;return await a.load(e),this._texturePool.set(e[0],a),a}async loadTextureCubeStd(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new to;return await a.loadStd(e),a}async loadJSON(e,t){return await new pt().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new pt().load(e,za,t,a),n=i.data;return ii.addFontData(n.face,n.size,n),i.data}async loadAtlas(e,t){return(await new pt().load(e,Of,t,e)).data}async loadKMZ(e,t){return(await new pt().load(e,Yf,t)).data}normalTexture;maskTexture;whiteTexture;blackTexture;redTexture;blueTexture;greenTexture;yellowTexture;grayTexture;defaultSky;defaultGUITexture;defaultGUISprite;defaultMaterial;createTexture(e,t,a,r,i,n,o){let l=32,c=32,f=new Uint8Array(l*c*4);this.fillColor(f,e,t,a,r,i,n);let d=new wn;return d.name=o,d.create(16,16,f,!0),o&&this.addTexture(o,d),d}fillColor(e,t,a,r,i,n,o){for(let l=0;l<t;l++)for(let c=0;c<a;c++){let f=c*t+l;e[f*4+0]=r,e[f*4+1]=i,e[f*4+2]=n,e[f*4+3]=o}}initDefault(){this.normalTexture=this.createTexture(32,32,255*.5,255*.5,255,255,"default-normalTexture"),this.maskTexture=this.createTexture(32,32,255,255*.5,255,255,"default-maskTexture"),this.whiteTexture=this.createTexture(32,32,255,255,255,255,"default-whiteTexture"),this.blackTexture=this.createTexture(32,32,0,0,0,255,"default-blackTexture"),this.redTexture=this.createTexture(32,32,255,0,0,255,"default-redTexture"),this.blueTexture=this.createTexture(32,32,0,0,255,255,"default-blueTexture"),this.greenTexture=this.createTexture(32,32,0,255,0,255,"default-greenTexture"),this.yellowTexture=this.createTexture(32,32,0,255,255,255,"default-yellowTexture"),this.grayTexture=this.createTexture(32,32,128,128,128,255,"default-grayTexture");let t=new Qf().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new xs,this.defaultSky.createFromTexture(128,this.blackTexture),me.getInstance().attached(this.defaultSky,this),me.getInstance().attached(t,this),me.getInstance().attached(this.normalTexture,this),me.getInstance().attached(this.maskTexture,this),me.getInstance().attached(this.whiteTexture,this),me.getInstance().attached(this.blackTexture,this),me.getInstance().attached(this.redTexture,this),me.getInstance().attached(this.blueTexture,this),me.getInstance().attached(this.greenTexture,this),me.getInstance().attached(this.yellowTexture,this),me.getInstance().attached(this.grayTexture,this),this.defaultGUITexture=new mr(this.whiteTexture),this.defaultGUISprite=new ri(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new ka}}class Hf extends Pe{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=m.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=m.getRenderJob(e);this._postList.forEach(a=>{t.removePost(a)})}addPost(e){if(this._postList.has(e))return;let t=new e;return this._postList.set(e,t),this._enable&&this.activePost(),t}removePost(e){if(!this._postList.has(e))return;let t=this._postList.get(e);this._postList.delete(e);let a=this.transform.view3D;m.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Bb="1.0.23";class m{static res;static inputSystem;static views;static _frameRateValue=0;static _frameRate=360;static _time=0;static _beforeRender;static _renderLoop;static _lateRender;static _requestAnimationFrameID=0;static get frameRate(){return this._frameRate}static set frameRate(e){this._frameRate=e,this._frameRateValue=1e3/e,e>=360&&(this._frameRateValue=0)}static get size(){return k.presentationSize}static get aspect(){return k.aspect}static get width(){return k.windowWidth}static get height(){return k.windowHeight}static setting={doublePrecision:!1,occlusionQuery:{enable:!0,debug:!1},pick:{enable:!0,mode:"bound",detail:"mesh"},render:{debug:!1,renderPassState:4,renderState_left:5,renderState_right:5,renderState_split:.5,quadScale:1,hdrExposure:1.5,debugQuad:-1,maxPointLight:1e3,maxDirectLight:4,maxSportLight:1e3,drawOpMin:0,drawOpMax:Number.MAX_SAFE_INTEGER,drawTrMin:0,drawTrMax:Number.MAX_SAFE_INTEGER,zPrePass:!1,useLogDepth:!1,useCompressGBuffer:!1,gi:!1,postProcessing:{bloom:{downSampleStep:3,downSampleBlurSize:9,downSampleBlurSigma:1,upSampleBlurSize:9,upSampleBlurSigma:1,luminanceThreshole:1,bloomIntensity:1,hdr:1},globalFog:{debug:!1,enable:!1,fogType:0,fogHeightScale:.1,start:400,end:10,density:.02,ins:.5,skyFactor:.5,skyRoughness:.4,overrideSkyFactor:.8,fogColor:new P(96/255,117/255,133/255,1),falloff:.7,rayLength:200,scatteringExponent:2.7,dirHeightLine:10},godRay:{blendColor:!0,rayMarchCount:16,scatteringExponent:5,intensity:.5},ssao:{enable:!1,radius:.15,bias:-.1,aoPower:2,debug:!0},outline:{enable:!1,strength:1,groupCount:4,outlinePixel:2,fadeOutlinePixel:4,textureScale:1,useAddMode:!1,debug:!0},taa:{enable:!1,jitterSeedCount:8,blendFactor:.1,sharpFactor:.6,sharpPreBlurFactor:.5,temporalJitterScale:.13,debug:!0},gtao:{enable:!1,darkFactor:1,maxDistance:5,maxPixel:50,rayMarchSegment:6,multiBounce:!1,usePosFloat32:!0,blendColor:!0,debug:!0},ssr:{enable:!1,pixelRatio:1,fadeEdgeRatio:.2,rayMarchRatio:.5,fadeDistanceMin:600,fadeDistanceMax:2e3,roughnessThreshold:.5,powDotRN:.2,mixThreshold:.1,debug:!0},fxaa:{enable:!1},depthOfView:{enable:!1,iterationCount:3,pixelOffset:1,near:150,far:300}}},shadow:{enable:!0,type:"HARD",pointShadowBias:5e-4,shadowSize:2048,pointShadowSize:1024,shadowSoft:.005,shadowBound:100,shadowBias:.05,needUpdate:!0,autoUpdate:!0,updateFrameRate:2,csmMargin:.1,csmScatteringExp:.7,csmAreaScale:.4,debug:!1},gi:{enable:!1,offsetX:0,offsetY:0,offsetZ:0,probeSpace:64,probeXCount:4,probeYCount:2,probeZCount:4,probeSize:32,probeSourceTextureSize:2048,octRTMaxSize:2048,octRTSideSize:16,maxDistance:64*1.73,normalBias:.25,depthSharpness:1,hysteresis:.98,lerpHysteresis:.01,irradianceChebyshevBias:.01,rayNumber:144,irradianceDistanceBias:32,indirectIntensity:1,ddgiGamma:2.2,bounceIntensity:.025,probeRoughness:1,realTimeGI:!1,debug:!1,autoRenderProbe:!1},sky:{type:"HDRSKY",sky:null,skyExposure:1,defaultFar:65536,defaultNear:1},light:{maxLight:4096},material:{materialChannelDebug:!1,materialDebug:!1},loader:{numConcurrent:20},reflectionSetting:{reflectionProbeMaxCount:8,reflectionProbeSize:256,width:256*6,height:8*256,enable:!0}};static renderJobs;static async init(e={}){console.log("Rings Version",Bb),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await pe.init(E.allocCount,this.setting.doublePrecision),await k.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,ne.getGBufferFrame(ne.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),z.init(),Ma.init(),oe.init(),vt.init(),It.init(),this.res=new Xf,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new nl,this.inputSystem.initCanvas(k.canvas)}static startRenderJob(e){let t=new J0(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(Hf).addPost(On),(this.setting.pick.mode=="pixel"||this.setting.pick.mode=="bound")&&(e.enablePick=!0),t}static startRenderView(e){this.renderJobs||=new Map,this.views=[e];let t=this.startRenderJob(e);return this.resume(),t}static startRenderViews(e){this.renderJobs||=new Map,this.views=e;for(let t=0;t<e.length;t++)this.startRenderJob(e[t]);this.resume()}static getRenderJob(e){return this.renderJobs.get(e)}static pause(){this._requestAnimationFrameID!==0&&(cancelAnimationFrame(this._requestAnimationFrameID),this._requestAnimationFrameID=0)}static resume(){this._requestAnimationFrameID===0&&(this._requestAnimationFrameID=requestAnimationFrame(e=>this.render(e)))}static async render(e){if(this._frameRateValue>0){let t=e-this._time;if(t<this._frameRateValue){let a=performance.now();await new Promise(r=>{setTimeout(()=>{e+=performance.now()-a,r(!0)},this._frameRateValue-t)})}this._time=e}await this.updateFrame(e),this._requestAnimationFrameID=0,this.resume()}static async updateFrame(e){Fe.delta=e-Fe.time,Fe.time=e,Fe.frame+=1,pr.tick(Fe.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const n=t[a];n.scene.waitUpdate();let[o,l]=k.presentationSize;n.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const n of xe.componentsBeforeUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}let r=k.device.createCommandEncoder();for(const n of xe.componentsComputeList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o,r)}}k.device.queue.submit([r.finish()]);for(const n of xe.componentsUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}for(const n of xe.graphicComponent){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];o&&f.enable&&d(o)}}this._renderLoop&&await this._renderLoop(),pe.updateAllContinueTransform(0,E.useCount,16),oe.modelMatrixBindGroup.writeBuffer(E.useCount*16),this.renderJobs.forEach((n,o)=>{n.renderState||n.start(),n.renderFrame()});for(const n of xe.componentsLateUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}this._lateRender&&await this._lateRender()}}let Ss=`
|
|
7765
|
+
`}async loadFontTextures(){let e=[],t=this.data;for(const a of t.fontPage){let r=this.baseUrl+a.file;await m.res.loadTexture(r,null,!0);let i=m.res.getTexture(r),n=new mr(i);e.push(n)}za.parseSprite(e,t),t.fontChar[" "]||za.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new ri,r=e.size*.5,i=e.lineHeight*.5;a.id=" ",a.offsetSize.set(0,0,e.size,e.size),a.trimSize.set(r,i),a.width=r,a.height=i,a.xadvance=0,a.xoffset=0,a.yoffset=0,a.guiTexture=t,a.uvRec.set(0,0,1e-6,1e-6),ii.addFnt(e.face,e.size,a.id,a)}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let n=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,n)&&(o.indexOf('"')==-1?t[n]=parseFloat(i[1]):t[n]=o.replace('"',"").replace('"',""))}})}}function ab(s,e){let t=new ri;return t.id=s,t.offsetSize.set(0,0,e.width,e.height),t.trimSize.set(e.width,e.height),t.width=e.width,t.height=e.height,t.xadvance=0,t.xoffset=0,t.yoffset=0,t.guiTexture=new mr(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function Vf(s,e,t){let a=new ri;a.guiTexture=s,a.id=e,a.uvRec.copyFrom(t.textureRect),a.trimSize.x=t.textureRect.z,a.trimSize.y=t.textureRect.w,a.offsetSize.x=t.textureRectOffset.x,a.offsetSize.y=t.textureRectOffset.y,a.offsetSize.z=t.size.x,a.offsetSize.w=t.size.y,a.width=t.size.x,a.height=t.size.y;let r=1/s.width,i=1/s.height;a.uvRec.set(a.uvRec.x*r,a.uvRec.y*i,a.uvRec.z*r,a.uvRec.w*i);let n=.1;return t.border.x<=n&&t.border.y<=n&&t.border.z<=n&&t.border.x<=n?a.isSliced=!1:(a.borderSize.copyFrom(t.border),a.uvBorder.copyFrom(t.border),a.uvBorder.x-=t.textureRectOffset.x,a.uvBorder.y-=t.textureRectOffset.y,a.uvBorder.z=t.border.z-(t.size.x-t.textureRect.z-t.textureRectOffset.x),a.uvBorder.w=t.border.w-(t.size.y-t.textureRect.w-t.textureRectOffset.y),a.uvBorder.x/=t.textureRect.z,a.uvBorder.z/=t.textureRect.z,a.uvBorder.y/=t.textureRect.w,a.uvBorder.w/=t.textureRect.w,a.isSliced=!0),a}class Pf{_spriteMap=new Map;_spriteList=[];textureSize=new K;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=Vf(e,t,a);return this._spriteMap.set(r.id,r),this._spriteList.push(r),r}getSprite(e){return this._spriteMap.get(e)}get spriteList(){return this._spriteList}}class Of extends st{static format=ze.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await m.res.loadTexture(t,null,!0),this.data={json:this._json,texture:this._texture},this.parseAtlas()}verification(){if(this.data)return!0;throw new Error("verify failed.")}parseAtlas(){let e=new Pf(this._json.size),t=new mr(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);m.res.addAtlas(this.baseUrl,e),this.data=e}}var Lt=Uint8Array,si=Uint16Array,rb=Int32Array,Lf=new Lt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gf=new Lt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ib=new Lt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zf=function(s,e){for(var t=new si(31),a=0;a<31;++a)t[a]=e+=1<<s[a-1];for(var r=new rb(t[30]),a=1;a<30;++a)for(var i=t[a];i<t[a+1];++i)r[i]=i-t[a]<<5|a;return{b:t,r}},Jf=zf(Lf,2),Wf=Jf.b,sb=Jf.r;Wf[28]=258,sb[258]=28;for(var nb=zf(Gf,0),ob=nb.b,uo=new si(32768),Te=0;Te<32768;++Te){var ir=(Te&43690)>>1|(Te&21845)<<1;ir=(ir&52428)>>2|(ir&13107)<<2,ir=(ir&61680)>>4|(ir&3855)<<4,uo[Te]=((ir&65280)>>8|(ir&255)<<8)>>1}for(var Fi=(function(s,e,t){for(var a=s.length,r=0,i=new si(e);r<a;++r)s[r]&&++i[s[r]-1];var n=new si(e);for(r=1;r<e;++r)n[r]=n[r-1]+i[r-1]<<1;var o;if(t){o=new si(1<<e);var l=15-e;for(r=0;r<a;++r)if(s[r])for(var c=r<<4|s[r],f=e-s[r],d=n[s[r]-1]++<<f,h=d|(1<<f)-1;d<=h;++d)o[uo[d]>>l]=c}else for(o=new si(a),r=0;r<a;++r)s[r]&&(o[r]=uo[n[s[r]-1]++]>>15-s[r]);return o}),ki=new Lt(288),Te=0;Te<144;++Te)ki[Te]=8;for(var Te=144;Te<256;++Te)ki[Te]=9;for(var Te=256;Te<280;++Te)ki[Te]=7;for(var Te=280;Te<288;++Te)ki[Te]=8;for(var Zf=new Lt(32),Te=0;Te<32;++Te)Zf[Te]=5;var lb=Fi(ki,9,1),cb=Fi(Zf,5,1),bo=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},sa=function(s,e,t){var a=e/8|0;return(s[a]|s[a+1]<<8)>>(e&7)&t},go=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},fb=function(s){return(s+7)/8|0},po=function(s,e,t){return(e==null||e<0)&&(e=0),(t==null||t>s.length)&&(t=s.length),new Lt(s.subarray(e,t))},db=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ht=function(s,e,t){var a=new Error(e||db[s]);if(a.code=s,Error.captureStackTrace&&Error.captureStackTrace(a,Ht),!t)throw a;return a},hb=function(s,e,t,a){var r=s.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new Lt(0);var n=!t,o=n||e.i!=2,l=e.i;n&&(t=new Lt(r*3));var c=function(Ft){var kt=t.length;if(Ft>kt){var Nt=new Lt(Math.max(kt*2,Ft));Nt.set(t),t=Nt}},f=e.f||0,d=e.p||0,h=e.b||0,b=e.l,p=e.d,g=e.m,A=e.n,D=r*8;do{if(!b){f=sa(s,d,1);var _=sa(s,d+1,3);if(d+=3,_)if(_==1)b=lb,p=cb,g=9,A=5;else if(_==2){var C=sa(s,d,31)+257,F=sa(s,d+10,15)+4,w=C+sa(s,d+5,31)+1;d+=14;for(var S=new Lt(w),M=new Lt(19),T=0;T<F;++T)M[ib[T]]=sa(s,d+T*3,7);d+=F*3;for(var Q=bo(M),L=(1<<Q)-1,X=Fi(M,Q,1),T=0;T<w;){var ie=X[sa(s,d,L)];d+=ie&15;var U=ie>>4;if(U<16)S[T++]=U;else{var q=0,be=0;for(U==16?(be=3+sa(s,d,3),d+=2,q=S[T-1]):U==17?(be=3+sa(s,d,7),d+=3):U==18&&(be=11+sa(s,d,127),d+=7);be--;)S[T++]=q}}var Ue=S.subarray(0,C),Z=S.subarray(C);g=bo(Ue),A=bo(Z),b=Fi(Ue,g,1),p=Fi(Z,A,1)}else Ht(1);else{var U=fb(d)+4,v=s[U-4]|s[U-3]<<8,x=U+v;if(x>r){l&&Ht(0);break}o&&c(h+v),t.set(s.subarray(U,x),h),e.b=h+=v,e.p=d=x*8,e.f=f;continue}if(d>D){l&&Ht(0);break}}o&&c(h+131072);for(var de=(1<<g)-1,ce=(1<<A)-1,De=d;;De=d){var q=b[go(s,d)&de],_e=q>>4;if(d+=q&15,d>D){l&&Ht(0);break}if(q||Ht(2),_e<256)t[h++]=_e;else if(_e==256){De=d,b=null;break}else{var Ne=_e-254;if(_e>264){var T=_e-257,we=Lf[T];Ne=sa(s,d,(1<<we)-1)+Wf[T],d+=we}var Ce=p[go(s,d)&ce],Me=Ce>>4;Ce||Ht(3),d+=Ce&15;var Z=ob[Me];if(Me>3){var we=Gf[Me];Z+=go(s,d)&(1<<we)-1,d+=we}if(d>D){l&&Ht(0);break}o&&c(h+131072);var ct=h+Ne;if(h<Z){var ga=i-Z,Mt=Math.min(Z,ct);for(ga+h<0&&Ht(3);h<Mt;++h)t[h]=a[ga+h]}for(;h<ct;++h)t[h]=t[h-Z]}}e.l=b,e.p=De,e.b=h,e.f=f,b&&(f=1,e.m=g,e.d=p,e.n=A)}while(!f);return h!=t.length&&n?po(t,0,h):t.subarray(0,h)},ub=new Lt(0),ya=function(s,e){return s[e]|s[e+1]<<8},na=function(s,e){return(s[e]|s[e+1]<<8|s[e+2]<<16|s[e+3]<<24)>>>0},mo=function(s,e){return na(s,e)+na(s,e+4)*4294967296};function bb(s,e){return hb(s,{i:2},e&&e.out,e&&e.dictionary)}var Ao=typeof TextDecoder<"u"&&new TextDecoder,gb=0;try{Ao.decode(ub,{stream:!0}),gb=1}catch{}var pb=function(s){for(var e="",t=0;;){var a=s[t++],r=(a>127)+(a>223)+(a>239);if(t+r>s.length)return{s:e,r:po(s,t-1)};r?r==3?(a=((a&15)<<18|(s[t++]&63)<<12|(s[t++]&63)<<6|s[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):r&1?e+=String.fromCharCode((a&31)<<6|s[t++]&63):e+=String.fromCharCode((a&15)<<12|(s[t++]&63)<<6|s[t++]&63):e+=String.fromCharCode(a)}};function jf(s,e){if(e){for(var t="",a=0;a<s.length;a+=16384)t+=String.fromCharCode.apply(null,s.subarray(a,a+16384));return t}else{if(Ao)return Ao.decode(s);var r=pb(s),i=r.s,t=r.r;return t.length&&Ht(8),i}}var mb=function(s,e){return e+30+ya(s,e+26)+ya(s,e+28)},Ab=function(s,e,t){var a=ya(s,e+28),r=jf(s.subarray(e+46,e+46+a),!(ya(s,e+8)&2048)),i=e+46+a,n=na(s,e+20),o=t&&n==4294967295?Db(s,i):[n,na(s,e+24),na(s,e+42)],l=o[0],c=o[1],f=o[2];return[ya(s,e+10),l,c,r,i+ya(s,e+30)+ya(s,e+32),f]},Db=function(s,e){for(;ya(s,e)!=1;e+=4+ya(s,e+2));return[mo(s,e+12),mo(s,e+4),mo(s,e+20)]};function _b(s,e){for(var t={},a=s.length-22;na(s,a)!=101010256;--a)(!a||s.length-a>65558)&&Ht(13);var r=ya(s,a+8);if(!r)return{};var i=na(s,a+16),n=i==4294967295||r==65535;if(n){var o=na(s,a-12);n=na(s,o)==101075792,n&&(r=na(s,o+32),i=na(s,o+48))}for(var l=0;l<r;++l){var c=Ab(s,i,n),f=c[0],d=c[1],h=c[2],b=c[3],p=c[4],g=c[5],A=mb(s,g);i=p,f?f==8?t[b]=bb(s.subarray(A,A+d),{out:new Lt(h)}):Ht(14,"unknown compression type "+f):t[b]=po(s,A,A+d)}return t}class nt extends mt{constructor(){super(),this.shader=new Oi,this.baseMap=m.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Rr extends Ee{shape_vertices=[];shape_indices=[];radius;widthSegments;heightSegments;phiStart;phiLength;thetaStart;thetaLength;constructor(e,t,a,r,i,n,o){super(),this.radius=e,this.widthSegments=t,this.heightSegments=a,this.phiStart=r,this.phiLength=i,this.thetaStart=n,this.thetaLength=o,this.buildGeometry()}buildGeometry(){var e,t,a=0;let r=this.heightSegments,i=this.widthSegments,n=this.radius;var o=(r+1)*(i+1);let l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),d=new Uint16Array(i*r*2*3),h=0,b=0,p=0;for(t=0;t<=r;++t){var g=Math.PI*t/r,A=n*Math.cos(g),D=n*Math.sin(g);for(e=0;e<=i;++e){var _=2*Math.PI*e/i,U=D*Math.cos(_),v=D*Math.sin(_),x=1/Math.sqrt(U*U+A*A+v*v);if(l[h++]=U,l[h++]=A,l[h++]=v,c[b++]=U*x,c[b++]=A*x,c[b++]=v*x,f[p++]=e/i,f[p++]=t/r,e>0&&t>0){var C=(i+1)*t+e,F=(i+1)*t+e-1,w=(i+1)*(t-1)+e-1,S=(i+1)*(t-1)+e;t==r?(d[a++]=C,d[a++]=w,d[a++]=S):t==1?(d[a++]=C,d[a++]=F,d[a++]=w):(d[a++]=C,d[a++]=F,d[a++]=w,d[a++]=C,d[a++]=w,d[a++]=S)}}}this.setIndices(d),this.setAttribute(V.position,l),this.setAttribute(V.normal,c),this.setAttribute(V.uv,f),this.setAttribute(V.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:d.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new pe(u.ZERO,new u(this.radius*2,this.radius*2,this.radius*2))}}class os extends ee{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new u(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),os.register3DRepresentation)this.marker=os.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new ee;const e=this.marker.addComponent($);e.geometry=new Rr(.1,32,16),e.material=new nt,e.material.baseColor=this.positionValid?new P(0,1,0,1):new P(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class ls extends ee{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new os(t);this.addChild(a)}this.entityChildren=this.entityChildren.sort((t,a)=>t.positionIndex-a.positionIndex)}setup3DRepresentation(){this.line&&(this.removeChild(this.line),this.line=null),ls.register3DRepresentation?(this.line=ls.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new P(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Ee,r=new Float32Array(e.length*3);for(let c=0;c<e.length;c++)r[c*3]=e[c].x,r[c*3+1]=e[c].y,r[c*3+2]=e[c].z;const i=new Uint16Array((e.length-1)*2);for(let c=0;c<e.length-1;c++)i[c*2]=c,i[c*2+1]=c+1;a.setIndices(i),a.setAttribute(V.position,r),a.addSubGeometry({indexStart:0,indexCount:i.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});const n=new ee,o=n.addComponent($),l=new nt;return l.topology="line-list",l.baseColor=t,l.blendMode=ae.ADD,l.castReflection=!1,o.geometry=a,o.material=l,n}}class Yf extends st{static format=ze.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=_b(new Uint8Array(e));for(const i in a){const n=a[i],l=new DOMParser().parseFromString(jf(n),"application/xml"),c={};this.parseNode(l,c);const f=i.replace("wpmz/","").split(".")[0];Object.assign(t,{[f]:c["#document"].kml.Document})}const r=new ls(t.waylines);this.data=r}catch(t){this.parserError(`KMZ parsing failed: ${t}`,-1)}}parseNode(e,t){const a=["Placemark","actionGroup","action"],r=e.nodeName.replace("wpml:","");if(!e.childNodes.length)t[r]=void 0;else{let i=null,n=!1;for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];if(l.nodeType==Node.TEXT_NODE){const c=l.nodeValue?.trim();c&&c.length>0&&(i=c)}else l.nodeType==Node.ELEMENT_NODE&&(n=!0)}if(i&&!n)t[r]=i;else if(n){a.includes(r)?t[r]?.length?t[r].push({}):t[r]=[{}]:t[r]={};for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];l.nodeType==Node.ELEMENT_NODE&&this.parseNode(l,Array.isArray(t[r])?t[r].at(-1):t[r])}}else t[r]=void 0}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Xf{_texturePool;_materialPool;_prefabPool;_gltfPool;_geometryPool;_atlasList;_obj;constructor(){this._texturePool=new Map,this._materialPool=new Map,this._prefabPool=new Map,this._geometryPool=new Map,this._gltfPool=new Map,this._atlasList=new Map,this._obj=new Map}getGltf(e){return this._gltfPool.get(e)}addObj(e,t){this._obj.set(e,t)}getObj(e){return this._obj.get(e)}addTexture(e,t){this._texturePool.set(e,t)}getTexture(e){return this._texturePool.get(e)}addGeometry(e,t){this._geometryPool.set(e,t)}getGeometry(e){return this._geometryPool.get(e)}addMat(e,t){return this._materialPool.set(e,t)}getMat(e){return this._materialPool.get(e)}addPrefab(e,t){this._prefabPool.set(e,t)}getPrefab(e){return this._prefabPool.get(e).instantiate()}addAtlas(e,t){t.name=e,this._atlasList.set(e,t)}getAtlas(e){return this._atlasList.get(e)}getGUISprite(e){for(let t of this._atlasList.values()){let a=t.getSprite(e);if(a)return a}return null}async load(e,t,a){return(await new pt().load(e,t,a)).data}async loadGltf(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new pt;r==".gltf"?a=await i.load(e,Dt,t):a=await i.load(e,eo,t);let n=a.data;return this._prefabPool.set(e,n),this._gltfPool.set(e,a.gltf),n}async loadObj(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new pt;r==".obj"&&(a=await i.load(e,gf,t));let n=a.data;return this._prefabPool.set(e,n),n}async loadB3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new pt().load(e,co,t,a)).data;return this._prefabPool.set(e,n),n}async loadI3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let n=(await new pt().load(e,Rf,t,a)).data;return this._prefabPool.set(e,n),n}async loadTexture(e,t,a){if(this._texturePool.has(e))return this._texturePool.get(e);let r=new Va;r.flipY=a;try{await r.load(e,t)}catch(i){return console.error(`Failed to load texture: ${e}`,i),null}return this._texturePool.set(e,r),r}destroyTexture(e){const t=this._texturePool.get(e);return t?ge.getInstance().hasReference(t)?!1:(t.isDestroyed||t.destroy(),this._texturePool.delete(e),!0):!1}destroyTextureAllUnUsed(){for(const[e,t]of this._texturePool.entries())this.destroyTexture(e)}async loadTextureCount(e,t,a,r){return new Promise(async(i,n)=>{let o=0,l=[];t==0&&i(l);for(let c=0;c<t;c++){const f=e.shift();this.loadTexture(f,a,r).then(d=>{l.push(d),o++,o==t&&i(l)})}})}async loadBitmapTextures(e,t=5,a,r){let i=[],n=Math.floor(e.length/t)+1,o=Math.floor(e.length%t);for(let l=0;l<n;l++){let c=await this.loadTextureCount(e,l==n-1?o:t,a,r);i.push(...c)}return i}async loadHDRTexture(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new ro;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadHDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new xs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadLDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Cs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadTextureCubeMaps(e){let t=e[0];if(this._texturePool.has(t))return this._texturePool.get(t);let a=new to;return await a.load(e),this._texturePool.set(e[0],a),a}async loadTextureCubeStd(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new to;return await a.loadStd(e),a}async loadJSON(e,t){return await new pt().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new pt().load(e,za,t,a),n=i.data;return ii.addFontData(n.face,n.size,n),i.data}async loadAtlas(e,t){return(await new pt().load(e,Of,t,e)).data}async loadKMZ(e,t){return(await new pt().load(e,Yf,t)).data}normalTexture;maskTexture;whiteTexture;blackTexture;redTexture;blueTexture;greenTexture;yellowTexture;grayTexture;defaultSky;defaultGUITexture;defaultGUISprite;defaultMaterial;createTexture(e,t,a,r,i,n,o){let l=32,c=32,f=new Uint8Array(l*c*4);this.fillColor(f,e,t,a,r,i,n);let d=new wn;return d.name=o,d.create(16,16,f,!0),o&&this.addTexture(o,d),d}fillColor(e,t,a,r,i,n,o){for(let l=0;l<t;l++)for(let c=0;c<a;c++){let f=c*t+l;e[f*4+0]=r,e[f*4+1]=i,e[f*4+2]=n,e[f*4+3]=o}}initDefault(){this.normalTexture=this.createTexture(32,32,255*.5,255*.5,255,255,"default-normalTexture"),this.maskTexture=this.createTexture(32,32,255,255*.5,255,255,"default-maskTexture"),this.whiteTexture=this.createTexture(32,32,255,255,255,255,"default-whiteTexture"),this.blackTexture=this.createTexture(32,32,0,0,0,255,"default-blackTexture"),this.redTexture=this.createTexture(32,32,255,0,0,255,"default-redTexture"),this.blueTexture=this.createTexture(32,32,0,0,255,255,"default-blueTexture"),this.greenTexture=this.createTexture(32,32,0,255,0,255,"default-greenTexture"),this.yellowTexture=this.createTexture(32,32,0,255,255,255,"default-yellowTexture"),this.grayTexture=this.createTexture(32,32,128,128,128,255,"default-grayTexture");let t=new Qf().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new xs,this.defaultSky.createFromTexture(128,this.blackTexture),ge.getInstance().attached(this.defaultSky,this),ge.getInstance().attached(t,this),ge.getInstance().attached(this.normalTexture,this),ge.getInstance().attached(this.maskTexture,this),ge.getInstance().attached(this.whiteTexture,this),ge.getInstance().attached(this.blackTexture,this),ge.getInstance().attached(this.redTexture,this),ge.getInstance().attached(this.blueTexture,this),ge.getInstance().attached(this.greenTexture,this),ge.getInstance().attached(this.yellowTexture,this),ge.getInstance().attached(this.grayTexture,this),this.defaultGUITexture=new mr(this.whiteTexture),this.defaultGUISprite=new ri(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new ka}}class Hf extends Pe{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=m.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=m.getRenderJob(e);this._postList.forEach(a=>{t.removePost(a)})}addPost(e){if(this._postList.has(e))return;let t=new e;return this._postList.set(e,t),this._enable&&this.activePost(),t}removePost(e){if(!this._postList.has(e))return;let t=this._postList.get(e);this._postList.delete(e);let a=this.transform.view3D;m.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Bb="1.0.25";class m{static res;static inputSystem;static views;static _frameRateValue=0;static _frameRate=360;static _time=0;static _beforeRender;static _renderLoop;static _lateRender;static _requestAnimationFrameID=0;static get frameRate(){return this._frameRate}static set frameRate(e){this._frameRate=e,this._frameRateValue=1e3/e,e>=360&&(this._frameRateValue=0)}static get size(){return k.presentationSize}static get aspect(){return k.aspect}static get width(){return k.windowWidth}static get height(){return k.windowHeight}static setting={doublePrecision:!1,occlusionQuery:{enable:!0,debug:!1},pick:{enable:!0,mode:"bound",detail:"mesh"},render:{debug:!1,renderPassState:4,renderState_left:5,renderState_right:5,renderState_split:.5,quadScale:1,hdrExposure:1.5,debugQuad:-1,maxPointLight:1e3,maxDirectLight:4,maxSportLight:1e3,drawOpMin:0,drawOpMax:Number.MAX_SAFE_INTEGER,drawTrMin:0,drawTrMax:Number.MAX_SAFE_INTEGER,zPrePass:!1,useLogDepth:!1,useCompressGBuffer:!1,gi:!1,postProcessing:{bloom:{downSampleStep:3,downSampleBlurSize:9,downSampleBlurSigma:1,upSampleBlurSize:9,upSampleBlurSigma:1,luminanceThreshole:1,bloomIntensity:1,hdr:1},globalFog:{debug:!1,enable:!1,fogType:0,fogHeightScale:.1,start:400,end:10,density:.02,ins:.5,skyFactor:.5,skyRoughness:.4,overrideSkyFactor:.8,fogColor:new P(96/255,117/255,133/255,1),falloff:.7,rayLength:200,scatteringExponent:2.7,dirHeightLine:10},godRay:{blendColor:!0,rayMarchCount:16,scatteringExponent:5,intensity:.5},ssao:{enable:!1,radius:.15,bias:-.1,aoPower:2,debug:!0},outline:{enable:!1,strength:1,groupCount:4,outlinePixel:2,fadeOutlinePixel:4,textureScale:1,useAddMode:!1,debug:!0},taa:{enable:!1,jitterSeedCount:8,blendFactor:.1,sharpFactor:.6,sharpPreBlurFactor:.5,temporalJitterScale:.13,debug:!0},gtao:{enable:!1,darkFactor:1,maxDistance:5,maxPixel:50,rayMarchSegment:6,multiBounce:!1,usePosFloat32:!0,blendColor:!0,debug:!0},ssr:{enable:!1,pixelRatio:1,fadeEdgeRatio:.2,rayMarchRatio:.5,fadeDistanceMin:600,fadeDistanceMax:2e3,roughnessThreshold:.5,powDotRN:.2,mixThreshold:.1,debug:!0},fxaa:{enable:!1},depthOfView:{enable:!1,iterationCount:3,pixelOffset:1,near:150,far:300}}},shadow:{enable:!0,type:"HARD",pointShadowBias:5e-4,shadowSize:2048,pointShadowSize:1024,shadowSoft:.005,shadowBound:100,shadowBias:.05,needUpdate:!0,autoUpdate:!0,updateFrameRate:2,csmMargin:.1,csmScatteringExp:.7,csmAreaScale:.4,debug:!1},gi:{enable:!1,offsetX:0,offsetY:0,offsetZ:0,probeSpace:64,probeXCount:4,probeYCount:2,probeZCount:4,probeSize:32,probeSourceTextureSize:2048,octRTMaxSize:2048,octRTSideSize:16,maxDistance:64*1.73,normalBias:.25,depthSharpness:1,hysteresis:.98,lerpHysteresis:.01,irradianceChebyshevBias:.01,rayNumber:144,irradianceDistanceBias:32,indirectIntensity:1,ddgiGamma:2.2,bounceIntensity:.025,probeRoughness:1,realTimeGI:!1,debug:!1,autoRenderProbe:!1},sky:{type:"HDRSKY",sky:null,skyExposure:1,defaultFar:65536,defaultNear:1},light:{maxLight:4096},material:{materialChannelDebug:!1,materialDebug:!1},loader:{numConcurrent:20},reflectionSetting:{reflectionProbeMaxCount:8,reflectionProbeSize:256,width:256*6,height:8*256,enable:!0}};static renderJobs;static async init(e={}){console.log("Rings Version",Bb),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await me.init(E.allocCount,this.setting.doublePrecision),await k.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,ne.getGBufferFrame(ne.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),z.init(),Ma.init(),oe.init(),vt.init(),It.init(),this.res=new Xf,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new nl,this.inputSystem.initCanvas(k.canvas)}static startRenderJob(e){let t=new J0(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(Hf).addPost(On),(this.setting.pick.mode=="pixel"||this.setting.pick.mode=="bound")&&(e.enablePick=!0),t}static startRenderView(e){this.renderJobs||=new Map,this.views=[e];let t=this.startRenderJob(e);return this.resume(),t}static startRenderViews(e){this.renderJobs||=new Map,this.views=e;for(let t=0;t<e.length;t++)this.startRenderJob(e[t]);this.resume()}static getRenderJob(e){return this.renderJobs.get(e)}static pause(){this._requestAnimationFrameID!==0&&(cancelAnimationFrame(this._requestAnimationFrameID),this._requestAnimationFrameID=0)}static resume(){this._requestAnimationFrameID===0&&(this._requestAnimationFrameID=requestAnimationFrame(e=>this.render(e)))}static async render(e){if(this._frameRateValue>0){let t=e-this._time;if(t<this._frameRateValue){let a=performance.now();await new Promise(r=>{setTimeout(()=>{e+=performance.now()-a,r(!0)},this._frameRateValue-t)})}this._time=e}await this.updateFrame(e),this._requestAnimationFrameID=0,this.resume()}static async updateFrame(e){Fe.delta=e-Fe.time,Fe.time=e,Fe.frame+=1,pr.tick(Fe.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const n=t[a];n.scene.waitUpdate();let[o,l]=k.presentationSize;n.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const n of xe.componentsBeforeUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}let r=k.device.createCommandEncoder();for(const n of xe.componentsComputeList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o,r)}}k.device.queue.submit([r.finish()]);for(const n of xe.componentsUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}for(const n of xe.graphicComponent){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];o&&f.enable&&d(o)}}this._renderLoop&&await this._renderLoop(),me.updateAllContinueTransform(0,E.useCount,16),oe.modelMatrixBindGroup.writeBuffer(E.useCount*16),this.renderJobs.forEach((n,o)=>{n.renderState||n.start(),n.renderFrame()});for(const n of xe.componentsLateUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],d=c[1];f.enable&&d(o)}}this._lateRender&&await this._lateRender()}}let Ss=`
|
|
7766
7766
|
struct BloomCfg{
|
|
7767
7767
|
downSampleStep: f32,
|
|
7768
7768
|
downSampleBlurSize: f32,
|
|
@@ -11410,7 +11410,7 @@ fn frag(){
|
|
|
11410
11410
|
var fragColor:vec4<f32> = vec4<f32>((sky.rgb), 1.0);
|
|
11411
11411
|
return fragColor;
|
|
11412
11412
|
}
|
|
11413
|
-
`}class kd{sunRadius=500;sunRadiance=11;mieG=.76;mieHeight=1200;eyePos=1500;sunX=.71;sunY=.56;sunBrightness=1;displaySun=!0;defaultTextureCubeSize=512;defaultTexture2DSize=1024;skyColor=new P(1,1,1,1)}class Ed extends Cs{_internalTexture;_cubeSize;setting;constructor(e){return super(),this.setting=e,this._cubeSize=e.defaultTextureCubeSize,this._internalTexture=new Tb(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 Tb extends Ae{_computeShader;_uniformBuffer;constructor(e,t){super(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.initCompute(e,t)}initCompute(e,t){this._uniformBuffer=new dt(64),this._uniformBuffer.apply(),this._computeShader=new fe(Fd.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=y.beginCommandEncoder();return y.computeCommand(t,[this._computeShader]),y.endCommandEncoder(t),this}}var Mb=Object.getOwnPropertyDescriptor,Nb=(s,e,t,a)=>{for(var r=a>1?void 0:a?Mb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ei=class extends ot{constructor(){super();let s=new Ve("sky_vs_frag_wgsl","sky_fs_frag_wgsl");this.addRenderPass(s),s.setUniformVector3("eyesPos",new u),s.setUniformFloat("exposure",1),s.setUniformFloat("roughness",0);let e=s.shaderState;e.frontFace="cw",e.cullMode=wt.back,e.depthWriteEnabled=!1,e.depthCompare=et.less}};Ei=Nb([Ia(Ei,"SkyShader")],Ei);class wd extends mt{constructor(){super(),this.shader=new Ei,this.shader.setUniformVector3("eyesPos",new u),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 m.setting.sky.skyExposure}set exposure(e){m.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 Rd extends Na{gid=0;needUpdate=!0;autoUpdate=!1;radius=500;init(){super.init(),this.addRendererMask(Be.Reflection),this.alwaysRender=!0,this.object3D.bound=new ge(u.ZERO.clone(),u.MAX),us(this.transform.onPositionChange,()=>{this.needUpdate=!0})}onEnable(){J.instance.addRenderNode(this.transform.scene3D,this)}onDisable(){J.instance.removeRenderNode(this.transform.scene3D,this)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class Id extends ot{constructor(){super();let e=new Ve("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 te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),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?wt.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 Qd extends mt{constructor(){super(),this.shader=new Id,this.baseMap=m.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 Mr{center=new u;extents;max;min;size;tmpVecA=new u;tmpVecB=new u;tmpVecC=new u;tmpVecD=new u;radius=0;diffBetweenPoints=new u;owner;forward=new u(0,0,1);worldCenter;worldSize;_center=new u;constructor(e,t){this.center=e||new u(0,0,0),this.radius=t===void 0?.5:t}updateBound(){throw new Error("Method not implemented.")}containsPoint(e){var t=this.tmpVecA.subtract(e,this.center).lengthSquared,a=this.radius;return t<a*a}intersectsRay(e,t){var a=this.tmpVecA.copyFrom(e.origin).subtract(this.center),r=a.dotProduct(this.tmpVecB.copyFrom(e.direction).normalize()),i=a.dotProduct(a)-this.radius*this.radius;if(i>0&&r>0)return null;var n=r*r-i;if(n<0)return!1;var o=Math.abs(-r-Math.sqrt(n));return t&&t.copyFrom(e.direction).scaleBy(o).add(e.origin),!0}intersectsBoundingSphere(e){this.tmpVecA.subtract(e.center,this.center);var t=e.radius+this.radius;return this.tmpVecA.lengthSquared<=t*t}calculateTransform(e){this.update(e)}inFrustum(e,t){return t.containsSphere(e)}clone(){return new Mr(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 Td extends Rd{init(){super.init(),this.castShadow=!1,this.castGI=!1,this.addRendererMask(Be.Reflection),this.alwaysRender=!0,this.object3D.bound=new Mr(u.ZERO.clone(),this.radius)}debug(e,t=1){let a=new ee,r=a.addComponent($);r.addMask(Be.ReflectionDebug),r.geometry=new Rr(25,30,30);let i=m.setting.reflectionSetting,n=ne.getGBufferFrame(ne.reflections_GBuffer,i.width,i.height),o=new Qd;o.reflectionIndex=e,o.baseMap=n.getCompressGBufferTexture(),r.material=o,this.object3D.addChild(a),a.scaleX=t,a.scaleY=t,a.scaleZ=t}onEnable(){super.onEnable()}onDisable(){super.onDisable()}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class Fs extends ${skyMaterial;init(){super.init(),this.castShadow=!1,this.castGI=!0,this.addRendererMask(Be.Sky),this.alwaysRender=!0,this.object3D.bound=new ge(u.ZERO.clone(),u.MAX),this.geometry=new Rr(m.setting.sky.defaultFar,20,20),this.skyMaterial||=new wd}onEnable(){this._readyPipeline?(this.castNeedPass(),!this._inRenderer&&this.transform.scene3D&&(J.instance.sky=this,this._inRenderer=!0)):this.initPipeline()}onDisable(){this._inRenderer&&this.transform.scene3D&&(this._inRenderer=!1,J.instance.sky=null),super.onDisable()}nodeUpdate(e,t,a,r){super.nodeUpdate(e,t,a,r)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}set map(e){this.skyMaterial.baseMap=e,this.skyMaterial.name==null&&(this.skyMaterial.name="skyMaterial"),this.material=this.skyMaterial}get map(){return this.skyMaterial.baseMap}get exposure(){return this.skyMaterial.exposure}set exposure(e){this.skyMaterial&&(this.skyMaterial.exposure=e)}get roughness(){return this.skyMaterial.roughness}set roughness(e){this.skyMaterial&&(this.skyMaterial.roughness=e)}useSkyReflection(){let e=new ee,t=e.addComponent(Td);t.autoUpdate=!1,e.x=0,e.y=300,e.z=0,this.object3D.addChild(e)}}class Vb{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 Pb extends Fs{_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 Vb,this._atmosphericScatteringSky=new Ed(new kd);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 Ir{static panelRatio=1;static quadMaxCountForWorld=256;static quadMaxCountForView=2048;static SortOrderStartWorld=7e3;static SortOrderStartView=8e3;static SortOrderCanvasSpan=1e4}var Kt=(s=>(s[s.View=0]="View",s[s.World=2]="World",s))(Kt||{}),ni=(s=>(s[s.Simple=0]="Simple",s[s.Sliced=1]="Sliced",s[s.Tiled=2]="Tiled",s[s.Filled=3]="Filled",s))(ni||{}),sr=(s=>(s[s.None=0]="None",s[s.BillboardY=9]="BillboardY",s[s.BillboardXYZ=10]="BillboardXYZ",s))(sr||{});class qi extends Pe{type;camera;_cameraPosition;constructor(){super(),this._cameraPosition=new u}onUpdate(){this.enable&&this.transform.view3D.camera&&this.updateBillboardMatrix()}updateBillboardMatrix(){let e=this.transform.view3D.camera;this._cameraPosition.copyFrom(e.transform.back),this.type==sr.BillboardXYZ||this.type==sr.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(qi);t.type=this.type}}var oi=(s=>(s[s.None=0]="None",s[s.Box=1]="Box",s[s.Capsule=2]="Capsule",s[s.Sphere=3]="Sphere",s[s.Mesh=4]="Mesh",s))(oi||{});class qe{_center;_size;_halfSize;_shapeType=0;static v3_help_0;static helpMatrix;static helpRay;constructor(){qe.v3_help_0||=new u,qe.helpMatrix||=new E,qe.helpRay||=new ea,this._center=new u,this._size=new u,this._halfSize=new u}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 li extends qe{_pickRet;box;constructor(){super(),this._shapeType=oi.Box,this.box=new ge(new u,new u)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.size);let r=qe.helpMatrix;r.copyFrom(t).invert();let i=qe.helpRay.copy(e);i.applyMatrix(r);let n=i.intersectBox(this.box,qe.v3_help_0);return n?(this._pickRet||(this._pickRet={intersectPoint:new u,distance:0}),this._pickRet.intersectPoint=n,this._pickRet.distance=u.distance(i.origin,qe.v3_help_0),this._pickRet):null}}class qt extends Pe{_shape;constructor(){super(),this._shape=new li}start(){m.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.set(this.transform.worldMatrix.index,this)}onEnable(e){xe.bindEnablePick(e,this,null)}onDisable(e){xe.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){m.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.delete(this.transform.worldMatrix.index),super.beforeDestroy(e)}}class Md{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 Ui(this.clip.skeleton)}reset(){this.time=0,this.weight=0,this._isEnd=!1}get name(){return this.clip.name}get currSkeletonPose(){return this._currSkeletonPose}update(e){this.time=(this.time+e*this.speed)%this.clip.totalTime;let t=this.time/this.clip.frameRate;if(this.currFrame=Math.trunc(t),this.t=t-this.currFrame,this.currFrame<0&&(this.currFrame=this.clip.numFrame+this.currFrame),this.time>=0?this.nextFrame=(this.currFrame+1)%this.clip.numFrame:(this.nextFrame=this.currFrame-1,this.nextFrame<0&&(this.nextFrame=this.clip.numFrame+this.nextFrame),this.t=1-this.t),this._isEnd)this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1;else if(this.currFrame!=this.lastFrame){let i=this.speed<0?0:this.clip.numFrame;this.currFrame==i&&(this.loop?(this.currFrame=0,this.nextFrame=1,this.time=this.t=0):(this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1,this._isEnd=!0));var a=this.clip.getEvents();if(a)for(let n of a){var r=Math.floor(n.time/this.clip.frameRate);if(r=Math.min(r,this.clip.numFrame),r=Math.max(r,0),r==this.currFrame){n.skeletonAnimation=this.animation,this.animation.eventDispatcher.dispatchEvent(n);break}}this.lastFrame=this.currFrame}this.clip.getLerpSkeletonPose(this.currFrame,this.nextFrame,this.t,this._currSkeletonPose)}}var Ob=Object.getOwnPropertyDescriptor,Lb=(s,e,t,a)=>{for(var r=a>1?void 0:a?Ob(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let nr=class extends Pe{isPlaying=!0;timeScale=1;_skeleton;_clips=[];_clipStates=new Map;_mixSkeletonPose;_mixTempSkeletonPose;_currentClipState;_bindList=[];_jointMatrixIndexTableBuffer;_crossFadeState;constructor(){super()}start(){}set skeleton(s){this._skeleton=s,this._mixSkeletonPose=new Ui(this._skeleton,!0),this._mixTempSkeletonPose=new Ui(this._skeleton);const e=new Float32Array(this._mixSkeletonPose.jointMatrixIndexTable);this._jointMatrixIndexTableBuffer=new ve(this._skeleton.numJoint*4,0,e)}get skeleton(){return this._skeleton}get finalSkeletonPose(){return this._mixSkeletonPose}get jointMatrixIndexTableBuffer(){return this._jointMatrixIndexTableBuffer}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){const a=s[t];let r=this._skeleton.getJointByName(a);e[t]=r?r.index:-1}return e}addAnimationClip(s){if(!this._clipStates.has(s.name)){this._clips.push(s);let e=new Md(s);e.animation=this,this._clipStates.set(s.name,e),this._currentClipState||this.setCurrentClipState(e)}}getAnimationClip(s){var e=this.getAnimationClipState(s);return e?e.clip:null}getAnimationClips(){return this._clips}getAnimationClipState(s){return this._clipStates.has(s)?this._clipStates.get(s):null}getAnimationClipStates(){return this._clipStates}pause(){this.isPlaying=!1}resume(){this.isPlaying=!0}play(s,e=1,t=!1){if(this._currentClipState&&this._currentClipState.name==s)return t&&this._currentClipState.reset(),!1;let a=this.getAnimationClipState(s);return a?(a.speed=e,a.reset(),this._clipStates.forEach((r,i)=>{r.weight=0}),this.setCurrentClipState(a),!0):!1}crossFade(s,e){if(e<.01){this.play(s);return}if(this._currentClipState.name==s)return;let t=this.getAnimationClipState(s);t&&(t.reset(),this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(t,this._currentClipState,e)):this._crossFadeState=new Gb(t,this._currentClipState,e),this._currentClipState=t)}setAnimIsLoop(s,e){this._clipStates.has(s)&&(this._clipStates.get(s).loop=e)}addJointBind(s,e){this._bindList.push({jointName:s,obj:e})}removeJointBind(s){for(let e=0;e<this._bindList.length;e++)if(this._bindList[e].obj==s){this._bindList.splice(e,1);break}}onUpdate(){if(!this.isPlaying)return;let s=Fe.delta*.001*this.timeScale;this._crossFadeState&&this._crossFadeState.update(s);var e=0,t=[];if(this._clipStates.forEach((r,i)=>{r.weight>0&&(r.update(s),e+=r.weight,t.push(r))}),t.length>0){this._mixSkeletonPose.copyFrom(t[0].currSkeletonPose);for(var a=1;a<t.length;++a){const r=t[a];this._mixTempSkeletonPose.lerp(this._mixSkeletonPose,r.currSkeletonPose,r.weight/e),this._mixSkeletonPose.copyFrom(this._mixTempSkeletonPose)}}}cloneTo(s){let e=s.addComponent(nr);e.skeleton=this.skeleton;for(var t=0;t<this._clips.length;++t)e.addAnimationClip(this._clips[t])}setCurrentClipState(s){this._currentClipState!=s&&(this._currentClipState=s,this._currentClipState.weight=1)}};nr=Lb([Vt(nr,"SkeletonAnimationComponent")],nr);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,Jb=(s,e,t,a)=>{for(var r=a>1?void 0:a?zb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Pa=class extends Pe{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 u;_boneScale=new u;_boneRot=new j;_crossFadeState;init(s){this.propertyCache=new Map,this._clipsMap=new Map,this._clips=[],this._clipsState=[],this._rendererList=this.object3D.getComponentsInChild(lr);let e=this.object3D.getComponentsInChild($);for(let t of e){let a=t;a.blendShape=t.morphData,this._rendererList.push(a)}for(const t of this._rendererList)Wt.hasMask(t.rendererMask,Be.MorphTarget)&&t.selfCloneMaterials("MORPH_TARGET_UUID")}start(){}debug(){}playAnim(s,e=0,t=1){let a=this.getAnimationClipState(s);a?(this._currentSkeletonClip&&(this._currentSkeletonClip.weight=0),this._currentSkeletonClip=a,this._currentSkeletonClip.weight=1,this._skeletonTime=e,this._skeletonSpeed=t,this._skeletonStart=!0):console.warn(`not has anim ${s}`)}crossFade(s,e){let t=this.getAnimationClipState(s);if(!t){console.warn(`not has anim ${s}`);return}if(e<.01||!this._currentSkeletonClip){this.playAnim(s);return}if(this._currentSkeletonClip&&this._currentSkeletonClip.clip.clipName===s)return;let a=t,r=this._currentSkeletonClip;this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(a,r,e)):this._crossFadeState=new Wb(a,r,e),this._currentSkeletonClip=a}playBlendShape(s,e=0,t=1){this._clipsMap.has(s)?(this._currentBlendAnimClip=this._clipsMap.get(s),this._blendShapeTime=e,this._blendShapeSpeed=t,this._blendShapeStart=!0):console.warn(`not has blendShape ${s}`)}set avatar(s){this._avatarName=s,this.inverseBindMatrices=[],this._avatar=m.res.getObj(s);let e=this.buildSkeletonPose();const t=new Float32Array(e);this.jointMatrixIndexTableBuffer=new ve(this._avatar.count,0,t)}get numJoint(){return this._avatar.count}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){let a=this._avatar.boneMap.get(s[t]);e[t]=a?a.boneID:-1}return e}skeltonPoseObject3D={};skeltonTPoseObject3D={};buildSkeletonPose(){let s=[];for(const e of this._avatar.boneData){let t=new ee;E.getEuler(u.HELP_6,e.q,!0,"ZYX"),t.localPosition=e.t.clone(),t.localRotation=u.HELP_6.clone(),t.localScale=u.ONE,e.s.clone(),this.skeltonPoseObject3D[e.boneName]=t,this.skeltonTPoseObject3D[e.bonePath]=t.clone(),e.parentBoneName&&e.parentBoneName!=""?this.skeltonPoseObject3D[e.parentBoneName].addChild(t):(this.object3D.transform.scene3D&&this.object3D.transform.scene3D.addChild(t),this.root=t),s.push(t.transform.worldMatrix.index);let a=new E;a.copyFrom(t.transform.worldMatrix),a.invert(),this.inverseBindMatrices.push(a.rawData)}return s}set clips(s){this._clips=s;for(const e of s)this._clipsMap.set(e.clipName,e);this._clipsState=[];for(const e of s)this._clipsState.push(new Nd(e));this._currentSkeletonClip||this.playAnim(s[0].clipName)}get clips(){return this._clips}get clipsState(){return this._clipsState}cloneTo(s){let e=s.addComponent(Pa);e.avatar=this._avatarName,e.clips=this._clips}updateTime(){const s=Fe.delta*.001;this._skeletonStart&&(this._skeletonTime+=s*this._skeletonSpeed*this.timeScale,this._currentSkeletonClip&&this._currentSkeletonClip.clip.loopTime&&(this._skeletonTime=this._skeletonTime%this._currentSkeletonClip.clip.stopTime)),this._blendShapeStart&&(this._blendShapeTime+=s*this._blendShapeSpeed,this._currentBlendAnimClip&&(this._currentBlendAnimClip.loopTime&&this.playBlendShapeLoop?this._blendShapeTime=this._blendShapeTime%this._currentBlendAnimClip.stopTime:this._blendShapeTime=Math.min(this._blendShapeTime,this._currentBlendAnimClip.stopTime)-1e-4)),this._crossFadeState&&this._crossFadeState.update(s)}onUpdate(s){this.updateTime();let e=[];for(let t of this._clipsState)t.weight>0&&e.push(t);e.length>0?this.updateSkeletonAnimMix(e):this.updateSkeletonAnim(),this.updateMorphAnim()}updateSkeletonAnim(){if(this._currentSkeletonClip){let s=this._avatar.boneData,e=0,t=s.length;for(e=0;e<t;e++){const a=s[e];let r=this.skeltonPoseObject3D[a.boneName];if(this._currentSkeletonClip.clip.useSkeletonPos){let n=this.getPosition(a.bonePath,this._skeletonTime);r.transform.localPosition=n}let i=this.getRotation(a.bonePath,this._skeletonTime);if(r.transform.localRotQuat=i,this._currentSkeletonClip.clip.useSkeletonScale){let n=this.getScale(a.bonePath,this._skeletonTime);r.transform.localScale=n}}}}updateMorphAnim(){if(this._currentBlendAnimClip&&this._currentBlendAnimClip.floatCurves&&this._currentBlendAnimClip.floatCurves.size>0&&this._rendererList)for(const s of this._currentBlendAnimClip.floatCurves){let e=s[0],a=s[1].propertys,i=this._currentBlendAnimClip.floatCurves.get(e).getValue(this._blendShapeTime)/100;this.updateBlendShape(a,e,i)}}updateBlendShape(s,e,t){for(const a of this._rendererList)if(a.blendShape){let r=this.propertyCache.get(a);if(r&&e in r)r[e](t);else{r=a;for(const i of s){if(!r[i]){r=null;break}r=r[i]}if(!r||r==a)continue;this.propertyCache.get(a)||this.propertyCache.set(a,{}),this.propertyCache.get(a)[e]=r,r(t)}}}updateSkeletonAnimMix(s){let e=0;for(let t of s)e+=t.weight;if(s.length>0){let t=this._avatar.boneData,a=t.length;for(let r=0;r<a;r++){const i=t[r];let n=this.skeltonPoseObject3D[i.boneName];if(s[0].clip.useSkeletonPos){this._bonePos.copyFrom(this.getPosition(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonPos){let c=this.getPosition(i.bonePath,this._skeletonTime,l.clip);u.HELP_0.lerp(this._bonePos,c,l.weight/e),this._bonePos.copyFrom(u.HELP_0)}}n.transform.localPosition=this._bonePos}this._boneRot.copyFrom(this.getRotation(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];let c=this.getRotation(i.bonePath,this._skeletonTime,l.clip);j.HELP_2.slerp(this._boneRot,c,l.weight/e),this._boneRot.copyFrom(j.HELP_2)}if(n.transform.localRotQuat=this._boneRot,s[0].clip.useSkeletonScale){this._boneScale.copyFrom(this.getScale(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonScale){let c=this.getScale(i.bonePath,this._skeletonTime,l.clip);u.HELP_0.lerp(this._boneScale,c,l.weight/e),this._boneScale.copyFrom(u.HELP_0)}}n.transform.localScale=this._boneScale}}}}getPosition(s,e,t=this._currentSkeletonClip.clip){return t.positionCurves.has(s)?t.positionCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localPosition}getRotation(s,e,t=this._currentSkeletonClip.clip){if(t.rotationCurves.has(s)){let a=t.rotationCurves.get(s).getValue(e);return j.HELP_0.set(a.x,a.y,a.z,a.w),j.HELP_0}return this.skeltonTPoseObject3D[s].localQuaternion}getScale(s,e,t=this._currentSkeletonClip.clip){return t.scaleCurves.has(s)?t.scaleCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localScale}getAnimationClipState(s){for(let e of this._clipsState)if(e.clip.clipName===s)return e;return null}cloneMorphRenderers(){let s={};for(const e of this._rendererList)for(const t in e.geometry.morphTargetDictionary){let a=s[t]||[];a.push(e),s[t]=a}return s}};Pa=Jb([Vt(Pa,"AnimatorComponent")],Pa);class Nd{clip;weight=0;get totalTime(){return this.clip.stopTime-this.clip.startTime}constructor(e){this.clip=e}}class Wb{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 Uo{index;time;timeEnd;coeff=[]}var or=(s=>(s[s.PingPong=0]="PingPong",s[s.Repeat=1]="Repeat",s[s.Clamp=2]="Clamp",s))(or||{});class ks{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 wi{_totalTime=1;_cache=new Uo;_cacheOut={lhsIndex:0,rhsIndex:0};_InvalidateCache=!1;curve=[];serializedVersion;preWarpMode;postWarpMode;rotationOrder;get cacheOut(){return this._cacheOut}constructor(e,t=or.Repeat,a=or.Repeat){if(e)for(let r=0;r<e.length;r++){const i=e[r];this.addKeyFrame(i)}this.preWarpMode=t,this.postWarpMode=a}get totalTime(){return this._totalTime}get first(){return this.curve[0]}get last(){return this.curve[this.curve.length-1]}addKeyFrame(e){this.curve.indexOf(e)==-1&&this.curve.push(e),this.calcTotalTime()}removeKeyFrame(e){let t=this.curve.indexOf(e);t!=-1&&this.curve.splice(t,1),this.calcTotalTime()}calculateCacheData(e,t,a,r=0){let i=this.curve,n=i[t],o=i[a];e.index=t,e.time=n.time+r,e.timeEnd=o.time+r,e.index=t;let l,c,f,d,h,b,p;l=o.time-n.time,l=Math.max(l,1e-4),f=o.value-n.value,c=1/(l*l),d=n.outSlope,h=o.inSlope,b=d*l,p=h*l,e.coeff[0]=(b+p-f-f)*c/l,e.coeff[1]=(f+f+f-b-b-p)*c,e.coeff[2]=d,e.coeff[3]=n.value,this.setupStepped(e.coeff,n,o)}getValue(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),this.calculateCacheData(this._cache,this._cacheOut.lhsIndex,this._cacheOut.rhsIndex,0),this.evaluateCache(this._cache,e)}getCurveFramesExtent(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),{lhsIndex:this._cacheOut.lhsIndex,rhsIndex:this._cacheOut.rhsIndex,time:e}}getKeyCount(){return this.curve.length}getKey(e){return this.curve[e]}unSerialized(e){this.preWarpMode=e.m_PreInfinity,this.postWarpMode=e.m_PostInfinity,this.rotationOrder=e.m_RotationOrder;let t=e.m_Curve.length;for(let a=0;a<t;a++)this.curve[a]=new ks,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 ks,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==or.Clamp?e=a:this.preWarpMode==or.PingPong?e=gn(e,a,r):e=pn(e,a,r):e>r&&(this.postWarpMode==or.Clamp?e=r:this.postWarpMode==or.PingPong?e=gn(e,a,r):e=pn(e,a,r)),e}evaluateCache(e,t){let a=t-e.time;return a*(a*(a*e.coeff[0]+e.coeff[1])+e.coeff[2])+e.coeff[3]}findCurve(e,t){let a=this.curve;for(let r=1;r<a.length;r++){let i=a[r-1],n=a[r];i.time<=e&&n.time>e&&(t.lhsIndex=r-1,t.rhsIndex=r)}}setupStepped(e,t,a){(isNaN(t.outSlope)||isNaN(a.inSlope))&&(e[0]=0,e[1]=0,e[2]=0,e[3]=t.value)}invalidateCache(){this._InvalidateCache=!0}calcTotalTime(){let e=0;for(let t of this.curve)t?e=Math.max(e,t.time):console.error(t);this._totalTime=e}static scaleCurveValue(e,t){if(!e._InvalidateCache)for(let a=0;a<e.curve.length;a++){let r=e.curve[a];r.value*=t,r.inSlope*=t,r.outSlope*=t}e.invalidateCache()}}class Vd extends wi{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 Pd{curve={}}var ci=(s=>(s[s.Default=0]="Default",s[s.Clamp=1]="Clamp",s[s.Once=1]="Once",s[s.Loop=2]="Loop",s[s.PingPong=4]="PingPong",s[s.ClampForever=8]="ClampForever",s))(ci||{});class Zb{name;objAnimClip;totalTime=0;time=0;_stopTime=0;_loopTime;_wrapMode;_sampleRate;get wrapMode(){return this._wrapMode||(this._wrapMode=0),this._wrapMode}set wrapMode(e){this._wrapMode=e}parse(e){this.objAnimClip={};let t=e.AnimationClip,{m_Name:a,m_AnimationClipSettings:r,m_WrapMode:i,m_SampleRate:n}=t;this.name=a,this._wrapMode=i,this._sampleRate=n,this._loopTime=r.m_LoopTime;for(const o in t.m_EditorCurves)if(Object.prototype.hasOwnProperty.call(t.m_EditorCurves,o)){const l=t.m_EditorCurves[o];let c=l.attribute,f=new Vd;f.unSerialized(l),this.totalTime=Math.max(this.totalTime,f.totalTime);let d=this.objAnimClip[l.path];d||(d=new Pd,this.objAnimClip[l.path]=d),d.curve[c]=f}}}class Od{transform;quaternion;materialColor}class Ri{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 zr{static Complete=0;static Seek=1;_rootObject3D;_animation;_propertyCache;_currentClip;_frame=0;_time=0;_isPlaying=!0;speed=1;_propertyTagDic;constructor(e){this._rootObject3D=e.object3D,this._animation=e,this._propertyTagDic=new Map,this.reset()}reset(){this._propertyCache={},this._propertyTagDic.clear()}get time(){return this._time}get currentClip(){return this._currentClip}play(e,t=!0){this._isPlaying=!0,t&&(this._time=0),e!=this._currentClip&&e&&this.parseAnimClip(e),this._currentClip=e,this.validProperty()}parseAnimClip(e){this.reset();for(const t in e.objAnimClip){let a=e.objAnimClip[t],r=this._rootObject3D,i={};if(t==""?r=this._rootObject3D:r=this._rootObject3D.getObjectByName(t),!r)continue;let n=new Od;this._propertyTagDic.set(r,n);let o=a.curve;for(const l in o){Ri.updatePropertyTag(n,l);let c=this._propertyCache[t]||={},f=Ri.Property[l].split("."),d=f[0];if(f.length>1){let h=i[d];h||(h=i[d]=r[d]),c[l]={value:h,property:f[1]}}else c[l]={value:r,property:f[0]}}}return this}stop(){return this._isPlaying=!1,this}toggle(){return this._isPlaying=!this._isPlaying,this}get isPlaying(){return this._isPlaying}update(e,t){if(e=e*.001,t=t*.001,!this._currentClip||this._frame==e||!this._isPlaying)return;this._frame=e;let a=this._time;this._time=this.calcTime(a+t*this.speed),this.validProperty(),this._currentClip.wrapMode!=ci.Loop&&this._currentClip.wrapMode!=ci.Default&&(this.speed>0?this._time>=this._currentClip.totalTime:this._time<=0)&&(this._isPlaying=!1,this._animation.statusCall(zr.Complete,a,this._time)),this._animation.statusCall(zr.Seek,a,this._time)}seek(e){return this._time=this.calcTime(e),this._rootObject3D&&this.validProperty(),this}calcTime(e){return this._currentClip.wrapMode==ci.Loop||this._currentClip.wrapMode==ci.Default?e=Bn(e,this._currentClip.totalTime):e=se(e,0,this._currentClip.totalTime),e}validProperty(){for(const e in this._currentClip.objAnimClip){let a=this._currentClip.objAnimClip[e].curve;for(const r in a){const i=a[r];let n=this._propertyCache[e][r],o=i.getValue(this._time);r in Ri.Scale&&(o*=Ri.Scale[r]),n.value[n.property]=o}}this._propertyTagDic.forEach((e,t)=>{this.applyProperty(e,t)})}applyProperty(e,t){e.quaternion&&E.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 jb{clipName;data;time}class Ii extends $e{static SEEK="SEEK";static COMPLETE="COMPLETE";animation;frame;constructor(e,t){super(t),this.animation=e}}class jo extends Pe{_animator;_clips=[];defaultClip;autoPlay;_seekEvent;_completeEvent;_keyFrameList;constructor(){super(),this._seekEvent=new Ii(this,Ii.SEEK),this._completeEvent=new Ii(this,Ii.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 zr(this)}onUpdate(){this.enable&&this._animator.update(Fe.time,Fe.delta)}appendClip(e){this._clips.push(e),this.play(e.name)}statusCall(e,t,a){if(e==zr.Complete)this.eventDispatcher.dispatchEvent(this._completeEvent);else if(e==zr.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(jo).copyComponent(this)}}var Yb=Object.getOwnPropertyDescriptor,Xb=(s,e,t,a)=>{for(var r=a>1?void 0:a?Yb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let lr=class extends ${skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Be.SkinnedMesh)}get geometry(){return this._geometry}set geometry(s){this.skinJointsName=s.skinNames;let e=[];for(let t=0;t<s.bindPose.length;t++)e.push(new Float32Array(s.bindPose[t].rawData.slice(0,16)));this.skinInverseBindMatrices=e,super.geometry=s}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(Pa),!this.skeletonAnimation){let s=this.object3D.parentObject.parentObject.getComponentsInChild(Pa);s.length>0&&(this.skeletonAnimation=s[0]);let e=this.object3D;for(;!this.skeletonAnimation&&e;)this.skeletonAnimation=e.getComponentFromParent(Pa),e.parent&&(e=e.parent.object3D)}}get blendShape(){return this.morphData}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(s){if(this.mSkeletonAnimation=s,!!s&&!this.mJointIndexTableBuffer){let e=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new ve(e.length,0,new Float32Array(e)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(s){this.mInverseBindMatrixData=s;var e=new Float32Array(s.length*16);for(let t=0;t<s.length;t++){let a=t*16,r=s[t];e.set(r,a)}this.mInverseBindMatrixBuffer=new ve(e.byteLength,0,e),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(s){let e=s.addComponent(lr),t=[];for(const a of this.materials)t.push(a.clone());e.materials=t,e.geometry=this.geometry,e.castShadow=this.castShadow,e.castGI=this.castGI,e.receiveShadow=this.receiveShadow,e.rendererMask=this.rendererMask,e.skinJointsName=this.skinJointsName,e.skinInverseBindMatrices=this.skinInverseBindMatrices,e.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(s,e,t,a){for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++){const l=n[o];!l.pipeline&&this.mSkeletonAnimation&&(l.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),l.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),l.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(s,e,t,a)}};lr=Xb([Vt(lr,"SkinnedMeshRenderer2")],lr);class Hb extends Pe{_targetRenderers={};_vec3=new u;_matrix4=new E;_quaternion=new j;init(e){let t=this.fetchMorphRenderers(this.object3D,lr),a=this.fetchMorphRenderers(this.object3D,$);t.push(...a);for(const r of t){Wt.hasMask(r.rendererMask,Be.MorphTarget)&&r.selfCloneMaterials("MORPH_TARGET_UUID");for(const n in r.geometry.morphTargetDictionary){let o=this._targetRenderers[n]||[];o.push(r),this._targetRenderers[n]=o}}}getMorphRenderersByKey(e){return this._targetRenderers[e]}cloneMorphRenderers(){let e={};for(let t in this._targetRenderers)e[t]=this._targetRenderers[t];return e}applyBlendShape(e,t,a=1){if(!e){console.warn("blendShape is null");return}this._vec3.setFromArray(e.transform.transform[3]),this._vec3.multiplyScalar(a),this.object3D.transform.localPosition=this._vec3,this._vec3.setFromArray(e.transform.transform[2]),this._matrix4.copyColFrom(2,this._vec3),this._vec3.setFromArray(e.transform.transform[1]),this._matrix4.copyColFrom(1,this._vec3),this._vec3.setFromArray(e.transform.transform[0]),this._matrix4.copyColFrom(0,this._vec3),this._matrix4.transpose(),this._quaternion.fromMatrix(this._matrix4),this.object3D.localQuaternion=this._quaternion;for(let r in t){let i=this._targetRenderers[r],n=t[r],o=e.texture[n];this.applyMorphTargetInfluence(r,o,i)}}applyMorphTargetInfluence(e,t,a){for(let r of a)r.setMorphInfluence(e,t)}fetchMorphRenderers(e,t){let a=e.getComponentsInChild(t),r=[];for(let i of a)i.hasMask(Be.MorphTarget)&&r.push(i);return r}}class Kb{texture;transform}var Ld=(s=>(s.mouthRollLower="mouthRollLower",s.browOuterUp_L="browOuterUpLeft",s.mouthSmile_L="mouthSmileLeft",s.jawRight="jawRight",s.eyeLookOut_L="eyeLookOutLeft",s.mouthFunnel="mouthFunnel",s.mouthUpperUp_R="mouthUpperUpRight",s.browDown_L="browDownLeft",s.jawLeft="jawLeft",s.mouthLowerDown_L="mouthLowerDownLeft",s.noseSneer_R="noseSneerRight",s.jawForward="jawForward",s.mouthLowerDown_R="mouthLowerDownRight",s.browInnerUp="browInnerUp",s.mouthRollUpper="mouthRollUpper",s.mouthStretch_R="mouthStretchRight",s.mouthPucker="mouthPucker",s.eyeBlink_L="eyeBlinkLeft",s.mouthUpperUp_L="mouthUpperUpLeft",s.mouthShrugUpper="mouthShrugUpper",s.eyeLookIn_R="eyeLookInRight",s.noseSneer_L="noseSneerLeft",s.mouthFrown_L="mouthFrownLeft",s.cheekSquint_L="cheekSquintLeft",s.eyeLookDown_L="eyeLookDownLeft",s.mouthDimple_L="mouthDimpleLeft",s.mouthFrown_R="mouthFrownRight",s.eyeLookIn_L="eyeLookInLeft",s.eyeLookOut_R="eyeLookOutRight",s.mouthLeft="mouthLeft",s.mouthStretch_L="mouthStretchLeft",s.mouthPress_L="mouthPressLeft",s.mouthDimple_R="mouthDimpleRight",s.eyeWide_R="eyeWideRight",s.browDown_R="browDownRight",s.eyeLookUp_R="eyeLookUpRight",s.eyeBlink_R="eyeBlinkRight",s.cheekSquint_R="cheekSquintRight",s.mouthRight="mouthDimpleRight",s.eyeLookDown_R="eyeLookDownRight",s.eyeLookUp_L="eyeLookUpLeft",s.eyeSquint_L="eyeSquintLeft",s.jawOpen="jawOpen",s.browOuterUp_R="browOuterUpRight",s.mouthClose="mouthClose",s.mouthShrugLower="mouthShrugLower",s.eyeWide_L="eyeWideLeft",s.tongueOut="tongueOut",s.eyeSquint_R="eyeSquintRight",s.cheekPuff="cheekPuff",s.mouthPress_R="mouthPressRight",s.mouthSmile_R="mouthSmileRight",s))(Ld||{});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=k.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 Ka{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,k.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=k.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 Ka{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,k.device.queue.writeBuffer(this._argumentsBuffer,0,this.shareDataBuffer))}allocationMemorySet(e){this.argumentsData={};let t=0;for(let r=0;r<e.length;r++){const i=e[r];t+=i.data.length}this.allocation(t*4);let a=this;for(let r=0;r<e.length;r++){const i=e[r],n=i.name;this.argumentsData[n]=this.allocation_node(i.data.length*4),a[n]=this.argumentsData[n]}}generateGPUBuffer(){let e=k.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 u(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 Pe{focus;distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Kr),!this._camera){console.error("FirstPersonCameraController need camera");return}if(!this.focus){console.error("FirstPersonCameraController need target");return}m.inputSystem.addEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.addEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){m.inputSystem.addEventListener(O.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){m.inputSystem.removeEventListener(O.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+=m.inputSystem.wheelDelta*.1}onUpdate(){let e=new u;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t}destroy(e){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var Oe=(s=>(s[s.Key_BackSpace=8]="Key_BackSpace",s[s.Key_Tab=9]="Key_Tab",s[s.Key_Clear=12]="Key_Clear",s[s.Key_Enter=13]="Key_Enter",s[s.Key_Shift_L=16]="Key_Shift_L",s[s.Key_Control_L=17]="Key_Control_L",s[s.Key_Alt_L=18]="Key_Alt_L",s[s.Key_Pause=19]="Key_Pause",s[s.Key_CapsLock=20]="Key_CapsLock",s[s.Key_Escape=21]="Key_Escape",s[s.Key_Esc=27]="Key_Esc",s[s.Key_Space=32]="Key_Space",s[s.Key_Prior=33]="Key_Prior",s[s.Key_Next=34]="Key_Next",s[s.Key_End=35]="Key_End",s[s.Key_Home=36]="Key_Home",s[s.Key_Left=37]="Key_Left",s[s.Key_Up=38]="Key_Up",s[s.Key_Right=39]="Key_Right",s[s.Key_Down=40]="Key_Down",s[s.Key_Select=41]="Key_Select",s[s.Key_Print=42]="Key_Print",s[s.Key_Execute=43]="Key_Execute",s[s.Key_Insert=45]="Key_Insert",s[s.Key_Delete=46]="Key_Delete",s[s.Key_Help=47]="Key_Help",s[s.Key_0=48]="Key_0",s[s.Key_1=49]="Key_1",s[s.Key_2=50]="Key_2",s[s.Key_3=51]="Key_3",s[s.Key_4=52]="Key_4",s[s.Key_5=53]="Key_5",s[s.Key_6=54]="Key_6",s[s.Key_7=55]="Key_7",s[s.Key_8=56]="Key_8",s[s.Key_9=57]="Key_9",s[s.Key_A=65]="Key_A",s[s.Key_B=66]="Key_B",s[s.Key_C=67]="Key_C",s[s.Key_D=68]="Key_D",s[s.Key_E=69]="Key_E",s[s.Key_F=70]="Key_F",s[s.Key_G=71]="Key_G",s[s.Key_H=72]="Key_H",s[s.Key_I=73]="Key_I",s[s.Key_J=74]="Key_J",s[s.Key_K=75]="Key_K",s[s.Key_L=76]="Key_L",s[s.Key_M=77]="Key_M",s[s.Key_N=78]="Key_N",s[s.Key_O=79]="Key_O",s[s.Key_P=80]="Key_P",s[s.Key_Q=81]="Key_Q",s[s.Key_R=82]="Key_R",s[s.Key_S=83]="Key_S",s[s.Key_T=84]="Key_T",s[s.Key_U=85]="Key_U",s[s.Key_V=86]="Key_V",s[s.Key_W=87]="Key_W",s[s.Key_X=88]="Key_X",s[s.Key_Y=89]="Key_Y",s[s.Key_Z=90]="Key_Z",s[s.Key_KP_0=96]="Key_KP_0",s[s.Key_KP_1=97]="Key_KP_1",s[s.Key_KP_2=98]="Key_KP_2",s[s.Key_KP_3=99]="Key_KP_3",s[s.Key_KP_4=100]="Key_KP_4",s[s.Key_KP_5=101]="Key_KP_5",s[s.Key_KP_6=102]="Key_KP_6",s[s.Key_KP_7=103]="Key_KP_7",s[s.Key_KP_8=104]="Key_KP_8",s[s.Key_KP_9=105]="Key_KP_9",s[s.Key_Multiply=106]="Key_Multiply",s[s.Key_Add=107]="Key_Add",s[s.Key_Separator=108]="Key_Separator",s[s.Key_Subtract=109]="Key_Subtract",s[s.Key_Decimal=110]="Key_Decimal",s[s.Key_Divide=111]="Key_Divide",s[s.Key_F1=112]="Key_F1",s[s.Key_F2=113]="Key_F2",s[s.Key_F3=114]="Key_F3",s[s.Key_F4=115]="Key_F4",s[s.Key_F5=116]="Key_F5",s[s.Key_F6=117]="Key_F6",s[s.Key_F7=118]="Key_F7",s[s.Key_F8=119]="Key_F8",s[s.Key_F9=120]="Key_F9",s[s.Key_F10=121]="Key_F10",s[s.Key_F11=122]="Key_F11",s[s.Key_F12=123]="Key_F12",s[s.Key_F13=124]="Key_F13",s[s.Key_F14=125]="Key_F14",s[s.Key_F15=126]="Key_F15",s[s.Key_F16=127]="Key_F16",s[s.Key_F17=128]="Key_F17",s[s.Key_F18=129]="Key_F18",s[s.Key_F19=130]="Key_F19",s[s.Key_F20=131]="Key_F20",s[s.Key_F21=132]="Key_F21",s[s.Key_F22=133]="Key_F22",s[s.Key_F23=134]="Key_F23",s[s.Key_F24=135]="Key_F24",s[s.Key_Num_Lock=136]="Key_Num_Lock",s[s.Key_Scroll_Lock=137]="Key_Scroll_Lock",s))(Oe||{});class ig extends Pe{moveSpeed=2;targetPos=new u(0,0,10);lookAtPos=new u(0,0,0);config={shiftMoveScale:20};_moveScale=1;_dir;_mouseFactory=25;_factory=1.5;_mouseDown=!1;_lastPos;_keyState;constructor(){super(),this._lastPos=new u,this._keyState={front:!1,back:!1,left:!1,right:!1,q:!1,e:!1},this.setCamera(new u(0,0,100),new u(0,0,0))}setCamera(e,t){this.targetPos.copyFrom(e),this.lookAtPos.copyFrom(t),this.Reset()}start(){m.inputSystem.addEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.addEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.mouseDown,this),m.inputSystem.addEventListener(va.KEY_UP,this.keyUp,this),m.inputSystem.addEventListener(va.KEY_DOWN,this.keyDown,this),this.transform.lookAt(this.targetPos,this.lookAtPos)}mouseWheel(e){}keyUp(e){switch(e.keyCode){case Oe.Key_W:this._keyState.front=!1;break;case Oe.Key_S:this._keyState.back=!1;break;case Oe.Key_A:this._keyState.left=!1;break;case Oe.Key_D:this._keyState.right=!1;break;case Oe.Key_Shift_L:this._moveScale=1;break;case Oe.Key_Q:this._keyState.q=!1;break;case Oe.Key_E:this._keyState.e=!1;break;case Oe.Key_F:this.transform.lookAt(this.targetPos,this.lookAtPos);break}}keyDown(e){switch(e.keyCode){case Oe.Key_W:this._keyState.front=!0;break;case Oe.Key_S:this._keyState.back=!0;break;case Oe.Key_A:this._keyState.left=!0;break;case Oe.Key_D:this._keyState.right=!0;break;case Oe.Key_Q:this._keyState.q=!0;break;case Oe.Key_E:this._keyState.e=!0;break;case Oe.Key_Shift_L:this._moveScale=this.config.shiftMoveScale}}Reset(){this._lastPos.x=m.inputSystem.mouseLastX,this._lastPos.y=m.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=se(Fe.delta,0,.016);if(this._mouseDown&&(e.rotationY-=this.internal(e.rotationY+(m.inputSystem.mouseLastX-this._lastPos.x)*.25,e.rotationY,t*this._mouseFactory),e.rotationX-=this.internal(e.rotationX+(m.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=wr(e.y,e.y-this.moveSpeed*this._moveScale,t*this._factory)),this._keyState.e&&(e.y=wr(e.y,e.y+this.moveSpeed*this._moveScale,t*this._factory))}destroy(e){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.mouseDown,this),m.inputSystem.removeEventListener(va.KEY_UP,this.keyUp,this),m.inputSystem.removeEventListener(va.KEY_DOWN,this.keyDown,this),super.destroy(e)}}class Qi{static add(e,t,a){return a||(a=new u),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 u),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 u),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 u),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 u),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=u.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 u.distance(e,t)}static getRandomXYZ(e=-100,t=100){return new u(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 u(Math.random()*t+e,Math.random()*r+a,Math.random()*t+e)}static sphere(e){let t=e*Math.random(),a=new u(Math.random()*1-.5,Math.random()*1-.5,Math.random()*1-.5);return a.normalize(),a.scaleBy(t),a}static sphereXYZ(e,t,a=1,r=1,i=1){let n=e+(t-e)*Math.random(),o=new u(Math.random()*a-a*.5,Math.random()*r-r*.5,Math.random()*i-i*.5);return o.normalize(),o.scaleBy(n),o}}class sg extends Pe{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 u;_tempPos=new u;constructor(){super(),this._currentPos=new ee,this._targetPos=new ee}start(){this.camera=this.object3D.getOrAddComponent(Kr),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onMouseDown,this),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onMouseMove,this,null,10),m.inputSystem.addEventListener(O.POINTER_UP,this.onMouseUp,this,null,10),m.inputSystem.addEventListener(O.POINTER_WHEEL,this.onMouseWheel,this)}flowTarget(e,t=u.ZERO){this._flowTarget=e,this._flowOffset||=new u,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=In.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*Qi.distance(this._currentPos.transform.worldPosition,this.camera.transform.worldPosition)/10,this.distance-=m.inputSystem.wheelDelta*this._wheelStep,this.distance=se(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&&(u.HELP_1.x=-1*e.movementX*Math.cos(this._roll*Math.PI/180)-e.movementY*Math.sin(this._roll*Math.PI/180),u.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+=u.HELP_1.x*this.mouseRightFactor,this._targetPos.z+=u.HELP_1.z*this.mouseRightFactor),this._mouseLeftDown&&(this.roll-=e.movementX*Fe.delta*.001*this.mouseLeftFactor,this.pitch-=e.movementY*Fe.delta*.001*this.mouseLeftFactor,this.pitch=se(this.pitch,this._topClamp,this._bottomClamp)))}onBeforeUpdate(e){if(!this.enable)return;this._flowTarget&&(u.HELP_0.copyFrom(this._flowTarget.transform.worldPosition),u.HELP_0.add(this._flowOffset,u.HELP_0),this.target=u.HELP_0);let t=se(Fe.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=j.HELP_0;a.fromEulerAngles(this._pitch,this._roll,0),this._tempDir.applyQuaternion(a),this._tempPos=Qi.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,u.UP)}destroy(e){m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onMouseDown,this),m.inputSystem.removeEventListener(O.POINTER_MOVE,this.onMouseMove,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onMouseUp,this),m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.onMouseWheel,this),super.destroy(e),this.camera=null,this._flowTarget=null}}class ng extends Pe{_camera;autoRotate=!1;autoRotateSpeed=.1;rotateFactor=.5;zoomFactor=.1;panFactor=.25;_smooth=5;_minDistance=1;_maxDistance=1e5;_maxPolarAngle=90;_minPolarAngle=-90;_target=new u(0,0,0);_cTarget=new u(0,0,0);_position=new u(0,0,0);_cPosition=new u(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=se(e,2e-6,this._maxDistance)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance=se(e,this._minDistance,1/0)}get minPolarAngle(){return this._minPolarAngle}set minPolarAngle(e){this._minPolarAngle=se(e,-90,this._maxPolarAngle)}get maxPolarAngle(){return this._maxPolarAngle}set maxPolarAngle(e){this._maxPolarAngle=se(e,this._minPolarAngle,90)}get spherical(){return this._spherical}start(){this._camera=this.object3D.getComponent(Kr),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,u.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,u.UP)}onWheel(e){e.deltaY=se(e.deltaY,-this._spherical.radius,this._spherical.radius),this._spherical.radius+=e.deltaY*this.zoomFactor,this._spherical.radius=se(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=se(this._spherical.phi,this.minPolarAngle,this.maxPolarAngle),this.updateCamera()}else e.mouseCode===2&&(Qi.mulScale(this.object3D.transform.up,e.movementY*this.panFactor*this._camera.aspect,u.HELP_1),e.ctrlKey||e.metaKey?this._target.y+=u.HELP_1.y:(this._target.x+=u.HELP_1.x,this._target.z+=u.HELP_1.z),Qi.mulScale(this.object3D.transform.right,-e.movementX*this.panFactor,u.HELP_1),this._target.x-=u.HELP_1.x,this._target.z-=u.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(){m.inputSystem.addEventListener(O.POINTER_WHEEL,this.onWheel,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onPointerDown,this),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onPointerMove,this),m.inputSystem.addEventListener(O.POINTER_UP,this.onPointerUp,this)}removeEventListener(){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.onWheel,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onPointerDown,this),m.inputSystem.removeEventListener(O.POINTER_MOVE,this.onPointerMove,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onPointerUp,this)}}const Gd=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 u,this}set(e,t,a){return this.radius=e,this.phi=t,this.theta=a,this}makeSafe(){return this.phi=Math.max(Gd,Math.min(Math.PI-Gd,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(se(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 Pe{focus;_rotation=new u(45,0,0);distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Kr),!this._camera){console.error("ThirdPersonCameraController need camera");return}if(!this.focus){console.error("ThirdPersonCameraController need target");return}m.inputSystem.addEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.addEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){m.inputSystem.addEventListener(O.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){m.inputSystem.removeEventListener(O.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){this._rotation.y+=e.movementX*.01,this._rotation.x+=e.movementY*.01}mouseWheel(e){this.distance+=m.inputSystem.wheelDelta*.1}onUpdate(){let e=new u;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t.subtract(e)}destroy(e){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var Le=(s=>(s[s.NORMAL=0]="NORMAL",s[s.DOWN=1]="DOWN",s[s.OVER=2]="OVER",s[s.DISABLE=3]="DISABLE",s))(Le||{});let cg=Math.PI,zd=cg*2;class Nr{a;b;c;d;tx;ty;constructor(e=1,t=0,a=0,r=1,i=0,n=0){this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n}clone(){return new Nr(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*rt;let t=Math.cos(e),a=Math.sin(e),r=this.a,i=this.b,n=this.c,o=this.d,l=this.tx,c=this.ty;this.a=r*t-i*a,this.b=r*a+i*t,this.c=n*t-o*a,this.d=n*a+o*t,this.tx=l*t-c*a,this.ty=l*a+c*t}}scale(e,t){e!==1&&(this.a*=e,this.c*=e,this.tx*=e),t!==1&&(this.b*=t,this.d*=t,this.ty*=t)}setTo(e,t,a,r,i,n){return this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n,this}transformPoint(e,t,a){let r=this.a*e+this.c*t+this.tx,i=this.b*e+this.d*t+this.ty;return a?(a.setTo(r,i,0,1),a):new u(r,i,0,1)}setTranslate(e,t){this.tx=e,this.ty=t}translate(e,t){this.tx+=e,this.ty+=t}mul(e){let t=this,a=e,r=t.a,i=t.b,n=t.c,o=t.d,l=t.tx,c=t.ty,f=a.a,d=a.b,h=a.c,b=a.d,p=a.tx,g=a.ty;d!==0||h!==0?(this.a=r*f+i*h,this.b=r*d+i*b,this.c=n*f+o*h,this.d=n*d+o*b,this.tx=f*l+h*c+p,this.ty=d*l+b*c+g):(this.a=r*f,this.b=i*b,this.c=n*f,this.d=o*b,this.tx=f*l+p,this.ty=b*c+g)}equals(e){return this.a==e.a&&this.b==e.b&&this.c==e.c&&this.d==e.d&&this.tx==e.tx&&this.ty==e.ty}prepend(e,t,a,r,i,n){let o=this.tx;if(e!=1||t!=0||a!=0||r!=1){let l=this.a,c=this.c;this.a=l*e+this.b*a,this.b=l*t+this.b*r,this.c=c*e+this.d*a,this.d=c*t+this.d*r}return this.tx=o*e+this.ty*a+i,this.ty=o*t+this.ty*r+n,this}append(e){let t=this.a,a=this.b,r=this.c,i=this.d;return(e.a!=1||e.b!=0||e.c!=0||e.d!=1)&&(this.a=e.a*t+e.b*r,this.b=e.a*a+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*a+e.d*i),this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*a+e.ty*i+this.ty,this}deltaTransformPoint(e){let t=this,a=t.a*e.x+t.c*e.y,r=t.b*e.x+t.d*e.y;return new u(a,r)}toString(){return"(a="+this.a+", b="+this.b+", c="+this.c+", d="+this.d+", tx="+this.tx+", ty="+this.ty+")"}createBox(e,t,a=0,r=0,i=0){let n=this;if(a!==0){a=a*rt;let o=Math.cos(a),l=Math.sin(a);n.a=o*e,n.b=l*t,n.c=-l*e,n.d=o*t}else n.a=e,n.b=0,n.c=0,n.d=t;n.tx=r,n.ty=i}createGradientBox(e,t,a=0,r=0,i=0){this.createBox(e/1638.4,t/1638.4,a,r+e/2,i+t/2)}_invertInto(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty;if(a==0&&r==0){e.b=e.c=0,t==0||i==0?e.a=e.d=e.tx=e.ty=0:(t=e.a=1/t,i=e.d=1/i,e.tx=-t*n,e.ty=-i*o);return}let l=t*i-a*r;if(l==0){e.identity();return}l=1/l;let c=e.a=i*l;a=e.b=-a*l,r=e.c=-r*l,i=e.d=t*l,e.tx=-(c*n+r*o),e.ty=-(a*n+i*o)}getScaleX(){let e=this;if(e.a==1&&e.b==0)return 1;let t=Math.sqrt(e.a*e.a+e.b*e.b);return this.getDeterminant()<0?-t:t}getScaleY(){let e=this;if(e.c==0&&e.d==1)return 1;let t=Math.sqrt(e.c*e.c+e.d*e.d);return this.getDeterminant()<0?-t:t}getSkewX(){return Math.atan2(this.d,this.c)-Math.PI/2}getSkewY(){return Math.atan2(this.b,this.a)}updateScaleAndRotation(e,t,a,r){if((a==0||a==zd)&&(r==0||r==zd)){this.a=e,this.b=this.c=0,this.d=t;return}a=a*rt,r=r*rt;let i=Math.cos(a),n=Math.sin(a);a==r?(this.a=i*e,this.b=n*e):(this.a=Math.cos(r)*e,this.b=Math.sin(r)*e),this.c=-n*t,this.d=i*t}preMultiplyInto(e,t){let a=e.a*this.a,r=0,i=0,n=e.d*this.d,o=e.tx*this.a+this.tx,l=e.ty*this.d+this.ty;(e.b!==0||e.c!==0||this.b!==0||this.c!==0)&&(a+=e.b*this.c,n+=e.c*this.b,r+=e.a*this.b+e.b*this.d,i+=e.c*this.a+e.d*this.c,o+=e.ty*this.c,l+=e.tx*this.b),t.a=a,t.b=r,t.c=i,t.d=n,t.tx=o,t.ty=l}$transformBounds(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty,l=e.x,c=e.y,f=l+e.width,d=c+e.height,h=t*l+r*c+n,b=a*l+i*c+o,p=t*f+r*c+n,g=a*f+i*c+o,A=t*f+r*d+n,D=a*f+i*d+o,_=t*l+r*d+n,U=a*l+i*d+o,v=0;h>p&&(v=h,h=p,p=v),A>_&&(v=A,A=_,_=v),e.x=Math.floor(h<A?h:A),e.width=Math.ceil((p>_?p:_)-e.x),b>g&&(v=b,b=g,g=v),D>U&&(v=D,D=U,U=v),e.y=Math.floor(b<D?b:D),e.height=Math.ceil((g>U?g:U)-e.y)}getDeterminant(){return this.a*this.d-this.b*this.c}}class $i extends Pe{isGUICanvas=!0;index=0;addChild(e){return this.object3D.addChild(e),this}removeChild(e){return this.object3D.removeChild(e),this}cloneTo(e){e.getOrAddComponent($i).copyComponent(this)}copyComponent(e){return e.index=e.index,this}}var Ze=(s=>(s[s.NONE=0]="NONE",s[s.POSITION=1]="POSITION",s[s.SPRITE=2]="SPRITE",s[s.COLOR=4]="COLOR",s[s.MAX=7]="MAX",s))(Ze||{});class xo{array;buffer;constructor(e){this.buffer=new ve(e,0),this.array=new Float32Array(this.buffer.memory.shareDataBuffer)}}class Jd extends Ee{_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 u(-a,-a,-a),t=new u(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(...fi.attUV);for(let i=0,n=this.maxQuadCount*fi.vertexCount;i<n;i++)a[i]=i;this._attributeUV=new Float32Array(fi.vertexCount*e*this._uvSize),this._attributeVIndex=new Float32Array(fi.vertexCount*e*this._vIndexSize),this._attributeUV.set(t,0),this._attributeVIndex.set(a,0);let r=[];for(let i=0;i<e;i++)for(let n=0;n<fi.indecies.length;n++){const o=fi.indecies[n]+i*4;r.push(o)}return this._faceIndexes=new Uint32Array(e*6),this._faceIndexes.set(r,0),this.setIndices(this._faceIndexes),this.setAttribute(V.uv,this._attributeUV),this.setAttribute(V.vIndex,this._attributeVIndex),this.updateSubGeometry(0,0,this._faceIndexes.length),this}createBuffer(){let e=this.maxQuadCount;this._posAttribute=new xo(e*4),this._spriteAttribute=new xo(e*12),this._colorAttribute=new xo(e*4)}fillQuad(e,t){e.dirtyAttributes&Ze.POSITION&&this.fillQuadPosition(e,t),e.dirtyAttributes&Ze.COLOR&&this.fillQuadColor(e,t),e.dirtyAttributes&Ze.SPRITE&&this.fillQuadSprite(e,t)}fillQuadPosition(e,t){Wd.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;Wd.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==ni.Sliced&&(r=a.trimSize.x,r=(t.width-(a.offsetSize.z-a.trimSize.x))/r,i=a.trimSize.y,i=(t.height-(a.offsetSize.w-a.trimSize.y))/i);let n=a.guiTexture.dynamicId,o=a.uvRec,l=a.uvBorder,c=this._spriteAttribute.array,f=12*e.z;c[f+0]=o.x,c[f+1]=o.y,c[f+2]=o.z,c[f+3]=o.w,c[f+4]=l.x,c[f+5]=l.y,c[f+6]=l.z,c[f+7]=l.w,c[f+8]=r,c[f+9]=i,c[f+10]=n,c[f+11]=e.visible?1:0,this._onSpriteChange=!0}}class fg{static set(e,t,a,r,...i){let n=t*r+a;for(let o=0,l=i.length;o<l;o++)e[n+o]=i[o]}}class Wd extends fg{static setXYZW(e,t,a,r,i,n){this.set(e,t,0,4,a,r,i,n)}static setXYZ(e,t,a,r,i){this.set(e,t,0,4,a,r,i)}static setZ(e,t,a){this.set(e,t,3,4,a)}}class fi{static vertexCount=4;static attUV=[0,0,1,0,1,1,0,1];static indecies=[0,1,2,0,2,3]}class Zd{_textureMap=new Map;_textureList=[];build(e,t,a){let r=t._geometry;r.resetSubGeometries();let i=-1,n=0,o=0,l=0,c=0,f=this._textureList,d=this._textureMap;function h(){l>0&&(t.updateDrawCallSegment(c,o,l),t._uiRenderer.materials[c].setTextures(f),d.clear(),f.length=0,c++,o+=l,l=0,n=0)}d.clear(),f.length=0;let b=[],p=t.quadMaxCount-1;for(let g of e){let A=g.needUpdateQuads;b.length=0;const D=this.collectQuads(g.object3D,b);for(let _ of D){let U=_.sprite.guiTexture;if(d.has(U.staticId)||(n==7&&h(),d.set(U.staticId,U),U.dynamicId=n,f[n]=U.texture,n+=1),_.z=++i,l+=6,_.cacheTextureId!=U.dynamicId&&(_.dirtyAttributes=Ze.MAX,_.cacheTextureId=U.dynamicId),(A||a)&&(_.dirtyAttributes=Ze.MAX),_.dirtyAttributes&Ze.POSITION&&_.applyTransform(g),_.dirtyAttributes&&_.writeToGeometry(r,g),i==p)return h(),!0}}return h(),!1}collectQuads(e,t){t||=[];let a=e.components.values();for(let r of a){let i=r;if(i.isUIShadow||!i.mainQuads)continue;let n=i.getShadowRender();n&&this.push(n.mainQuads,t),this.push(i.mainQuads,t)}return t}push(e,t){e&&e.length>0&&t.push(...e)}}class yo{static bindTextureArray(){let e="";for(let t=0;t<7;t++)e+=`
|
|
11413
|
+
`}class kd{sunRadius=500;sunRadiance=11;mieG=.76;mieHeight=1200;eyePos=1500;sunX=.71;sunY=.56;sunBrightness=1;displaySun=!0;defaultTextureCubeSize=512;defaultTexture2DSize=1024;skyColor=new P(1,1,1,1)}class Ed extends Cs{_internalTexture;_cubeSize;setting;constructor(e){return super(),this.setting=e,this._cubeSize=e.defaultTextureCubeSize,this._internalTexture=new Tb(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 Tb extends Ae{_computeShader;_uniformBuffer;constructor(e,t){super(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.initCompute(e,t)}initCompute(e,t){this._uniformBuffer=new dt(64),this._uniformBuffer.apply(),this._computeShader=new fe(Fd.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=y.beginCommandEncoder();return y.computeCommand(t,[this._computeShader]),y.endCommandEncoder(t),this}}var Mb=Object.getOwnPropertyDescriptor,Nb=(s,e,t,a)=>{for(var r=a>1?void 0:a?Mb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ei=class extends ot{constructor(){super();let s=new Ve("sky_vs_frag_wgsl","sky_fs_frag_wgsl");this.addRenderPass(s),s.setUniformVector3("eyesPos",new u),s.setUniformFloat("exposure",1),s.setUniformFloat("roughness",0);let e=s.shaderState;e.frontFace="cw",e.cullMode=wt.back,e.depthWriteEnabled=!1,e.depthCompare=et.less}};Ei=Nb([Ia(Ei,"SkyShader")],Ei);class wd extends mt{constructor(){super(),this.shader=new Ei,this.shader.setUniformVector3("eyesPos",new u),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 m.setting.sky.skyExposure}set exposure(e){m.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 Rd extends Na{gid=0;needUpdate=!0;autoUpdate=!1;radius=500;init(){super.init(),this.addRendererMask(Be.Reflection),this.alwaysRender=!0,this.object3D.bound=new pe(u.ZERO.clone(),u.MAX),us(this.transform.onPositionChange,()=>{this.needUpdate=!0})}onEnable(){J.instance.addRenderNode(this.transform.scene3D,this)}onDisable(){J.instance.removeRenderNode(this.transform.scene3D,this)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class Id extends ot{constructor(){super();let e=new Ve("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 te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),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?wt.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 Qd extends mt{constructor(){super(),this.shader=new Id,this.baseMap=m.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 Mr{center=new u;extents;max;min;size;tmpVecA=new u;tmpVecB=new u;tmpVecC=new u;tmpVecD=new u;radius=0;diffBetweenPoints=new u;owner;forward=new u(0,0,1);worldCenter;worldSize;_center=new u;constructor(e,t){this.center=e||new u(0,0,0),this.radius=t===void 0?.5:t}updateBound(){throw new Error("Method not implemented.")}containsPoint(e){var t=this.tmpVecA.subtract(e,this.center).lengthSquared,a=this.radius;return t<a*a}intersectsRay(e,t){var a=this.tmpVecA.copyFrom(e.origin).subtract(this.center),r=a.dotProduct(this.tmpVecB.copyFrom(e.direction).normalize()),i=a.dotProduct(a)-this.radius*this.radius;if(i>0&&r>0)return null;var n=r*r-i;if(n<0)return!1;var o=Math.abs(-r-Math.sqrt(n));return t&&t.copyFrom(e.direction).scaleBy(o).add(e.origin),!0}intersectsBoundingSphere(e){this.tmpVecA.subtract(e.center,this.center);var t=e.radius+this.radius;return this.tmpVecA.lengthSquared<=t*t}calculateTransform(e){this.update(e)}inFrustum(e,t){return t.containsSphere(e)}clone(){return new Mr(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 Td extends Rd{init(){super.init(),this.castShadow=!1,this.castGI=!1,this.addRendererMask(Be.Reflection),this.alwaysRender=!0,this.object3D.bound=new Mr(u.ZERO.clone(),this.radius)}debug(e,t=1){let a=new ee,r=a.addComponent($);r.addMask(Be.ReflectionDebug),r.geometry=new Rr(25,30,30);let i=m.setting.reflectionSetting,n=ne.getGBufferFrame(ne.reflections_GBuffer,i.width,i.height),o=new Qd;o.reflectionIndex=e,o.baseMap=n.getCompressGBufferTexture(),r.material=o,this.object3D.addChild(a),a.scaleX=t,a.scaleY=t,a.scaleZ=t}onEnable(){super.onEnable()}onDisable(){super.onDisable()}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}}class Fs extends ${skyMaterial;init(){super.init(),this.castShadow=!1,this.castGI=!0,this.addRendererMask(Be.Sky),this.alwaysRender=!0,this.object3D.bound=new pe(u.ZERO.clone(),u.MAX),this.geometry=new Rr(m.setting.sky.defaultFar,20,20),this.skyMaterial||=new wd}onEnable(){this._readyPipeline?(this.castNeedPass(),!this._inRenderer&&this.transform.scene3D&&(J.instance.sky=this,this._inRenderer=!0)):this.initPipeline()}onDisable(){this._inRenderer&&this.transform.scene3D&&(this._inRenderer=!1,J.instance.sky=null),super.onDisable()}nodeUpdate(e,t,a,r){super.nodeUpdate(e,t,a,r)}renderPass2(e,t,a,r,i,n=!1){super.renderPass2(e,t,a,r,i,n)}set map(e){this.skyMaterial.baseMap=e,this.skyMaterial.name==null&&(this.skyMaterial.name="skyMaterial"),this.material=this.skyMaterial}get map(){return this.skyMaterial.baseMap}get exposure(){return this.skyMaterial.exposure}set exposure(e){this.skyMaterial&&(this.skyMaterial.exposure=e)}get roughness(){return this.skyMaterial.roughness}set roughness(e){this.skyMaterial&&(this.skyMaterial.roughness=e)}useSkyReflection(){let e=new ee,t=e.addComponent(Td);t.autoUpdate=!1,e.x=0,e.y=300,e.z=0,this.object3D.addChild(e)}}class Vb{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 Pb extends Fs{_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 Vb,this._atmosphericScatteringSky=new Ed(new kd);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 Ir{static panelRatio=1;static quadMaxCountForWorld=256;static quadMaxCountForView=2048;static SortOrderStartWorld=7e3;static SortOrderStartView=8e3;static SortOrderCanvasSpan=1e4}var Kt=(s=>(s[s.View=0]="View",s[s.World=2]="World",s))(Kt||{}),ni=(s=>(s[s.Simple=0]="Simple",s[s.Sliced=1]="Sliced",s[s.Tiled=2]="Tiled",s[s.Filled=3]="Filled",s))(ni||{}),sr=(s=>(s[s.None=0]="None",s[s.BillboardY=9]="BillboardY",s[s.BillboardXYZ=10]="BillboardXYZ",s))(sr||{});class qi extends Pe{type;camera;_cameraPosition;constructor(){super(),this._cameraPosition=new u}onUpdate(){this.enable&&this.transform.view3D.camera&&this.updateBillboardMatrix()}updateBillboardMatrix(){let e=this.transform.view3D.camera;this._cameraPosition.copyFrom(e.transform.back),this.type==sr.BillboardXYZ||this.type==sr.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(qi);t.type=this.type}}var oi=(s=>(s[s.None=0]="None",s[s.Box=1]="Box",s[s.Capsule=2]="Capsule",s[s.Sphere=3]="Sphere",s[s.Mesh=4]="Mesh",s))(oi||{});class qe{_center;_size;_halfSize;_shapeType=0;static v3_help_0;static helpMatrix;static helpRay;constructor(){qe.v3_help_0||=new u,qe.helpMatrix||=new E,qe.helpRay||=new ea,this._center=new u,this._size=new u,this._halfSize=new u}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 li extends qe{_pickRet;box;constructor(){super(),this._shapeType=oi.Box,this.box=new pe(new u,new u)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.size);let r=qe.helpMatrix;r.copyFrom(t).invert();let i=qe.helpRay.copy(e);i.applyMatrix(r);let n=i.intersectBox(this.box,qe.v3_help_0);return n?(this._pickRet||(this._pickRet={intersectPoint:new u,distance:0}),this._pickRet.intersectPoint=n,this._pickRet.distance=u.distance(i.origin,qe.v3_help_0),this._pickRet):null}}class qt extends Pe{_shape;constructor(){super(),this._shape=new li}start(){m.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.set(this.transform.worldMatrix.index,this)}onEnable(e){xe.bindEnablePick(e,this,null)}onDisable(e){xe.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){m.setting.pick.mode=="pixel"&&this.transform.scene3D.view.pickFire.mouseEnableMap.delete(this.transform.worldMatrix.index),super.beforeDestroy(e)}}class Md{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 Ui(this.clip.skeleton)}reset(){this.time=0,this.weight=0,this._isEnd=!1}get name(){return this.clip.name}get currSkeletonPose(){return this._currSkeletonPose}update(e){this.time=(this.time+e*this.speed)%this.clip.totalTime;let t=this.time/this.clip.frameRate;if(this.currFrame=Math.trunc(t),this.t=t-this.currFrame,this.currFrame<0&&(this.currFrame=this.clip.numFrame+this.currFrame),this.time>=0?this.nextFrame=(this.currFrame+1)%this.clip.numFrame:(this.nextFrame=this.currFrame-1,this.nextFrame<0&&(this.nextFrame=this.clip.numFrame+this.nextFrame),this.t=1-this.t),this._isEnd)this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1;else if(this.currFrame!=this.lastFrame){let i=this.speed<0?0:this.clip.numFrame;this.currFrame==i&&(this.loop?(this.currFrame=0,this.nextFrame=1,this.time=this.t=0):(this.currFrame=this.nextFrame=this.speed<0?0:this.clip.numFrame-1,this._isEnd=!0));var a=this.clip.getEvents();if(a)for(let n of a){var r=Math.floor(n.time/this.clip.frameRate);if(r=Math.min(r,this.clip.numFrame),r=Math.max(r,0),r==this.currFrame){n.skeletonAnimation=this.animation,this.animation.eventDispatcher.dispatchEvent(n);break}}this.lastFrame=this.currFrame}this.clip.getLerpSkeletonPose(this.currFrame,this.nextFrame,this.t,this._currSkeletonPose)}}var Ob=Object.getOwnPropertyDescriptor,Lb=(s,e,t,a)=>{for(var r=a>1?void 0:a?Ob(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let nr=class extends Pe{isPlaying=!0;timeScale=1;_skeleton;_clips=[];_clipStates=new Map;_mixSkeletonPose;_mixTempSkeletonPose;_currentClipState;_bindList=[];_jointMatrixIndexTableBuffer;_crossFadeState;constructor(){super()}start(){}set skeleton(s){this._skeleton=s,this._mixSkeletonPose=new Ui(this._skeleton,!0),this._mixTempSkeletonPose=new Ui(this._skeleton);const e=new Float32Array(this._mixSkeletonPose.jointMatrixIndexTable);this._jointMatrixIndexTableBuffer=new ve(this._skeleton.numJoint*4,0,e)}get skeleton(){return this._skeleton}get finalSkeletonPose(){return this._mixSkeletonPose}get jointMatrixIndexTableBuffer(){return this._jointMatrixIndexTableBuffer}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){const a=s[t];let r=this._skeleton.getJointByName(a);e[t]=r?r.index:-1}return e}addAnimationClip(s){if(!this._clipStates.has(s.name)){this._clips.push(s);let e=new Md(s);e.animation=this,this._clipStates.set(s.name,e),this._currentClipState||this.setCurrentClipState(e)}}getAnimationClip(s){var e=this.getAnimationClipState(s);return e?e.clip:null}getAnimationClips(){return this._clips}getAnimationClipState(s){return this._clipStates.has(s)?this._clipStates.get(s):null}getAnimationClipStates(){return this._clipStates}pause(){this.isPlaying=!1}resume(){this.isPlaying=!0}play(s,e=1,t=!1){if(this._currentClipState&&this._currentClipState.name==s)return t&&this._currentClipState.reset(),!1;let a=this.getAnimationClipState(s);return a?(a.speed=e,a.reset(),this._clipStates.forEach((r,i)=>{r.weight=0}),this.setCurrentClipState(a),!0):!1}crossFade(s,e){if(e<.01){this.play(s);return}if(this._currentClipState.name==s)return;let t=this.getAnimationClipState(s);t&&(t.reset(),this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(t,this._currentClipState,e)):this._crossFadeState=new Gb(t,this._currentClipState,e),this._currentClipState=t)}setAnimIsLoop(s,e){this._clipStates.has(s)&&(this._clipStates.get(s).loop=e)}addJointBind(s,e){this._bindList.push({jointName:s,obj:e})}removeJointBind(s){for(let e=0;e<this._bindList.length;e++)if(this._bindList[e].obj==s){this._bindList.splice(e,1);break}}onUpdate(){if(!this.isPlaying)return;let s=Fe.delta*.001*this.timeScale;this._crossFadeState&&this._crossFadeState.update(s);var e=0,t=[];if(this._clipStates.forEach((r,i)=>{r.weight>0&&(r.update(s),e+=r.weight,t.push(r))}),t.length>0){this._mixSkeletonPose.copyFrom(t[0].currSkeletonPose);for(var a=1;a<t.length;++a){const r=t[a];this._mixTempSkeletonPose.lerp(this._mixSkeletonPose,r.currSkeletonPose,r.weight/e),this._mixSkeletonPose.copyFrom(this._mixTempSkeletonPose)}}}cloneTo(s){let e=s.addComponent(nr);e.skeleton=this.skeleton;for(var t=0;t<this._clips.length;++t)e.addAnimationClip(this._clips[t])}setCurrentClipState(s){this._currentClipState!=s&&(this._currentClipState=s,this._currentClipState.weight=1)}};nr=Lb([Vt(nr,"SkeletonAnimationComponent")],nr);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,Jb=(s,e,t,a)=>{for(var r=a>1?void 0:a?zb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Pa=class extends Pe{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 u;_boneScale=new u;_boneRot=new j;_crossFadeState;init(s){this.propertyCache=new Map,this._clipsMap=new Map,this._clips=[],this._clipsState=[],this._rendererList=this.object3D.getComponentsInChild(lr);let e=this.object3D.getComponentsInChild($);for(let t of e){let a=t;a.blendShape=t.morphData,this._rendererList.push(a)}for(const t of this._rendererList)Wt.hasMask(t.rendererMask,Be.MorphTarget)&&t.selfCloneMaterials("MORPH_TARGET_UUID")}start(){}debug(){}playAnim(s,e=0,t=1){let a=this.getAnimationClipState(s);a?(this._currentSkeletonClip&&(this._currentSkeletonClip.weight=0),this._currentSkeletonClip=a,this._currentSkeletonClip.weight=1,this._skeletonTime=e,this._skeletonSpeed=t,this._skeletonStart=!0):console.warn(`not has anim ${s}`)}crossFade(s,e){let t=this.getAnimationClipState(s);if(!t){console.warn(`not has anim ${s}`);return}if(e<.01||!this._currentSkeletonClip){this.playAnim(s);return}if(this._currentSkeletonClip&&this._currentSkeletonClip.clip.clipName===s)return;let a=t,r=this._currentSkeletonClip;this._crossFadeState?(this._crossFadeState.inClip&&(this._crossFadeState.inClip.weight=0),this._crossFadeState.outClip&&(this._crossFadeState.outClip.weight=0),this._crossFadeState.reset(a,r,e)):this._crossFadeState=new Wb(a,r,e),this._currentSkeletonClip=a}playBlendShape(s,e=0,t=1){this._clipsMap.has(s)?(this._currentBlendAnimClip=this._clipsMap.get(s),this._blendShapeTime=e,this._blendShapeSpeed=t,this._blendShapeStart=!0):console.warn(`not has blendShape ${s}`)}set avatar(s){this._avatarName=s,this.inverseBindMatrices=[],this._avatar=m.res.getObj(s);let e=this.buildSkeletonPose();const t=new Float32Array(e);this.jointMatrixIndexTableBuffer=new ve(this._avatar.count,0,t)}get numJoint(){return this._avatar.count}getJointIndexTable(s){let e=new Array;for(let t=0;t<s.length;t++){let a=this._avatar.boneMap.get(s[t]);e[t]=a?a.boneID:-1}return e}skeltonPoseObject3D={};skeltonTPoseObject3D={};buildSkeletonPose(){let s=[];for(const e of this._avatar.boneData){let t=new ee;E.getEuler(u.HELP_6,e.q,!0,"ZYX"),t.localPosition=e.t.clone(),t.localRotation=u.HELP_6.clone(),t.localScale=u.ONE,e.s.clone(),this.skeltonPoseObject3D[e.boneName]=t,this.skeltonTPoseObject3D[e.bonePath]=t.clone(),e.parentBoneName&&e.parentBoneName!=""?this.skeltonPoseObject3D[e.parentBoneName].addChild(t):(this.object3D.transform.scene3D&&this.object3D.transform.scene3D.addChild(t),this.root=t),s.push(t.transform.worldMatrix.index);let a=new E;a.copyFrom(t.transform.worldMatrix),a.invert(),this.inverseBindMatrices.push(a.rawData)}return s}set clips(s){this._clips=s;for(const e of s)this._clipsMap.set(e.clipName,e);this._clipsState=[];for(const e of s)this._clipsState.push(new Nd(e));this._currentSkeletonClip||this.playAnim(s[0].clipName)}get clips(){return this._clips}get clipsState(){return this._clipsState}cloneTo(s){let e=s.addComponent(Pa);e.avatar=this._avatarName,e.clips=this._clips}updateTime(){const s=Fe.delta*.001;this._skeletonStart&&(this._skeletonTime+=s*this._skeletonSpeed*this.timeScale,this._currentSkeletonClip&&this._currentSkeletonClip.clip.loopTime&&(this._skeletonTime=this._skeletonTime%this._currentSkeletonClip.clip.stopTime)),this._blendShapeStart&&(this._blendShapeTime+=s*this._blendShapeSpeed,this._currentBlendAnimClip&&(this._currentBlendAnimClip.loopTime&&this.playBlendShapeLoop?this._blendShapeTime=this._blendShapeTime%this._currentBlendAnimClip.stopTime:this._blendShapeTime=Math.min(this._blendShapeTime,this._currentBlendAnimClip.stopTime)-1e-4)),this._crossFadeState&&this._crossFadeState.update(s)}onUpdate(s){this.updateTime();let e=[];for(let t of this._clipsState)t.weight>0&&e.push(t);e.length>0?this.updateSkeletonAnimMix(e):this.updateSkeletonAnim(),this.updateMorphAnim()}updateSkeletonAnim(){if(this._currentSkeletonClip){let s=this._avatar.boneData,e=0,t=s.length;for(e=0;e<t;e++){const a=s[e];let r=this.skeltonPoseObject3D[a.boneName];if(this._currentSkeletonClip.clip.useSkeletonPos){let n=this.getPosition(a.bonePath,this._skeletonTime);r.transform.localPosition=n}let i=this.getRotation(a.bonePath,this._skeletonTime);if(r.transform.localRotQuat=i,this._currentSkeletonClip.clip.useSkeletonScale){let n=this.getScale(a.bonePath,this._skeletonTime);r.transform.localScale=n}}}}updateMorphAnim(){if(this._currentBlendAnimClip&&this._currentBlendAnimClip.floatCurves&&this._currentBlendAnimClip.floatCurves.size>0&&this._rendererList)for(const s of this._currentBlendAnimClip.floatCurves){let e=s[0],a=s[1].propertys,i=this._currentBlendAnimClip.floatCurves.get(e).getValue(this._blendShapeTime)/100;this.updateBlendShape(a,e,i)}}updateBlendShape(s,e,t){for(const a of this._rendererList)if(a.blendShape){let r=this.propertyCache.get(a);if(r&&e in r)r[e](t);else{r=a;for(const i of s){if(!r[i]){r=null;break}r=r[i]}if(!r||r==a)continue;this.propertyCache.get(a)||this.propertyCache.set(a,{}),this.propertyCache.get(a)[e]=r,r(t)}}}updateSkeletonAnimMix(s){let e=0;for(let t of s)e+=t.weight;if(s.length>0){let t=this._avatar.boneData,a=t.length;for(let r=0;r<a;r++){const i=t[r];let n=this.skeltonPoseObject3D[i.boneName];if(s[0].clip.useSkeletonPos){this._bonePos.copyFrom(this.getPosition(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonPos){let c=this.getPosition(i.bonePath,this._skeletonTime,l.clip);u.HELP_0.lerp(this._bonePos,c,l.weight/e),this._bonePos.copyFrom(u.HELP_0)}}n.transform.localPosition=this._bonePos}this._boneRot.copyFrom(this.getRotation(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];let c=this.getRotation(i.bonePath,this._skeletonTime,l.clip);j.HELP_2.slerp(this._boneRot,c,l.weight/e),this._boneRot.copyFrom(j.HELP_2)}if(n.transform.localRotQuat=this._boneRot,s[0].clip.useSkeletonScale){this._boneScale.copyFrom(this.getScale(i.bonePath,this._skeletonTime,s[0].clip));for(let o=1;o<s.length;o++){const l=s[o];if(l.clip.useSkeletonScale){let c=this.getScale(i.bonePath,this._skeletonTime,l.clip);u.HELP_0.lerp(this._boneScale,c,l.weight/e),this._boneScale.copyFrom(u.HELP_0)}}n.transform.localScale=this._boneScale}}}}getPosition(s,e,t=this._currentSkeletonClip.clip){return t.positionCurves.has(s)?t.positionCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localPosition}getRotation(s,e,t=this._currentSkeletonClip.clip){if(t.rotationCurves.has(s)){let a=t.rotationCurves.get(s).getValue(e);return j.HELP_0.set(a.x,a.y,a.z,a.w),j.HELP_0}return this.skeltonTPoseObject3D[s].localQuaternion}getScale(s,e,t=this._currentSkeletonClip.clip){return t.scaleCurves.has(s)?t.scaleCurves.get(s).getValue(e):this.skeltonTPoseObject3D[s].localScale}getAnimationClipState(s){for(let e of this._clipsState)if(e.clip.clipName===s)return e;return null}cloneMorphRenderers(){let s={};for(const e of this._rendererList)for(const t in e.geometry.morphTargetDictionary){let a=s[t]||[];a.push(e),s[t]=a}return s}};Pa=Jb([Vt(Pa,"AnimatorComponent")],Pa);class Nd{clip;weight=0;get totalTime(){return this.clip.stopTime-this.clip.startTime}constructor(e){this.clip=e}}class Wb{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 Uo{index;time;timeEnd;coeff=[]}var or=(s=>(s[s.PingPong=0]="PingPong",s[s.Repeat=1]="Repeat",s[s.Clamp=2]="Clamp",s))(or||{});class ks{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 wi{_totalTime=1;_cache=new Uo;_cacheOut={lhsIndex:0,rhsIndex:0};_InvalidateCache=!1;curve=[];serializedVersion;preWarpMode;postWarpMode;rotationOrder;get cacheOut(){return this._cacheOut}constructor(e,t=or.Repeat,a=or.Repeat){if(e)for(let r=0;r<e.length;r++){const i=e[r];this.addKeyFrame(i)}this.preWarpMode=t,this.postWarpMode=a}get totalTime(){return this._totalTime}get first(){return this.curve[0]}get last(){return this.curve[this.curve.length-1]}addKeyFrame(e){this.curve.indexOf(e)==-1&&this.curve.push(e),this.calcTotalTime()}removeKeyFrame(e){let t=this.curve.indexOf(e);t!=-1&&this.curve.splice(t,1),this.calcTotalTime()}calculateCacheData(e,t,a,r=0){let i=this.curve,n=i[t],o=i[a];e.index=t,e.time=n.time+r,e.timeEnd=o.time+r,e.index=t;let l,c,f,d,h,b,p;l=o.time-n.time,l=Math.max(l,1e-4),f=o.value-n.value,c=1/(l*l),d=n.outSlope,h=o.inSlope,b=d*l,p=h*l,e.coeff[0]=(b+p-f-f)*c/l,e.coeff[1]=(f+f+f-b-b-p)*c,e.coeff[2]=d,e.coeff[3]=n.value,this.setupStepped(e.coeff,n,o)}getValue(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),this.calculateCacheData(this._cache,this._cacheOut.lhsIndex,this._cacheOut.rhsIndex,0),this.evaluateCache(this._cache,e)}getCurveFramesExtent(e){return e=this.wrapTime(e),this.findCurve(e,this._cacheOut),{lhsIndex:this._cacheOut.lhsIndex,rhsIndex:this._cacheOut.rhsIndex,time:e}}getKeyCount(){return this.curve.length}getKey(e){return this.curve[e]}unSerialized(e){this.preWarpMode=e.m_PreInfinity,this.postWarpMode=e.m_PostInfinity,this.rotationOrder=e.m_RotationOrder;let t=e.m_Curve.length;for(let a=0;a<t;a++)this.curve[a]=new ks,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 ks,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==or.Clamp?e=a:this.preWarpMode==or.PingPong?e=gn(e,a,r):e=pn(e,a,r):e>r&&(this.postWarpMode==or.Clamp?e=r:this.postWarpMode==or.PingPong?e=gn(e,a,r):e=pn(e,a,r)),e}evaluateCache(e,t){let a=t-e.time;return a*(a*(a*e.coeff[0]+e.coeff[1])+e.coeff[2])+e.coeff[3]}findCurve(e,t){let a=this.curve;for(let r=1;r<a.length;r++){let i=a[r-1],n=a[r];i.time<=e&&n.time>e&&(t.lhsIndex=r-1,t.rhsIndex=r)}}setupStepped(e,t,a){(isNaN(t.outSlope)||isNaN(a.inSlope))&&(e[0]=0,e[1]=0,e[2]=0,e[3]=t.value)}invalidateCache(){this._InvalidateCache=!0}calcTotalTime(){let e=0;for(let t of this.curve)t?e=Math.max(e,t.time):console.error(t);this._totalTime=e}static scaleCurveValue(e,t){if(!e._InvalidateCache)for(let a=0;a<e.curve.length;a++){let r=e.curve[a];r.value*=t,r.inSlope*=t,r.outSlope*=t}e.invalidateCache()}}class Vd extends wi{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 Pd{curve={}}var ci=(s=>(s[s.Default=0]="Default",s[s.Clamp=1]="Clamp",s[s.Once=1]="Once",s[s.Loop=2]="Loop",s[s.PingPong=4]="PingPong",s[s.ClampForever=8]="ClampForever",s))(ci||{});class Zb{name;objAnimClip;totalTime=0;time=0;_stopTime=0;_loopTime;_wrapMode;_sampleRate;get wrapMode(){return this._wrapMode||(this._wrapMode=0),this._wrapMode}set wrapMode(e){this._wrapMode=e}parse(e){this.objAnimClip={};let t=e.AnimationClip,{m_Name:a,m_AnimationClipSettings:r,m_WrapMode:i,m_SampleRate:n}=t;this.name=a,this._wrapMode=i,this._sampleRate=n,this._loopTime=r.m_LoopTime;for(const o in t.m_EditorCurves)if(Object.prototype.hasOwnProperty.call(t.m_EditorCurves,o)){const l=t.m_EditorCurves[o];let c=l.attribute,f=new Vd;f.unSerialized(l),this.totalTime=Math.max(this.totalTime,f.totalTime);let d=this.objAnimClip[l.path];d||(d=new Pd,this.objAnimClip[l.path]=d),d.curve[c]=f}}}class Od{transform;quaternion;materialColor}class Ri{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 zr{static Complete=0;static Seek=1;_rootObject3D;_animation;_propertyCache;_currentClip;_frame=0;_time=0;_isPlaying=!0;speed=1;_propertyTagDic;constructor(e){this._rootObject3D=e.object3D,this._animation=e,this._propertyTagDic=new Map,this.reset()}reset(){this._propertyCache={},this._propertyTagDic.clear()}get time(){return this._time}get currentClip(){return this._currentClip}play(e,t=!0){this._isPlaying=!0,t&&(this._time=0),e!=this._currentClip&&e&&this.parseAnimClip(e),this._currentClip=e,this.validProperty()}parseAnimClip(e){this.reset();for(const t in e.objAnimClip){let a=e.objAnimClip[t],r=this._rootObject3D,i={};if(t==""?r=this._rootObject3D:r=this._rootObject3D.getObjectByName(t),!r)continue;let n=new Od;this._propertyTagDic.set(r,n);let o=a.curve;for(const l in o){Ri.updatePropertyTag(n,l);let c=this._propertyCache[t]||={},f=Ri.Property[l].split("."),d=f[0];if(f.length>1){let h=i[d];h||(h=i[d]=r[d]),c[l]={value:h,property:f[1]}}else c[l]={value:r,property:f[0]}}}return this}stop(){return this._isPlaying=!1,this}toggle(){return this._isPlaying=!this._isPlaying,this}get isPlaying(){return this._isPlaying}update(e,t){if(e=e*.001,t=t*.001,!this._currentClip||this._frame==e||!this._isPlaying)return;this._frame=e;let a=this._time;this._time=this.calcTime(a+t*this.speed),this.validProperty(),this._currentClip.wrapMode!=ci.Loop&&this._currentClip.wrapMode!=ci.Default&&(this.speed>0?this._time>=this._currentClip.totalTime:this._time<=0)&&(this._isPlaying=!1,this._animation.statusCall(zr.Complete,a,this._time)),this._animation.statusCall(zr.Seek,a,this._time)}seek(e){return this._time=this.calcTime(e),this._rootObject3D&&this.validProperty(),this}calcTime(e){return this._currentClip.wrapMode==ci.Loop||this._currentClip.wrapMode==ci.Default?e=Bn(e,this._currentClip.totalTime):e=se(e,0,this._currentClip.totalTime),e}validProperty(){for(const e in this._currentClip.objAnimClip){let a=this._currentClip.objAnimClip[e].curve;for(const r in a){const i=a[r];let n=this._propertyCache[e][r],o=i.getValue(this._time);r in Ri.Scale&&(o*=Ri.Scale[r]),n.value[n.property]=o}}this._propertyTagDic.forEach((e,t)=>{this.applyProperty(e,t)})}applyProperty(e,t){e.quaternion&&E.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 jb{clipName;data;time}class Ii extends $e{static SEEK="SEEK";static COMPLETE="COMPLETE";animation;frame;constructor(e,t){super(t),this.animation=e}}class jo extends Pe{_animator;_clips=[];defaultClip;autoPlay;_seekEvent;_completeEvent;_keyFrameList;constructor(){super(),this._seekEvent=new Ii(this,Ii.SEEK),this._completeEvent=new Ii(this,Ii.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 zr(this)}onUpdate(){this.enable&&this._animator.update(Fe.time,Fe.delta)}appendClip(e){this._clips.push(e),this.play(e.name)}statusCall(e,t,a){if(e==zr.Complete)this.eventDispatcher.dispatchEvent(this._completeEvent);else if(e==zr.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(jo).copyComponent(this)}}var Yb=Object.getOwnPropertyDescriptor,Xb=(s,e,t,a)=>{for(var r=a>1?void 0:a?Yb(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let lr=class extends ${skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Be.SkinnedMesh)}get geometry(){return this._geometry}set geometry(s){this.skinJointsName=s.skinNames;let e=[];for(let t=0;t<s.bindPose.length;t++)e.push(new Float32Array(s.bindPose[t].rawData.slice(0,16)));this.skinInverseBindMatrices=e,super.geometry=s}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(Pa),!this.skeletonAnimation){let s=this.object3D.parentObject.parentObject.getComponentsInChild(Pa);s.length>0&&(this.skeletonAnimation=s[0]);let e=this.object3D;for(;!this.skeletonAnimation&&e;)this.skeletonAnimation=e.getComponentFromParent(Pa),e.parent&&(e=e.parent.object3D)}}get blendShape(){return this.morphData}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(s){if(this.mSkeletonAnimation=s,!!s&&!this.mJointIndexTableBuffer){let e=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new ve(e.length,0,new Float32Array(e)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(s){this.mInverseBindMatrixData=s;var e=new Float32Array(s.length*16);for(let t=0;t<s.length;t++){let a=t*16,r=s[t];e.set(r,a)}this.mInverseBindMatrixBuffer=new ve(e.byteLength,0,e),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(s){let e=s.addComponent(lr),t=[];for(const a of this.materials)t.push(a.clone());e.materials=t,e.geometry=this.geometry,e.castShadow=this.castShadow,e.castGI=this.castGI,e.receiveShadow=this.receiveShadow,e.rendererMask=this.rendererMask,e.skinJointsName=this.skinJointsName,e.skinInverseBindMatrices=this.skinInverseBindMatrices,e.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(s,e,t,a){for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++){const l=n[o];!l.pipeline&&this.mSkeletonAnimation&&(l.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),l.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),l.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(s,e,t,a)}};lr=Xb([Vt(lr,"SkinnedMeshRenderer2")],lr);class Hb extends Pe{_targetRenderers={};_vec3=new u;_matrix4=new E;_quaternion=new j;init(e){let t=this.fetchMorphRenderers(this.object3D,lr),a=this.fetchMorphRenderers(this.object3D,$);t.push(...a);for(const r of t){Wt.hasMask(r.rendererMask,Be.MorphTarget)&&r.selfCloneMaterials("MORPH_TARGET_UUID");for(const n in r.geometry.morphTargetDictionary){let o=this._targetRenderers[n]||[];o.push(r),this._targetRenderers[n]=o}}}getMorphRenderersByKey(e){return this._targetRenderers[e]}cloneMorphRenderers(){let e={};for(let t in this._targetRenderers)e[t]=this._targetRenderers[t];return e}applyBlendShape(e,t,a=1){if(!e){console.warn("blendShape is null");return}this._vec3.setFromArray(e.transform.transform[3]),this._vec3.multiplyScalar(a),this.object3D.transform.localPosition=this._vec3,this._vec3.setFromArray(e.transform.transform[2]),this._matrix4.copyColFrom(2,this._vec3),this._vec3.setFromArray(e.transform.transform[1]),this._matrix4.copyColFrom(1,this._vec3),this._vec3.setFromArray(e.transform.transform[0]),this._matrix4.copyColFrom(0,this._vec3),this._matrix4.transpose(),this._quaternion.fromMatrix(this._matrix4),this.object3D.localQuaternion=this._quaternion;for(let r in t){let i=this._targetRenderers[r],n=t[r],o=e.texture[n];this.applyMorphTargetInfluence(r,o,i)}}applyMorphTargetInfluence(e,t,a){for(let r of a)r.setMorphInfluence(e,t)}fetchMorphRenderers(e,t){let a=e.getComponentsInChild(t),r=[];for(let i of a)i.hasMask(Be.MorphTarget)&&r.push(i);return r}}class Kb{texture;transform}var Ld=(s=>(s.mouthRollLower="mouthRollLower",s.browOuterUp_L="browOuterUpLeft",s.mouthSmile_L="mouthSmileLeft",s.jawRight="jawRight",s.eyeLookOut_L="eyeLookOutLeft",s.mouthFunnel="mouthFunnel",s.mouthUpperUp_R="mouthUpperUpRight",s.browDown_L="browDownLeft",s.jawLeft="jawLeft",s.mouthLowerDown_L="mouthLowerDownLeft",s.noseSneer_R="noseSneerRight",s.jawForward="jawForward",s.mouthLowerDown_R="mouthLowerDownRight",s.browInnerUp="browInnerUp",s.mouthRollUpper="mouthRollUpper",s.mouthStretch_R="mouthStretchRight",s.mouthPucker="mouthPucker",s.eyeBlink_L="eyeBlinkLeft",s.mouthUpperUp_L="mouthUpperUpLeft",s.mouthShrugUpper="mouthShrugUpper",s.eyeLookIn_R="eyeLookInRight",s.noseSneer_L="noseSneerLeft",s.mouthFrown_L="mouthFrownLeft",s.cheekSquint_L="cheekSquintLeft",s.eyeLookDown_L="eyeLookDownLeft",s.mouthDimple_L="mouthDimpleLeft",s.mouthFrown_R="mouthFrownRight",s.eyeLookIn_L="eyeLookInLeft",s.eyeLookOut_R="eyeLookOutRight",s.mouthLeft="mouthLeft",s.mouthStretch_L="mouthStretchLeft",s.mouthPress_L="mouthPressLeft",s.mouthDimple_R="mouthDimpleRight",s.eyeWide_R="eyeWideRight",s.browDown_R="browDownRight",s.eyeLookUp_R="eyeLookUpRight",s.eyeBlink_R="eyeBlinkRight",s.cheekSquint_R="cheekSquintRight",s.mouthRight="mouthDimpleRight",s.eyeLookDown_R="eyeLookDownRight",s.eyeLookUp_L="eyeLookUpLeft",s.eyeSquint_L="eyeSquintLeft",s.jawOpen="jawOpen",s.browOuterUp_R="browOuterUpRight",s.mouthClose="mouthClose",s.mouthShrugLower="mouthShrugLower",s.eyeWide_L="eyeWideLeft",s.tongueOut="tongueOut",s.eyeSquint_R="eyeSquintRight",s.cheekPuff="cheekPuff",s.mouthPress_R="mouthPressRight",s.mouthSmile_R="mouthSmileRight",s))(Ld||{});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=k.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 Ka{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,k.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=k.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 Ka{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,k.device.queue.writeBuffer(this._argumentsBuffer,0,this.shareDataBuffer))}allocationMemorySet(e){this.argumentsData={};let t=0;for(let r=0;r<e.length;r++){const i=e[r];t+=i.data.length}this.allocation(t*4);let a=this;for(let r=0;r<e.length;r++){const i=e[r],n=i.name;this.argumentsData[n]=this.allocation_node(i.data.length*4),a[n]=this.argumentsData[n]}}generateGPUBuffer(){let e=k.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 u(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 Pe{focus;distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Kr),!this._camera){console.error("FirstPersonCameraController need camera");return}if(!this.focus){console.error("FirstPersonCameraController need target");return}m.inputSystem.addEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.addEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){m.inputSystem.addEventListener(O.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){m.inputSystem.removeEventListener(O.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+=m.inputSystem.wheelDelta*.1}onUpdate(){let e=new u;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t}destroy(e){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var Oe=(s=>(s[s.Key_BackSpace=8]="Key_BackSpace",s[s.Key_Tab=9]="Key_Tab",s[s.Key_Clear=12]="Key_Clear",s[s.Key_Enter=13]="Key_Enter",s[s.Key_Shift_L=16]="Key_Shift_L",s[s.Key_Control_L=17]="Key_Control_L",s[s.Key_Alt_L=18]="Key_Alt_L",s[s.Key_Pause=19]="Key_Pause",s[s.Key_CapsLock=20]="Key_CapsLock",s[s.Key_Escape=21]="Key_Escape",s[s.Key_Esc=27]="Key_Esc",s[s.Key_Space=32]="Key_Space",s[s.Key_Prior=33]="Key_Prior",s[s.Key_Next=34]="Key_Next",s[s.Key_End=35]="Key_End",s[s.Key_Home=36]="Key_Home",s[s.Key_Left=37]="Key_Left",s[s.Key_Up=38]="Key_Up",s[s.Key_Right=39]="Key_Right",s[s.Key_Down=40]="Key_Down",s[s.Key_Select=41]="Key_Select",s[s.Key_Print=42]="Key_Print",s[s.Key_Execute=43]="Key_Execute",s[s.Key_Insert=45]="Key_Insert",s[s.Key_Delete=46]="Key_Delete",s[s.Key_Help=47]="Key_Help",s[s.Key_0=48]="Key_0",s[s.Key_1=49]="Key_1",s[s.Key_2=50]="Key_2",s[s.Key_3=51]="Key_3",s[s.Key_4=52]="Key_4",s[s.Key_5=53]="Key_5",s[s.Key_6=54]="Key_6",s[s.Key_7=55]="Key_7",s[s.Key_8=56]="Key_8",s[s.Key_9=57]="Key_9",s[s.Key_A=65]="Key_A",s[s.Key_B=66]="Key_B",s[s.Key_C=67]="Key_C",s[s.Key_D=68]="Key_D",s[s.Key_E=69]="Key_E",s[s.Key_F=70]="Key_F",s[s.Key_G=71]="Key_G",s[s.Key_H=72]="Key_H",s[s.Key_I=73]="Key_I",s[s.Key_J=74]="Key_J",s[s.Key_K=75]="Key_K",s[s.Key_L=76]="Key_L",s[s.Key_M=77]="Key_M",s[s.Key_N=78]="Key_N",s[s.Key_O=79]="Key_O",s[s.Key_P=80]="Key_P",s[s.Key_Q=81]="Key_Q",s[s.Key_R=82]="Key_R",s[s.Key_S=83]="Key_S",s[s.Key_T=84]="Key_T",s[s.Key_U=85]="Key_U",s[s.Key_V=86]="Key_V",s[s.Key_W=87]="Key_W",s[s.Key_X=88]="Key_X",s[s.Key_Y=89]="Key_Y",s[s.Key_Z=90]="Key_Z",s[s.Key_KP_0=96]="Key_KP_0",s[s.Key_KP_1=97]="Key_KP_1",s[s.Key_KP_2=98]="Key_KP_2",s[s.Key_KP_3=99]="Key_KP_3",s[s.Key_KP_4=100]="Key_KP_4",s[s.Key_KP_5=101]="Key_KP_5",s[s.Key_KP_6=102]="Key_KP_6",s[s.Key_KP_7=103]="Key_KP_7",s[s.Key_KP_8=104]="Key_KP_8",s[s.Key_KP_9=105]="Key_KP_9",s[s.Key_Multiply=106]="Key_Multiply",s[s.Key_Add=107]="Key_Add",s[s.Key_Separator=108]="Key_Separator",s[s.Key_Subtract=109]="Key_Subtract",s[s.Key_Decimal=110]="Key_Decimal",s[s.Key_Divide=111]="Key_Divide",s[s.Key_F1=112]="Key_F1",s[s.Key_F2=113]="Key_F2",s[s.Key_F3=114]="Key_F3",s[s.Key_F4=115]="Key_F4",s[s.Key_F5=116]="Key_F5",s[s.Key_F6=117]="Key_F6",s[s.Key_F7=118]="Key_F7",s[s.Key_F8=119]="Key_F8",s[s.Key_F9=120]="Key_F9",s[s.Key_F10=121]="Key_F10",s[s.Key_F11=122]="Key_F11",s[s.Key_F12=123]="Key_F12",s[s.Key_F13=124]="Key_F13",s[s.Key_F14=125]="Key_F14",s[s.Key_F15=126]="Key_F15",s[s.Key_F16=127]="Key_F16",s[s.Key_F17=128]="Key_F17",s[s.Key_F18=129]="Key_F18",s[s.Key_F19=130]="Key_F19",s[s.Key_F20=131]="Key_F20",s[s.Key_F21=132]="Key_F21",s[s.Key_F22=133]="Key_F22",s[s.Key_F23=134]="Key_F23",s[s.Key_F24=135]="Key_F24",s[s.Key_Num_Lock=136]="Key_Num_Lock",s[s.Key_Scroll_Lock=137]="Key_Scroll_Lock",s))(Oe||{});class ig extends Pe{moveSpeed=2;targetPos=new u(0,0,10);lookAtPos=new u(0,0,0);config={shiftMoveScale:20};_moveScale=1;_dir;_mouseFactory=25;_factory=1.5;_mouseDown=!1;_lastPos;_keyState;constructor(){super(),this._lastPos=new u,this._keyState={front:!1,back:!1,left:!1,right:!1,q:!1,e:!1},this.setCamera(new u(0,0,100),new u(0,0,0))}setCamera(e,t){this.targetPos.copyFrom(e),this.lookAtPos.copyFrom(t),this.Reset()}start(){m.inputSystem.addEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.addEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.mouseDown,this),m.inputSystem.addEventListener(va.KEY_UP,this.keyUp,this),m.inputSystem.addEventListener(va.KEY_DOWN,this.keyDown,this),this.transform.lookAt(this.targetPos,this.lookAtPos)}mouseWheel(e){}keyUp(e){switch(e.keyCode){case Oe.Key_W:this._keyState.front=!1;break;case Oe.Key_S:this._keyState.back=!1;break;case Oe.Key_A:this._keyState.left=!1;break;case Oe.Key_D:this._keyState.right=!1;break;case Oe.Key_Shift_L:this._moveScale=1;break;case Oe.Key_Q:this._keyState.q=!1;break;case Oe.Key_E:this._keyState.e=!1;break;case Oe.Key_F:this.transform.lookAt(this.targetPos,this.lookAtPos);break}}keyDown(e){switch(e.keyCode){case Oe.Key_W:this._keyState.front=!0;break;case Oe.Key_S:this._keyState.back=!0;break;case Oe.Key_A:this._keyState.left=!0;break;case Oe.Key_D:this._keyState.right=!0;break;case Oe.Key_Q:this._keyState.q=!0;break;case Oe.Key_E:this._keyState.e=!0;break;case Oe.Key_Shift_L:this._moveScale=this.config.shiftMoveScale}}Reset(){this._lastPos.x=m.inputSystem.mouseLastX,this._lastPos.y=m.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=se(Fe.delta,0,.016);if(this._mouseDown&&(e.rotationY-=this.internal(e.rotationY+(m.inputSystem.mouseLastX-this._lastPos.x)*.25,e.rotationY,t*this._mouseFactory),e.rotationX-=this.internal(e.rotationX+(m.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=wr(e.y,e.y-this.moveSpeed*this._moveScale,t*this._factory)),this._keyState.e&&(e.y=wr(e.y,e.y+this.moveSpeed*this._moveScale,t*this._factory))}destroy(e){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.mouseDown,this),m.inputSystem.removeEventListener(va.KEY_UP,this.keyUp,this),m.inputSystem.removeEventListener(va.KEY_DOWN,this.keyDown,this),super.destroy(e)}}class Qi{static add(e,t,a){return a||(a=new u),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 u),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 u),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 u),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 u),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=u.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 u.distance(e,t)}static getRandomXYZ(e=-100,t=100){return new u(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 u(Math.random()*t+e,Math.random()*r+a,Math.random()*t+e)}static sphere(e){let t=e*Math.random(),a=new u(Math.random()*1-.5,Math.random()*1-.5,Math.random()*1-.5);return a.normalize(),a.scaleBy(t),a}static sphereXYZ(e,t,a=1,r=1,i=1){let n=e+(t-e)*Math.random(),o=new u(Math.random()*a-a*.5,Math.random()*r-r*.5,Math.random()*i-i*.5);return o.normalize(),o.scaleBy(n),o}}class sg extends Pe{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 u;_tempPos=new u;constructor(){super(),this._currentPos=new ee,this._targetPos=new ee}start(){this.camera=this.object3D.getOrAddComponent(Kr),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onMouseDown,this),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onMouseMove,this,null,10),m.inputSystem.addEventListener(O.POINTER_UP,this.onMouseUp,this,null,10),m.inputSystem.addEventListener(O.POINTER_WHEEL,this.onMouseWheel,this)}flowTarget(e,t=u.ZERO){this._flowTarget=e,this._flowOffset||=new u,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=In.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*Qi.distance(this._currentPos.transform.worldPosition,this.camera.transform.worldPosition)/10,this.distance-=m.inputSystem.wheelDelta*this._wheelStep,this.distance=se(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&&(u.HELP_1.x=-1*e.movementX*Math.cos(this._roll*Math.PI/180)-e.movementY*Math.sin(this._roll*Math.PI/180),u.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+=u.HELP_1.x*this.mouseRightFactor,this._targetPos.z+=u.HELP_1.z*this.mouseRightFactor),this._mouseLeftDown&&(this.roll-=e.movementX*Fe.delta*.001*this.mouseLeftFactor,this.pitch-=e.movementY*Fe.delta*.001*this.mouseLeftFactor,this.pitch=se(this.pitch,this._topClamp,this._bottomClamp)))}onBeforeUpdate(e){if(!this.enable)return;this._flowTarget&&(u.HELP_0.copyFrom(this._flowTarget.transform.worldPosition),u.HELP_0.add(this._flowOffset,u.HELP_0),this.target=u.HELP_0);let t=se(Fe.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=j.HELP_0;a.fromEulerAngles(this._pitch,this._roll,0),this._tempDir.applyQuaternion(a),this._tempPos=Qi.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,u.UP)}destroy(e){m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onMouseDown,this),m.inputSystem.removeEventListener(O.POINTER_MOVE,this.onMouseMove,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onMouseUp,this),m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.onMouseWheel,this),super.destroy(e),this.camera=null,this._flowTarget=null}}class ng extends Pe{_camera;autoRotate=!1;autoRotateSpeed=.1;rotateFactor=.5;zoomFactor=.1;panFactor=.25;_smooth=5;_minDistance=1;_maxDistance=1e5;_maxPolarAngle=90;_minPolarAngle=-90;_target=new u(0,0,0);_cTarget=new u(0,0,0);_position=new u(0,0,0);_cPosition=new u(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=se(e,2e-6,this._maxDistance)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance=se(e,this._minDistance,1/0)}get minPolarAngle(){return this._minPolarAngle}set minPolarAngle(e){this._minPolarAngle=se(e,-90,this._maxPolarAngle)}get maxPolarAngle(){return this._maxPolarAngle}set maxPolarAngle(e){this._maxPolarAngle=se(e,this._minPolarAngle,90)}get spherical(){return this._spherical}start(){this._camera=this.object3D.getComponent(Kr),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,u.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,u.UP)}onWheel(e){e.deltaY=se(e.deltaY,-this._spherical.radius,this._spherical.radius),this._spherical.radius+=e.deltaY*this.zoomFactor,this._spherical.radius=se(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=se(this._spherical.phi,this.minPolarAngle,this.maxPolarAngle),this.updateCamera()}else e.mouseCode===2&&(Qi.mulScale(this.object3D.transform.up,e.movementY*this.panFactor*this._camera.aspect,u.HELP_1),e.ctrlKey||e.metaKey?this._target.y+=u.HELP_1.y:(this._target.x+=u.HELP_1.x,this._target.z+=u.HELP_1.z),Qi.mulScale(this.object3D.transform.right,-e.movementX*this.panFactor,u.HELP_1),this._target.x-=u.HELP_1.x,this._target.z-=u.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(){m.inputSystem.addEventListener(O.POINTER_WHEEL,this.onWheel,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onPointerDown,this),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onPointerMove,this),m.inputSystem.addEventListener(O.POINTER_UP,this.onPointerUp,this)}removeEventListener(){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.onWheel,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onPointerDown,this),m.inputSystem.removeEventListener(O.POINTER_MOVE,this.onPointerMove,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onPointerUp,this)}}const Gd=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 u,this}set(e,t,a){return this.radius=e,this.phi=t,this.theta=a,this}makeSafe(){return this.phi=Math.max(Gd,Math.min(Math.PI-Gd,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(se(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 Pe{focus;_rotation=new u(45,0,0);distance=5;_camera;constructor(){super()}start(){if(this._camera=this.object3D.getOrAddComponent(Kr),!this._camera){console.error("ThirdPersonCameraController need camera");return}if(!this.focus){console.error("ThirdPersonCameraController need target");return}m.inputSystem.addEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.addEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.mouseDown,this)}mouseDown(e){m.inputSystem.addEventListener(O.POINTER_MOVE,this.mouseMove,this)}mouseUp(e){m.inputSystem.removeEventListener(O.POINTER_MOVE,this.mouseMove,this)}mouseMove(e){this._rotation.y+=e.movementX*.01,this._rotation.x+=e.movementY*.01}mouseWheel(e){this.distance+=m.inputSystem.wheelDelta*.1}onUpdate(){let e=new u;this._camera.transform.forward.scaleToRef(this.distance,e);var t=this.focus.transform.worldPosition;this._camera.transform.localPosition=t.subtract(e)}destroy(e){m.inputSystem.removeEventListener(O.POINTER_WHEEL,this.mouseWheel,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.mouseUp,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.mouseDown,this),super.destroy(e)}}var Le=(s=>(s[s.NORMAL=0]="NORMAL",s[s.DOWN=1]="DOWN",s[s.OVER=2]="OVER",s[s.DISABLE=3]="DISABLE",s))(Le||{});let cg=Math.PI,zd=cg*2;class Nr{a;b;c;d;tx;ty;constructor(e=1,t=0,a=0,r=1,i=0,n=0){this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n}clone(){return new Nr(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*rt;let t=Math.cos(e),a=Math.sin(e),r=this.a,i=this.b,n=this.c,o=this.d,l=this.tx,c=this.ty;this.a=r*t-i*a,this.b=r*a+i*t,this.c=n*t-o*a,this.d=n*a+o*t,this.tx=l*t-c*a,this.ty=l*a+c*t}}scale(e,t){e!==1&&(this.a*=e,this.c*=e,this.tx*=e),t!==1&&(this.b*=t,this.d*=t,this.ty*=t)}setTo(e,t,a,r,i,n){return this.a=e,this.b=t,this.c=a,this.d=r,this.tx=i,this.ty=n,this}transformPoint(e,t,a){let r=this.a*e+this.c*t+this.tx,i=this.b*e+this.d*t+this.ty;return a?(a.setTo(r,i,0,1),a):new u(r,i,0,1)}setTranslate(e,t){this.tx=e,this.ty=t}translate(e,t){this.tx+=e,this.ty+=t}mul(e){let t=this,a=e,r=t.a,i=t.b,n=t.c,o=t.d,l=t.tx,c=t.ty,f=a.a,d=a.b,h=a.c,b=a.d,p=a.tx,g=a.ty;d!==0||h!==0?(this.a=r*f+i*h,this.b=r*d+i*b,this.c=n*f+o*h,this.d=n*d+o*b,this.tx=f*l+h*c+p,this.ty=d*l+b*c+g):(this.a=r*f,this.b=i*b,this.c=n*f,this.d=o*b,this.tx=f*l+p,this.ty=b*c+g)}equals(e){return this.a==e.a&&this.b==e.b&&this.c==e.c&&this.d==e.d&&this.tx==e.tx&&this.ty==e.ty}prepend(e,t,a,r,i,n){let o=this.tx;if(e!=1||t!=0||a!=0||r!=1){let l=this.a,c=this.c;this.a=l*e+this.b*a,this.b=l*t+this.b*r,this.c=c*e+this.d*a,this.d=c*t+this.d*r}return this.tx=o*e+this.ty*a+i,this.ty=o*t+this.ty*r+n,this}append(e){let t=this.a,a=this.b,r=this.c,i=this.d;return(e.a!=1||e.b!=0||e.c!=0||e.d!=1)&&(this.a=e.a*t+e.b*r,this.b=e.a*a+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*a+e.d*i),this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*a+e.ty*i+this.ty,this}deltaTransformPoint(e){let t=this,a=t.a*e.x+t.c*e.y,r=t.b*e.x+t.d*e.y;return new u(a,r)}toString(){return"(a="+this.a+", b="+this.b+", c="+this.c+", d="+this.d+", tx="+this.tx+", ty="+this.ty+")"}createBox(e,t,a=0,r=0,i=0){let n=this;if(a!==0){a=a*rt;let o=Math.cos(a),l=Math.sin(a);n.a=o*e,n.b=l*t,n.c=-l*e,n.d=o*t}else n.a=e,n.b=0,n.c=0,n.d=t;n.tx=r,n.ty=i}createGradientBox(e,t,a=0,r=0,i=0){this.createBox(e/1638.4,t/1638.4,a,r+e/2,i+t/2)}_invertInto(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty;if(a==0&&r==0){e.b=e.c=0,t==0||i==0?e.a=e.d=e.tx=e.ty=0:(t=e.a=1/t,i=e.d=1/i,e.tx=-t*n,e.ty=-i*o);return}let l=t*i-a*r;if(l==0){e.identity();return}l=1/l;let c=e.a=i*l;a=e.b=-a*l,r=e.c=-r*l,i=e.d=t*l,e.tx=-(c*n+r*o),e.ty=-(a*n+i*o)}getScaleX(){let e=this;if(e.a==1&&e.b==0)return 1;let t=Math.sqrt(e.a*e.a+e.b*e.b);return this.getDeterminant()<0?-t:t}getScaleY(){let e=this;if(e.c==0&&e.d==1)return 1;let t=Math.sqrt(e.c*e.c+e.d*e.d);return this.getDeterminant()<0?-t:t}getSkewX(){return Math.atan2(this.d,this.c)-Math.PI/2}getSkewY(){return Math.atan2(this.b,this.a)}updateScaleAndRotation(e,t,a,r){if((a==0||a==zd)&&(r==0||r==zd)){this.a=e,this.b=this.c=0,this.d=t;return}a=a*rt,r=r*rt;let i=Math.cos(a),n=Math.sin(a);a==r?(this.a=i*e,this.b=n*e):(this.a=Math.cos(r)*e,this.b=Math.sin(r)*e),this.c=-n*t,this.d=i*t}preMultiplyInto(e,t){let a=e.a*this.a,r=0,i=0,n=e.d*this.d,o=e.tx*this.a+this.tx,l=e.ty*this.d+this.ty;(e.b!==0||e.c!==0||this.b!==0||this.c!==0)&&(a+=e.b*this.c,n+=e.c*this.b,r+=e.a*this.b+e.b*this.d,i+=e.c*this.a+e.d*this.c,o+=e.ty*this.c,l+=e.tx*this.b),t.a=a,t.b=r,t.c=i,t.d=n,t.tx=o,t.ty=l}$transformBounds(e){let t=this.a,a=this.b,r=this.c,i=this.d,n=this.tx,o=this.ty,l=e.x,c=e.y,f=l+e.width,d=c+e.height,h=t*l+r*c+n,b=a*l+i*c+o,p=t*f+r*c+n,g=a*f+i*c+o,A=t*f+r*d+n,D=a*f+i*d+o,_=t*l+r*d+n,U=a*l+i*d+o,v=0;h>p&&(v=h,h=p,p=v),A>_&&(v=A,A=_,_=v),e.x=Math.floor(h<A?h:A),e.width=Math.ceil((p>_?p:_)-e.x),b>g&&(v=b,b=g,g=v),D>U&&(v=D,D=U,U=v),e.y=Math.floor(b<D?b:D),e.height=Math.ceil((g>U?g:U)-e.y)}getDeterminant(){return this.a*this.d-this.b*this.c}}class $i extends Pe{isGUICanvas=!0;index=0;addChild(e){return this.object3D.addChild(e),this}removeChild(e){return this.object3D.removeChild(e),this}cloneTo(e){e.getOrAddComponent($i).copyComponent(this)}copyComponent(e){return e.index=e.index,this}}var Ze=(s=>(s[s.NONE=0]="NONE",s[s.POSITION=1]="POSITION",s[s.SPRITE=2]="SPRITE",s[s.COLOR=4]="COLOR",s[s.MAX=7]="MAX",s))(Ze||{});class xo{array;buffer;constructor(e){this.buffer=new ve(e,0),this.array=new Float32Array(this.buffer.memory.shareDataBuffer)}}class Jd extends Ee{_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 u(-a,-a,-a),t=new u(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(...fi.attUV);for(let i=0,n=this.maxQuadCount*fi.vertexCount;i<n;i++)a[i]=i;this._attributeUV=new Float32Array(fi.vertexCount*e*this._uvSize),this._attributeVIndex=new Float32Array(fi.vertexCount*e*this._vIndexSize),this._attributeUV.set(t,0),this._attributeVIndex.set(a,0);let r=[];for(let i=0;i<e;i++)for(let n=0;n<fi.indecies.length;n++){const o=fi.indecies[n]+i*4;r.push(o)}return this._faceIndexes=new Uint32Array(e*6),this._faceIndexes.set(r,0),this.setIndices(this._faceIndexes),this.setAttribute(V.uv,this._attributeUV),this.setAttribute(V.vIndex,this._attributeVIndex),this.updateSubGeometry(0,0,this._faceIndexes.length),this}createBuffer(){let e=this.maxQuadCount;this._posAttribute=new xo(e*4),this._spriteAttribute=new xo(e*12),this._colorAttribute=new xo(e*4)}fillQuad(e,t){e.dirtyAttributes&Ze.POSITION&&this.fillQuadPosition(e,t),e.dirtyAttributes&Ze.COLOR&&this.fillQuadColor(e,t),e.dirtyAttributes&Ze.SPRITE&&this.fillQuadSprite(e,t)}fillQuadPosition(e,t){Wd.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;Wd.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==ni.Sliced&&(r=a.trimSize.x,r=(t.width-(a.offsetSize.z-a.trimSize.x))/r,i=a.trimSize.y,i=(t.height-(a.offsetSize.w-a.trimSize.y))/i);let n=a.guiTexture.dynamicId,o=a.uvRec,l=a.uvBorder,c=this._spriteAttribute.array,f=12*e.z;c[f+0]=o.x,c[f+1]=o.y,c[f+2]=o.z,c[f+3]=o.w,c[f+4]=l.x,c[f+5]=l.y,c[f+6]=l.z,c[f+7]=l.w,c[f+8]=r,c[f+9]=i,c[f+10]=n,c[f+11]=e.visible?1:0,this._onSpriteChange=!0}}class fg{static set(e,t,a,r,...i){let n=t*r+a;for(let o=0,l=i.length;o<l;o++)e[n+o]=i[o]}}class Wd extends fg{static setXYZW(e,t,a,r,i,n){this.set(e,t,0,4,a,r,i,n)}static setXYZ(e,t,a,r,i){this.set(e,t,0,4,a,r,i)}static setZ(e,t,a){this.set(e,t,3,4,a)}}class fi{static vertexCount=4;static attUV=[0,0,1,0,1,1,0,1];static indecies=[0,1,2,0,2,3]}class Zd{_textureMap=new Map;_textureList=[];build(e,t,a){let r=t._geometry;r.resetSubGeometries();let i=-1,n=0,o=0,l=0,c=0,f=this._textureList,d=this._textureMap;function h(){l>0&&(t.updateDrawCallSegment(c,o,l),t._uiRenderer.materials[c].setTextures(f),d.clear(),f.length=0,c++,o+=l,l=0,n=0)}d.clear(),f.length=0;let b=[],p=t.quadMaxCount-1;for(let g of e){let A=g.needUpdateQuads;b.length=0;const D=this.collectQuads(g.object3D,b);for(let _ of D){let U=_.sprite.guiTexture;if(d.has(U.staticId)||(n==7&&h(),d.set(U.staticId,U),U.dynamicId=n,f[n]=U.texture,n+=1),_.z=++i,l+=6,_.cacheTextureId!=U.dynamicId&&(_.dirtyAttributes=Ze.MAX,_.cacheTextureId=U.dynamicId),(A||a)&&(_.dirtyAttributes=Ze.MAX),_.dirtyAttributes&Ze.POSITION&&_.applyTransform(g),_.dirtyAttributes&&_.writeToGeometry(r,g),i==p)return h(),!0}}return h(),!1}collectQuads(e,t){t||=[];let a=e.components.values();for(let r of a){let i=r;if(i.isUIShadow||!i.mainQuads)continue;let n=i.getShadowRender();n&&this.push(n.mainQuads,t),this.push(i.mainQuads,t)}return t}push(e,t){e&&e.length>0&&t.push(...e)}}class yo{static bindTextureArray(){let e="";for(let t=0;t<7;t++)e+=`
|
|
11414
11414
|
@group(1) @binding(auto)
|
|
11415
11415
|
var tex_${t}Sampler: sampler;
|
|
11416
11416
|
@group(1) @binding(auto)
|
|
@@ -11658,9 +11658,9 @@ fn frag(){
|
|
|
11658
11658
|
}
|
|
11659
11659
|
|
|
11660
11660
|
${this.fs}
|
|
11661
|
-
`}class Co extends mt{_scissorRect;_screenSize=new K(1024,768);_scissorEnable=!1;constructor(e){super(),z.register("GUI_shader_view",yo.GUI_shader_view),z.register("GUI_shader_world",yo.GUI_shader_world);let t=new ot;this.addColorPass(t,H.COLOR,e),this.addColorPass(t,H.UI,e),this.shader=t}addColorPass(e,t,a){let r=a==Kt.View?"GUI_shader_view":"GUI_shader_world",i=new Ve(r,r);i.passType=t,i.setShaderEntry("VertMain","FragMain"),i.setUniformVector4("scissorRect",new te),i.setUniformVector2("screenSize",this._screenSize),i.setUniformFloat("scissorCornerRadius",0),i.setUniformFloat("scissorFadeOutSize",0),i.setUniformFloat("pixelRatio",1),i.setUniformVector3("v3",u.ZERO);let n=i.shaderState;n.depthWriteEnabled=!1,i.blendMode=ae.NORMAL,i.depthCompare=a==Kt.View?et.always:et.less_equal,i.cullMode=wt.back,e.addRenderPass(i)}setPanelRatio(e){this.shader.setUniformFloat("pixelRatio",e)}setScissorRect(e,t,a,r){this._scissorRect||=new te,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]||m.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 jd extends ${_guiGeometry;init(e){super.init(),this.addRendererMask(Be.UI),this.removeRendererMask(Be.Default),this.castGI=!1,this.castShadow=!1,this.alwaysRender=!0,this._ignoreEnvMap=this._ignorePrefilterMap=!0}get geometry(){return super.geometry}set geometry(e){super.geometry=e,this._guiGeometry=e}nodeUpdate(e,t,a,r){for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t),l=this._guiGeometry.getPositionBuffer(),c=this._guiGeometry.getSpriteBuffer(),f=this._guiGeometry.getColorBuffer();if(o)for(let d=0;d<o.length;d++){const h=o[d];h.pipeline||(h.setStorageBuffer("vPositionBuffer",l),h.setStorageBuffer("vSpriteBuffer",c),h.setStorageBuffer("vColorBuffer",f))}}super.nodeUpdate(e,t,a,r)}onUpdate(e){}}class Yd{_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 Ti;class wa{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=m.res.defaultGUISprite;_color=new P(1,1,1,1);_imageType=ni.Simple;dirtyAttributes=Ze.MAX;cacheTextureId=-1;static textPool;static get quadPool(){return this.textPool||=new Yd,this.textPool}static recycleQuad(e){e.sprite=null,e.dirtyAttributes=Ze.MAX,e.x=0,e.y=0,e.z=-1,e.cacheTextureId=-1,wa.quadPool.pushBack(e)}static spawnQuad(){return wa.quadPool.getOne(wa)}get imageType(){return this._imageType}set imageType(e){this._imageType=e,this.setAttrChange(Ze.SPRITE|Ze.POSITION)}get color(){return this._color}set color(e){this._color.copyFrom(e),this.setAttrChange(Ze.COLOR)}get visible(){return this._visible}set visible(e){e!=this._visible&&(this._visible=e,this.setAttrChange(Ze.SPRITE))}get sprite(){return this._sprite}set sprite(e){this._sprite!=e&&(this._sprite=e,this.setAttrChange(Ze.SPRITE|Ze.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(Ze.POSITION)}setXY(e,t){this.x=e,this.y=t,this.setAttrChange(Ze.POSITION)}setAttrChange(e){this.dirtyAttributes=this.dirtyAttributes|e}applyTransform(e){this.setAttrChange(Ze.POSITION);let t=this._sprite,a=e.getWorldMatrix();(this.x!=0||this.y!=0)&&(a=this.getQuadMatrix(a));let r=a.getScaleX(),i=a.getScaleY(),n=t.isSliced&&this._imageType==ni.Sliced;if(this._offsetX=e.width*.5*r,this._offsetY=e.height*.5*i,n)this._globalWidth=r*(e.width-(t.offsetSize.z-t.trimSize.x)),this._globalHeight=i*(e.height-(t.offsetSize.w-t.trimSize.y)),this._globalX=a.tx+t.offsetSize.x*r,this._globalY=a.ty+t.offsetSize.y*i;else{let o=this.width/t.offsetSize.z,l=this.height/t.offsetSize.w;this._globalWidth=r*t.trimSize.x*o,this._globalHeight=i*t.trimSize.y*l,this._globalX=a.tx+t.offsetSize.x*o*r,this._globalY=a.ty+t.offsetSize.y*l*i}return this}getQuadMatrix(e){return Ti||=new Nr,Ti.identity(),Ti.setTranslate(this.x,this.y),Ti.mul(e),Ti}writeToGeometry(e,t){return e.fillQuad(this,t),this.dirtyAttributes=Ze.NONE,this}}class So extends Pe{_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(Za),this._uiTransform.setNeedUpdateUIPanel()}copyComponent(e){return this.visible=e.visible,this}}class Mi extends So{_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),wa.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 Vr extends Mi{init(e){super.init?.(e),this.attachQuad(wa.spawnQuad()),this.sprite=m.res.defaultGUISprite}cloneTo(e){e.getOrAddComponent(Vr).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||=m.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 es extends Vr{space=Kt.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(es).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(k.canvas.width,k.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 Co(this.space);let n=this._uiRenderer.materials.slice();n.push(i),this._uiRenderer.materials=n,i.cullMode=r.cullMode,i.depthCompare=r.depthCompare}}create(e){this._maxCount=this.space==Kt.World?Ir.quadMaxCountForWorld:Ir.quadMaxCountForView,this._uiRenderer=this.object3D.addComponent(jd),this._geometry=this._uiRenderer.geometry=new Jd(this._maxCount).create(),this._uiRenderer.material=new Co(e),this._uiRenderer.renderOrder=Ir.SortOrderStartWorld,this._rebuild=new Zd,this.object3D.bound=new ge(new u,new u(1,1,1).multiplyScalar(Number.MAX_VALUE*.1))}get quadMaxCount(){return this._maxCount}get renderer(){return this._uiRenderer}set billboard(e){this.space==Kt.View&&(e=sr.None,console.warn("Cannot enable billboard in view space")),e==sr.BillboardXYZ||e==sr.BillboardY?(this._billboard=this.object3D.getOrAddComponent(qi),this._billboard.type=e):(this.object3D.removeComponent(qi),this._billboard=null)}get billboard(){return this._billboard?this._billboard.type:sr.None}set cullMode(e){if(this.space==Kt.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(Za,a),a.length>0){t._rebuild.build(a,t,t.needUpdateGeometry);for(const o of a)o.needUpdateQuads=!1}let r=t.object3D.getComponentFromParent($i),i=r?r.index:0;t._uiRenderer.enable=a.length>0;let n=t.isViewPanel?Ir.SortOrderStartView:Ir.SortOrderStartWorld;if(t._uiRenderer.renderOrder=i*Ir.SortOrderCanvasSpan+n+t.panelOrder,t._uiRenderer.needSortOnCameraZ=t.needSortOnCameraZ,this.space==Kt.View){let o=k.canvas.clientWidth,l=k.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(k.canvas.clientWidth,k.canvas.clientHeight),l.setScissorEnable(t.scissorEnable),t.scissorEnable){let c=t.mainQuads[0];l.setScissorRect(c.left,c.bottom,c.right,c.top),l.setScissorCorner(t.scissorCornerRadius,t.scissorFadeOutSize)}}t.needUpdateGeometry=!1}updateGUIPixelRatio(e,t,a,r){let i=a/r,n=e/t,o=1;return i<n?o=t/r:o=e/a,o}}class Xs extends es{isViewPanel=!0;space=Kt.View;constructor(){super()}cloneTo(e){e.getOrAddComponent(Xs).copyComponent(this)}}class Hs extends es{isWorldPanel=!0;space=Kt.World;_depthTest=!0;constructor(){super()}cloneTo(e){e.getOrAddComponent(Hs).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?et.less_equal:et.always;for(let a of this._uiRenderer.materials)a.depthCompare=t}}}let Xd;class Za extends Pe{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 Nr,this._worldMatrix=new Nr}init(e){super.init(e),this.transform.eventDispatcher.addEventListener(this.transform.eventLocalChange.type,this.onTransformChange,this),this.onParentChange(null,this.object3D.parent?.object3D)}onTransformChange(e){this.onChange=!0}addUIInteractive(e){return this._uiInteractiveList||=[],this._uiInteractiveList.push(e),this}removeUIInteractive(e){if(this._uiInteractiveList){let t=this._uiInteractiveList.indexOf(e);if(t>=0)return this._uiInteractiveList.slice(t,1),e}return null}get globalVisible(){return this._globalVisible}set visible(e){if(this._localVisible!=e){this._localVisible=e;let t=this.parent?this.parent._globalVisible:!0;this.onUITransformVisible(this._localVisible&&t)}}get visible(){return this._localVisible}onUITransformVisible(e){let t=this._localVisible&&e;t!=this._globalVisible&&(this._globalVisible=t,this.object3D.components.forEach((a,r)=>{let i=a;if(i.onUITransformVisible)if(i==this)for(let n of this.object3D.entityChildren){let o=n.getComponent(Za);o&&o.onUITransformVisible(this._globalVisible)}else i.onUITransformVisible(this._globalVisible)}))}onParentChange(e,t){this.parent?.setNeedUpdateUIPanel(),this.parent=t?.getComponent(Za),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(Za,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(Hs),e||(e=this.object3D.getComponentFromParent(Xs)),e&&(e.needUpdateGeometry=!0)}cloneTo(e){let t=e.getOrAddComponent(Za);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)&&(Xd||=new Nr().identity(),e.mul(Xd.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 Hd{_ray;_mouseCode;_clickEvent;_outEvent;_overEvent;_upEvent;_downEvent;_view;init(e){this._view=e,this._ray=new ea,this._clickEvent=new ft(ft.PICK_CLICK_GUI),this._outEvent=new ft(ft.PICK_OUT_GUI),this._overEvent=new ft(ft.PICK_OVER_GUI),this._upEvent=new ft(ft.PICK_UP_GUI),this._downEvent=new ft(ft.PICK_DOWN_GUI),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onTouchDown,this,null,1),m.inputSystem.addEventListener(O.POINTER_UP,this.onTouchUp,this,null,1),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onTouchMove,this,null,1),m.inputSystem.addEventListener(O.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=Le.OVER,Object.assign(this._overEvent,e),this._overEvent.type=ft.PICK_OVER_GUI,this._overEvent.target=a.object3D,this._overEvent.data=t,a.object3D.dispatchEvent(this._overEvent),this._lastOverTarget&&(this._lastOverTarget.mouseStyle=Le.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=ft.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=Le.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=ft.PICK_OUT_GUI,this._outEvent.target=this._lastOverTarget.object3D,this._outEvent.data=t,this._lastOverTarget.object3D.dispatchEvent(this._outEvent),this._lastOverTarget=null)}_lastDownPosition=new K;_calcDistanceVec2=new K;_lastDownTime=0;_clickTimeSpan=200;_clickDistanceSpan=10;onTouchDown(e){this._lastDownTime=Fe.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=Le.DOWN,Object.assign(this._downEvent,e),this._downEvent.type=ft.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=Le.NORMAL),a&&a==this._lastDownTarget&&Fe.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=ft.PICK_CLICK_GUI,this._clickEvent.target=a.object3D,this._clickEvent.data=t,a.object3D.dispatchEvent(this._clickEvent))),this._lastDownTarget=null}_colliderOut=[];_transformList=[];_sortWorldPanelList=[];_iteractive2PanelDict=new Map;collectEntities(){return this._colliderOut.length=0,this._sortWorldPanelList.length=0,this._iteractive2PanelDict.clear(),this._view.canvasList.slice().reverse().forEach(t=>{if(t&&t.transform&&t.transform.parent){let a=t.object3D.getComponentsByProperty("isUIPanel",!0,!0);a.sort((r,i)=>{let n=r._uiRenderer.__renderOrder,o=i._uiRenderer.__renderOrder;return n>o?-1:1});for(let r of a){this._transformList.length=0,r.object3D.getComponents(Za,this._transformList),this._transformList.reverse();for(const i of this._transformList){let n=i.uiInteractiveList;if(n&&n.length>0)for(let o of n)this._colliderOut.push(o),this._iteractive2PanelDict.set(o,r)}}}}),this._colliderOut}pick(e){this._ray=this._view.camera.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY);let t=new K(m.inputSystem.mouseX,m.inputSystem.mouseY),a=new K(k.canvas.clientWidth,k.canvas.clientHeight),r;for(const i of e)if(i.interactive&&i.enable&&i.interactiveVisible){let n=this._iteractive2PanelDict.get(i);if(r=i.rayPick(this._ray,n,t,a),r)return r.collider=i,r}return null}}var Kd=(s=>(s[s.COLLINEAR=0]="COLLINEAR",s[s.LINES_INTERSECT=1]="LINES_INTERSECT",s[s.SEGMENTS_INTERSECT=2]="SEGMENTS_INTERSECT",s[s.A_BISECTS_B=3]="A_BISECTS_B",s[s.B_BISECTS_A=4]="B_BISECTS_A",s[s.PARALELL=5]="PARALELL",s))(Kd||{}),qd=(s=>(s[s.ON_LINE=0]="ON_LINE",s[s.LEFT_SIDE=1]="LEFT_SIDE",s[s.RIGHT_SIDE=2]="RIGHT_SIDE",s))(qd||{});class lt{static cacluteLine0=new lt(null,null);static cacluteLine1=new lt(null,null);start;end;color=new P(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=u.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=Bn(a+1,e.length),n=e[r],o=e[i];t.push(new lt(n,o))}return t}intersection(e,t=null){var a=(e.end.z-e.start.z)*(this.end.x-this.start.x)-(e.end.x-e.start.x)*(this.end.z-this.start.z),r=(e.end.x-e.start.x)*(this.start.z-e.start.z)-(e.end.z-e.start.z)*(this.start.x-e.start.x),i=(e.start.x-this.start.x)*(this.end.z-this.start.z)-(e.start.z-this.start.z)*(this.end.x-this.start.x);if(a==0)return r==0&&i==0?0:5;r=r/a,i=i/a;var n=this.start.x+r*(this.end.x-this.start.x),o=this.start.z+r*(this.end.z-this.start.z);return t!=null&&(t.x=n,t.y=0,t.z=o),r>=0&&r<=1&&i>=0&&i<=1?2:i>=0&&i<=1?3:r>=0&&r<=1?4:1}getDirection(){var e=this.end.subtract(this.start),t=new u(e.x,e.y);return t.normalize()}copyFrom(e){this.start||(this.start=new u),this.end||(this.end=new u),this.start.copyFrom(e.start),this.end.copyFrom(e.end)}static IsEqual(e,t){return Math.abs(e-t)<1e-7}static squreDistanceSegmentToSegment(e,t,a){let r=e.start,i=e.end,n=t.start,o=t.end,l=r.x,c=r.y,f=r.z,d=i.x,h=i.y,b=i.z,p=n.x,g=n.y,A=n.z,D=o.x,_=o.y,U=o.z,v=d-l,x=h-c,C=b-f,F=D-p,w=_-g,S=U-A,M=l-p,T=c-g,Q=f-A,L=v*v+x*x+C*C,X=v*F+x*w+C*S,ie=F*F+w*w+S*S,q=v*M+x*T+C*Q,be=F*M+w*T+S*Q,Ue=L*ie-X*X,Z=Ue,de=Ue,ce=0,De=0;this.IsEqual(Ue,0)?(ce=0,Z=1,De=be,de=ie):(ce=X*be-ie*q,De=L*be-X*q,ce<0?(ce=0,De=be,de=ie):ce>Z&&(ce=Z,De=be+X,de=ie)),De<0?(De=0,-q<0?ce=0:-q>L?ce=Z:(ce=-q,Z=L)):De>de&&(De=de,-q+X<0?ce=0:-q+X>L?ce=Z:(ce=-q+X,Z=L));let _e=0,Ne=0;this.IsEqual(ce,0)?_e=0:_e=ce/Z,this.IsEqual(De,0)?Ne=0:Ne=De/de;let we=M+_e*v-Ne*F,Ce=T+_e*x-Ne*w,Me=Q+_e*C-Ne*S;return we*we+Ce*Ce+Me*Me}isNear(e,t=0,a){let r=u.HELP_0,i=u.HELP_1;r.copyFrom(e.origin),i.copyFrom(e.direction),i.scaleBy(9999),i.add(r,i),lt.cacluteLine0.set(r,i),lt.cacluteLine1.copyFrom(this),a&&(a.perspectiveMultiplyPoint3(lt.cacluteLine1.start,lt.cacluteLine1.start),a.perspectiveMultiplyPoint3(lt.cacluteLine1.end,lt.cacluteLine1.end));let n=lt.squreDistanceSegmentToSegment(lt.cacluteLine0,lt.cacluteLine1,a);return n+1e-4<=t?(e.length=n,!0):(e.length=-999999,!1)}}class ts{static ID=-1;v1;v2;v3;u1;u2;u3;n1;n2;n3;t0;t;u;v;min=new u;max=new u;id=0;constructor(e,t,a){this.id=ts.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 u(t.x-e.x,t.y-e.y,t.z-e.z),n=new u(a.x-e.x,a.y-e.y,a.z-e.z).crossProduct(r);return n.normalize(),n}turnBack(){let e=this.v3;this.v3=this.v1,this.v1=e}getLines(){let e=this.v1,t=this.v2,a=this.v3;return[new lt(e,t),new lt(t,a),new lt(a,e)]}equals(e){let t=this.getLines(),a=e.getLines(),r=0;for(let i=0;i<t.length;i++)for(let n=0;n<a.length;n++)t[i].equals(a[n])&&r++;return r==3}getCenter(){let e=this.min,t=this.max,a=new u;return a.x=(e.x+t.x)*.5,a.y=(e.y+t.y)*.5,a.z=(e.z+t.z)*.5,a}intersects(e){var t=this.max,a=this.min,r=e.max,i=e.min;return a.x<=r.x&&t.x>=i.x&&a.y<=r.y&&t.y>=i.y&&a.z<=r.z&&t.z>=i.z}sign2D(e,t,a){return(e.x-a.x)*(t.z-a.z)-(t.x-a.x)*(e.z-a.z)}pointInTriangle2D(e){let t=this.v1,a=this.v2,r=this.v3,i,n,o,l,c;return i=this.sign2D(e,t,a),n=this.sign2D(e,a,r),o=this.sign2D(e,r,t),l=i<0||n<0||o<0,c=i>0||n>0||o>0,!(l&&c)}toArray(){return[this.v1.x,this.v1.y,this.v1.z,this.v2.x,this.v2.y,this.v2.z,this.v3.x,this.v3.y,this.v3.z]}}class $d{static _pt0;static _pt1;static _pt2;static _pt3;static _hitPoint;static _worldMatrix;static _ray;static _triangle;static _isInit;static init(){this._pt0=new u,this._pt1=new u,this._pt2=new u,this._pt3=new u,this._ray=new ea,this._triangle=new ts,this._hitPoint=new u,this._worldMatrix=new E}static rayPick(e,t,a,r,i,n,o){this._isInit||(this.init(),this._isInit=!0);let l=this._worldMatrix;if(r==Kt.World){let c;this.calculateHotArea_World(n,this._pt0,this._pt1,this._pt2,this._pt3),l.copyFrom(o).invert();let f=this._ray;if(f.copy(e).applyMatrix(l),this._triangle.set(this._pt0,this._pt1,this._pt2),c=f.intersectTriangle(f.origin,f.direction,this._triangle),c||(this._triangle.set(this._pt1,this._pt2,this._pt3),c=f.intersectTriangle(f.origin,f.direction,this._triangle)),c)return{distance:0,intersectPoint:c}}else{this.calculateHotArea_View(n,i,this._pt0,this._pt1,this._pt2,this._pt3);let c=a.x,f=a.y,d=Math.min(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,h=Math.min(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5,b=Math.max(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,p=Math.max(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5;return t.x<=b&&t.x>=d&&t.y<=p&&t.y>=h?(this._hitPoint.set(t.x,t.y,0),{distance:0,intersectPoint:this._hitPoint}):null}return null}static calculateHotArea_View(e,t,a,r,i,n){let o=e.getWorldMatrix(),l=o.getScaleX(),c=o.getScaleY(),f=e.width*.5*l,d=e.height*.5*c;a.set(-f,-d,0),r.set(f,-d,0),i.set(-f,d,0),n.set(f,d,0);let h=o.tx;a.x+=h,r.x+=h,i.x+=h,n.x+=h,h=o.ty,a.y-=h,r.y-=h,i.y-=h,n.y-=h,a.multiplyScalar(t),r.multiplyScalar(t),i.multiplyScalar(t),n.multiplyScalar(t)}static calculateHotArea_World(e,t,a,r,i){let n=e.getWorldMatrix(),o=n.getScaleX(),l=n.getScaleY(),c=e.width*.5*o,f=e.height*.5*l;t.set(-c,f,0),a.set(c,f,0),r.set(-c,-f,0),i.set(c,-f,0);let d=n.tx;t.x+=d,a.x+=d,r.x+=d,i.x+=d,d=n.ty,t.y+=d,a.y+=d,r.y+=d,i.y+=d}}var eh=(s=>(s[s.UpperLeft=0]="UpperLeft",s[s.UpperCenter=1]="UpperCenter",s[s.UpperRight=2]="UpperRight",s[s.MiddleLeft=3]="MiddleLeft",s[s.MiddleCenter=4]="MiddleCenter",s[s.MiddleRight=5]="MiddleRight",s[s.LowerLeft=6]="LowerLeft",s[s.LowerCenter=7]="LowerCenter",s[s.LowerRight=8]="LowerRight",s))(eh||{}),th=(s=>(s[s.Upper=0]="Upper",s[s.Middle=1]="Middle",s[s.Lower=2]="Lower",s))(th||{}),ah=(s=>(s[s.Left=0]="Left",s[s.Center=1]="Center",s[s.Right=2]="Right",s))(ah||{});class rh{charList=[];quadList=[];width=0;index=0}class ih{layout(e){let t=[],a=e.originSize,r=ii.getFontData(e.font,a),i=e.fontSize/a;return this.makeTextLine(e.uiTransform,e.alignment,t,e.font,r,e.text,i,a,e.lineSpacing),t}makeTextLine(e,t,a,r,i,n,o,l,c){let f=-1,d=0,h=l*o,b=h*.5,p=e.width/o,g=e.height/o,A=0,D=e.height,_=()=>{d=0,f++;let C=new rh;return C.index=f,a.push(C),C},U=(C,F)=>{const w=C.charCodeAt(0).toString();let S=ii.getFnt(r,l,w),M=null;return S?(M=wa.spawnQuad(),M.sprite=S,M.x=(d+S.xoffset)*o-A,M.y=(i.base-S.height-S.yoffset-i.base)*o+D,M.width=S.offsetSize.width*o,M.height=S.offsetSize.height*o,d+=S.xadvance):C==`
|
|
11661
|
+
`}class Co extends mt{_scissorRect;_screenSize=new K(1024,768);_scissorEnable=!1;constructor(e){super(),z.register("GUI_shader_view",yo.GUI_shader_view),z.register("GUI_shader_world",yo.GUI_shader_world);let t=new ot;this.addColorPass(t,H.COLOR,e),this.addColorPass(t,H.UI,e),this.shader=t}addColorPass(e,t,a){let r=a==Kt.View?"GUI_shader_view":"GUI_shader_world",i=new Ve(r,r);i.passType=t,i.setShaderEntry("VertMain","FragMain"),i.setUniformVector4("scissorRect",new te),i.setUniformVector2("screenSize",this._screenSize),i.setUniformFloat("scissorCornerRadius",0),i.setUniformFloat("scissorFadeOutSize",0),i.setUniformFloat("pixelRatio",1),i.setUniformVector3("v3",u.ZERO);let n=i.shaderState;n.depthWriteEnabled=!1,i.blendMode=ae.NORMAL,i.depthCompare=a==Kt.View?et.always:et.less_equal,i.cullMode=wt.back,e.addRenderPass(i)}setPanelRatio(e){this.shader.setUniformFloat("pixelRatio",e)}setScissorRect(e,t,a,r){this._scissorRect||=new te,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]||m.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 jd extends ${_guiGeometry;init(e){super.init(),this.addRendererMask(Be.UI),this.removeRendererMask(Be.Default),this.castGI=!1,this.castShadow=!1,this.alwaysRender=!0,this._ignoreEnvMap=this._ignorePrefilterMap=!0}get geometry(){return super.geometry}set geometry(e){super.geometry=e,this._guiGeometry=e}nodeUpdate(e,t,a,r){for(let i=0;i<this.materials.length;i++){let o=this.materials[i].getPass(t),l=this._guiGeometry.getPositionBuffer(),c=this._guiGeometry.getSpriteBuffer(),f=this._guiGeometry.getColorBuffer();if(o)for(let d=0;d<o.length;d++){const h=o[d];h.pipeline||(h.setStorageBuffer("vPositionBuffer",l),h.setStorageBuffer("vSpriteBuffer",c),h.setStorageBuffer("vColorBuffer",f))}}super.nodeUpdate(e,t,a,r)}onUpdate(e){}}class Yd{_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 Ti;class wa{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=m.res.defaultGUISprite;_color=new P(1,1,1,1);_imageType=ni.Simple;dirtyAttributes=Ze.MAX;cacheTextureId=-1;static textPool;static get quadPool(){return this.textPool||=new Yd,this.textPool}static recycleQuad(e){e.sprite=null,e.dirtyAttributes=Ze.MAX,e.x=0,e.y=0,e.z=-1,e.cacheTextureId=-1,wa.quadPool.pushBack(e)}static spawnQuad(){return wa.quadPool.getOne(wa)}get imageType(){return this._imageType}set imageType(e){this._imageType=e,this.setAttrChange(Ze.SPRITE|Ze.POSITION)}get color(){return this._color}set color(e){this._color.copyFrom(e),this.setAttrChange(Ze.COLOR)}get visible(){return this._visible}set visible(e){e!=this._visible&&(this._visible=e,this.setAttrChange(Ze.SPRITE))}get sprite(){return this._sprite}set sprite(e){this._sprite!=e&&(this._sprite=e,this.setAttrChange(Ze.SPRITE|Ze.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(Ze.POSITION)}setXY(e,t){this.x=e,this.y=t,this.setAttrChange(Ze.POSITION)}setAttrChange(e){this.dirtyAttributes=this.dirtyAttributes|e}applyTransform(e){this.setAttrChange(Ze.POSITION);let t=this._sprite,a=e.getWorldMatrix();(this.x!=0||this.y!=0)&&(a=this.getQuadMatrix(a));let r=a.getScaleX(),i=a.getScaleY(),n=t.isSliced&&this._imageType==ni.Sliced;if(this._offsetX=e.width*.5*r,this._offsetY=e.height*.5*i,n)this._globalWidth=r*(e.width-(t.offsetSize.z-t.trimSize.x)),this._globalHeight=i*(e.height-(t.offsetSize.w-t.trimSize.y)),this._globalX=a.tx+t.offsetSize.x*r,this._globalY=a.ty+t.offsetSize.y*i;else{let o=this.width/t.offsetSize.z,l=this.height/t.offsetSize.w;this._globalWidth=r*t.trimSize.x*o,this._globalHeight=i*t.trimSize.y*l,this._globalX=a.tx+t.offsetSize.x*o*r,this._globalY=a.ty+t.offsetSize.y*l*i}return this}getQuadMatrix(e){return Ti||=new Nr,Ti.identity(),Ti.setTranslate(this.x,this.y),Ti.mul(e),Ti}writeToGeometry(e,t){return e.fillQuad(this,t),this.dirtyAttributes=Ze.NONE,this}}class So extends Pe{_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(Za),this._uiTransform.setNeedUpdateUIPanel()}copyComponent(e){return this.visible=e.visible,this}}class Mi extends So{_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),wa.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 Vr extends Mi{init(e){super.init?.(e),this.attachQuad(wa.spawnQuad()),this.sprite=m.res.defaultGUISprite}cloneTo(e){e.getOrAddComponent(Vr).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||=m.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 es extends Vr{space=Kt.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(es).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(k.canvas.width,k.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 Co(this.space);let n=this._uiRenderer.materials.slice();n.push(i),this._uiRenderer.materials=n,i.cullMode=r.cullMode,i.depthCompare=r.depthCompare}}create(e){this._maxCount=this.space==Kt.World?Ir.quadMaxCountForWorld:Ir.quadMaxCountForView,this._uiRenderer=this.object3D.addComponent(jd),this._geometry=this._uiRenderer.geometry=new Jd(this._maxCount).create(),this._uiRenderer.material=new Co(e),this._uiRenderer.renderOrder=Ir.SortOrderStartWorld,this._rebuild=new Zd,this.object3D.bound=new pe(new u,new u(1,1,1).multiplyScalar(Number.MAX_VALUE*.1))}get quadMaxCount(){return this._maxCount}get renderer(){return this._uiRenderer}set billboard(e){this.space==Kt.View&&(e=sr.None,console.warn("Cannot enable billboard in view space")),e==sr.BillboardXYZ||e==sr.BillboardY?(this._billboard=this.object3D.getOrAddComponent(qi),this._billboard.type=e):(this.object3D.removeComponent(qi),this._billboard=null)}get billboard(){return this._billboard?this._billboard.type:sr.None}set cullMode(e){if(this.space==Kt.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(Za,a),a.length>0){t._rebuild.build(a,t,t.needUpdateGeometry);for(const o of a)o.needUpdateQuads=!1}let r=t.object3D.getComponentFromParent($i),i=r?r.index:0;t._uiRenderer.enable=a.length>0;let n=t.isViewPanel?Ir.SortOrderStartView:Ir.SortOrderStartWorld;if(t._uiRenderer.renderOrder=i*Ir.SortOrderCanvasSpan+n+t.panelOrder,t._uiRenderer.needSortOnCameraZ=t.needSortOnCameraZ,this.space==Kt.View){let o=k.canvas.clientWidth,l=k.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(k.canvas.clientWidth,k.canvas.clientHeight),l.setScissorEnable(t.scissorEnable),t.scissorEnable){let c=t.mainQuads[0];l.setScissorRect(c.left,c.bottom,c.right,c.top),l.setScissorCorner(t.scissorCornerRadius,t.scissorFadeOutSize)}}t.needUpdateGeometry=!1}updateGUIPixelRatio(e,t,a,r){let i=a/r,n=e/t,o=1;return i<n?o=t/r:o=e/a,o}}class Xs extends es{isViewPanel=!0;space=Kt.View;constructor(){super()}cloneTo(e){e.getOrAddComponent(Xs).copyComponent(this)}}class Hs extends es{isWorldPanel=!0;space=Kt.World;_depthTest=!0;constructor(){super()}cloneTo(e){e.getOrAddComponent(Hs).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?et.less_equal:et.always;for(let a of this._uiRenderer.materials)a.depthCompare=t}}}let Xd;class Za extends Pe{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 Nr,this._worldMatrix=new Nr}init(e){super.init(e),this.transform.eventDispatcher.addEventListener(this.transform.eventLocalChange.type,this.onTransformChange,this),this.onParentChange(null,this.object3D.parent?.object3D)}onTransformChange(e){this.onChange=!0}addUIInteractive(e){return this._uiInteractiveList||=[],this._uiInteractiveList.push(e),this}removeUIInteractive(e){if(this._uiInteractiveList){let t=this._uiInteractiveList.indexOf(e);if(t>=0)return this._uiInteractiveList.slice(t,1),e}return null}get globalVisible(){return this._globalVisible}set visible(e){if(this._localVisible!=e){this._localVisible=e;let t=this.parent?this.parent._globalVisible:!0;this.onUITransformVisible(this._localVisible&&t)}}get visible(){return this._localVisible}onUITransformVisible(e){let t=this._localVisible&&e;t!=this._globalVisible&&(this._globalVisible=t,this.object3D.components.forEach((a,r)=>{let i=a;if(i.onUITransformVisible)if(i==this)for(let n of this.object3D.entityChildren){let o=n.getComponent(Za);o&&o.onUITransformVisible(this._globalVisible)}else i.onUITransformVisible(this._globalVisible)}))}onParentChange(e,t){this.parent?.setNeedUpdateUIPanel(),this.parent=t?.getComponent(Za),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(Za,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(Hs),e||(e=this.object3D.getComponentFromParent(Xs)),e&&(e.needUpdateGeometry=!0)}cloneTo(e){let t=e.getOrAddComponent(Za);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)&&(Xd||=new Nr().identity(),e.mul(Xd.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 Hd{_ray;_mouseCode;_clickEvent;_outEvent;_overEvent;_upEvent;_downEvent;_view;init(e){this._view=e,this._ray=new ea,this._clickEvent=new ft(ft.PICK_CLICK_GUI),this._outEvent=new ft(ft.PICK_OUT_GUI),this._overEvent=new ft(ft.PICK_OVER_GUI),this._upEvent=new ft(ft.PICK_UP_GUI),this._downEvent=new ft(ft.PICK_DOWN_GUI),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onTouchDown,this,null,1),m.inputSystem.addEventListener(O.POINTER_UP,this.onTouchUp,this,null,1),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onTouchMove,this,null,1),m.inputSystem.addEventListener(O.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=Le.OVER,Object.assign(this._overEvent,e),this._overEvent.type=ft.PICK_OVER_GUI,this._overEvent.target=a.object3D,this._overEvent.data=t,a.object3D.dispatchEvent(this._overEvent),this._lastOverTarget&&(this._lastOverTarget.mouseStyle=Le.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=ft.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=Le.NORMAL,Object.assign(this._outEvent,e),this._outEvent.type=ft.PICK_OUT_GUI,this._outEvent.target=this._lastOverTarget.object3D,this._outEvent.data=t,this._lastOverTarget.object3D.dispatchEvent(this._outEvent),this._lastOverTarget=null)}_lastDownPosition=new K;_calcDistanceVec2=new K;_lastDownTime=0;_clickTimeSpan=200;_clickDistanceSpan=10;onTouchDown(e){this._lastDownTime=Fe.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=Le.DOWN,Object.assign(this._downEvent,e),this._downEvent.type=ft.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=Le.NORMAL),a&&a==this._lastDownTarget&&Fe.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=ft.PICK_CLICK_GUI,this._clickEvent.target=a.object3D,this._clickEvent.data=t,a.object3D.dispatchEvent(this._clickEvent))),this._lastDownTarget=null}_colliderOut=[];_transformList=[];_sortWorldPanelList=[];_iteractive2PanelDict=new Map;collectEntities(){return this._colliderOut.length=0,this._sortWorldPanelList.length=0,this._iteractive2PanelDict.clear(),this._view.canvasList.slice().reverse().forEach(t=>{if(t&&t.transform&&t.transform.parent){let a=t.object3D.getComponentsByProperty("isUIPanel",!0,!0);a.sort((r,i)=>{let n=r._uiRenderer.__renderOrder,o=i._uiRenderer.__renderOrder;return n>o?-1:1});for(let r of a){this._transformList.length=0,r.object3D.getComponents(Za,this._transformList),this._transformList.reverse();for(const i of this._transformList){let n=i.uiInteractiveList;if(n&&n.length>0)for(let o of n)this._colliderOut.push(o),this._iteractive2PanelDict.set(o,r)}}}}),this._colliderOut}pick(e){this._ray=this._view.camera.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY);let t=new K(m.inputSystem.mouseX,m.inputSystem.mouseY),a=new K(k.canvas.clientWidth,k.canvas.clientHeight),r;for(const i of e)if(i.interactive&&i.enable&&i.interactiveVisible){let n=this._iteractive2PanelDict.get(i);if(r=i.rayPick(this._ray,n,t,a),r)return r.collider=i,r}return null}}var Kd=(s=>(s[s.COLLINEAR=0]="COLLINEAR",s[s.LINES_INTERSECT=1]="LINES_INTERSECT",s[s.SEGMENTS_INTERSECT=2]="SEGMENTS_INTERSECT",s[s.A_BISECTS_B=3]="A_BISECTS_B",s[s.B_BISECTS_A=4]="B_BISECTS_A",s[s.PARALELL=5]="PARALELL",s))(Kd||{}),qd=(s=>(s[s.ON_LINE=0]="ON_LINE",s[s.LEFT_SIDE=1]="LEFT_SIDE",s[s.RIGHT_SIDE=2]="RIGHT_SIDE",s))(qd||{});class lt{static cacluteLine0=new lt(null,null);static cacluteLine1=new lt(null,null);start;end;color=new P(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=u.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=Bn(a+1,e.length),n=e[r],o=e[i];t.push(new lt(n,o))}return t}intersection(e,t=null){var a=(e.end.z-e.start.z)*(this.end.x-this.start.x)-(e.end.x-e.start.x)*(this.end.z-this.start.z),r=(e.end.x-e.start.x)*(this.start.z-e.start.z)-(e.end.z-e.start.z)*(this.start.x-e.start.x),i=(e.start.x-this.start.x)*(this.end.z-this.start.z)-(e.start.z-this.start.z)*(this.end.x-this.start.x);if(a==0)return r==0&&i==0?0:5;r=r/a,i=i/a;var n=this.start.x+r*(this.end.x-this.start.x),o=this.start.z+r*(this.end.z-this.start.z);return t!=null&&(t.x=n,t.y=0,t.z=o),r>=0&&r<=1&&i>=0&&i<=1?2:i>=0&&i<=1?3:r>=0&&r<=1?4:1}getDirection(){var e=this.end.subtract(this.start),t=new u(e.x,e.y);return t.normalize()}copyFrom(e){this.start||(this.start=new u),this.end||(this.end=new u),this.start.copyFrom(e.start),this.end.copyFrom(e.end)}static IsEqual(e,t){return Math.abs(e-t)<1e-7}static squreDistanceSegmentToSegment(e,t,a){let r=e.start,i=e.end,n=t.start,o=t.end,l=r.x,c=r.y,f=r.z,d=i.x,h=i.y,b=i.z,p=n.x,g=n.y,A=n.z,D=o.x,_=o.y,U=o.z,v=d-l,x=h-c,C=b-f,F=D-p,w=_-g,S=U-A,M=l-p,T=c-g,Q=f-A,L=v*v+x*x+C*C,X=v*F+x*w+C*S,ie=F*F+w*w+S*S,q=v*M+x*T+C*Q,be=F*M+w*T+S*Q,Ue=L*ie-X*X,Z=Ue,de=Ue,ce=0,De=0;this.IsEqual(Ue,0)?(ce=0,Z=1,De=be,de=ie):(ce=X*be-ie*q,De=L*be-X*q,ce<0?(ce=0,De=be,de=ie):ce>Z&&(ce=Z,De=be+X,de=ie)),De<0?(De=0,-q<0?ce=0:-q>L?ce=Z:(ce=-q,Z=L)):De>de&&(De=de,-q+X<0?ce=0:-q+X>L?ce=Z:(ce=-q+X,Z=L));let _e=0,Ne=0;this.IsEqual(ce,0)?_e=0:_e=ce/Z,this.IsEqual(De,0)?Ne=0:Ne=De/de;let we=M+_e*v-Ne*F,Ce=T+_e*x-Ne*w,Me=Q+_e*C-Ne*S;return we*we+Ce*Ce+Me*Me}isNear(e,t=0,a){let r=u.HELP_0,i=u.HELP_1;r.copyFrom(e.origin),i.copyFrom(e.direction),i.scaleBy(9999),i.add(r,i),lt.cacluteLine0.set(r,i),lt.cacluteLine1.copyFrom(this),a&&(a.perspectiveMultiplyPoint3(lt.cacluteLine1.start,lt.cacluteLine1.start),a.perspectiveMultiplyPoint3(lt.cacluteLine1.end,lt.cacluteLine1.end));let n=lt.squreDistanceSegmentToSegment(lt.cacluteLine0,lt.cacluteLine1,a);return n+1e-4<=t?(e.length=n,!0):(e.length=-999999,!1)}}class ts{static ID=-1;v1;v2;v3;u1;u2;u3;n1;n2;n3;t0;t;u;v;min=new u;max=new u;id=0;constructor(e,t,a){this.id=ts.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 u(t.x-e.x,t.y-e.y,t.z-e.z),n=new u(a.x-e.x,a.y-e.y,a.z-e.z).crossProduct(r);return n.normalize(),n}turnBack(){let e=this.v3;this.v3=this.v1,this.v1=e}getLines(){let e=this.v1,t=this.v2,a=this.v3;return[new lt(e,t),new lt(t,a),new lt(a,e)]}equals(e){let t=this.getLines(),a=e.getLines(),r=0;for(let i=0;i<t.length;i++)for(let n=0;n<a.length;n++)t[i].equals(a[n])&&r++;return r==3}getCenter(){let e=this.min,t=this.max,a=new u;return a.x=(e.x+t.x)*.5,a.y=(e.y+t.y)*.5,a.z=(e.z+t.z)*.5,a}intersects(e){var t=this.max,a=this.min,r=e.max,i=e.min;return a.x<=r.x&&t.x>=i.x&&a.y<=r.y&&t.y>=i.y&&a.z<=r.z&&t.z>=i.z}sign2D(e,t,a){return(e.x-a.x)*(t.z-a.z)-(t.x-a.x)*(e.z-a.z)}pointInTriangle2D(e){let t=this.v1,a=this.v2,r=this.v3,i,n,o,l,c;return i=this.sign2D(e,t,a),n=this.sign2D(e,a,r),o=this.sign2D(e,r,t),l=i<0||n<0||o<0,c=i>0||n>0||o>0,!(l&&c)}toArray(){return[this.v1.x,this.v1.y,this.v1.z,this.v2.x,this.v2.y,this.v2.z,this.v3.x,this.v3.y,this.v3.z]}}class $d{static _pt0;static _pt1;static _pt2;static _pt3;static _hitPoint;static _worldMatrix;static _ray;static _triangle;static _isInit;static init(){this._pt0=new u,this._pt1=new u,this._pt2=new u,this._pt3=new u,this._ray=new ea,this._triangle=new ts,this._hitPoint=new u,this._worldMatrix=new E}static rayPick(e,t,a,r,i,n,o){this._isInit||(this.init(),this._isInit=!0);let l=this._worldMatrix;if(r==Kt.World){let c;this.calculateHotArea_World(n,this._pt0,this._pt1,this._pt2,this._pt3),l.copyFrom(o).invert();let f=this._ray;if(f.copy(e).applyMatrix(l),this._triangle.set(this._pt0,this._pt1,this._pt2),c=f.intersectTriangle(f.origin,f.direction,this._triangle),c||(this._triangle.set(this._pt1,this._pt2,this._pt3),c=f.intersectTriangle(f.origin,f.direction,this._triangle)),c)return{distance:0,intersectPoint:c}}else{this.calculateHotArea_View(n,i,this._pt0,this._pt1,this._pt2,this._pt3);let c=a.x,f=a.y,d=Math.min(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,h=Math.min(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5,b=Math.max(this._pt0.x,this._pt1.x,this._pt2.x,this._pt3.x)+c*.5,p=Math.max(this._pt0.y,this._pt1.y,this._pt2.y,this._pt3.y)+f*.5;return t.x<=b&&t.x>=d&&t.y<=p&&t.y>=h?(this._hitPoint.set(t.x,t.y,0),{distance:0,intersectPoint:this._hitPoint}):null}return null}static calculateHotArea_View(e,t,a,r,i,n){let o=e.getWorldMatrix(),l=o.getScaleX(),c=o.getScaleY(),f=e.width*.5*l,d=e.height*.5*c;a.set(-f,-d,0),r.set(f,-d,0),i.set(-f,d,0),n.set(f,d,0);let h=o.tx;a.x+=h,r.x+=h,i.x+=h,n.x+=h,h=o.ty,a.y-=h,r.y-=h,i.y-=h,n.y-=h,a.multiplyScalar(t),r.multiplyScalar(t),i.multiplyScalar(t),n.multiplyScalar(t)}static calculateHotArea_World(e,t,a,r,i){let n=e.getWorldMatrix(),o=n.getScaleX(),l=n.getScaleY(),c=e.width*.5*o,f=e.height*.5*l;t.set(-c,f,0),a.set(c,f,0),r.set(-c,-f,0),i.set(c,-f,0);let d=n.tx;t.x+=d,a.x+=d,r.x+=d,i.x+=d,d=n.ty,t.y+=d,a.y+=d,r.y+=d,i.y+=d}}var eh=(s=>(s[s.UpperLeft=0]="UpperLeft",s[s.UpperCenter=1]="UpperCenter",s[s.UpperRight=2]="UpperRight",s[s.MiddleLeft=3]="MiddleLeft",s[s.MiddleCenter=4]="MiddleCenter",s[s.MiddleRight=5]="MiddleRight",s[s.LowerLeft=6]="LowerLeft",s[s.LowerCenter=7]="LowerCenter",s[s.LowerRight=8]="LowerRight",s))(eh||{}),th=(s=>(s[s.Upper=0]="Upper",s[s.Middle=1]="Middle",s[s.Lower=2]="Lower",s))(th||{}),ah=(s=>(s[s.Left=0]="Left",s[s.Center=1]="Center",s[s.Right=2]="Right",s))(ah||{});class rh{charList=[];quadList=[];width=0;index=0}class ih{layout(e){let t=[],a=e.originSize,r=ii.getFontData(e.font,a),i=e.fontSize/a;return this.makeTextLine(e.uiTransform,e.alignment,t,e.font,r,e.text,i,a,e.lineSpacing),t}makeTextLine(e,t,a,r,i,n,o,l,c){let f=-1,d=0,h=l*o,b=h*.5,p=e.width/o,g=e.height/o,A=0,D=e.height,_=()=>{d=0,f++;let C=new rh;return C.index=f,a.push(C),C},U=(C,F)=>{const w=C.charCodeAt(0).toString();let S=ii.getFnt(r,l,w),M=null;return S?(M=wa.spawnQuad(),M.sprite=S,M.x=(d+S.xoffset)*o-A,M.y=(i.base-S.height-S.yoffset-i.base)*o+D,M.width=S.offsetSize.width*o,M.height=S.offsetSize.height*o,d+=S.xadvance):C==`
|
|
11662
11662
|
`||(C==" "?d+=h:d+=b),F.width=d,F.quadList.push(M),F.charList.push(C),M},v=()=>{let C=this.getAlignment(t);switch(C.v){case 0:for(let F=0,w=a.length;F<w;F++){let S=a[F];if(F>0){let M=F*h*c;for(let T=0,Q=S.quadList.length;T<Q;T++){let L=S.quadList[T];L&&(L.y-=M)}}}break;case 1:for(let F=0,w=a.length;F<w;F++){let S=a[F],M=(g-w*l*c)*.5*o+F*h*c;for(let T=0,Q=S.quadList.length;T<Q;T++){let L=S.quadList[T];L&&(L.y-=M)}}break;case 2:for(let F=0,w=a.length;F<w;F++){let S=a[F],M=(g-w*l*c)*o+F*h*c;for(let T=0,Q=S.quadList.length;T<Q;T++){let L=S.quadList[T];L&&(L.y-=M)}}break}switch(C.h){case 0:break;case 1:for(let F=0,w=a.length;F<w;F++){let S=a[F],M=(p-S.width)*.5*o;for(let T=0,Q=S.quadList.length;T<Q;T++){let L=S.quadList[T];L&&(L.x+=M)}}break;case 2:for(let F=0,w=a.length;F<w;F++){let S=a[F],M=(p-S.width)*o;for(let T=0,Q=S.quadList.length;T<Q;T++){let L=S.quadList[T];L&&(L.x+=M)}}break}};(()=>{let C=null,F=n.length;for(let w=0;w<F;w++){C||=_();let S=n.charAt(w);S==`
|
|
11663
|
-
`||S==" "?C=null:(U(S,C),C.width+b>=p&&(C=_()))}})(),v()}getAlignment(e){let t={v:0,h:0};switch(e){case 1:t.v=0,t.h=1;break;case 0:t.v=0,t.h=0;break;case 2:t.v=0,t.h=2;break;case 4:t.v=1,t.h=1;break;case 3:t.v=1,t.h=0;break;case 5:t.v=1,t.h=2;break;case 7:t.v=2,t.h=1;break;case 6:t.v=2,t.h=0;break;case 8:t.v=2,t.h=2;break}return t}}class Ks extends So{_style=Le.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 $d.rayPick(e,a,r,t.space,t.panelRatio,this._uiTransform,t.transform.worldMatrix)}cloneTo(e){e.getOrAddComponent(Ks).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.enable=e._enable,this.interactive=e._interactive,this.mouseStyle=e._style,this}}var sh=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=1]="COLOR",s[s.SPRITE=2]="SPRITE",s))(sh||{});class Yo extends Ks{_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(Vr),this._isCreateImage=this._image==null,this._image||(this._image=this.object3D.addComponent(Vr)),this.imageType=ni.Sliced}onEnable(){this.mouseStyle=Le.NORMAL}onDisable(){this.mouseStyle=Le.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(Le.NORMAL)}set normalSprite(e){this._spriteMap.set(Le.NORMAL,e),this._style==Le.NORMAL&&this.validateStyle(this._style,!0)}get overSprite(){return this._spriteMap.get(Le.OVER)}set overSprite(e){this._spriteMap.set(Le.OVER,e),this._style==Le.OVER&&this.validateStyle(this._style,!0)}set downSprite(e){this._spriteMap.set(Le.DOWN,e),this._style==Le.DOWN&&this.validateStyle(this._style,!0)}get downSprite(){return this._spriteMap.get(Le.DOWN)}set disableSprite(e){this._spriteMap.set(Le.DISABLE,e),this._style==Le.DISABLE&&this.validateStyle(this._style,!0)}get disableSprite(){return this._spriteMap.get(Le.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(Vr),this._image=null),super.destroy()}}class Xo extends Mi{_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(wa.spawnQuad());this._uiTransform.resize(0,0)}getQuad(e){return this._mainQuads[e]}cloneTo(e){e.addComponent(Xo,{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||m.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 K;let a=this._mainQuads[e];return t.x=a.x,t.y=a.y,t}}class Ho extends Mi{_shadowQuality=1;_shadowOffset;_shadowRadius;_shadowColor;_subShadowColor;needUpdateShadow=!1;init(e){super.init?.(e),this._shadowRadius=2,this._shadowQuality=1,this._shadowOffset=new K(4,-4),this._shadowColor=new P(.1,.1,.1,.8),this._subShadowColor=this._shadowColor.clone(),this.isUIShadow=!0}cloneTo(e){e.getOrAddComponent(Ho).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=se(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 K(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=wa.spawnQuad(),n=0,o=0;if(r==0)i.color=this._shadowColor;else{let l=a*(r-1)/(t-1);n=Math.sin(l)*this._shadowRadius,o=Math.cos(l)*this._shadowRadius,i.color=this._subShadowColor}i.setXY(n+this._shadowOffset.x+e.x,o+this._shadowOffset.y+e.y),i.setSize(e.width,e.height),i.sprite=e.sprite,i.visible=e.visible,i.imageType=e.imageType,this.attachQuad(i)}}}class Ko extends Mi{_font="\u5FAE\u8F6F\u96C5\u9ED1";_fontSize=14;_originSize=42;_alignment=0;_lineSpacing=1;_text="";_color=new P(1,1,1,1);constructor(){super()}cloneTo(e){e.getOrAddComponent(Ko).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 ih;layoutText(){this.detachQuads(),this.textLine=this.layoutProxy.layout(this);for(let e=0,t=this.textLine.length;e<t;e++){let a=this.textLine[e];for(let r=0,i=a.quadList.length;r<i;r++){let n=a.quadList[r];n&&this.attachQuad(n)}}this.color=this._color,this._uiTransform.setNeedUpdateUIPanel(),this.onUIComponentVisible(this._visible),this.setShadowDirty()}onUIComponentVisible(e){this.applyComponentVisible()}onUITransformVisible(e){this.applyComponentVisible()}applyComponentVisible(){let e=!this._visible||!this._uiTransform.globalVisible;for(let t of this._mainQuads)t&&(t.visible=!e);this.setShadowDirty()}onTransformResize(){this.layoutText()}get color(){return this._color}set color(e){this._color.copyFrom(e);for(let t of this._mainQuads)t.color=e;this.setShadowDirty()}get alignment(){return this._alignment}set alignment(e){this._alignment!=e&&(this._alignment=e,this.layoutText())}get lineSpacing(){return this._lineSpacing}set lineSpacing(e){this._lineSpacing!=e&&(this._lineSpacing=e,this.layoutText())}}var dg=Object.getOwnPropertyDescriptor,hg=(s,e,t,a)=>{for(var r=a>1?void 0:a?dg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Es=class extends xi{constructor(){super()}init(){super.init(),this.lightData.lightType=Xe.PointLight,this.object3D.name==""&&(this.object3D.name="PointLight"+Et())}get range(){return this.lightData.range}set range(s){this.lightData.range=s,this.onChange()}get at(){return this.lightData.linear}set at(s){this.lightData.linear=s,this.onChange()}get radius(){return this.lightData.radius}set radius(s){this.lightData.radius=s,this.onChange()}get quadratic(){return this.lightData.quadratic}set quadratic(s){this.lightData.quadratic=s,this.onChange()}start(){this.transform.rotationX=90,super.start()}onUpdate(){}onGraphic(s){let e=s.scene.getChildByName("graphic3D");if(!e)return;let t=e.createCustomShape(`PointLight_${this.object3D.instanceID}`,this.transform);t.buildAxis(),t.buildCircle(u.ZERO,this.range,32,u.X_AXIS),t.buildCircle(u.ZERO,this.range,32,u.Y_AXIS),t.buildCircle(u.ZERO,this.range,32,u.Z_AXIS)}debug(){}debugDraw(s){}};Es=hg([Vt(Es,"Light")],Es);var ug=Object.getOwnPropertyDescriptor,bg=(s,e,t,a)=>{for(var r=a>1?void 0:a?ug(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ni=class extends Na{_fatLineMaterial=null;_fatLineGeometry=null;_cachedResolution=new K(0,0);constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(s){s.addComponent(Ni).copyComponent(this)}copyComponent(s){return super.copyComponent(s),this}set geometry(s){super.geometry=s,this._fatLineGeometry=s,s&&(this.instanceCount=s.instanceCount,this._fatLineMaterial&&s.instanceBuffer&&this._fatLineMaterial.setInstanceBuffer(s.instanceBuffer))}get geometry(){return this._fatLineGeometry}set material(s){this.materials=[s],this._fatLineMaterial=s,this._fatLineGeometry&&this._fatLineGeometry.instanceBuffer&&s.setInstanceBuffer(this._fatLineGeometry.instanceBuffer)}get material(){return this._fatLineMaterial}nodeUpdate(s,e,t,a){if(this._fatLineMaterial&&this.object3D){this._fatLineMaterial.setModelMatrix(this.object3D.transform.worldMatrix);const r=k.presentationSize[0],i=k.presentationSize[1];r>0&&i>0&&(this._cachedResolution.x!==r||this._cachedResolution.y!==i)&&(this._cachedResolution.set(r,i),this._fatLineMaterial.resolution=this._cachedResolution.clone())}super.nodeUpdate(s,e,t,a)}destroy(s){super.destroy(s)}};Ni=bg([Vt(Ni,"FatLineRenderer")],Ni);class nh extends ee{index=0;drawCallFrame=-1;constructor(){super()}}var Fo=(s=>(s[s.CastGI=0]="CastGI",s[s.ReceiveGI=1]="ReceiveGI",s[s.CastDepth=2]="CastDepth",s[s.Other=3]="Other",s))(Fo||{});class oh extends mt{static count=0;constructor(e=0,t=0){super(),z.register("GIProbeShader",yd);let a=new ot,r=new Ve("GIProbeShader","GIProbeShader");r.passType=H.COLOR,a.addRenderPass(r),r.setDefine("USE_BRDF",!0),r.setShaderEntry("VertMain","FragMain"),r.setUniformVector4("probeUniform",new te(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",m.res.whiteTexture),a.setTexture("normalMap",m.res.normalTexture),a.setTexture("emissiveMap",m.res.blackTexture),this.shader=a}}class gg extends Pe{_probes;_volume;_debugMr=[];init(e){e||=m.views[0]?.scene,m.setting.gi.enable=!0,this._volume=oe.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 Rr(4,16,16),n=new u;this._probes=[];for(let o=0;o<t;o++)for(let l=0;l<a;l++)for(let c=0;c<r;c++){let f=o+c*t+l*(t*r),d=new nh;d.index=f,d.name=`${o}_${l}_${c}`;let h=d.addComponent($);h.material=new oh(Fo.CastGI,f),h.geometry=i,h.castGI=!1,h.castShadow=!1,this._debugMr.push(h),this.object3D.addChild(d),this._volume.calcPosition(o,l,c,n),d.x=n.x,d.y=n.y,d.z=n.z,this._probes[f]=d,this._debugMr.push(h)}for(let o=0;o<this._probes.length;o++)J.instance.addGIProbe(e,this._probes[o]);this.object3D.transform.enable=!1,this._volume.setting.debug&&this.debug()}debug(){}debugProbeRay(e,t){const a=m.setting.gi.rayNumber;let r=new j(0,-.7071067811865475,.7071067811865475,0);for(let i=0;i<a;i++){let n=e*a+i,o=new u(-t[n*4+0],-t[n*4+1],-t[n*4+2],0);r.transformVector(o,o);let l=t[n*4+3],c=this._probes[e].transform.worldPosition.clone(),f=o.scaleBy(l);f.add(c,f)}}changeProbesVolumeData(){this._volume.setVolumeDataChange()}changeProbesPosition(){this._volume.setVolumeDataChange();let e=this._volume.setting.probeXCount,t=this._volume.setting.probeYCount,a=this._volume.setting.probeZCount,r=new u;for(let i=0;i<e;i++)for(let n=0;n<t;n++)for(let o=0;o<a;o++){let l=i+o*e+n*(e*a),c=this._probes[l];this._volume.calcPosition(i,n,o,r),c.x=r.x,c.y=r.y,c.z=r.z}}onUpdate(){m.setting.gi.maxDistance=m.setting.gi.probeSpace*1.5;let e=this.transform.scene3D.view.camera,t=u.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 Na{_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($,e,!0);for(let t=0;t<e.length;t++){const a=e[t];a.transform.updateWorldMatrix(!0),a.enable=!1;let r=a.geometry.instanceID;for(let i=0;i<a.materials.length;i++){const n=a.materials[i];r+=n.instanceID}if(this._keyRenderGroup.has(r))this._keyRenderGroup.get(r).push(a),this._keyIdsGroup.get(r).push(a.transform.worldMatrix.index);else{let i=new ve(e.length);i.visibility=GPUShaderStage.VERTEX,this._keyRenderGroup.set(r,[a]),this._keyBufferGroup.set(r,i),this._keyIdsGroup.set(r,[a.transform.worldMatrix.index])}}this._keyBufferGroup.forEach((t,a)=>{let r=this._keyIdsGroup.get(a),i=this._keyBufferGroup.get(a);i.setInt32Array("matrixIDs",new Int32Array(r)),i.apply()})}reset(){this._keyRenderGroup.size>0&&(this._keyRenderGroup.clear(),this._keyBufferGroup.clear(),this._keyIdsGroup.clear(),this.start())}nodeUpdate(e,t,a,r){this._keyRenderGroup.forEach((i,n)=>{let o=this._keyBufferGroup.get(n),l=i[0];for(let c=0;c<l.materials.length;c++){let d=l.materials[c].getPass(t);if(d)for(let h=0;h<d.length;h++){const b=d[h];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 n=r[0];n.instanceCount=r.length,this.renderItem(e,t,n,a)})}renderItem(e,t,a,r){let i=a.transform._worldMatrix;for(let n=0;n<a.materials.length;n++){let l=a.materials[n].getPass(t);if(!(!l||l.length==0))for(let c=0;c<l.length;c++){let f=l[c];y.bindGeometryBuffer(r.encoder,a.geometry);const d=f;d.shaderState.splitTexture&&(r.endRenderPass(),vt.WriteSplitColorTexture(a.instanceID),r.beginOpaqueRenderPass(),y.bindCamera(r.encoder,e.camera),y.bindGeometryBuffer(r.encoder,a.geometry)),y.bindPipeline(r.encoder,d);let g=a.geometry.subGeometries[n].lodLevels[a.lodLevel];a.instanceCount>0?y.drawIndexed(r.encoder,g.indexCount,a.instanceCount,g.indexStart,0,0):y.drawIndexed(r.encoder,g.indexCount,1,g.indexStart,0,i.index)}}}beforeDestroy(e){this._keyRenderGroup.clear(),this._keyBufferGroup.clear(),this._keyIdsGroup.clear(),this._keyRenderGroup=this._keyBufferGroup=this._keyIdsGroup=void 0,xe.removeWaitStart(this.object3D,this)}}var mg=Object.getOwnPropertyDescriptor,Ag=(s,e,t,a)=>{for(var r=a>1?void 0:a?mg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ws=class extends ${constructor(){super()}get geometry(){return null}set geometry(s){}cloneTo(s){}set meshURL(s){let e=m.res.getGeometry(s);e?this.geometry=e:console.error("no geometry set",s)}};ws=Ag([Vt(ws,"MeshFilter")],ws);var Dg=Object.getOwnPropertyDescriptor,_g=(s,e,t,a)=>{for(var r=a>1?void 0:a?Dg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Vi=class extends ${skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Be.SkinnedMesh)}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(nr),!this.skeletonAnimation){let s=this.object3D.parentObject.parentObject.getComponentsInChild(nr);s.length>0&&(this.skeletonAnimation=s[0]);let e=this.object3D;for(;!this.skeletonAnimation&&e;)this.skeletonAnimation=e.getComponentFromParent(nr),e.parent&&(e=e.parent.object3D)}}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(s){if(this.mSkeletonAnimation=s,!!s&&!this.mJointIndexTableBuffer){let e=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new ve(e.length*4,0,new Float32Array(e)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(s){this.mInverseBindMatrixData=s;var e=new Float32Array(s.length*16);for(let t=0;t<s.length;t++){let a=t*16,r=s[t];e.set(r,a)}this.mInverseBindMatrixBuffer=new ve(e.byteLength,0,e),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(s){let e=s.addComponent(Vi);e.geometry=this.geometry,e.material=this.material.clone(),e.castShadow=this.castShadow,e.castGI=this.castGI,e.receiveShadow=this.receiveShadow,e.rendererMask=this.rendererMask,e.skinJointsName=this.skinJointsName,e.skinInverseBindMatrices=this.skinInverseBindMatrices,e.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(s,e,t,a){for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++){const l=n[o];!l.pipeline&&this.mSkeletonAnimation&&(l.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),l.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),l.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(s,e,t,a)}};Vi=_g([Vt(Vi,"SkinnedMeshRenderer")],Vi);class Bg extends qe{radius=2.5;height=10;constructor(){super(),this._shapeType=oi.Capsule}}class qs extends qe{mesh;static triangle;_pickRet;constructor(){super(),this._shapeType=oi.Mesh}rayPick(e,t){if(this.mesh){qs.triangle||=new ts(new u,new u,new u);let a=this.mesh.getAttribute(V.position),r=this.mesh.getAttribute(V.indices),i=qe.helpMatrix;i.copyFrom(t).invert();let n=qe.helpRay.copy(e);if(n.applyMatrix(i),n.intersectBox(this.mesh.bounds),!n.intersectBox(this.mesh.bounds,qe.v3_help_0))return null;if(r&&a&&r.data.length>0){let l=a.data;for(let c=0,f=r.data.length/3;c<f;c++){let d=c*3;const h=r.data[d+0]*3,b=r.data[d+1]*3,p=r.data[d+2]*3;let g=qs.triangle,A=g.v1.set(l[h+0],l[h+1],l[h+2]),D=g.v2.set(l[b+0],l[b+1],l[b+2]),_=g.v3.set(l[p+0],l[p+1],l[p+2]);g.set(A,D,_);let U=n.intersectTriangle(n.origin,n.direction,g);if(U){this._pickRet||={intersectPoint:new u,distance:0},this._pickRet.intersectPoint=U,this._pickRet.distance=u.distance(n.origin,U);let v=this.mesh.getAttribute(V.normal);if(v){let x=v.data,C=new u(x[h],x[h+1],x[h+2]);t.transformVector(C,C),C.normalize(),this._pickRet.normal=C}return this._pickRet}}}}return null}}class vg extends qe{_pickRet;box;radius=.5;constructor(e){super(),this._shapeType=oi.Sphere,this.radius=e,this.box=new Mr(new u,1)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.radius);let r=qe.helpMatrix;r.copyFrom(t).invert();let i=qe.helpRay.copy(e);i.applyMatrix(r);let n=i.intersectSphere(i.origin,i.direction,this.box.center,this.box.radius);return n?(this._pickRet||(this._pickRet={intersect:!1,intersectPoint:new u,distance:0}),this._pickRet.intersect=!0,this._pickRet.intersectPoint=n,this._pickRet.distance=u.distance(i.origin,qe.v3_help_0),this._pickRet):null}}class Ug extends ee{_envMap;skyObject;envMapChange=!0;view;constructor(){super(),this.transform.scene3D=this,this.skyObject=new ee,this.addChild(this.skyObject),this._isScene3D=!0,this.envMap||=m.res.defaultSky}get envMap(){return this._envMap}set envMap(e){this._envMap!=e&&(this.envMapChange=!0),this._envMap=e,J.instance.sky&&"map"in J.instance.sky&&(J.instance.sky.map=e)}get exposure(){return J.instance.sky&&"exposure"in J.instance.sky?J.instance.sky.exposure:0}set exposure(e){J.instance.sky&&"exposure"in J.instance.sky&&(J.instance.sky.exposure=e,m.setting.sky.skyExposure=e)}get roughness(){if(J.instance.sky&&"roughness"in J.instance.sky)return J.instance.sky.roughness}set roughness(e){J.instance.sky&&"roughness"in J.instance.sky&&(J.instance.sky.roughness=e)}}class lh{_computeShader;_outBuffer;constructor(){}init(){let e=ne.getGBufferFrame(ne.colorPass_GBuffer);this._computeShader=new fe(ld),this._outBuffer=new ti(32),this._computeShader.setStorageBuffer("outBuffer",this._outBuffer),this._computeShader.setSamplerTexture("gBufferTexture",e.getCompressGBufferTexture())}compute(e){let t=oe.getCameraGroup(e.camera);this._computeShader.setStorageBuffer("globalUniform",t.uniformGPUBuffer);let a=y.beginCommandEncoder();y.computeCommand(a,[this._computeShader]),y.endCommandEncoder(a),this._outBuffer.readBuffer()}getPickMeshID(){var e=this._outBuffer.outFloat32Array[0]+.1;return Math.floor(e)}getPickWorldPosition(e){e||=new u;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 u;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 K;var t=this._outBuffer.outFloat32Array[2],a=this._outBuffer.outFloat32Array[3];return e.set(t,a),e}}class ch extends Ra{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 ea,this.mouseEnableMap=new Map,this._pickEvent=new O(O.PICK_CLICK),this._outEvent=new O(O.PICK_OUT),this._overEvent=new O(O.PICK_OVER),this._mouseMove=new O(O.PICK_MOVE),this._upEvent=new O(O.PICK_UP),this._downEvent=new O(O.PICK_DOWN)}start(){m.setting.pick.enable&&(m.inputSystem.addEventListener(O.POINTER_DOWN,this.onTouchStart,this),m.inputSystem.addEventListener(O.POINTER_UP,this.onTouchEnd,this),m.inputSystem.addEventListener(O.POINTER_CLICK,this.onTouchOnce,this),m.inputSystem.addEventListener(O.POINTER_RIGHT_CLICK,this.onTouchOnce,this),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onTouchMove,this)),m.setting.pick.mode=="pixel"&&(this._pickCompute=new lh,this._pickCompute.init())}stop(){m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onTouchStart,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onTouchEnd,this),m.inputSystem.removeEventListener(O.POINTER_CLICK,this.onTouchOnce,this),m.inputSystem.removeEventListener(O.POINTER_RIGHT_CLICK,this.onTouchOnce,this),m.inputSystem.removeEventListener(O.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=O.PICK_DOWN,this._downEvent.target=t.object3D,this._downEvent.data=this.getPickInfo(),this.dispatchEvent(this._downEvent),t.object3D.containEventListener(O.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=O.PICK_UP,this._upEvent.target=t.object3D,this._upEvent.data=this.getPickInfo(),this.dispatchEvent(this._upEvent),t.object3D.containEventListener(O.PICK_UP)&&t.object3D.dispatchEvent(this._upEvent))}_lastFocus;getPickInfo(){if(m.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=O.PICK_MOVE,this._mouseMove.target=t.object3D,this._mouseMove.data=this.getPickInfo(),this.dispatchEvent(this._mouseMove),t.object3D.containEventListener(O.PICK_MOVE)&&t.object3D.dispatchEvent(this._mouseMove)),t!=this._lastFocus&&(this._lastFocus&&this._lastFocus.object3D&&(Object.assign(this._outEvent,e),this._outEvent.type=O.PICK_OUT,this._outEvent.target=this._lastFocus.object3D,this._outEvent.data=this.getPickInfo(),this.dispatchEvent(this._outEvent),this._lastFocus.object3D.containEventListener(O.PICK_OUT)&&this._lastFocus.object3D.dispatchEvent(this._outEvent)),t&&(Object.assign(this._overEvent,e),this._overEvent.type=O.PICK_OVER,this._overEvent.target=t.object3D,this._overEvent.data=this.getPickInfo(),this.dispatchEvent(this._overEvent),t.object3D.containEventListener(O.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=O.PICK_CLICK,this._pickEvent.target=t.object3D,this._pickEvent.data=a,this.dispatchEvent(this._pickEvent),t===this._lastDownTarget&&t.object3D.containEventListener(O.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,m.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=u.distance(r,this.ray.origin);this._interestList.push({distance:i,collider:a,intersectPoint:r})}}else if(m.setting.pick.mode=="bound"){this.ray=e.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY);let t,a=xe.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 xg extends hs{_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 te(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 ch(this),this.pickFire.start()),this._enablePick=e}get scene(){return this._scene}set scene(e){this._scene=e,e.view=this,It.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 ee;a.name="Canvas "+e,t=a.addComponent($i),t.index=e,this.canvasList[e]=t}return this.scene.addChild(t.object3D),this.guiPick||(this.guiPick=new Hd,this.guiPick.init(this)),t}disableUICanvas(e=0){let t=this.canvasList[e];t&&t.object3D&&t.object3D.removeFromParent()}}class yg{normal;fixNormal;center;rotateShape;distance=0;index;constructor(e){this.index=e,this.rotateShape=[]}}class Cg extends Ee{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 ge(u.ZERO.clone(),new u(100,100,100)),this}buildSections(e,t){let a,r,i,n=[],o=t.length;for(let c=0;c<o;c++){let f=new yg(c);a=t[c],r=t[c+1],f.center=a.clone(),r==null?(f.normal=i.clone(),f.distance=0):(i=r.subtract(a),f.distance=i.length,f.normal=i.normalize()),n.push(f)}n[0].fixNormal=n[0].normal.clone();for(let c=1;c<o;c++){let f=n[c-1],d=n[c];d.fixNormal=d.normal.add(f.normal).normalize()}let l=new E().identity();for(let c=0;c<o;c++){let f=n[c],d,h;if(c==0)d=u.UP,h=e;else{let b=n[c-1];d=b.fixNormal,h=b.rotateShape}E.fromToRotation(d,f.fixNormal,l);for(let b=0,p=e.length;b<p;b++){let g=l.multiplyPoint3(h[b]);f.rotateShape.push(g)}}return n}buildGeometry(e,t){let a=t.length,r=e.length,i=a*r,n=a-1,o=new Float32Array(i*3),l=new Float32Array(i*3),c=new Float32Array(i*2),f=new Uint32Array(n*(r-1)*6),d=r-1,h=0,b=0,p=[0];for(let A=1;A<r;A++)b+=e[A-1].subtract(e[A]).length,p.push(b);for(let A=0;A<a;A++){let D=t[A];for(let _=0;_<r;_++){let U=(A*r+_)*3,v=D.rotateShape[_].add(D.center);o[U]=v.x,o[U+1]=v.y,o[U+2]=v.z,l[U+1]=1;let x=(A*r+_)*2,C=p[_]/b;c[x]=this.uNegate?1-C:C,c[x+1]=h*this.vScale}h+=D.distance}let g=0;for(let A=0;A<n;A++){let D=A*r;for(let _=0;_<d;_++){let U=_,v=_+1,x=U+r,C=v+r;f[g++]=U+D,f[g++]=v+D,f[g++]=x+D,f[g++]=v+D,f[g++]=C+D,f[g++]=x+D}}return this.setIndices(f),this.setAttribute(V.position,o),this.setAttribute(V.normal,l),this.setAttribute(V.uv,c),this.setAttribute(V.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.computeNormals(),this}}class Sg extends Ee{_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(V.position,e),this.setAttribute(V.uv,t),this.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:e.length/3,firstStart:0,index:0,topology:0})}setPositions(e){const t=e instanceof Float32Array?e:new Float32Array(e),r=t.length/3-1;if(r<=0)return console.warn("FatLineGeometry: Need at least 2 points"),this;const i=new Float32Array(r*16);for(let n=0;n<r;n++){const o=n*3,l=(n+1)*3;i[n*16+0]=t[o+0],i[n*16+1]=t[o+1],i[n*16+2]=t[o+2],i[n*16+3]=0,i[n*16+4]=t[l+0],i[n*16+5]=t[l+1],i[n*16+6]=t[l+2],i[n*16+7]=0,i[n*16+8]=1,i[n*16+9]=1,i[n*16+10]=1,i[n*16+11]=0,i[n*16+12]=1,i[n*16+13]=1,i[n*16+14]=1,i[n*16+15]=0}return this._instanceData=i,this._instanceCount=r,this.computeBoundingBox(t),this}setColors(e){const t=e instanceof Float32Array?e:new Float32Array(e);if(!this._instanceData)return console.warn("FatLineGeometry: Must call setPositions() before setColors()"),this;const r=t.length/3-1;if(r!==this._instanceCount)return console.warn("FatLineGeometry: Color array length doesn't match segment count"),this;for(let i=0;i<r;i++){const n=i*3,o=(i+1)*3;this._instanceData[i*16+8]=t[n+0],this._instanceData[i*16+9]=t[n+1],this._instanceData[i*16+10]=t[n+2],this._instanceData[i*16+12]=t[o+0],this._instanceData[i*16+13]=t[o+1],this._instanceData[i*16+14]=t[o+2]}return this}computeBoundingBox(e){const t=new u(1/0,1/0,1/0),a=new u(-1/0,-1/0,-1/0);for(let i=0;i<e.length;i+=3){const n=e[i],o=e[i+1],l=e[i+2];t.x=Math.min(t.x,n),t.y=Math.min(t.y,o),t.z=Math.min(t.z,l),a.x=Math.max(a.x,n),a.y=Math.max(a.y,o),a.z=Math.max(a.z,l)}const r=u.sub(a,t);this.bounds=new ge(u.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 ve(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 fh=(s=>(s[s.position=3]="position",s[s.normal=3]="normal",s[s.TANGENT=4]="TANGENT",s[s.uv=2]="uv",s[s.TEXCOORD_1=2]="TEXCOORD_1",s[s.color=4]="color",s[s.joints0=4]="joints0",s[s.weights0=4]="weights0",s[s.joints1=4]="joints1",s[s.weights1=4]="weights1",s[s.vIndex=1]="vIndex",s[s.weight=1]="weight",s[s.a_morphPositions_0=3]="a_morphPositions_0",s))(fh||{});class Eg{get data(){return null}entity}class dh{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 hh{_spaceDesc;getRange(e){return this._spaceDesc[e]}initSpace(e){this._spaceDesc={};for(let t of e)(this._spaceDesc[t]=new dh).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 as{static MaxEntityCountInLeaf=4;static MaxLayer=10;static ClearLeafLayer=as.MaxLayer-4}class rs{static UUID=0;uuid="0";constructor(){this.uuid=(rs.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 br extends rs{_dimensionIndex=0;_dimensions;_dimension;_left;_right;_space;_parent;_entities;layer;get dimension(){return this._dimension}constructor(e=0){super(),this.layer=e,br.nodeCount++}initNode(e,t,a){return this._dimensions=t,this._dimensionIndex=a,this._dimension=t[a],this._space=new hh().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>as.MaxEntityCountInLeaf&&!this._right&&!this._left&&this.layer<as.MaxLayer){let e=this._splitEntityList,t=(this._dimensionIndex+1)%this._dimensions.length,a=this._dimensions[t],r=0;for(const i in this._entities.map){let n=this._entities.map[i];r+=n.centerValue(a),e.push(n)}r/=this._entities.count,this._left=new br(this.layer+1),this._right=new br(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>as.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,br.nodeCount-=2),e||t}isContain(e){return this._space.isContain(this._dimension,e)}static rangeBox=new ge(new u(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),new u(-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=br.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=br.rangeBox;return i.min.set(t.min,a.min,r.min),i.max.set(t.max,a.max,r.max),!0}pointCast(e,t=0,a){if(a=a||[],this._entities.count>0){let r=this._entities.map;for(let i in r){let n=r[i],o=n.entityContainPoint(e);!o&&t>0&&(o=n.squareDistanceTo(e,this._dimensions)<=t),o&&a.push(n)}}this._left&&this._left.isContain(e[this._left.dimension])&&this._left.pointCast(e,t,a),this._right&&this._right.isContain(e[this._right.dimension])&&this._right.pointCast(e,t,a)}boxCast(e,t){if(t=t||[],this._entities.count>0){let a=this._entities.map;for(let r in a){let i=a[r];i.entityIntersectsBox(e)&&t.push(i)}}this._left&&this._left.nodeIntersectsBox(e)&&this._left.boxCast(e,t),this._right&&this._right.nodeIntersectsBox(e)&&this._right.boxCast(e,t)}pointIntersect=new u;rayCast(e,t,a){t=t||[],a=a||[];let r=this.pointIntersect;if(this._entities.count>0){let i=this._entities.map;for(let n in i){let o=i[n];o.entityIntersectsRay(e,r)&&(a.push(new u().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 rs{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 Ut{minPosX=0;minPosY=0;maxPosX=0;maxPosY=0;testID=0;points;offsetPosition;static TINY=1e-6;constructor(){this.points=new Array,this.offsetPosition=new u(0,0,0,0),this.clear()}setAABox(e,t,a,r){this.minPosX=e-a/2-Ut.TINY,this.maxPosX=e+a/2+Ut.TINY,this.minPosY=t-r/2-Ut.TINY,this.maxPosY=t+r/2+Ut.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-Ut.TINY),e.x>this.maxPosX&&(this.maxPosX=e.x+Ut.TINY),e.z<this.minPosY&&(this.minPosY=e.z-Ut.TINY),e.z>this.maxPosY&&(this.maxPosY=e.z+Ut.TINY),this.points.push(e))}clone(){var e=new Ut;return e.minPosX=this.minPosX,e.minPosY=this.minPosY,e.maxPosX=this.maxPosX,e.maxPosY=this.maxPosY,e}get radius(){return Math.sqrt((this.maxPosY-this.minPosY)*(this.maxPosY-this.minPosY)+(this.maxPosX-this.minPosX)*(this.maxPosX-this.minPosX))}get sideX(){return this.maxPosX-this.minPosX}get sideY(){return this.maxPosY-this.minPosY}get centreX(){return(this.maxPosX-this.minPosX)*.5+this.minPosX}get centreY(){return(this.maxPosY-this.minPosY)*.5+this.minPosY}overlapTest(e){return!(this.minPosY>=e.maxPosY||this.maxPosY<=e.minPosY||this.minPosX>=e.maxPosX||this.maxPosX<=e.minPosX)}isPointInside(e){return e.x>=this.minPosX&&e.x<=this.maxPosX&&e.z>=this.minPosY&&e.z<=this.maxPosY}isIntersectLineSegment(e,t,a,r){var i=!1,n=t-r,o=a-e,l=e*r-a*t,c=(-l-n*this.minPosX)/o;c<=this.maxPosY&&c>=this.minPosY&&(i=!0),c=(-l-n*this.maxPosX)/o,c<=this.maxPosY&&c>=this.minPosY&&(i=!0);var f=(-l-o*this.minPosY)/n;return f<=this.maxPosX&&f>=this.minPosX&&(i=!0),f=(-l-o*this.maxPosY)/n,f<=this.maxPosX&&f>=this.minPosX&&(i=!0),i}}class Ar{static NUM_CHILDREN=4;childCellIndices;nodeIndices;aabb;points;constructor(e){this.childCellIndices=new Array,this.childCellIndices.length=Ar.NUM_CHILDREN,this.nodeIndices=new Array,this.clear(),e?this.aabb=e.clone():this.aabb=new Ut}isLeaf(){return this.childCellIndices[0]==-1}clear(){for(var e=0;e<Ar.NUM_CHILDREN;e++)this.childCellIndices[e]=-1;this.nodeIndices.splice(0,this.nodeIndices.length)}}class uh{_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 Ut}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 Ar(this._aabb),this._cells.push(this._rootCell);for(var i=this._quadNodes.length,n=0;n<i;n++)this._cells[0].nodeIndices[n]=n;var o=new Array;o.push(0);for(var l,c,f;o.length!=0;)if(c=o.pop(),!(this._cells[c].nodeIndices.length<=e||this._cells[c].aabb.radius<t)){for(n=0;n<Ar.NUM_CHILDREN;n++){this._cells[c].childCellIndices[n]=this._cells.length,o.push(this._cells.length),this._cells.push(new Ar(this.createAABox(this._cells[c].aabb,n))),f=this._cells[this._cells.length-1],i=this._cells[c].nodeIndices.length;for(var d=0;d<i;d++)l=this._cells[c].nodeIndices[d],this.doesNodeIntersectCell(this._quadNodes[l],f)&&f.nodeIndices.push(l)}this._cells[c].nodeIndices.length=0}}createAABox(e,t){var a=e.centreX,r=e.centreY,i=e.sideX,n=e.sideY,o=new Ut;switch(t){case 0:o.setAABox(a+i/4,r+n/4,i/2,n/2);break;case 1:o.setAABox(a-i/4,r+n/4,i/2,n/2);break;case 2:o.setAABox(a-i/4,r-n/4,i/2,n/2);break;case 3:o.setAABox(a+i/4,r-n/4,i/2,n/2);break;default:o.setAABox(a+i/4,r-n/4,i/2,n/2);break}return o}doesNodeIntersectCell(e,t){var a=e.aabb;if(!a.overlapTest(t.aabb))return!1;if(!e.isTriangle)return!0;var r=a.points,i=r[0],n=r[1],o=r[2];if(t.aabb.isPointInside(i)||t.aabb.isPointInside(n)||t.aabb.isPointInside(o))return!0;var l=this.pointInTriangle(t.aabb.minPosX,t.aabb.minPosY,i,n,o)||this.pointInTriangle(t.aabb.minPosX,t.aabb.maxPosY,i,n,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.maxPosY,i,n,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.minPosY,i,n,o);return l?!0:(l=t.aabb.isIntersectLineSegment(i.x,i.z,n.x,n.z)||t.aabb.isIntersectLineSegment(i.x,i.z,o.x,o.z)||t.aabb.isIntersectLineSegment(n.x,n.z,o.x,o.z),l)}getNodesIntersectingtAABox(e,t){if(this._cells.length==0)return 0;this._cellsToTest.length=0,this._cellsToTest.push(0),this.incrementTestCounter();for(var a,r,i,n,o=0;this._cellsToTest.length!=0;)if(a=this._cellsToTest.pop(),i=this._cells[a],!!t.overlapTest(i.aabb))if(i.isLeaf())for(r=i.nodeIndices.length,o=0;o<r;o++)n=this.getQuadNode(i.nodeIndices[o]).aabb,n.testID!=this._testID&&(n.testID=this._testID,t.overlapTest(n)&&e.push(i.nodeIndices[o]));else for(o=0;o<Ar.NUM_CHILDREN;o++)this._cellsToTest.push(i.childCellIndices[o]);return e.length}pointInTriangle(e,t,a,r,i){var n=a,o=r,l=i,c=n.z-o.z,f=o.x-n.x,d=n.x*o.z-o.x*n.z,h=o.z-l.z,b=l.x-o.x,p=o.x*l.z-l.x*o.z,g=l.z-n.z,A=n.x-l.x,D=l.x*n.z-n.x*l.z,_=!1,U=c*e+f*t+d,v=h*e+b*t+p,x=g*e+A*t+D;const C=.01;return(U>=-C&&v>=-C&&x>=-C||U<=C&&v<=C&&x<=C)&&(_=!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 n=this._quadNodes[t.nodeIndices[i]];console.log(a+" t="+t.nodeIndices[i]+" "+n.aabb.minPosX.toFixed(2)+" "+n.aabb.maxPosX.toFixed(2)+" "+n.aabb.minPosY.toFixed(2)+" "+n.aabb.maxPosY.toFixed(2))}for(i=0;i<t.childCellIndices.length;i++)t.childCellIndices[i]>=0&&this.logTree(t.childCellIndices[i]);this.logDeep--}}}class bh{_maxNodesPerCell;_minCellSize;_quadTree;_collisionNodesIdx;_segBox;_collisionNodes;constructor(e=10,t=500){this._maxNodesPerCell=e,this._minCellSize=t,this._segBox=new Ut,this._collisionNodesIdx=new Array,this._collisionNodes=new Array}createQuadTree(e){this._quadTree=new uh,this._quadTree.initNodes(e),this._quadTree.buildQuadTree(this._maxNodesPerCell,this._minCellSize)}getNodesByAABB(e,t,a,r){this._segBox.clear(),this._segBox.maxPosX=a,this._segBox.maxPosY=r,this._segBox.minPosX=e,this._segBox.minPosY=t,this._collisionNodesIdx.length=0,this._collisionNodes.length=0,this._quadTree.getNodesIntersectingtAABox(this._collisionNodesIdx,this._segBox);for(var i,n=0;n<this._collisionNodesIdx.length;n++)i=this._quadTree.getQuadNode(this._collisionNodesIdx[n]),this._collisionNodes.push(i);return this._collisionNodes}getTriangleAtPoint(e,t=5){this._segBox.clear(),this._segBox.setAABox(e.x,e.z,1,1),this._collisionNodesIdx.length=0,this._collisionNodes.length=0,this._quadTree.getNodesIntersectingtAABox(this._collisionNodesIdx,this._segBox);for(var a=4294967295,r=0,i,n,o,l,c=0;c<this._collisionNodesIdx.length;c++)n=this._quadTree.getQuadNode(this._collisionNodesIdx[c]),l=n.aabb,u.pointInsideTriangle(e,l.points[0],l.points[1],l.points[2])&&(o=n,r=Math.abs(o.plane.distance(e)),!(r>t)&&(n==null||r<=a)&&(i=o,a=r));return i}}var Rs=(s=>(s[s.MOUSE_LEFT=0]="MOUSE_LEFT",s[s.MOUSE_MID=1]="MOUSE_MID",s[s.MOUSE_RIGHT=2]="MOUSE_RIGHT",s))(Rs||{});class Ig extends $e{static LOADER_PROGRESS="loaderProgress";static LOADER_COMPLETE="loaderComplete"}class Qg extends $e{static ADDED="added";static REMOVED="removed";static CHILD_ADD_EVENT="childAddEvent";static CHILD_REMOVED="childRemoved"}class Tg extends $e{static SHOW="show";static HIDE="hide";static UPDATE="update"}class Mg{static merge(e,t,a,r){let i=0,n=0;i=Math.max(e.width,i),i=Math.max(t.width,i),i=Math.max(a.width,i),i=Math.max(r.width,i),n=Math.max(e.height,n),n=Math.max(t.height,n),n=Math.max(a.height,n),n=Math.max(r.height,n);let o=new Ae(i,n,Y.rgba8unorm),l=new fe(id);l.setSamplerTexture("textureR",e),l.setSamplerTexture("textureG",t),l.setSamplerTexture("textureB",a),l.setSamplerTexture("textureA",r),l.setStorageTexture("outTex",o),l.workerSizeX=Math.ceil(i/8),l.workerSizeY=Math.ceil(n/8);let c=y.beginCommandEncoder();return y.computeCommand(c,[l]),y.endCommandEncoder(c),o}}class gh{computeShader;setInputes(e,t,a){this.computeShader=new fe(_d(e,t,a,8,8,1));for(let r=0;r<t.length;r++)this.computeShader.setSamplerTexture(`source${r}Map`,t[r]);for(let r=0;r<a.length;r++)this.computeShader.setStorageTexture(`dest${r}Map`,a[r]);e&&this.computeShader.setSamplerTexture("colorMap",e),this.computeShader.workerSizeX=a[0].width/8,this.computeShader.workerSizeY=a[0].height/8,this.computeShader.workerSizeZ=1}}class ph{sourceShader;compute;needUpdate=!0;constructor(e,t){this.sourceShader=t,this.compute=new fe(e),this.init()}init(){}onUpdate(){this.onFrame&&this.onFrame(),this.onOnce&&this.needUpdate&&(this.needUpdate=!1,this.onFrame())}}class mh extends ph{constructor(e){super(cd,e)}init(){let e=new Ae(256,256,Y.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=y.beginCommandEncoder();y.computeCommand(e,[this.compute]),y.endCommandEncoder(e)}}class Ng{gpuBuffer;probes;memoryDo;_probeInfoList;initDataUniform(e){this.memoryDo=new Ka,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=k.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;)k.device.queue.writeBuffer(this.gpuBuffer,a,e,a,Math.floor(Math.min(r,t-a))),a+=r}}class Vg extends Qa{constructor(e,t,a=0){super(),this.bufferType=aa.StructStorageGPUBuffer,this.createBufferByStruct(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|a,e,t)}}class Pg{static codeMax=`
|
|
11663
|
+
`||S==" "?C=null:(U(S,C),C.width+b>=p&&(C=_()))}})(),v()}getAlignment(e){let t={v:0,h:0};switch(e){case 1:t.v=0,t.h=1;break;case 0:t.v=0,t.h=0;break;case 2:t.v=0,t.h=2;break;case 4:t.v=1,t.h=1;break;case 3:t.v=1,t.h=0;break;case 5:t.v=1,t.h=2;break;case 7:t.v=2,t.h=1;break;case 6:t.v=2,t.h=0;break;case 8:t.v=2,t.h=2;break}return t}}class Ks extends So{_style=Le.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 $d.rayPick(e,a,r,t.space,t.panelRatio,this._uiTransform,t.transform.worldMatrix)}cloneTo(e){e.getOrAddComponent(Ks).copyComponent(this)}copyComponent(e){return super.copyComponent(e),this.enable=e._enable,this.interactive=e._interactive,this.mouseStyle=e._style,this}}var sh=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=1]="COLOR",s[s.SPRITE=2]="SPRITE",s))(sh||{});class Yo extends Ks{_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(Vr),this._isCreateImage=this._image==null,this._image||(this._image=this.object3D.addComponent(Vr)),this.imageType=ni.Sliced}onEnable(){this.mouseStyle=Le.NORMAL}onDisable(){this.mouseStyle=Le.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(Le.NORMAL)}set normalSprite(e){this._spriteMap.set(Le.NORMAL,e),this._style==Le.NORMAL&&this.validateStyle(this._style,!0)}get overSprite(){return this._spriteMap.get(Le.OVER)}set overSprite(e){this._spriteMap.set(Le.OVER,e),this._style==Le.OVER&&this.validateStyle(this._style,!0)}set downSprite(e){this._spriteMap.set(Le.DOWN,e),this._style==Le.DOWN&&this.validateStyle(this._style,!0)}get downSprite(){return this._spriteMap.get(Le.DOWN)}set disableSprite(e){this._spriteMap.set(Le.DISABLE,e),this._style==Le.DISABLE&&this.validateStyle(this._style,!0)}get disableSprite(){return this._spriteMap.get(Le.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(Vr),this._image=null),super.destroy()}}class Xo extends Mi{_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(wa.spawnQuad());this._uiTransform.resize(0,0)}getQuad(e){return this._mainQuads[e]}cloneTo(e){e.addComponent(Xo,{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||m.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 K;let a=this._mainQuads[e];return t.x=a.x,t.y=a.y,t}}class Ho extends Mi{_shadowQuality=1;_shadowOffset;_shadowRadius;_shadowColor;_subShadowColor;needUpdateShadow=!1;init(e){super.init?.(e),this._shadowRadius=2,this._shadowQuality=1,this._shadowOffset=new K(4,-4),this._shadowColor=new P(.1,.1,.1,.8),this._subShadowColor=this._shadowColor.clone(),this.isUIShadow=!0}cloneTo(e){e.getOrAddComponent(Ho).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=se(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 K(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=wa.spawnQuad(),n=0,o=0;if(r==0)i.color=this._shadowColor;else{let l=a*(r-1)/(t-1);n=Math.sin(l)*this._shadowRadius,o=Math.cos(l)*this._shadowRadius,i.color=this._subShadowColor}i.setXY(n+this._shadowOffset.x+e.x,o+this._shadowOffset.y+e.y),i.setSize(e.width,e.height),i.sprite=e.sprite,i.visible=e.visible,i.imageType=e.imageType,this.attachQuad(i)}}}class Ko extends Mi{_font="\u5FAE\u8F6F\u96C5\u9ED1";_fontSize=14;_originSize=42;_alignment=0;_lineSpacing=1;_text="";_color=new P(1,1,1,1);constructor(){super()}cloneTo(e){e.getOrAddComponent(Ko).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 ih;layoutText(){this.detachQuads(),this.textLine=this.layoutProxy.layout(this);for(let e=0,t=this.textLine.length;e<t;e++){let a=this.textLine[e];for(let r=0,i=a.quadList.length;r<i;r++){let n=a.quadList[r];n&&this.attachQuad(n)}}this.color=this._color,this._uiTransform.setNeedUpdateUIPanel(),this.onUIComponentVisible(this._visible),this.setShadowDirty()}onUIComponentVisible(e){this.applyComponentVisible()}onUITransformVisible(e){this.applyComponentVisible()}applyComponentVisible(){let e=!this._visible||!this._uiTransform.globalVisible;for(let t of this._mainQuads)t&&(t.visible=!e);this.setShadowDirty()}onTransformResize(){this.layoutText()}get color(){return this._color}set color(e){this._color.copyFrom(e);for(let t of this._mainQuads)t.color=e;this.setShadowDirty()}get alignment(){return this._alignment}set alignment(e){this._alignment!=e&&(this._alignment=e,this.layoutText())}get lineSpacing(){return this._lineSpacing}set lineSpacing(e){this._lineSpacing!=e&&(this._lineSpacing=e,this.layoutText())}}var dg=Object.getOwnPropertyDescriptor,hg=(s,e,t,a)=>{for(var r=a>1?void 0:a?dg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Es=class extends xi{constructor(){super()}init(){super.init(),this.lightData.lightType=Xe.PointLight,this.object3D.name==""&&(this.object3D.name="PointLight"+Et())}get range(){return this.lightData.range}set range(s){this.lightData.range=s,this.onChange()}get at(){return this.lightData.linear}set at(s){this.lightData.linear=s,this.onChange()}get radius(){return this.lightData.radius}set radius(s){this.lightData.radius=s,this.onChange()}get quadratic(){return this.lightData.quadratic}set quadratic(s){this.lightData.quadratic=s,this.onChange()}start(){this.transform.rotationX=90,super.start()}onUpdate(){}onGraphic(s){let e=s.scene.getChildByName("graphic3D");if(!e)return;let t=e.createCustomShape(`PointLight_${this.object3D.instanceID}`,this.transform);t.buildAxis(),t.buildCircle(u.ZERO,this.range,32,u.X_AXIS),t.buildCircle(u.ZERO,this.range,32,u.Y_AXIS),t.buildCircle(u.ZERO,this.range,32,u.Z_AXIS)}debug(){}debugDraw(s){}};Es=hg([Vt(Es,"Light")],Es);var ug=Object.getOwnPropertyDescriptor,bg=(s,e,t,a)=>{for(var r=a>1?void 0:a?ug(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ni=class extends Na{_fatLineMaterial=null;_fatLineGeometry=null;_cachedResolution=new K(0,0);constructor(){super()}onEnable(){super.onEnable()}onDisable(){super.onDisable()}cloneTo(s){s.addComponent(Ni).copyComponent(this)}copyComponent(s){return super.copyComponent(s),this}set geometry(s){super.geometry=s,this._fatLineGeometry=s,s&&(this.instanceCount=s.instanceCount,this._fatLineMaterial&&s.instanceBuffer&&this._fatLineMaterial.setInstanceBuffer(s.instanceBuffer))}get geometry(){return this._fatLineGeometry}set material(s){this.materials=[s],this._fatLineMaterial=s,this._fatLineGeometry&&this._fatLineGeometry.instanceBuffer&&s.setInstanceBuffer(this._fatLineGeometry.instanceBuffer)}get material(){return this._fatLineMaterial}nodeUpdate(s,e,t,a){if(this._fatLineMaterial&&this.object3D){this._fatLineMaterial.setModelMatrix(this.object3D.transform.worldMatrix);const r=k.presentationSize[0],i=k.presentationSize[1];r>0&&i>0&&(this._cachedResolution.x!==r||this._cachedResolution.y!==i)&&(this._cachedResolution.set(r,i),this._fatLineMaterial.resolution=this._cachedResolution.clone())}super.nodeUpdate(s,e,t,a)}destroy(s){super.destroy(s)}};Ni=bg([Vt(Ni,"FatLineRenderer")],Ni);class nh extends ee{index=0;drawCallFrame=-1;constructor(){super()}}var Fo=(s=>(s[s.CastGI=0]="CastGI",s[s.ReceiveGI=1]="ReceiveGI",s[s.CastDepth=2]="CastDepth",s[s.Other=3]="Other",s))(Fo||{});class oh extends mt{static count=0;constructor(e=0,t=0){super(),z.register("GIProbeShader",yd);let a=new ot,r=new Ve("GIProbeShader","GIProbeShader");r.passType=H.COLOR,a.addRenderPass(r),r.setDefine("USE_BRDF",!0),r.setShaderEntry("VertMain","FragMain"),r.setUniformVector4("probeUniform",new te(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",m.res.whiteTexture),a.setTexture("normalMap",m.res.normalTexture),a.setTexture("emissiveMap",m.res.blackTexture),this.shader=a}}class gg extends Pe{_probes;_volume;_debugMr=[];init(e){e||=m.views[0]?.scene,m.setting.gi.enable=!0,this._volume=oe.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 Rr(4,16,16),n=new u;this._probes=[];for(let o=0;o<t;o++)for(let l=0;l<a;l++)for(let c=0;c<r;c++){let f=o+c*t+l*(t*r),d=new nh;d.index=f,d.name=`${o}_${l}_${c}`;let h=d.addComponent($);h.material=new oh(Fo.CastGI,f),h.geometry=i,h.castGI=!1,h.castShadow=!1,this._debugMr.push(h),this.object3D.addChild(d),this._volume.calcPosition(o,l,c,n),d.x=n.x,d.y=n.y,d.z=n.z,this._probes[f]=d,this._debugMr.push(h)}for(let o=0;o<this._probes.length;o++)J.instance.addGIProbe(e,this._probes[o]);this.object3D.transform.enable=!1,this._volume.setting.debug&&this.debug()}debug(){}debugProbeRay(e,t){const a=m.setting.gi.rayNumber;let r=new j(0,-.7071067811865475,.7071067811865475,0);for(let i=0;i<a;i++){let n=e*a+i,o=new u(-t[n*4+0],-t[n*4+1],-t[n*4+2],0);r.transformVector(o,o);let l=t[n*4+3],c=this._probes[e].transform.worldPosition.clone(),f=o.scaleBy(l);f.add(c,f)}}changeProbesVolumeData(){this._volume.setVolumeDataChange()}changeProbesPosition(){this._volume.setVolumeDataChange();let e=this._volume.setting.probeXCount,t=this._volume.setting.probeYCount,a=this._volume.setting.probeZCount,r=new u;for(let i=0;i<e;i++)for(let n=0;n<t;n++)for(let o=0;o<a;o++){let l=i+o*e+n*(e*a),c=this._probes[l];this._volume.calcPosition(i,n,o,r),c.x=r.x,c.y=r.y,c.z=r.z}}onUpdate(){m.setting.gi.maxDistance=m.setting.gi.probeSpace*1.5;let e=this.transform.scene3D.view.camera,t=u.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 Na{_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($,e,!0);for(let t=0;t<e.length;t++){const a=e[t];a.transform.updateWorldMatrix(!0),a.enable=!1;let r=a.geometry.instanceID;for(let i=0;i<a.materials.length;i++){const n=a.materials[i];r+=n.instanceID}if(this._keyRenderGroup.has(r))this._keyRenderGroup.get(r).push(a),this._keyIdsGroup.get(r).push(a.transform.worldMatrix.index);else{let i=new ve(e.length);i.visibility=GPUShaderStage.VERTEX,this._keyRenderGroup.set(r,[a]),this._keyBufferGroup.set(r,i),this._keyIdsGroup.set(r,[a.transform.worldMatrix.index])}}this._keyBufferGroup.forEach((t,a)=>{let r=this._keyIdsGroup.get(a),i=this._keyBufferGroup.get(a);i.setInt32Array("matrixIDs",new Int32Array(r)),i.apply()})}reset(){this._keyRenderGroup.size>0&&(this._keyRenderGroup.clear(),this._keyBufferGroup.clear(),this._keyIdsGroup.clear(),this.start())}nodeUpdate(e,t,a,r){this._keyRenderGroup.forEach((i,n)=>{let o=this._keyBufferGroup.get(n),l=i[0];for(let c=0;c<l.materials.length;c++){let d=l.materials[c].getPass(t);if(d)for(let h=0;h<d.length;h++){const b=d[h];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 n=r[0];n.instanceCount=r.length,this.renderItem(e,t,n,a)})}renderItem(e,t,a,r){let i=a.transform._worldMatrix;for(let n=0;n<a.materials.length;n++){let l=a.materials[n].getPass(t);if(!(!l||l.length==0))for(let c=0;c<l.length;c++){let f=l[c];y.bindGeometryBuffer(r.encoder,a.geometry);const d=f;d.shaderState.splitTexture&&(r.endRenderPass(),vt.WriteSplitColorTexture(a.instanceID),r.beginOpaqueRenderPass(),y.bindCamera(r.encoder,e.camera),y.bindGeometryBuffer(r.encoder,a.geometry)),y.bindPipeline(r.encoder,d);let g=a.geometry.subGeometries[n].lodLevels[a.lodLevel];a.instanceCount>0?y.drawIndexed(r.encoder,g.indexCount,a.instanceCount,g.indexStart,0,0):y.drawIndexed(r.encoder,g.indexCount,1,g.indexStart,0,i.index)}}}beforeDestroy(e){this._keyRenderGroup.clear(),this._keyBufferGroup.clear(),this._keyIdsGroup.clear(),this._keyRenderGroup=this._keyBufferGroup=this._keyIdsGroup=void 0,xe.removeWaitStart(this.object3D,this)}}var mg=Object.getOwnPropertyDescriptor,Ag=(s,e,t,a)=>{for(var r=a>1?void 0:a?mg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let ws=class extends ${constructor(){super()}get geometry(){return null}set geometry(s){}cloneTo(s){}set meshURL(s){let e=m.res.getGeometry(s);e?this.geometry=e:console.error("no geometry set",s)}};ws=Ag([Vt(ws,"MeshFilter")],ws);var Dg=Object.getOwnPropertyDescriptor,_g=(s,e,t,a)=>{for(var r=a>1?void 0:a?Dg(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Vi=class extends ${skinJointsName;mInverseBindMatrixData;mInverseBindMatrixBuffer;mSkeletonAnimation;mJointIndexTableBuffer;constructor(){super(),this.addRendererMask(Be.SkinnedMesh)}start(){if(super.start(),this.skeletonAnimation=this.object3D.getComponent(nr),!this.skeletonAnimation){let s=this.object3D.parentObject.parentObject.getComponentsInChild(nr);s.length>0&&(this.skeletonAnimation=s[0]);let e=this.object3D;for(;!this.skeletonAnimation&&e;)this.skeletonAnimation=e.getComponentFromParent(nr),e.parent&&(e=e.parent.object3D)}}onEnable(){super.onEnable()}get skeletonAnimation(){return this.mSkeletonAnimation}set skeletonAnimation(s){if(this.mSkeletonAnimation=s,!!s&&!this.mJointIndexTableBuffer){let e=this.mSkeletonAnimation.getJointIndexTable(this.skinJointsName);this.mJointIndexTableBuffer=new ve(e.length*4,0,new Float32Array(e)),this.mJointIndexTableBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}}get skinInverseBindMatrices(){return this.mInverseBindMatrixData}set skinInverseBindMatrices(s){this.mInverseBindMatrixData=s;var e=new Float32Array(s.length*16);for(let t=0;t<s.length;t++){let a=t*16,r=s[t];e.set(r,a)}this.mInverseBindMatrixBuffer=new ve(e.byteLength,0,e),this.mInverseBindMatrixBuffer.visibility=GPUShaderStage.VERTEX|GPUShaderStage.COMPUTE}get inverseBindMatrixBuffer(){return this.mInverseBindMatrixBuffer}get jointIndexTableBuffer(){return this.mJointIndexTableBuffer.buffer}cloneTo(s){let e=s.addComponent(Vi);e.geometry=this.geometry,e.material=this.material.clone(),e.castShadow=this.castShadow,e.castGI=this.castGI,e.receiveShadow=this.receiveShadow,e.rendererMask=this.rendererMask,e.skinJointsName=this.skinJointsName,e.skinInverseBindMatrices=this.skinInverseBindMatrices,e.mJointIndexTableBuffer=this.mJointIndexTableBuffer}nodeUpdate(s,e,t,a){for(let r=0;r<this.materials.length;r++){let n=this.materials[r].getPass(e);if(n)for(let o=0;o<n.length;o++){const l=n[o];!l.pipeline&&this.mSkeletonAnimation&&(l.setStorageBuffer("jointsMatrixIndexTable",this.mSkeletonAnimation.jointMatrixIndexTableBuffer),l.setStorageBuffer("jointsInverseMatrix",this.mInverseBindMatrixBuffer),l.setStorageBuffer("jointsIndexMapingTable",this.mJointIndexTableBuffer))}}super.nodeUpdate(s,e,t,a)}};Vi=_g([Vt(Vi,"SkinnedMeshRenderer")],Vi);class Bg extends qe{radius=2.5;height=10;constructor(){super(),this._shapeType=oi.Capsule}}class qs extends qe{mesh;static triangle;_pickRet;constructor(){super(),this._shapeType=oi.Mesh}rayPick(e,t){if(this.mesh){qs.triangle||=new ts(new u,new u,new u);let a=this.mesh.getAttribute(V.position),r=this.mesh.getAttribute(V.indices),i=qe.helpMatrix;i.copyFrom(t).invert();let n=qe.helpRay.copy(e);if(n.applyMatrix(i),n.intersectBox(this.mesh.bounds),!n.intersectBox(this.mesh.bounds,qe.v3_help_0))return null;if(r&&a&&r.data.length>0){let l=a.data;for(let c=0,f=r.data.length/3;c<f;c++){let d=c*3;const h=r.data[d+0]*3,b=r.data[d+1]*3,p=r.data[d+2]*3;let g=qs.triangle,A=g.v1.set(l[h+0],l[h+1],l[h+2]),D=g.v2.set(l[b+0],l[b+1],l[b+2]),_=g.v3.set(l[p+0],l[p+1],l[p+2]);g.set(A,D,_);let U=n.intersectTriangle(n.origin,n.direction,g);if(U){this._pickRet||={intersectPoint:new u,distance:0},this._pickRet.intersectPoint=U,this._pickRet.distance=u.distance(n.origin,U);let v=this.mesh.getAttribute(V.normal);if(v){let x=v.data,C=new u(x[h],x[h+1],x[h+2]);t.transformVector(C,C),C.normalize(),this._pickRet.normal=C}return this._pickRet}}}}return null}}class vg extends qe{_pickRet;box;radius=.5;constructor(e){super(),this._shapeType=oi.Sphere,this.radius=e,this.box=new Mr(new u,1)}rayPick(e,t){this.box.setFromCenterAndSize(this.center,this.radius);let r=qe.helpMatrix;r.copyFrom(t).invert();let i=qe.helpRay.copy(e);i.applyMatrix(r);let n=i.intersectSphere(i.origin,i.direction,this.box.center,this.box.radius);return n?(this._pickRet||(this._pickRet={intersect:!1,intersectPoint:new u,distance:0}),this._pickRet.intersect=!0,this._pickRet.intersectPoint=n,this._pickRet.distance=u.distance(i.origin,qe.v3_help_0),this._pickRet):null}}class Ug extends ee{_envMap;skyObject;envMapChange=!0;view;constructor(){super(),this.transform.scene3D=this,this.skyObject=new ee,this.addChild(this.skyObject),this._isScene3D=!0,this.envMap||=m.res.defaultSky}get envMap(){return this._envMap}set envMap(e){this._envMap!=e&&(this.envMapChange=!0),this._envMap=e,J.instance.sky&&"map"in J.instance.sky&&(J.instance.sky.map=e)}get exposure(){return J.instance.sky&&"exposure"in J.instance.sky?J.instance.sky.exposure:0}set exposure(e){J.instance.sky&&"exposure"in J.instance.sky&&(J.instance.sky.exposure=e,m.setting.sky.skyExposure=e)}get roughness(){if(J.instance.sky&&"roughness"in J.instance.sky)return J.instance.sky.roughness}set roughness(e){J.instance.sky&&"roughness"in J.instance.sky&&(J.instance.sky.roughness=e)}}class lh{_computeShader;_outBuffer;constructor(){}init(){let e=ne.getGBufferFrame(ne.colorPass_GBuffer);this._computeShader=new fe(ld),this._outBuffer=new ti(32),this._computeShader.setStorageBuffer("outBuffer",this._outBuffer),this._computeShader.setSamplerTexture("gBufferTexture",e.getCompressGBufferTexture())}compute(e){let t=oe.getCameraGroup(e.camera);this._computeShader.setStorageBuffer("globalUniform",t.uniformGPUBuffer);let a=y.beginCommandEncoder();y.computeCommand(a,[this._computeShader]),y.endCommandEncoder(a),this._outBuffer.readBuffer()}getPickMeshID(){var e=this._outBuffer.outFloat32Array[0]+.1;return Math.floor(e)}getPickWorldPosition(e){e||=new u;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 u;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 K;var t=this._outBuffer.outFloat32Array[2],a=this._outBuffer.outFloat32Array[3];return e.set(t,a),e}}class ch extends Ra{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 ea,this.mouseEnableMap=new Map,this._pickEvent=new O(O.PICK_CLICK),this._outEvent=new O(O.PICK_OUT),this._overEvent=new O(O.PICK_OVER),this._mouseMove=new O(O.PICK_MOVE),this._upEvent=new O(O.PICK_UP),this._downEvent=new O(O.PICK_DOWN)}start(){m.setting.pick.enable&&(m.inputSystem.addEventListener(O.POINTER_DOWN,this.onTouchStart,this),m.inputSystem.addEventListener(O.POINTER_UP,this.onTouchEnd,this),m.inputSystem.addEventListener(O.POINTER_CLICK,this.onTouchOnce,this),m.inputSystem.addEventListener(O.POINTER_RIGHT_CLICK,this.onTouchOnce,this),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onTouchMove,this)),m.setting.pick.mode=="pixel"&&(this._pickCompute=new lh,this._pickCompute.init())}stop(){m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onTouchStart,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onTouchEnd,this),m.inputSystem.removeEventListener(O.POINTER_CLICK,this.onTouchOnce,this),m.inputSystem.removeEventListener(O.POINTER_RIGHT_CLICK,this.onTouchOnce,this),m.inputSystem.removeEventListener(O.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=O.PICK_DOWN,this._downEvent.target=t.object3D,this._downEvent.data=this.getPickInfo(),this.dispatchEvent(this._downEvent),t.object3D.containEventListener(O.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=O.PICK_UP,this._upEvent.target=t.object3D,this._upEvent.data=this.getPickInfo(),this.dispatchEvent(this._upEvent),t.object3D.containEventListener(O.PICK_UP)&&t.object3D.dispatchEvent(this._upEvent))}_lastFocus;getPickInfo(){if(m.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=O.PICK_MOVE,this._mouseMove.target=t.object3D,this._mouseMove.data=this.getPickInfo(),this.dispatchEvent(this._mouseMove),t.object3D.containEventListener(O.PICK_MOVE)&&t.object3D.dispatchEvent(this._mouseMove)),t!=this._lastFocus&&(this._lastFocus&&this._lastFocus.object3D&&(Object.assign(this._outEvent,e),this._outEvent.type=O.PICK_OUT,this._outEvent.target=this._lastFocus.object3D,this._outEvent.data=this.getPickInfo(),this.dispatchEvent(this._outEvent),this._lastFocus.object3D.containEventListener(O.PICK_OUT)&&this._lastFocus.object3D.dispatchEvent(this._outEvent)),t&&(Object.assign(this._overEvent,e),this._overEvent.type=O.PICK_OVER,this._overEvent.target=t.object3D,this._overEvent.data=this.getPickInfo(),this.dispatchEvent(this._overEvent),t.object3D.containEventListener(O.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=O.PICK_CLICK,this._pickEvent.target=t.object3D,this._pickEvent.data=a,this.dispatchEvent(this._pickEvent),t===this._lastDownTarget&&t.object3D.containEventListener(O.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,m.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=u.distance(r,this.ray.origin);this._interestList.push({distance:i,collider:a,intersectPoint:r})}}else if(m.setting.pick.mode=="bound"){this.ray=e.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY);let t,a=xe.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 xg extends hs{_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 te(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 ch(this),this.pickFire.start()),this._enablePick=e}get scene(){return this._scene}set scene(e){this._scene=e,e.view=this,It.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 ee;a.name="Canvas "+e,t=a.addComponent($i),t.index=e,this.canvasList[e]=t}return this.scene.addChild(t.object3D),this.guiPick||(this.guiPick=new Hd,this.guiPick.init(this)),t}disableUICanvas(e=0){let t=this.canvasList[e];t&&t.object3D&&t.object3D.removeFromParent()}}class yg{normal;fixNormal;center;rotateShape;distance=0;index;constructor(e){this.index=e,this.rotateShape=[]}}class Cg extends Ee{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 pe(u.ZERO.clone(),new u(100,100,100)),this}buildSections(e,t){let a,r,i,n=[],o=t.length;for(let c=0;c<o;c++){let f=new yg(c);a=t[c],r=t[c+1],f.center=a.clone(),r==null?(f.normal=i.clone(),f.distance=0):(i=r.subtract(a),f.distance=i.length,f.normal=i.normalize()),n.push(f)}n[0].fixNormal=n[0].normal.clone();for(let c=1;c<o;c++){let f=n[c-1],d=n[c];d.fixNormal=d.normal.add(f.normal).normalize()}let l=new E().identity();for(let c=0;c<o;c++){let f=n[c],d,h;if(c==0)d=u.UP,h=e;else{let b=n[c-1];d=b.fixNormal,h=b.rotateShape}E.fromToRotation(d,f.fixNormal,l);for(let b=0,p=e.length;b<p;b++){let g=l.multiplyPoint3(h[b]);f.rotateShape.push(g)}}return n}buildGeometry(e,t){let a=t.length,r=e.length,i=a*r,n=a-1,o=new Float32Array(i*3),l=new Float32Array(i*3),c=new Float32Array(i*2),f=new Uint32Array(n*(r-1)*6),d=r-1,h=0,b=0,p=[0];for(let A=1;A<r;A++)b+=e[A-1].subtract(e[A]).length,p.push(b);for(let A=0;A<a;A++){let D=t[A];for(let _=0;_<r;_++){let U=(A*r+_)*3,v=D.rotateShape[_].add(D.center);o[U]=v.x,o[U+1]=v.y,o[U+2]=v.z,l[U+1]=1;let x=(A*r+_)*2,C=p[_]/b;c[x]=this.uNegate?1-C:C,c[x+1]=h*this.vScale}h+=D.distance}let g=0;for(let A=0;A<n;A++){let D=A*r;for(let _=0;_<d;_++){let U=_,v=_+1,x=U+r,C=v+r;f[g++]=U+D,f[g++]=v+D,f[g++]=x+D,f[g++]=v+D,f[g++]=C+D,f[g++]=x+D}}return this.setIndices(f),this.setAttribute(V.position,o),this.setAttribute(V.normal,l),this.setAttribute(V.uv,c),this.setAttribute(V.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.computeNormals(),this}}class Sg extends Ee{_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(V.position,e),this.setAttribute(V.uv,t),this.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:e.length/3,firstStart:0,index:0,topology:0})}setPositions(e){const t=e instanceof Float32Array?e:new Float32Array(e),r=t.length/3-1;if(r<=0)return console.warn("FatLineGeometry: Need at least 2 points"),this;const i=new Float32Array(r*16);for(let n=0;n<r;n++){const o=n*3,l=(n+1)*3;i[n*16+0]=t[o+0],i[n*16+1]=t[o+1],i[n*16+2]=t[o+2],i[n*16+3]=0,i[n*16+4]=t[l+0],i[n*16+5]=t[l+1],i[n*16+6]=t[l+2],i[n*16+7]=0,i[n*16+8]=1,i[n*16+9]=1,i[n*16+10]=1,i[n*16+11]=0,i[n*16+12]=1,i[n*16+13]=1,i[n*16+14]=1,i[n*16+15]=0}return this._instanceData=i,this._instanceCount=r,this.computeBoundingBox(t),this}setColors(e){const t=e instanceof Float32Array?e:new Float32Array(e);if(!this._instanceData)return console.warn("FatLineGeometry: Must call setPositions() before setColors()"),this;const r=t.length/3-1;if(r!==this._instanceCount)return console.warn("FatLineGeometry: Color array length doesn't match segment count"),this;for(let i=0;i<r;i++){const n=i*3,o=(i+1)*3;this._instanceData[i*16+8]=t[n+0],this._instanceData[i*16+9]=t[n+1],this._instanceData[i*16+10]=t[n+2],this._instanceData[i*16+12]=t[o+0],this._instanceData[i*16+13]=t[o+1],this._instanceData[i*16+14]=t[o+2]}return this}computeBoundingBox(e){const t=new u(1/0,1/0,1/0),a=new u(-1/0,-1/0,-1/0);for(let i=0;i<e.length;i+=3){const n=e[i],o=e[i+1],l=e[i+2];t.x=Math.min(t.x,n),t.y=Math.min(t.y,o),t.z=Math.min(t.z,l),a.x=Math.max(a.x,n),a.y=Math.max(a.y,o),a.z=Math.max(a.z,l)}const r=u.sub(a,t);this.bounds=new pe(u.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 ve(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 fh=(s=>(s[s.position=3]="position",s[s.normal=3]="normal",s[s.TANGENT=4]="TANGENT",s[s.uv=2]="uv",s[s.TEXCOORD_1=2]="TEXCOORD_1",s[s.color=4]="color",s[s.joints0=4]="joints0",s[s.weights0=4]="weights0",s[s.joints1=4]="joints1",s[s.weights1=4]="weights1",s[s.vIndex=1]="vIndex",s[s.weight=1]="weight",s[s.a_morphPositions_0=3]="a_morphPositions_0",s))(fh||{});class Eg{get data(){return null}entity}class dh{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 hh{_spaceDesc;getRange(e){return this._spaceDesc[e]}initSpace(e){this._spaceDesc={};for(let t of e)(this._spaceDesc[t]=new dh).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 as{static MaxEntityCountInLeaf=4;static MaxLayer=10;static ClearLeafLayer=as.MaxLayer-4}class rs{static UUID=0;uuid="0";constructor(){this.uuid=(rs.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 br extends rs{_dimensionIndex=0;_dimensions;_dimension;_left;_right;_space;_parent;_entities;layer;get dimension(){return this._dimension}constructor(e=0){super(),this.layer=e,br.nodeCount++}initNode(e,t,a){return this._dimensions=t,this._dimensionIndex=a,this._dimension=t[a],this._space=new hh().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>as.MaxEntityCountInLeaf&&!this._right&&!this._left&&this.layer<as.MaxLayer){let e=this._splitEntityList,t=(this._dimensionIndex+1)%this._dimensions.length,a=this._dimensions[t],r=0;for(const i in this._entities.map){let n=this._entities.map[i];r+=n.centerValue(a),e.push(n)}r/=this._entities.count,this._left=new br(this.layer+1),this._right=new br(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>as.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,br.nodeCount-=2),e||t}isContain(e){return this._space.isContain(this._dimension,e)}static rangeBox=new pe(new u(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),new u(-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=br.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=br.rangeBox;return i.min.set(t.min,a.min,r.min),i.max.set(t.max,a.max,r.max),!0}pointCast(e,t=0,a){if(a=a||[],this._entities.count>0){let r=this._entities.map;for(let i in r){let n=r[i],o=n.entityContainPoint(e);!o&&t>0&&(o=n.squareDistanceTo(e,this._dimensions)<=t),o&&a.push(n)}}this._left&&this._left.isContain(e[this._left.dimension])&&this._left.pointCast(e,t,a),this._right&&this._right.isContain(e[this._right.dimension])&&this._right.pointCast(e,t,a)}boxCast(e,t){if(t=t||[],this._entities.count>0){let a=this._entities.map;for(let r in a){let i=a[r];i.entityIntersectsBox(e)&&t.push(i)}}this._left&&this._left.nodeIntersectsBox(e)&&this._left.boxCast(e,t),this._right&&this._right.nodeIntersectsBox(e)&&this._right.boxCast(e,t)}pointIntersect=new u;rayCast(e,t,a){t=t||[],a=a||[];let r=this.pointIntersect;if(this._entities.count>0){let i=this._entities.map;for(let n in i){let o=i[n];o.entityIntersectsRay(e,r)&&(a.push(new u().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 rs{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 Ut{minPosX=0;minPosY=0;maxPosX=0;maxPosY=0;testID=0;points;offsetPosition;static TINY=1e-6;constructor(){this.points=new Array,this.offsetPosition=new u(0,0,0,0),this.clear()}setAABox(e,t,a,r){this.minPosX=e-a/2-Ut.TINY,this.maxPosX=e+a/2+Ut.TINY,this.minPosY=t-r/2-Ut.TINY,this.maxPosY=t+r/2+Ut.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-Ut.TINY),e.x>this.maxPosX&&(this.maxPosX=e.x+Ut.TINY),e.z<this.minPosY&&(this.minPosY=e.z-Ut.TINY),e.z>this.maxPosY&&(this.maxPosY=e.z+Ut.TINY),this.points.push(e))}clone(){var e=new Ut;return e.minPosX=this.minPosX,e.minPosY=this.minPosY,e.maxPosX=this.maxPosX,e.maxPosY=this.maxPosY,e}get radius(){return Math.sqrt((this.maxPosY-this.minPosY)*(this.maxPosY-this.minPosY)+(this.maxPosX-this.minPosX)*(this.maxPosX-this.minPosX))}get sideX(){return this.maxPosX-this.minPosX}get sideY(){return this.maxPosY-this.minPosY}get centreX(){return(this.maxPosX-this.minPosX)*.5+this.minPosX}get centreY(){return(this.maxPosY-this.minPosY)*.5+this.minPosY}overlapTest(e){return!(this.minPosY>=e.maxPosY||this.maxPosY<=e.minPosY||this.minPosX>=e.maxPosX||this.maxPosX<=e.minPosX)}isPointInside(e){return e.x>=this.minPosX&&e.x<=this.maxPosX&&e.z>=this.minPosY&&e.z<=this.maxPosY}isIntersectLineSegment(e,t,a,r){var i=!1,n=t-r,o=a-e,l=e*r-a*t,c=(-l-n*this.minPosX)/o;c<=this.maxPosY&&c>=this.minPosY&&(i=!0),c=(-l-n*this.maxPosX)/o,c<=this.maxPosY&&c>=this.minPosY&&(i=!0);var f=(-l-o*this.minPosY)/n;return f<=this.maxPosX&&f>=this.minPosX&&(i=!0),f=(-l-o*this.maxPosY)/n,f<=this.maxPosX&&f>=this.minPosX&&(i=!0),i}}class Ar{static NUM_CHILDREN=4;childCellIndices;nodeIndices;aabb;points;constructor(e){this.childCellIndices=new Array,this.childCellIndices.length=Ar.NUM_CHILDREN,this.nodeIndices=new Array,this.clear(),e?this.aabb=e.clone():this.aabb=new Ut}isLeaf(){return this.childCellIndices[0]==-1}clear(){for(var e=0;e<Ar.NUM_CHILDREN;e++)this.childCellIndices[e]=-1;this.nodeIndices.splice(0,this.nodeIndices.length)}}class uh{_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 Ut}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 Ar(this._aabb),this._cells.push(this._rootCell);for(var i=this._quadNodes.length,n=0;n<i;n++)this._cells[0].nodeIndices[n]=n;var o=new Array;o.push(0);for(var l,c,f;o.length!=0;)if(c=o.pop(),!(this._cells[c].nodeIndices.length<=e||this._cells[c].aabb.radius<t)){for(n=0;n<Ar.NUM_CHILDREN;n++){this._cells[c].childCellIndices[n]=this._cells.length,o.push(this._cells.length),this._cells.push(new Ar(this.createAABox(this._cells[c].aabb,n))),f=this._cells[this._cells.length-1],i=this._cells[c].nodeIndices.length;for(var d=0;d<i;d++)l=this._cells[c].nodeIndices[d],this.doesNodeIntersectCell(this._quadNodes[l],f)&&f.nodeIndices.push(l)}this._cells[c].nodeIndices.length=0}}createAABox(e,t){var a=e.centreX,r=e.centreY,i=e.sideX,n=e.sideY,o=new Ut;switch(t){case 0:o.setAABox(a+i/4,r+n/4,i/2,n/2);break;case 1:o.setAABox(a-i/4,r+n/4,i/2,n/2);break;case 2:o.setAABox(a-i/4,r-n/4,i/2,n/2);break;case 3:o.setAABox(a+i/4,r-n/4,i/2,n/2);break;default:o.setAABox(a+i/4,r-n/4,i/2,n/2);break}return o}doesNodeIntersectCell(e,t){var a=e.aabb;if(!a.overlapTest(t.aabb))return!1;if(!e.isTriangle)return!0;var r=a.points,i=r[0],n=r[1],o=r[2];if(t.aabb.isPointInside(i)||t.aabb.isPointInside(n)||t.aabb.isPointInside(o))return!0;var l=this.pointInTriangle(t.aabb.minPosX,t.aabb.minPosY,i,n,o)||this.pointInTriangle(t.aabb.minPosX,t.aabb.maxPosY,i,n,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.maxPosY,i,n,o)||this.pointInTriangle(t.aabb.maxPosX,t.aabb.minPosY,i,n,o);return l?!0:(l=t.aabb.isIntersectLineSegment(i.x,i.z,n.x,n.z)||t.aabb.isIntersectLineSegment(i.x,i.z,o.x,o.z)||t.aabb.isIntersectLineSegment(n.x,n.z,o.x,o.z),l)}getNodesIntersectingtAABox(e,t){if(this._cells.length==0)return 0;this._cellsToTest.length=0,this._cellsToTest.push(0),this.incrementTestCounter();for(var a,r,i,n,o=0;this._cellsToTest.length!=0;)if(a=this._cellsToTest.pop(),i=this._cells[a],!!t.overlapTest(i.aabb))if(i.isLeaf())for(r=i.nodeIndices.length,o=0;o<r;o++)n=this.getQuadNode(i.nodeIndices[o]).aabb,n.testID!=this._testID&&(n.testID=this._testID,t.overlapTest(n)&&e.push(i.nodeIndices[o]));else for(o=0;o<Ar.NUM_CHILDREN;o++)this._cellsToTest.push(i.childCellIndices[o]);return e.length}pointInTriangle(e,t,a,r,i){var n=a,o=r,l=i,c=n.z-o.z,f=o.x-n.x,d=n.x*o.z-o.x*n.z,h=o.z-l.z,b=l.x-o.x,p=o.x*l.z-l.x*o.z,g=l.z-n.z,A=n.x-l.x,D=l.x*n.z-n.x*l.z,_=!1,U=c*e+f*t+d,v=h*e+b*t+p,x=g*e+A*t+D;const C=.01;return(U>=-C&&v>=-C&&x>=-C||U<=C&&v<=C&&x<=C)&&(_=!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 n=this._quadNodes[t.nodeIndices[i]];console.log(a+" t="+t.nodeIndices[i]+" "+n.aabb.minPosX.toFixed(2)+" "+n.aabb.maxPosX.toFixed(2)+" "+n.aabb.minPosY.toFixed(2)+" "+n.aabb.maxPosY.toFixed(2))}for(i=0;i<t.childCellIndices.length;i++)t.childCellIndices[i]>=0&&this.logTree(t.childCellIndices[i]);this.logDeep--}}}class bh{_maxNodesPerCell;_minCellSize;_quadTree;_collisionNodesIdx;_segBox;_collisionNodes;constructor(e=10,t=500){this._maxNodesPerCell=e,this._minCellSize=t,this._segBox=new Ut,this._collisionNodesIdx=new Array,this._collisionNodes=new Array}createQuadTree(e){this._quadTree=new uh,this._quadTree.initNodes(e),this._quadTree.buildQuadTree(this._maxNodesPerCell,this._minCellSize)}getNodesByAABB(e,t,a,r){this._segBox.clear(),this._segBox.maxPosX=a,this._segBox.maxPosY=r,this._segBox.minPosX=e,this._segBox.minPosY=t,this._collisionNodesIdx.length=0,this._collisionNodes.length=0,this._quadTree.getNodesIntersectingtAABox(this._collisionNodesIdx,this._segBox);for(var i,n=0;n<this._collisionNodesIdx.length;n++)i=this._quadTree.getQuadNode(this._collisionNodesIdx[n]),this._collisionNodes.push(i);return this._collisionNodes}getTriangleAtPoint(e,t=5){this._segBox.clear(),this._segBox.setAABox(e.x,e.z,1,1),this._collisionNodesIdx.length=0,this._collisionNodes.length=0,this._quadTree.getNodesIntersectingtAABox(this._collisionNodesIdx,this._segBox);for(var a=4294967295,r=0,i,n,o,l,c=0;c<this._collisionNodesIdx.length;c++)n=this._quadTree.getQuadNode(this._collisionNodesIdx[c]),l=n.aabb,u.pointInsideTriangle(e,l.points[0],l.points[1],l.points[2])&&(o=n,r=Math.abs(o.plane.distance(e)),!(r>t)&&(n==null||r<=a)&&(i=o,a=r));return i}}var Rs=(s=>(s[s.MOUSE_LEFT=0]="MOUSE_LEFT",s[s.MOUSE_MID=1]="MOUSE_MID",s[s.MOUSE_RIGHT=2]="MOUSE_RIGHT",s))(Rs||{});class Ig extends $e{static LOADER_PROGRESS="loaderProgress";static LOADER_COMPLETE="loaderComplete"}class Qg extends $e{static ADDED="added";static REMOVED="removed";static CHILD_ADD_EVENT="childAddEvent";static CHILD_REMOVED="childRemoved"}class Tg extends $e{static SHOW="show";static HIDE="hide";static UPDATE="update"}class Mg{static merge(e,t,a,r){let i=0,n=0;i=Math.max(e.width,i),i=Math.max(t.width,i),i=Math.max(a.width,i),i=Math.max(r.width,i),n=Math.max(e.height,n),n=Math.max(t.height,n),n=Math.max(a.height,n),n=Math.max(r.height,n);let o=new Ae(i,n,Y.rgba8unorm),l=new fe(id);l.setSamplerTexture("textureR",e),l.setSamplerTexture("textureG",t),l.setSamplerTexture("textureB",a),l.setSamplerTexture("textureA",r),l.setStorageTexture("outTex",o),l.workerSizeX=Math.ceil(i/8),l.workerSizeY=Math.ceil(n/8);let c=y.beginCommandEncoder();return y.computeCommand(c,[l]),y.endCommandEncoder(c),o}}class gh{computeShader;setInputes(e,t,a){this.computeShader=new fe(_d(e,t,a,8,8,1));for(let r=0;r<t.length;r++)this.computeShader.setSamplerTexture(`source${r}Map`,t[r]);for(let r=0;r<a.length;r++)this.computeShader.setStorageTexture(`dest${r}Map`,a[r]);e&&this.computeShader.setSamplerTexture("colorMap",e),this.computeShader.workerSizeX=a[0].width/8,this.computeShader.workerSizeY=a[0].height/8,this.computeShader.workerSizeZ=1}}class ph{sourceShader;compute;needUpdate=!0;constructor(e,t){this.sourceShader=t,this.compute=new fe(e),this.init()}init(){}onUpdate(){this.onFrame&&this.onFrame(),this.onOnce&&this.needUpdate&&(this.needUpdate=!1,this.onFrame())}}class mh extends ph{constructor(e){super(cd,e)}init(){let e=new Ae(256,256,Y.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=y.beginCommandEncoder();y.computeCommand(e,[this.compute]),y.endCommandEncoder(e)}}class Ng{gpuBuffer;probes;memoryDo;_probeInfoList;initDataUniform(e){this.memoryDo=new Ka,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=k.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;)k.device.queue.writeBuffer(this.gpuBuffer,a,e,a,Math.floor(Math.min(r,t-a))),a+=r}}class Vg extends Qa{constructor(e,t,a=0){super(),this.bufferType=aa.StructStorageGPUBuffer,this.createBufferByStruct(GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|a,e,t)}}class Pg{static codeMax=`
|
|
11664
11664
|
@group(0) @binding(0) var inputTexture : texture_2d<f32>;
|
|
11665
11665
|
@group(0) @binding(1) var inputTextureSampler : sampler;
|
|
11666
11666
|
@group(0) @binding(2) var outputTexture : texture_storage_2d<rgba8unorm, write>;
|
|
@@ -11687,5 +11687,5 @@ fn frag(){
|
|
|
11687
11687
|
textureStore(outputTexture, dstCoord, fromColor);
|
|
11688
11688
|
}
|
|
11689
11689
|
`;static _pipelineMax;static _pipelineMin;static createMipmap(e,t){const a=k.device;this._pipelineMax||=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:this.codeMax}),entryPoint:"main"}}),this._pipelineMin||=a.createComputePipeline({layout:"auto",compute:{module:a.createShaderModule({code:this.codeMin}),entryPoint:"main"}});let r=Math.ceil(e.width*.5),i=Math.ceil(e.height*.5),n={mipmapCount:t,texture:e,srcView:null,mipLevel:1,dstHeight:i,dstWidth:r};n.srcView=e.getGPUTexture().createView({format:e.format,dimension:"2d",baseMipLevel:0,mipLevelCount:1}),e.width>1024&&e.height>1024?this.mipmap(this._pipelineMax,n):this.mipmap(this._pipelineMin,n)}static mipmap(e,t){const a=k.device,r=y.beginCommandEncoder();let i=e==this._pipelineMax,n,o;for(let l=t.mipLevel;l<t.mipmapCount;l++){let c=[],f=0;c.push({binding:f++,resource:t.srcView}),c.push({binding:f++,resource:t.texture.gpuSampler}),n=t.texture.getGPUTexture().createView({format:t.texture.format,dimension:"2d",baseMipLevel:l,mipLevelCount:1}),c.push({binding:f++,resource:n});const d=a.createBindGroup({layout:e.getBindGroupLayout(0),entries:c}),h=r.beginComputePass();h.setPipeline(e),h.setBindGroup(0,d);let b=t.dstWidth,p=t.dstHeight;if(i&&(b=Math.max(1,Math.floor(t.dstWidth/8)),p=Math.max(1,Math.floor(t.dstHeight/8))),h.dispatchWorkgroups(b,p),t.dstHeight*=.5,t.dstWidth*=.5,t.srcView=n,t.mipLevel=l+1,o=i&&(t.dstWidth<8||t.dstHeight<8),h.end(),o)break}y.endCommandEncoder(r),o&&this.mipmap(this._pipelineMin,t)}}class Ah{name="";passMap=new Map}class Dh{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=ra.filterComment(e);let a=new Ah,r=e.indexOf(this.shaderKeyword),i=e.indexOf("{",r),n=e.substring(r+this.shaderKeyword.length,i).trim();a.name=n.substring(1,n.length-1),n=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));let o=this.splitPassBlock(n);for(let l of o){let c=this.parserPassBlock(l),f;a.passMap.has(c.passType)?f=a.passMap.get(c.passType):(f=[],a.passMap.set(c.passType,f)),f.push(c),c.vertexShader.length>0&&(c.vertexShader=ra.parse(c.vertexShader,t)),c.fragmentShader.length>0&&(c.fragmentShader=ra.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 Dh,a=e.indexOf(this.passTypeKeyword),r=e.indexOf('"',a);return a=e.indexOf('"',r+1),t.passType=e.substring(a+1,r).trim(),this.parserShaderState(t,e),a=e.indexOf(this.vertexKeyword),a!=-1&&(t.vertexShader=this.extractBlock(e.substring(a+this.vertexKeyword.length),"{","}")),a=e.indexOf(this.fragmentKeyword),a!=-1&&(t.fragmentShader=this.extractBlock(e.substring(a+this.fragmentKeyword.length),"{","}")),t}static parserShaderState(e,t){let a=t.indexOf("ShaderState");if(a==-1)return!1;a=t.indexOf("{",a);let r=t.indexOf("}",a),n=t.substring(a+1,r).split(",");for(let o of n){let l=o.split(":"),c=l[0].trim(),f=this.convertValue(l[1].trim());e.shaderState.set(c,f)}return!0}static convertValue(e){return e.length==4&&e.toLowerCase()=="true"?!0:e.length==5&&e.toLowerCase()=="false"?!1:e[0]=='"'?e.substring(1,e.length-1):Number.parseInt(e)}static extractBlock(e,t,a){let r=e.indexOf(t);if(r==-1)return"";let i=0,n=0;e=e.substring(r);for(let l of e){if(l==t?i++:l==a&&i--,i<=0)break;n++}return e.substring(1,n).trim()}}let _h=new $e("IrradianceDataReaderCompleteEvent");class cs extends Ra{readFlag=!1;probeRenderer;opColorBuffer;opDepthBuffer;srcColorMap;srcDepthMap;opDepthArray;opColorArray;initReader(e,t,a){this.probeRenderer=e,this.srcColorMap=t,this.srcDepthMap=a;let r=m.setting.gi,i=r.octRTMaxSize*r.octRTMaxSize;this.opColorBuffer=k.device.createBuffer({size:i*4*4,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}),this.opColorArray=new Float32Array(i*4),this.opDepthBuffer=k.device.createBuffer({size:i*4*4,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,mappedAtCreation:!1}),this.opDepthArray=new Float32Array(i*4),this.probeRenderer.addEventListener(Ln.type,()=>{this.onProbeRenderComplete()},this),this.probeRenderer.addEventListener(_s.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 cs.read(this.srcColorMap.getGPUTexture(),this.opColorBuffer,this.opColorArray),await cs.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(_h)}}static async read(e,t,a){let r=y.beginCommandEncoder();r.copyTextureToBuffer({texture:e},{buffer:t,bytesPerRow:e.width*16},[e.width,e.height]),y.endCommandEncoder(r),await t.mapAsync(GPUMapMode.READ);const i=t.getMappedRange();a.set(new Float32Array(i),0),t.unmap()}}let Lg=new cs;class Gg{computeShader;visibleBuffer;texture;constructor(){this.computeShader=new fe(vd),this.visibleBuffer=new ti(8192*2),this.computeShader.setStorageBuffer("visibleBuffer",this.visibleBuffer),this.texture=vt.getTexture(Ua.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=y.beginCommandEncoder();y.computeCommand(a,[this.computeShader]),this.visibleBuffer.readBuffer(),t.zVisibleList=this.visibleBuffer.outFloat32Array}}class zg extends Rt{RT_BloomUp;RT_BloomDown;RT_threshold;rendererPassState;thresholdCompute;downSampleComputes;upSampleComputes;postCompute;bloomSetting;rtFrame;constructor(){super()}onAttach(e){m.setting.render.postProcessing.bloom.enable=!0,this.createGUI()}onDetach(e){m.setting.render.postProcessing.bloom.enable=!1,this.removeGUI()}createGUI(){}removeGUI(){}get downSampleBlurSize(){return m.setting.render.postProcessing.bloom.downSampleBlurSize}set downSampleBlurSize(e){m.setting.render.postProcessing.bloom.downSampleBlurSize=e}get downSampleBlurSigma(){return m.setting.render.postProcessing.bloom.downSampleBlurSigma}set downSampleBlurSigma(e){m.setting.render.postProcessing.bloom.downSampleBlurSigma=e}get upSampleBlurSize(){return m.setting.render.postProcessing.bloom.upSampleBlurSize}set upSampleBlurSize(e){m.setting.render.postProcessing.bloom.upSampleBlurSize=e}get upSampleBlurSigma(){return m.setting.render.postProcessing.bloom.upSampleBlurSigma}set upSampleBlurSigma(e){m.setting.render.postProcessing.bloom.upSampleBlurSigma=e}get luminanceThreshole(){return m.setting.render.postProcessing.bloom.luminanceThreshole}set luminanceThreshole(e){m.setting.render.postProcessing.bloom.luminanceThreshole=e}get bloomIntensity(){return m.setting.render.postProcessing.bloom.bloomIntensity}set bloomIntensity(e){m.setting.render.postProcessing.bloom.bloomIntensity=e}get hdr(){return m.setting.render.postProcessing.bloom.hdr}set hdr(e){m.setting.render.postProcessing.bloom.hdr=e}createThreshouldCompute(){this.thresholdCompute=new fe(qf),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=m.setting.render.postProcessing.bloom.downSampleStep;this.downSampleComputes=[];for(let a=0;a<t;a++){let r=new fe($f),i=this.RT_BloomDown[a],n=a==0?this.RT_threshold:this.RT_BloomDown[a-1];r.setSamplerTexture("inTex",n),r.setStorageTexture("outTex",i),r.setUniformBuffer("bloomCfg",this.bloomSetting),r.workerSizeX=Math.ceil(i.width/8),r.workerSizeY=Math.ceil(i.height/8),r.workerSizeZ=1,this.downSampleComputes.push(r)}}createUpSampleComputes(){const t=m.setting.render.postProcessing.bloom.downSampleStep;this.upSampleComputes=[];{let a=new fe(Bo),r=this.RT_BloomUp[0],i=this.RT_BloomDown[t-2];a.setSamplerTexture("_MainTex",i),a.setSamplerTexture("_PrevMip",this.RT_BloomDown[t-1]),a.setStorageTexture("outTex",r),a.setUniformBuffer("bloomCfg",this.bloomSetting),a.workerSizeX=Math.ceil(r.width/8),a.workerSizeY=Math.ceil(r.height/8),a.workerSizeZ=1,this.upSampleComputes.push(a)}for(let a=1;a<t-1;a++){let r=new fe(Bo),i=this.RT_BloomUp[a],n=this.RT_BloomDown[t-2-a];r.setSamplerTexture("_MainTex",n),r.setSamplerTexture("_PrevMip",this.RT_BloomUp[a-1]),r.setStorageTexture("outTex",i),r.setUniformBuffer("bloomCfg",this.bloomSetting),r.workerSizeX=Math.ceil(i.width/8),r.workerSizeY=Math.ceil(i.height/8),r.workerSizeZ=1,this.upSampleComputes.push(r)}}createPostCompute(){const t=m.setting.render.postProcessing.bloom.downSampleStep;this.postCompute=new fe(ed),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=m.setting.render.postProcessing.bloom;this.bloomSetting=new dt(8);let[t,a]=k.presentationSize,r=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING;this.RT_threshold=new Ae(t,a,Y.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 Ae(o,l,Y.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 Ae(l,c,Y.rgba16float,!1,r)}}let n=new ke;n.loadOp="load",this.rtFrame=new je([this.RT_threshold],[n])}render(e,t){this.thresholdCompute||(this.createResource(),this.createThreshouldCompute(),this.createDownSampleComputes(),this.createUpSampleComputes(),this.createPostCompute(),this.rendererPassState=Qe.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="Bloom");let a=m.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(),y.computeCommand(t,[this.thresholdCompute,...this.downSampleComputes,...this.upSampleComputes,this.postCompute]),y.lastRenderPassState=this.rendererPassState}onResize(){let e=m.setting.render.postProcessing.bloom,[t,a]=k.presentationSize;this.RT_threshold.resize(t,a);const r=e.downSampleStep;let i=Math.ceil(t/4),n=Math.ceil(a/4);for(let o=0;o<r;o++)this.RT_BloomDown[o].resize(i,n),i=Math.ceil(i/2),n=Math.ceil(n/2);for(let o=0;o<r-1;o++){let l=this.RT_BloomDown[r-2-o].width,c=this.RT_BloomDown[r-2-o].height;this.RT_BloomUp[o].resize(l,c)}this.thresholdCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.thresholdCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.thresholdCompute.workerSizeZ=1;for(let o=0;o<r;o++){let l=this.downSampleComputes[o],c=this.RT_BloomDown[o];l.workerSizeX=Math.ceil(c.width/8),l.workerSizeY=Math.ceil(c.height/8),l.workerSizeZ=1}{let o=this.RT_BloomUp[0],l=this.upSampleComputes[0];l.workerSizeX=Math.ceil(o.width/8),l.workerSizeY=Math.ceil(o.height/8),l.workerSizeZ=1}for(let o=1;o<r-1;o++){let l=this.RT_BloomUp[o],c=this.upSampleComputes[o];c.workerSizeX=Math.ceil(l.width/8),c.workerSizeY=Math.ceil(l.height/8),c.workerSizeZ=1}this.postCompute.workerSizeX=Math.ceil(this.RT_threshold.width/8),this.postCompute.workerSizeY=Math.ceil(this.RT_threshold.height/8),this.postCompute.workerSizeZ=1}}class Jg extends Rt{blurTexture1;blurTexture2;rendererPassState;blurComputes;blurSettings;outTexture;rtFrame;constructor(){super()}onAttach(e){m.setting.render.postProcessing.depthOfView.enable=!0}onDetach(e){m.setting.render.postProcessing.depthOfView.enable=!1}get pixelOffset(){return m.setting.render.postProcessing.depthOfView.pixelOffset}set pixelOffset(e){e=Math.max(0,e);let t=m.setting.render.postProcessing.depthOfView;t.pixelOffset=e}get near(){return m.setting.render.postProcessing.depthOfView.near}set near(e){e=Math.max(0,e);let t=m.setting.render.postProcessing.depthOfView;t.near=e}get far(){return m.setting.render.postProcessing.depthOfView.far}set far(e){e=Math.max(0,e);let t=m.setting.render.postProcessing.depthOfView;t.far=e}createBlurCompute(){this.blurSettings=[],this.blurComputes=[];let e=m.setting.render.postProcessing.depthOfView;for(let t=0;t<e.iterationCount;t++){let a=new dt(4),r=new fe(td);this.blurComputes.push(r),this.blurSettings.push(a),r.setUniformBuffer("blurSetting",a);let i=ne.getGBufferFrame(ne.colorPass_GBuffer);r.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture());let n=t%2==0?this.blurTexture1:this.blurTexture2,o=t%2==1?this.blurTexture1:this.blurTexture2;r.setSamplerTexture("inTex",n),r.setStorageTexture("outTex",o),r.workerSizeX=Math.ceil(this.blurTexture1.width/8),r.workerSizeY=Math.ceil(this.blurTexture1.height/8),r.workerSizeZ=1,this.outTexture=o}}createResource(){let e=k.presentationSize,t=e[0],a=e[1];this.blurTexture1=new Ae(t,a,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture1.name="dof1";let r=new ke;r.clearValue=[0,0,0,1],r.loadOp="clear",this.blurTexture2=new Ae(t,a,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.blurTexture2.name="dof2";let i=new ke;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new je([this.blurTexture1,this.blurTexture2],[r,i])}render(e,t){if(!this.blurComputes){this.createResource(),this.createBlurCompute();let r=oe.getCameraGroup(e.camera);for(let i=0;i<this.blurComputes.length;i++)this.blurComputes[i].setUniformBuffer("globalUniform",r.uniformGPUBuffer);this.rendererPassState=Qe.createRendererPassState(this.rtFrame,null)}this.autoSetColorTexture("inTex",this.blurComputes[0]);let a=m.setting.render.postProcessing.depthOfView;a.far=Math.max(a.near,a.far)+1e-4;for(let r=0;r<a.iterationCount;r++){let i=this.blurComputes[r],n=this.blurSettings[r];n.setFloat("near",a.near),n.setFloat("far",a.far),n.setFloat("pixelOffset",(r+1)*a.pixelOffset),n.apply(),i.setStorageBuffer("blurSetting",n)}y.computeCommand(t,this.blurComputes),y.lastRenderPassState=this.rendererPassState}onResize(){let e=k.presentationSize,t=e[0],a=e[1],r=m.setting.render.postProcessing.depthOfView;r.far=Math.max(r.near,r.far)+1e-4,this.blurTexture1.resize(t,a),this.blurTexture2.resize(t,a);for(let i=0;i<r.iterationCount;i++){let n=this.blurComputes[i];n.workerSizeX=Math.ceil(this.blurTexture1.width/8),n.workerSizeY=Math.ceil(this.blurTexture1.height/8),n.workerSizeZ=1}}}class Wg extends Rt{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=ne.getGBufferFrame("ColorPassGBuffer");this.currentRenderTexture=e.getColorTexture(),this.gBufferTexture=e.getCompressGBufferTexture();let[t,a]=k.presentationSize;this.outTexture=new Ae(t,a,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let r=new ke;r.loadOp="load",this.rtFrame=new je([this.outTexture],[r])}createCompute(){this.uniformBuffer=new dt(4),this.uniformBuffer.setInt32("state",this._state);let e=oe.getCameraGroup(this.view.camera),a=ne.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture(),r=m.setting.reflectionSetting,n=ne.getGBufferFrame(ne.reflections_GBuffer,r.width,r.height).getCompressGBufferTexture(),o=m.renderJobs.get(this.view).reflectionRenderer.outTexture;this.testCompute=new fe(Dd),this.testCompute.setUniformBuffer("globalUniform",e.uniformGPUBuffer),this.testCompute.setUniformBuffer("uniformData",this.uniformBuffer),this.testCompute.setSamplerTexture("gBufferTexture",a),this.testCompute.setSamplerTexture("currentRenderTexture",this.currentRenderTexture),this.testCompute.setSamplerTexture("reflectionsGBufferTexture",n),this.testCompute.setSamplerTexture("envMap",o),this.testCompute.setStorageTexture("outputTexture",this.outTexture),this.testCompute.workerSizeX=Math.ceil(this.outTexture.width/16),this.testCompute.workerSizeY=Math.ceil(this.outTexture.height/16),this.testCompute.workerSizeZ=1}render(e,t){}compute(e){this.testCompute||(this.createResource(),this.createCompute(),this.onResize(),this.rendererPassState=Qe.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="test");let t=y.beginCommandEncoder();y.computeCommand(t,[this.testCompute]),y.endCommandEncoder(t),y.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=k.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 Zg extends Rt{gtaoTexture;rendererPassState;gtaoCompute;gtaoSetting;aoBuffer;directionsBuffer;directionsArray;rtFrame;constructor(){super()}onAttach(e){m.setting.render.postProcessing.gtao.enable=!0}Render;onDetach(e){m.setting.render.postProcessing.gtao.enable=!1}get maxDistance(){return m.setting.render.postProcessing.gtao.maxDistance}set maxDistance(e){e=se(e,.1,50);let t=m.setting.render.postProcessing.gtao;t.maxDistance=e}get maxPixel(){return m.setting.render.postProcessing.gtao.maxPixel}set maxPixel(e){e=se(e,5,100);let t=m.setting.render.postProcessing.gtao;t.maxPixel=e}get darkFactor(){return m.setting.render.postProcessing.gtao.darkFactor}set darkFactor(e){e=se(e,.01,1);let t=m.setting.render.postProcessing.gtao;t.darkFactor=e}get rayMarchSegment(){return m.setting.render.postProcessing.gtao.rayMarchSegment}set rayMarchSegment(e){e=se(e,4,10);let t=m.setting.render.postProcessing.gtao;t.rayMarchSegment=e}get multiBounce(){return m.setting.render.postProcessing.gtao.multiBounce}set multiBounce(e){let t=m.setting.render.postProcessing.gtao;t.multiBounce=e}get blendColor(){return m.setting.render.postProcessing.gtao.blendColor}set blendColor(e){let t=m.setting.render.postProcessing.gtao;t.blendColor=e}get usePosFloat32(){return m.setting.render.postProcessing.gtao.usePosFloat32}set usePosFloat32(e){let t=m.setting.render.postProcessing.gtao;t.usePosFloat32=e}createCompute(){this.gtaoCompute=new fe(ad);let e=new dt(8);this.gtaoCompute.setUniformBuffer("gtaoData",e),this.directionsArray=new Float32Array(16),this.directionsBuffer=new ve(16),this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply(),this.gtaoCompute.setStorageBuffer("directions",this.directionsBuffer),this.aoBuffer=new ve(this.gtaoTexture.width*this.gtaoTexture.height),this.gtaoCompute.setStorageBuffer("aoBuffer",this.aoBuffer);let t=ne.getGBufferFrame(ne.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]=k.presentationSize;this.gtaoTexture=new Ae(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.gtaoTexture.name="gtaoTex";let a=new ke;a.loadOp="load",this.rtFrame=new je([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=Qe.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GTAO";let l=oe.getCameraGroup(e.camera);this.gtaoCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=m.setting.render.postProcessing.gtao;this.directionsBuffer.setFloat32Array("array",this.randomDirection()),this.directionsBuffer.apply();let r=1-.2*(Fe.frame%2),i=a.maxDistance*r,n=a.maxPixel*r;this.gtaoSetting.setFloat("maxDistance",i),this.gtaoSetting.setFloat("maxPixel",n),this.gtaoSetting.setFloat("darkFactor",a.darkFactor),this.gtaoSetting.setFloat("rayMarchSegment",a.rayMarchSegment);let o=e.camera;this.gtaoSetting.setFloat("cameraNear",o.near),this.gtaoSetting.setFloat("cameraFar",o.far),this.gtaoSetting.setFloat("multiBounce",a.multiBounce?1:0),this.gtaoSetting.setFloat("blendColor",a.blendColor?1:0),this.gtaoSetting.apply(),y.computeCommand(t,[this.gtaoCompute]),y.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=k.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 jg extends Rt{fogSetting;fogOpTexture;fogCompute;fogUniform;rendererPassState;constructor(){super(),this.fogSetting=m.setting.render.postProcessing.globalFog}createCompute(e){z.register("GlobalFog_shader",vo),this.fogCompute=new fe(vo),this.fogUniform=new dt(20),this.fogCompute.setUniformBuffer("fogUniform",this.fogUniform);let t=ne.getGBufferFrame(ne.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=Qe.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="FOG";let a=oe.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]=k.presentationSize;this.fogOpTexture=new Ae(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.fogOpTexture.name="fogTex";let a=new ke;a.loadOp="load",this.rtFrame=new je([this.fogOpTexture],[a])}onAttach(e){m.setting.render.postProcessing.globalFog.enable=!0}onDetach(e){m.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=m.res.defaultSky;return J.instance.sky instanceof Fs&&(e=J.instance.sky.map),e}render(e,t){if(!this.fogCompute){this.createResource(),this.createCompute(e),this.onResize();let r=oe.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(),y.computeCommand(t,[this.fogCompute]),y.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=k.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 Rt{godRayTexture;rendererPassState;godRayCompute;historyGodRayData;godRaySetting;rtFrame;constructor(){super()}onAttach(e){m.setting.render.postProcessing.godRay.enable=!0,this.createGUI()}Render;onDetach(e){m.setting.render.postProcessing.godRay.enable=!1,this.removeGUI()}get blendColor(){return m.setting.render.postProcessing.godRay.blendColor}set blendColor(e){m.setting.render.postProcessing.godRay.blendColor=e}get rayMarchCount(){return m.setting.render.postProcessing.godRay.rayMarchCount}set rayMarchCount(e){e=se(e,8,20),m.setting.render.postProcessing.godRay.rayMarchCount=e}get scatteringExponent(){return m.setting.render.postProcessing.godRay.scatteringExponent}set scatteringExponent(e){e=se(e,1,40),m.setting.render.postProcessing.godRay.scatteringExponent=e}get intensity(){return m.setting.render.postProcessing.godRay.intensity}set intensity(e){e=se(e,.01,5),m.setting.render.postProcessing.godRay.intensity=e}createGUI(){}removeGUI(){}createCompute(e){this.godRayCompute=new fe(rd);let t=new dt(12);this.godRayCompute.setUniformBuffer("godRayUniform",t),this.historyGodRayData=new ve(4*this.godRayTexture.width*this.godRayTexture.height),this.godRayCompute.setStorageBuffer("historyGodRayData",this.historyGodRayData);let a=ne.getGBufferFrame(ne.colorPass_GBuffer);this.godRayCompute.setSamplerTexture("gBufferTexture",a.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",this.godRayCompute),this.godRayCompute.setStorageTexture("outTex",this.godRayTexture);let r=m.getRenderJob(e).shadowMapPassRenderer;this.godRayCompute.setSamplerTexture("shadowMap",r.depth2DArrayTexture),this.godRaySetting=t,this.onResize()}createResource(){let e=k.presentationSize,[t,a]=e;this.godRayTexture=new Ae(t,a,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.godRayTexture.name="godRayTexture";let r=new ke;r.loadOp="load",this.rtFrame=new je([this.godRayTexture],[r])}onResize(){let e=k.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=oe.getLightEntries(e.scene);this.godRayCompute.setStorageBuffer("lightBuffer",o.storageGPUBuffer),this.godRayCompute.setStorageBuffer("models",oe.modelMatrixBindGroup.matrixBufferDst),this.rendererPassState=Qe.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="GodRay";let l=oe.getCameraGroup(e.camera);this.godRayCompute.setUniformBuffer("globalUniform",l.uniformGPUBuffer)}let a=m.setting.render.postProcessing.godRay;this.godRaySetting.setFloat("intensity",a.intensity),this.godRaySetting.setFloat("rayMarchCount",a.rayMarchCount);let r=k.presentationSize,[i,n]=r;this.godRaySetting.setFloat("viewPortWidth",i),this.godRaySetting.setFloat("viewPortHeight",n),this.godRaySetting.setFloat("blendColor",a.blendColor?1:0),this.godRaySetting.setFloat("scatteringExponent",a.scatteringExponent),this.godRaySetting.apply(),y.computeCommand(t,[this.godRayCompute]),y.lastRenderPassState=this.rendererPassState}}class Bh{indexList;color;count}class vh{SlotCount=8;MaxEntities=16;defaultColor=new P(.2,1,1,1);slots=[];dataDirty=!0;constructor(){let e=m.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 Bh;a.indexList=new Float32Array(this.MaxEntities),a.color=this.defaultColor.clone(),a.count=0}}clear(){for(let e=0;e<this.SlotCount;e++)this.clearAt(e)}clearAt(e){this.dataDirty=!0;let t=this.slots[e];return t.color.copyFrom(this.defaultColor),t.indexList.fill(-1),t.count=0,this}fillDataAt(e,t,a){this.dataDirty=!0;let r=this.slots[e];if(r){r.indexList.fill(-1);for(let i=0,n=t.length;i<n;i++)r.indexList[i]=t[i];r.count=t.length,r.color.copyFrom(a)}return this}fetchData(e){return e.dirty=this.dataDirty,e.slots=this.slots,this.dataDirty=!1,this}}let oa=new vh;class Xg extends Rt{outlineTex;lowTex;rendererPassState;calcWeightCompute;outlineCompute;blendCompute;outlineSetting;slotsBuffer;slotsArray;entitiesArray;entitiesBuffer;weightBuffer;lowTexSize;oldOutlineColor;rtFrame;view;constructor(){super()}onAttach(e){this.view=e,m.setting.render.postProcessing.outline.enable=!0}onDetach(e){m.setting.render.postProcessing.outline.enable=!1}set outlinePixel(e){e=se(e,0,8);let t=m.setting.render.postProcessing.outline;t.outlinePixel!=e&&(t.outlinePixel=e)}get outlinePixel(){return m.setting.render.postProcessing.outline.outlinePixel}set fadeOutlinePixel(e){let t=m.setting.render.postProcessing.outline;e=se(e,0,8),t.fadeOutlinePixel!=e&&(t.fadeOutlinePixel=e)}get fadeOutlinePixel(){return m.setting.render.postProcessing.outline.fadeOutlinePixel}set strength(e){e=se(e,0,1);let t=m.setting.render.postProcessing.outline;t.strength!=e&&(t.strength=e)}get strength(){return m.setting.render.postProcessing.outline.strength}set useAddMode(e){m.setting.render.postProcessing.outline.useAddMode=e}get useAddMode(){return m.setting.render.postProcessing.outline.useAddMode}createGUI(){}createCompute(){let e=ne.getGBufferFrame(ne.colorPass_GBuffer);this.calcWeightCompute=new fe(nd);let t=oe.getCameraGroup(this.view.camera);this.calcWeightCompute.setUniformBuffer("globalUniform",t.uniformGPUBuffer),this.calcWeightCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.calcWeightCompute.setStorageBuffer("slotsBuffer",this.slotsBuffer),this.calcWeightCompute.setStorageBuffer("weightBuffer",this.weightBuffer),this.calcWeightCompute.setStorageBuffer("entitiesBuffer",this.entitiesBuffer),this.calcWeightCompute.setSamplerTexture("gBufferTexture",e.getCompressGBufferTexture()),this.calcWeightCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.calcWeightCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.calcWeightCompute.workerSizeZ=1,this.outlineCompute=new fe(od),this.outlineCompute.setStorageBuffer("outlineSetting",this.outlineSetting),this.outlineCompute.setStorageBuffer("slotsBuffer",this.slotsBuffer),this.outlineCompute.setStorageBuffer("weightBuffer",this.weightBuffer),this.outlineCompute.setStorageBuffer("oldOutlineColor",this.oldOutlineColor),this.outlineCompute.setStorageTexture("lowTex",this.lowTex),this.outlineCompute.workerSizeX=Math.ceil(this.lowTex.width/8),this.outlineCompute.workerSizeY=Math.ceil(this.lowTex.height/8),this.outlineCompute.workerSizeZ=1,this.blendCompute=new fe(sd),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=k.presentationSize,t=e[0],a=e[1],r=m.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new K(Math.ceil(t*r),Math.ceil(a*r)),this.lowTex=new Ae(this.lowTexSize.x,this.lowTexSize.y,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lowTex.name="lowTex";let i=new ke;i.clearValue=[0,0,0,1],i.loadOp="clear",this.outlineTex=new Ae(t,a,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outlineTex.name="outlineTex";let n=new ke;n.clearValue=[0,0,0,1],n.loadOp="clear",this.rtFrame=new je([this.outlineTex],[n]),this.outlineSetting=new dt(8),this.weightBuffer=new ve(this.lowTexSize.x*this.lowTexSize.y*4,GPUBufferUsage.COPY_SRC),this.oldOutlineColor=new ve(this.lowTexSize.x*this.lowTexSize.y*4,GPUBufferUsage.COPY_SRC),this.slotsArray=new Float32Array(oa.SlotCount*4),this.slotsBuffer=new ve(this.slotsArray.length),this.slotsBuffer.setFloat32Array("slotsArray",this.slotsArray),this.slotsBuffer.apply(),this.entitiesArray=new Float32Array(oa.SlotCount*oa.MaxEntities),this.entitiesBuffer=new ve(this.entitiesArray.length),this.entitiesBuffer.setFloat32Array("entitiesArray",this.entitiesArray),this.slotsBuffer.apply(),this.fetchData||={}}fetchData;fetchOutlineData(){if(oa.fetchData(this.fetchData),this.fetchData.dirty){let e=oa.SlotCount,t=oa.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=Qe.createRendererPassState(this.rtFrame,null)),this.computeList||=[this.calcWeightCompute,this.outlineCompute,this.blendCompute];let a=m.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(),y.computeCommand(t,this.computeList),y.lastRenderPassState=this.rendererPassState}onResize(){let e=k.presentationSize,t=e[0],a=e[1],r=m.setting.render.postProcessing.outline.textureScale;this.lowTexSize=new K(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 Rt{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 ve(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?us(e.camera.transform.onPositionChange,(t,a)=>this.onCameraChange(t,a)):(t,a)=>this.onCameraChange(t,a)}onCameraChange(e,t){console.log("a");let a=u.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=ne.getGBufferFrame("ColorPassGBuffer");this.gBufferTexture=e.getCompressGBufferTexture();let t=k.presentationSize,a=t[0],r=t[1];this.lastPosTexture=new Ae(a,r,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.lastPosTexture.name="lastPosTexture",this.outTexture=new Ae(a,r,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="outTexture";let i=Math.floor(a*this.downSampleCofe),n=Math.floor(r*this.downSampleCofe);this.newTexture=new Ae(i,n,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.newTexture.name="newTexture",this.oldTexture=new Ae(i,n,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.oldTexture.name="oldTexture",this.combineTexture=new Ae(i,n,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.combineTexture.name="combineTexture";let o=new ke;o.loadOp="load",this.rtFrame=new je([this.outTexture],[o])}createCompute(){this.ssgiCompute=new fe(fd),this.delayCompute=new fe(Ad),this.combineCompute=new fe(md);let e=oe.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 gh,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=Qe.createRendererPassState(this.rtFrame,null),this.rendererPassState.label="SSGI"),this.frameCount=this.frame,this.frame++;let t=y.beginCommandEncoder();switch(parseInt(this.debugChanal)){case 0:y.copyTexture(t,this.combineTexture,this.oldTexture),y.computeCommand(t,[this.ssgiCompute,this.delayCompute,this.combineCompute]);break;case 1:y.copyTexture(t,this.posTexture,this.lastPosTexture),y.copyTexture(t,this.lastPosTexture,this.outTexture);break;case 2:y.copyTexture(t,this.normalTexture,this.outTexture);break;case 3:y.copyTexture(t,this.posTexture,this.outTexture);break;case 4:y.copyTexture(t,this.colorTexture,this.outTexture);break;case 5:y.copyTexture(t,this.gBufferTexture,this.outTexture);break}y.lastRenderPassState=this.rendererPassState,this.updateBuffer.setFloat("delay",.01)}onResize(){let e=k.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 Rt{SSR_RayTraceCompute;SSR_IS_Compute;SSR_Blend_Compute;isRetTexture;finalTexture;rendererPassState;ssrUniformBuffer;rayTraceData;ssrColorData;rtFrame;historyPosition;view;onAttach(e){this.view=e,m.setting.render.postProcessing.ssr.enable=!0}onDetach(e){m.setting.render.postProcessing.ssr.enable=!1}reflectionRatio=.5;get fadeEdgeRatio(){return m.setting.render.postProcessing.ssr.fadeEdgeRatio}set fadeEdgeRatio(e){e=se(e,0,1);let t=m.setting.render.postProcessing.ssr;t.fadeEdgeRatio=e}get rayMarchRatio(){return m.setting.render.postProcessing.ssr.rayMarchRatio}set rayMarchRatio(e){e=se(e,0,1);let t=m.setting.render.postProcessing.ssr;t.rayMarchRatio=e}get roughnessThreshold(){return m.setting.render.postProcessing.ssr.roughnessThreshold}set roughnessThreshold(e){e=se(e,0,1);let t=m.setting.render.postProcessing.ssr;t.roughnessThreshold=e}get fadeDistanceMin(){return m.setting.render.postProcessing.ssr.fadeDistanceMin}set fadeDistanceMin(e){e=se(e,0,1e4);let t=m.setting.render.postProcessing.ssr;t.fadeDistanceMin=e}get fadeDistanceMax(){return m.setting.render.postProcessing.ssr.fadeDistanceMax}set fadeDistanceMax(e){e=se(e,0,1e4);let t=m.setting.render.postProcessing.ssr;t.fadeDistanceMax=e}get powDotRN(){return m.setting.render.postProcessing.ssr.powDotRN}set powDotRN(e){e=se(e,0,1);let t=m.setting.render.postProcessing.ssr;t.powDotRN=e}createRayTraceShader(){let e=oe.getCameraGroup(this.view.camera);this.SSR_RayTraceCompute=new fe(ud),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=ne.getGBufferFrame("ColorPassGBuffer").getCompressGBufferTexture();this.SSR_RayTraceCompute.setSamplerTexture("gBufferTexture",a),J.instance.sky instanceof Fs&&this.SSR_RayTraceCompute.setSamplerTexture("prefilterMap",J.instance.sky.map),this.SSR_RayTraceCompute.workerSizeX=Math.ceil(this.isRetTexture.width/8),this.SSR_RayTraceCompute.workerSizeY=Math.ceil(this.isRetTexture.height/8),this.SSR_RayTraceCompute.workerSizeZ=1}createISShader(){this.SSR_IS_Compute=new fe(hd),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=oe.getCameraGroup(this.view.camera);this.SSR_Blend_Compute=new fe(dd),this.SSR_Blend_Compute.setStorageBuffer("rayTraceBuffer",this.rayTraceData),this.SSR_Blend_Compute.setUniformBuffer("globalUniform",t.uniformGPUBuffer);let r=ne.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]=k.presentationSize;this.finalTexture=new Ae(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.finalTexture.name="ssrOutTex";let a=new ke;a.clearValue=[0,0,0,0],a.loadOp="clear";let r=Math.ceil(e*m.setting.render.postProcessing.ssr.pixelRatio),i=Math.ceil(t*m.setting.render.postProcessing.ssr.pixelRatio);this.isRetTexture=new Ae(r,i,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING),this.isRetTexture.name="ssrTextureIn";let n=new ke;n.clearValue=[0,0,0,0],n.loadOp="clear",this.rtFrame=new je([this.finalTexture,this.isRetTexture],[a,n]),this.rayTraceData=new ve(r*i*8,GPUBufferUsage.COPY_SRC),this.ssrColorData=new ve(r*i*4,GPUBufferUsage.COPY_SRC),this.historyPosition=new ve(r*i*4,GPUBufferUsage.COPY_SRC),this.ssrUniformBuffer=new dt(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=Qe.createRendererPassState(this.rtFrame,null);let i=oe.getCameraGroup(e.camera);this.SSR_RayTraceCompute.setUniformBuffer("standUniform",i.uniformGPUBuffer)}let a=m.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];y.computeCommand(t,r),y.lastRenderPassState=this.rendererPassState}onResize(){let[e,t]=k.presentationSize,a=Math.ceil(e*m.setting.render.postProcessing.ssr.pixelRatio),r=Math.ceil(t*m.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 u(0,0,e)],r=0,i=.02;for(let n=1;n<t;n++){let o=new u;a.push(o),r+=1-(1-.618)*n/t,i+=n*.01,o.x=Math.sin(r)*i,o.y=Math.cos(r)*i,o.z=1-n/t,o.multiplyScalar(e)}return a}}class $g extends Rt{taaTexture;outTexture;rendererPassState;taaCompute;copyTexCompute;sharpCompute;taaSetting;preColorBuffer;preColorTex;preProjMatrix;preViewMatrix;rtFrame;constructor(){super()}onAttach(e){m.setting.render.postProcessing.taa.enable=!0,e.camera.enableJitterProjection(!0),this.createGUI()}onDetach(e){m.setting.render.postProcessing.taa.enable=!1,e.camera.enableJitterProjection(!1)}get jitterSeedCount(){return m.setting.render.postProcessing.taa.jitterSeedCount}set jitterSeedCount(e){e=se(e,2,32),e=Math.round(e);let t=m.setting.render.postProcessing.taa;t.jitterSeedCount=e}get blendFactor(){return m.setting.render.postProcessing.taa.blendFactor}set blendFactor(e){e=se(e,0,1);let t=m.setting.render.postProcessing.taa;t.blendFactor=e}get sharpFactor(){return m.setting.render.postProcessing.taa.sharpFactor}set sharpFactor(e){e=se(e,.1,.99);let t=m.setting.render.postProcessing.taa;t.sharpFactor=e}get sharpPreBlurFactor(){return m.setting.render.postProcessing.taa.sharpPreBlurFactor}set sharpPreBlurFactor(e){e=se(e,.1,.99);let t=m.setting.render.postProcessing.taa;t.sharpPreBlurFactor=e}get temporalJitterScale(){return m.setting.render.postProcessing.taa.temporalJitterScale}set temporalJitterScale(e){e=se(e,0,1);let t=m.setting.render.postProcessing.taa;t.temporalJitterScale=e}createGUI(){}createCompute(e){let t=new fe(pd),a=new dt(44),r=oe.getCameraGroup(e.camera);t.setUniformBuffer("globalUniform",r.uniformGPUBuffer),t.setUniformBuffer("taaData",a),t.setStorageBuffer("preColorBuffer",this.preColorBuffer);let i=ne.getGBufferFrame(ne.colorPass_GBuffer);t.setSamplerTexture("preColorTex",this.preColorTex),t.setSamplerTexture("gBufferTexture",i.getCompressGBufferTexture()),this.autoSetColorTexture("inTex",t),t.setStorageTexture("outTex",this.taaTexture),t.workerSizeX=Math.ceil(this.taaTexture.width/8),t.workerSizeY=Math.ceil(this.taaTexture.height/8),t.workerSizeZ=1,this.taaCompute=t,this.taaSetting=a,this.copyTexCompute=new fe(bd),this.copyTexCompute.setStorageBuffer("preColor",this.preColorBuffer),this.copyTexCompute.setStorageTexture("preColorTex",this.preColorTex),this.copyTexCompute.workerSizeX=Math.ceil(this.taaTexture.width/8),this.copyTexCompute.workerSizeY=Math.ceil(this.taaTexture.height/8),this.copyTexCompute.workerSizeZ=1,this.sharpCompute=new fe(gd),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 E().identity(),this.preViewMatrix=new E().identity();let[e,t]=k.presentationSize;this.preColorBuffer=new ve(e*t*4,GPUBufferUsage.COPY_SRC),this.preColorTex=new Ae(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.preColorTex.name="taaTex";let a=new ke;a.clearValue=[0,0,0,1],a.loadOp="clear",this.taaTexture=new Ae(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.taaTexture.name="taaTex";let r=new ke;r.clearValue=[0,0,0,1],r.loadOp="clear",this.outTexture=new Ae(e,t,Y.rgba16float,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING),this.outTexture.name="sharpTaaTex";let i=new ke;i.clearValue=[0,0,0,1],i.loadOp="clear",this.rtFrame=new je([this.preColorTex,this.taaTexture,this.outTexture],[a,r,i])}render(e,t){this.taaCompute||(this.createResource(),this.createCompute(e),this.rendererPassState=Qe.createRendererPassState(this.rtFrame,null));let a=m.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(),y.computeCommand(t,[this.copyTexCompute,this.taaCompute,this.sharpCompute]),y.lastRenderPassState=this.rendererPassState,this.preProjMatrix.copyFrom(e.camera.projectionMatrix),this.preViewMatrix.copyFrom(e.camera.viewMatrix)}onResize(){let[e,t]=k.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 Uh{_tempIndexArray=[];setOutline(e,t){this.setOutlineList([e],t?[t]:null)}setOutlineList(e,t){e||=[];let a=oa.defaultColor,r=oa.SlotCount;for(let i=0;i<r;i++){this._tempIndexArray.length=0;let n=e[i],o=(t?t[i]:null)||a;if(n)for(const l of n)this.getEntityIdList(l,this._tempIndexArray);oa.fillDataAt(i,this._tempIndexArray,o)}}clearOutline(){return oa.clear(),this}_rendererList=[];getEntityIdList(e,t){this._rendererList.length=0;let a=e.getComponents($,this._rendererList);for(const r of a)t.push(r.object3D.transform._worldMatrix.index)}}let ep=new Uh;class xh{localPosition=new u;worldPosition=new u;uv=new K;faceIndex;isIn=!1;t=0;u=0;v=0;triangle;v0;v1;v2;pickList;color}class ui{static EPS=1e-4;static FLT_MAX=3402823466e29;static distPtTri(e,t,a,r){let i=new u,n=new u,o=new u;r.subtract(t,i),a.subtract(t,n),e.subtract(t,o);let l=ut(i,i),c=ut(i,n),f=ut(i,o),d=ut(n,n),h=ut(n,o),b=1/(l*d-c*c),p=(d*f-c*h)*b,g=(l*h-c*f)*b;if(p>=-ui.EPS&&g>=-ui.EPS&&p+g<=1+ui.EPS){let A=t[1]+i[1]*p+n[1]*g;return Math.abs(A-e[1])}return ui.FLT_MAX}static _info=new xh;static IntersectTriangle(e,t,a){let r=t.v1,i=t.v2,n=t.v3,o=i.subtract(r,u.HELP_3),l=n.subtract(r,u.HELP_4),c=e.direction.crossProduct(l,u.HELP_5),f=ut(o,c),d;if(f>0){if(a)return null;d=e.origin.subtract(r,u.HELP_2)}else d=r.subtract(e.origin,u.HELP_2),f=-f;if(f<1e-4)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let h=ut(d,c);if(h<0||h>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let b=d.crossProduct(o,u.HELP_1),p=ut(e.direction,b);if(p<0||h+p>f)return this._info.isIn=!1,this._info.t=0,this._info.u=0,this._info.v=0,this._info;let g=ut(l,b),A=1/f;g*=A,h*=A,p*=A,this._info.isIn=!0,this._info.t=g,this._info.u=h,this._info.v=p;let D=1-h-p;return this._u0.copyFrom(t.u1),this._u0.scale(D),this._u1.copyFrom(t.u2),this._u1.scale(h),this._u2.copyFrom(t.u3),this._u2.scale(p),this._info.uv.copyFrom(this._u0),this._info.uv.add(this._u1,this._info.uv),this._info.uv.add(this._u2,this._info.uv),this._info.localPosition.copyFrom(e.direction).multiplyScalar(g),this._info.localPosition.add(e.origin,this._info.localPosition),this._info}static _u0=new K;static _u1=new K;static _u2=new K}class $s extends Ra{static _instance;_maxRetry=3;loadAll(e,t){return new Promise((a,r)=>{let i=e.length,n=[];e.forEach((o,l)=>{let c=new t;this.load(o,t).then(f=>{c.parse(f),n.push(c),i--,i===0&&a(n)})})})}constructor(){if(super(),$s._instance)throw new Error("LoadManager is singleton class...")}static getInstance(){return this._instance||(this._instance=new $s)}loadUrls(e,t){return new Promise((a,r)=>{let i=e.length,n=[];e.forEach((o,l)=>{this.load(o,t).then(c=>{n.push(c),i--,i===0&&a(n),i<0&&console.error(`loadUrls ${e} error`)})})})}get maxRetry(){return this._maxRetry}set maxRetry(e){this._maxRetry=e}load(e,t){return new Promise((a,r)=>{t.format})}}function yh(s){const e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let a=0;a<s.length;a+=3){const r=s[a+0],i=s[a+1],n=s[a+2];r<e[0]&&(e[0]=r),i<e[1]&&(e[1]=i),n<e[2]&&(e[2]=n),r>t[0]&&(t[0]=r),i>t[1]&&(t[1]=i),n>t[2]&&(t[2]=n)}return{min:e,max:t}}var di=(s=>(s.PLY="ply",s.SPLAT="splat",s.KSPLAT="ksplat",s.UNKNOWN="unknown",s))(di||{});function Ch(s){if(s.byteLength<16)return"unknown";const e=new Uint8Array(s,0,Math.min(512,s.byteLength));return new TextDecoder("utf-8").decode(e).startsWith("ply")?"ply":"unknown"}function Sh(s){switch(s){case"char":case"uchar":case"uint8":case"int8":return 1;case"short":case"ushort":case"int16":case"uint16":return 2;case"int":case"uint":case"int32":case"uint32":case"float":case"float32":return 4;case"double":case"float64":return 8;default:return 4}}function tt(s,e,t){switch(t){case"char":case"int8":return s.getInt8(e);case"uchar":case"uint8":return s.getUint8(e);case"short":case"int16":return s.getInt16(e,!0);case"ushort":case"uint16":return s.getUint16(e,!0);case"int":case"int32":return s.getInt32(e,!0);case"uint":case"uint32":return s.getUint32(e,!0);case"double":case"float64":return s.getFloat64(e,!0);case"float":case"float32":default:return s.getFloat32(e,!0)}}function Fh(s){const e=Math.round(Math.sqrt(s));return Math.max(0,e-1)}function kh(s){const e=new TextDecoder("utf-8").decode(new Uint8Array(s,0,Math.min(4096,s.byteLength)));if(!e.startsWith("ply"))throw new Error("PLY: Unsupported format. Expecting PLY file.");const t=e.indexOf(`end_header
|
|
11690
|
-
`);if(t<0)throw new Error("PLY: Invalid PLY header");const a=e.substring(0,t+11),r=a.split(/\r?\n/);let i="",n=0;const o=[];let l=!1;for(const c of r)if(c.startsWith("format "))i=c.split(/\s+/)[1];else if(c.startsWith("element ")){const f=c.split(/\s+/);l=f[1]==="vertex",l&&(n=parseInt(f[2]))}else if(l&&c.startsWith("property ")){const f=c.split(/\s+/),d=f[1],h=f[2];o.push({name:h,type:d})}if(i!=="binary_little_endian")throw new Error("PLY: Only binary_little_endian PLY is supported");return{format:i,vertexCount:n,properties:o,headerByteLength:a.length}}function Eh(s){const e=kh(s),{vertexCount:t,properties:a,headerByteLength:r}=e,i=new DataView(s,r),n=v=>a.find(x=>x.name===v)!=null,o=v=>a.findIndex(x=>x.name===v),l=new Float32Array(t*3),c=n("scale_0")?new Float32Array(t*3):void 0,f=n("rot_0")?new Float32Array(t*4):void 0,d=n("opacity")?new Float32Array(t):void 0,h=[o("f_dc_0"),o("f_dc_1"),o("f_dc_2")],b=[];for(let v=0;v<a.length;v++)a[v].name.startsWith("f_rest_")&&b.push(v);const p=h[0]>=0&&h[1]>=0&&h[2]>=0;let g,A=0;if(p){const v=1+b.length/3;A=Fh(v),g=new Float32Array(t*v*3)}const D=[];let _=0;for(const v of a)D.push(_),_+=Sh(v.type);let U=0;for(let v=0;v<t;v++){const x=U,C=o("x"),F=o("y"),w=o("z");if(C<0||F<0||w<0)throw new Error("PLY: Missing x/y/z for vertex");if(l[v*3+0]=tt(i,x+D[C],a[C].type),l[v*3+1]=tt(i,x+D[F],a[F].type),l[v*3+2]=tt(i,x+D[w],a[w].type),c){const S=o("scale_0"),M=o("scale_1"),T=o("scale_2");c[v*3+0]=tt(i,x+D[S],a[S].type),c[v*3+1]=tt(i,x+D[M],a[M].type),c[v*3+2]=tt(i,x+D[T],a[T].type)}if(f){const S=o("rot_0"),M=o("rot_1"),T=o("rot_2"),Q=o("rot_3"),L=tt(i,x+D[S],a[S].type),X=tt(i,x+D[M],a[M].type),ie=tt(i,x+D[T],a[T].type),q=tt(i,x+D[Q],a[Q].type);f[v*4+0]=X,f[v*4+1]=ie,f[v*4+2]=q,f[v*4+3]=L}if(d){const S=o("opacity");d[v]=tt(i,x+D[S],a[S].type)}if(p&&g){const S=1+b.length/3,M=v*S*3;g[M+0]=tt(i,x+D[h[0]],a[h[0]].type),g[M+S+0]=tt(i,x+D[h[1]],a[h[1]].type),g[M+2*S+0]=tt(i,x+D[h[2]],a[h[2]].type);let T=1,Q=1,L=1;for(let X=0;X<b.length;X+=3){const ie=b[X+0],q=b[X+1],be=b[X+2];g[M+T]=tt(i,x+D[ie],a[ie].type),g[M+S+Q]=tt(i,x+D[q],a[q].type),g[M+2*S+L]=tt(i,x+D[be],a[be].type),T++,Q++,L++}}U+=_}return{vertexCount:t,position:l,scale:c,rotation:f,opacity:d,sh:p&&g?{order:A,coeffs:g}:void 0}}class tp extends st{static format=ze.BIN;async parseBuffer(e){const t=Ch(e);let a;switch(t){case di.PLY:{const r=Eh(e);a={count:r.vertexCount,position:r.position,rotation:r.rotation,scale:r.scale,opacity:r.opacity,sh:r.sh},a.bbox=yh(r.position);break}case di.SPLAT:throw new Error("SPLAT format is not yet supported");case di.KSPLAT:throw new Error("KSPLAT format is not yet supported");case di.UNKNOWN:default:throw new Error("Unknown or unsupported Gaussian Splatting file format")}return this.data=a,a}verification(){return!!this.data&&this.data.count>0}}var Is=(s=>(s.Point="Point",s.LineString="LineString",s.MultiPolygon="MultiPolygon",s))(Is||{});class ap extends st{static format=ze.JSON;json;async parseString(e){this.json=e,this.data=JSON.parse(e)}}class rp{static getPath(e){let t=[];for(let a=0;a<e.features.length;a++){const r=e.features[a];switch(r.geometry.type){case Is.LineString:break;case Is.MultiPolygon:let i=[];for(let n=0;n<r.geometry.coordinates.length;n++){const o=r.geometry.coordinates[n];for(const l of o)for(const c of l){let f=new u(c[0],0,c[1]);i.push(f)}}t.push(i);break}}return t}}class ip{name;defines;doubleSided;baseColorFactor;emissiveFactor;metallicFactor;roughnessFactor;alphaCutoff;enableBlend;baseColorTexture;metallicRoughnessTexture;normalTexture;occlusionTexture;emissiveTexture;extensions;baseMapOffsetSize;normalMapOffsetSize;emissiveMapOffsetSize;roughnessMapOffsetSize;metallicMapOffsetSize;aoMapOffsetSize}class sp{}class np{}class ko{boneName;bonePath;parentBoneName;boneID;parentBoneID;instanceID;parentInstanceID;t;q;s;formBytes(e){this.boneName=e.readUTF(),this.bonePath=e.readUTF(),this.parentBoneName=e.readUTF(),this.boneID=e.readInt32(),this.parentBoneID=e.readInt32(),this.instanceID=e.readUTF(),this.parentInstanceID=e.readUTF(),this.t=e.readVector3(),this.q=e.readQuaternion(),this.s=e.readVector3()}}class Eo{name;count;boneData;boneMap;formBytes(e){this.boneData=[],this.boneMap=new Map,this.name=e.readUTF(),this.count=e.readInt32();for(let t=0;t<this.count;t++){let a=new ko;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class wh extends st{static format=ze.BIN;static parser(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Eo;i.formBytes(e.readBytesArray()),m.res.addObj(i.name,i)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}V.position,V.normal,V.color,V.TANGENT,V.uv,V.TEXCOORD_1,V.TEXCOORD_2,V.TEXCOORD_2,V.TEXCOORD_4,V.TEXCOORD_5,V.TEXCOORD_6,V.TEXCOORD_7,V.joints0,V.weights0;var G=(s=>(s[s.single=0]="single",s[s.boolean=1]="boolean",s[s.int=2]="int",s[s.int16=3]="int16",s[s.int32=4]="int32",s[s.float=5]="float",s[s.long=6]="long",s[s.uint=7]="uint",s[s.uint32=8]="uint32",s[s.uint64=9]="uint64",s[s.double=10]="double",s[s.string=11]="string",s[s.singleArray=12]="singleArray",s[s.stringArray=13]="stringArray",s[s.floatArray=14]="floatArray",s[s.vector2=15]="vector2",s[s.vector3=16]="vector3",s[s.vector4=17]="vector4",s[s.color=18]="color",s[s.color32=19]="color32",s[s.animationCurve=20]="animationCurve",s[s.quaternion=21]="quaternion",s[s.matrix4x4=22]="matrix4x4",s[s.mesh=23]="mesh",s[s.texture=24]="texture",s[s.material=25]="material",s[s.materials=26]="materials",s[s.skeleton=27]="skeleton",s[s.animClip=28]="animClip",s[s.vector2Int=29]="vector2Int",s[s.int32List=30]="int32List",s[s.colorList=31]="colorList",s[s.color32List=32]="color32List",s))(G||{});class Qs{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=cl(t);if(r){let i=new mt;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 G.color:case G.color32:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformColor(i,n)}break;case G.single:case G.float:case G.int:case G.int16:case G.int32:case G.uint:case G.uint32:case G.uint64:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case G.singleArray:{let n=r.getValue()[0];i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case G.vector2:case G.vector2Int:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector2(i,n)}break;case G.vector3:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector3(i,n)}break;case G.vector4:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector4(i,n)}break}}}}class Ea{static parser(e){switch(e.readInt32()){case G.single:return{t:G.single,v:e.readFloat32()};case G.boolean:return{t:G.boolean,v:e.readBoolean()};case G.int:return{t:G.int,v:e.readInt32()};case G.int16:return{t:G.int16,v:e.readInt16()};case G.int32:return{t:G.int32,v:e.readInt32()};case G.float:return{t:G.float,v:e.readFloat32()};case G.long:return{t:G.long,v:e.readFloat64()};case G.uint:return{t:G.uint,v:e.readUnit32()};case G.uint32:return{t:G.uint32,v:e.readUnit32()};case G.uint64:return{t:G.uint64,v:e.readUnit32()};case G.double:return{t:G.double,v:e.readFloat64()};case G.string:return{t:G.string,v:e.readUTF()};case G.singleArray:return{t:G.singleArray,v:e.readFloatArray()};case G.stringArray:return{t:G.stringArray,v:e.readStringArray()};case G.floatArray:return{t:G.floatArray,v:e.readFloatArray()};case G.vector2:return{t:G.vector2,v:e.readVector2()};case G.vector3:return{t:G.vector3,v:e.readVector3()};case G.vector4:return{t:G.vector4,v:e.readVector4()};case G.color:return{t:G.color,v:e.readColor()};case G.color32:return{t:G.color32,v:e.readColor()};case G.animationCurve:return{t:G.animationCurve,v:null};case G.quaternion:return{t:G.quaternion,v:e.readQuaternion()};case G.matrix4x4:return{t:G.matrix4x4,v:null};case G.mesh:{let o=e.readUTF(),l=m.res.getGeometry(o);return{t:G.mesh,v:l}}case G.texture:{let o=e.readUTF(),l=m.res.getTexture(o);return{t:G.texture,v:l}}case G.material:{let o=e.readUTF(),l=m.res.getMat(o);return{t:G.material,v:l}}case G.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let d=m.res.getMat(f);l.push(d)}return{t:G.materials,v:l}}case G.skeleton:break;case G.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new Jo;f.formBytes(e),o.push(f)}return{t:G.animClip,v:o}}case G.vector2Int:return{t:G.vector2Int,v:e.readVector2int()};case G.int32List:return{t:G.int32List,v:e.readInt32List()};case G.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Ea.parser(e).v;r.push(l)}return{t:G.colorList,v:r};case G.color32List:let i=e.readInt32(),n=[];for(let o=0;o<i;o++){const l=Ea.parser(e).v;n.push(l)}return{t:G.color32List,v:n}}}}class wo{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Ea.parser(e);this.type=t,this._data=a}}class Rh{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class Ih extends st{static format=ze.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),n=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],d=[],h=i.readInt32();for(let g=0;g<h;g++){let A=new wo;A.formBytes(i),f.push(A)}let b=i.readInt32();for(let g=0;g<b;g++){let A=i.readBytesArray(),D=new Rh;D.property=A.readUTF(),D.name=A.readUTF(),D.texture=m.res.getTexture(D.name),D.texelSize=A.readVector2(),D.wrapModeU=A.readUnit32(),D.wrapModeV=A.readUnit32(),D.wrapModeW=A.readUnit32(),D.wrapMode=A.readUnit32(),D.anisoLevel=A.readUnit32(),D.dimension=A.readUnit32(),D.filterMode=A.readUnit32(),d.push(D)}let p=Qs.GetMaterial(c);p.name=n;for(let g=0;g<l.length;g++){const A=l[g];p.shader.setDefine(A,!0)}Qs.applyMaterialTexture(p,d),Qs.applyMaterialProperties(p,f),m.res.addMat(o,p)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Ro{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 Io{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 Ro;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class Qh{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class Th extends st{static format=ze.BIN;async parseBuffer(e){}static parserMeshs(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Qh,n=e.readBytesArray();i.meshName=n.readUTF(),i.meshID=n.readUTF(),n.readFloat32()>0,n.readFloat32()>0,n.readFloat32()>0;let o=n.readFloat32()>0,l=n.readFloat32()>0;o&&(i.bones=n.readStringArray(),i.bindPose=n.readMatrix44Array()),l&&(i.blendShapeData=new Io,i.blendShapeData.formBytes(n));let c=n.readBytesArray(),f=n.readBytesArray(),d=c.readInt32(),h=0,b=[];for(let _=0;_<d;_++)b[_]={},b[_].att=op[c.readUTF()],b[_].dim=c.readInt32(),h+=b[_].dim,b[_].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let p=n.readInt32Array(),g=[],A=n.readInt32();for(let _=0;_<A;_++){let U=n.readInt32(),v=n.readInt32(),x=n.readInt32(),C=n.readInt32(),F=n.readInt32(),w=n.readInt32();n.readVector3(),n.readVector3();let S={indexStart:v,indexCount:x,vertexStart:C,vertexCount:w,firstStart:F,topology:U,index:_};g.push(S)}p.length>65535?i.indices=new Uint32Array(p):i.indices=new Uint16Array(p);let D=new Ee;if(D.vertexDim=h,D.geometryType=bt.compose_bin,D.setIndices(i.indices),D.setAttribute(V.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 U=0;U<i.blendShapeData.blendCount;U++){let v=i.blendShapeData.shapeNames[U],x=i.blendShapeData.shapeIndexs[U];D.morphTargetDictionary[v]=x}}}for(let _=0;_<b.length;_++){const U=b[_].att;D.setAttribute(U,null)}for(let _=0;_<g.length;_++){const U=g[_];D.addSubGeometry(U)}D.name=i.meshName,m.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let op={Position:V.position,Normal:V.normal,Color:V.color,Tangent:V.TANGENT,TexCoord0:V.uv,TexCoord1:V.TEXCOORD_1,TexCoord2:V.TEXCOORD_2,TexCoord3:V.TEXCOORD_2,TexCoord4:V.TEXCOORD_4,TexCoord5:V.TEXCOORD_5,TexCoord6:V.TEXCOORD_6,TexCoord7:V.vIndex,BlendIndices:V.joints0,BlendWeight:V.weights0};class en 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 en(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 K;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new K;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new u;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 te;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 P;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 j;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 E,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 Mh extends st{static format=ze.TEXT;static async parserTexture(e,t,a){let r=e.readInt32(),i=[];for(let o=0;o<r;o++){let l=e.readUTF();Nh.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let n=await m.res.loadBitmapTextures(i,m.setting.loader.numConcurrent,a,!0);for(const o of n)m.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var lp=Object.getOwnPropertyDescriptor,cp=(s,e,t,a)=>{for(var r=a>1?void 0:a?lp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ts=class extends ot{constructor(){super(),z.register("PBRLitSSSShader",Cd);let s=new Ve("PBRLitSSSShader","PBRLitSSSShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefine("USE_CUSTOMUNIFORM",!0),this.setDefault(),this.computes=[new mh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformColor("emissiveColor",new P(1,1,1)),this.setUniformVector4("materialF0",new te(.04,.04,.04,1)),this.setUniformColor("specularColor",new P(.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 P(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new P(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _SSSMap(s){this.setTexture("sssMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SkinColor(s){this.setUniformColor("skinColor",s)}set _SkinPower(s){this.setUniformFloat("skinPower",s)}set _SkinColorIns(s){this.setUniformFloat("skinColorIns",s)}set curveFactor(s){this.setUniformFloat("curveFactor",s)}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Ts=cp([Ia(Ts,"LitSSSShader")],Ts);var fp=Object.getOwnPropertyDescriptor,dp=(s,e,t,a)=>{for(var r=a>1?void 0:a?fp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ms=class extends ot{constructor(){super();let s=new Ve("PBRLItShader","PBRLItShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformColor("emissiveColor",new P(0,0,0)),this.setUniformVector4("materialF0",new te(.04,.04,.04,1)),this.setUniformColor("specularColor",new P(.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 P(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=m.res.grayTexture,this._BumpMap=m.res.normalTexture,this._MaskTex=m.res.maskTexture}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Ms=dp([Ia(Ms,"LitShader")],Ms);class tn{comName;data;static parser(e){let t=e.readBytesArray(),a=new tn;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let n=new wo;n.formBytes(t),a.data.push(n)}return a}}class fs{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new fs;a.name=t.readUTF(),a.parentName=t.readUTF(),a.position=t.readVector3(),a.rotation=t.readQuaternion(),a.scale=t.readVector3(),a.comDatas=[],a.child=[];let r=t.readInt32();for(let n=0;n<r;n++){const o=tn.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let n=0;n<i;n++){const o=fs.parser(t);a.child.push(o)}return a}}class Nh extends st{static useWebp=!0;static format=ze.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new en(e,0);await Mh.parserTexture(t,this,this.loaderFunctions),wh.parser(t,this),Th.parserMeshs(t,this),Ih.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return fs.parser(e)}parserNodeTree(e){let t=new ee;if(t.localPosition=u.serialize(e.position),t.localQuaternion=j.serialize(e.rotation),t.localScale=u.serialize(e.scale),t.name=e.name,e.comDatas)for(let a=0;a<e.comDatas.length;a++){const r=e.comDatas[a];let i=null,n=ll(r.comName);if(n){i=t.getOrAddComponent(n);for(let o=0;o<r.data.length;o++){const l=r.data[o];l.key in i&&(i[l.key]=l.getValue())}}}if(e.child&&e.child.length>0)for(let a=0;a<e.child.length;a++){let r=this.parserNodeTree(e.child[a]);t.addChild(r)}return t}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class hp{static getNumber(e){return parseFloat(e)}static getInt(e){return parseInt(e)}static getBoolean(e){return e=="true"}static getNumberArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(",");for(let r=0;r<a.length;r++)parseFloat(a[r]);return t}static getStringArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(","),r=[];for(let i=0;i<a.length;i++){const n=a[i];r.push(n)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var up=Object.getOwnPropertyDescriptor,bp=(s,e,t,a)=>{for(var r=a>1?void 0:a?up(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Pi=class extends ot{constructor(){super();const s=new Ve("FatLine_VS","FatLine_FS");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);const e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,e.cullMode=wt.none,e.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new P(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new K(1920,1080));const s=new E;this.getDefaultColorShader().setUniform("modelMatrix",s.rawData)}};Pi=bp([Ia(Pi,"FatLineShader")],Pi);var gp=Object.getOwnPropertyDescriptor,pp=(s,e,t,a)=>{for(var r=a>1?void 0:a?gp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Oi=class extends ot{constructor(){super();let s=new Ve("UnLit","UnLit");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Oi=pp([Ia(Oi,"UnLitShader")],Oi);var mp=Object.getOwnPropertyDescriptor,Ap=(s,e,t,a)=>{for(var r=a>1?void 0:a?mp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Li=class extends ot{constructor(){super(),z.register("VertexAttributeIndexShader",Ud),z.register("UnLitTextureArray",Sd);let s=new Ve("UnLitTextureArray","UnLitTextureArray");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Li=Ap([Ia(Li,"UnLitTexArrayShader")],Li);const cr=-1,fr=0,Qo=1,Vh=2,Ca=3,Dp=6378137,_p=1/298.257223563,Bp=6356752314245179e-9,vp=Symbol("PLUGIN_REGISTERED");class To{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=fr;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 Oh{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,n=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-n<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,n+=c)}}clear(){Array.from(this._itemSet.keys()).forEach(t=>this.remove(t))}getStats(){return{size:this._itemSet.size,bytes:this._cachedBytes,usedCount:this._usedSet.size}}}class Mo{maxJobs=6;autoUpdate=!0;priorityCallback=null;_items=[];_callbacks=new Map;_currJobs=0;_scheduled=!1;_schedulingCallback;constructor(){this._schedulingCallback=e=>{requestAnimationFrame(e)}}set schedulingCallback(e){this._schedulingCallback=e}get running(){return this._items.length!==0||this._currJobs!==0}sort(){this.priorityCallback&&this._items.sort(this.priorityCallback)}has(e){return this._callbacks.has(e)}add(e,t){if(this._callbacks.has(e))return this._callbacks.get(e).promise;let a,r;const i=new Promise((o,l)=>{a=o,r=l}),n={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,n),this.autoUpdate&&this._scheduleJobRun(),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))}_scheduleJobRun(){this._scheduled||(this._scheduled=!0,this._schedulingCallback(()=>{this._scheduled=!1,this._tryRunJobs()}))}_tryRunJobs(){this.sort();const e=this.maxJobs;let t=0;const a=()=>{this._currJobs--,this.autoUpdate&&this._scheduleJobRun()};for(;e>this._currJobs&&this._items.length>0&&t<e;){this._currJobs++,t++;const r=this._items.shift(),i=this._callbacks.get(r);this._callbacks.delete(r),Promise.resolve(i.callback(r)).then(()=>{i.resolve(),a()}).catch(n=>{i.reject(n),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function Lh(s,e=null,t=null){const a=[];for(a.push(s),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),n=a.pop();if(e&&e(n,i,r)===!0){t&&t(n,i,r);return}const o=n.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(n),a.push(r+1);if(t&&t(n,i,r)===!0)return}}function Up(s,e){let t=s;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const Ns={inView:!1,error:1/0,distanceFromCamera:1/0},Gh=!0;function zh(s){return s===Ca||s===cr}function dr(s,e){return s.lastFrameVisited===e&&s.used}function Jh(s){return s.childrenProcessed===s.children.length}function No(s){return s.hasUnrenderableContent||s.parent!==null&&s.parent.geometricError<s.geometricError}function Vo(s,e){s.lastFrameVisited!==e.frameCount&&(s.usedLastFrame=s.used,s.lastFrameVisited=e.frameCount,s.used=!1,s.inFrustum=!1,s.isLeaf=!1,s.visible=!1,s.active=!1,s.error=1/0,s.distanceFromCamera=1/0,s.allChildrenReady=!1,e.calculateTileViewError(s,Ns),s.inFrustum=Ns.inView,s.error=Ns.error,s.distanceFromCamera=Ns.distanceFromCamera)}function Po(s,e,t=!1){s.used||(t||(s.used=!0,e.stats.used++),e.markTileUsed(s),s.inFrustum===!0&&e.stats.inFrustum++)}function xp(s,e){if(s.canTraverse&&s.canTraverseFrame===e.frameCount)return s.canTraverse;let t=!1;return s.error<=e.errorTarget&&!No(s)||s.depth>=e.maxDepth||!s.children||s.children.length===0?t=!1:t=!0,s.canTraverse=t,s.canTraverseFrame=e.frameCount,t}function Oo(s,e,t=!1){if(e.ensureChildrenArePreprocessed(s),Vo(s,e),Po(s,e,t),No(s)&&Jh(s)){const a=s.children;for(let r=0,i=a.length;r<i;r++)Oo(a[r],e,t)}}function Vs(s,e){if(e.ensureChildrenArePreprocessed(s),Vo(s,e),!s.inFrustum)return;if(!xp(s,e)){Po(s,e);const n=s.children;if(!s.hasContent&&n&&n.length>0)for(let o=0,l=n.length;o<l;o++){const c=n[o];Vs(c,e)}return}const a=s.children;let r=!1,i=!1;for(let n=0,o=a.length;n<o;n++){const l=a[n];Vs(l,e),r=r||dr(l,e.frameCount),i=i||l.inFrustum}if(s.refine==="REPLACE"&&!i&&a.length!==0){s.inFrustum=!1;for(let n=0,o=a.length;n<o;n++)Oo(a[n],e,!0);return}if(Po(s,e),s.refine==="REPLACE"&&(r&&s.depth!==0||Gh))for(let n=0,o=a.length;n<o;n++)Oo(a[n],e)}function Lo(s,e){const t=e.frameCount;if(!dr(s,t))return;const a=s.children;let r=!1;for(let i=0,n=a.length;i<n;i++){const o=a[i];r=r||dr(o,t)}if(!r)s.isLeaf=!0;else{let i=!0;for(let n=0,o=a.length;n<o;n++){const l=a[n];if(Lo(l,e),dr(l,t)){const c=!No(l);let f=!l.hasContent||l.hasRenderableContent&&zh(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===cr;f=c&&f||l.allChildrenReady,i=i&&f}}s.allChildrenReady=i}}function Wh(s,e){if(e.ensureChildrenArePreprocessed(s),dr(s,e.frameCount)&&(s.hasContent&&e.queueTileForDownload(s),Jh(s))){const t=s.children;for(let a=0,r=t.length;a<r;a++)Wh(t[a],e)}}function Go(s,e){const t=e.stats;if(!dr(s,e.frameCount))return;if(s.isLeaf){s.loadingState===Ca?(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++):s.hasContent&&e.queueTileForDownload(s);return}const a=s.children,r=s.hasContent,i=zh(s.loadingState)&&r,n=(e.errorTarget+1)*(e.errorThreshold||1),o=s.error<=n,l=s.refine==="ADD",c=s.allChildrenReady||s.depth===0&&!Gh;if(r&&(o||l)&&e.queueTileForDownload(s),(o&&i&&!c||i&&l)&&(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++),!l&&o&&!c)for(let f=0,d=a.length;f<d;f++){const h=a[f];dr(h,e.frameCount)&&Wh(h,e)}else for(let f=0,d=a.length;f<d;f++)Go(a[f],e)}function zo(s,e){const t=dr(s,e.frameCount);if(t||s.usedLastFrame){let a=!1,r=!1;if(t?(a=s.active,r=s.visible):Vo(s,e),s.hasRenderableContent&&s.loadingState===Ca){const n=s.__wasSetVisible;s.__wasSetActive!==a&&(e.setTileActive(s,a),s.__wasSetActive=a),n!==r&&(e.setTileVisible(s,r),s.__wasSetVisible=r)}s.usedLastFrame=t;const i=s.children;for(let n=0,o=i.length;n<o;n++)zo(i[n],e)}}class Wr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Wr.s_tmpMatrix||(Wr.s_tmpMatrix=new E),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 u(e[0],e[1],e[2]),a=new u(e[3],e[4],e[5]),r=new u(e[6],e[7],e[8]),i=new u(e[9],e[10],e[11]),n=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),d=i.clone().normalize();this._matrix=new E;const h=this._matrix.rawData;h[0]=c.x,h[1]=c.y,h[2]=c.z,h[3]=0,h[4]=f.x,h[5]=f.y,h[6]=f.z,h[7]=0,h[8]=d.x,h[9]=d.y,h[10]=d.z,h[11]=0,h[12]=t.x,h[13]=t.y,h[14]=t.z,h[15]=1;const b=new u(n*2,o*2,l*2);this._box=new ge(new u(0,0,0),b)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new u(e[0],e[1],e[2]),a=e[3];this._sphere=new Mr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,n,o]=e,l=new u((t+r)/2,(a+i)/2,(n+o)/2),c=new u(Math.abs(r-t),Math.abs(i-a),Math.abs(o-n));this._box=new ge(l,c),this._matrix=new E,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new u(a.x-r,a.y-r,a.z-r),n=new u(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,n),t){const o=[new u(i.x,i.y,i.z),new u(n.x,i.y,i.z),new u(i.x,n.y,i.z),new u(n.x,n.y,i.z),new u(i.x,i.y,n.z),new u(n.x,i.y,n.z),new u(i.x,n.y,n.z),new u(n.x,n.y,n.z)];o.forEach(l=>{const c=new u;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Wr.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 u(r.min.x,r.min.y,r.min.z),new u(r.max.x,r.min.y,r.min.z),new u(r.min.x,r.max.y,r.min.z),new u(r.max.x,r.max.y,r.min.z),new u(r.min.x,r.min.y,r.max.z),new u(r.max.x,r.min.y,r.max.z),new u(r.min.x,r.max.y,r.max.z),new u(r.max.x,r.max.y,r.max.z)];i.forEach(n=>{const o=new u;a.transformPoint(n,o),n.copyFrom(o)}),e.makeEmpty(),i.forEach(n=>{e.expandByPoint(n)})}else e.setFromMinMax(this._box.min,this._box.max);return e}throw new Error("BoundingVolume: Invalid state")}getOBB(e,t){this._type==="box"&&this._box&&this._matrix?(e.setFromMinMax(this._box.min,this._box.max),t.copyFrom(this._matrix)):(this.getAABB(e),t.identity())}getSphere(e){if(this._type==="sphere"&&this._sphere)return e.center.copyFrom(this._sphere.center),e.radius=this._sphere.radius,e;const t=new ge;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 u;t.transformPoint(a,o),r=o}const i=this._sphere.radius,n=e.clone().subtract(r).length;return Math.max(0,n-i)}else if(this._box){const a=new ge;this.getAABB(a,t);const r=a.center,i=a.size,n=Math.max(0,Math.abs(e.x-r.x)-i.x*.5),o=Math.max(0,Math.abs(e.y-r.y)-i.y*.5),l=Math.max(0,Math.abs(e.z-r.z)-i.z*.5);return Math.sqrt(n*n+o*o+l*l)}return 1/0}intersectsFrustum(e,t){if(this._type==="sphere"&&this._sphere){const a=new ge;return this.getAABB(a,t),e.containsBox2(a)>0}else if(this._box){const a=new ge;return this.getAABB(a,t),e.containsBox2(a)>0}return!1}}const Zh=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.used!==e.used?s.used?1:-1:s.error!==e.error?s.error>e.error?1:-1:s.distanceFromCamera!==e.distanceFromCamera?s.distanceFromCamera>e.distanceFromCamera?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},jh=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.lastFrameVisited!==e.lastFrameVisited?s.lastFrameVisited>e.lastFrameVisited?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:s.loadingState!==e.loadingState?s.loadingState>e.loadingState?-1:1:s.hasUnrenderableContent!==e.hasUnrenderableContent?s.hasUnrenderableContent?-1:1:s.error!==e.error?s.error>e.error?-1:1:0};class yp{rootLoadingState=fr;rootTileSet=null;rootURL=null;fetchOptions={};frameCount=0;isLoading=!1;lruCache;loadQueue;processNodeQueue;plugins=[];_queuedTiles=[];_cachedSinceLoadComplete=new Set;_processedTiles=new WeakSet;_visibleTiles=new Set;_usedSet=new Set;_cacheHits=0;_cacheMisses=0;stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0,inCacheSinceLoad:0};errorTarget=16;errorThreshold=1;maxDepth=30;displayActiveTiles=!1;onRootTileLoaded;rtcOffset=null;_root=null;_activeTiles=new Set;group;cameras=[];_cameraMap=new Map;_cameraInfo=[];_upRotationMatrix=new E;_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 Oh,this.lruCache.unloadPriorityCallback=jh,this.loadQueue=new Mo,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=Zh,this.processNodeQueue=new Mo,this.processNodeQueue.maxJobs=25,this.group=new ee,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===fr&&(this.rootLoadingState=Qo,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=Ca,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),d=this.preprocessNode(c.root,f,null);this._root=d;const h=new Wr(d.boundingVolume),b=new Mr;h.getSphere(b);const p=new ge;if(h.getAABB(p),this.rtcOffset=new u(-b.center.x,-b.center.y,-b.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:b.center,radius:b.radius,boundingBox:p,rtcOffset:this.rtcOffset})}catch(g){console.warn("Failed to calculate bounding volume for root tile:",g)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=cr,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const n=this.root;if(!n)return;a.inFrustum=0,a.used=0,a.active=0,a.visible=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.updateCameraInfo(),Vs(n,this),Lo(n,this),Go(n,this),zo(n,this);const o=this._queuedTiles;e.unloadPriorityCallback&&o.sort(e.unloadPriorityCallback);for(let c=0,f=o.length;c<f&&!e.isFull();c++)this.requestTileContents(o[c]);o.length=0,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&&Lh(this.root,(r,i,n)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,n):!1),t)}registerPlugin(e){if(this.plugins.includes(e))return;const t=e.priority||0;let a=this.plugins.length;for(let r=0;r<this.plugins.length;r++)if((this.plugins[r].priority||0)>t){a=r;break}this.plugins.splice(a,0,e),e.init&&e.init(this)}unregisterPlugin(e){const t=this.plugins;let a;if(typeof e=="string"?a=t.find(r=>r.name===e):a=e,a&&t.includes(a)){const r=t.indexOf(a);return t.splice(r,1),a.dispose&&a.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}calculateTileViewError(e,t){const a=e.cached,r=this.cameras,i=this._cameraInfo,n=a.boundingVolume;if(!n){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,d=1/0;const h=a.worldTransform;for(let b=0,p=r.length;b<p;b++){const g=i[b];let A,D;if(g.isOrthographic){const U=g.pixelSize;A=e.geometricError/U,D=1/0}else{const U=g.sseDenominator;D=n.distanceToPoint(g.position,h),A=D===0?1/0:e.geometricError/(D*U)}const _=i[b].frustum;n.intersectsFrustum(_,h)&&(o=!0,l=Math.max(l,A),c=Math.min(c,D)),f=Math.max(f,A),d=Math.min(d,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=d)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new u,frustum:new Un,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],n=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(n.position.copyFrom(l),n.frustum=i.frustum,n.isOrthographic=i.type===We.ortho,n.isOrthographic){const c=i.frustumSize;n.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;n.sseDenominator=2*Math.tan(f/2)/o.height}}}preprocessNode(e,t,a=null){if(this._processedTiles.has(e))return e;this._processedTiles.add(e);let r;if(e instanceof To?r=e:r=new To(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 Wr(r.boundingVolume);r.cached.boundingVolume=c}const i=new u(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),n=new E;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)n.rawData[f]=c[f]}if(!a){n.copyFrom(this._upRotationMatrix);const c=new u;c.copyFrom(i),c.applyMatrix4(n);const f=r.cached.boundingVolume.box,d=[new u(f.min.x,f.min.y,f.min.z),new u(f.max.x,f.min.y,f.min.z),new u(f.min.x,f.max.y,f.min.z),new u(f.max.x,f.max.y,f.min.z),new u(f.min.x,f.min.y,f.max.z),new u(f.max.x,f.min.y,f.max.z),new u(f.min.x,f.max.y,f.max.z),new u(f.max.x,f.max.y,f.max.z)];for(const p of d)p.applyMatrix4(n);const h=new ge;d.forEach(p=>{h.expandByPoint(p)}),n.rawData[12]=-c.x,n.rawData[13]=-c.y,n.rawData[14]=-c.z;const b=h.min;n.rawData[13]-=b.y}const o=new E;o.copyFrom(n),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,n);const l=new E;if(l.copyFrom(o),l.invert(),r.cached.transfrom=n,r.cached.worldTransform=o,r.cached.transformInverse=l,e.children&&e.children.length>0){r.children=[];for(let c=0;c<e.children.length;c++){const f=e.children[c],d=this.preprocessNode(f,t,r);r.children.push(d)}r.childrenProcessed=r.children.length}return r}ensureChildrenArePreprocessed(e,t=!1){const a=e.children;for(let r=0,i=a.length;r<i;r++){const n=a[r];n.basePath!==void 0&&n.basePath!==""||n.cached.boundingVolume||(t?(this.processNodeQueue.remove(n),this.preprocessNode(n,e.basePath,e)):this.processNodeQueue.has(n)||this.processNodeQueue.add(n,o=>{this.preprocessNode(o,e.basePath,e)}))}}_recordCacheHit(){this._cacheHits++}_recordCacheMiss(){this._cacheMisses++}resetCacheStats(){this._cacheHits=0,this._cacheMisses=0}requestTileContents(e){if(e.loadingState!==fr){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=Qo,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=cr,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async n=>{try{await this.parseTileContent(n,r,i),this.stats.downloading--}catch(o){n.loadingState=cr,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=Vh;const i=(l=>{const c=l.split(".");return c.length>1?c[c.length-1]:""})(t),n=a;let o=null;switch(i.toLowerCase()){case"b3dm":o=(await new pt().load(n,co,{onProgress:f=>{},onComplete:f=>{}})).data;break;case"i3dm":o=await m.res.loadI3DM(n,{onProgress:f=>{},onComplete:f=>{}});break;case"glb":case"gltf":o=await m.res.loadGltf(n,{onProgress:f=>{},onComplete:f=>{}});break;case"pnts":console.warn("PNTS format not yet supported");break;case"json":try{const f=await m.res.loadJSON(n);e.children.length=0,e.childrenProcessed=0;const d=this._getBasePath(n);if(f.root){const h=this.preprocessNode(f.root,d,e);e.children.push(h),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:f,url:n})}e.loadingState=Ca;return}catch(f){console.error("Failed to load external tileset:",f),e.loadingState=cr,this.stats.failed++;return}break;default:console.warn(`Unknown tile format: ${i}`);break}if(o){e.cached.scene=o,e.loadingState=Ca;const l=this._estimateBytesUsed(o);this._bytesUsed.set(o,l),this.lruCache.setMemoryUsage(e,l),this.lruCache.has(e)||this.lruCache.add(e,c=>{if(c.cached.scene){const f=c.cached.scene;f.parent&&f.parent.object3D.removeChild(f),f.destroy(),c.cached.scene=null}c.loadingState=fr}),e.active&&this.setTileActive(e,!0)}else e.loadingState=cr,this.stats.failed++}markTileUsed(e){this._usedSet.add(e),this.lruCache.markUsed(e)}setTileActive(e,t){t?this._activeTiles.add(e):this._activeTiles.delete(e);const a=e.cached.scene;a&&(t?(this.group.entityChildren.includes(a)||(a.parent&&a.parent.object3D.removeChild(a),this.group.addChild(a)),e.cached.worldTransform&&this._applyWorldTransform(a.transform,e.cached.worldTransform),a.transform.enable=!0):a.transform.enable=!1)}setTileVisible(e,t){t?this._visibleTiles.add(e):this._visibleTiles.delete(e);const a=e.cached.scene;a&&(a.transform.enable=t)}queueTileForDownload(e){e.loadingState!==fr||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 m.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new E;switch(e.toLowerCase()){case"x":t.makeRotationAxis(u.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(u.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(jt.EULER_ANGLES);e.localPosition=a[0];const r=new j;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(jt.EULER_ANGLES);e.localPosition=a[0];const r=new j;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_getBasePath(e){const t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}_resolveURL(e,t){return t.startsWith("http://")||t.startsWith("https://")?t:e+"/"+t}_getUrlExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}getMemoryStats(){const e=this.lruCache.getStats(),t=this.lruCache.maxBytesSize,a=e.bytes,r=t-a,i=this._cacheHits+this._cacheMisses,n=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:n}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===Ca&&e.push(t),!1),null),e}getVisibleTiles(){return Array.from(this._visibleTiles)}getActiveTiles(){return Array.from(this._activeTiles)}getTileTreeStats(){let e=0,t=0,a=0,r=0,i=0,n=0;return this.traverse(o=>(e++,o.loadingState===Ca&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),n+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?n/e:0}}printDebugInfo(){const e=this.stats,t=this.getMemoryStats(),a=this.getTileTreeStats(),r=this.performanceStats,i=this.lruCache.getStats();console.log("=== TilesRenderer Debug Info ==="),console.log("Stats:",e),console.log("Memory:",t),console.log("Tree:",a),console.log("Performance:",r),console.log("Cache:",i),console.log("Queues:",{load:this.loadQueue.getStats(),process:this.processNodeQueue.getStats()})}setPerformanceOptions(e){e.lruCacheMinSize!==void 0&&(this.lruCache.minSize=e.lruCacheMinSize),e.lruCacheMaxSize!==void 0&&(this.lruCache.maxSize=e.lruCacheMaxSize),e.lruCacheMinBytes!==void 0&&(this.lruCache.minBytesSize=e.lruCacheMinBytes),e.lruCacheMaxBytes!==void 0&&(this.lruCache.maxBytesSize=e.lruCacheMaxBytes),e.lruCacheUnloadPercent!==void 0&&(this.lruCache.unloadPercent=e.lruCacheUnloadPercent),e.downloadQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.downloadQueueMaxJobs),e.parseQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.parseQueueMaxJobs),e.processQueueMaxJobs!==void 0&&(this.processNodeQueue.maxJobs=e.processQueueMaxJobs),e.enablePerformanceStats!==void 0&&(this._enablePerformanceStats=e.enablePerformanceStats),e.enableCacheStats!==void 0&&(this._enableCacheStats=e.enableCacheStats)}dispose(){[...this.plugins].forEach(t=>this.unregisterPlugin(t)),this.lruCache.clear(),this.loadQueue.clear(),this.processNodeQueue.clear(),this._root=null,this.rootTileSet=null,this.rootLoadingState=fr,this.frameCount=0,this.isLoading=!1,this.resetCacheStats(),this.group.destroy()}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===Ca&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent($);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 Cp{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class Sp{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class Fp{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class kp{uri;group;metadata}class Ep{class;properties}function wp(s,e){let t=0,a=null;return function(...r){const i=Date.now(),n=i-t;n>=e?(t=i,s.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),s.apply(this,r),a=null},e-n))}}class Rp extends mt{static count=0;constructor(){super(),z.register("ColorLitShader",xd),this.shader=new ot;let e=new Ve("ColorLitShader","ColorLitShader");e.passType=H.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new P),e.setUniformColor("emissiveColor",new P),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",m.res.normalTexture),e.setTexture("emissiveMap",m.res.blackTexture)}clone(){return null}debug(){}}class Ip extends mt{constructor(){super(),this.shader=new Pi,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 Qp extends mt{constructor(){super();let e=new Ve("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=H.COLOR,e.setUniformVector4("transformUV1",new te(0,0,1,1)),e.setUniformVector4("transformUV2",new te(0,0,1,1)),e.setUniformColor("baseColor",new P(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 ot;a.addRenderPass(e),this.shader=a,this.baseMap=m.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 Tp(s,e){}class Mp extends mt{constructor(){super(),this.shader=new Li,this.baseMap=m.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 Jo{clipName;loopTime;startTime;stopTime;sampleRate;useSkeletonPos;useSkeletonScale;positionCurves=new Map;rotationCurves=new Map;scaleCurves=new Map;floatCurves=new Map;formBytes(e){if(this.clipName=e.readUTF(),this.loopTime=!e.readInt32(),this.startTime=e.readFloat32(),this.stopTime=e.readFloat32(),this.sampleRate=e.readInt32(),this.useSkeletonPos=e.readInt32()>0,this.useSkeletonScale=e.readInt32()>0,this.useSkeletonPos){let r=e.readInt32();for(let i=0;i<r;i++){let n=new hr;n.formBytes(e),this.positionCurves.set(n.path,n)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new hr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let n=new hr;n.formBytes(e),this.scaleCurves.set(n.path,n)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new hr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class hr{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 wi;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new K;break;case 3:this._cacheValue=new u;break;case 4:this._cacheValue=new te;break}}get totalTime(){return this.m_curves[0].totalTime}addKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].addKeyFrame(e.getK(t))}removeKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].removeKeyFrame(e.getK(t))}getValue(e){switch(this.k){case 1:this._cacheValue=this.m_curves[0].getValue(e);break;case 2:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e);break;case 3:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e),this._cacheValue.z=this.m_curves[2].getValue(e);break;case 4:const t=this.m_curves[0].getCurveFramesExtent(e),a=t.lhsIndex,r=t.rhsIndex;e=t.time;let i=this.m_curves[0].getKey(a),n=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(n.time-i.time);j.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),j.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),j.HELP_2.slerp(j.HELP_0,j.HELP_1,o),this._cacheValue.x=j.HELP_2.x,this._cacheValue.y=j.HELP_2.y,this._cacheValue.z=j.HELP_2.z,this._cacheValue.w=j.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 Ji(0);r.formBytes(e),this.addKeyFrame(r)}}}class Np 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 Vp{colorArray;constructor(e){this.colorArray=e}getColor(e){let t=e*this.colorArray.length,a=Math.floor(t),r=Math.min(a+1,this.colorArray.length-1),i=this.colorArray[a],n=this.colorArray[r];return P.lerp(t-a,i,n)}}class Ps{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return u.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,n=e*e*e;return this.controlVertices[0].mul(a).add(this.controlVertices[1].mul(r)).add(this.controlVertices[2].mul(i)).add(this.controlVertices[3].mul(n))}getTangent(e){if(!(e>=0&&e<=1))return u.ZERO;let t=this.controlVertices,a=t[0].add(t[1].add(t[0]).mul(e)),r=t[1].add(t[2].add(t[1]).mul(e)),i=t[2].add(t[3].add(t[2]).mul(e)),n=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(n)}getClosestParam(e,t=1e-6){return this.getClosestParamRec(e,0,1,t)}getClosestParamRec(e,t,a,r){let i=(t+a)/2;if(a-t<r)return i;let n=(t+i)/2,o=(i+a)/2,l=this.getPoint(n),c=this.getPoint(o),f=l.subtract(e).lengthSquared,d=c.subtract(e).lengthSquared;return f<d?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var Yh=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(Yh||{});class Pp{type=0;numCurveSegments=0;numControlVertices=0;controlVertices=[];constructor(e,t=0){this.setControlVertices(e,t)}getPathType(){return this.type}isClosed(){return this.type==1}isValid(){return this.numCurveSegments>0}clear(){this.controlVertices.length=0,this.type=0,this.numCurveSegments=0,this.numControlVertices=0}computeApproxLength(){if(!this.isValid())return 0;let e=this.numCurveSegments+1;if(e<2)return 0;let t=0,a=this.controlVertices;for(let r=1;r<e;r++){let i=a[(r-1)*3],n=a[r*3];t+=i.subtract(n).lengthSquared}return t==0?0:t}computeApproxParamPerUnitLength(){let e=this.computeApproxLength();return this.numCurveSegments/e}computeApproxNormParamPerUnitLength(){return 1/this.computeApproxLength()}interpolatePoints(e,t){let a=e.length;a<2&&console.error("point count must great 1"),this.clear(),this.type=t;let r=this.controlVertices;switch(t){case 0:{this.numCurveSegments=a-1,this.numControlVertices=3*a-2,r.length=this.numControlVertices;for(let o=0;o<a;o++)r[o*3]=e[o];let i=e[1].subtract(e[0]).mul(.25);r[1]=e[0].add(i);let n=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(n);for(let o=1;o<this.numCurveSegments;o++){let l=e[o-1].subtract(e[o]),c=e[o+1].subtract(e[o]),f=l.lengthSquared,d=c.lengthSquared;if(f>0&&d>0){let h=(f+d)/8,b=c.div(d).subtract(l.div(f));b.normalize(),b=b.mul(h),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 n=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[n].subtract(e[l]),f=e[o].subtract(e[l]),d=c.lengthSquared,h=f.lengthSquared,b=3*i-1,p=(3*i+1)%(this.numControlVertices-1);if(d>0&&h>0){let g=(d+h)/8,A=f.div(h).subtract(c.div(d));A.normalize(),A=A.mul(g),r[b]=e[l].subtract(A),r[p]=e[l].add(A)}else r[b]=e[l],r[p]=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=St.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 Ps(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=St.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 Ps(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],n=new Ps(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let d=0;d<4;d++)i[d]=this.controlVertices[o+d];n.setControlVertices(i);let l=n.getClosestParam(e,t),f=n.getPoint(l).subtract(e).lengthSquared;f<a&&(a=f,r=o/3+l)}return r}computeClosestNormParam(e,t){return this.computeClosestParam(e,t*this.numCurveSegments)}}class Op 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 Xh=(s=>(s[s.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",s[s.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",s[s.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",s[s.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",s[s.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",s[s.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",s[s.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",s[s.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",s[s.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",s[s.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",s[s.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",s[s.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",s[s.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",s))(Xh||{});const Lp=3.141592653589793;class Gp{}function Hh(s,e,t){let a=.3333333333333333,r=.5,i=s*a,n=i*i,l=n*i-i*e*r+t*r,c=-n+e*a,f=c*c*c,d=f+l*l;if(d>=0){let p=Math.sqrt(d)-l;return p=p>0?Math.pow(p,a):-Math.pow(-p,a),-i-c/p+p}let h=Math.sqrt(-f),b=Math.acos(-l/h);return h=Math.pow(h,a),h=h-c/h,b=-i+h*Math.cos(b*a),b}function Os(s,e,t,a){let r=1e-5;if(Math.abs(s)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*s*t;if(i<0)return 0;let n=.5/s,o=Math.sqrt(i);return a.r0=(o-e)*n,a.r1=(-o-e)*n,2}function Kh(s,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let n=t/e,o=a/e,l=r/e;s[0]=Hh(n,o,l),i++;let c=e,f=t+e*s[0],d=a+t*s[0]+e*s[0]*s[0];i+=Os(c,f,d,{r0:s[1],r1:s[2]})}else i+=Os(t,a,r,{r0:s[1],r1:s[2]});return i}class Sa{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class Wa{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[Wa.kMaxNumSegments]=new Sa,this.integrationCache[Wa.kMaxNumSegments]=0,this.doubleIntegrationCache[Wa.kMaxNumSegments]=0,this.times[Wa.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=K.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=K.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],n=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=Kh(c,i,n,o,l);for(let d=0;d<f;d++){let h=c[d]+t[r];h>=t[r]&&h<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(h))}this.calculateMinMax(e,this.evaluateIntegrated(a[r])),this.times[r]}return e}generateIntegrationCache(e){e.integrationCache[0]=0;let t=e.times[0],a=0;for(let r=1;r<e.segmentCount;r++){let i=e.segments[r-1].coeff;Wo(i);let n=t-a;e.integrationCache[r]=e.integrationCache[r-1]+Sa.EvalSegment(n,i)*n,a=t,t=e.times[r]}}generateDoubleIntegrationCache(e){let t=0,a=0;for(let r=0;r<e.segmentCount;r++){e.doubleIntegrationCache[r]=t;let i=e.times[r]-a;i=Math.max(i,0),t+=Sa.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++)Wo(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)qh(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<=Wa.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+Sa.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]+Sa.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 Sa.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 Sa,this.segments[0].coeff[3]=e.getKey(0).value*t;else{this.segmentCount=a-1;let i=0;e.getKey(0).time!=0&&(this.segments[0].coeff[3]=e.getKey(0).value,this.times[0]=e.getKey(0).time,i=1);for(let n=0;n<this.segmentCount;n++){let o;e.calculateCacheData(o,n,n+1,0),this.segments[n+i].coeff=o.coeff.concat(),this.times[n+i]=e.getKey(n+1).time}this.segmentCount+=i,e.getKey(a-1).time!=1&&(this.segments[this.segmentCount].coeff[3]=e.getKey(a-1).value,this.segmentCount++),this.times[this.segmentCount-1]=r;for(let n=0;n<this.segmentCount;n++)this.segments[n].coeff[0]*=t,this.segments[n].coeff[1]*=t,this.segments[n].coeff[2]*=t,this.segments[n].coeff[3]*=t}return!0}}function qh(s){s[0]/=20,s[1]/=12,s[2]/=6,s[3]/=2}function Wo(s){s[0]/=4,s[1]/=3,s[2]/=2,s[3]/=1}var $h=(s=>(s[s.kEMScalar=0]="kEMScalar",s[s.kEMOptimized=1]="kEMOptimized",s[s.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",s[s.kEMSlow=3]="kEMSlow",s))($h||{}),eu=(s=>(s[s.kMMCScalar=0]="kMMCScalar",s[s.kMMCCurve=1]="kMMCCurve",s[s.kMMCTwoCurves=2]="kMMCTwoCurves",s[s.kMMCTwoConstants=3]="kMMCTwoConstants",s))(eu||{});class zp{max;min}class Jp{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class tu{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new wi,this.maxCurve=new wi}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?wr(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?wr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?wr(e._minScalar,e._scalar,a):e.minMaxState==2?wr(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 Wp{value=0;mode=0;spread=0;speed=new tu;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function Zp(s,e){let t=Wa.isValidCurve(s.max);return e!=2&&e!=3?t:t&&Wa.isValidCurve(s.min)}function jp(s,e,t,a){s.max.buildCurve(e.max,t),a!=2&&a!=3?s.min.buildCurve(e.max,t):s.min.buildCurve(e.min,t)}function Yp(s,e){let t=e.getKeyCount();if(t!=0)if(t==1)Gi(s,e.getKey(0).value);else{let a=t-1;Gi(s,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Uo;e.calculateCacheData(i,r,r+1,0);let n=3*i.coeff[0],o=2*i.coeff[1],l=1*i.coeff[2],c=e.getKey(r).time,f=e.getKey(r+1).time,d=[],h=Os(n,o,l,{r0:d[0],r1:d[1]});for(let b=0;b<h;b++)d[b]>=0&&d[b]+c<f&&Gi(s,Sa.EvalSegment(d[b],i.coeff));Gi(s,Sa.EvalSegment(f-c,i.coeff))}}}function Gi(s,e){s.x=Math.min(s.x,e),s.y=Math.max(s.y,e)}class Qr{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class au{a;b;c;d;static ALIGN_ANY=0;static ALIGN_XY_AXIS=1;static ALIGN_YZ_AXIS=2;static ALIGN_XZ_AXIS=3;constructor(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}setTo(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}fromPoints(e,t,a){var r=t.x-e.x,i=t.y-e.y,n=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-n*l,this.b=n*o-r*c,this.c=r*l-i*o,this.d=-(this.a*e.x+this.b*e.y+this.c*e.z)}fromNormalAndPoint(e,t){this.a=e.x,this.b=e.y,this.c=e.z,this.d=-(this.a*t.x+this.b*t.y+this.c*t.z)}normalize(){var e=Math.sqrt(this.a*this.a+this.b*this.b+this.c*this.c);if(e>0){var t=1/e;this.a*=t,this.b*=t,this.c*=t,this.d*=t}return e}distance(e){return this.a*e.x+this.b*e.y+this.c*e.z+this.d}classifyPoint(e,t=.01){var a=this.distance(e);return a<-t?Qr.BACK:a>t?Qr.FRONT:Qr.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function Xp(s,e){return Math.random()*e+Math.random()*s+(e-s)*Math.random()}function Hp(s,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*s*a+(e-s)*Math.random()*a}function ru(s,e,t){let a=0,r=0;for(;a===0;)a=Math.random();for(;r===0;)r=Math.random();let i=Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*r);return i=i/10+.5,(i>1||i<0)&&(i=ru(s,e,t)),i=Math.pow(i,t),i*=e-s,i+=s,i}function la(s){return s>0?Math.floor(s):Math.floor(s)-1}let le=[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 Zo(s,e){let t=s&15,a=1+(t&7);return t&8&&(a=-a),a*e}function Ls(s,e,t){let a=s&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function zi(s,e,t,a){let r=s&15,i=r<8?e:t,n=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-n:n)}function hi(s,e,t,a,r){let i=s&31,n=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-n:n)+(i&2?-o:o)+(i&4?-l:l)}let Gt=[[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 Kp(s){let e=la(s),t=e+1,a=s-e,r=a-1,i,n,o=1-a*a;o*=o,i=o*o*Zo(le[e&255],a);let l=1-r*r;return l*=l,n=l*l*Zo(le[t&255],r),.25*(i+n)}function qp(s,e){const t=.366025403,a=.211324865;let r,i,n,o=(s+e)*t,l=s+o,c=e+o,f=la(l),d=la(c),h=(f+d)*a,b=f-h,p=d-h,g=s-b,A=e-p,D,_;g>A?(D=1,_=0):(D=0,_=1);let U=g-D+a,v=A-_+a,x=g-1+2*a,C=A-1+2*a,F=f&255,w=d&255,S=.5-g*g-A*A;S<0?r=0:(S*=S,r=S*S*Ls(le[F+le[w]],g,A));let M=.5-U*U-v*v;M<0?i=0:(M*=M,i=M*M*Ls(le[F+D+le[w+_]],U,v));let T=.5-x*x-C*C;return T<0?n=0:(T*=T,n=T*T*Ls(le[F+1+le[w+1]],x,C)),40*(r+i+n)}function $p(s,e,t){const a=.333333333,r=.166666667;let i,n,o,l,c=(s+e+t)*a,f=s+c,d=e+c,h=t+c,b=la(f),p=la(d),g=la(h),A=(b+p+g)*r,D=b-A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,a){let r=Math.floor(e%(t*a)),i=Math.floor(r/t),n=r%t;return new te(i/t,n/a,1/t,1/a)}}class Ji{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 G.single:{let r=this.getKeyFrame(0);r[a]=t}break;case G.float:{let r=this.getKeyFrame(0);r[a]=t}break;case G.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y}break;case G.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case G.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case G.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break}}getKeyFrame(e){let t=this.propertyKeyFrame[e];return t||(t=new ks,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}=Ea.parser(e);this.split(t,a,"value")}{let{t,v:a}=Ea.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Ea.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Ea.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Ea.parser(e);this.split(t,a,"outWeight")}}}class tm{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new K(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new u(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new te(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 j(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}}}}class Wi{_keys=new Array;_values=new Array;getIndexByKey(e){return this._keys.indexOf(e)}getValueByKey(e){var t=this.getIndexByKey(e);return t>-1?this._values[t]:null}put(e,t){if(e==null)return null;var a=this.remove(e);return this._keys.push(e),this._values.push(t),a}remove(e){var t=this._keys.indexOf(e),a;return t>-1&&(a=this._values[t],this._keys.splice(t,1),this._values.splice(t,1)),a}getValues(){return this._values}getKeys(){return this._keys}clear(){this._values.length=0,this._keys.length=0}}class ur{static WalkAble=1}class Zi{static SetConst(e){this.EPSILON=e,this.POWER_EPSILON=e*e}static EPSILON=.1;static POWER_EPSILON=this.EPSILON*this.EPSILON}class _t extends u{static CALC_VECTOR3D1=new u;static CALC_VECTOR3D2=new u;static CALC_VECTOR3D3=new u;static CALC_VECTOR3D4=new u;static CALC_VECTOR3D5=new u;_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)<Zi.POWER_EPSILON}static calcDistance(e,t){return _t.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),_t.CALC_VECTOR3D3.length}}class iu{_openedList;_closedList;_endNode;_startNode;_triangleChannel;_navMesh;_findIndex=0;constructor(){this._openedList=new Array,this._closedList=new Array}findPath(e,t,a){return this._findIndex++,this._navMesh=e,this._startNode=t,this._endNode=a,this._openedList.length=0,this._closedList.length=0,this._startNode&&this._endNode?(this._startNode.gg=0,this._startNode.h=0,this._startNode.f=0,this._startNode.parent=null,this.search()):!1}search(){for(var e=this._startNode,t=[],a;e!=this._endNode;){t=e.getNeibourTriangles(t,ur.WalkAble,ur.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+_t.calcDistance(a,e)*a.costMultiplier,i=_t.calcDistance(a,this._endNode),n=r+i;a.openId==this._findIndex?a.f>n&&(a.f=n,a.gg=r,a.h=i,a.parent=e):(a.f=n,a.gg=r,a.h=i,a.parent=e,a.openId=this._findIndex,this._openedList.push(a))}if(e.closeId=this._findIndex,this._closedList.push(e),this._openedList.length==0)return!1;this._openedList.sort(function(o,l){return o.f-l.f}),e=this._openedList.shift()}return this.buildPath(),!0}buildPath(){this._triangleChannel=[];var e=this._endNode;for(this._triangleChannel.push(e);e!=this._startNode;)e=e.parent,this._triangleChannel.unshift(e)}get channel(){return this._triangleChannel}}class fa extends _t{_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 ha{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new u;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 u,this._edgeMask=ur.WalkAble,_t.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=_t.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&&(ha.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ha.CALC_FAT_VECTOR.scaleBy(e),ha.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(ha.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(ha.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ha.CALC_FAT_VECTOR.scaleBy(-e),ha.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(ha.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 _t.equalPoint(e,this._pointA)?this._pointA:_t.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 _t.equalPoint(e,this._pointA)?this._pointA:_t.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&ur.WalkAble)==ur.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class re{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new u;static RAY_2=new u;static TEST_RAY=new u;static TEST_RAY_1=new u;static TEST_RAY_2=new u;static CALC_CROSS_POINT=new u;static CALC_CROSS_TEST=new u;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=re.RAY_1,this.rayB=re.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(re.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(re.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(re.TEST_RAY),a instanceof _t?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(re.TEST_RAY),a instanceof _t?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);re.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(re.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var n;if(re.TEST_RAY_1.copyFrom(t.pointA),re.TEST_RAY_1.decrementBy(this.curPoint),re.TEST_RAY_2.copyFrom(t.pointB),re.TEST_RAY_2.decrementBy(this.curPoint),re.TEST_RAY_1.y=0,re.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,re.TEST_RAY_1,re.TEST_RAY_2)||this.isPointAtCenter(this.rayB,re.TEST_RAY_1,re.TEST_RAY_2)?n=!1:n=!0,n)return this.isPointAtCenter(this.rayA,re.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return re.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(re.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,re.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){re.CALC_CROSS_POINT.copyFrom(t),re.CALC_CROSS_POINT.decrementBy(e);let i=re.CALC_CROSS_POINT.x*r.z-r.x*re.CALC_CROSS_POINT.z;var n=0;return i!=0&&(n=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),n>1?n=1:n<0&&(n=0),re.CALC_CROSS_POINT.scaleBy(n),re.CALC_CROSS_POINT.incrementBy(e),re.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){re.CALC_CROSS_POINT.copyFrom(t),re.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(re.CALC_CROSS_POINT.x*r.z-r.x*re.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(re.CALC_CROSS_POINT.scaleBy(i),re.CALC_CROSS_POINT.incrementBy(e),re.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){re.CALC_CROSS_TEST.copyFrom(t),re.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(re.CALC_CROSS_TEST.x*r.z-r.x*re.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,re.RAY_1.setTo(0,0,0),re.RAY_2.setTo(0,0,0)}}class Ja{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new u;constructor(){this._router=new re}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,Zi.EPSILON)!=Qr.INTERSECT||a[a.length-1].plane.classifyPoint(t,Zi.EPSILON)!=Qr.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,n,o,l,c;for(r=0;r<i;r++)o=a[r].getPublicEdge(a[r+1]),o.crossPoint=null,o.initFatPoints(this._aiRadius),this._tempPublicEdgeList.push(o),n=a[r],c=n.plane,n=a[r+1],l=n.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,Zi.EPSILON)==Qr.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,d,h,b;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],n=a[r+1],b=r==i-1,b?l=t:l=n.getEdgeAgainstPoint(o),h=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,b),h||(f=this._router.cornerPoint,d=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(d),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let p=[];for(let g of this._result)p.push(new u().copyFrom(g));this._result=p}optimusTerminusFat(){var e,t,a;a=this._result[1],a instanceof fa&&(e=a),a=this._result[this._result.length-2],a instanceof fa&&(t=a),e&&(this._result[1]=e.scalePoint()),t&&e!=t&&(this._result[this._result.length-2]=t.scalePoint())}pushAllPathPoint2(e,t){var a=this._tempPublicEdgeList.length,r,i;this._result=new Array,this._result.push(e);for(var n=e,o,l,c,f=0;f<a;f++)if(r=this._tempPublicEdgeList[f],l=null,r.crossPoint)l=this.getFatPoint(r,r.crossPoint),l?this._result.push(l):this._result.push(r.crossPoint),n=r.crossPoint;else{i=null,o=null;for(var d=f+1;d<a&&(i=this._tempPublicEdgeList[d],o=i.crossPoint,!o);d++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==n?c=o.clone():(Ja.CROSS_TEST_DIRECTION.setTo(o.x-n.x,0,o.z-n.z),c=this._router.calcCrossEdge(r,n,Ja.CROSS_TEST_DIRECTION)),this._result.push(c))}this._result.push(t)}optimusByRadius(){var e=new Array;e.length=this._result.length;var t=this._result.length-2,a,r,i,n,o,l,c,f,d,h,b,p,g;for(g=0;g<t;g++)c=f=d=null,n=o=l=null,b=!1,p=null,a=this._result[g],r=this._result[g+1],i=this._result[g+2],a instanceof fa&&(n=a),r instanceof fa&&(o=r),i instanceof fa&&(l=i),n&&(c=n.ownerPoint),o&&(f=o.ownerPoint),l&&(d=l.ownerPoint),c&&f&&c==f&&f!=d&&(b=!0),d&&f&&d==f&&c!=f&&(b=!0),b&&(Ja.CROSS_TEST_DIRECTION.copyFrom(a),Ja.CROSS_TEST_DIRECTION.decrementBy(i),h=o.ownerEdge,b=this._router.hasCrossPoint(h.pointA,h.pointB,i,Ja.CROSS_TEST_DIRECTION),b&&(p=this._router.calcCrossPointOut(f,r,i,Ja.CROSS_TEST_DIRECTION)),p&&(e[g+1]=p))}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 su extends u{_id=0;_plane;_points=new Array;_edges=new Array;_neibourTriangles=new Wi;_pointAgainstEdge=new Wi;_edgeAgainstPoint=new Wi;_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 Ut,this._aabbBox.addPoint(this._points[0]),this._aabbBox.addPoint(this._points[1]),this._aabbBox.addPoint(this._points[2])}calcGlobalQuadAABB(){}get isTriangle(){return!0}constructor(e,t,a,r){super(0,0,0,0),this._id=e,this._mask=ur.WalkAble,this._edges.push(t,a,r);var i;for(i of this._edges)this._points.indexOf(i.pointA)==-1&&this._points.push(i.pointA),this._points.indexOf(i.pointB)==-1&&this._points.push(i.pointB);this.x=(this._points[0].x+this._points[1].x+this._points[2].x)/3,this.y=(this._points[0].y+this._points[1].y+this._points[2].y)/3,this.z=(this._points[0].z+this._points[1].z+this._points[2].z)/3,this._plane=new au,this._plane.fromPoints(this._points[0],this._points[1],this._points[2]),this._plane.normalize(),this.genarateAgainstData(),this.initAABB()}genarateAgainstData(){var e,t;for(e of this._edges)for(t of this._points)e.pointA!=t&&e.pointB!=t&&(this._edgeAgainstPoint.put(e,t),this._pointAgainstEdge.put(t,e))}get id(){return this._id}get plane(){return this._plane}get points(){return this._points}addNeibour(e,t){if(this._edges.indexOf(e)>=0)this._neibourTriangles.put(e,t);else throw new Error("the edge is not in triangle!!!")}getNeibourTriangles(e=null,t=1,a=1){e=e||new Array,e.length=0;var r,i,n=this._neibourTriangles.getKeys(),o;for(o of n)i=o,i.testMask(t)&&(r=this._neibourTriangles.getValueByKey(i),r.testMask(a)&&e.push(r));return e}getEdges(e=null,t=1){e=e||new Array,e.length=0;var a;for(a of this._edges)a.testMask(t)&&e.push(a);return e}get walkAble(){return this.testMask(ur.WalkAble)}get edges(){return this._edges}testMask(e){return(this._mask&e)==e}getEdgeAgainstPoint(e){return this._edgeAgainstPoint.getValueByKey(e)}getPointAgainstEdge(e){return this._pointAgainstEdge.getValueByKey(e)}getPublicEdge(e){if(e&&e!=this){var t=this._neibourTriangles.getKeys(),a;for(a of t)if(this._neibourTriangles.getValueByKey(a)==e)return a}return null}loopPublicEdge(e){var t,a;if(e&&e!=this){for(t of this._edges)for(a of e._edges)if(t==a)return t}return null}randomPoint(){var e=this._points[2].subtract(this._points[0]);e.scaleBy(Math.random()),e.incrementBy(this._points[0]);var t=this._points[1].subtract(e);return t.scaleBy(Math.random()),t.incrementBy(e),t}}class am{_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 Wi,this.initPoints(e),this.initEdgesAndTriangles(t),this.createConnections(),this._nav3dAstar=new iu,this._nav3dFunnel=new Ja,this._terrainQuad=new bh(8,128),this._terrainQuad.createQuadTree(this._nav3dTriangles)}getTriangleAtPoint(e,t=5){return this._terrainQuad.getTriangleAtPoint(e,t)}findPath(e,t,a=5){this._path=null,this._triangleList=null;var r=this.getTriangleAtPoint(e,10),i=this.getTriangleAtPoint(t,10),n=this._nav3dAstar.findPath(this,r,i);return n?(this._triangleList=this._nav3dAstar.channel,n=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,n):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new _t(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,n,o=e.length,l=0;l<o;l++)t=e[l],a=this.tryCreateEdge(t[0],t[1]),r=this.tryCreateEdge(t[1],t[2]),i=this.tryCreateEdge(t[2],t[0]),!(a==null||r==null||i==null)&&(n=new su(l,a,r,i),this._nav3dTriangles.push(n))}tryCreateEdge(e,t){if(e==t)throw new Error("edge point index error!!!");if(e>t){var a=e;e=t,t=a}var r=this._edgesDict.getValueByKey(e+"_"+t);return r==null&&(r=new ha(this._nav3dPoints[e],this._nav3dPoints[t]),this._nav3dEdges.push(r),this._edgesDict.put(e+"_"+t,r)),r}createConnections(){for(var e=this._nav3dTriangles.length,t=this._nav3dTriangles.length,a,r,i,n,o=0;o<e;o++){a=this._nav3dTriangles[o];for(i of a.edges)i.addTriangleOwners(a);for(var l=0;l<t;l++)r=this._nav3dTriangles[l],a!=r&&(n=a.loopPublicEdge(r),n&&(a.addNeibour(n,r),r.addNeibour(n,a)))}}}class $o{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 $o;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class Fa extends Ee{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 ge(u.ZERO.clone(),new u(this.width,this.height,this.depth));let r=new Float32Array([-e,t,a,e,t,a,e,t,-a,-e,t,-a,-e,t,a,e,t,-a,e,-t,a,-e,-t,a,-e,-t,-a,e,-t,-a,e,-t,a,-e,-t,-a,-e,-t,a,-e,t,a,-e,t,-a,-e,-t,-a,-e,-t,a,-e,t,-a,e,t,a,e,-t,a,e,-t,-a,e,t,-a,e,t,a,e,-t,-a,e,t,a,-e,t,a,-e,-t,a,-e,-t,a,e,-t,a,e,t,a,e,-t,-a,-e,-t,-a,-e,t,-a,e,t,-a,e,-t,-a,-e,t,-a]),i=new Float32Array([0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1]),n=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),o=[0,2,1,3,5,4,6,8,7,9,11,10,12,14,13,15,17,16,18,20,19,21,23,22,24,26,25,27,29,28,30,32,31,33,35,34],l=new Uint16Array(o.reverse());this.setIndices(l),this.setAttribute(V.position,r),this.setAttribute(V.normal,i),this.setAttribute(V.uv,n),this.setAttribute(V.TEXCOORD_1,n),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class nu extends Ee{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,n=!1,o=0,l=Math.PI*2){super(),this.radiusTop=e,this.radiusBottom=t,this.height=a,this.radialSegments=r,this.heightSegments=i,this.openEnded=n,this.thetaStart=o,this.thetaLength=l,this.instanceID=Et(),this.buildGeometry()}addGroup(e,t,a){this.addSubGeometry({indexStart:e,indexCount:t,vertexStart:e,vertexCount:0,firstStart:0,index:a,topology:0})}buildGeometry(){const e=this;this.radialSegments=Math.floor(this.radialSegments),this.heightSegments=Math.floor(this.heightSegments);const t=[],a=[],r=[],i=[];let n=0;const o=[],l=this.height/2;let c=0;p(),this.openEnded===!1&&(this.radiusTop>0&&g(!0),this.radiusBottom>0&&g(!1));let f=new Float32Array(t),d=new Float32Array(a),h=new Float32Array(r),b=new Uint16Array(i);this.setAttribute(V.position,f),this.setAttribute(V.normal,d),this.setAttribute(V.uv,h),this.setAttribute(V.TEXCOORD_1,h),this.setIndices(b);function p(){const A=new u,D=new u;let _=0;const U=(e.radiusBottom-e.radiusTop)/e.height;for(let v=0;v<=e.heightSegments;v++){const x=[],C=v/e.heightSegments,F=C*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let w=0;w<=e.radialSegments;w++){const S=w/e.radialSegments;let M=S*e.thetaLength+e.thetaStart;w==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(M=0);const T=Math.sin(M),Q=Math.cos(M);D.x=F*T,D.y=-C*e.height+l,D.z=F*Q,t.push(D.x,D.y,D.z),A.set(T,U,Q).normalize(),a.push(A.x,A.y,A.z),r.push(S,1-C),x.push(n++)}o.push(x)}for(let v=0;v<e.radialSegments;v++)for(let x=0;x<e.heightSegments;x++){const C=o[x][v],F=o[x+1][v],w=o[x+1][v+1],S=o[x][v+1];i.push(C,F,S),i.push(F,w,S),_+=6}e.addGroup(c,_,0),c+=_}function g(A){const D=n,_=new K,U=new u;let v=0;const x=A===!0?e.radiusTop:e.radiusBottom,C=A===!0?1:-1;for(let w=1;w<=e.radialSegments;w++)t.push(0,l*C,0),a.push(0,C,0),r.push(.5,.5),n++;const F=n;for(let w=0;w<=e.radialSegments;w++){const M=w/e.radialSegments*e.thetaLength+e.thetaStart,T=Math.cos(M),Q=Math.sin(M);U.x=x*Q,U.y=l*C,U.z=x*T,t.push(U.x,U.y,U.z),a.push(0,C,0),_.x=T*.5+.5,_.y=Q*.5*C+.5,r.push(_.x,_.y),n++}for(let w=0;w<e.radialSegments;w++){const S=D+w,M=F+w;A===!0?i.push(M,M+1,S):i.push(M+1,M,S),v+=3}e.addGroup(c,v,A===!0?1:2),c+=v}}}class ou extends Ee{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 ge(u.ZERO.clone(),new u(t*2,a*2,t*2));var n=(r+1)*(i+1);let o=new Float32Array(n*3),l=new Float32Array(n*3),c=new Float32Array(n*2),f=new Uint16Array(r*i*2*3),d=0,h=0,b=0,p=0;for(let g=0;g<=r;g++)for(let A=0;A<=i;A++){const D=A/i,_=g/r,U=D*e,v=_*Math.PI*2;if(o[d++]=(t+a*Math.cos(v))*Math.sin(U),o[d++]=a*Math.sin(v),o[d++]=(t+a*Math.cos(v))*Math.cos(U),l[h++]=Math.sin(U)*Math.cos(v),l[h++]=Math.sin(v),l[h++]=Math.cos(U)*Math.cos(v),c[b++]=D,c[b++]=_,A<i&&g<r){const x=i+1,C=x*g+A,F=x*(g+1)+A,w=x*(g+1)+A+1,S=x*g+A+1;f[p++]=C,f[p++]=S,f[p++]=F,f[p++]=S,f[p++]=w,f[p++]=F}}this.setIndices(f),this.setAttribute(V.position,o),this.setAttribute(V.normal,l),this.setAttribute(V.uv,c),this.setAttribute(V.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class rm extends Ee{segment;row=0;constructor(e){super(),this.segment=e,this.buildGeometry()}buildGeometry(){this.row=this.segment+1;let e=new Uint32Array(this.segment*6),t=new Float32Array(this.row*3*2),a=new Float32Array(this.row*3*2),r=new Float32Array(this.row*2*2);for(let i=0;i<this.row;i++){t[i*3*2+0]=0,t[i*3*2+1]=0,t[i*3*2+2]=0,t[i*3*2+3]=0,t[i*3*2+4]=0,t[i*3*2+5]=0,a[i*3*2+0]=0,a[i*3*2+1]=0,a[i*3*2+2]=1,a[i*3*2+3]=0,a[i*3*2+4]=0,a[i*3*2+5]=1,r[i*2*2+0]=0,r[i*2*2+1]=i/this.segment,r[i*2*2+2]=1,r[i*2*2+3]=i/this.segment;let n=i*2,o=n,l=n+1,c=n+2,f=n+3;e[i*6+0]=o,e[i*6+1]=l,e[i*6+2]=c,e[i*6+3]=l,e[i*6+4]=f,e[i*6+5]=c}this.setIndices(e),this.setAttribute(V.position,t),this.setAttribute(V.normal,a),this.setAttribute(V.uv,r),this.setAttribute(V.TEXCOORD_1,r),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class im extends Ee{faceCount=0;constructor(e){super(),this.faceCount=e,this.buildGeometry()}buildGeometry(){let e=new Uint32Array(this.faceCount*3),t=new Float32Array(this.faceCount*3*3),a=new Float32Array(this.faceCount*3*3),r=new Float32Array(this.faceCount*3*2),i=new Float32Array(this.faceCount*3*1);for(let n=0;n<this.faceCount;n++){let o=n*3+0,l=n*3+1,c=n*3+2;e[o]=o,e[l]=l,e[c]=c}this.setIndices(e),this.setAttribute(V.position,t),this.setAttribute(V.normal,a),this.setAttribute(V.uv,r),this.setAttribute(V.TEXCOORD_1,r),this.setAttribute(V.vIndex,i),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class sm extends He{create(e,t,a,r=!0){let i=k.device;const n=e*4*4;this.format=Y.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);const c=y.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(c),r&&(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float"),this.gpuSampler=i.createSampler({})}fromBuffer(e,t,a){let r=k.device;const i=e*4*4;this.format=Y.rgba32float,this.mipmapCount=1,this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const n=y.beginCommandEncoder();return n.copyBufferToTexture({buffer:a,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(n),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=r.createSampler({}),this}}class nm extends Cs{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new Rn;let t=[];return m.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,m.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 om extends ee{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new ee,t=new ee,a=new ee,r=new Fa(2,2,2),i=new Fa(2,2,2),n=new Fa(2,2,2),o=new nt;o.baseColor=new P(1,0,0);let l=new nt;l.baseColor=new P(0,1,0);let c=new nt;c.baseColor=new P(0,0,1);let f=e.addComponent($),d=t.addComponent($),h=a.addComponent($);f.geometry=r,f.material=o,f.castShadow=!1,d.geometry=i,d.material=l,d.castShadow=!1,h.geometry=n,h.material=c,h.castShadow=!1,e.localScale=new u(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new u(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new u(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class lm{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Ee,i=e.getAttribute(V.position).data.length/3,n=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let d=f[1].attribute;if(d==V.indices)continue;let h=e.getAttribute(d).data,b=h.length,p=new Float32Array(b*t);for(let g=0;g<t;g++){p.set(h,b*g);for(let A=0;A<i;A++)n[i*g+A]=g}r.setAttribute(d,p)}r.setAttribute(V.vIndex,n);let o=e.getAttribute(V.indices).data,l=o.length,c=new Uint32Array(o.length*t);for(let f=0;f<t;f++)for(let d=0;d<l;d++){let h=f*i,b=f*l;const p=o[d]+h;c[b+d]=p}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 cm extends ee{size=100;divisions=10;constructor(e=100,t=10){super(),this.size=e,this.divisions=t,this.buildGeometry(),this.addAxis()}buildGeometry(){const e=[],t=[],a=this.size/this.divisions,r=this.size/2,i=this.divisions/2;for(let c=0,f=-r;c<=this.divisions;c++,f+=a)c!==i&&(e.push(-r,0,f,r,0,f),e.push(f,0,-r,f,0,r));for(let c=0;c<e.length/3;c+=2)t.push(c,c+1);let n=new Ee;n.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),n.setAttribute(V.position,new Float32Array(e)),n.addSubGeometry({indexStart:0,indexCount:t.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let o=new nt;o.topology="line-list",o.baseColor=new P(1,1,1,.15),o.blendMode=ae.ADD,o.castReflection=!1;let l=this.addComponent($);l.geometry=n,l.material=o}addAxis(){const e=this.size/2;let t=new Float32Array([-e,0,0,e,0,0]),a=new Uint16Array([0,1,2,3]),r=new Ee;r.setIndices(a),r.setAttribute(V.position,t),r.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});{let i=new ee,n=i.addComponent($);n.geometry=r;let o=n.material=new nt;o.baseColor=new P(1,0,0,.5),o.blendMode=ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new ee;i.rotationY=90;let n=i.addComponent($);n.geometry=r;let o=n.material=new nt;o.baseColor=new P(0,1,0,.5),o.blendMode=ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class fm{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 P(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 dm{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new Fa),this.planeGeo||(this.planeGeo=new ei(1,1,1,1,u.UP)),this.sphere||(this.sphere=new Rr(1,35,35)),this.material||(this.material=new ka),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 ee,t=e.addComponent($);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 ka,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new ee,a=t.addComponent($);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,n){this.initHeap();let o=new ka;o.roughness=.5,o.metallic=.1,o.baseColor=new P(r,i,n,1);let l=new ee,c=l.addComponent($);return c.castGI=!0,c.geometry=new Fa(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new ka;i.baseColor=new P(t,a,r,1);let n=new ee,o=n.addComponent($);return o.castGI=!0,o.geometry=new Rr(e,20,20),o.material=i,n}static get Sphere(){this.initHeap();let e=new ee,t=e.addComponent($);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new ee,r=a.addComponent($);return r.castShadow=!1,r.geometry=new Fa(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,n,o=1,l=!0){let c=new ee,f=c.addComponent(ai);f.lightColor=new P(r,i,n,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let d=this.GetSingleSphere(.1,1,1,1);return c.addChild(d),f}}var R=(s=>(s[s.X=0]="X",s[s.Y=1]="Y",s[s.Z=2]="Z",s[s.XY=3]="XY",s[s.XZ=4]="XZ",s[s.YZ=5]="YZ",s[s.XYZ=6]="XYZ",s[s.MAX=7]="MAX",s[s.NONE=8]="NONE",s))(R||{}),$t=(s=>(s[s.Local=0]="Local",s[s.Global=1]="Global",s))($t||{});class Gs extends Pe{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(R.MAX),this.mAxisColor=new Array(R.MAX),this.mAxisMaterial=new Array(R.MAX),this.mAxisCollider=new Array(R.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 ee;let t=new nt;t.baseColor=new P(1,0,0),t.depthCompare=et.always,this.mAxisColor[R.X]=t.baseColor,this.mAxisMaterial[R.X]=t;let a=new nt;a.baseColor=new P(0,1,0),a.depthCompare=et.always,this.mAxisColor[R.Y]=a.baseColor,this.mAxisMaterial[R.Y]=a;let r=new nt;r.baseColor=new P(0,0,1),r.depthCompare=et.always,this.mAxisColor[R.Z]=r.baseColor,this.mAxisMaterial[R.Z]=r;let i=this.createCustomAxis(R.X),n=this.createCustomAxis(R.Y),o=this.createCustomAxis(R.Z);this.mContainer.addChild(this.mAxis[R.X]=i),this.mContainer.addChild(this.mAxis[R.Y]=n),this.mContainer.addChild(this.mAxis[R.Z]=o),this.mAxisCollider[R.X]=i.getComponent(qt),this.mAxisCollider[R.Y]=n.getComponent(qt),this.mAxisCollider[R.Z]=o.getComponent(qt)}start(){}onEnable(e){this.object3D.addChild(this.mContainer),this.reset()}onDisable(e){this.object3D.removeChild(this.mContainer)}reset(){switch(this.transformSpaceMode){case $t.Local:{let t=E.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 $t.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(m.inputSystem.mouseX,m.inputSystem.mouseY),r,i;for(let n=0;n<=R.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||n==R.XYZ)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},n==R.XYZ)))break}return i}currentAxis=R.NONE;beginPoint=new u;beginMousePos=new u;currentPoint=new u;onMouseDown(e){if(e.mouseCode!=Rs.MOUSE_LEFT)return;let t=this.pickAxis();if(!t)return;this.currentAxis=t.axis,e.stopImmediatePropagation();const r=this.object3D.transform.scene3D.view.camera;let i=r.worldToScreenPoint(this.mX.transform.worldPosition),n=r.screenPointToWorld(m.inputSystem.mouseX,m.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(n),this.beginMousePos.x=m.inputSystem.mouseX,this.beginMousePos.y=m.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==R.NONE){let t=this.lastMoveObj.getComponent($).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==R.XYZ&&(this.mAxis[R.X].getComponent($).material.setUniformColor("baseColor",this.mAxisColor[R.X]),this.mAxis[R.Y].getComponent($).material.setUniformColor("baseColor",this.mAxisColor[R.Y]),this.mAxis[R.Z].getComponent($).material.setUniformColor("baseColor",this.mAxisColor[R.Z])),this.lastMoveAxis=R.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new P(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==R.XYZ&&(this.mAxis[R.X].getComponent($).material.setUniformColor("baseColor",new P(1,1,1)),this.mAxis[R.Y].getComponent($).material.setUniformColor("baseColor",new P(1,1,1)),this.mAxis[R.Z].getComponent($).material.setUniformColor("baseColor",new P(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(m.inputSystem.mouseX,m.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let n=i.subtract(this.beginPoint);u.HELP_0.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let o=u.distance(u.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(u.HELP_0),this.transformSpaceMode){case $t.Local:this.applyLocalTransform(this.currentAxis,n,o);break;case $t.Global:this.applyGlobalTransform(this.currentAxis,n,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Rs.MOUSE_LEFT&&(this.currentAxis=R.NONE,this.reset())}onUpdate(e){let a=u.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 R.X:t=1;break;case R.Y:a=1;break;case R.Z:r=1;break}let i=.4+t*20,n=.4+a*20,o=.4+r*20,l=new ee;l.x=i*.5,l.y=n*.5,l.z=o*.5;let c=l.addComponent($);c.geometry=new Fa(i,n,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(qt),d=new li;return d.setFromCenterAndSize(new u(0,0,0),new u(i+1,n+1,o+1)),f.shape=d,l}}class lu extends Gs{init(e){super.init(e);let t=new nt;t.doubleSide=!0,t.baseColor=new P(.9,.9,.9),t.depthCompare=et.always,this.mAxisColor[R.XYZ]=t.baseColor,this.mAxisMaterial[R.XYZ]=t;let a=new ee,r=a.addComponent($);r.geometry=new Fa(2,2,2),r.material=this.mAxisMaterial[R.XYZ];let i=a.addComponent(qt),n=new li;n.setFromCenterAndSize(new u(0,0,0),new u(2,2,2)),i.shape=n,this.mContainer.addChild(this.mAxis[R.XYZ]=a),this.mAxisCollider[R.XYZ]=a.getComponent(qt)}applyLocalTransform(e,t,a){switch(this.currentAxis){case R.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==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=u.HELP_0;r.set(0,0,0),(this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ)&&(r.x=t.x),(this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ)&&(r.y=t.y),(this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,u.HELP_1),this.mX.scaleX+=u.HELP_1.x,this.mX.scaleY+=u.HELP_1.y,this.mX.scaleZ+=u.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 ee;switch(e){case R.X:t=1,i.rotationZ=-90;break;case R.Y:a=1;break;case R.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent($);return c.geometry=new Fa(2,2,2),c.material=this.mAxisMaterial[e],i}}var at=(s=>(s[s.Scale=0]="Scale",s[s.Rotation=1]="Rotation",s[s.Translation=2]="Translation",s[s.NONE=3]="NONE",s))(at||{});class cu extends Gs{applyLocalTransform(e,t,a){if(this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ,this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ){E.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),E.help_matrix_1.identity(),E.help_matrix_1.createByRotation(1,u.Y_AXIS),E.help_matrix_2.multiplyMatrices(E.help_matrix_1,E.help_matrix_0),E.help_matrix_2.invert(),E.help_matrix_1.multiplyMatrices(E.help_matrix_2,E.help_matrix_0);let r=E.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY),this.currentAxis==R.X){let r=t.worldToScreenPoint(a);u.HELP_1.set(r.x,r.y,0),u.HELP_2.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let i=u.HELP_2.subtract(u.HELP_1),n=u.getAngle(u.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.x-a.x>0&&(n=360-n),n}if(this.currentAxis==R.Y){let r=t.worldToScreenPoint(a);u.HELP_1.set(r.x,r.y,0),u.HELP_2.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let i=u.HELP_2.subtract(u.HELP_1),n=u.getAngle(u.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.y-a.y>0&&(n=360-n),n}if(this.currentAxis==R.Z){let r=t.worldToScreenPoint(a);u.HELP_1.set(r.x,r.y,0),u.HELP_2.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let i=u.HELP_2.subtract(u.HELP_1),n=u.getAngle(u.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.z-a.z>0&&(n=360-n),n}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==R.X||this.currentAxis==R.Y||this.currentAxis==R.Z){let r=this.getAngle();switch(E.help_matrix_0.identity(),this.currentAxis){case R.X:E.help_matrix_0.createByRotation(this.mLastAngle-r,u.X_AXIS);break;case R.Y:E.help_matrix_0.createByRotation(this.mLastAngle-r,u.Y_AXIS);break;case R.Z:E.help_matrix_0.createByRotation(this.mLastAngle-r,u.Z_AXIS);break}E.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),E.help_matrix_1.append(E.help_matrix_0),this.mX.parent&&(E.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),E.help_matrix_2.invert(),E.help_matrix_1.multiply(E.help_matrix_2));let n=E.help_matrix_1.decompose(jt.QUATERNION)[1];j.HELP_0.set(n.x,n.y,n.z,n.w),this.mLastAngle=r,this.mX.transform.localRotQuat=j.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=R.NONE&&(this.mAxis[R.X].getComponent($).enable=!1,this.mAxis[R.Y].getComponent($).enable=!1,this.mAxis[R.Z].getComponent($).enable=!1,this.mAxis[this.currentAxis].getComponent($).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==R.NONE&&(this.mAxis[R.X].getComponent($).enable=!0,this.mAxis[R.Y].getComponent($).enable=!0,this.mAxis[R.Z].getComponent($).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new ee;switch(e){case R.X:t.rotationZ=90;break;case R.Y:break;case R.Z:t.rotationX=90;break}let a=t.addComponent($);a.geometry=new ou(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(qt),i=new li;return i.setFromCenterAndSize(new u,new u(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY),r,i;for(let n=0;n<=R.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r)){let l=u.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class fu extends Gs{init(e){super.init(e);let t=new nt;t.doubleSide=!0,t.baseColor=new P(0,0,1),t.depthCompare=et.always,this.mAxisColor[R.XY]=t.baseColor,this.mAxisMaterial[R.XY]=t;let a=new nt;a.doubleSide=!0,a.baseColor=new P(0,1,0),a.depthCompare=et.always,this.mAxisColor[R.XZ]=a.baseColor,this.mAxisMaterial[R.XZ]=a;let r=new nt;r.doubleSide=!0,r.baseColor=new P(1,0,0),r.depthCompare=et.always,this.mAxisColor[R.YZ]=r.baseColor,this.mAxisMaterial[R.YZ]=r;let i=this.createPlane(R.XY),n=this.createPlane(R.XZ),o=this.createPlane(R.YZ);this.mContainer.addChild(this.mAxis[R.XY]=i),this.mContainer.addChild(this.mAxis[R.XZ]=n),this.mContainer.addChild(this.mAxis[R.YZ]=o),this.mAxisCollider[R.XY]=i.getComponent(qt),this.mAxisCollider[R.XZ]=n.getComponent(qt),this.mAxisCollider[R.YZ]=o.getComponent(qt)}applyLocalTransform(e,t,a){E.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),E.help_matrix_0.transformVector(t,u.HELP_0),this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ||(u.HELP_0.x=0),this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ||(u.HELP_0.y=0),this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ||(u.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(u.HELP_0,u.HELP_1),this.mX.x+=u.HELP_1.x,this.mX.y+=u.HELP_1.y,this.mX.z+=u.HELP_1.z}applyGlobalTransform(e,t,a){E.help_matrix_0.identity(),(this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ)&&E.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ)&&E.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ)&&E.help_matrix_0.appendTranslation(0,0,t.z),E.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),E.help_matrix_1.append(E.help_matrix_0),this.mX.parent&&(E.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),E.help_matrix_2.invert(),E.help_matrix_1.multiply(E.help_matrix_2));let r=E.help_matrix_1.decompose(jt.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 ee;switch(e){case R.X:t=1,i.rotationZ=-90;break;case R.Y:a=1,i.rotationY=-90;break;case R.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent($);return c.geometry=new nu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new ee,a=t.addComponent($);a.material=this.mAxisMaterial[e];let r=t.addComponent(qt),i=new li;switch(r.shape=i,e){case R.XY:a.geometry=new ei(4,4,1,1,u.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new u(0,0,0),new u(4,4,.1));break;case R.XZ:a.geometry=new ei(4,4,1,1,u.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new u(0,0,0),new u(4,.1,4));break;case R.YZ:a.geometry=new ei(4,4,1,1,u.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new u(0,0,0),new u(.1,4,4));break}return t}}class el extends ee{static _instance;static get instance(){return this._instance||(this._instance=new el),this._instance}mTarget;mTransformMode=at.NONE;mTransformSpaceType=$t.Global;mControllers;mXObj;mYObj;mZObj;constructor(){super(),this.mControllers=[null,null,null],this.mControllers[at.Scale]=this.addComponent(lu),this.mControllers[at.Rotation]=this.addComponent(cu),this.mControllers[at.Translation]=this.addComponent(fu),this.mControllers[at.Scale].enable=!1,this.mControllers[at.Rotation].enable=!1,this.mControllers[at.Translation].enable=!1,this.mXObj=new ee,this.mYObj=new ee,this.mZObj=new ee,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!=at.NONE&&(this.mControllers[this.mTransformMode].enable=!1),this.mTransformMode=e,this.mTransformMode!=at.NONE&&(this.mControllers[this.mTransformMode].enable=!0))}selectTransformSpaceMode(e){this.mTransformSpaceType!=e&&(this.mTransformSpaceType=e,this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].reset())}activate(){m.inputSystem.addEventListener(va.KEY_DOWN,this.onKeyDown,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onMouseDown,this,null,99999),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onMouseMove,this,null,99999),m.inputSystem.addEventListener(O.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){m.inputSystem.removeEventListener(va.KEY_DOWN,this.onKeyDown,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onMouseDown,this),m.inputSystem.removeEventListener(O.POINTER_MOVE,this.onMouseMove,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onMouseUp,this)}onKeyDown(e){switch(e.keyCode){case Oe.Key_R:this.selectTransformMode(at.Scale),this.selectTransformSpaceMode($t.Local);break;case Oe.Key_E:this.selectTransformMode(at.Rotation),this.selectTransformSpaceMode($t.Global);break;case Oe.Key_W:this.selectTransformMode(at.Translation),this.selectTransformSpaceMode($t.Global);break;case Oe.Key_A:this.selectTransformSpaceMode($t.Local);break;case Oe.Key_S:this.selectTransformSpaceMode($t.Global);break}}onMouseDown(e){this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].onMouseDown(e)}onMouseMove(e){this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].onMouseMove(e)}onMouseUp(e){this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].onMouseUp(e)}}const hm=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{j0 as AccelerateDecelerateInterpolator,W0 as AccelerateInterpolator,wi as AnimationCurve,hr as AnimationCurveT,zr as AnimationMonitor,Pa as AnimatorComponent,jb as AnimatorEventKeyframe,H0 as AnticipateInterpolator,ns as AnticipateOvershootInterpolator,_u as ArrayHas,Bu as ArrayItemIndex,Of as AtlasParser,Pb as AtmosphericComponent,Ed as AtmosphericScatteringSky,kd as AtmosphericScatteringSkySetting,Fd as AtmosphericScatteringSky_shader,Vd as AttributeAnimCurve,om as AxisObject,Ga as B3DMLoader,Cf as B3DMLoaderBase,ho as B3DMParseUtil,co as B3DMParser,If as BRDFLUT,Qf as BRDFLUTGenerate,Ml as BRDF_frag,oo as BatchTable,Np as BiMap,qi as BillboardComponent,sr as BillboardType,cc as BitUtil,Va as BitmapTexture2D,Ec as BitmapTexture2DArray,to as BitmapTextureCube,Fc as Blend,kc as BlendFactor,ae as BlendMode,Io as BlendShapeData,Ro as BlendShapePropertyData,zg as BloomPost,mf as BlurEffectCreatorBlur_cs,pf as BlurEffectCreatorSample_cs,Af as BlurTexture2DBufferCreator,zt as BounceInterpolator,In as BoundUtil,ge as BoundingBox,Mr as BoundingSphere,Wr as BoundingVolume,li as BoxColliderShape,Fa as BoxGeometry,Cl as BrdfLut_frag,Vl as BsDF_frag,Nl as BxDF_frag,Gl as BxdfDebug_frag,en as BytesArray,$e as CEvent,Ra as CEventDispatcher,hs as CEventListener,Ha as CResizeEvent,Zt as CSM,Kr as Camera3D,ag as CameraControllerBase,We as CameraType,Ke as CameraUtil,Bg as CapsuleColliderShape,Jc as CastPointShadowMaterialPass,zc as CastShadowMaterialPass,Pl as Clearcoat_frag,_0 as ClusterBoundsSource_cs,gt as ClusterConfig,bl as ClusterDebug_frag,Hl as ClusterLight,D0 as ClusterLightingBuffer,v0 as ClusterLightingRender,B0 as ClusterLighting_cs,Yc as CollectInfo,qt as ColliderComponent,qe as ColliderShape,oi as ColliderShapeType,P as Color,Vp as ColorGradient,Rp as ColorLitMaterial,xd as ColorLitShader,Eb as ColorPassFragmentOutput,A0 as ColorPassRenderer,bs as ColorUtil,tn as ComData,md as Combine_cs,xl as Common_frag,yl as Common_vert,Pe as ComponentBase,xe as ComponentCollect,ti as ComputeGPUBuffer,fe as ComputeShader,ol as Context3D,Pn as CubeCamera,Df as CubeMapFaceEnum,fn as CubeSky_Shader,Ps as CubicBezierCurve,Pp as CubicBezierPath,Yh as CubicBezierType,K0 as CycleInterpolator,nu as CylinderGeometry,N0 as DDGIIrradianceComputePass,cs as DDGIIrradianceGPUBufferReader,f0 as DDGIIrradianceVolume,M0 as DDGIIrradiance_shader,L0 as DDGILightingPass,O0 as DDGILighting_shader,P0 as DDGIMultiBouncePass,G0 as DDGIProbeRenderer,rt as DEGREES_TO_RADIANS,ef as DRACO_DECODER_GLTF_JS,Z0 as DecelerateInterpolator,Ad as Denoising_cs,C0 as Depth2DTextureArray,x0 as DepthCubeArrayTexture,Wc as DepthMaterialPass,Jg as DepthOfFieldPost,td as DepthOfView_cs,yi as DirectLight,Wi as DoubleArray,jr as EditorInspector,m as Engine3D,c0 as Entity,Xc as EntityBatchCollect,J as EntityCollect,Sl as EnvMap_frag,Tt as ErpImage2CubeMap,_f as ErpImage2CubeMapCreateCube_cs,Bf as ErpImage2CubeMapRgbe2rgba_cs,Cg as ExtrudeGeometry,cr as FAILED,la as FASTFLOOR,On as FXAAPost,I0 as FXAAShader,kl as FastMathShader,Sg as FatLineGeometry,Ip as FatLineMaterial,Ni as FatLineRenderer,Pi as FatLineShader,gc as FatLine_FS,bc as FatLine_VS,ys as FeatureTable,pt as FileLoader,rg as FirstPersonCameraController,Rn as Float16ArrayTexture,sm as Float32ArrayTexture,ig as FlyCameraController,Nf as FontChar,Tf as FontInfo,Mf as FontPage,za as FontParser,J0 as ForwardRenderJob,un as FragmentOutput,wl as FragmentVarying,Uo as FrameCache,Un as Frustum,Sc as FrustumCSM,kb as FrustumCulling_cs,zl as FullQuad_vert_wgsl,ne as GBufferFrame,Gc as GBufferPass,Wg as GBufferPost,fc as GBufferStand,bn as GBuffer_pass,$n as GILighting,oh as GIProbeMaterial,Fo as GIProbeMaterialType,yd as GIProbeShader,Ln as GIRenderCompleteEvent,_s as GIRenderStartEvent,uf as GLBChunk,hf as GLBHeader,eo as GLBParser,wc as GLSLLexer,pi as GLSLLexerToken,Rc as GLSLPreprocessor,Mc as GLSLSyntax,kf as GLTFBinaryExtension,ip as GLTFMaterial,Dt as GLTFParser,vs as GLTFSubParser,tf as GLTFSubParserCamera,df as GLTFSubParserConverter,rf as GLTFSubParserMaterial,af as GLTFSubParserMesh,qn as GLTFSubParserSkeleton,sf as GLTFSubParserSkin,Yt as GLTFType,Q2 as GLTF_Accessors,Bs as GLTF_Info,E2 as GLTF_Light,I2 as GLTF_Mesh,w2 as GLTF_Node,R2 as GLTF_Primitives,k2 as GLTF_Scene,Ot as GPUAddressMode,vu as GPUBlendFactor,Qa as GPUBufferBase,aa as GPUBufferType,et as GPUCompareFunction,y as GPUContext,wt as GPUCullMode,er as GPUFilterMode,cn as GPUPrimitiveTopology,Y as GPUTextureFormat,gi as GPUVertexFormat,yu as GPUVertexStepMode,di as GSplatFormat,s0 as GSplatGeometry,e0 as GSplatMaterial,_i as GSplatRenderer,Di as GSplatShader,$c as GSplat_FS,qc as GSplat_VS,Zg as GTAOPost,ad as GTAO_cs,Pf as GUIAtlasTexture,$i as GUICanvas,Ir as GUIConfig,Jd as GUIGeometry,Zd as GUIGeometryRebuild,Co as GUIMaterial,z0 as GUIPassRenderer,Hd as GUIPick,$d as GUIPickHelper,wa as GUIQuad,Ze as GUIQuadAttrEnum,jd as GUIRenderer,yo as GUIShader,Kt as GUISpace,ri as GUISprite,mr as GUITexture,tp as GaussianSplatParser,Yl as GenerayRandomDir,ap as GeoJsonParser,rp as GeoJsonUtil,Is as GeoType,Ee as GeometryBase,r0 as GeometryIndicesBuffer,lm as GeometryUtil,t0 as GeometryVertexBuffer,bt as GeometryVertexType,ll as GetComponentClass,on as GetCountInstanceID,Qu as GetRepeat,cl as GetShader,wb as GlassShader,oe as GlobalBindGroup,xn as GlobalBindGroupLayout,jg as GlobalFog,vo as GlobalFog_shader,gg as GlobalIlluminationComponent,dn as GlobalUniform,Qn as GlobalUniformGroup,Yg as GodRayPost,rd as GodRay_cs,cm as GridObject,ro as HDRTexture,xs as HDRTextureCube,Kl as Hair_frag,Rb as Hair_shader_op,Ib as Hair_shader_tr,As as HaltonSeq,ah as Horizontal,sg as HoverCameraController,da as I3DMLoader,Ef as I3DMLoaderBase,Rf as I3DMParser,xf as IBLEnvMapCreator,Uf as IBLEnvMapCreator_cs,ba as IESProfiles,Il as IESProfiles_frag,Eg as IKDTreeUserData,ni as ImageType,a0 as IndicesGPUBuffer,Ul as Inline_vert,nl as InputSystem,pg as InstanceDrawComponent,Fl as InstanceUniform,wf as InstancedMesh,pr as Interpolator,Gn as InterpolatorEnum,_h as IrradianceDataReaderCompleteEvent,vl as IrradianceVolumeData_frag,Tl as Irradiance_frag,Au as IsEditorInspector,sn as IsNonSerialize,nf as Joint,Kn as JointPose,X0 as JumperInterpolator,Rg as KDTreeEntity,br as KDTreeNode,dh as KDTreeRange,hh as KDTreeSpace,rs as KDTreeUUID,Hn as KHR_draco_mesh_compression,sp as KHR_lights_punctual,lf as KHR_materials_clearcoat,cf as KHR_materials_emissive_strength,np as KHR_materials_ior,ff as KHR_materials_unlit,Yf as KMZParser,wo as KV,fm as KelvinUtil,Oe as KeyCode,va as KeyEvent,ks as Keyframe,Ji as KeyframeT,Cs as LDRTextureCube,Ca as LOADED,Qo as LOADING,Oh as LRUCache,Qp as LambertMaterial,$l as Lambert_shader,Es as Light,xi as LightBase,ms as LightData,d0 as LightEntries,Xe as LightType,gl as LightingFunction_frag,lt as Line,Kd as LineClassification,Y0 as LinearInterpolator,ka as LitMaterial,Ts as LitSSSShader,Ms as LitShader,Ol as Lit_shader,Jr as LoaderBase,Ig as LoaderEvent,$s as LoaderManager,ku as MAX_VALUE,Eu as MIN_VALUE,mt as Material,Oc as MaterialDataUniformGPUBuffer,Qs as MaterialUtilities,pl as MathShader,St as MathUtil,Nr as Matrix3,E as Matrix4,b0 as MatrixBindGroup,u0 as MatrixGPUBuffer,Xl as MatrixShader,Ka as MemoryDO,dl as MemoryInfo,Mg as MergeRGBACreator,id as MergeRGBA_cs,qs as MeshColliderShape,ws as MeshFilter,$ as MeshRenderer,zp as MinMaxAnimationCurves,tu as MinMaxCurve,eu as MinMaxCurveState,Jp as MinMaxPolyCurves,Og as MorePassParser,Ah as MorePassShader,Hb as MorphTargetBlender,p0 as MorphTargetData,Kb as MorphTargetFrame,Ld as MorphTargetTransformKey,Pt as MorphTarget_shader,Rs as MouseCode,V0 as MultiBouncePass_cs,iu as Navi3DAstar,Zi as Navi3DConst,ha as Navi3DEdge,Ja as Navi3DFunnel,ur as Navi3DMaskType,am as Navi3DMesh,_t as Navi3DPoint,$o as Navi3DPoint2D,fa as Navi3DPointFat,re as Navi3DRouter,su as Navi3DTriangle,rn as NonSerialize,El as NormalMap_frag,of as OAnimationEvent,gf as OBJParser,ee as Object3D,Qg as Object3DEvent,el as Object3DTransformTools,dm as Object3DUtil,Pd as ObjectAnimClip,Vn as OcclusionSystem,gr as Octree,Kc as OctreeEntity,ng as OrbitController,Op as OrderMap,jt as Orientation3D,sd as OutLineBlendColor_cs,nd as OutlineCalcOutline_cs,Qb as OutlinePass,Xg as OutlinePost,vh as OutlinePostData,Uh as OutlinePostManager,Bh as OutlinePostSlot,od as Outline_cs,q0 as OvershootInterpolator,Vh as PARSING,Ll as PBRLItShader,Cd as PBRLitSSSShader,vp as PLUGIN_REGISTERED,st as ParserBase,ze as ParserFormat,$h as ParticleSystemCurveEvalMode,Xh as ParticleSystemRandomnessIds,mi as PassGenerate,Dh as PassShader,H as PassType,ml as PhysicMaterialUniform_frag,lh as PickCompute,ch as PickFire,ft as PickGUIEvent3D,xh as PickResult,ld as Picker_cs,gn as PingPong,Fn as PipelinePool,au as Plane3D,Qr as PlaneClassification,ei as PlaneGeometry,qd as PointClassification,ai as PointLight,y0 as PointLightShadowRenderer,U0 as PointShadowCubeCamera,O as PointerEvent3D,Sa as Polynomial,Wa as PolynomialCurve,Gp as Polynomials,Yd as PoolNode,Rt as PostBase,Hf as PostProcessingComponent,E0 as PostRenderer,F0 as PreDepthPassRenderer,w0 as PreFilteredEnvironment_cs,vb as PreFilteredEnvironment_cs2,cd as PreIntegratedLut,mh as PreIntegratedLutCompute,Eo as PrefabAvatarData,wh as PrefabAvatarParser,ko as PrefabBoneData,Ih as PrefabMaterialParser,Qh as PrefabMeshData,Th as PrefabMeshParser,fs as PrefabNode,Nh as PrefabParser,hp as PrefabStringUtil,Rh as PrefabTextureData,Mh as PrefabTextureParser,ra as Preprocessor,Mo as PriorityQueue,nh as Probe,Ng as ProbeEntries,T0 as ProbeGBufferFrame,Ye as ProfilerUtil,Zb as PropertyAnimClip,Od as PropertyAnimTag,jo as PropertyAnimation,Jo as PropertyAnimationClip,Nd as PropertyAnimationClipState,Ii as PropertyAnimationEvent,Ri as PropertyHelp,Ut as QuadAABB,tc as QuadGlsl_fs,ec as QuadGlsl_vs,bh as QuadRoot,Bi as QuadShader,uh as QuadTree,Ar as QuadTreeCell,Cu as Quad_depth2dArray_frag_wgsl,Zl as Quad_depth2d_frag_wgsl,jl as Quad_depthCube_frag_wgsl,Wl as Quad_frag_wgsl,Jl as Quad_vert_wgsl,j as Quaternion,o0 as R32UintTexture,Xr as RADIANS_TO_DEGREES,vf as RGBEErrorCode,io as RGBEHeader,so as RGBEParser,ke as RTDescriptor,je as RTFrame,Ua as RTResourceConfig,vt as RTResourceMap,Yi as Rand,Tu as RandomSeed,ea as Ray,ui as RayCastMeshDetail,qr as Reader,is as Rect,me as Reference,Rd as Reflection,hc as ReflectionCG,h0 as ReflectionEntries,Qd as ReflectionMaterial,R0 as ReflectionRenderer,Id as ReflectionShader,dc as ReflectionShader_shader,Vt as RegisterComponent,Ia as RegisterShader,Nn as RenderContext,Ai as RenderLayer,kn as RenderLayerUtil,Na as RenderNode,Hc as RenderShaderCollect,ph as RenderShaderCompute,Ve as RenderShaderPass,At as RenderTexture,xa as RendererBase,Q0 as RendererJob,k0 as RendererMap,Be as RendererMask,Wt as RendererMaskUtil,m0 as RendererPassState,pn as RepeatSE,Xf as Res,cu as RotationControlComponents,uc as SHCommon_frag,ss as SN_ArrayConstant,ar as SN_BinaryOperation,h2 as SN_Break,ca as SN_CodeBlock,La as SN_Constant,Ws as SN_Continue,Ge as SN_Declaration,u2 as SN_Discard,d2 as SN_DoWhileLoop,ue as SN_Expression,Or as SN_ForLoop,zs as SN_Function,Js as SN_FunctionArgs,Pr as SN_FunctionCall,Tr as SN_IFBranch,Ta as SN_Identifier,Gr as SN_IndexOperation,Ki as SN_Layout,Qc as SN_ParenExpression,Zs as SN_Precision,Xi as SN_Return,Hi as SN_SelectOperation,Oa as SN_Struct,Tc as SN_TernaryOperation,$r as SN_UnaryOperation,Lr as SN_WhileLoop,Ub as SSAO_cs,fd as SSGI2_cs,Hg as SSGIPost,Kg as SSRPost,dd as SSR_BlendColor_cs,qg as SSR_IS_Kernel,hd as SSR_IS_cs,ud as SSR_RayTrace_cs,lu as ScaleControlComponents,Ug as Scene3D,ot as Shader,Sn as ShaderAttributeInfo,Nc as ShaderConverter,Vc as ShaderConverterResult,z as ShaderLib,ln as ShaderPassBase,Bt as ShaderReflection,ia as ShaderStage,Pc as ShaderState,Cn as ShaderUniformInfo,Ma as ShaderUtil,Rl as ShadingInput,It as ShadowLightsCollect,S0 as ShadowMapPassRenderer,Ql as ShadowMapping_frag,qb as Skeleton,js as SkeletonAnimationClip,Md as SkeletonAnimationClipState,nr as SkeletonAnimationComponent,$b as SkeletonAnimationCompute,Yr as SkeletonAnimation_shader,eg as SkeletonBlendComputeArgs,Ui as SkeletonPose,tg as SkeletonTransformComputeArgs,Vi as SkinnedMeshRenderer,lr as SkinnedMeshRenderer2,Lc as SkyGBufferPass,ac as SkyGBuffer_pass,wd as SkyMaterial,Fs as SkyRenderer,Ei as SkyShader,nm as SolidColorSky,vg as SphereColliderShape,Rr as SphereGeometry,Td as SphereReflection,Ci as SpotLight,bf as StandShader,ye as StatementNode,ve as StorageGPUBuffer,Ct as StringUtil,bi as Struct,Vg as StructStorageGPUBuffer,i0 as SubGeometry,bd as TAACopyTex_cs,$g as TAAPost,gd as TAASharpTex_cs,pd as TAA_cs,Dd as TestComputeLoadBuffer,eh as TextAnchor,ih as TextFieldLayout,rh as TextFieldLine,He as Texture,Us as TextureCube,no as TextureCubeFaceData,Ys as TextureCubeStdCreator,ao as TextureCubeUtils,Pg as TextureMipmapCompute,ua as TextureMipmapGenerator,gh as TextureScaleCompute,lg as ThirdPersonCameraController,To as Tile,Cp as TileSet,Fp as TileSetChild,kp as TileSetChildContent,Ep as TileSetChildContentMetaData,Sp as TileSetRoot,yp as TilesRenderer,Fe as Time,B as TokenType,ou as TorusGeometry,sl as TouchData,rm as TrailGeometry,Qt as Transform,R as TransformAxisEnum,Gs as TransformControllerBaseComponent,at as TransformMode,$t as TransformSpaceMode,fu as TranslationControlComponents,yn as TranslatorContext,im as TriGeometry,ts as Triangle,Yo as UIButton,sh as UIButtonTransition,So as UIComponentBase,Tg as UIEvent,Vr as UIImage,Xo as UIImageGroup,Ks as UIInteractive,Le as UIInteractiveStyle,es as UIPanel,Mi as UIRenderAble,Ho as UIShadow,Ko as UITextField,Za as UITransform,fr as UNLOADED,Et as UUID,qo as UV,n0 as Uint32ArrayTexture,wn as Uint8ArrayTexture,ql as UnLit,nt as UnLitMaterial,Al as UnLitMaterialUniform_frag,Oi as UnLitShader,Mp as UnLitTexArrayMaterial,Li as UnLitTexArrayShader,Sd as UnLitTextureArray,Dl as UnLit_frag,dt as UniformGPUBuffer,qa as UniformNode,ht as UniformType,G as ValueEnumType,tm as ValueOp,Ea as ValueParser,Wp as ValueSpread,K as Vector2,u as Vector3,Qi as Vector3Ex,te as Vector4,kg as VertexAttribute,Ud as VertexAttributeIndexShader,V as VertexAttributeName,$a as VertexAttributeSize,fh as VertexAttributeStride,_l as VertexAttributes_vert,Fg as VertexBufferLayout,ul as VertexFormat,Ds as VertexGPUBuffer,th as Vertical,Bl as VideoUniform_frag,xg as View3D,Xs as ViewPanel,Mn as ViewQuad,Ae as VirtualTexture,_p as WGS84_FLATTENING,Bp as WGS84_HEIGHT,Dp as WGS84_RADIUS,Ic as WGSLTranslator,ls as WayLines3D,os as WayPoint3D,Qe as WebGPUDescriptorCreator,hn as WorldMatrixUniform,Hs as WorldPanel,ci as WrapMode,or as WrapTimeMode,Gg as ZCullingCompute,vd as ZPassShader_cs,lc as ZPassShader_fs,oc as ZPassShader_vs,Zc as ZSorterUtil,Cc as append,yf as arrayToString,Uu as blendComponent,jp as buildCurves,Sh as byteSizeOfType,Yp as calculateCurveRangesValue,Gi as calculateMinMax,ic as castPointShadowMap_vert,se as clamp,r2 as clampRepeat,yh as computeAABBFromPositions,Yu as cos,e2 as crossProduct,Hh as cubicPolynomialRoot,Kh as cubicPolynomialRootsGeneric,Zp as curvesSupportProcedural,Wu as deg2Rad,Ch as detectGSplatFormat,nc as directionShadowCastMap_frag,ut as dot,qh as doubleIntegrateSegment,$f as downSample,xc as fastInvSqrt,Uc as floorfToIntPos,ii as fonts,t2 as generateRandom,a2 as generateRandom3,Dc as getFloatFromInt,Z2 as getGLTypeFromTypedArray,W2 as getGLTypeFromTypedArrayType,Xu as getGlobalRandomSeed,j2 as getTypedArray,Xn as getTypedArrayTypeFromGLType,Zo as grad1,Ls as grad2,zi as grad3,hi as grad4,Fh as inferSHOrder,Wo as integrateSegment,Lg as irradianceDataReader,Lp as kPI,wr as lerp,Iu as lerpByte,Ru as lerpColor,wu as lerpVector3,jh as lruPriorityCallback,An as magnitude,ab as makeAloneSprite,Vf as makeGUISprite,ps as makeMatrix44,Lo as markUsedSetLeaves,Vs as markUsedTiles,Go as markVisibleTiles,vn as matrixMultiply,o2 as matrixRotate,n2 as matrixRotateY,us as mergeFunctions,yc as multiplyMatrices4x4REF,ru as normal_distribution,$u as normalizeFast,Ac as normalizeSafe,qu as normalizedToByte,Ku as normalizedToWord,oa as outlinePostData,ep as outlinePostManager,Eh as parsePlyGaussianSplat,kh as parsePlyHeader,le as perm,ed as post,Zh as priorityCallback,Os as quadraticPolynomialRootsGeneric,Zu as rad2Deg,Hr as random01,Ju as randomBarycentricCoord,zu as randomPointBetweenEllipsoid,Lu as randomPointBetweenSphere,Pu as randomPointInsideCube,Ou as randomPointInsideEllipsoid,Gu as randomPointInsideUnitCircle,Bc as randomPointInsideUnitSphere,Nu as randomQuaternion,Vu as randomQuaternionUniformDistribution,vc as randomSeed,gs as randomUnitVector,_c as randomUnitVector2,it as rangedRandomFloat,Mu as rangedRandomInt,tt as readByType,lo as readMagicBytes,Tp as registerMaterial,Bn as repeat,s2 as rotMatrix,Fu as rotateVectorByQuat,Dn as roundfToIntPos,mn as scale,sc as shadowCastMap_frag,rc as shadowCastMap_vert,Gt as simplex,ju as sin,Kp as snoise1,qp as snoise2,$p as snoise3,em as snoise4,_n as sqrMagnitude,mc as sqrtImpl,xu as stencilStateFace,Hu as swap,_d as textureCompress,qf as threshold,wp as throttle,rr as toHalfFloat,zo as toggleTiles,Up as traverseAncestors,Lh as traverseSet,Fb as tw,Xp as uniform_real_distribution,Hp as uniform_real_distribution2,Bo as upSample,k as webGPUContext,jc as zSorterUtil};
|
|
11690
|
+
`);if(t<0)throw new Error("PLY: Invalid PLY header");const a=e.substring(0,t+11),r=a.split(/\r?\n/);let i="",n=0;const o=[];let l=!1;for(const c of r)if(c.startsWith("format "))i=c.split(/\s+/)[1];else if(c.startsWith("element ")){const f=c.split(/\s+/);l=f[1]==="vertex",l&&(n=parseInt(f[2]))}else if(l&&c.startsWith("property ")){const f=c.split(/\s+/),d=f[1],h=f[2];o.push({name:h,type:d})}if(i!=="binary_little_endian")throw new Error("PLY: Only binary_little_endian PLY is supported");return{format:i,vertexCount:n,properties:o,headerByteLength:a.length}}function Eh(s){const e=kh(s),{vertexCount:t,properties:a,headerByteLength:r}=e,i=new DataView(s,r),n=v=>a.find(x=>x.name===v)!=null,o=v=>a.findIndex(x=>x.name===v),l=new Float32Array(t*3),c=n("scale_0")?new Float32Array(t*3):void 0,f=n("rot_0")?new Float32Array(t*4):void 0,d=n("opacity")?new Float32Array(t):void 0,h=[o("f_dc_0"),o("f_dc_1"),o("f_dc_2")],b=[];for(let v=0;v<a.length;v++)a[v].name.startsWith("f_rest_")&&b.push(v);const p=h[0]>=0&&h[1]>=0&&h[2]>=0;let g,A=0;if(p){const v=1+b.length/3;A=Fh(v),g=new Float32Array(t*v*3)}const D=[];let _=0;for(const v of a)D.push(_),_+=Sh(v.type);let U=0;for(let v=0;v<t;v++){const x=U,C=o("x"),F=o("y"),w=o("z");if(C<0||F<0||w<0)throw new Error("PLY: Missing x/y/z for vertex");if(l[v*3+0]=tt(i,x+D[C],a[C].type),l[v*3+1]=tt(i,x+D[F],a[F].type),l[v*3+2]=tt(i,x+D[w],a[w].type),c){const S=o("scale_0"),M=o("scale_1"),T=o("scale_2");c[v*3+0]=tt(i,x+D[S],a[S].type),c[v*3+1]=tt(i,x+D[M],a[M].type),c[v*3+2]=tt(i,x+D[T],a[T].type)}if(f){const S=o("rot_0"),M=o("rot_1"),T=o("rot_2"),Q=o("rot_3"),L=tt(i,x+D[S],a[S].type),X=tt(i,x+D[M],a[M].type),ie=tt(i,x+D[T],a[T].type),q=tt(i,x+D[Q],a[Q].type);f[v*4+0]=X,f[v*4+1]=ie,f[v*4+2]=q,f[v*4+3]=L}if(d){const S=o("opacity");d[v]=tt(i,x+D[S],a[S].type)}if(p&&g){const S=1+b.length/3,M=v*S*3;g[M+0]=tt(i,x+D[h[0]],a[h[0]].type),g[M+S+0]=tt(i,x+D[h[1]],a[h[1]].type),g[M+2*S+0]=tt(i,x+D[h[2]],a[h[2]].type);let T=1,Q=1,L=1;for(let X=0;X<b.length;X+=3){const ie=b[X+0],q=b[X+1],be=b[X+2];g[M+T]=tt(i,x+D[ie],a[ie].type),g[M+S+Q]=tt(i,x+D[q],a[q].type),g[M+2*S+L]=tt(i,x+D[be],a[be].type),T++,Q++,L++}}U+=_}return{vertexCount:t,position:l,scale:c,rotation:f,opacity:d,sh:p&&g?{order:A,coeffs:g}:void 0}}class tp extends st{static format=ze.BIN;async parseBuffer(e){const t=Ch(e);let a;switch(t){case di.PLY:{const r=Eh(e);a={count:r.vertexCount,position:r.position,rotation:r.rotation,scale:r.scale,opacity:r.opacity,sh:r.sh},a.bbox=yh(r.position);break}case di.SPLAT:throw new Error("SPLAT format is not yet supported");case di.KSPLAT:throw new Error("KSPLAT format is not yet supported");case di.UNKNOWN:default:throw new Error("Unknown or unsupported Gaussian Splatting file format")}return this.data=a,a}verification(){return!!this.data&&this.data.count>0}}var Is=(s=>(s.Point="Point",s.LineString="LineString",s.MultiPolygon="MultiPolygon",s))(Is||{});class ap extends st{static format=ze.JSON;json;async parseString(e){this.json=e,this.data=JSON.parse(e)}}class rp{static getPath(e){let t=[];for(let a=0;a<e.features.length;a++){const r=e.features[a];switch(r.geometry.type){case Is.LineString:break;case Is.MultiPolygon:let i=[];for(let n=0;n<r.geometry.coordinates.length;n++){const o=r.geometry.coordinates[n];for(const l of o)for(const c of l){let f=new u(c[0],0,c[1]);i.push(f)}}t.push(i);break}}return t}}class ip{name;defines;doubleSided;baseColorFactor;emissiveFactor;metallicFactor;roughnessFactor;alphaCutoff;enableBlend;baseColorTexture;metallicRoughnessTexture;normalTexture;occlusionTexture;emissiveTexture;extensions;baseMapOffsetSize;normalMapOffsetSize;emissiveMapOffsetSize;roughnessMapOffsetSize;metallicMapOffsetSize;aoMapOffsetSize}class sp{}class np{}class ko{boneName;bonePath;parentBoneName;boneID;parentBoneID;instanceID;parentInstanceID;t;q;s;formBytes(e){this.boneName=e.readUTF(),this.bonePath=e.readUTF(),this.parentBoneName=e.readUTF(),this.boneID=e.readInt32(),this.parentBoneID=e.readInt32(),this.instanceID=e.readUTF(),this.parentInstanceID=e.readUTF(),this.t=e.readVector3(),this.q=e.readQuaternion(),this.s=e.readVector3()}}class Eo{name;count;boneData;boneMap;formBytes(e){this.boneData=[],this.boneMap=new Map,this.name=e.readUTF(),this.count=e.readInt32();for(let t=0;t<this.count;t++){let a=new ko;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class wh extends st{static format=ze.BIN;static parser(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Eo;i.formBytes(e.readBytesArray()),m.res.addObj(i.name,i)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}V.position,V.normal,V.color,V.TANGENT,V.uv,V.TEXCOORD_1,V.TEXCOORD_2,V.TEXCOORD_2,V.TEXCOORD_4,V.TEXCOORD_5,V.TEXCOORD_6,V.TEXCOORD_7,V.joints0,V.weights0;var G=(s=>(s[s.single=0]="single",s[s.boolean=1]="boolean",s[s.int=2]="int",s[s.int16=3]="int16",s[s.int32=4]="int32",s[s.float=5]="float",s[s.long=6]="long",s[s.uint=7]="uint",s[s.uint32=8]="uint32",s[s.uint64=9]="uint64",s[s.double=10]="double",s[s.string=11]="string",s[s.singleArray=12]="singleArray",s[s.stringArray=13]="stringArray",s[s.floatArray=14]="floatArray",s[s.vector2=15]="vector2",s[s.vector3=16]="vector3",s[s.vector4=17]="vector4",s[s.color=18]="color",s[s.color32=19]="color32",s[s.animationCurve=20]="animationCurve",s[s.quaternion=21]="quaternion",s[s.matrix4x4=22]="matrix4x4",s[s.mesh=23]="mesh",s[s.texture=24]="texture",s[s.material=25]="material",s[s.materials=26]="materials",s[s.skeleton=27]="skeleton",s[s.animClip=28]="animClip",s[s.vector2Int=29]="vector2Int",s[s.int32List=30]="int32List",s[s.colorList=31]="colorList",s[s.color32List=32]="color32List",s))(G||{});class Qs{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=cl(t);if(r){let i=new mt;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 G.color:case G.color32:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformColor(i,n)}break;case G.single:case G.float:case G.int:case G.int16:case G.int32:case G.uint:case G.uint32:case G.uint64:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case G.singleArray:{let n=r.getValue()[0];i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformFloat(i,n)}break;case G.vector2:case G.vector2Int:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector2(i,n)}break;case G.vector3:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector3(i,n)}break;case G.vector4:{let n=r.getValue();i in e?e[i]=n:i in e.shader?e.shader[i]=n:e.setUniformVector4(i,n)}break}}}}class Ea{static parser(e){switch(e.readInt32()){case G.single:return{t:G.single,v:e.readFloat32()};case G.boolean:return{t:G.boolean,v:e.readBoolean()};case G.int:return{t:G.int,v:e.readInt32()};case G.int16:return{t:G.int16,v:e.readInt16()};case G.int32:return{t:G.int32,v:e.readInt32()};case G.float:return{t:G.float,v:e.readFloat32()};case G.long:return{t:G.long,v:e.readFloat64()};case G.uint:return{t:G.uint,v:e.readUnit32()};case G.uint32:return{t:G.uint32,v:e.readUnit32()};case G.uint64:return{t:G.uint64,v:e.readUnit32()};case G.double:return{t:G.double,v:e.readFloat64()};case G.string:return{t:G.string,v:e.readUTF()};case G.singleArray:return{t:G.singleArray,v:e.readFloatArray()};case G.stringArray:return{t:G.stringArray,v:e.readStringArray()};case G.floatArray:return{t:G.floatArray,v:e.readFloatArray()};case G.vector2:return{t:G.vector2,v:e.readVector2()};case G.vector3:return{t:G.vector3,v:e.readVector3()};case G.vector4:return{t:G.vector4,v:e.readVector4()};case G.color:return{t:G.color,v:e.readColor()};case G.color32:return{t:G.color32,v:e.readColor()};case G.animationCurve:return{t:G.animationCurve,v:null};case G.quaternion:return{t:G.quaternion,v:e.readQuaternion()};case G.matrix4x4:return{t:G.matrix4x4,v:null};case G.mesh:{let o=e.readUTF(),l=m.res.getGeometry(o);return{t:G.mesh,v:l}}case G.texture:{let o=e.readUTF(),l=m.res.getTexture(o);return{t:G.texture,v:l}}case G.material:{let o=e.readUTF(),l=m.res.getMat(o);return{t:G.material,v:l}}case G.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let d=m.res.getMat(f);l.push(d)}return{t:G.materials,v:l}}case G.skeleton:break;case G.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new Jo;f.formBytes(e),o.push(f)}return{t:G.animClip,v:o}}case G.vector2Int:return{t:G.vector2Int,v:e.readVector2int()};case G.int32List:return{t:G.int32List,v:e.readInt32List()};case G.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Ea.parser(e).v;r.push(l)}return{t:G.colorList,v:r};case G.color32List:let i=e.readInt32(),n=[];for(let o=0;o<i;o++){const l=Ea.parser(e).v;n.push(l)}return{t:G.color32List,v:n}}}}class wo{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Ea.parser(e);this.type=t,this._data=a}}class Rh{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class Ih extends st{static format=ze.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),n=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],d=[],h=i.readInt32();for(let g=0;g<h;g++){let A=new wo;A.formBytes(i),f.push(A)}let b=i.readInt32();for(let g=0;g<b;g++){let A=i.readBytesArray(),D=new Rh;D.property=A.readUTF(),D.name=A.readUTF(),D.texture=m.res.getTexture(D.name),D.texelSize=A.readVector2(),D.wrapModeU=A.readUnit32(),D.wrapModeV=A.readUnit32(),D.wrapModeW=A.readUnit32(),D.wrapMode=A.readUnit32(),D.anisoLevel=A.readUnit32(),D.dimension=A.readUnit32(),D.filterMode=A.readUnit32(),d.push(D)}let p=Qs.GetMaterial(c);p.name=n;for(let g=0;g<l.length;g++){const A=l[g];p.shader.setDefine(A,!0)}Qs.applyMaterialTexture(p,d),Qs.applyMaterialProperties(p,f),m.res.addMat(o,p)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Ro{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 Io{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 Ro;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class Qh{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class Th extends st{static format=ze.BIN;async parseBuffer(e){}static parserMeshs(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Qh,n=e.readBytesArray();i.meshName=n.readUTF(),i.meshID=n.readUTF(),n.readFloat32()>0,n.readFloat32()>0,n.readFloat32()>0;let o=n.readFloat32()>0,l=n.readFloat32()>0;o&&(i.bones=n.readStringArray(),i.bindPose=n.readMatrix44Array()),l&&(i.blendShapeData=new Io,i.blendShapeData.formBytes(n));let c=n.readBytesArray(),f=n.readBytesArray(),d=c.readInt32(),h=0,b=[];for(let _=0;_<d;_++)b[_]={},b[_].att=op[c.readUTF()],b[_].dim=c.readInt32(),h+=b[_].dim,b[_].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let p=n.readInt32Array(),g=[],A=n.readInt32();for(let _=0;_<A;_++){let U=n.readInt32(),v=n.readInt32(),x=n.readInt32(),C=n.readInt32(),F=n.readInt32(),w=n.readInt32();n.readVector3(),n.readVector3();let S={indexStart:v,indexCount:x,vertexStart:C,vertexCount:w,firstStart:F,topology:U,index:_};g.push(S)}p.length>65535?i.indices=new Uint32Array(p):i.indices=new Uint16Array(p);let D=new Ee;if(D.vertexDim=h,D.geometryType=bt.compose_bin,D.setIndices(i.indices),D.setAttribute(V.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 U=0;U<i.blendShapeData.blendCount;U++){let v=i.blendShapeData.shapeNames[U],x=i.blendShapeData.shapeIndexs[U];D.morphTargetDictionary[v]=x}}}for(let _=0;_<b.length;_++){const U=b[_].att;D.setAttribute(U,null)}for(let _=0;_<g.length;_++){const U=g[_];D.addSubGeometry(U)}D.name=i.meshName,m.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let op={Position:V.position,Normal:V.normal,Color:V.color,Tangent:V.TANGENT,TexCoord0:V.uv,TexCoord1:V.TEXCOORD_1,TexCoord2:V.TEXCOORD_2,TexCoord3:V.TEXCOORD_2,TexCoord4:V.TEXCOORD_4,TexCoord5:V.TEXCOORD_5,TexCoord6:V.TEXCOORD_6,TexCoord7:V.vIndex,BlendIndices:V.joints0,BlendWeight:V.weights0};class en 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 en(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 K;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new K;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new u;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 te;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 P;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 j;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 E,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 Mh extends st{static format=ze.TEXT;static async parserTexture(e,t,a){let r=e.readInt32(),i=[];for(let o=0;o<r;o++){let l=e.readUTF();Nh.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let n=await m.res.loadBitmapTextures(i,m.setting.loader.numConcurrent,a,!0);for(const o of n)m.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var lp=Object.getOwnPropertyDescriptor,cp=(s,e,t,a)=>{for(var r=a>1?void 0:a?lp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ts=class extends ot{constructor(){super(),z.register("PBRLitSSSShader",Cd);let s=new Ve("PBRLitSSSShader","PBRLitSSSShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefine("USE_CUSTOMUNIFORM",!0),this.setDefault(),this.computes=[new mh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformColor("emissiveColor",new P(1,1,1)),this.setUniformVector4("materialF0",new te(.04,.04,.04,1)),this.setUniformColor("specularColor",new P(.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 P(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new P(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _SSSMap(s){this.setTexture("sssMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SkinColor(s){this.setUniformColor("skinColor",s)}set _SkinPower(s){this.setUniformFloat("skinPower",s)}set _SkinColorIns(s){this.setUniformFloat("skinColorIns",s)}set curveFactor(s){this.setUniformFloat("curveFactor",s)}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Ts=cp([Ia(Ts,"LitSSSShader")],Ts);var fp=Object.getOwnPropertyDescriptor,dp=(s,e,t,a)=>{for(var r=a>1?void 0:a?fp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Ms=class extends ot{constructor(){super();let s=new Ve("PBRLItShader","PBRLItShader");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!0,e.castShadow=!0,e.receiveEnv=!0,e.acceptGI=!0,e.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformColor("emissiveColor",new P(0,0,0)),this.setUniformVector4("materialF0",new te(.04,.04,.04,1)),this.setUniformColor("specularColor",new P(.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 P(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=m.res.grayTexture,this._BumpMap=m.res.normalTexture,this._MaskTex=m.res.maskTexture}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Ms=dp([Ia(Ms,"LitShader")],Ms);class tn{comName;data;static parser(e){let t=e.readBytesArray(),a=new tn;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let n=new wo;n.formBytes(t),a.data.push(n)}return a}}class fs{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new fs;a.name=t.readUTF(),a.parentName=t.readUTF(),a.position=t.readVector3(),a.rotation=t.readQuaternion(),a.scale=t.readVector3(),a.comDatas=[],a.child=[];let r=t.readInt32();for(let n=0;n<r;n++){const o=tn.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let n=0;n<i;n++){const o=fs.parser(t);a.child.push(o)}return a}}class Nh extends st{static useWebp=!0;static format=ze.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new en(e,0);await Mh.parserTexture(t,this,this.loaderFunctions),wh.parser(t,this),Th.parserMeshs(t,this),Ih.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return fs.parser(e)}parserNodeTree(e){let t=new ee;if(t.localPosition=u.serialize(e.position),t.localQuaternion=j.serialize(e.rotation),t.localScale=u.serialize(e.scale),t.name=e.name,e.comDatas)for(let a=0;a<e.comDatas.length;a++){const r=e.comDatas[a];let i=null,n=ll(r.comName);if(n){i=t.getOrAddComponent(n);for(let o=0;o<r.data.length;o++){const l=r.data[o];l.key in i&&(i[l.key]=l.getValue())}}}if(e.child&&e.child.length>0)for(let a=0;a<e.child.length;a++){let r=this.parserNodeTree(e.child[a]);t.addChild(r)}return t}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class hp{static getNumber(e){return parseFloat(e)}static getInt(e){return parseInt(e)}static getBoolean(e){return e=="true"}static getNumberArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(",");for(let r=0;r<a.length;r++)parseFloat(a[r]);return t}static getStringArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(","),r=[];for(let i=0;i<a.length;i++){const n=a[i];r.push(n)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var up=Object.getOwnPropertyDescriptor,bp=(s,e,t,a)=>{for(var r=a>1?void 0:a?up(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Pi=class extends ot{constructor(){super();const s=new Ve("FatLine_VS","FatLine_FS");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);const e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,e.cullMode=wt.none,e.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new P(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new K(1920,1080));const s=new E;this.getDefaultColorShader().setUniform("modelMatrix",s.rawData)}};Pi=bp([Ia(Pi,"FatLineShader")],Pi);var gp=Object.getOwnPropertyDescriptor,pp=(s,e,t,a)=>{for(var r=a>1?void 0:a?gp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Oi=class extends ot{constructor(){super();let s=new Ve("UnLit","UnLit");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Oi=pp([Ia(Oi,"UnLitShader")],Oi);var mp=Object.getOwnPropertyDescriptor,Ap=(s,e,t,a)=>{for(var r=a>1?void 0:a?mp(e,t):e,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=n(r)||r);return r};let Li=class extends ot{constructor(){super(),z.register("VertexAttributeIndexShader",Ud),z.register("UnLitTextureArray",Sd);let s=new Ve("UnLitTextureArray","UnLitTextureArray");s.setShaderEntry("VertMain","FragMain"),this.addRenderPass(s);let e=s.shaderState;e.acceptShadow=!1,e.castShadow=!1,e.receiveEnv=!1,e.acceptGI=!1,e.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new te(0,0,1,1)),this.setUniformVector4("transformUV2",new te(0,0,1,1)),this.setUniformColor("baseColor",new P),this.setUniformFloat("alphaCutoff",0)}set _MainTex(s){this.setTexture("baseMap",s)}set _BumpMap(s){this.setTexture("normalMap",s)}set _MaskTex(s){this.setTexture("maskMap",s)}set _UVTransform(s){this.setUniformVector4("transformUV1",s)}set _Metallic(s){this.setUniformFloat("metallic",s)}set _Roughness(s){this.setUniformFloat("roughness",s)}set _MainColor(s){this.setUniformColor("baseColor",s)}set _AlphaCutoff(s){this.setUniformFloat("alphaCutoff",s)}set _DoubleSidedEnable(s){let e=this.getDefaultColorShader();e.shaderState.cullMode=s?wt.none:e.shaderState.cullMode}set _SurfaceType(s){let e=this.getDefaultColorShader();s==0?e.blendMode=ae.NONE:e.blendMode=ae.ALPHA}set _AlphaCutoffEnable(s){s==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}};Li=Ap([Ia(Li,"UnLitTexArrayShader")],Li);const cr=-1,fr=0,Qo=1,Vh=2,Ca=3,Dp=6378137,_p=1/298.257223563,Bp=6356752314245179e-9,vp=Symbol("PLUGIN_REGISTERED");class To{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=fr;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 Oh{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,n=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-n<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,n+=c)}}clear(){Array.from(this._itemSet.keys()).forEach(t=>this.remove(t))}getStats(){return{size:this._itemSet.size,bytes:this._cachedBytes,usedCount:this._usedSet.size}}}class Mo{maxJobs=6;autoUpdate=!0;priorityCallback=null;_items=[];_callbacks=new Map;_currJobs=0;_scheduled=!1;_schedulingCallback;constructor(){this._schedulingCallback=e=>{requestAnimationFrame(e)}}set schedulingCallback(e){this._schedulingCallback=e}get running(){return this._items.length!==0||this._currJobs!==0}sort(){this.priorityCallback&&this._items.sort(this.priorityCallback)}has(e){return this._callbacks.has(e)}add(e,t){if(this._callbacks.has(e))return this._callbacks.get(e).promise;let a,r;const i=new Promise((o,l)=>{a=o,r=l}),n={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,n),this.autoUpdate&&this._scheduleJobRun(),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))}_scheduleJobRun(){this._scheduled||(this._scheduled=!0,this._schedulingCallback(()=>{this._scheduled=!1,this._tryRunJobs()}))}_tryRunJobs(){this.sort();const e=this.maxJobs;let t=0;const a=()=>{this._currJobs--,this.autoUpdate&&this._scheduleJobRun()};for(;e>this._currJobs&&this._items.length>0&&t<e;){this._currJobs++,t++;const r=this._items.shift(),i=this._callbacks.get(r);this._callbacks.delete(r),Promise.resolve(i.callback(r)).then(()=>{i.resolve(),a()}).catch(n=>{i.reject(n),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function Lh(s,e=null,t=null){const a=[];for(a.push(s),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),n=a.pop();if(e&&e(n,i,r)===!0){t&&t(n,i,r);return}const o=n.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(n),a.push(r+1);if(t&&t(n,i,r)===!0)return}}function Up(s,e){let t=s;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const Ns={inView:!1,error:1/0,distanceFromCamera:1/0},Gh=!0;function zh(s){return s===Ca||s===cr}function dr(s,e){return s.lastFrameVisited===e&&s.used}function Jh(s){return s.childrenProcessed===s.children.length}function No(s){return s.hasUnrenderableContent||s.parent!==null&&s.parent.geometricError<s.geometricError}function Vo(s,e){s.lastFrameVisited!==e.frameCount&&(s.usedLastFrame=s.used,s.lastFrameVisited=e.frameCount,s.used=!1,s.inFrustum=!1,s.isLeaf=!1,s.visible=!1,s.active=!1,s.error=1/0,s.distanceFromCamera=1/0,s.allChildrenReady=!1,e.calculateTileViewError(s,Ns),s.inFrustum=Ns.inView,s.error=Ns.error,s.distanceFromCamera=Ns.distanceFromCamera)}function Po(s,e,t=!1){s.used||(t||(s.used=!0,e.stats.used++),e.markTileUsed(s),s.inFrustum===!0&&e.stats.inFrustum++)}function xp(s,e){if(s.canTraverse&&s.canTraverseFrame===e.frameCount)return s.canTraverse;let t=!1;return s.error<=e.errorTarget&&!No(s)||s.depth>=e.maxDepth||!s.children||s.children.length===0?t=!1:t=!0,s.canTraverse=t,s.canTraverseFrame=e.frameCount,t}function Oo(s,e,t=!1){if(e.ensureChildrenArePreprocessed(s),Vo(s,e),Po(s,e,t),No(s)&&Jh(s)){const a=s.children;for(let r=0,i=a.length;r<i;r++)Oo(a[r],e,t)}}function Vs(s,e){if(e.ensureChildrenArePreprocessed(s),Vo(s,e),!s.inFrustum)return;if(!xp(s,e)){Po(s,e);const n=s.children;if(!s.hasContent&&n&&n.length>0)for(let o=0,l=n.length;o<l;o++){const c=n[o];Vs(c,e)}return}const a=s.children;let r=!1,i=!1;for(let n=0,o=a.length;n<o;n++){const l=a[n];Vs(l,e),r=r||dr(l,e.frameCount),i=i||l.inFrustum}if(s.refine==="REPLACE"&&!i&&a.length!==0){s.inFrustum=!1;for(let n=0,o=a.length;n<o;n++)Oo(a[n],e,!0);return}if(Po(s,e),s.refine==="REPLACE"&&(r&&s.depth!==0||Gh))for(let n=0,o=a.length;n<o;n++)Oo(a[n],e)}function Lo(s,e){const t=e.frameCount;if(!dr(s,t))return;const a=s.children;let r=!1;for(let i=0,n=a.length;i<n;i++){const o=a[i];r=r||dr(o,t)}if(!r)s.isLeaf=!0;else{let i=!0;for(let n=0,o=a.length;n<o;n++){const l=a[n];if(Lo(l,e),dr(l,t)){const c=!No(l);let f=!l.hasContent||l.hasRenderableContent&&zh(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===cr;f=c&&f||l.allChildrenReady,i=i&&f}}s.allChildrenReady=i}}function Wh(s,e){if(e.ensureChildrenArePreprocessed(s),dr(s,e.frameCount)&&(s.hasContent&&e.queueTileForDownload(s),Jh(s))){const t=s.children;for(let a=0,r=t.length;a<r;a++)Wh(t[a],e)}}function Go(s,e){const t=e.stats;if(!dr(s,e.frameCount))return;if(s.isLeaf){s.loadingState===Ca?(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++):s.hasContent&&e.queueTileForDownload(s);return}const a=s.children,r=s.hasContent,i=zh(s.loadingState)&&r,n=(e.errorTarget+1)*(e.errorThreshold||1),o=s.error<=n,l=s.refine==="ADD",c=s.allChildrenReady||s.depth===0&&!Gh;if(r&&(o||l)&&e.queueTileForDownload(s),(o&&i&&!c||i&&l)&&(s.inFrustum&&(s.visible=!0,t.visible++),s.active=!0,t.active++),!l&&o&&!c)for(let f=0,d=a.length;f<d;f++){const h=a[f];dr(h,e.frameCount)&&Wh(h,e)}else for(let f=0,d=a.length;f<d;f++)Go(a[f],e)}function zo(s,e){const t=dr(s,e.frameCount);if(t||s.usedLastFrame){let a=!1,r=!1;if(t?(a=s.active,r=s.visible):Vo(s,e),s.hasRenderableContent&&s.loadingState===Ca){const n=s.__wasSetVisible;s.__wasSetActive!==a&&(e.setTileActive(s,a),s.__wasSetActive=a),n!==r&&(e.setTileVisible(s,r),s.__wasSetVisible=r)}s.usedLastFrame=t;const i=s.children;for(let n=0,o=i.length;n<o;n++)zo(i[n],e)}}class Wr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Wr.s_tmpMatrix||(Wr.s_tmpMatrix=new E),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 u(e[0],e[1],e[2]),a=new u(e[3],e[4],e[5]),r=new u(e[6],e[7],e[8]),i=new u(e[9],e[10],e[11]),n=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),d=i.clone().normalize();this._matrix=new E;const h=this._matrix.rawData;h[0]=c.x,h[1]=c.y,h[2]=c.z,h[3]=0,h[4]=f.x,h[5]=f.y,h[6]=f.z,h[7]=0,h[8]=d.x,h[9]=d.y,h[10]=d.z,h[11]=0,h[12]=t.x,h[13]=t.y,h[14]=t.z,h[15]=1;const b=new u(n*2,o*2,l*2);this._box=new pe(new u(0,0,0),b)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new u(e[0],e[1],e[2]),a=e[3];this._sphere=new Mr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,n,o]=e,l=new u((t+r)/2,(a+i)/2,(n+o)/2),c=new u(Math.abs(r-t),Math.abs(i-a),Math.abs(o-n));this._box=new pe(l,c),this._matrix=new E,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new u(a.x-r,a.y-r,a.z-r),n=new u(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,n),t){const o=[new u(i.x,i.y,i.z),new u(n.x,i.y,i.z),new u(i.x,n.y,i.z),new u(n.x,n.y,i.z),new u(i.x,i.y,n.z),new u(n.x,i.y,n.z),new u(i.x,n.y,n.z),new u(n.x,n.y,n.z)];o.forEach(l=>{const c=new u;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Wr.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 u(r.min.x,r.min.y,r.min.z),new u(r.max.x,r.min.y,r.min.z),new u(r.min.x,r.max.y,r.min.z),new u(r.max.x,r.max.y,r.min.z),new u(r.min.x,r.min.y,r.max.z),new u(r.max.x,r.min.y,r.max.z),new u(r.min.x,r.max.y,r.max.z),new u(r.max.x,r.max.y,r.max.z)];i.forEach(n=>{const o=new u;a.transformPoint(n,o),n.copyFrom(o)}),e.makeEmpty(),i.forEach(n=>{e.expandByPoint(n)})}else e.setFromMinMax(this._box.min,this._box.max);return e}throw new Error("BoundingVolume: Invalid state")}getOBB(e,t){this._type==="box"&&this._box&&this._matrix?(e.setFromMinMax(this._box.min,this._box.max),t.copyFrom(this._matrix)):(this.getAABB(e),t.identity())}getSphere(e){if(this._type==="sphere"&&this._sphere)return e.center.copyFrom(this._sphere.center),e.radius=this._sphere.radius,e;const t=new pe;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 u;t.transformPoint(a,o),r=o}const i=this._sphere.radius,n=e.clone().subtract(r).length;return Math.max(0,n-i)}else if(this._box){const a=new pe;this.getAABB(a,t);const r=a.center,i=a.size,n=Math.max(0,Math.abs(e.x-r.x)-i.x*.5),o=Math.max(0,Math.abs(e.y-r.y)-i.y*.5),l=Math.max(0,Math.abs(e.z-r.z)-i.z*.5);return Math.sqrt(n*n+o*o+l*l)}return 1/0}intersectsFrustum(e,t){if(this._type==="sphere"&&this._sphere){const a=new pe;return this.getAABB(a,t),e.containsBox2(a)>0}else if(this._box){const a=new pe;return this.getAABB(a,t),e.containsBox2(a)>0}return!1}}const Zh=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.used!==e.used?s.used?1:-1:s.error!==e.error?s.error>e.error?1:-1:s.distanceFromCamera!==e.distanceFromCamera?s.distanceFromCamera>e.distanceFromCamera?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},jh=(s,e)=>{const t=s.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:s.lastFrameVisited!==e.lastFrameVisited?s.lastFrameVisited>e.lastFrameVisited?-1:1:s.depthFromRenderedParent!==e.depthFromRenderedParent?s.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:s.loadingState!==e.loadingState?s.loadingState>e.loadingState?-1:1:s.hasUnrenderableContent!==e.hasUnrenderableContent?s.hasUnrenderableContent?-1:1:s.error!==e.error?s.error>e.error?-1:1:0};class yp{rootLoadingState=fr;rootTileSet=null;rootURL=null;fetchOptions={};frameCount=0;isLoading=!1;lruCache;loadQueue;processNodeQueue;plugins=[];_queuedTiles=[];_cachedSinceLoadComplete=new Set;_processedTiles=new WeakSet;_visibleTiles=new Set;_usedSet=new Set;_cacheHits=0;_cacheMisses=0;stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0,inCacheSinceLoad:0};errorTarget=16;errorThreshold=1;maxDepth=30;displayActiveTiles=!1;onRootTileLoaded;rtcOffset=null;_root=null;_activeTiles=new Set;group;cameras=[];_cameraMap=new Map;_cameraInfo=[];_upRotationMatrix=new E;_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 Oh,this.lruCache.unloadPriorityCallback=jh,this.loadQueue=new Mo,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=Zh,this.processNodeQueue=new Mo,this.processNodeQueue.maxJobs=25,this.group=new ee,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===fr&&(this.rootLoadingState=Qo,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=Ca,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),d=this.preprocessNode(c.root,f,null);this._root=d;const h=new Wr(d.boundingVolume),b=new Mr;h.getSphere(b);const p=new pe;if(h.getAABB(p),this.rtcOffset=new u(-b.center.x,-b.center.y,-b.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:b.center,radius:b.radius,boundingBox:p,rtcOffset:this.rtcOffset})}catch(g){console.warn("Failed to calculate bounding volume for root tile:",g)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=cr,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const n=this.root;if(!n)return;a.inFrustum=0,a.used=0,a.active=0,a.visible=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.updateCameraInfo(),Vs(n,this),Lo(n,this),Go(n,this),zo(n,this);const o=this._queuedTiles;e.unloadPriorityCallback&&o.sort(e.unloadPriorityCallback);for(let c=0,f=o.length;c<f&&!e.isFull();c++)this.requestTileContents(o[c]);o.length=0,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&&Lh(this.root,(r,i,n)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,n):!1),t)}registerPlugin(e){if(this.plugins.includes(e))return;const t=e.priority||0;let a=this.plugins.length;for(let r=0;r<this.plugins.length;r++)if((this.plugins[r].priority||0)>t){a=r;break}this.plugins.splice(a,0,e),e.init&&e.init(this)}unregisterPlugin(e){const t=this.plugins;let a;if(typeof e=="string"?a=t.find(r=>r.name===e):a=e,a&&t.includes(a)){const r=t.indexOf(a);return t.splice(r,1),a.dispose&&a.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}calculateTileViewError(e,t){const a=e.cached,r=this.cameras,i=this._cameraInfo,n=a.boundingVolume;if(!n){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,d=1/0;const h=a.worldTransform;for(let b=0,p=r.length;b<p;b++){const g=i[b];let A,D;if(g.isOrthographic){const U=g.pixelSize;A=e.geometricError/U,D=1/0}else{const U=g.sseDenominator;D=n.distanceToPoint(g.position,h),A=D===0?1/0:e.geometricError/(D*U)}const _=i[b].frustum;n.intersectsFrustum(_,h)&&(o=!0,l=Math.max(l,A),c=Math.min(c,D)),f=Math.max(f,A),d=Math.min(d,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=d)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new u,frustum:new Un,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],n=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(n.position.copyFrom(l),n.frustum=i.frustum,n.isOrthographic=i.type===We.ortho,n.isOrthographic){const c=i.frustumSize;n.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;n.sseDenominator=2*Math.tan(f/2)/o.height}}}preprocessNode(e,t,a=null){if(this._processedTiles.has(e))return e;this._processedTiles.add(e);let r;if(e instanceof To?r=e:r=new To(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 Wr(r.boundingVolume);r.cached.boundingVolume=c}const i=new u(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),n=new E;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)n.rawData[f]=c[f]}if(!a){n.copyFrom(this._upRotationMatrix);const c=new u;c.copyFrom(i),c.applyMatrix4(n);const f=r.cached.boundingVolume.box,d=[new u(f.min.x,f.min.y,f.min.z),new u(f.max.x,f.min.y,f.min.z),new u(f.min.x,f.max.y,f.min.z),new u(f.max.x,f.max.y,f.min.z),new u(f.min.x,f.min.y,f.max.z),new u(f.max.x,f.min.y,f.max.z),new u(f.min.x,f.max.y,f.max.z),new u(f.max.x,f.max.y,f.max.z)];for(const p of d)p.applyMatrix4(n);const h=new pe;d.forEach(p=>{h.expandByPoint(p)}),n.rawData[12]=-c.x,n.rawData[13]=-c.y,n.rawData[14]=-c.z;const b=h.min;n.rawData[13]-=b.y}const o=new E;o.copyFrom(n),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,n);const l=new E;if(l.copyFrom(o),l.invert(),r.cached.transfrom=n,r.cached.worldTransform=o,r.cached.transformInverse=l,e.children&&e.children.length>0){r.children=[];for(let c=0;c<e.children.length;c++){const f=e.children[c],d=this.preprocessNode(f,t,r);r.children.push(d)}r.childrenProcessed=r.children.length}return r}ensureChildrenArePreprocessed(e,t=!1){const a=e.children;for(let r=0,i=a.length;r<i;r++){const n=a[r];n.basePath!==void 0&&n.basePath!==""||n.cached.boundingVolume||(t?(this.processNodeQueue.remove(n),this.preprocessNode(n,e.basePath,e)):this.processNodeQueue.has(n)||this.processNodeQueue.add(n,o=>{this.preprocessNode(o,e.basePath,e)}))}}_recordCacheHit(){this._cacheHits++}_recordCacheMiss(){this._cacheMisses++}resetCacheStats(){this._cacheHits=0,this._cacheMisses=0}requestTileContents(e){if(e.loadingState!==fr){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=Qo,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=cr,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async n=>{try{await this.parseTileContent(n,r,i),this.stats.downloading--}catch(o){n.loadingState=cr,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=Vh;const i=(l=>{const c=l.split(".");return c.length>1?c[c.length-1]:""})(t),n=a;let o=null;switch(i.toLowerCase()){case"b3dm":o=(await new pt().load(n,co,{onProgress:f=>{},onComplete:f=>{}})).data;break;case"i3dm":o=await m.res.loadI3DM(n,{onProgress:f=>{},onComplete:f=>{}});break;case"glb":case"gltf":o=await m.res.loadGltf(n,{onProgress:f=>{},onComplete:f=>{}});break;case"pnts":console.warn("PNTS format not yet supported");break;case"json":try{const f=await m.res.loadJSON(n);e.children.length=0,e.childrenProcessed=0;const d=this._getBasePath(n);if(f.root){const h=this.preprocessNode(f.root,d,e);e.children.push(h),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:f,url:n})}e.loadingState=Ca;return}catch(f){console.error("Failed to load external tileset:",f),e.loadingState=cr,this.stats.failed++;return}break;default:console.warn(`Unknown tile format: ${i}`);break}if(o){e.cached.scene=o,e.loadingState=Ca;const l=this._estimateBytesUsed(o);this._bytesUsed.set(o,l),this.lruCache.setMemoryUsage(e,l),this.lruCache.has(e)||this.lruCache.add(e,c=>{if(c.cached.scene){const f=c.cached.scene;f.parent&&f.parent.object3D.removeChild(f),f.destroy(!0),c.cached.scene=null}c.loadingState=fr}),e.active&&this.setTileActive(e,!0)}else e.loadingState=cr,this.stats.failed++}markTileUsed(e){this._usedSet.add(e),this.lruCache.markUsed(e)}setTileActive(e,t){t?this._activeTiles.add(e):this._activeTiles.delete(e);const a=e.cached.scene;a&&(t?(this.group.entityChildren.includes(a)||(a.parent&&a.parent.object3D.removeChild(a),this.group.addChild(a)),e.cached.worldTransform&&this._applyWorldTransform(a.transform,e.cached.worldTransform),a.transform.enable=!0):a.transform.enable=!1)}setTileVisible(e,t){t?this._visibleTiles.add(e):this._visibleTiles.delete(e);const a=e.cached.scene;a&&(a.transform.enable=t)}queueTileForDownload(e){e.loadingState!==fr||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 m.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new E;switch(e.toLowerCase()){case"x":t.makeRotationAxis(u.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(u.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(jt.EULER_ANGLES);e.localPosition=a[0];const r=new j;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(jt.EULER_ANGLES);e.localPosition=a[0];const r=new j;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_getBasePath(e){const t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}_resolveURL(e,t){return t.startsWith("http://")||t.startsWith("https://")?t:e+"/"+t}_getUrlExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}getMemoryStats(){const e=this.lruCache.getStats(),t=this.lruCache.maxBytesSize,a=e.bytes,r=t-a,i=this._cacheHits+this._cacheMisses,n=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:n}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===Ca&&e.push(t),!1),null),e}getVisibleTiles(){return Array.from(this._visibleTiles)}getActiveTiles(){return Array.from(this._activeTiles)}getTileTreeStats(){let e=0,t=0,a=0,r=0,i=0,n=0;return this.traverse(o=>(e++,o.loadingState===Ca&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),n+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?n/e:0}}printDebugInfo(){const e=this.stats,t=this.getMemoryStats(),a=this.getTileTreeStats(),r=this.performanceStats,i=this.lruCache.getStats();console.log("=== TilesRenderer Debug Info ==="),console.log("Stats:",e),console.log("Memory:",t),console.log("Tree:",a),console.log("Performance:",r),console.log("Cache:",i),console.log("Queues:",{load:this.loadQueue.getStats(),process:this.processNodeQueue.getStats()})}setPerformanceOptions(e){e.lruCacheMinSize!==void 0&&(this.lruCache.minSize=e.lruCacheMinSize),e.lruCacheMaxSize!==void 0&&(this.lruCache.maxSize=e.lruCacheMaxSize),e.lruCacheMinBytes!==void 0&&(this.lruCache.minBytesSize=e.lruCacheMinBytes),e.lruCacheMaxBytes!==void 0&&(this.lruCache.maxBytesSize=e.lruCacheMaxBytes),e.lruCacheUnloadPercent!==void 0&&(this.lruCache.unloadPercent=e.lruCacheUnloadPercent),e.downloadQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.downloadQueueMaxJobs),e.parseQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.parseQueueMaxJobs),e.processQueueMaxJobs!==void 0&&(this.processNodeQueue.maxJobs=e.processQueueMaxJobs),e.enablePerformanceStats!==void 0&&(this._enablePerformanceStats=e.enablePerformanceStats),e.enableCacheStats!==void 0&&(this._enableCacheStats=e.enableCacheStats)}dispose(e){[...this.plugins].forEach(a=>this.unregisterPlugin(a)),this.lruCache.clear(),this.loadQueue.clear(),this.processNodeQueue.clear(),this._root=null,this.rootTileSet=null,this.rootLoadingState=fr,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===Ca&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent($);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 Cp{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class Sp{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class Fp{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class kp{uri;group;metadata}class Ep{class;properties}function wp(s,e){let t=0,a=null;return function(...r){const i=Date.now(),n=i-t;n>=e?(t=i,s.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),s.apply(this,r),a=null},e-n))}}class Rp extends mt{static count=0;constructor(){super(),z.register("ColorLitShader",xd),this.shader=new ot;let e=new Ve("ColorLitShader","ColorLitShader");e.passType=H.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new P),e.setUniformColor("emissiveColor",new P),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",m.res.normalTexture),e.setTexture("emissiveMap",m.res.blackTexture)}clone(){return null}debug(){}}class Ip extends mt{constructor(){super(),this.shader=new Pi,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 Qp extends mt{constructor(){super();let e=new Ve("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=H.COLOR,e.setUniformVector4("transformUV1",new te(0,0,1,1)),e.setUniformVector4("transformUV2",new te(0,0,1,1)),e.setUniformColor("baseColor",new P(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 ot;a.addRenderPass(e),this.shader=a,this.baseMap=m.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 Tp(s,e){}class Mp extends mt{constructor(){super(),this.shader=new Li,this.baseMap=m.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 Jo{clipName;loopTime;startTime;stopTime;sampleRate;useSkeletonPos;useSkeletonScale;positionCurves=new Map;rotationCurves=new Map;scaleCurves=new Map;floatCurves=new Map;formBytes(e){if(this.clipName=e.readUTF(),this.loopTime=!e.readInt32(),this.startTime=e.readFloat32(),this.stopTime=e.readFloat32(),this.sampleRate=e.readInt32(),this.useSkeletonPos=e.readInt32()>0,this.useSkeletonScale=e.readInt32()>0,this.useSkeletonPos){let r=e.readInt32();for(let i=0;i<r;i++){let n=new hr;n.formBytes(e),this.positionCurves.set(n.path,n)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new hr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let n=new hr;n.formBytes(e),this.scaleCurves.set(n.path,n)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new hr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class hr{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 wi;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new K;break;case 3:this._cacheValue=new u;break;case 4:this._cacheValue=new te;break}}get totalTime(){return this.m_curves[0].totalTime}addKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].addKeyFrame(e.getK(t))}removeKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].removeKeyFrame(e.getK(t))}getValue(e){switch(this.k){case 1:this._cacheValue=this.m_curves[0].getValue(e);break;case 2:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e);break;case 3:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e),this._cacheValue.z=this.m_curves[2].getValue(e);break;case 4:const t=this.m_curves[0].getCurveFramesExtent(e),a=t.lhsIndex,r=t.rhsIndex;e=t.time;let i=this.m_curves[0].getKey(a),n=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(n.time-i.time);j.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),j.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),j.HELP_2.slerp(j.HELP_0,j.HELP_1,o),this._cacheValue.x=j.HELP_2.x,this._cacheValue.y=j.HELP_2.y,this._cacheValue.z=j.HELP_2.z,this._cacheValue.w=j.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 Ji(0);r.formBytes(e),this.addKeyFrame(r)}}}class Np 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 Vp{colorArray;constructor(e){this.colorArray=e}getColor(e){let t=e*this.colorArray.length,a=Math.floor(t),r=Math.min(a+1,this.colorArray.length-1),i=this.colorArray[a],n=this.colorArray[r];return P.lerp(t-a,i,n)}}class Ps{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return u.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,n=e*e*e;return this.controlVertices[0].mul(a).add(this.controlVertices[1].mul(r)).add(this.controlVertices[2].mul(i)).add(this.controlVertices[3].mul(n))}getTangent(e){if(!(e>=0&&e<=1))return u.ZERO;let t=this.controlVertices,a=t[0].add(t[1].add(t[0]).mul(e)),r=t[1].add(t[2].add(t[1]).mul(e)),i=t[2].add(t[3].add(t[2]).mul(e)),n=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(n)}getClosestParam(e,t=1e-6){return this.getClosestParamRec(e,0,1,t)}getClosestParamRec(e,t,a,r){let i=(t+a)/2;if(a-t<r)return i;let n=(t+i)/2,o=(i+a)/2,l=this.getPoint(n),c=this.getPoint(o),f=l.subtract(e).lengthSquared,d=c.subtract(e).lengthSquared;return f<d?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var Yh=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(Yh||{});class Pp{type=0;numCurveSegments=0;numControlVertices=0;controlVertices=[];constructor(e,t=0){this.setControlVertices(e,t)}getPathType(){return this.type}isClosed(){return this.type==1}isValid(){return this.numCurveSegments>0}clear(){this.controlVertices.length=0,this.type=0,this.numCurveSegments=0,this.numControlVertices=0}computeApproxLength(){if(!this.isValid())return 0;let e=this.numCurveSegments+1;if(e<2)return 0;let t=0,a=this.controlVertices;for(let r=1;r<e;r++){let i=a[(r-1)*3],n=a[r*3];t+=i.subtract(n).lengthSquared}return t==0?0:t}computeApproxParamPerUnitLength(){let e=this.computeApproxLength();return this.numCurveSegments/e}computeApproxNormParamPerUnitLength(){return 1/this.computeApproxLength()}interpolatePoints(e,t){let a=e.length;a<2&&console.error("point count must great 1"),this.clear(),this.type=t;let r=this.controlVertices;switch(t){case 0:{this.numCurveSegments=a-1,this.numControlVertices=3*a-2,r.length=this.numControlVertices;for(let o=0;o<a;o++)r[o*3]=e[o];let i=e[1].subtract(e[0]).mul(.25);r[1]=e[0].add(i);let n=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(n);for(let o=1;o<this.numCurveSegments;o++){let l=e[o-1].subtract(e[o]),c=e[o+1].subtract(e[o]),f=l.lengthSquared,d=c.lengthSquared;if(f>0&&d>0){let h=(f+d)/8,b=c.div(d).subtract(l.div(f));b.normalize(),b=b.mul(h),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 n=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[n].subtract(e[l]),f=e[o].subtract(e[l]),d=c.lengthSquared,h=f.lengthSquared,b=3*i-1,p=(3*i+1)%(this.numControlVertices-1);if(d>0&&h>0){let g=(d+h)/8,A=f.div(h).subtract(c.div(d));A.normalize(),A=A.mul(g),r[b]=e[l].subtract(A),r[p]=e[l].add(A)}else r[b]=e[l],r[p]=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=St.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 Ps(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=St.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 Ps(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],n=new Ps(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let d=0;d<4;d++)i[d]=this.controlVertices[o+d];n.setControlVertices(i);let l=n.getClosestParam(e,t),f=n.getPoint(l).subtract(e).lengthSquared;f<a&&(a=f,r=o/3+l)}return r}computeClosestNormParam(e,t){return this.computeClosestParam(e,t*this.numCurveSegments)}}class Op 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 Xh=(s=>(s[s.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",s[s.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",s[s.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",s[s.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",s[s.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",s[s.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",s[s.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",s[s.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",s[s.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",s[s.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",s[s.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",s[s.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",s[s.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",s))(Xh||{});const Lp=3.141592653589793;class Gp{}function Hh(s,e,t){let a=.3333333333333333,r=.5,i=s*a,n=i*i,l=n*i-i*e*r+t*r,c=-n+e*a,f=c*c*c,d=f+l*l;if(d>=0){let p=Math.sqrt(d)-l;return p=p>0?Math.pow(p,a):-Math.pow(-p,a),-i-c/p+p}let h=Math.sqrt(-f),b=Math.acos(-l/h);return h=Math.pow(h,a),h=h-c/h,b=-i+h*Math.cos(b*a),b}function Os(s,e,t,a){let r=1e-5;if(Math.abs(s)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*s*t;if(i<0)return 0;let n=.5/s,o=Math.sqrt(i);return a.r0=(o-e)*n,a.r1=(-o-e)*n,2}function Kh(s,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let n=t/e,o=a/e,l=r/e;s[0]=Hh(n,o,l),i++;let c=e,f=t+e*s[0],d=a+t*s[0]+e*s[0]*s[0];i+=Os(c,f,d,{r0:s[1],r1:s[2]})}else i+=Os(t,a,r,{r0:s[1],r1:s[2]});return i}class Sa{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class Wa{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[Wa.kMaxNumSegments]=new Sa,this.integrationCache[Wa.kMaxNumSegments]=0,this.doubleIntegrationCache[Wa.kMaxNumSegments]=0,this.times[Wa.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=K.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=K.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],n=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=Kh(c,i,n,o,l);for(let d=0;d<f;d++){let h=c[d]+t[r];h>=t[r]&&h<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(h))}this.calculateMinMax(e,this.evaluateIntegrated(a[r])),this.times[r]}return e}generateIntegrationCache(e){e.integrationCache[0]=0;let t=e.times[0],a=0;for(let r=1;r<e.segmentCount;r++){let i=e.segments[r-1].coeff;Wo(i);let n=t-a;e.integrationCache[r]=e.integrationCache[r-1]+Sa.EvalSegment(n,i)*n,a=t,t=e.times[r]}}generateDoubleIntegrationCache(e){let t=0,a=0;for(let r=0;r<e.segmentCount;r++){e.doubleIntegrationCache[r]=t;let i=e.times[r]-a;i=Math.max(i,0),t+=Sa.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++)Wo(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)qh(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<=Wa.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+Sa.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]+Sa.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 Sa.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 Sa,this.segments[0].coeff[3]=e.getKey(0).value*t;else{this.segmentCount=a-1;let i=0;e.getKey(0).time!=0&&(this.segments[0].coeff[3]=e.getKey(0).value,this.times[0]=e.getKey(0).time,i=1);for(let n=0;n<this.segmentCount;n++){let o;e.calculateCacheData(o,n,n+1,0),this.segments[n+i].coeff=o.coeff.concat(),this.times[n+i]=e.getKey(n+1).time}this.segmentCount+=i,e.getKey(a-1).time!=1&&(this.segments[this.segmentCount].coeff[3]=e.getKey(a-1).value,this.segmentCount++),this.times[this.segmentCount-1]=r;for(let n=0;n<this.segmentCount;n++)this.segments[n].coeff[0]*=t,this.segments[n].coeff[1]*=t,this.segments[n].coeff[2]*=t,this.segments[n].coeff[3]*=t}return!0}}function qh(s){s[0]/=20,s[1]/=12,s[2]/=6,s[3]/=2}function Wo(s){s[0]/=4,s[1]/=3,s[2]/=2,s[3]/=1}var $h=(s=>(s[s.kEMScalar=0]="kEMScalar",s[s.kEMOptimized=1]="kEMOptimized",s[s.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",s[s.kEMSlow=3]="kEMSlow",s))($h||{}),eu=(s=>(s[s.kMMCScalar=0]="kMMCScalar",s[s.kMMCCurve=1]="kMMCCurve",s[s.kMMCTwoCurves=2]="kMMCTwoCurves",s[s.kMMCTwoConstants=3]="kMMCTwoConstants",s))(eu||{});class zp{max;min}class Jp{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class tu{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new wi,this.maxCurve=new wi}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?wr(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?wr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?wr(e._minScalar,e._scalar,a):e.minMaxState==2?wr(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 Wp{value=0;mode=0;spread=0;speed=new tu;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function Zp(s,e){let t=Wa.isValidCurve(s.max);return e!=2&&e!=3?t:t&&Wa.isValidCurve(s.min)}function jp(s,e,t,a){s.max.buildCurve(e.max,t),a!=2&&a!=3?s.min.buildCurve(e.max,t):s.min.buildCurve(e.min,t)}function Yp(s,e){let t=e.getKeyCount();if(t!=0)if(t==1)Gi(s,e.getKey(0).value);else{let a=t-1;Gi(s,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Uo;e.calculateCacheData(i,r,r+1,0);let n=3*i.coeff[0],o=2*i.coeff[1],l=1*i.coeff[2],c=e.getKey(r).time,f=e.getKey(r+1).time,d=[],h=Os(n,o,l,{r0:d[0],r1:d[1]});for(let b=0;b<h;b++)d[b]>=0&&d[b]+c<f&&Gi(s,Sa.EvalSegment(d[b],i.coeff));Gi(s,Sa.EvalSegment(f-c,i.coeff))}}}function Gi(s,e){s.x=Math.min(s.x,e),s.y=Math.max(s.y,e)}class Qr{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class au{a;b;c;d;static ALIGN_ANY=0;static ALIGN_XY_AXIS=1;static ALIGN_YZ_AXIS=2;static ALIGN_XZ_AXIS=3;constructor(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}setTo(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}fromPoints(e,t,a){var r=t.x-e.x,i=t.y-e.y,n=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-n*l,this.b=n*o-r*c,this.c=r*l-i*o,this.d=-(this.a*e.x+this.b*e.y+this.c*e.z)}fromNormalAndPoint(e,t){this.a=e.x,this.b=e.y,this.c=e.z,this.d=-(this.a*t.x+this.b*t.y+this.c*t.z)}normalize(){var e=Math.sqrt(this.a*this.a+this.b*this.b+this.c*this.c);if(e>0){var t=1/e;this.a*=t,this.b*=t,this.c*=t,this.d*=t}return e}distance(e){return this.a*e.x+this.b*e.y+this.c*e.z+this.d}classifyPoint(e,t=.01){var a=this.distance(e);return a<-t?Qr.BACK:a>t?Qr.FRONT:Qr.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function Xp(s,e){return Math.random()*e+Math.random()*s+(e-s)*Math.random()}function Hp(s,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*s*a+(e-s)*Math.random()*a}function ru(s,e,t){let a=0,r=0;for(;a===0;)a=Math.random();for(;r===0;)r=Math.random();let i=Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*r);return i=i/10+.5,(i>1||i<0)&&(i=ru(s,e,t)),i=Math.pow(i,t),i*=e-s,i+=s,i}function la(s){return s>0?Math.floor(s):Math.floor(s)-1}let le=[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 Zo(s,e){let t=s&15,a=1+(t&7);return t&8&&(a=-a),a*e}function Ls(s,e,t){let a=s&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function zi(s,e,t,a){let r=s&15,i=r<8?e:t,n=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-n:n)}function hi(s,e,t,a,r){let i=s&31,n=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-n:n)+(i&2?-o:o)+(i&4?-l:l)}let Gt=[[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 Kp(s){let e=la(s),t=e+1,a=s-e,r=a-1,i,n,o=1-a*a;o*=o,i=o*o*Zo(le[e&255],a);let l=1-r*r;return l*=l,n=l*l*Zo(le[t&255],r),.25*(i+n)}function qp(s,e){const t=.366025403,a=.211324865;let r,i,n,o=(s+e)*t,l=s+o,c=e+o,f=la(l),d=la(c),h=(f+d)*a,b=f-h,p=d-h,g=s-b,A=e-p,D,_;g>A?(D=1,_=0):(D=0,_=1);let U=g-D+a,v=A-_+a,x=g-1+2*a,C=A-1+2*a,F=f&255,w=d&255,S=.5-g*g-A*A;S<0?r=0:(S*=S,r=S*S*Ls(le[F+le[w]],g,A));let M=.5-U*U-v*v;M<0?i=0:(M*=M,i=M*M*Ls(le[F+D+le[w+_]],U,v));let T=.5-x*x-C*C;return T<0?n=0:(T*=T,n=T*T*Ls(le[F+1+le[w+1]],x,C)),40*(r+i+n)}function $p(s,e,t){const a=.333333333,r=.166666667;let i,n,o,l,c=(s+e+t)*a,f=s+c,d=e+c,h=t+c,b=la(f),p=la(d),g=la(h),A=(b+p+g)*r,D=b-A,_=p-A,U=g-A,v=s-D,x=e-_,C=t-U,F,w,S,M,T,Q;v>=x?x>=C?(F=1,w=0,S=0,M=1,T=1,Q=0):v>=C?(F=1,w=0,S=0,M=1,T=0,Q=1):(F=0,w=0,S=1,M=1,T=0,Q=1):x<C?(F=0,w=0,S=1,M=0,T=1,Q=1):v<C?(F=0,w=1,S=0,M=0,T=1,Q=1):(F=0,w=1,S=0,M=1,T=1,Q=0);let L=v-F+r,X=x-w+r,ie=C-S+r,q=v-M+2*r,be=x-T+2*r,Ue=C-Q+2*r,Z=v-1+3*r,de=x-1+3*r,ce=C-1+3*r,De=b&255,_e=p&255,Ne=g&255,we=.6-v*v-x*x-C*C;we<0?i=0:(we*=we,i=we*we*zi(le[De+le[_e+le[Ne]]],v,x,C));let Ce=.6-L*L-X*X-ie*ie;Ce<0?n=0:(Ce*=Ce,n=Ce*Ce*zi(le[De+F+le[_e+w+le[Ne+S]]],L,X,ie));let Me=.6-q*q-be*be-Ue*Ue;Me<0?o=0:(Me*=Me,o=Me*Me*zi(le[De+M+le[_e+T+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t+de+le[xr+ce+le[yr+De+le[Xa+_e]]]],kt,Nt,xt,pa));let Fr=.6-ma*ma-Aa*Aa-Da*Da-Dr*Dr;Fr<0?l=0:(Fr*=Fr,l=Fr*Fr*hi(le[Jt+Ne+le[xr+we+le[yr+Ce+le[Xa+Me]]]],ma,Aa,Da,Dr));let kr=.6-ja*ja-_a*_a-_r*_r-Ya*Ya;kr<0?c=0:(kr*=kr,c=kr*kr*hi(le[Jt+ct+le[xr+ga+le[yr+Mt+le[Xa+Ft]]]],ja,_a,_r,Ya));let Er=.6-Br*Br-Ba*Ba-vr*vr-Ur*Ur;return Er<0?f=0:(Er*=Er,f=Er*Er*hi(le[Jt+1+le[xr+1+le[yr+1+le[Xa+1]]]],Br,Ba,vr,Ur)),27*(n+o+l+c+f)}class qo extends K{static uv_0=new qo;u=0;v=0;constructor(e=0,t=0){super(e,t),this.u=e,this.v=t}length(){return 0}static getUVSheet(e,t,a){let r=Math.floor(e%(t*a)),i=Math.floor(r/t),n=r%t;return new te(i/t,n/a,1/t,1/a)}}class Ji{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 G.single:{let r=this.getKeyFrame(0);r[a]=t}break;case G.float:{let r=this.getKeyFrame(0);r[a]=t}break;case G.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y}break;case G.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case G.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case G.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let n=this.getKeyFrame(1);n[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break}}getKeyFrame(e){let t=this.propertyKeyFrame[e];return t||(t=new ks,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}=Ea.parser(e);this.split(t,a,"value")}{let{t,v:a}=Ea.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Ea.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Ea.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Ea.parser(e);this.split(t,a,"outWeight")}}}class tm{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new K(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new u(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new te(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 j(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}}}}class Wi{_keys=new Array;_values=new Array;getIndexByKey(e){return this._keys.indexOf(e)}getValueByKey(e){var t=this.getIndexByKey(e);return t>-1?this._values[t]:null}put(e,t){if(e==null)return null;var a=this.remove(e);return this._keys.push(e),this._values.push(t),a}remove(e){var t=this._keys.indexOf(e),a;return t>-1&&(a=this._values[t],this._keys.splice(t,1),this._values.splice(t,1)),a}getValues(){return this._values}getKeys(){return this._keys}clear(){this._values.length=0,this._keys.length=0}}class ur{static WalkAble=1}class Zi{static SetConst(e){this.EPSILON=e,this.POWER_EPSILON=e*e}static EPSILON=.1;static POWER_EPSILON=this.EPSILON*this.EPSILON}class _t extends u{static CALC_VECTOR3D1=new u;static CALC_VECTOR3D2=new u;static CALC_VECTOR3D3=new u;static CALC_VECTOR3D4=new u;static CALC_VECTOR3D5=new u;_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)<Zi.POWER_EPSILON}static calcDistance(e,t){return _t.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),_t.CALC_VECTOR3D3.length}}class iu{_openedList;_closedList;_endNode;_startNode;_triangleChannel;_navMesh;_findIndex=0;constructor(){this._openedList=new Array,this._closedList=new Array}findPath(e,t,a){return this._findIndex++,this._navMesh=e,this._startNode=t,this._endNode=a,this._openedList.length=0,this._closedList.length=0,this._startNode&&this._endNode?(this._startNode.gg=0,this._startNode.h=0,this._startNode.f=0,this._startNode.parent=null,this.search()):!1}search(){for(var e=this._startNode,t=[],a;e!=this._endNode;){t=e.getNeibourTriangles(t,ur.WalkAble,ur.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+_t.calcDistance(a,e)*a.costMultiplier,i=_t.calcDistance(a,this._endNode),n=r+i;a.openId==this._findIndex?a.f>n&&(a.f=n,a.gg=r,a.h=i,a.parent=e):(a.f=n,a.gg=r,a.h=i,a.parent=e,a.openId=this._findIndex,this._openedList.push(a))}if(e.closeId=this._findIndex,this._closedList.push(e),this._openedList.length==0)return!1;this._openedList.sort(function(o,l){return o.f-l.f}),e=this._openedList.shift()}return this.buildPath(),!0}buildPath(){this._triangleChannel=[];var e=this._endNode;for(this._triangleChannel.push(e);e!=this._startNode;)e=e.parent,this._triangleChannel.unshift(e)}get channel(){return this._triangleChannel}}class fa extends _t{_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 ha{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new u;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 u,this._edgeMask=ur.WalkAble,_t.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=_t.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&&(ha.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ha.CALC_FAT_VECTOR.scaleBy(e),ha.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(ha.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(ha.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ha.CALC_FAT_VECTOR.scaleBy(-e),ha.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(ha.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 _t.equalPoint(e,this._pointA)?this._pointA:_t.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 _t.equalPoint(e,this._pointA)?this._pointA:_t.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&ur.WalkAble)==ur.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class re{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new u;static RAY_2=new u;static TEST_RAY=new u;static TEST_RAY_1=new u;static TEST_RAY_2=new u;static CALC_CROSS_POINT=new u;static CALC_CROSS_TEST=new u;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=re.RAY_1,this.rayB=re.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(re.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(re.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(re.TEST_RAY),a instanceof _t?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(re.TEST_RAY),a instanceof _t?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);re.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(re.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var n;if(re.TEST_RAY_1.copyFrom(t.pointA),re.TEST_RAY_1.decrementBy(this.curPoint),re.TEST_RAY_2.copyFrom(t.pointB),re.TEST_RAY_2.decrementBy(this.curPoint),re.TEST_RAY_1.y=0,re.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,re.TEST_RAY_1,re.TEST_RAY_2)||this.isPointAtCenter(this.rayB,re.TEST_RAY_1,re.TEST_RAY_2)?n=!1:n=!0,n)return this.isPointAtCenter(this.rayA,re.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return re.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(re.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,re.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){re.CALC_CROSS_POINT.copyFrom(t),re.CALC_CROSS_POINT.decrementBy(e);let i=re.CALC_CROSS_POINT.x*r.z-r.x*re.CALC_CROSS_POINT.z;var n=0;return i!=0&&(n=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),n>1?n=1:n<0&&(n=0),re.CALC_CROSS_POINT.scaleBy(n),re.CALC_CROSS_POINT.incrementBy(e),re.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){re.CALC_CROSS_POINT.copyFrom(t),re.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(re.CALC_CROSS_POINT.x*r.z-r.x*re.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(re.CALC_CROSS_POINT.scaleBy(i),re.CALC_CROSS_POINT.incrementBy(e),re.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){re.CALC_CROSS_TEST.copyFrom(t),re.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(re.CALC_CROSS_TEST.x*r.z-r.x*re.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,re.RAY_1.setTo(0,0,0),re.RAY_2.setTo(0,0,0)}}class Ja{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new u;constructor(){this._router=new re}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,Zi.EPSILON)!=Qr.INTERSECT||a[a.length-1].plane.classifyPoint(t,Zi.EPSILON)!=Qr.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,n,o,l,c;for(r=0;r<i;r++)o=a[r].getPublicEdge(a[r+1]),o.crossPoint=null,o.initFatPoints(this._aiRadius),this._tempPublicEdgeList.push(o),n=a[r],c=n.plane,n=a[r+1],l=n.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,Zi.EPSILON)==Qr.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,d,h,b;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],n=a[r+1],b=r==i-1,b?l=t:l=n.getEdgeAgainstPoint(o),h=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,b),h||(f=this._router.cornerPoint,d=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(d),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let p=[];for(let g of this._result)p.push(new u().copyFrom(g));this._result=p}optimusTerminusFat(){var e,t,a;a=this._result[1],a instanceof fa&&(e=a),a=this._result[this._result.length-2],a instanceof fa&&(t=a),e&&(this._result[1]=e.scalePoint()),t&&e!=t&&(this._result[this._result.length-2]=t.scalePoint())}pushAllPathPoint2(e,t){var a=this._tempPublicEdgeList.length,r,i;this._result=new Array,this._result.push(e);for(var n=e,o,l,c,f=0;f<a;f++)if(r=this._tempPublicEdgeList[f],l=null,r.crossPoint)l=this.getFatPoint(r,r.crossPoint),l?this._result.push(l):this._result.push(r.crossPoint),n=r.crossPoint;else{i=null,o=null;for(var d=f+1;d<a&&(i=this._tempPublicEdgeList[d],o=i.crossPoint,!o);d++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==n?c=o.clone():(Ja.CROSS_TEST_DIRECTION.setTo(o.x-n.x,0,o.z-n.z),c=this._router.calcCrossEdge(r,n,Ja.CROSS_TEST_DIRECTION)),this._result.push(c))}this._result.push(t)}optimusByRadius(){var e=new Array;e.length=this._result.length;var t=this._result.length-2,a,r,i,n,o,l,c,f,d,h,b,p,g;for(g=0;g<t;g++)c=f=d=null,n=o=l=null,b=!1,p=null,a=this._result[g],r=this._result[g+1],i=this._result[g+2],a instanceof fa&&(n=a),r instanceof fa&&(o=r),i instanceof fa&&(l=i),n&&(c=n.ownerPoint),o&&(f=o.ownerPoint),l&&(d=l.ownerPoint),c&&f&&c==f&&f!=d&&(b=!0),d&&f&&d==f&&c!=f&&(b=!0),b&&(Ja.CROSS_TEST_DIRECTION.copyFrom(a),Ja.CROSS_TEST_DIRECTION.decrementBy(i),h=o.ownerEdge,b=this._router.hasCrossPoint(h.pointA,h.pointB,i,Ja.CROSS_TEST_DIRECTION),b&&(p=this._router.calcCrossPointOut(f,r,i,Ja.CROSS_TEST_DIRECTION)),p&&(e[g+1]=p))}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 su extends u{_id=0;_plane;_points=new Array;_edges=new Array;_neibourTriangles=new Wi;_pointAgainstEdge=new Wi;_edgeAgainstPoint=new Wi;_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 Ut,this._aabbBox.addPoint(this._points[0]),this._aabbBox.addPoint(this._points[1]),this._aabbBox.addPoint(this._points[2])}calcGlobalQuadAABB(){}get isTriangle(){return!0}constructor(e,t,a,r){super(0,0,0,0),this._id=e,this._mask=ur.WalkAble,this._edges.push(t,a,r);var i;for(i of this._edges)this._points.indexOf(i.pointA)==-1&&this._points.push(i.pointA),this._points.indexOf(i.pointB)==-1&&this._points.push(i.pointB);this.x=(this._points[0].x+this._points[1].x+this._points[2].x)/3,this.y=(this._points[0].y+this._points[1].y+this._points[2].y)/3,this.z=(this._points[0].z+this._points[1].z+this._points[2].z)/3,this._plane=new au,this._plane.fromPoints(this._points[0],this._points[1],this._points[2]),this._plane.normalize(),this.genarateAgainstData(),this.initAABB()}genarateAgainstData(){var e,t;for(e of this._edges)for(t of this._points)e.pointA!=t&&e.pointB!=t&&(this._edgeAgainstPoint.put(e,t),this._pointAgainstEdge.put(t,e))}get id(){return this._id}get plane(){return this._plane}get points(){return this._points}addNeibour(e,t){if(this._edges.indexOf(e)>=0)this._neibourTriangles.put(e,t);else throw new Error("the edge is not in triangle!!!")}getNeibourTriangles(e=null,t=1,a=1){e=e||new Array,e.length=0;var r,i,n=this._neibourTriangles.getKeys(),o;for(o of n)i=o,i.testMask(t)&&(r=this._neibourTriangles.getValueByKey(i),r.testMask(a)&&e.push(r));return e}getEdges(e=null,t=1){e=e||new Array,e.length=0;var a;for(a of this._edges)a.testMask(t)&&e.push(a);return e}get walkAble(){return this.testMask(ur.WalkAble)}get edges(){return this._edges}testMask(e){return(this._mask&e)==e}getEdgeAgainstPoint(e){return this._edgeAgainstPoint.getValueByKey(e)}getPointAgainstEdge(e){return this._pointAgainstEdge.getValueByKey(e)}getPublicEdge(e){if(e&&e!=this){var t=this._neibourTriangles.getKeys(),a;for(a of t)if(this._neibourTriangles.getValueByKey(a)==e)return a}return null}loopPublicEdge(e){var t,a;if(e&&e!=this){for(t of this._edges)for(a of e._edges)if(t==a)return t}return null}randomPoint(){var e=this._points[2].subtract(this._points[0]);e.scaleBy(Math.random()),e.incrementBy(this._points[0]);var t=this._points[1].subtract(e);return t.scaleBy(Math.random()),t.incrementBy(e),t}}class am{_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 Wi,this.initPoints(e),this.initEdgesAndTriangles(t),this.createConnections(),this._nav3dAstar=new iu,this._nav3dFunnel=new Ja,this._terrainQuad=new bh(8,128),this._terrainQuad.createQuadTree(this._nav3dTriangles)}getTriangleAtPoint(e,t=5){return this._terrainQuad.getTriangleAtPoint(e,t)}findPath(e,t,a=5){this._path=null,this._triangleList=null;var r=this.getTriangleAtPoint(e,10),i=this.getTriangleAtPoint(t,10),n=this._nav3dAstar.findPath(this,r,i);return n?(this._triangleList=this._nav3dAstar.channel,n=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,n):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new _t(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,n,o=e.length,l=0;l<o;l++)t=e[l],a=this.tryCreateEdge(t[0],t[1]),r=this.tryCreateEdge(t[1],t[2]),i=this.tryCreateEdge(t[2],t[0]),!(a==null||r==null||i==null)&&(n=new su(l,a,r,i),this._nav3dTriangles.push(n))}tryCreateEdge(e,t){if(e==t)throw new Error("edge point index error!!!");if(e>t){var a=e;e=t,t=a}var r=this._edgesDict.getValueByKey(e+"_"+t);return r==null&&(r=new ha(this._nav3dPoints[e],this._nav3dPoints[t]),this._nav3dEdges.push(r),this._edgesDict.put(e+"_"+t,r)),r}createConnections(){for(var e=this._nav3dTriangles.length,t=this._nav3dTriangles.length,a,r,i,n,o=0;o<e;o++){a=this._nav3dTriangles[o];for(i of a.edges)i.addTriangleOwners(a);for(var l=0;l<t;l++)r=this._nav3dTriangles[l],a!=r&&(n=a.loopPublicEdge(r),n&&(a.addNeibour(n,r),r.addNeibour(n,a)))}}}class $o{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 $o;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class Fa extends Ee{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 pe(u.ZERO.clone(),new u(this.width,this.height,this.depth));let r=new Float32Array([-e,t,a,e,t,a,e,t,-a,-e,t,-a,-e,t,a,e,t,-a,e,-t,a,-e,-t,a,-e,-t,-a,e,-t,-a,e,-t,a,-e,-t,-a,-e,-t,a,-e,t,a,-e,t,-a,-e,-t,-a,-e,-t,a,-e,t,-a,e,t,a,e,-t,a,e,-t,-a,e,t,-a,e,t,a,e,-t,-a,e,t,a,-e,t,a,-e,-t,a,-e,-t,a,e,-t,a,e,t,a,e,-t,-a,-e,-t,-a,-e,t,-a,e,t,-a,e,-t,-a,-e,t,-a]),i=new Float32Array([0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1]),n=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),o=[0,2,1,3,5,4,6,8,7,9,11,10,12,14,13,15,17,16,18,20,19,21,23,22,24,26,25,27,29,28,30,32,31,33,35,34],l=new Uint16Array(o.reverse());this.setIndices(l),this.setAttribute(V.position,r),this.setAttribute(V.normal,i),this.setAttribute(V.uv,n),this.setAttribute(V.TEXCOORD_1,n),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class nu extends Ee{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,n=!1,o=0,l=Math.PI*2){super(),this.radiusTop=e,this.radiusBottom=t,this.height=a,this.radialSegments=r,this.heightSegments=i,this.openEnded=n,this.thetaStart=o,this.thetaLength=l,this.instanceID=Et(),this.buildGeometry()}addGroup(e,t,a){this.addSubGeometry({indexStart:e,indexCount:t,vertexStart:e,vertexCount:0,firstStart:0,index:a,topology:0})}buildGeometry(){const e=this;this.radialSegments=Math.floor(this.radialSegments),this.heightSegments=Math.floor(this.heightSegments);const t=[],a=[],r=[],i=[];let n=0;const o=[],l=this.height/2;let c=0;p(),this.openEnded===!1&&(this.radiusTop>0&&g(!0),this.radiusBottom>0&&g(!1));let f=new Float32Array(t),d=new Float32Array(a),h=new Float32Array(r),b=new Uint16Array(i);this.setAttribute(V.position,f),this.setAttribute(V.normal,d),this.setAttribute(V.uv,h),this.setAttribute(V.TEXCOORD_1,h),this.setIndices(b);function p(){const A=new u,D=new u;let _=0;const U=(e.radiusBottom-e.radiusTop)/e.height;for(let v=0;v<=e.heightSegments;v++){const x=[],C=v/e.heightSegments,F=C*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let w=0;w<=e.radialSegments;w++){const S=w/e.radialSegments;let M=S*e.thetaLength+e.thetaStart;w==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(M=0);const T=Math.sin(M),Q=Math.cos(M);D.x=F*T,D.y=-C*e.height+l,D.z=F*Q,t.push(D.x,D.y,D.z),A.set(T,U,Q).normalize(),a.push(A.x,A.y,A.z),r.push(S,1-C),x.push(n++)}o.push(x)}for(let v=0;v<e.radialSegments;v++)for(let x=0;x<e.heightSegments;x++){const C=o[x][v],F=o[x+1][v],w=o[x+1][v+1],S=o[x][v+1];i.push(C,F,S),i.push(F,w,S),_+=6}e.addGroup(c,_,0),c+=_}function g(A){const D=n,_=new K,U=new u;let v=0;const x=A===!0?e.radiusTop:e.radiusBottom,C=A===!0?1:-1;for(let w=1;w<=e.radialSegments;w++)t.push(0,l*C,0),a.push(0,C,0),r.push(.5,.5),n++;const F=n;for(let w=0;w<=e.radialSegments;w++){const M=w/e.radialSegments*e.thetaLength+e.thetaStart,T=Math.cos(M),Q=Math.sin(M);U.x=x*Q,U.y=l*C,U.z=x*T,t.push(U.x,U.y,U.z),a.push(0,C,0),_.x=T*.5+.5,_.y=Q*.5*C+.5,r.push(_.x,_.y),n++}for(let w=0;w<e.radialSegments;w++){const S=D+w,M=F+w;A===!0?i.push(M,M+1,S):i.push(M+1,M,S),v+=3}e.addGroup(c,v,A===!0?1:2),c+=v}}}class ou extends Ee{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 pe(u.ZERO.clone(),new u(t*2,a*2,t*2));var n=(r+1)*(i+1);let o=new Float32Array(n*3),l=new Float32Array(n*3),c=new Float32Array(n*2),f=new Uint16Array(r*i*2*3),d=0,h=0,b=0,p=0;for(let g=0;g<=r;g++)for(let A=0;A<=i;A++){const D=A/i,_=g/r,U=D*e,v=_*Math.PI*2;if(o[d++]=(t+a*Math.cos(v))*Math.sin(U),o[d++]=a*Math.sin(v),o[d++]=(t+a*Math.cos(v))*Math.cos(U),l[h++]=Math.sin(U)*Math.cos(v),l[h++]=Math.sin(v),l[h++]=Math.cos(U)*Math.cos(v),c[b++]=D,c[b++]=_,A<i&&g<r){const x=i+1,C=x*g+A,F=x*(g+1)+A,w=x*(g+1)+A+1,S=x*g+A+1;f[p++]=C,f[p++]=S,f[p++]=F,f[p++]=S,f[p++]=w,f[p++]=F}}this.setIndices(f),this.setAttribute(V.position,o),this.setAttribute(V.normal,l),this.setAttribute(V.uv,c),this.setAttribute(V.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class rm extends Ee{segment;row=0;constructor(e){super(),this.segment=e,this.buildGeometry()}buildGeometry(){this.row=this.segment+1;let e=new Uint32Array(this.segment*6),t=new Float32Array(this.row*3*2),a=new Float32Array(this.row*3*2),r=new Float32Array(this.row*2*2);for(let i=0;i<this.row;i++){t[i*3*2+0]=0,t[i*3*2+1]=0,t[i*3*2+2]=0,t[i*3*2+3]=0,t[i*3*2+4]=0,t[i*3*2+5]=0,a[i*3*2+0]=0,a[i*3*2+1]=0,a[i*3*2+2]=1,a[i*3*2+3]=0,a[i*3*2+4]=0,a[i*3*2+5]=1,r[i*2*2+0]=0,r[i*2*2+1]=i/this.segment,r[i*2*2+2]=1,r[i*2*2+3]=i/this.segment;let n=i*2,o=n,l=n+1,c=n+2,f=n+3;e[i*6+0]=o,e[i*6+1]=l,e[i*6+2]=c,e[i*6+3]=l,e[i*6+4]=f,e[i*6+5]=c}this.setIndices(e),this.setAttribute(V.position,t),this.setAttribute(V.normal,a),this.setAttribute(V.uv,r),this.setAttribute(V.TEXCOORD_1,r),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class im extends Ee{faceCount=0;constructor(e){super(),this.faceCount=e,this.buildGeometry()}buildGeometry(){let e=new Uint32Array(this.faceCount*3),t=new Float32Array(this.faceCount*3*3),a=new Float32Array(this.faceCount*3*3),r=new Float32Array(this.faceCount*3*2),i=new Float32Array(this.faceCount*3*1);for(let n=0;n<this.faceCount;n++){let o=n*3+0,l=n*3+1,c=n*3+2;e[o]=o,e[l]=l,e[c]=c}this.setIndices(e),this.setAttribute(V.position,t),this.setAttribute(V.normal,a),this.setAttribute(V.uv,r),this.setAttribute(V.TEXCOORD_1,r),this.setAttribute(V.vIndex,i),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class sm extends He{create(e,t,a,r=!0){let i=k.device;const n=e*4*4;this.format=Y.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);const c=y.beginCommandEncoder();c.copyBufferToTexture({buffer:l,bytesPerRow:n},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(c),r&&(this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float"),this.gpuSampler=i.createSampler({})}fromBuffer(e,t,a){let r=k.device;const i=e*4*4;this.format=Y.rgba32float,this.mipmapCount=1,this.createTextureDescriptor(e,t,this.mipmapCount,this.format);const n=y.beginCommandEncoder();return n.copyBufferToTexture({buffer:a,bytesPerRow:i},{texture:this.getGPUTexture()},{width:e,height:t,depthOrArrayLayers:1}),y.endCommandEncoder(n),this.samplerBindingLayout.type="non-filtering",this.textureBindingLayout.sampleType="unfilterable-float",this.gpuSampler=r.createSampler({}),this}}class nm extends Cs{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new Rn;let t=[];return m.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,m.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 om extends ee{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new ee,t=new ee,a=new ee,r=new Fa(2,2,2),i=new Fa(2,2,2),n=new Fa(2,2,2),o=new nt;o.baseColor=new P(1,0,0);let l=new nt;l.baseColor=new P(0,1,0);let c=new nt;c.baseColor=new P(0,0,1);let f=e.addComponent($),d=t.addComponent($),h=a.addComponent($);f.geometry=r,f.material=o,f.castShadow=!1,d.geometry=i,d.material=l,d.castShadow=!1,h.geometry=n,h.material=c,h.castShadow=!1,e.localScale=new u(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new u(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new u(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class lm{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Ee,i=e.getAttribute(V.position).data.length/3,n=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let d=f[1].attribute;if(d==V.indices)continue;let h=e.getAttribute(d).data,b=h.length,p=new Float32Array(b*t);for(let g=0;g<t;g++){p.set(h,b*g);for(let A=0;A<i;A++)n[i*g+A]=g}r.setAttribute(d,p)}r.setAttribute(V.vIndex,n);let o=e.getAttribute(V.indices).data,l=o.length,c=new Uint32Array(o.length*t);for(let f=0;f<t;f++)for(let d=0;d<l;d++){let h=f*i,b=f*l;const p=o[d]+h;c[b+d]=p}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 cm extends ee{size=100;divisions=10;constructor(e=100,t=10){super(),this.size=e,this.divisions=t,this.buildGeometry(),this.addAxis()}buildGeometry(){const e=[],t=[],a=this.size/this.divisions,r=this.size/2,i=this.divisions/2;for(let c=0,f=-r;c<=this.divisions;c++,f+=a)c!==i&&(e.push(-r,0,f,r,0,f),e.push(f,0,-r,f,0,r));for(let c=0;c<e.length/3;c+=2)t.push(c,c+1);let n=new Ee;n.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),n.setAttribute(V.position,new Float32Array(e)),n.addSubGeometry({indexStart:0,indexCount:t.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let o=new nt;o.topology="line-list",o.baseColor=new P(1,1,1,.15),o.blendMode=ae.ADD,o.castReflection=!1;let l=this.addComponent($);l.geometry=n,l.material=o}addAxis(){const e=this.size/2;let t=new Float32Array([-e,0,0,e,0,0]),a=new Uint16Array([0,1,2,3]),r=new Ee;r.setIndices(a),r.setAttribute(V.position,t),r.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});{let i=new ee,n=i.addComponent($);n.geometry=r;let o=n.material=new nt;o.baseColor=new P(1,0,0,.5),o.blendMode=ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new ee;i.rotationY=90;let n=i.addComponent($);n.geometry=r;let o=n.material=new nt;o.baseColor=new P(0,1,0,.5),o.blendMode=ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class fm{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 P(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 dm{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new Fa),this.planeGeo||(this.planeGeo=new ei(1,1,1,1,u.UP)),this.sphere||(this.sphere=new Rr(1,35,35)),this.material||(this.material=new ka),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 ee,t=e.addComponent($);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 ka,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new ee,a=t.addComponent($);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,n){this.initHeap();let o=new ka;o.roughness=.5,o.metallic=.1,o.baseColor=new P(r,i,n,1);let l=new ee,c=l.addComponent($);return c.castGI=!0,c.geometry=new Fa(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new ka;i.baseColor=new P(t,a,r,1);let n=new ee,o=n.addComponent($);return o.castGI=!0,o.geometry=new Rr(e,20,20),o.material=i,n}static get Sphere(){this.initHeap();let e=new ee,t=e.addComponent($);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new ee,r=a.addComponent($);return r.castShadow=!1,r.geometry=new Fa(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,n,o=1,l=!0){let c=new ee,f=c.addComponent(ai);f.lightColor=new P(r,i,n,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let d=this.GetSingleSphere(.1,1,1,1);return c.addChild(d),f}}var R=(s=>(s[s.X=0]="X",s[s.Y=1]="Y",s[s.Z=2]="Z",s[s.XY=3]="XY",s[s.XZ=4]="XZ",s[s.YZ=5]="YZ",s[s.XYZ=6]="XYZ",s[s.MAX=7]="MAX",s[s.NONE=8]="NONE",s))(R||{}),$t=(s=>(s[s.Local=0]="Local",s[s.Global=1]="Global",s))($t||{});class Gs extends Pe{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(R.MAX),this.mAxisColor=new Array(R.MAX),this.mAxisMaterial=new Array(R.MAX),this.mAxisCollider=new Array(R.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 ee;let t=new nt;t.baseColor=new P(1,0,0),t.depthCompare=et.always,this.mAxisColor[R.X]=t.baseColor,this.mAxisMaterial[R.X]=t;let a=new nt;a.baseColor=new P(0,1,0),a.depthCompare=et.always,this.mAxisColor[R.Y]=a.baseColor,this.mAxisMaterial[R.Y]=a;let r=new nt;r.baseColor=new P(0,0,1),r.depthCompare=et.always,this.mAxisColor[R.Z]=r.baseColor,this.mAxisMaterial[R.Z]=r;let i=this.createCustomAxis(R.X),n=this.createCustomAxis(R.Y),o=this.createCustomAxis(R.Z);this.mContainer.addChild(this.mAxis[R.X]=i),this.mContainer.addChild(this.mAxis[R.Y]=n),this.mContainer.addChild(this.mAxis[R.Z]=o),this.mAxisCollider[R.X]=i.getComponent(qt),this.mAxisCollider[R.Y]=n.getComponent(qt),this.mAxisCollider[R.Z]=o.getComponent(qt)}start(){}onEnable(e){this.object3D.addChild(this.mContainer),this.reset()}onDisable(e){this.object3D.removeChild(this.mContainer)}reset(){switch(this.transformSpaceMode){case $t.Local:{let t=E.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 $t.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(m.inputSystem.mouseX,m.inputSystem.mouseY),r,i;for(let n=0;n<=R.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||n==R.XYZ)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},n==R.XYZ)))break}return i}currentAxis=R.NONE;beginPoint=new u;beginMousePos=new u;currentPoint=new u;onMouseDown(e){if(e.mouseCode!=Rs.MOUSE_LEFT)return;let t=this.pickAxis();if(!t)return;this.currentAxis=t.axis,e.stopImmediatePropagation();const r=this.object3D.transform.scene3D.view.camera;let i=r.worldToScreenPoint(this.mX.transform.worldPosition),n=r.screenPointToWorld(m.inputSystem.mouseX,m.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(n),this.beginMousePos.x=m.inputSystem.mouseX,this.beginMousePos.y=m.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==R.NONE){let t=this.lastMoveObj.getComponent($).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==R.XYZ&&(this.mAxis[R.X].getComponent($).material.setUniformColor("baseColor",this.mAxisColor[R.X]),this.mAxis[R.Y].getComponent($).material.setUniformColor("baseColor",this.mAxisColor[R.Y]),this.mAxis[R.Z].getComponent($).material.setUniformColor("baseColor",this.mAxisColor[R.Z])),this.lastMoveAxis=R.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new P(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==R.XYZ&&(this.mAxis[R.X].getComponent($).material.setUniformColor("baseColor",new P(1,1,1)),this.mAxis[R.Y].getComponent($).material.setUniformColor("baseColor",new P(1,1,1)),this.mAxis[R.Z].getComponent($).material.setUniformColor("baseColor",new P(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(m.inputSystem.mouseX,m.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let n=i.subtract(this.beginPoint);u.HELP_0.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let o=u.distance(u.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(u.HELP_0),this.transformSpaceMode){case $t.Local:this.applyLocalTransform(this.currentAxis,n,o);break;case $t.Global:this.applyGlobalTransform(this.currentAxis,n,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Rs.MOUSE_LEFT&&(this.currentAxis=R.NONE,this.reset())}onUpdate(e){let a=u.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 R.X:t=1;break;case R.Y:a=1;break;case R.Z:r=1;break}let i=.4+t*20,n=.4+a*20,o=.4+r*20,l=new ee;l.x=i*.5,l.y=n*.5,l.z=o*.5;let c=l.addComponent($);c.geometry=new Fa(i,n,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(qt),d=new li;return d.setFromCenterAndSize(new u(0,0,0),new u(i+1,n+1,o+1)),f.shape=d,l}}class lu extends Gs{init(e){super.init(e);let t=new nt;t.doubleSide=!0,t.baseColor=new P(.9,.9,.9),t.depthCompare=et.always,this.mAxisColor[R.XYZ]=t.baseColor,this.mAxisMaterial[R.XYZ]=t;let a=new ee,r=a.addComponent($);r.geometry=new Fa(2,2,2),r.material=this.mAxisMaterial[R.XYZ];let i=a.addComponent(qt),n=new li;n.setFromCenterAndSize(new u(0,0,0),new u(2,2,2)),i.shape=n,this.mContainer.addChild(this.mAxis[R.XYZ]=a),this.mAxisCollider[R.XYZ]=a.getComponent(qt)}applyLocalTransform(e,t,a){switch(this.currentAxis){case R.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==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=u.HELP_0;r.set(0,0,0),(this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ)&&(r.x=t.x),(this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ)&&(r.y=t.y),(this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,u.HELP_1),this.mX.scaleX+=u.HELP_1.x,this.mX.scaleY+=u.HELP_1.y,this.mX.scaleZ+=u.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 ee;switch(e){case R.X:t=1,i.rotationZ=-90;break;case R.Y:a=1;break;case R.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent($);return c.geometry=new Fa(2,2,2),c.material=this.mAxisMaterial[e],i}}var at=(s=>(s[s.Scale=0]="Scale",s[s.Rotation=1]="Rotation",s[s.Translation=2]="Translation",s[s.NONE=3]="NONE",s))(at||{});class cu extends Gs{applyLocalTransform(e,t,a){if(this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ,this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ){E.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),E.help_matrix_1.identity(),E.help_matrix_1.createByRotation(1,u.Y_AXIS),E.help_matrix_2.multiplyMatrices(E.help_matrix_1,E.help_matrix_0),E.help_matrix_2.invert(),E.help_matrix_1.multiplyMatrices(E.help_matrix_2,E.help_matrix_0);let r=E.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY),this.currentAxis==R.X){let r=t.worldToScreenPoint(a);u.HELP_1.set(r.x,r.y,0),u.HELP_2.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let i=u.HELP_2.subtract(u.HELP_1),n=u.getAngle(u.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.x-a.x>0&&(n=360-n),n}if(this.currentAxis==R.Y){let r=t.worldToScreenPoint(a);u.HELP_1.set(r.x,r.y,0),u.HELP_2.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let i=u.HELP_2.subtract(u.HELP_1),n=u.getAngle(u.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.y-a.y>0&&(n=360-n),n}if(this.currentAxis==R.Z){let r=t.worldToScreenPoint(a);u.HELP_1.set(r.x,r.y,0),u.HELP_2.set(m.inputSystem.mouseX,m.inputSystem.mouseY,0);let i=u.HELP_2.subtract(u.HELP_1),n=u.getAngle(u.X_AXIS,i);return i.y>0&&(n=360-n),t.transform.worldPosition.z-a.z>0&&(n=360-n),n}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==R.X||this.currentAxis==R.Y||this.currentAxis==R.Z){let r=this.getAngle();switch(E.help_matrix_0.identity(),this.currentAxis){case R.X:E.help_matrix_0.createByRotation(this.mLastAngle-r,u.X_AXIS);break;case R.Y:E.help_matrix_0.createByRotation(this.mLastAngle-r,u.Y_AXIS);break;case R.Z:E.help_matrix_0.createByRotation(this.mLastAngle-r,u.Z_AXIS);break}E.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),E.help_matrix_1.append(E.help_matrix_0),this.mX.parent&&(E.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),E.help_matrix_2.invert(),E.help_matrix_1.multiply(E.help_matrix_2));let n=E.help_matrix_1.decompose(jt.QUATERNION)[1];j.HELP_0.set(n.x,n.y,n.z,n.w),this.mLastAngle=r,this.mX.transform.localRotQuat=j.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=R.NONE&&(this.mAxis[R.X].getComponent($).enable=!1,this.mAxis[R.Y].getComponent($).enable=!1,this.mAxis[R.Z].getComponent($).enable=!1,this.mAxis[this.currentAxis].getComponent($).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==R.NONE&&(this.mAxis[R.X].getComponent($).enable=!0,this.mAxis[R.Y].getComponent($).enable=!0,this.mAxis[R.Z].getComponent($).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new ee;switch(e){case R.X:t.rotationZ=90;break;case R.Y:break;case R.Z:t.rotationX=90;break}let a=t.addComponent($);a.geometry=new ou(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(qt),i=new li;return i.setFromCenterAndSize(new u,new u(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(m.inputSystem.mouseX,m.inputSystem.mouseY),r,i;for(let n=0;n<=R.MAX;n++){let o=this.mAxisCollider[n];if(o&&(r=o.rayPick(a),r)){let l=u.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:n,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class fu extends Gs{init(e){super.init(e);let t=new nt;t.doubleSide=!0,t.baseColor=new P(0,0,1),t.depthCompare=et.always,this.mAxisColor[R.XY]=t.baseColor,this.mAxisMaterial[R.XY]=t;let a=new nt;a.doubleSide=!0,a.baseColor=new P(0,1,0),a.depthCompare=et.always,this.mAxisColor[R.XZ]=a.baseColor,this.mAxisMaterial[R.XZ]=a;let r=new nt;r.doubleSide=!0,r.baseColor=new P(1,0,0),r.depthCompare=et.always,this.mAxisColor[R.YZ]=r.baseColor,this.mAxisMaterial[R.YZ]=r;let i=this.createPlane(R.XY),n=this.createPlane(R.XZ),o=this.createPlane(R.YZ);this.mContainer.addChild(this.mAxis[R.XY]=i),this.mContainer.addChild(this.mAxis[R.XZ]=n),this.mContainer.addChild(this.mAxis[R.YZ]=o),this.mAxisCollider[R.XY]=i.getComponent(qt),this.mAxisCollider[R.XZ]=n.getComponent(qt),this.mAxisCollider[R.YZ]=o.getComponent(qt)}applyLocalTransform(e,t,a){E.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),E.help_matrix_0.transformVector(t,u.HELP_0),this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ||(u.HELP_0.x=0),this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ||(u.HELP_0.y=0),this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ||(u.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(u.HELP_0,u.HELP_1),this.mX.x+=u.HELP_1.x,this.mX.y+=u.HELP_1.y,this.mX.z+=u.HELP_1.z}applyGlobalTransform(e,t,a){E.help_matrix_0.identity(),(this.currentAxis==R.X||this.currentAxis==R.XY||this.currentAxis==R.XZ)&&E.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==R.Y||this.currentAxis==R.XY||this.currentAxis==R.YZ)&&E.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==R.Z||this.currentAxis==R.XZ||this.currentAxis==R.YZ)&&E.help_matrix_0.appendTranslation(0,0,t.z),E.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),E.help_matrix_1.append(E.help_matrix_0),this.mX.parent&&(E.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),E.help_matrix_2.invert(),E.help_matrix_1.multiply(E.help_matrix_2));let r=E.help_matrix_1.decompose(jt.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 ee;switch(e){case R.X:t=1,i.rotationZ=-90;break;case R.Y:a=1,i.rotationY=-90;break;case R.Z:r=1,i.rotationX=90;break}let n=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=n*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent($);return c.geometry=new nu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new ee,a=t.addComponent($);a.material=this.mAxisMaterial[e];let r=t.addComponent(qt),i=new li;switch(r.shape=i,e){case R.XY:a.geometry=new ei(4,4,1,1,u.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new u(0,0,0),new u(4,4,.1));break;case R.XZ:a.geometry=new ei(4,4,1,1,u.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new u(0,0,0),new u(4,.1,4));break;case R.YZ:a.geometry=new ei(4,4,1,1,u.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new u(0,0,0),new u(.1,4,4));break}return t}}class el extends ee{static _instance;static get instance(){return this._instance||(this._instance=new el),this._instance}mTarget;mTransformMode=at.NONE;mTransformSpaceType=$t.Global;mControllers;mXObj;mYObj;mZObj;constructor(){super(),this.mControllers=[null,null,null],this.mControllers[at.Scale]=this.addComponent(lu),this.mControllers[at.Rotation]=this.addComponent(cu),this.mControllers[at.Translation]=this.addComponent(fu),this.mControllers[at.Scale].enable=!1,this.mControllers[at.Rotation].enable=!1,this.mControllers[at.Translation].enable=!1,this.mXObj=new ee,this.mYObj=new ee,this.mZObj=new ee,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!=at.NONE&&(this.mControllers[this.mTransformMode].enable=!1),this.mTransformMode=e,this.mTransformMode!=at.NONE&&(this.mControllers[this.mTransformMode].enable=!0))}selectTransformSpaceMode(e){this.mTransformSpaceType!=e&&(this.mTransformSpaceType=e,this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].reset())}activate(){m.inputSystem.addEventListener(va.KEY_DOWN,this.onKeyDown,this),m.inputSystem.addEventListener(O.POINTER_DOWN,this.onMouseDown,this,null,99999),m.inputSystem.addEventListener(O.POINTER_MOVE,this.onMouseMove,this,null,99999),m.inputSystem.addEventListener(O.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){m.inputSystem.removeEventListener(va.KEY_DOWN,this.onKeyDown,this),m.inputSystem.removeEventListener(O.POINTER_DOWN,this.onMouseDown,this),m.inputSystem.removeEventListener(O.POINTER_MOVE,this.onMouseMove,this),m.inputSystem.removeEventListener(O.POINTER_UP,this.onMouseUp,this)}onKeyDown(e){switch(e.keyCode){case Oe.Key_R:this.selectTransformMode(at.Scale),this.selectTransformSpaceMode($t.Local);break;case Oe.Key_E:this.selectTransformMode(at.Rotation),this.selectTransformSpaceMode($t.Global);break;case Oe.Key_W:this.selectTransformMode(at.Translation),this.selectTransformSpaceMode($t.Global);break;case Oe.Key_A:this.selectTransformSpaceMode($t.Local);break;case Oe.Key_S:this.selectTransformSpaceMode($t.Global);break}}onMouseDown(e){this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].onMouseDown(e)}onMouseMove(e){this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].onMouseMove(e)}onMouseUp(e){this.mTransformMode!=at.NONE&&this.mControllers[this.mTransformMode].onMouseUp(e)}}const hm=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{j0 as AccelerateDecelerateInterpolator,W0 as AccelerateInterpolator,wi as AnimationCurve,hr as AnimationCurveT,zr as AnimationMonitor,Pa as AnimatorComponent,jb as AnimatorEventKeyframe,H0 as AnticipateInterpolator,ns as AnticipateOvershootInterpolator,_u as ArrayHas,Bu as ArrayItemIndex,Of as AtlasParser,Pb as AtmosphericComponent,Ed as AtmosphericScatteringSky,kd as AtmosphericScatteringSkySetting,Fd as AtmosphericScatteringSky_shader,Vd as AttributeAnimCurve,om as AxisObject,Ga as B3DMLoader,Cf as B3DMLoaderBase,ho as B3DMParseUtil,co as B3DMParser,If as BRDFLUT,Qf as BRDFLUTGenerate,Ml as BRDF_frag,oo as BatchTable,Np as BiMap,qi as BillboardComponent,sr as BillboardType,cc as BitUtil,Va as BitmapTexture2D,Ec as BitmapTexture2DArray,to as BitmapTextureCube,Fc as Blend,kc as BlendFactor,ae as BlendMode,Io as BlendShapeData,Ro as BlendShapePropertyData,zg as BloomPost,mf as BlurEffectCreatorBlur_cs,pf as BlurEffectCreatorSample_cs,Af as BlurTexture2DBufferCreator,zt as BounceInterpolator,In as BoundUtil,pe as BoundingBox,Mr as BoundingSphere,Wr as BoundingVolume,li as BoxColliderShape,Fa as BoxGeometry,Cl as BrdfLut_frag,Vl as BsDF_frag,Nl as BxDF_frag,Gl as BxdfDebug_frag,en as BytesArray,$e as CEvent,Ra as CEventDispatcher,hs as CEventListener,Ha as CResizeEvent,Zt as CSM,Kr as Camera3D,ag as CameraControllerBase,We as CameraType,Ke as CameraUtil,Bg as CapsuleColliderShape,Jc as CastPointShadowMaterialPass,zc as CastShadowMaterialPass,Pl as Clearcoat_frag,_0 as ClusterBoundsSource_cs,gt as ClusterConfig,bl as ClusterDebug_frag,Hl as ClusterLight,D0 as ClusterLightingBuffer,v0 as ClusterLightingRender,B0 as ClusterLighting_cs,Yc as CollectInfo,qt as ColliderComponent,qe as ColliderShape,oi as ColliderShapeType,P as Color,Vp as ColorGradient,Rp as ColorLitMaterial,xd as ColorLitShader,Eb as ColorPassFragmentOutput,A0 as ColorPassRenderer,bs as ColorUtil,tn as ComData,md as Combine_cs,xl as Common_frag,yl as Common_vert,Pe as ComponentBase,xe as ComponentCollect,ti as ComputeGPUBuffer,fe as ComputeShader,ol as Context3D,Pn as CubeCamera,Df as CubeMapFaceEnum,fn as CubeSky_Shader,Ps as CubicBezierCurve,Pp as CubicBezierPath,Yh as CubicBezierType,K0 as CycleInterpolator,nu as CylinderGeometry,N0 as DDGIIrradianceComputePass,cs as DDGIIrradianceGPUBufferReader,f0 as DDGIIrradianceVolume,M0 as DDGIIrradiance_shader,L0 as DDGILightingPass,O0 as DDGILighting_shader,P0 as DDGIMultiBouncePass,G0 as DDGIProbeRenderer,rt as DEGREES_TO_RADIANS,ef as DRACO_DECODER_GLTF_JS,Z0 as DecelerateInterpolator,Ad as Denoising_cs,C0 as Depth2DTextureArray,x0 as DepthCubeArrayTexture,Wc as DepthMaterialPass,Jg as DepthOfFieldPost,td as DepthOfView_cs,yi as DirectLight,Wi as DoubleArray,jr as EditorInspector,m as Engine3D,c0 as Entity,Xc as EntityBatchCollect,J as EntityCollect,Sl as EnvMap_frag,Tt as ErpImage2CubeMap,_f as ErpImage2CubeMapCreateCube_cs,Bf as ErpImage2CubeMapRgbe2rgba_cs,Cg as ExtrudeGeometry,cr as FAILED,la as FASTFLOOR,On as FXAAPost,I0 as FXAAShader,kl as FastMathShader,Sg as FatLineGeometry,Ip as FatLineMaterial,Ni as FatLineRenderer,Pi as FatLineShader,gc as FatLine_FS,bc as FatLine_VS,ys as FeatureTable,pt as FileLoader,rg as FirstPersonCameraController,Rn as Float16ArrayTexture,sm as Float32ArrayTexture,ig as FlyCameraController,Nf as FontChar,Tf as FontInfo,Mf as FontPage,za as FontParser,J0 as ForwardRenderJob,un as FragmentOutput,wl as FragmentVarying,Uo as FrameCache,Un as Frustum,Sc as FrustumCSM,kb as FrustumCulling_cs,zl as FullQuad_vert_wgsl,ne as GBufferFrame,Gc as GBufferPass,Wg as GBufferPost,fc as GBufferStand,bn as GBuffer_pass,$n as GILighting,oh as GIProbeMaterial,Fo as GIProbeMaterialType,yd as GIProbeShader,Ln as GIRenderCompleteEvent,_s as GIRenderStartEvent,uf as GLBChunk,hf as GLBHeader,eo as GLBParser,wc as GLSLLexer,pi as GLSLLexerToken,Rc as GLSLPreprocessor,Mc as GLSLSyntax,kf as GLTFBinaryExtension,ip as GLTFMaterial,Dt as GLTFParser,vs as GLTFSubParser,tf as GLTFSubParserCamera,df as GLTFSubParserConverter,rf as GLTFSubParserMaterial,af as GLTFSubParserMesh,qn as GLTFSubParserSkeleton,sf as GLTFSubParserSkin,Yt as GLTFType,Q2 as GLTF_Accessors,Bs as GLTF_Info,E2 as GLTF_Light,I2 as GLTF_Mesh,w2 as GLTF_Node,R2 as GLTF_Primitives,k2 as GLTF_Scene,Ot as GPUAddressMode,vu as GPUBlendFactor,Qa as GPUBufferBase,aa as GPUBufferType,et as GPUCompareFunction,y as GPUContext,wt as GPUCullMode,er as GPUFilterMode,cn as GPUPrimitiveTopology,Y as GPUTextureFormat,gi as GPUVertexFormat,yu as GPUVertexStepMode,di as GSplatFormat,s0 as GSplatGeometry,e0 as GSplatMaterial,_i as GSplatRenderer,Di as GSplatShader,$c as GSplat_FS,qc as GSplat_VS,Zg as GTAOPost,ad as GTAO_cs,Pf as GUIAtlasTexture,$i as GUICanvas,Ir as GUIConfig,Jd as GUIGeometry,Zd as GUIGeometryRebuild,Co as GUIMaterial,z0 as GUIPassRenderer,Hd as GUIPick,$d as GUIPickHelper,wa as GUIQuad,Ze as GUIQuadAttrEnum,jd as GUIRenderer,yo as GUIShader,Kt as GUISpace,ri as GUISprite,mr as GUITexture,tp as GaussianSplatParser,Yl as GenerayRandomDir,ap as GeoJsonParser,rp as GeoJsonUtil,Is as GeoType,Ee as GeometryBase,r0 as GeometryIndicesBuffer,lm as GeometryUtil,t0 as GeometryVertexBuffer,bt as GeometryVertexType,ll as GetComponentClass,on as GetCountInstanceID,Qu as GetRepeat,cl as GetShader,wb as GlassShader,oe as GlobalBindGroup,xn as GlobalBindGroupLayout,jg as GlobalFog,vo as GlobalFog_shader,gg as GlobalIlluminationComponent,dn as GlobalUniform,Qn as GlobalUniformGroup,Yg as GodRayPost,rd as GodRay_cs,cm as GridObject,ro as HDRTexture,xs as HDRTextureCube,Kl as Hair_frag,Rb as Hair_shader_op,Ib as Hair_shader_tr,As as HaltonSeq,ah as Horizontal,sg as HoverCameraController,da as I3DMLoader,Ef as I3DMLoaderBase,Rf as I3DMParser,xf as IBLEnvMapCreator,Uf as IBLEnvMapCreator_cs,ba as IESProfiles,Il as IESProfiles_frag,Eg as IKDTreeUserData,ni as ImageType,a0 as IndicesGPUBuffer,Ul as Inline_vert,nl as InputSystem,pg as InstanceDrawComponent,Fl as InstanceUniform,wf as InstancedMesh,pr as Interpolator,Gn as InterpolatorEnum,_h as IrradianceDataReaderCompleteEvent,vl as IrradianceVolumeData_frag,Tl as Irradiance_frag,Au as IsEditorInspector,sn as IsNonSerialize,nf as Joint,Kn as JointPose,X0 as JumperInterpolator,Rg as KDTreeEntity,br as KDTreeNode,dh as KDTreeRange,hh as KDTreeSpace,rs as KDTreeUUID,Hn as KHR_draco_mesh_compression,sp as KHR_lights_punctual,lf as KHR_materials_clearcoat,cf as KHR_materials_emissive_strength,np as KHR_materials_ior,ff as KHR_materials_unlit,Yf as KMZParser,wo as KV,fm as KelvinUtil,Oe as KeyCode,va as KeyEvent,ks as Keyframe,Ji as KeyframeT,Cs as LDRTextureCube,Ca as LOADED,Qo as LOADING,Oh as LRUCache,Qp as LambertMaterial,$l as Lambert_shader,Es as Light,xi as LightBase,ms as LightData,d0 as LightEntries,Xe as LightType,gl as LightingFunction_frag,lt as Line,Kd as LineClassification,Y0 as LinearInterpolator,ka as LitMaterial,Ts as LitSSSShader,Ms as LitShader,Ol as Lit_shader,Jr as LoaderBase,Ig as LoaderEvent,$s as LoaderManager,ku as MAX_VALUE,Eu as MIN_VALUE,mt as Material,Oc as MaterialDataUniformGPUBuffer,Qs as MaterialUtilities,pl as MathShader,St as MathUtil,Nr as Matrix3,E as Matrix4,b0 as MatrixBindGroup,u0 as MatrixGPUBuffer,Xl as MatrixShader,Ka as MemoryDO,dl as MemoryInfo,Mg as MergeRGBACreator,id as MergeRGBA_cs,qs as MeshColliderShape,ws as MeshFilter,$ as MeshRenderer,zp as MinMaxAnimationCurves,tu as MinMaxCurve,eu as MinMaxCurveState,Jp as MinMaxPolyCurves,Og as MorePassParser,Ah as MorePassShader,Hb as MorphTargetBlender,p0 as MorphTargetData,Kb as MorphTargetFrame,Ld as MorphTargetTransformKey,Pt as MorphTarget_shader,Rs as MouseCode,V0 as MultiBouncePass_cs,iu as Navi3DAstar,Zi as Navi3DConst,ha as Navi3DEdge,Ja as Navi3DFunnel,ur as Navi3DMaskType,am as Navi3DMesh,_t as Navi3DPoint,$o as Navi3DPoint2D,fa as Navi3DPointFat,re as Navi3DRouter,su as Navi3DTriangle,rn as NonSerialize,El as NormalMap_frag,of as OAnimationEvent,gf as OBJParser,ee as Object3D,Qg as Object3DEvent,el as Object3DTransformTools,dm as Object3DUtil,Pd as ObjectAnimClip,Vn as OcclusionSystem,gr as Octree,Kc as OctreeEntity,ng as OrbitController,Op as OrderMap,jt as Orientation3D,sd as OutLineBlendColor_cs,nd as OutlineCalcOutline_cs,Qb as OutlinePass,Xg as OutlinePost,vh as OutlinePostData,Uh as OutlinePostManager,Bh as OutlinePostSlot,od as Outline_cs,q0 as OvershootInterpolator,Vh as PARSING,Ll as PBRLItShader,Cd as PBRLitSSSShader,vp as PLUGIN_REGISTERED,st as ParserBase,ze as ParserFormat,$h as ParticleSystemCurveEvalMode,Xh as ParticleSystemRandomnessIds,mi as PassGenerate,Dh as PassShader,H as PassType,ml as PhysicMaterialUniform_frag,lh as PickCompute,ch as PickFire,ft as PickGUIEvent3D,xh as PickResult,ld as Picker_cs,gn as PingPong,Fn as PipelinePool,au as Plane3D,Qr as PlaneClassification,ei as PlaneGeometry,qd as PointClassification,ai as PointLight,y0 as PointLightShadowRenderer,U0 as PointShadowCubeCamera,O as PointerEvent3D,Sa as Polynomial,Wa as PolynomialCurve,Gp as Polynomials,Yd as PoolNode,Rt as PostBase,Hf as PostProcessingComponent,E0 as PostRenderer,F0 as PreDepthPassRenderer,w0 as PreFilteredEnvironment_cs,vb as PreFilteredEnvironment_cs2,cd as PreIntegratedLut,mh as PreIntegratedLutCompute,Eo as PrefabAvatarData,wh as PrefabAvatarParser,ko as PrefabBoneData,Ih as PrefabMaterialParser,Qh as PrefabMeshData,Th as PrefabMeshParser,fs as PrefabNode,Nh as PrefabParser,hp as PrefabStringUtil,Rh as PrefabTextureData,Mh as PrefabTextureParser,ra as Preprocessor,Mo as PriorityQueue,nh as Probe,Ng as ProbeEntries,T0 as ProbeGBufferFrame,Ye as ProfilerUtil,Zb as PropertyAnimClip,Od as PropertyAnimTag,jo as PropertyAnimation,Jo as PropertyAnimationClip,Nd as PropertyAnimationClipState,Ii as PropertyAnimationEvent,Ri as PropertyHelp,Ut as QuadAABB,tc as QuadGlsl_fs,ec as QuadGlsl_vs,bh as QuadRoot,Bi as QuadShader,uh as QuadTree,Ar as QuadTreeCell,Cu as Quad_depth2dArray_frag_wgsl,Zl as Quad_depth2d_frag_wgsl,jl as Quad_depthCube_frag_wgsl,Wl as Quad_frag_wgsl,Jl as Quad_vert_wgsl,j as Quaternion,o0 as R32UintTexture,Xr as RADIANS_TO_DEGREES,vf as RGBEErrorCode,io as RGBEHeader,so as RGBEParser,ke as RTDescriptor,je as RTFrame,Ua as RTResourceConfig,vt as RTResourceMap,Yi as Rand,Tu as RandomSeed,ea as Ray,ui as RayCastMeshDetail,qr as Reader,is as Rect,ge as Reference,Rd as Reflection,hc as ReflectionCG,h0 as ReflectionEntries,Qd as ReflectionMaterial,R0 as ReflectionRenderer,Id as ReflectionShader,dc as ReflectionShader_shader,Vt as RegisterComponent,Ia as RegisterShader,Nn as RenderContext,Ai as RenderLayer,kn as RenderLayerUtil,Na as RenderNode,Hc as RenderShaderCollect,ph as RenderShaderCompute,Ve as RenderShaderPass,At as RenderTexture,xa as RendererBase,Q0 as RendererJob,k0 as RendererMap,Be as RendererMask,Wt as RendererMaskUtil,m0 as RendererPassState,pn as RepeatSE,Xf as Res,cu as RotationControlComponents,uc as SHCommon_frag,ss as SN_ArrayConstant,ar as SN_BinaryOperation,h2 as SN_Break,ca as SN_CodeBlock,La as SN_Constant,Ws as SN_Continue,Ge as SN_Declaration,u2 as SN_Discard,d2 as SN_DoWhileLoop,ue as SN_Expression,Or as SN_ForLoop,zs as SN_Function,Js as SN_FunctionArgs,Pr as SN_FunctionCall,Tr as SN_IFBranch,Ta as SN_Identifier,Gr as SN_IndexOperation,Ki as SN_Layout,Qc as SN_ParenExpression,Zs as SN_Precision,Xi as SN_Return,Hi as SN_SelectOperation,Oa as SN_Struct,Tc as SN_TernaryOperation,$r as SN_UnaryOperation,Lr as SN_WhileLoop,Ub as SSAO_cs,fd as SSGI2_cs,Hg as SSGIPost,Kg as SSRPost,dd as SSR_BlendColor_cs,qg as SSR_IS_Kernel,hd as SSR_IS_cs,ud as SSR_RayTrace_cs,lu as ScaleControlComponents,Ug as Scene3D,ot as Shader,Sn as ShaderAttributeInfo,Nc as ShaderConverter,Vc as ShaderConverterResult,z as ShaderLib,ln as ShaderPassBase,Bt as ShaderReflection,ia as ShaderStage,Pc as ShaderState,Cn as ShaderUniformInfo,Ma as ShaderUtil,Rl as ShadingInput,It as ShadowLightsCollect,S0 as ShadowMapPassRenderer,Ql as ShadowMapping_frag,qb as Skeleton,js as SkeletonAnimationClip,Md as SkeletonAnimationClipState,nr as SkeletonAnimationComponent,$b as SkeletonAnimationCompute,Yr as SkeletonAnimation_shader,eg as SkeletonBlendComputeArgs,Ui as SkeletonPose,tg as SkeletonTransformComputeArgs,Vi as SkinnedMeshRenderer,lr as SkinnedMeshRenderer2,Lc as SkyGBufferPass,ac as SkyGBuffer_pass,wd as SkyMaterial,Fs as SkyRenderer,Ei as SkyShader,nm as SolidColorSky,vg as SphereColliderShape,Rr as SphereGeometry,Td as SphereReflection,Ci as SpotLight,bf as StandShader,ye as StatementNode,ve as StorageGPUBuffer,Ct as StringUtil,bi as Struct,Vg as StructStorageGPUBuffer,i0 as SubGeometry,bd as TAACopyTex_cs,$g as TAAPost,gd as TAASharpTex_cs,pd as TAA_cs,Dd as TestComputeLoadBuffer,eh as TextAnchor,ih as TextFieldLayout,rh as TextFieldLine,He as Texture,Us as TextureCube,no as TextureCubeFaceData,Ys as TextureCubeStdCreator,ao as TextureCubeUtils,Pg as TextureMipmapCompute,ua as TextureMipmapGenerator,gh as TextureScaleCompute,lg as ThirdPersonCameraController,To as Tile,Cp as TileSet,Fp as TileSetChild,kp as TileSetChildContent,Ep as TileSetChildContentMetaData,Sp as TileSetRoot,yp as TilesRenderer,Fe as Time,B as TokenType,ou as TorusGeometry,sl as TouchData,rm as TrailGeometry,Qt as Transform,R as TransformAxisEnum,Gs as TransformControllerBaseComponent,at as TransformMode,$t as TransformSpaceMode,fu as TranslationControlComponents,yn as TranslatorContext,im as TriGeometry,ts as Triangle,Yo as UIButton,sh as UIButtonTransition,So as UIComponentBase,Tg as UIEvent,Vr as UIImage,Xo as UIImageGroup,Ks as UIInteractive,Le as UIInteractiveStyle,es as UIPanel,Mi as UIRenderAble,Ho as UIShadow,Ko as UITextField,Za as UITransform,fr as UNLOADED,Et as UUID,qo as UV,n0 as Uint32ArrayTexture,wn as Uint8ArrayTexture,ql as UnLit,nt as UnLitMaterial,Al as UnLitMaterialUniform_frag,Oi as UnLitShader,Mp as UnLitTexArrayMaterial,Li as UnLitTexArrayShader,Sd as UnLitTextureArray,Dl as UnLit_frag,dt as UniformGPUBuffer,qa as UniformNode,ht as UniformType,G as ValueEnumType,tm as ValueOp,Ea as ValueParser,Wp as ValueSpread,K as Vector2,u as Vector3,Qi as Vector3Ex,te as Vector4,kg as VertexAttribute,Ud as VertexAttributeIndexShader,V as VertexAttributeName,$a as VertexAttributeSize,fh as VertexAttributeStride,_l as VertexAttributes_vert,Fg as VertexBufferLayout,ul as VertexFormat,Ds as VertexGPUBuffer,th as Vertical,Bl as VideoUniform_frag,xg as View3D,Xs as ViewPanel,Mn as ViewQuad,Ae as VirtualTexture,_p as WGS84_FLATTENING,Bp as WGS84_HEIGHT,Dp as WGS84_RADIUS,Ic as WGSLTranslator,ls as WayLines3D,os as WayPoint3D,Qe as WebGPUDescriptorCreator,hn as WorldMatrixUniform,Hs as WorldPanel,ci as WrapMode,or as WrapTimeMode,Gg as ZCullingCompute,vd as ZPassShader_cs,lc as ZPassShader_fs,oc as ZPassShader_vs,Zc as ZSorterUtil,Cc as append,yf as arrayToString,Uu as blendComponent,jp as buildCurves,Sh as byteSizeOfType,Yp as calculateCurveRangesValue,Gi as calculateMinMax,ic as castPointShadowMap_vert,se as clamp,r2 as clampRepeat,yh as computeAABBFromPositions,Yu as cos,e2 as crossProduct,Hh as cubicPolynomialRoot,Kh as cubicPolynomialRootsGeneric,Zp as curvesSupportProcedural,Wu as deg2Rad,Ch as detectGSplatFormat,nc as directionShadowCastMap_frag,ut as dot,qh as doubleIntegrateSegment,$f as downSample,xc as fastInvSqrt,Uc as floorfToIntPos,ii as fonts,t2 as generateRandom,a2 as generateRandom3,Dc as getFloatFromInt,Z2 as getGLTypeFromTypedArray,W2 as getGLTypeFromTypedArrayType,Xu as getGlobalRandomSeed,j2 as getTypedArray,Xn as getTypedArrayTypeFromGLType,Zo as grad1,Ls as grad2,zi as grad3,hi as grad4,Fh as inferSHOrder,Wo as integrateSegment,Lg as irradianceDataReader,Lp as kPI,wr as lerp,Iu as lerpByte,Ru as lerpColor,wu as lerpVector3,jh as lruPriorityCallback,An as magnitude,ab as makeAloneSprite,Vf as makeGUISprite,ps as makeMatrix44,Lo as markUsedSetLeaves,Vs as markUsedTiles,Go as markVisibleTiles,vn as matrixMultiply,o2 as matrixRotate,n2 as matrixRotateY,us as mergeFunctions,yc as multiplyMatrices4x4REF,ru as normal_distribution,$u as normalizeFast,Ac as normalizeSafe,qu as normalizedToByte,Ku as normalizedToWord,oa as outlinePostData,ep as outlinePostManager,Eh as parsePlyGaussianSplat,kh as parsePlyHeader,le as perm,ed as post,Zh as priorityCallback,Os as quadraticPolynomialRootsGeneric,Zu as rad2Deg,Hr as random01,Ju as randomBarycentricCoord,zu as randomPointBetweenEllipsoid,Lu as randomPointBetweenSphere,Pu as randomPointInsideCube,Ou as randomPointInsideEllipsoid,Gu as randomPointInsideUnitCircle,Bc as randomPointInsideUnitSphere,Nu as randomQuaternion,Vu as randomQuaternionUniformDistribution,vc as randomSeed,gs as randomUnitVector,_c as randomUnitVector2,it as rangedRandomFloat,Mu as rangedRandomInt,tt as readByType,lo as readMagicBytes,Tp as registerMaterial,Bn as repeat,s2 as rotMatrix,Fu as rotateVectorByQuat,Dn as roundfToIntPos,mn as scale,sc as shadowCastMap_frag,rc as shadowCastMap_vert,Gt as simplex,ju as sin,Kp as snoise1,qp as snoise2,$p as snoise3,em as snoise4,_n as sqrMagnitude,mc as sqrtImpl,xu as stencilStateFace,Hu as swap,_d as textureCompress,qf as threshold,wp as throttle,rr as toHalfFloat,zo as toggleTiles,Up as traverseAncestors,Lh as traverseSet,Fb as tw,Xp as uniform_real_distribution,Hp as uniform_real_distribution2,Bo as upSample,k as webGPUContext,jc as zSorterUtil};
|
|
11691
11691
|
//# sourceMappingURL=rings.es.js.map
|