1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-0LhFotdt.js","assets/index-DmX7KW9i.css","assets/pass.fragment-iPWhOUDx.js"])))=>i.map(i=>d[i]); 2import{T as d,C as _,c as v,E as T,g,f as D,h as b,i as C,j as I,n as x}from"./index-0LhFotdt.js";let f=null;async function S(){const n=g.LastCreatedEngine?.createCanvas(100,100)??new OffscreenCanvas(100,100);n instanceof OffscreenCanvas&&v.Warn("DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values.");const{ThinEngine:i}=await D(async()=>{const{ThinEngine:t}=await import("./index-0LhFotdt.js").then(a=>a.t);return{ThinEngine:t}},__vite__mapDeps([0,1]));if(!i.IsSupported)throw new Error("DumpData: No WebGL context available. Cannot dump data.");const s={preserveDrawingBuffer:!0,depth:!1,stencil:!1,alpha:!0,premultipliedAlpha:!1,antialias:!1,failIfMajorPerformanceCaveat:!1},e=new i(n,!1,s);g.Instances.pop(),g.OnEnginesDisposedObservable.add(t=>{e&&t!==e&&!e.isDisposed&&g.Instances.length===0&&A()}),e.getCaps().parallelShaderCompile=void 0;const o=new b(e),{passPixelShader:r}=await D(async()=>{const{passPixelShader:t}=await import("./pass.fragment-iPWhOUDx.js");return{passPixelShader:t}},__vite__mapDeps([2,0,1])),p=new C({engine:e,name:r.name,fragmentShader:r.shader,samplerNames:["textureSampler"]});return{canvas:n,dumpEngine:{engine:e,renderer:o,wrapper:p}}}async function P(){return f||(f=S()),await f}class E{static async EncodeImageAsync(i,s,e,o,r,p){const t=await P(),a=t.dumpEngine;a.engine.setSize(s,e,!0);const c=a.engine.createRawTexture(i,s,e,5,!1,!r,1);return a.renderer.setViewport(),a.renderer.applyEffectWrapper(a.wrapper),a.wrapper.effect._bindTexture("textureSampler",c),a.renderer.draw(),c.dispose(),await new Promise((l,u)=>{d.ToBlob(t.canvas,m=>{m?l(m):u(new Error("EncodeImageAsync: Failed to convert canvas to blob."))},o,p)})}}I([x],E,"EncodeImageAsync",null);const B=E.EncodeImageAsync;async function h(n,i,s,e,o="image/png",r,p){const t=await s.readPixels(0,0,n,i),a=new Uint8Array(t.buffer);y(n,i,a,e,o,r,!0,void 0,p)}async function w(n,i,s,e="image/png",o,r=!1,p=!1,t){if(s instanceof Float32Array){const l=new Uint8Array(s.length);let u=s.length;for(;u--;){const m=s[u];l[u]=Math.round(_(m)*255)}s=l}const a=await E.EncodeImageAsync(s,n,i,e,r,t);o!==void 0&&d.DownloadBlob(a,o),a.type!==e&&v.Warn(`DumpData: The requested mimeType '${e}' is not supported. The result has mimeType '${a.type}' instead.`);const c=await a.arrayBuffer();return p?c:`data:${e};base64,${T(c)}`}function y(n,i,s,e,o="image/png",r,p=!1,t=!1,a){r===void 0&&!e&&(r=""),w(n,i,s,o,r,p,t,a).then(c=>{e&&e(c)})}function A(){f&&(f?.then(n=>{n.canvas instanceof HTMLCanvasElement&&n.canvas.remove(),n.dumpEngine&&(n.dumpEngine.engine.dispose(),n.dumpEngine.renderer.dispose(),n.dumpEngine.wrapper.dispose())}),f=null)}const L={DumpData:y,DumpDataAsync:w,DumpFramebuffer:h,Dispose:A},O=()=>{d.DumpData=y,d.DumpDataAsync=w,d.DumpFramebuffer=h};O();export{A as Dispose,y as DumpData,w as DumpDataAsync,h as DumpFramebuffer,L as DumpTools,B as EncodeImageAsync};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.