@rings-webgpu/core 1.0.24 → 1.0.25
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 +2 -2
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +27 -4
- package/dist/rings.umd.js +2 -2
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +27 -4
- package/package.json +1 -1
package/dist/rings.es.max.js
CHANGED
|
@@ -32698,9 +32698,32 @@ class StringUtil {
|
|
|
32698
32698
|
return url.substring(0, s_pos);
|
|
32699
32699
|
}
|
|
32700
32700
|
static normalizePath(url) {
|
|
32701
|
-
|
|
32702
|
-
|
|
32703
|
-
|
|
32701
|
+
if (!url) {
|
|
32702
|
+
return url;
|
|
32703
|
+
}
|
|
32704
|
+
let normalized = url.replace(/\\/g, "/");
|
|
32705
|
+
const preserveLeadingDoubleSlash = normalized.startsWith("//");
|
|
32706
|
+
const protectedTokens = [];
|
|
32707
|
+
let tokenIndex = 0;
|
|
32708
|
+
normalized = normalized.replace(
|
|
32709
|
+
/([a-zA-Z][a-zA-Z0-9+\-.]*):\/{2}/g,
|
|
32710
|
+
(match, scheme, offset) => {
|
|
32711
|
+
if (scheme.length === 1 && offset === 0) {
|
|
32712
|
+
return match;
|
|
32713
|
+
}
|
|
32714
|
+
const token = `__SCHEME_SLASH_${tokenIndex++}__`;
|
|
32715
|
+
protectedTokens.push(token);
|
|
32716
|
+
return `${scheme}:${token}`;
|
|
32717
|
+
}
|
|
32718
|
+
);
|
|
32719
|
+
normalized = normalized.replace(/\/{2,}/g, "/");
|
|
32720
|
+
protectedTokens.forEach((token) => {
|
|
32721
|
+
normalized = normalized.replace(token, "//");
|
|
32722
|
+
});
|
|
32723
|
+
if (preserveLeadingDoubleSlash) {
|
|
32724
|
+
normalized = `//${normalized.replace(/^\/+/, "")}`;
|
|
32725
|
+
}
|
|
32726
|
+
return normalized;
|
|
32704
32727
|
}
|
|
32705
32728
|
static getStringList(str, char = ";") {
|
|
32706
32729
|
return str.split(char);
|
|
@@ -41265,7 +41288,7 @@ class PostProcessingComponent extends ComponentBase {
|
|
|
41265
41288
|
}
|
|
41266
41289
|
}
|
|
41267
41290
|
|
|
41268
|
-
const version = "1.0.
|
|
41291
|
+
const version = "1.0.24";
|
|
41269
41292
|
|
|
41270
41293
|
class Engine3D {
|
|
41271
41294
|
/**
|
package/dist/rings.umd.js
CHANGED
|
@@ -7228,7 +7228,7 @@ fn CsMain( @builtin(workgroup_id) workgroup_id : vec3<u32> , @builtin(global_inv
|
|
|
7228
7228
|
}
|
|
7229
7229
|
`;class p0{computeShader;worldPosMap;worldNormalMap;colorMap;shadowMap;pointShadowMap;lightingTexture;constructor(){let e=A.setting.gi;this.lightingTexture=new gt(e.probeSourceTextureSize,e.probeSourceTextureSize,Y.rgba16float,!1,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING)}create(e){let t=le.getLightEntries(e.scene);this.computeShader=new fe(m0);let a=le.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",le.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",A.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=S.beginCommandEncoder(),r=A.setting.gi;this.computeShader.workerSizeX=r.probeSourceTextureSize/8,this.computeShader.workerSizeY=r.probeSourceTextureSize/8,this.computeShader.workerSizeZ=1,S.computeCommand(a,[this.computeShader]),S.endCommandEncoder(a)}}let cn=new qe("GIRenderStartEvent"),Bs=new qe("GIRenderCompleteEvent");class t2{count;complete}class A0 extends ma{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 Ds(.01,5e3),this.sizeW=t.probeSourceTextureSize,this.sizeH=t.probeSourceTextureSize,this.probeNext=t.probeSourceTextureSize/t.probeSize,this.initIrradianceMap(e),this.probeRenderResult=new t2;let a=new d0(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 p0,this.bouncePass=new g0(this.volume),this.irradianceComputePass=new u0(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=W.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=W.instance.getRenderNodes(e.scene,t);S.bindCamera(a,t);let n=Math.max(0,A.setting.render.drawOpMin),o=Math.min(A.setting.render.drawOpMax,i.opaqueList.length),l=W.instance.getRenderShaderCollect(e);for(const c of l){let f=c[1];for(const h of f){let u=h[1];if(!u.isDestroyed&&u.preInit(this.passType)){u.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))}W.instance.sky&&(W.instance.sky.preInit(this.passType)||W.instance.sky.nodeUpdate(e,this.passType,this.rendererPassState,null),W.instance.sky.renderPass2(e,this.passType,this.rendererPassState,null,a)),n=Math.max(0,A.setting.render.drawTrMin),o=Math.min(A.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(!A.setting.gi.enable)return;this.volume.updateOrientation(),this.volume.isVolumeFrameChange=!1,this.volume.uploadBuffer(),this.rendProbe(e);let a=this.probeRenderResult.count>0;(W.instance.state.giLightingChange||a||A.setting.gi.realTimeGI)&&(W.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(Bs)}startRenderGI(e=0){this.nextProbeIndex==-1&&e==0&&this.dispatchEvent(cn),this.nextProbeIndex=e,this.renderStatus="rendering"}startRenderCloudGI(){this.dispatchEvent(cn),this.nextProbeIndex=0,this.renderStatus="rendering",this.isRenderCloudGI=!0}rendProbe(e){let t=A.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=W.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 gt(t.octRTMaxSize,t.octRTMaxSize,Y.rgba16float,!1,a),this.irradianceDepthMap.name="irradianceDepthMap",this.irradianceColorMap=new gt(t.octRTMaxSize,t.octRTMaxSize,Y.rgba16float,!1,a),this.irradianceColorMap.name="irradianceColorMap"}writeToTexture(e,t,a,r){console.log(e.name);const i=E.device.createBuffer({size:t.byteLength,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC});E.device.queue.writeBuffer(i,0,t);const n=S.beginCommandEncoder();n.copyBufferToTexture({buffer:i,bytesPerRow:a*16},{texture:e.getGPUTexture()},{width:a,height:r,depthOrArrayLayers:1}),S.endCommandEncoder(n)}}class D0 extends ma{constructor(){super(),this.passType=H.UI}compute(e,t){let a=S.beginCommandEncoder(),r=S.lastRenderPassState.getLastRenderTexture(),i=oe.getGUIBufferFrame().getColorTexture();S.copyTexture(a,r,i),S.endCommandEncoder(a)}render(e,t,a,r=!1){this.renderContext.clean();let i=e.scene,n=e.camera;le.updateCameraGroup(n),this.rendererPassState.camera3D=n;let o=W.instance.getRenderNodes(i,n);{this.renderContext.specialtRenderPass();let l=this.renderContext.encoder;o.opaqueList&&(S.bindCamera(l,n),this.drawNodes(e,this.renderContext,o.opaqueList,t,a))}{let l=this.renderContext.encoder;!r&&o.transparentList&&(S.bindCamera(l,n),this.drawNodes(e,this.renderContext,o.transparentList,t,a)),this.renderContext.endRenderPass()}}drawNodes(e,t,a,r,i){let n=W.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=A.setting.render.drawOpMin;o<Math.min(a.length,A.setting.render.drawOpMax);++o){let l=a[o];l.transform.enable&&l.enable&&(!l.hasMask(De.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 _0 extends f0{constructor(e){super(e)}start(){super.start();{let e=new Yc,t=oe.getGBufferFrame(oe.colorPass_GBuffer);if(A.setting.render.zPrePass&&(t.zPreTexture=this.depthPassRenderer.rendererPassState.depthTexture),e.setRenderStates(t),A.setting.gi.enable){let a=le.getLightEntries(this.view.scene);this.ddgiProbeRenderer=new A0(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=oe.getGUIBufferFrame(),t=new D0;t.setRenderStates(e),this.rendererMap.addRenderer(t)}A.setting.render.debug&&this.debug()}debug(){}}class B0{_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 U0{_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 v0{_factor=1;constructor(){}getInterpolation(e){return Math.cos((e+1)*Math.PI)/2+.5}}class y0{getInterpolation(e){return e}}class C0{getInterpolation(e){return 4.9*e+4.9*e}}class Vt{constructor(){}static bounce(e){return e*e*9.8}getInterpolation(e){return e*=1.1226,e<.3535?Vt.bounce(e):e<.7408?Vt.bounce(e-.54719)+.7:e<.9644?Vt.bounce(e-.8526)+.9:Vt.bounce(e-1.0435)+.95}getBounceInterpolation(e){return e<.5?Vt.bounce(e):Vt.bounce(e-1)}geJumpUp(e,t){return t<.5?(t=t/.5,e*t-Vt.bounce(t)):t<.8?(t=(t-.5)/(.8-.5),(e*t-Vt.bounce(t))*.3):t<1?(t=(t-.8)/(1-.8),(e*t-Vt.bounce(t))*.15):e*t-Vt.bounce(t)}}class S0{_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 Bi{_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*Bi.a(e*2,this._tension):.5*(Bi.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 x0{_cycles;constructor(e){this._cycles=e}getInterpolation(e){return Math.sin(2*this._cycles*Math.PI*e)}}class F0{_tension;constructor(){this._tension=2}getInterpolation(e){return e-=1,e*e*((this._tension+1)*e+this._tension)+1}}var Us=(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))(Us||{});class rr{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 rr;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=rr.interpolators;for(let a of t)a.complete?rr.remove(a,!0):a.tick(e)}static remove(e,t){let a=rr.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=B0,window.DecelerateInterpolator=U0,window.AccelerateDecelerateInterpolator=v0,window.LinearInterpolator=y0,window.BounceInterpolator=Vt,window.AnticipateInterpolator=S0,window.AnticipateOvershootInterpolator=Bi,window.CycleInterpolator=x0,window.OvershootInterpolator=F0,window.JumperInterpolator=C0,this._interpolator=new window[Us[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,rr.remove(this)}}class yt{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
|
|
@@ -7762,7 +7762,7 @@ else if (typeof exports === 'object')
|
|
|
7762
7762
|
`;class ff{compute;constructor(){this.compute=new fe(cf)}generateBRDFLUTTexture(){let e=new pe(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=S.beginCommandEncoder();return S.computeCommand(t,[this.compute]),S.endCommandEncoder(t),e}}class qr{id;guiTexture;uvRec=new $(0,0,1,1);uvBorder=new $(0,0,0,0);offsetSize=new $(0,0,4,4);borderSize=new $(0,0,0,0);trimSize=new K;isSliced=!1;height=4;width=4;xadvance=0;xoffset=0;yoffset=0;constructor(e){this.guiTexture=e||A.res.defaultGUITexture}}class ir{static _maxUid=-1;_staticId=-1;dynamicId=-1;texture;width=1;height=1;get staticId(){return this._staticId}constructor(e){e||=A.res.whiteTexture,e.addressModeU="clamp-to-edge",e.addressModeV="clamp-to-edge",this.texture=e,ir._maxUid++,this._staticId=ir._maxUid,this.init()}init(){this.dynamicId=-1,this.width=this.texture.width,this.height=this.texture.height}}class F2{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 $r=new F2;class df{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 hf{id=0;file=""}class uf{id=-1;x=0;y=0;width=0;height=0;xoffset=0;yoffset=0;xadvance=0;page=0;chnl=0}class za extends nt{static format=Ge.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 qr;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),$r.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 df;a.trim().split(t).forEach((i,n)=>{if(n<2)za.readLineProperty(i,r);else if(n<r.pages+2){let o=new hf;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 uf;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 A.res.loadTexture(r,null,!0);let i=A.res.getTexture(r),n=new ir(i);e.push(n)}za.parseSprite(e,t),t.fontChar[" "]||za.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new qr,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),$r.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 k2(s,e){let t=new qr;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 ir(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function bf(s,e,t){let a=new qr;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 gf{_spriteMap=new Map;_spriteList=[];textureSize=new K;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=bf(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 mf extends nt{static format=Ge.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await A.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 gf(this._json.size),t=new ir(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);A.res.addAtlas(this.baseUrl,e),this.data=e}}var Ot=Uint8Array,ei=Uint16Array,E2=Int32Array,pf=new Ot([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]),Af=new Ot([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]),R2=new Ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Df=function(s,e){for(var t=new ei(31),a=0;a<31;++a)t[a]=e+=1<<s[a-1];for(var r=new E2(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}},_f=Df(pf,2),Bf=_f.b,w2=_f.r;Bf[28]=258,w2[258]=28;for(var I2=Df(Af,0),Q2=I2.b,js=new ei(32768),we=0;we<32768;++we){var nr=(we&43690)>>1|(we&21845)<<1;nr=(nr&52428)>>2|(nr&13107)<<2,nr=(nr&61680)>>4|(nr&3855)<<4,js[we]=((nr&65280)>>8|(nr&255)<<8)>>1}for(var Si=(function(s,e,t){for(var a=s.length,r=0,i=new ei(e);r<a;++r)s[r]&&++i[s[r]-1];var n=new ei(e);for(r=1;r<e;++r)n[r]=n[r-1]+i[r-1]<<1;var o;if(t){o=new ei(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],h=n[s[r]-1]++<<f,u=h|(1<<f)-1;h<=u;++h)o[js[h]>>l]=c}else for(o=new ei(a),r=0;r<a;++r)s[r]&&(o[r]=js[n[s[r]-1]++]>>15-s[r]);return o}),xi=new Ot(288),we=0;we<144;++we)xi[we]=8;for(var we=144;we<256;++we)xi[we]=9;for(var we=256;we<280;++we)xi[we]=7;for(var we=280;we<288;++we)xi[we]=8;for(var Uf=new Ot(32),we=0;we<32;++we)Uf[we]=5;var T2=Si(xi,9,1),M2=Si(Uf,5,1),Zs=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},oa=function(s,e,t){var a=e/8|0;return(s[a]|s[a+1]<<8)>>(e&7)&t},Ys=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},N2=function(s){return(s+7)/8|0},Xs=function(s,e,t){return(e==null||e<0)&&(e=0),(t==null||t>s.length)&&(t=s.length),new Ot(s.subarray(e,t))},P2=["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"],Xt=function(s,e,t){var a=new Error(e||P2[s]);if(a.code=s,Error.captureStackTrace&&Error.captureStackTrace(a,Xt),!t)throw a;return a},V2=function(s,e,t,a){var r=s.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new Ot(0);var n=!t,o=n||e.i!=2,l=e.i;n&&(t=new Ot(r*3));var c=function(It){var Qt=t.length;if(It>Qt){var Gt=new Ot(Math.max(Qt*2,It));Gt.set(t),t=Gt}},f=e.f||0,h=e.p||0,u=e.b||0,g=e.l,p=e.d,m=e.m,D=e.n,_=r*8;do{if(!g){f=oa(s,h,1);var B=oa(s,h+1,3);if(h+=3,B)if(B==1)g=T2,p=M2,m=9,D=5;else if(B==2){var F=oa(s,h,31)+257,k=oa(s,h+10,15)+4,w=F+oa(s,h+5,31)+1;h+=14;for(var x=new Ot(w),M=new Ot(19),N=0;N<k;++N)M[R2[N]]=oa(s,h+N*3,7);h+=k*3;for(var Q=Zs(M),G=(1<<Q)-1,X=Si(M,Q,1),N=0;N<w;){var ne=X[oa(s,h,G)];h+=ne&15;var v=ne>>4;if(v<16)x[N++]=v;else{var q=0,he=0;for(v==16?(he=3+oa(s,h,3),h+=2,q=x[N-1]):v==17?(he=3+oa(s,h,7),h+=3):v==18&&(he=11+oa(s,h,127),h+=7);he--;)x[N++]=q}}var Be=x.subarray(0,F),ae=x.subarray(F);m=Zs(Be),D=Zs(ae),g=Si(Be,m,1),p=Si(ae,D,1)}else Xt(1);else{var v=N2(h)+4,C=s[v-4]|s[v-3]<<8,y=v+C;if(y>r){l&&Xt(0);break}o&&c(u+C),t.set(s.subarray(v,y),u),e.b=u+=C,e.p=h=y*8,e.f=f;continue}if(h>_){l&&Xt(0);break}}o&&c(u+131072);for(var ee=(1<<m)-1,se=(1<<D)-1,Ae=h;;Ae=h){var q=g[Ys(s,h)&ee],Ue=q>>4;if(h+=q&15,h>_){l&&Xt(0);break}if(q||Xt(2),Ue<256)t[u++]=Ue;else if(Ue==256){Ae=h,g=null;break}else{var Se=Ue-254;if(Ue>264){var N=Ue-257,Te=pf[N];Se=oa(s,h,(1<<Te)-1)+Bf[N],h+=Te}var ve=p[Ys(s,h)&se],Me=ve>>4;ve||Xt(3),h+=ve&15;var ae=Q2[Me];if(Me>3){var Te=Af[Me];ae+=Ys(s,h)&(1<<Te)-1,h+=Te}if(h>_){l&&Xt(0);break}o&&c(u+131072);var Ut=u+Se;if(u<ae){var ya=i-ae,Ca=Math.min(ae,Ut);for(ya+u<0&&Xt(3);u<Ca;++u)t[u]=a[ya+u]}for(;u<Ut;++u)t[u]=t[u-ae]}}e.l=g,e.p=Ae,e.b=u,e.f=f,g&&(f=1,e.m=m,e.d=p,e.n=D)}while(!f);return u!=t.length&&n?Xs(t,0,u):t.subarray(0,u)},O2=new Ot(0),Aa=function(s,e){return s[e]|s[e+1]<<8},la=function(s,e){return(s[e]|s[e+1]<<8|s[e+2]<<16|s[e+3]<<24)>>>0},Hs=function(s,e){return la(s,e)+la(s,e+4)*4294967296};function L2(s,e){return V2(s,{i:2},e&&e.out,e&&e.dictionary)}var Ks=typeof TextDecoder<"u"&&new TextDecoder,G2=0;try{Ks.decode(O2,{stream:!0}),G2=1}catch{}var z2=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:Xs(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 vf(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(Ks)return Ks.decode(s);var r=z2(s),i=r.s,t=r.r;return t.length&&Xt(8),i}}var J2=function(s,e){return e+30+Aa(s,e+26)+Aa(s,e+28)},W2=function(s,e,t){var a=Aa(s,e+28),r=vf(s.subarray(e+46,e+46+a),!(Aa(s,e+8)&2048)),i=e+46+a,n=la(s,e+20),o=t&&n==4294967295?j2(s,i):[n,la(s,e+24),la(s,e+42)],l=o[0],c=o[1],f=o[2];return[Aa(s,e+10),l,c,r,i+Aa(s,e+30)+Aa(s,e+32),f]},j2=function(s,e){for(;Aa(s,e)!=1;e+=4+Aa(s,e+2));return[Hs(s,e+12),Hs(s,e+4),Hs(s,e+20)]};function Z2(s,e){for(var t={},a=s.length-22;la(s,a)!=101010256;--a)(!a||s.length-a>65558)&&Xt(13);var r=Aa(s,a+8);if(!r)return{};var i=la(s,a+16),n=i==4294967295||r==65535;if(n){var o=la(s,a-12);n=la(s,o)==101075792,n&&(r=la(s,o+32),i=la(s,o+48))}for(var l=0;l<r;++l){var c=W2(s,i,n),f=c[0],h=c[1],u=c[2],g=c[3],p=c[4],m=c[5],D=J2(s,m);i=p,f?f==8?t[g]=L2(s.subarray(D,D+h),{out:new Ot(u)}):Xt(14,"unknown compression type "+f):t[g]=Xs(s,D,D+h)}return t}class st extends ut{constructor(){super(),this.shader=new d.UnLitShader,this.baseMap=A.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 Cr extends Fe{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),h=new Uint16Array(i*r*2*3),u=0,g=0,p=0;for(t=0;t<=r;++t){var m=Math.PI*t/r,D=n*Math.cos(m),_=n*Math.sin(m);for(e=0;e<=i;++e){var B=2*Math.PI*e/i,v=_*Math.cos(B),C=_*Math.sin(B),y=1/Math.sqrt(v*v+D*D+C*C);if(l[u++]=v,l[u++]=D,l[u++]=C,c[g++]=v*y,c[g++]=D*y,c[g++]=C*y,f[p++]=e/i,f[p++]=t/r,e>0&&t>0){var F=(i+1)*t+e,k=(i+1)*t+e-1,w=(i+1)*(t-1)+e-1,x=(i+1)*(t-1)+e;t==r?(h[a++]=F,h[a++]=w,h[a++]=x):t==1?(h[a++]=F,h[a++]=k,h[a++]=w):(h[a++]=F,h[a++]=k,h[a++]=w,h[a++]=F,h[a++]=w,h[a++]=x)}}}this.setIndices(h),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:h.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new ge(b.ZERO,new b(this.radius*2,this.radius*2,this.radius*2))}}class Fi extends d.Object3D{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new b(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),Fi.register3DRepresentation)this.marker=Fi.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new d.Object3D;const e=this.marker.addComponent(d.MeshRenderer);e.geometry=new Cr(.1,32,16),e.material=new st,e.material.baseColor=this.positionValid?new O(0,1,0,1):new O(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class ki extends d.Object3D{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new Fi(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),ki.register3DRepresentation?(this.line=ki.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new O(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Fe,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 d.Object3D,o=n.addComponent(d.MeshRenderer),l=new st;return l.topology="line-list",l.baseColor=t,l.blendMode=te.ADD,l.castReflection=!1,o.geometry=a,o.material=l,n}}class yf extends nt{static format=Ge.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=Z2(new Uint8Array(e));for(const i in a){const n=a[i],l=new DOMParser().parseFromString(vf(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 ki(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 Cf{_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 At().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 At;r==".gltf"?a=await i.load(e,Dt,t):a=await i.load(e,Qs,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 At;r==".obj"&&(a=await i.load(e,J0,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 At().load(e,zs,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 At().load(e,lf,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 La;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(h=>{l.push(h),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 Ns;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 gn;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 pn;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 Ts;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 Ts;return await a.loadStd(e),a}async loadJSON(e,t){return await new At().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new At().load(e,za,t,a),n=i.data;return $r.addFontData(n.face,n.size,n),i.data}async loadAtlas(e,t){return(await new At().load(e,mf,t,e)).data}async loadKMZ(e,t){return(await new At().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 h=new ds;return h.name=o,h.create(16,16,f,!0),o&&this.addTexture(o,h),h}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 ff().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new gn,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 ir(this.whiteTexture),this.defaultGUISprite=new qr(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new pa}}class Sf extends Pe{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=A.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=A.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;A.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Y2="1.0.23";class A{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 E.presentationSize}static get aspect(){return E.aspect}static get width(){return E.windowWidth}static get height(){return E.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 O(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",Y2),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await be.init(R.allocCount,this.setting.doublePrecision),await E.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,oe.getGBufferFrame(oe.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),J.init(),Va.init(),le.init(),mt.init(),Et.init(),this.res=new Cf,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new No,this.inputSystem.initCanvas(E.canvas)}static startRenderJob(e){let t=new _0(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(Sf).addPost(_s),(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){xe.delta=e-xe.time,xe.time=e,xe.frame+=1,rr.tick(xe.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const n=t[a];n.scene.waitUpdate();let[o,l]=E.presentationSize;n.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const n of ye.componentsBeforeUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}let r=E.device.createCommandEncoder();for(const n of ye.componentsComputeList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o,r)}}E.device.queue.submit([r.finish()]);for(const n of ye.componentsUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}for(const n of ye.graphicComponent){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];o&&f.enable&&h(o)}}this._renderLoop&&await this._renderLoop(),be.updateAllContinueTransform(0,R.useCount,16),le.modelMatrixBindGroup.writeBuffer(R.useCount*16),this.renderJobs.forEach((n,o)=>{n.renderState||n.start(),n.renderFrame()});for(const n of ye.componentsLateUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}this._lateRender&&await this._lateRender()}}let An=`
|
|
7765
|
+
`}async loadFontTextures(){let e=[],t=this.data;for(const a of t.fontPage){let r=this.baseUrl+a.file;await A.res.loadTexture(r,null,!0);let i=A.res.getTexture(r),n=new ir(i);e.push(n)}za.parseSprite(e,t),t.fontChar[" "]||za.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new qr,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),$r.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 k2(s,e){let t=new qr;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 ir(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function bf(s,e,t){let a=new qr;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 gf{_spriteMap=new Map;_spriteList=[];textureSize=new K;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=bf(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 mf extends nt{static format=Ge.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await A.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 gf(this._json.size),t=new ir(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);A.res.addAtlas(this.baseUrl,e),this.data=e}}var Ot=Uint8Array,ei=Uint16Array,E2=Int32Array,pf=new Ot([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]),Af=new Ot([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]),R2=new Ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Df=function(s,e){for(var t=new ei(31),a=0;a<31;++a)t[a]=e+=1<<s[a-1];for(var r=new E2(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}},_f=Df(pf,2),Bf=_f.b,w2=_f.r;Bf[28]=258,w2[258]=28;for(var I2=Df(Af,0),Q2=I2.b,js=new ei(32768),we=0;we<32768;++we){var nr=(we&43690)>>1|(we&21845)<<1;nr=(nr&52428)>>2|(nr&13107)<<2,nr=(nr&61680)>>4|(nr&3855)<<4,js[we]=((nr&65280)>>8|(nr&255)<<8)>>1}for(var Si=(function(s,e,t){for(var a=s.length,r=0,i=new ei(e);r<a;++r)s[r]&&++i[s[r]-1];var n=new ei(e);for(r=1;r<e;++r)n[r]=n[r-1]+i[r-1]<<1;var o;if(t){o=new ei(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],h=n[s[r]-1]++<<f,u=h|(1<<f)-1;h<=u;++h)o[js[h]>>l]=c}else for(o=new ei(a),r=0;r<a;++r)s[r]&&(o[r]=js[n[s[r]-1]++]>>15-s[r]);return o}),xi=new Ot(288),we=0;we<144;++we)xi[we]=8;for(var we=144;we<256;++we)xi[we]=9;for(var we=256;we<280;++we)xi[we]=7;for(var we=280;we<288;++we)xi[we]=8;for(var Uf=new Ot(32),we=0;we<32;++we)Uf[we]=5;var T2=Si(xi,9,1),M2=Si(Uf,5,1),Zs=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},oa=function(s,e,t){var a=e/8|0;return(s[a]|s[a+1]<<8)>>(e&7)&t},Ys=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},N2=function(s){return(s+7)/8|0},Xs=function(s,e,t){return(e==null||e<0)&&(e=0),(t==null||t>s.length)&&(t=s.length),new Ot(s.subarray(e,t))},P2=["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"],Xt=function(s,e,t){var a=new Error(e||P2[s]);if(a.code=s,Error.captureStackTrace&&Error.captureStackTrace(a,Xt),!t)throw a;return a},V2=function(s,e,t,a){var r=s.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new Ot(0);var n=!t,o=n||e.i!=2,l=e.i;n&&(t=new Ot(r*3));var c=function(It){var Qt=t.length;if(It>Qt){var Gt=new Ot(Math.max(Qt*2,It));Gt.set(t),t=Gt}},f=e.f||0,h=e.p||0,u=e.b||0,g=e.l,p=e.d,m=e.m,D=e.n,_=r*8;do{if(!g){f=oa(s,h,1);var B=oa(s,h+1,3);if(h+=3,B)if(B==1)g=T2,p=M2,m=9,D=5;else if(B==2){var F=oa(s,h,31)+257,k=oa(s,h+10,15)+4,w=F+oa(s,h+5,31)+1;h+=14;for(var x=new Ot(w),M=new Ot(19),N=0;N<k;++N)M[R2[N]]=oa(s,h+N*3,7);h+=k*3;for(var Q=Zs(M),G=(1<<Q)-1,X=Si(M,Q,1),N=0;N<w;){var ne=X[oa(s,h,G)];h+=ne&15;var v=ne>>4;if(v<16)x[N++]=v;else{var q=0,he=0;for(v==16?(he=3+oa(s,h,3),h+=2,q=x[N-1]):v==17?(he=3+oa(s,h,7),h+=3):v==18&&(he=11+oa(s,h,127),h+=7);he--;)x[N++]=q}}var Be=x.subarray(0,F),ae=x.subarray(F);m=Zs(Be),D=Zs(ae),g=Si(Be,m,1),p=Si(ae,D,1)}else Xt(1);else{var v=N2(h)+4,C=s[v-4]|s[v-3]<<8,y=v+C;if(y>r){l&&Xt(0);break}o&&c(u+C),t.set(s.subarray(v,y),u),e.b=u+=C,e.p=h=y*8,e.f=f;continue}if(h>_){l&&Xt(0);break}}o&&c(u+131072);for(var ee=(1<<m)-1,se=(1<<D)-1,Ae=h;;Ae=h){var q=g[Ys(s,h)&ee],Ue=q>>4;if(h+=q&15,h>_){l&&Xt(0);break}if(q||Xt(2),Ue<256)t[u++]=Ue;else if(Ue==256){Ae=h,g=null;break}else{var Se=Ue-254;if(Ue>264){var N=Ue-257,Te=pf[N];Se=oa(s,h,(1<<Te)-1)+Bf[N],h+=Te}var ve=p[Ys(s,h)&se],Me=ve>>4;ve||Xt(3),h+=ve&15;var ae=Q2[Me];if(Me>3){var Te=Af[Me];ae+=Ys(s,h)&(1<<Te)-1,h+=Te}if(h>_){l&&Xt(0);break}o&&c(u+131072);var Ut=u+Se;if(u<ae){var ya=i-ae,Ca=Math.min(ae,Ut);for(ya+u<0&&Xt(3);u<Ca;++u)t[u]=a[ya+u]}for(;u<Ut;++u)t[u]=t[u-ae]}}e.l=g,e.p=Ae,e.b=u,e.f=f,g&&(f=1,e.m=m,e.d=p,e.n=D)}while(!f);return u!=t.length&&n?Xs(t,0,u):t.subarray(0,u)},O2=new Ot(0),Aa=function(s,e){return s[e]|s[e+1]<<8},la=function(s,e){return(s[e]|s[e+1]<<8|s[e+2]<<16|s[e+3]<<24)>>>0},Hs=function(s,e){return la(s,e)+la(s,e+4)*4294967296};function L2(s,e){return V2(s,{i:2},e&&e.out,e&&e.dictionary)}var Ks=typeof TextDecoder<"u"&&new TextDecoder,G2=0;try{Ks.decode(O2,{stream:!0}),G2=1}catch{}var z2=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:Xs(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 vf(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(Ks)return Ks.decode(s);var r=z2(s),i=r.s,t=r.r;return t.length&&Xt(8),i}}var J2=function(s,e){return e+30+Aa(s,e+26)+Aa(s,e+28)},W2=function(s,e,t){var a=Aa(s,e+28),r=vf(s.subarray(e+46,e+46+a),!(Aa(s,e+8)&2048)),i=e+46+a,n=la(s,e+20),o=t&&n==4294967295?j2(s,i):[n,la(s,e+24),la(s,e+42)],l=o[0],c=o[1],f=o[2];return[Aa(s,e+10),l,c,r,i+Aa(s,e+30)+Aa(s,e+32),f]},j2=function(s,e){for(;Aa(s,e)!=1;e+=4+Aa(s,e+2));return[Hs(s,e+12),Hs(s,e+4),Hs(s,e+20)]};function Z2(s,e){for(var t={},a=s.length-22;la(s,a)!=101010256;--a)(!a||s.length-a>65558)&&Xt(13);var r=Aa(s,a+8);if(!r)return{};var i=la(s,a+16),n=i==4294967295||r==65535;if(n){var o=la(s,a-12);n=la(s,o)==101075792,n&&(r=la(s,o+32),i=la(s,o+48))}for(var l=0;l<r;++l){var c=W2(s,i,n),f=c[0],h=c[1],u=c[2],g=c[3],p=c[4],m=c[5],D=J2(s,m);i=p,f?f==8?t[g]=L2(s.subarray(D,D+h),{out:new Ot(u)}):Xt(14,"unknown compression type "+f):t[g]=Xs(s,D,D+h)}return t}class st extends ut{constructor(){super(),this.shader=new d.UnLitShader,this.baseMap=A.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 Cr extends Fe{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),h=new Uint16Array(i*r*2*3),u=0,g=0,p=0;for(t=0;t<=r;++t){var m=Math.PI*t/r,D=n*Math.cos(m),_=n*Math.sin(m);for(e=0;e<=i;++e){var B=2*Math.PI*e/i,v=_*Math.cos(B),C=_*Math.sin(B),y=1/Math.sqrt(v*v+D*D+C*C);if(l[u++]=v,l[u++]=D,l[u++]=C,c[g++]=v*y,c[g++]=D*y,c[g++]=C*y,f[p++]=e/i,f[p++]=t/r,e>0&&t>0){var F=(i+1)*t+e,k=(i+1)*t+e-1,w=(i+1)*(t-1)+e-1,x=(i+1)*(t-1)+e;t==r?(h[a++]=F,h[a++]=w,h[a++]=x):t==1?(h[a++]=F,h[a++]=k,h[a++]=w):(h[a++]=F,h[a++]=k,h[a++]=w,h[a++]=F,h[a++]=w,h[a++]=x)}}}this.setIndices(h),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:h.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new ge(b.ZERO,new b(this.radius*2,this.radius*2,this.radius*2))}}class Fi extends d.Object3D{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new b(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),Fi.register3DRepresentation)this.marker=Fi.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new d.Object3D;const e=this.marker.addComponent(d.MeshRenderer);e.geometry=new Cr(.1,32,16),e.material=new st,e.material.baseColor=this.positionValid?new O(0,1,0,1):new O(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class ki extends d.Object3D{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new Fi(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),ki.register3DRepresentation?(this.line=ki.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new O(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Fe,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 d.Object3D,o=n.addComponent(d.MeshRenderer),l=new st;return l.topology="line-list",l.baseColor=t,l.blendMode=te.ADD,l.castReflection=!1,o.geometry=a,o.material=l,n}}class yf extends nt{static format=Ge.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=Z2(new Uint8Array(e));for(const i in a){const n=a[i],l=new DOMParser().parseFromString(vf(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 ki(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 Cf{_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 At().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 At;r==".gltf"?a=await i.load(e,Dt,t):a=await i.load(e,Qs,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 At;r==".obj"&&(a=await i.load(e,J0,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 At().load(e,zs,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 At().load(e,lf,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 La;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(h=>{l.push(h),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 Ns;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 gn;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 pn;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 Ts;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 Ts;return await a.loadStd(e),a}async loadJSON(e,t){return await new At().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new At().load(e,za,t,a),n=i.data;return $r.addFontData(n.face,n.size,n),i.data}async loadAtlas(e,t){return(await new At().load(e,mf,t,e)).data}async loadKMZ(e,t){return(await new At().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 h=new ds;return h.name=o,h.create(16,16,f,!0),o&&this.addTexture(o,h),h}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 ff().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new gn,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 ir(this.whiteTexture),this.defaultGUISprite=new qr(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new pa}}class Sf extends Pe{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=A.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=A.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;A.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Y2="1.0.24";class A{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 E.presentationSize}static get aspect(){return E.aspect}static get width(){return E.windowWidth}static get height(){return E.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 O(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",Y2),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await be.init(R.allocCount,this.setting.doublePrecision),await E.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,oe.getGBufferFrame(oe.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),J.init(),Va.init(),le.init(),mt.init(),Et.init(),this.res=new Cf,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new No,this.inputSystem.initCanvas(E.canvas)}static startRenderJob(e){let t=new _0(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(Sf).addPost(_s),(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){xe.delta=e-xe.time,xe.time=e,xe.frame+=1,rr.tick(xe.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const n=t[a];n.scene.waitUpdate();let[o,l]=E.presentationSize;n.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const n of ye.componentsBeforeUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}let r=E.device.createCommandEncoder();for(const n of ye.componentsComputeList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o,r)}}E.device.queue.submit([r.finish()]);for(const n of ye.componentsUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}for(const n of ye.graphicComponent){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];o&&f.enable&&h(o)}}this._renderLoop&&await this._renderLoop(),be.updateAllContinueTransform(0,R.useCount,16),le.modelMatrixBindGroup.writeBuffer(R.useCount*16),this.renderJobs.forEach((n,o)=>{n.renderState||n.start(),n.renderFrame()});for(const n of ye.componentsLateUpdateList){let o=n[0],l=n[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}this._lateRender&&await this._lateRender()}}let An=`
|
|
7766
7766
|
struct BloomCfg{
|
|
7767
7767
|
downSampleStep: f32,
|
|
7768
7768
|
downSampleBlurSize: f32,
|