@luma.gl/engine 9.2.3 → 9.2.5

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/dist.dev.js CHANGED
@@ -1047,12 +1047,13 @@ var __exports__ = (() => {
1047
1047
  pipeline.hash = hash;
1048
1048
  cache[hash] = { pipeline, useCount: 1 };
1049
1049
  if (this.debug) {
1050
- import_core4.log.warn(`${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
1050
+ import_core4.log.log(3, `${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
1051
1051
  }
1052
1052
  } else {
1053
1053
  cache[hash].useCount++;
1054
1054
  if (this.debug) {
1055
- import_core4.log.warn(
1055
+ import_core4.log.log(
1056
+ 3,
1056
1057
  `${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`
1057
1058
  )();
1058
1059
  }
@@ -1076,12 +1077,13 @@ var __exports__ = (() => {
1076
1077
  pipeline.hash = hash;
1077
1078
  cache[hash] = { pipeline, useCount: 1 };
1078
1079
  if (this.debug) {
1079
- import_core4.log.warn(`${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
1080
+ import_core4.log.log(3, `${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
1080
1081
  }
1081
1082
  } else {
1082
1083
  cache[hash].useCount++;
1083
1084
  if (this.debug) {
1084
- import_core4.log.warn(
1085
+ import_core4.log.log(
1086
+ 3,
1085
1087
  `${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`
1086
1088
  )();
1087
1089
  }
@@ -1099,13 +1101,13 @@ var __exports__ = (() => {
1099
1101
  if (cache[hash].useCount === 0) {
1100
1102
  this._destroyPipeline(pipeline);
1101
1103
  if (this.debug) {
1102
- import_core4.log.warn(`${this}: ${pipeline} released and destroyed`)();
1104
+ import_core4.log.log(3, `${this}: ${pipeline} released and destroyed`)();
1103
1105
  }
1104
1106
  } else if (cache[hash].useCount < 0) {
1105
1107
  import_core4.log.error(`${this}: ${pipeline} released, useCount < 0, resetting`)();
1106
1108
  cache[hash].useCount = 0;
1107
1109
  } else if (this.debug) {
1108
- import_core4.log.warn(`${this}: ${pipeline} released, count=${cache[hash].useCount}`)();
1110
+ import_core4.log.log(3, `${this}: ${pipeline} released, count=${cache[hash].useCount}`)();
1109
1111
  }
1110
1112
  }
1111
1113
  // PRIVATE
@@ -1210,12 +1212,15 @@ var __exports__ = (() => {
1210
1212
  });
1211
1213
  this._cache[key] = cacheEntry = { shader, useCount: 1 };
1212
1214
  if (this.debug) {
1213
- import_core5.log.warn(`${this}: Created new shader ${shader.id}`)();
1215
+ import_core5.log.log(3, `${this}: Created new shader ${shader.id}`)();
1214
1216
  }
1215
1217
  } else {
1216
1218
  cacheEntry.useCount++;
1217
1219
  if (this.debug) {
1218
- import_core5.log.warn(`${this}: Reusing shader ${cacheEntry.shader.id} count=${cacheEntry.useCount}`)();
1220
+ import_core5.log.log(
1221
+ 3,
1222
+ `${this}: Reusing shader ${cacheEntry.shader.id} count=${cacheEntry.useCount}`
1223
+ )();
1219
1224
  }
1220
1225
  }
1221
1226
  return cacheEntry.shader;
@@ -1235,13 +1240,13 @@ var __exports__ = (() => {
1235
1240
  delete this._cache[key];
1236
1241
  cacheEntry.shader.destroy();
1237
1242
  if (this.debug) {
1238
- import_core5.log.warn(`${this}: Releasing shader ${shader.id}, destroyed`)();
1243
+ import_core5.log.log(3, `${this}: Releasing shader ${shader.id}, destroyed`)();
1239
1244
  }
1240
1245
  }
1241
1246
  } else if (cacheEntry.useCount < 0) {
1242
1247
  throw new Error(`ShaderFactory: Shader ${shader.id} released too many times`);
1243
1248
  } else if (this.debug) {
1244
- import_core5.log.warn(`${this}: Releasing shader ${shader.id} count=${cacheEntry.useCount}`)();
1249
+ import_core5.log.log(3, `${this}: Releasing shader ${shader.id} count=${cacheEntry.useCount}`)();
1245
1250
  }
1246
1251
  }
1247
1252
  }
package/dist/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var qi=Object.create;var wt=Object.defineProperty;var Wi=Object.getOwnPropertyDescriptor;var Yi=Object.getOwnPropertyNames;var Xi=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty;var Ki=(i,t,e)=>t in i?wt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var De=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Zi=(i,t)=>{for(var e in t)wt(i,e,{get:t[e],enumerable:!0})},Nt=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Yi(t))!Hi.call(i,n)&&n!==e&&wt(i,n,{get:()=>t[n],enumerable:!(s=Wi(t,n))||s.enumerable});return i},Ft=(i,t,e)=>(Nt(i,t,"default"),e&&Nt(e,t,"default")),k=(i,t,e)=>(e=i!=null?qi(Xi(i)):{},Nt(t||!i||!i.__esModule?wt(e,"default",{value:i,enumerable:!0}):e,i)),Qi=i=>Nt(wt({},"__esModule",{value:!0}),i);var z=(i,t,e)=>(Ki(i,typeof t!="symbol"?t+"":t,e),e);var j=De((pn,ze)=>{ze.exports=globalThis.luma});var ht=De((kn,je)=>{je.exports=globalThis.luma});var Et={};Zi(Et,{AnimationLoop:()=>ct,AnimationLoopTemplate:()=>Bt,AsyncTexture:()=>tt,BackgroundTextureModel:()=>ft,BufferTransform:()=>It,ClipSpace:()=>et,Computation:()=>Ct,ConeGeometry:()=>se,CubeGeometry:()=>ne,CylinderGeometry:()=>re,GPUGeometry:()=>pt,Geometry:()=>B,GroupNode:()=>bt,IcoSphereGeometry:()=>oe,KeyFrames:()=>zt,LegacyPickingManager:()=>pe,Model:()=>W,ModelNode:()=>ie,PickingManager:()=>Pt,PipelineFactory:()=>Q,PlaneGeometry:()=>ae,ScenegraphNode:()=>st,ShaderFactory:()=>J,ShaderInputs:()=>H,ShaderPassRenderer:()=>le,SphereGeometry:()=>ce,Swap:()=>Mt,SwapBuffers:()=>he,SwapFramebuffers:()=>vt,TextureTransform:()=>Yt,Timeline:()=>Dt,TruncatedConeGeometry:()=>ot,cancelAnimationFramePolyfill:()=>Ut,colorPicking:()=>$i,indexPicking:()=>Bi,loadImage:()=>Je,loadImageBitmap:()=>Gt,makeAnimationLoop:()=>Ue,makeRandomGenerator:()=>Fi,requestAnimationFramePolyfill:()=>$t,setPathPrefix:()=>Qe});Ft(Et,k(j(),1));var Ji=1,ts=1,Dt=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(t){let{delay:e=0,duration:s=Number.POSITIVE_INFINITY,rate:n=1,repeat:r=1}=t,o=Ji++,a={time:0,delay:e,duration:s,rate:n,repeat:r};return this._setChannelTime(a,this.time),this.channels.set(o,a),o}removeChannel(t){this.channels.delete(t);for(let[e,s]of this.animations)s.channel===t&&this.detachAnimation(e)}isFinished(t){let e=this.channels.get(t);return e===void 0?!1:this.time>=e.delay+e.duration*e.repeat}getTime(t){if(t===void 0)return this.time;let e=this.channels.get(t);return e===void 0?-1:e.time}setTime(t){this.time=Math.max(0,t);let e=this.channels.values();for(let n of e)this._setChannelTime(n,this.time);let s=this.animations.values();for(let n of s){let{animation:r,channel:o}=n;r.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,e){let s=ts++;return this.animations.set(s,{animation:t,channel:e}),t.setTime(this.getTime(e)),s}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,e){let s=e-t.delay,n=t.duration*t.repeat;s>=n?t.time=t.duration*t.rate:(t.time=Math.max(0,s)%t.duration,t.time*=t.rate)}};var zt=class{startIndex=-1;endIndex=-1;factor=0;times=[];values=[];_lastTime=-1;constructor(t){this.setKeyFrames(t),this.setTime(0)}setKeyFrames(t){let e=t.length;this.times.length=e,this.values.length=e;for(let s=0;s<e;++s)this.times[s]=t[s][0],this.values[s]=t[s][1];this._calculateKeys(this._lastTime)}setTime(t){t=Math.max(0,t),t!==this._lastTime&&(this._calculateKeys(t),this._lastTime=t)}getStartTime(){return this.times[this.startIndex]}getEndTime(){return this.times[this.endIndex]}getStartData(){return this.values[this.startIndex]}getEndData(){return this.values[this.endIndex]}_calculateKeys(t){let e=0,s=this.times.length;for(e=0;e<s-2&&!(this.times[e+1]>t);++e);this.startIndex=e,this.endIndex=e+1;let n=this.times[this.startIndex],r=this.times[this.endIndex];this.factor=Math.min(Math.max(0,(t-n)/(r-n)),1)}};var Bt=class{constructor(t){}async onInitialize(t){return null}};var Be=k(j(),1);function $t(i){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(i):setTimeout(i,1e3/60)}function Ut(i){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(i):clearTimeout(i)}function At(){let i;if(typeof window<"u"&&window.performance)i=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();i=t[0]*1e3+t[1]/1e6}else i=Date.now();return i}var at=class{constructor(t,e){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=At(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(At()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var ut=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:s}=t,n=this.stats[e];return n||(t instanceof at?n=t:n=new at(e,s),this.stats[e]=n),n}};var es=0,me=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;constructor(t){if(this.props={...me.defaultAnimationLoopProps,...t},t=this.props,!t.device)throw new Error("No device provided");this.stats=t.stats||new ut({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:t.autoResizeViewport}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}reportError(t){this.props.onError(t),this._error=t}setNeedsRedraw(t){return this.needsRedraw=this.needsRedraw||t,this}setProps(t){return"autoResizeViewport"in t&&(this.props.autoResizeViewport=t.autoResizeViewport||!1),this}async start(){if(this._running)return this;this._running=!0;try{let t;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(t!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(t){let e=t instanceof Error?t:new Error("Unknown error");throw this.props.onError(e),e}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost||this._error?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport()}_setDisplay(t){this.display&&(this.display.destroy(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_requestAnimationFrame(){this._running&&(this._animationFrameId=$t(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(Ut(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(t){if(this.display){this.display._renderFrame(t);return}this.props.onRender(this._getAnimationProps()),this.device?.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){let t=this.device?.getDefaultCanvasContext();if(!this.device||!t)throw new Error("loop");let e=t?.canvas,s=t.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:t,canvas:e,useDevicePixels:s,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:t,height:e,aspect:s}=this._getSizeAndAspect();(t!==this.animationProps.width||e!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),s!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=e,this.animationProps.aspect=s,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";let e=document.createElement("div");e.style.position="absolute",e.style.left="10px",e.style.bottom="10px",e.style.width="300px",e.style.background="white",this.canvas instanceof HTMLCanvasElement&&t.appendChild(this.canvas),t.appendChild(e);let s=this.props.onAddHTML(e);s&&(e.innerHTML=s)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[t,e]=this.device?.getDefaultCanvasContext().getDevicePixelSize()||[1,1],s=1,n=this.device?.getDefaultCanvasContext().canvas;return n&&n.clientHeight?s=n.clientWidth/n.clientHeight:t>0&&e>0&&(s=t/e),{width:t,height:e,aspect:s}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(t){t instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[t.offsetX,t.offsetY])}_onMouseleave(t){this._getAnimationProps()._mousePosition=null}},ct=me;z(ct,"defaultAnimationLoopProps",{device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:Be.luma.stats.get(`animation-loop-${es++}`),autoResizeViewport:!1});var $e=k(j(),1);function Ue(i,t){let e=null,s=t?.device||$e.luma.createDevice({id:"animation-loop",adapters:t?.adapters,createCanvasContext:!0}),n=new ct({...t,device:s,async onInitialize(r){ss(r.animationLoop.device);try{return e=new i(r),await e?.onInitialize(r)}catch(o){return is(r.animationLoop.device,o),null}},onRender:r=>e?.onRender(r),onFinalize:r=>e?.onFinalize(r)});return n.getInfo=()=>this.AnimationLoopTemplateCtor.info,n}function is(i,t){let e=i?.getDefaultCanvasContext().canvas;if(e instanceof HTMLCanvasElement){e.style.overflow="visible";let s=document.getElementById("animation-loop-error");s?.remove(),s=document.createElement("h1"),s.id="animation-loop-error",s.innerHTML=t.message,s.style.position="absolute",s.style.top="10px",s.style.left="10px",s.style.color="black",s.style.backgroundColor="red",e.parentElement?.appendChild(s)}}function ss(i){let t=document.getElementById("animation-loop-error");t&&t.remove()}var S=k(j(),1),qt=k(ht(),1);var Tt=k(j(),1);var ge={};function C(i="id"){ge[i]=ge[i]||1;let t=ge[i]++;return`${i}-${t}`}var pt=class{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(t){if(this.id=t.id||C("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&!(this.indices.usage&Tt.Buffer.INDEX))throw new Error("Index buffer must have INDEX usage")}destroy(){this.indices?.destroy();for(let t of Object.values(this.attributes))t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices||null}_calculateVertexCount(t){return t.byteLength/12}};function Ve(i,t){if(t instanceof pt)return t;let e=ns(i,t),{attributes:s,bufferLayout:n}=rs(i,t);return new pt({topology:t.topology||"triangle-list",bufferLayout:n,vertexCount:t.vertexCount,indices:e,attributes:s})}function ns(i,t){if(!t.indices)return;let e=t.indices.value;return i.createBuffer({usage:Tt.Buffer.INDEX,data:e})}function rs(i,t){let e=[],s={};for(let[r,o]of Object.entries(t.attributes)){let a=r;switch(r){case"POSITION":a="positions";break;case"NORMAL":a="normals";break;case"TEXCOORD_0":a="texCoords";break;case"COLOR_0":a="colors";break}if(o){s[a]=i.createBuffer({data:o.value,id:`${r}-buffer`});let{value:c,size:l,normalized:h}=o;e.push({name:a,format:(0,Tt.getVertexFormatFromAttribute)(c,l,h)})}}let n=t._calculateVertexCount(t.attributes,t.indices);return{attributes:s,bufferLayout:e,vertexCount:n}}var V=k(j(),1);var xe=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new xe(t),t._lumaData.defaultPipelineFactory}device;cachingEnabled;destroyPolicy;debug;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};get[Symbol.toStringTag](){return"PipelineFactory"}toString(){return`PipelineFactory(${this.device.id})`}constructor(t){this.device=t,this.cachingEnabled=t.props._cachePipelines,this.destroyPolicy=t.props._cacheDestroyPolicy,this.debug=t.props.debugFactories}createRenderPipeline(t){if(!this.cachingEnabled)return this.device.createRenderPipeline(t);let e={...V.RenderPipeline.defaultProps,...t},s=this._renderPipelineCache,n=this._hashRenderPipeline(e),r=s[n]?.pipeline;return r?(s[n].useCount++,this.debug&&V.log.warn(`${this}: ${s[n].pipeline} reused, count=${s[n].useCount}, (id=${t.id})`)()):(r=this.device.createRenderPipeline({...e,id:e.id?`${e.id}-cached`:C("unnamed-cached")}),r.hash=n,s[n]={pipeline:r,useCount:1},this.debug&&V.log.warn(`${this}: ${r} created, count=${s[n].useCount}`)()),r}createComputePipeline(t){if(!this.cachingEnabled)return this.device.createComputePipeline(t);let e={...V.ComputePipeline.defaultProps,...t},s=this._computePipelineCache,n=this._hashComputePipeline(e),r=s[n]?.pipeline;return r?(s[n].useCount++,this.debug&&V.log.warn(`${this}: ${s[n].pipeline} reused, count=${s[n].useCount}, (id=${t.id})`)()):(r=this.device.createComputePipeline({...e,id:e.id?`${e.id}-cached`:void 0}),r.hash=n,s[n]={pipeline:r,useCount:1},this.debug&&V.log.warn(`${this}: ${r} created, count=${s[n].useCount}`)()),r}release(t){if(!this.cachingEnabled){t.destroy();return}let e=this._getCache(t),s=t.hash;e[s].useCount--,e[s].useCount===0?(this._destroyPipeline(t),this.debug&&V.log.warn(`${this}: ${t} released and destroyed`)()):e[s].useCount<0?(V.log.error(`${this}: ${t} released, useCount < 0, resetting`)(),e[s].useCount=0):this.debug&&V.log.warn(`${this}: ${t} released, count=${e[s].useCount}`)()}_destroyPipeline(t){let e=this._getCache(t);switch(this.destroyPolicy){case"never":return!1;case"unused":return delete e[t.hash],t.destroy(),!0}}_getCache(t){let e;if(t instanceof V.ComputePipeline&&(e=this._computePipelineCache),t instanceof V.RenderPipeline&&(e=this._renderPipelineCache),!e)throw new Error(`${this}`);if(!e[t.hash])throw new Error(`${this}: ${t} matched incorrect entry`);return e}_hashComputePipeline(t){let{type:e}=this.device,s=this._getHash(t.shader.source);return`${e}/C/${s}`}_hashRenderPipeline(t){let e=t.vs?this._getHash(t.vs.source):0,s=t.fs?this._getHash(t.fs.source):0,n="-",r=this._getHash(JSON.stringify(t.bufferLayout)),{type:o}=this.device;switch(o){case"webgl":return`${o}/R/${e}/${s}V${n}BL${r}`;case"webgpu":default:let a=this._getHash(JSON.stringify(t.parameters));return`${o}/R/${e}/${s}V${n}T${t.topology}P${a}BL${r}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}},Q=xe;z(Q,"defaultProps",{...V.RenderPipeline.defaultProps});var lt=k(j(),1);var ye=class{static getDefaultShaderFactory(t){return t._lumaData.defaultShaderFactory||=new ye(t),t._lumaData.defaultShaderFactory}device;cachingEnabled;destroyPolicy;debug;_cache={};get[Symbol.toStringTag](){return"ShaderFactory"}toString(){return`${this[Symbol.toStringTag]}(${this.device.id})`}constructor(t){this.device=t,this.cachingEnabled=t.props._cacheShaders,this.destroyPolicy=t.props._cacheDestroyPolicy,this.debug=!0}createShader(t){if(!this.cachingEnabled)return this.device.createShader(t);let e=this._hashShader(t),s=this._cache[e];if(s)s.useCount++,this.debug&&lt.log.warn(`${this}: Reusing shader ${s.shader.id} count=${s.useCount}`)();else{let n=this.device.createShader({...t,id:t.id?`${t.id}-cached`:void 0});this._cache[e]=s={shader:n,useCount:1},this.debug&&lt.log.warn(`${this}: Created new shader ${n.id}`)()}return s.shader}release(t){if(!this.cachingEnabled){t.destroy();return}let e=this._hashShader(t),s=this._cache[e];if(s)if(s.useCount--,s.useCount===0)this.destroyPolicy==="unused"&&(delete this._cache[e],s.shader.destroy(),this.debug&&lt.log.warn(`${this}: Releasing shader ${t.id}, destroyed`)());else{if(s.useCount<0)throw new Error(`ShaderFactory: Shader ${t.id} released too many times`);this.debug&&lt.log.warn(`${this}: Releasing shader ${t.id} count=${s.useCount}`)()}}_hashShader(t){return`${t.stage}:${t.source}`}},J=ye;z(J,"defaultProps",{...lt.Shader.defaultProps});function Ge(i,t){let e={},s="Values";if(i.attributes.length===0&&!i.varyings?.length)return{"No attributes or varyings":{[s]:"N/A"}};for(let n of i.attributes)if(n){let r=`${n.location} ${n.name}: ${n.type}`;e[`in ${r}`]={[s]:n.stepMode||"vertex"}}for(let n of i.varyings||[]){let r=`${n.location} ${n.name}`;e[`out ${r}`]={[s]:JSON.stringify(n)}}return e}var N=null,be=null;function qe(i,{id:t,minimap:e,opaque:s,top:n="0",left:r="0",rgbaScale:o=1}){N||(N=document.createElement("canvas"),N.id=t,N.title=t,N.style.zIndex="100",N.style.position="absolute",N.style.top=n,N.style.left=r,N.style.border="blue 5px solid",N.style.transform="scaleY(-1)",document.body.appendChild(N),be=N.getContext("2d")),(N.width!==i.width||N.height!==i.height)&&(N.width=i.width/2,N.height=i.height/2,N.style.width="400px",N.style.height="400px");let a=i.device.readPixelsToArrayWebGL(i),c=be?.createImageData(i.width,i.height);if(c){for(let h=0;h<a.length;h+=4)c.data[0+h+0]=a[h+0]*o,c.data[0+h+1]=a[h+1]*o,c.data[0+h+2]=a[h+2]*o,c.data[0+h+3]=s?255:a[h+3]*o;be?.putImageData(c,0,0)}}function jt(i,t,e){if(i===t)return!0;if(!e||!i||!t)return!1;if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let s=0;s<i.length;s++)if(!jt(i[s],t[s],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof i=="object"&&typeof t=="object"){let s=Object.keys(i),n=Object.keys(t);if(s.length!==n.length)return!1;for(let r of s)if(!t.hasOwnProperty(r)||!jt(i[r],t[r],e-1))return!1;return!0}return!1}var We=k(j(),1),mt=class{bufferLayouts;constructor(t){this.bufferLayouts=t}getBufferLayout(t){return this.bufferLayouts.find(e=>e.name===t)||null}getAttributeNamesForBuffer(t){return t.attributes?t.attributes?.map(e=>e.attribute):[t.name]}mergeBufferLayouts(t,e){let s=[...t];for(let n of e){let r=s.findIndex(o=>o.name===n.name);r<0?s.push(n):s[r]=n}return s}getBufferIndex(t){let e=this.bufferLayouts.findIndex(s=>s.name===t);return e===-1&&We.log.warn(`BufferLayout: Missing buffer for "${t}".`)(),e}};function Ye(i,t){let e=Object.fromEntries(i.attributes.map(n=>[n.name,n.location])),s=t.slice();return s.sort((n,r)=>{let o=n.attributes?n.attributes.map(h=>h.attribute):[n.name],a=r.attributes?r.attributes.map(h=>h.attribute):[r.name],c=Math.min(...o.map(h=>e[h])),l=Math.min(...a.map(h=>e[h]));return c-l}),s}var Vt=k(j(),1),Ze=k(ht(),1);function Xe(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function He(i){return Array.isArray(i)?i.length===0||typeof i[0]=="number":!1}function St(i){return Xe(i)||He(i)}function os(i){return St(i)||typeof i=="number"||typeof i=="boolean"}function Ke(i){let t={bindings:{},uniforms:{}};return Object.keys(i).forEach(e=>{let s=i[e];os(s)?t.uniforms[e]=s:t.bindings[e]=s}),t}var H=class{options={disableWarnings:!1};modules;moduleUniforms;moduleBindings;constructor(t,e){Object.assign(this.options,e);let s=(0,Ze.getShaderModuleDependencies)(Object.values(t).filter(n=>n.dependencies));for(let n of s)t[n.name]=n;Vt.log.log(1,"Creating ShaderInputs with modules",Object.keys(t))(),this.modules=t,this.moduleUniforms={},this.moduleBindings={};for(let[n,r]of Object.entries(t))this._addModule(r),r.name&&n!==r.name&&!this.options.disableWarnings&&Vt.log.warn(`Module name: ${n} vs ${r.name}`)()}destroy(){}setProps(t){for(let e of Object.keys(t)){let s=e,n=t[s]||{},r=this.modules[s];if(!r){this.options.disableWarnings||Vt.log.warn(`Module ${e} not found`)();continue}let o=this.moduleUniforms[s],a=this.moduleBindings[s],c=r.getUniforms?.(n,o)||n,{uniforms:l,bindings:h}=Ke(c);this.moduleUniforms[s]={...o,...l},this.moduleBindings[s]={...a,...h}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindingValues(){let t={};for(let e of Object.values(this.moduleBindings))Object.assign(t,e);return t}getDebugTable(){let t={};for(let[e,s]of Object.entries(this.moduleUniforms))for(let[n,r]of Object.entries(s))t[`${e}.${n}`]={type:this.modules[e].uniformTypes?.[n],value:String(r)};return t}_addModule(t){let e=t.name;this.moduleUniforms[e]=t.defaultUniforms||{},this.moduleBindings[e]={}}};var rt=k(j(),1);var Me="";function Qe(i){Me=i}async function Gt(i,t){let e=new Image;return e.crossOrigin=t?.crossOrigin||"anonymous",e.src=i.startsWith("http")?i:Me+i,await e.decode(),t?await createImageBitmap(e,t):await createImageBitmap(e)}async function Je(i,t){return await new Promise((e,s)=>{try{let n=new Image;n.onload=()=>e(n),n.onerror=()=>s(new Error(`Could not load image ${i}.`)),n.crossOrigin=t?.crossOrigin||"anonymous",n.src=i.startsWith("http")?i:Me+i}catch(n){s(n)}})}var as=["+X","-X","+Y","-Y","+Z","-Z"];var cs=["+X","-X","+Y","-Y","+Z","-Z"],ve=class{device;id;props;texture;sampler;view;ready;isReady=!1;destroyed=!1;resolveReady=()=>{};rejectReady=()=>{};get[Symbol.toStringTag](){return"AsyncTexture"}toString(){return`AsyncTexture:"${this.id}"(${this.isReady?"ready":"loading"})`}constructor(t,e){this.device=t;let s=C("async-texture");this.props={...ve.defaultProps,id:s,...e},this.id=this.props.id,e={...e},typeof e?.data=="string"&&e.dimension==="2d"&&(e.data=Gt(e.data)),e.mipmaps&&(e.mipLevels="auto"),this.ready=new Promise((n,r)=>{this.resolveReady=()=>{this.isReady=!0,n()},this.rejectReady=r}),this.initAsync(e)}async initAsync(t){let e=t.data,s=await ti(e).then(void 0,this.rejectReady);if(this.destroyed)return;let n=this.props.width&&this.props.height?{width:this.props.width,height:this.props.height}:this.getTextureDataSize(s);if(!n)throw new Error("Texture size could not be determined");let r={...n,...t,data:void 0,mipLevels:1},o=this.device.getMipLevelCount(r.width,r.height);if(r.mipLevels=this.props.mipLevels==="auto"?o:Math.min(o,this.props.mipLevels),this.texture=this.device.createTexture(r),this.sampler=this.texture.sampler,this.view=this.texture.view,t.data)switch(this.props.dimension){case"1d":this._setTexture1DData(this.texture,s);break;case"2d":this._setTexture2DData(s);break;case"3d":this._setTexture3DData(this.texture,s);break;case"2d-array":this._setTextureArrayData(this.texture,s);break;case"cube":this._setTextureCubeData(this.texture,s);break;case"cube-array":this._setTextureCubeArrayData(this.texture,s);break}this.props.mipmaps&&this.generateMipmaps(),rt.log.info(1,`${this} loaded`),this.resolveReady()}destroy(){this.texture&&(this.texture.destroy(),this.texture=null),this.destroyed=!0}generateMipmaps(){this.texture.generateMipmapsWebGL()}setSampler(t={}){this.texture.setSampler(t instanceof rt.Sampler?t:this.device.createSampler(t))}resize(t){if(!this.isReady)throw new Error("Cannot resize texture before it is ready");if(t.width===this.texture.width&&t.height===this.texture.height)return!1;if(this.texture){let e=this.texture;this.texture=e.clone(t),e.destroy()}return!0}isTextureLevelData(t){let e=t?.data;return ArrayBuffer.isView(e)}getTextureDataSize(t){if(!t||ArrayBuffer.isView(t))return null;if(Array.isArray(t))return this.getTextureDataSize(t[0]);if(this.device.isExternalImage(t))return this.device.getExternalImageSize(t);if(t&&typeof t=="object"&&t.constructor===Object){let s=Object.values(t)[0];return{width:s.width,height:s.height}}throw new Error("texture size deduction failed")}getCubeFaceDepth(t){switch(t){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(t)}}setTextureData(t){}_setTexture1DData(t,e){throw new Error("setTexture1DData not supported in WebGL.")}_setTexture2DData(t,e=0){if(!this.texture)throw new Error("Texture not initialized");let s=this._normalizeTextureData(t);s.length>1&&this.props.mipmaps!==!1&&rt.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let n=0;n<s.length;n++){let r=s[n];this.device.isExternalImage(r)?this.texture.copyExternalImage({image:r,depth:e,mipLevel:n,flipY:!0}):this.texture.copyImageData({data:r.data,mipLevel:n})}}_setTexture3DData(t,e){if(this.texture?.props.dimension!=="3d")throw new Error(this.id);for(let s=0;s<e.length;s++)this._setTexture2DData(e[s],s)}_setTextureCubeData(t,e){if(this.texture?.props.dimension!=="cube")throw new Error(this.id);for(let[s,n]of Object.entries(e)){let r=cs.indexOf(s);this._setTexture2DData(n,r)}}_setTextureArrayData(t,e){if(this.texture?.props.dimension!=="2d-array")throw new Error(this.id);for(let s=0;s<e.length;s++)this._setTexture2DData(e[s],s)}_setTextureCubeArrayData(t,e){throw new Error("setTextureCubeArrayData not supported in WebGL2.")}_setTextureCubeFaceData(t,e,s,n=0){Array.isArray(e)&&e.length>1&&this.props.mipmaps!==!1&&rt.log.warn(`${this.id} has mipmap and multiple LODs.`)();let r=as.indexOf(s);this._setTexture2DData(e,r)}_normalizeTextureData(t){let e=this.texture,s;return ArrayBuffer.isView(t)?s=[{data:t,width:e.width,height:e.height}]:Array.isArray(t)?s=t:s=[t],s}},tt=ve;z(tt,"defaultProps",{...rt.Texture.defaultProps,data:null,mipmaps:!1});async function ti(i){if(i=await i,Array.isArray(i))return await Promise.all(i.map(ti));if(i&&typeof i=="object"&&i.constructor===Object){let t=i,e=await Promise.all(Object.values(t)),s=Object.keys(t),n={};for(let r=0;r<s.length;r++)n[s[r]]=e[r];return n}return i}var dt=2,hs=1e4,_e=class{device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;isInstanced=void 0;instanceCount=0;vertexCount;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};vertexArray;transformFeedback=null;pipeline;shaderInputs;_uniformStore;_attributeInfos={};_gpuGeometry=null;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;get[Symbol.toStringTag](){return"Model"}toString(){return`Model(${this.id})`}constructor(t,e){this.props={..._e.defaultProps,...e},e=this.props,this.id=e.id||C("model"),this.device=t,Object.assign(this.userData,e.userData);let s=Object.fromEntries(this.props.modules?.map(c=>[c.name,c])||[]),n=e.shaderInputs||new H(s,{disableWarnings:this.props.disableWarnings});this.setShaderInputs(n);let r=ds(t),o=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){let{source:c,getUniforms:l}=this.props.shaderAssembler.assembleWGSLShader({platformInfo:r,...this.props,modules:o});this.source=c,this._getModuleUniforms=l,this.props.shaderLayout||=(0,qt.getShaderLayoutFromWGSL)(this.source)}else{let{vs:c,fs:l,getUniforms:h}=this.props.shaderAssembler.assembleGLSLShaderPair({platformInfo:r,...this.props,modules:o});this.vs=c,this.fs=l,this._getModuleUniforms=h}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,e.geometry&&this.setGeometry(e.geometry),this.pipelineFactory=e.pipelineFactory||Q.getDefaultPipelineFactory(this.device),this.shaderFactory=e.shaderFactory||J.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in e&&(this.isInstanced=e.isInstanced),e.instanceCount&&this.setInstanceCount(e.instanceCount),e.vertexCount&&this.setVertexCount(e.vertexCount),e.indexBuffer&&this.setIndexBuffer(e.indexBuffer),e.attributes&&this.setAttributes(e.attributes),e.constantAttributes&&this.setConstantAttributes(e.constantAttributes),e.bindings&&this.setBindings(e.bindings),e.transformFeedback&&(this.transformFeedback=e.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");let t=this._needsRedraw;return this._needsRedraw=!1,t}setNeedsRedraw(t){this._needsRedraw||=t}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(t){let e=this._areBindingsLoading();if(e)return S.log.info(dt,`>>> DRAWING ABORTED ${this.id}: ${e} not loaded`)(),!1;try{t.pushDebugGroup(`${this}.predraw(${t})`),this.predraw()}finally{t.popDebugGroup()}let s;try{t.pushDebugGroup(`${this}.draw(${t})`),this._logDrawCallStart(),this.pipeline=this._updatePipeline();let n=this._getBindings();this.pipeline.setBindings(n,{disableWarnings:this.props.disableWarnings});let{indexBuffer:r}=this.vertexArray,o=r?r.byteLength/(r.indexType==="uint32"?4:2):void 0;s=this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:o,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{t.popDebugGroup(),this._logDrawCallEnd()}return this._logFramebuffer(t),s?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",s}setGeometry(t){this._gpuGeometry?.destroy();let e=t&&Ve(this.device,t);if(e){this.setTopology(e.topology||"triangle-list");let s=new mt(this.bufferLayout);this.bufferLayout=s.mergeBufferLayouts(e.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(e)}this._gpuGeometry=e}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){let e=new mt(this.bufferLayout);this.bufferLayout=this._gpuGeometry?e.mergeBufferLayouts(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){jt(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(t){this.instanceCount=t,this.isInstanced===void 0&&t>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(t){this.vertexCount=t,this.setNeedsRedraw("vertexCount")}setShaderInputs(t){this.shaderInputs=t,this._uniformStore=new S.UniformStore(this.shaderInputs.modules);for(let[e,s]of Object.entries(this.shaderInputs.modules))if(ls(s)){let n=this._uniformStore.getManagedUniformBuffer(this.device,e);this.bindings[`${e}Uniforms`]=n}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setBindings(this.shaderInputs.getBindingValues()),this.setNeedsRedraw("shaderInputs")}setBindings(t){Object.assign(this.bindings,t),this.setNeedsRedraw("bindings")}setTransformFeedback(t){this.transformFeedback=t,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t),this.setNeedsRedraw("indexBuffer")}setAttributes(t,e){let s=e?.disableWarnings??this.props.disableWarnings;t.indices&&S.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)(),this.bufferLayout=Ye(this.pipeline.shaderLayout,this.bufferLayout);let n=new mt(this.bufferLayout);for(let[r,o]of Object.entries(t)){let a=n.getBufferLayout(r);if(!a){s||S.log.warn(`Model(${this.id}): Missing layout for buffer "${r}".`)();continue}let c=n.getAttributeNamesForBuffer(a),l=!1;for(let h of c){let d=this._attributeInfos[h];if(d){let f=this.device.type==="webgpu"?n.getBufferIndex(d.bufferName):d.location;this.vertexArray.setBuffer(f,o),l=!0}}!l&&!s&&S.log.warn(`Model(${this.id}): Ignoring buffer "${o.id}" for unknown attribute "${r}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(t,e){for(let[s,n]of Object.entries(t)){let r=this._attributeInfos[s];r?this.vertexArray.setConstantWebGL(r.location,n):(e?.disableWarnings??this.props.disableWarnings)||S.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${s}"`)()}this.setNeedsRedraw("constants")}_areBindingsLoading(){for(let t of Object.values(this.bindings))if(t instanceof tt&&!t.isReady)return t.id;return!1}_getBindings(){let t={};for(let[e,s]of Object.entries(this.bindings))s instanceof tt?s.isReady&&(t[e]=s.texture):t[e]=s;return t}_getBindingsUpdateTimestamp(){let t=0;for(let e of Object.values(this.bindings))e instanceof S.TextureView?t=Math.max(t,e.texture.updateTimestamp):e instanceof S.Buffer||e instanceof S.Texture?t=Math.max(t,e.updateTimestamp):e instanceof tt?t=e.texture?Math.max(t,e.texture.updateTimestamp):1/0:e instanceof S.Sampler||(t=Math.max(t,e.buffer.updateTimestamp));return t}_setGeometryAttributes(t){let e={...t.attributes};for(let[s]of Object.entries(e))!this.pipeline.shaderLayout.attributes.find(n=>n.name===s)&&s!=="positions"&&delete e[s];this.vertexCount=t.vertexCount,this.setIndexBuffer(t.indices||null),this.setAttributes(t.attributes,{disableWarnings:!0}),this.setAttributes(e,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate||=t,this.setNeedsRedraw(t)}_updatePipeline(){if(this._pipelineNeedsUpdate){let t=null,e=null;this.pipeline&&(S.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),t=this.pipeline.vs,e=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let s=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debugShaders:this.props.debugShaders}),n=null;this.source?n=s:this.fs&&(n=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debugShaders:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,bindings:this._getBindings(),vs:s,fs:n}),this._attributeInfos=(0,S.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout),t&&this.shaderFactory.release(t),e&&this.shaderFactory.release(e)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let t=S.log.level>3?0:hs;S.log.level<2||Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,S.log.group(dt,`>>> DRAWING MODEL ${this.id}`,{collapsed:S.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=Ge(this.pipeline.shaderLayout,this.id);S.log.table(dt,t)();let e=this.shaderInputs.getDebugTable();S.log.table(dt,e)();let s=this._getAttributeDebugTable();S.log.table(dt,this._attributeInfos)(),S.log.table(dt,s)(),S.log.groupEnd(dt)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(t){let e=this.device.props.debugFramebuffers;if(this._drawCount++,!e)return;let s=t.props.framebuffer;s&&qe(s,{id:s.id,minimap:!0})}_getAttributeDebugTable(){let t={};for(let[e,s]of Object.entries(this._attributeInfos)){let n=this.vertexArray.attributes[s.location];t[s.location]={name:e,type:s.shaderType,values:n?this._getBufferOrConstantValues(n,s.bufferDataType):"null"}}if(this.vertexArray.indexBuffer){let{indexBuffer:e}=this.vertexArray,s=e.indexType==="uint32"?new Uint32Array(e.debugData):new Uint16Array(e.debugData);t.indices={name:"indices",type:e.indexType,values:s.toString()}}return t}_getBufferOrConstantValues(t,e){let s=(0,S.getTypedArrayConstructor)(e);return(t instanceof S.Buffer?new s(t.debugData):t).toString()}},W=_e;z(W,"defaultProps",{...S.RenderPipeline.defaultProps,source:void 0,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:qt.ShaderAssembler.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0});function ls(i){return Boolean(i.uniformTypes&&!fs(i.uniformTypes))}function ds(i){return{type:i.type,shaderLanguage:i.info.shadingLanguage,shaderLanguageVersion:i.info.shadingLanguageVersion,gpu:i.info.gpu,features:i.features}}function fs(i){for(let t in i)return!1;return!0}var ei=k(j(),1),ii=k(ht(),1);var Wt=class{device;model;transformFeedback;static isSupported(t){return t?.info?.type==="webgl"}constructor(t,e=Wt.defaultProps){if(!Wt.isSupported(t))throw new Error("BufferTransform not yet implemented on WebGPU");this.device=t,this.model=new W(this.device,{id:e.id||"buffer-transform-model",fs:e.fs||(0,ii.getPassthroughFS)(),topology:e.topology||"point-list",varyings:e.outputs||e.varyings,...e}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:e.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(t){t?.inputBuffers&&this.model.setAttributes(t.inputBuffers),t?.outputBuffers&&this.transformFeedback.setBuffers(t.outputBuffers);let e=this.device.beginRenderPass(t);this.model.draw(e),e.end()}getBuffer(t){return this.transformFeedback.getBuffer(t)}readAsync(t){let e=this.getBuffer(t);if(!e)throw new Error("BufferTransform#getBuffer");if(e instanceof ei.Buffer)return e.readAsync();let{buffer:s,byteOffset:n=0,byteLength:r=s.byteLength}=e;return s.readAsync(n,r)}},It=Wt;z(It,"defaultProps",{...W.defaultProps,outputs:void 0,feedbackBuffers:void 0});var si=k(ht(),1);var us="transform_output",Yt=class{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(t,e){this.device=t,this.sampler=t.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new W(this.device,{id:e.id||C("texture-transform-model"),fs:e.fs||(0,si.getPassthroughFS)({input:e.targetTextureVarying,inputChannels:e.targetTextureChannels,output:us}),vertexCount:e.vertexCount,...e}),this._initialize(e),Object.seal(this)}destroy(){this.model.destroy();for(let t of this.bindings)t.framebuffer?.destroy()}delete(){this.destroy()}run(t){let{framebuffer:e}=this.bindings[this.currentIndex],s=this.device.beginRenderPass({framebuffer:e,...t});this.model.draw(s),s.end(),this.device.submit()}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(t){this._updateBindings(t)}_updateBindings(t){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t)}_updateBinding(t,{sourceBuffers:e,sourceTextures:s,targetTexture:n}){if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,s),Object.assign(t.sourceBuffers,e),n){t.targetTexture=n;let{width:r,height:o}=n;t.framebuffer&&t.framebuffer.destroy(),t.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:r,height:o,colorAttachments:[n]}),t.framebuffer.resize({width:r,height:o})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:e}=this.bindings[t];for(let s in e)e[s].sampler=this.sampler}};var B=class{id;topology;vertexCount;indices;attributes;userData={};constructor(t){let{attributes:e={},indices:s=null,vertexCount:n=null}=t;this.id=t.id||C("geometry"),this.topology=t.topology,s&&(this.indices=ArrayBuffer.isView(s)?{value:s,size:1}:s),this.attributes={};for(let[r,o]of Object.entries(e)){let a=ArrayBuffer.isView(o)?{value:o}:o;if(!ArrayBuffer.isView(a.value))throw new Error(`${this._print(r)}: must be typed array or object with value as typed array`);if((r==="POSITION"||r==="positions")&&!a.size&&(a.size=3),r==="indices"){if(this.indices)throw new Error("Multiple indices detected");this.indices=a}else this.attributes[r]=a}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=n||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,e){return this}_calculateVertexCount(t,e){if(e)return e.value.length;let s=1/0;for(let n of Object.values(t)){let{value:r,size:o,constant:a}=n;!a&&r&&o!==void 0&&o>=1&&(s=Math.min(s,r.length/o))}return s}};var ps=`struct VertexInputs {
7
+ "use strict";var __exports__=(()=>{var qi=Object.create;var wt=Object.defineProperty;var Wi=Object.getOwnPropertyDescriptor;var Yi=Object.getOwnPropertyNames;var Xi=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty;var Ki=(i,t,e)=>t in i?wt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var De=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Zi=(i,t)=>{for(var e in t)wt(i,e,{get:t[e],enumerable:!0})},Nt=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Yi(t))!Hi.call(i,n)&&n!==e&&wt(i,n,{get:()=>t[n],enumerable:!(s=Wi(t,n))||s.enumerable});return i},Ft=(i,t,e)=>(Nt(i,t,"default"),e&&Nt(e,t,"default")),k=(i,t,e)=>(e=i!=null?qi(Xi(i)):{},Nt(t||!i||!i.__esModule?wt(e,"default",{value:i,enumerable:!0}):e,i)),Qi=i=>Nt(wt({},"__esModule",{value:!0}),i);var z=(i,t,e)=>(Ki(i,typeof t!="symbol"?t+"":t,e),e);var j=De((pn,ze)=>{ze.exports=globalThis.luma});var ht=De((kn,je)=>{je.exports=globalThis.luma});var Et={};Zi(Et,{AnimationLoop:()=>ct,AnimationLoopTemplate:()=>Bt,AsyncTexture:()=>tt,BackgroundTextureModel:()=>ft,BufferTransform:()=>It,ClipSpace:()=>et,Computation:()=>Ct,ConeGeometry:()=>se,CubeGeometry:()=>ne,CylinderGeometry:()=>re,GPUGeometry:()=>pt,Geometry:()=>B,GroupNode:()=>bt,IcoSphereGeometry:()=>oe,KeyFrames:()=>zt,LegacyPickingManager:()=>pe,Model:()=>W,ModelNode:()=>ie,PickingManager:()=>Pt,PipelineFactory:()=>Q,PlaneGeometry:()=>ae,ScenegraphNode:()=>st,ShaderFactory:()=>J,ShaderInputs:()=>H,ShaderPassRenderer:()=>le,SphereGeometry:()=>ce,Swap:()=>Mt,SwapBuffers:()=>he,SwapFramebuffers:()=>vt,TextureTransform:()=>Yt,Timeline:()=>Dt,TruncatedConeGeometry:()=>ot,cancelAnimationFramePolyfill:()=>Ut,colorPicking:()=>$i,indexPicking:()=>Bi,loadImage:()=>Je,loadImageBitmap:()=>Gt,makeAnimationLoop:()=>Ue,makeRandomGenerator:()=>Fi,requestAnimationFramePolyfill:()=>$t,setPathPrefix:()=>Qe});Ft(Et,k(j(),1));var Ji=1,ts=1,Dt=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(t){let{delay:e=0,duration:s=Number.POSITIVE_INFINITY,rate:n=1,repeat:r=1}=t,o=Ji++,a={time:0,delay:e,duration:s,rate:n,repeat:r};return this._setChannelTime(a,this.time),this.channels.set(o,a),o}removeChannel(t){this.channels.delete(t);for(let[e,s]of this.animations)s.channel===t&&this.detachAnimation(e)}isFinished(t){let e=this.channels.get(t);return e===void 0?!1:this.time>=e.delay+e.duration*e.repeat}getTime(t){if(t===void 0)return this.time;let e=this.channels.get(t);return e===void 0?-1:e.time}setTime(t){this.time=Math.max(0,t);let e=this.channels.values();for(let n of e)this._setChannelTime(n,this.time);let s=this.animations.values();for(let n of s){let{animation:r,channel:o}=n;r.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,e){let s=ts++;return this.animations.set(s,{animation:t,channel:e}),t.setTime(this.getTime(e)),s}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,e){let s=e-t.delay,n=t.duration*t.repeat;s>=n?t.time=t.duration*t.rate:(t.time=Math.max(0,s)%t.duration,t.time*=t.rate)}};var zt=class{startIndex=-1;endIndex=-1;factor=0;times=[];values=[];_lastTime=-1;constructor(t){this.setKeyFrames(t),this.setTime(0)}setKeyFrames(t){let e=t.length;this.times.length=e,this.values.length=e;for(let s=0;s<e;++s)this.times[s]=t[s][0],this.values[s]=t[s][1];this._calculateKeys(this._lastTime)}setTime(t){t=Math.max(0,t),t!==this._lastTime&&(this._calculateKeys(t),this._lastTime=t)}getStartTime(){return this.times[this.startIndex]}getEndTime(){return this.times[this.endIndex]}getStartData(){return this.values[this.startIndex]}getEndData(){return this.values[this.endIndex]}_calculateKeys(t){let e=0,s=this.times.length;for(e=0;e<s-2&&!(this.times[e+1]>t);++e);this.startIndex=e,this.endIndex=e+1;let n=this.times[this.startIndex],r=this.times[this.endIndex];this.factor=Math.min(Math.max(0,(t-n)/(r-n)),1)}};var Bt=class{constructor(t){}async onInitialize(t){return null}};var Be=k(j(),1);function $t(i){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(i):setTimeout(i,1e3/60)}function Ut(i){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(i):clearTimeout(i)}function At(){let i;if(typeof window<"u"&&window.performance)i=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();i=t[0]*1e3+t[1]/1e6}else i=Date.now();return i}var at=class{constructor(t,e){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=At(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(At()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var ut=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:s}=t,n=this.stats[e];return n||(t instanceof at?n=t:n=new at(e,s),this.stats[e]=n),n}};var es=0,me=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;constructor(t){if(this.props={...me.defaultAnimationLoopProps,...t},t=this.props,!t.device)throw new Error("No device provided");this.stats=t.stats||new ut({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:t.autoResizeViewport}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}reportError(t){this.props.onError(t),this._error=t}setNeedsRedraw(t){return this.needsRedraw=this.needsRedraw||t,this}setProps(t){return"autoResizeViewport"in t&&(this.props.autoResizeViewport=t.autoResizeViewport||!1),this}async start(){if(this._running)return this;this._running=!0;try{let t;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(t!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(t){let e=t instanceof Error?t:new Error("Unknown error");throw this.props.onError(e),e}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost||this._error?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport()}_setDisplay(t){this.display&&(this.display.destroy(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_requestAnimationFrame(){this._running&&(this._animationFrameId=$t(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(Ut(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(t){if(this.display){this.display._renderFrame(t);return}this.props.onRender(this._getAnimationProps()),this.device?.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){let t=this.device?.getDefaultCanvasContext();if(!this.device||!t)throw new Error("loop");let e=t?.canvas,s=t.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:t,canvas:e,useDevicePixels:s,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:t,height:e,aspect:s}=this._getSizeAndAspect();(t!==this.animationProps.width||e!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),s!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=e,this.animationProps.aspect=s,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";let e=document.createElement("div");e.style.position="absolute",e.style.left="10px",e.style.bottom="10px",e.style.width="300px",e.style.background="white",this.canvas instanceof HTMLCanvasElement&&t.appendChild(this.canvas),t.appendChild(e);let s=this.props.onAddHTML(e);s&&(e.innerHTML=s)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[t,e]=this.device?.getDefaultCanvasContext().getDevicePixelSize()||[1,1],s=1,n=this.device?.getDefaultCanvasContext().canvas;return n&&n.clientHeight?s=n.clientWidth/n.clientHeight:t>0&&e>0&&(s=t/e),{width:t,height:e,aspect:s}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(t){t instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[t.offsetX,t.offsetY])}_onMouseleave(t){this._getAnimationProps()._mousePosition=null}},ct=me;z(ct,"defaultAnimationLoopProps",{device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:Be.luma.stats.get(`animation-loop-${es++}`),autoResizeViewport:!1});var $e=k(j(),1);function Ue(i,t){let e=null,s=t?.device||$e.luma.createDevice({id:"animation-loop",adapters:t?.adapters,createCanvasContext:!0}),n=new ct({...t,device:s,async onInitialize(r){ss(r.animationLoop.device);try{return e=new i(r),await e?.onInitialize(r)}catch(o){return is(r.animationLoop.device,o),null}},onRender:r=>e?.onRender(r),onFinalize:r=>e?.onFinalize(r)});return n.getInfo=()=>this.AnimationLoopTemplateCtor.info,n}function is(i,t){let e=i?.getDefaultCanvasContext().canvas;if(e instanceof HTMLCanvasElement){e.style.overflow="visible";let s=document.getElementById("animation-loop-error");s?.remove(),s=document.createElement("h1"),s.id="animation-loop-error",s.innerHTML=t.message,s.style.position="absolute",s.style.top="10px",s.style.left="10px",s.style.color="black",s.style.backgroundColor="red",e.parentElement?.appendChild(s)}}function ss(i){let t=document.getElementById("animation-loop-error");t&&t.remove()}var S=k(j(),1),qt=k(ht(),1);var Tt=k(j(),1);var ge={};function C(i="id"){ge[i]=ge[i]||1;let t=ge[i]++;return`${i}-${t}`}var pt=class{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(t){if(this.id=t.id||C("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&!(this.indices.usage&Tt.Buffer.INDEX))throw new Error("Index buffer must have INDEX usage")}destroy(){this.indices?.destroy();for(let t of Object.values(this.attributes))t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices||null}_calculateVertexCount(t){return t.byteLength/12}};function Ve(i,t){if(t instanceof pt)return t;let e=ns(i,t),{attributes:s,bufferLayout:n}=rs(i,t);return new pt({topology:t.topology||"triangle-list",bufferLayout:n,vertexCount:t.vertexCount,indices:e,attributes:s})}function ns(i,t){if(!t.indices)return;let e=t.indices.value;return i.createBuffer({usage:Tt.Buffer.INDEX,data:e})}function rs(i,t){let e=[],s={};for(let[r,o]of Object.entries(t.attributes)){let a=r;switch(r){case"POSITION":a="positions";break;case"NORMAL":a="normals";break;case"TEXCOORD_0":a="texCoords";break;case"COLOR_0":a="colors";break}if(o){s[a]=i.createBuffer({data:o.value,id:`${r}-buffer`});let{value:c,size:l,normalized:h}=o;e.push({name:a,format:(0,Tt.getVertexFormatFromAttribute)(c,l,h)})}}let n=t._calculateVertexCount(t.attributes,t.indices);return{attributes:s,bufferLayout:e,vertexCount:n}}var V=k(j(),1);var xe=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new xe(t),t._lumaData.defaultPipelineFactory}device;cachingEnabled;destroyPolicy;debug;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};get[Symbol.toStringTag](){return"PipelineFactory"}toString(){return`PipelineFactory(${this.device.id})`}constructor(t){this.device=t,this.cachingEnabled=t.props._cachePipelines,this.destroyPolicy=t.props._cacheDestroyPolicy,this.debug=t.props.debugFactories}createRenderPipeline(t){if(!this.cachingEnabled)return this.device.createRenderPipeline(t);let e={...V.RenderPipeline.defaultProps,...t},s=this._renderPipelineCache,n=this._hashRenderPipeline(e),r=s[n]?.pipeline;return r?(s[n].useCount++,this.debug&&V.log.log(3,`${this}: ${s[n].pipeline} reused, count=${s[n].useCount}, (id=${t.id})`)()):(r=this.device.createRenderPipeline({...e,id:e.id?`${e.id}-cached`:C("unnamed-cached")}),r.hash=n,s[n]={pipeline:r,useCount:1},this.debug&&V.log.log(3,`${this}: ${r} created, count=${s[n].useCount}`)()),r}createComputePipeline(t){if(!this.cachingEnabled)return this.device.createComputePipeline(t);let e={...V.ComputePipeline.defaultProps,...t},s=this._computePipelineCache,n=this._hashComputePipeline(e),r=s[n]?.pipeline;return r?(s[n].useCount++,this.debug&&V.log.log(3,`${this}: ${s[n].pipeline} reused, count=${s[n].useCount}, (id=${t.id})`)()):(r=this.device.createComputePipeline({...e,id:e.id?`${e.id}-cached`:void 0}),r.hash=n,s[n]={pipeline:r,useCount:1},this.debug&&V.log.log(3,`${this}: ${r} created, count=${s[n].useCount}`)()),r}release(t){if(!this.cachingEnabled){t.destroy();return}let e=this._getCache(t),s=t.hash;e[s].useCount--,e[s].useCount===0?(this._destroyPipeline(t),this.debug&&V.log.log(3,`${this}: ${t} released and destroyed`)()):e[s].useCount<0?(V.log.error(`${this}: ${t} released, useCount < 0, resetting`)(),e[s].useCount=0):this.debug&&V.log.log(3,`${this}: ${t} released, count=${e[s].useCount}`)()}_destroyPipeline(t){let e=this._getCache(t);switch(this.destroyPolicy){case"never":return!1;case"unused":return delete e[t.hash],t.destroy(),!0}}_getCache(t){let e;if(t instanceof V.ComputePipeline&&(e=this._computePipelineCache),t instanceof V.RenderPipeline&&(e=this._renderPipelineCache),!e)throw new Error(`${this}`);if(!e[t.hash])throw new Error(`${this}: ${t} matched incorrect entry`);return e}_hashComputePipeline(t){let{type:e}=this.device,s=this._getHash(t.shader.source);return`${e}/C/${s}`}_hashRenderPipeline(t){let e=t.vs?this._getHash(t.vs.source):0,s=t.fs?this._getHash(t.fs.source):0,n="-",r=this._getHash(JSON.stringify(t.bufferLayout)),{type:o}=this.device;switch(o){case"webgl":return`${o}/R/${e}/${s}V${n}BL${r}`;case"webgpu":default:let a=this._getHash(JSON.stringify(t.parameters));return`${o}/R/${e}/${s}V${n}T${t.topology}P${a}BL${r}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}},Q=xe;z(Q,"defaultProps",{...V.RenderPipeline.defaultProps});var lt=k(j(),1);var ye=class{static getDefaultShaderFactory(t){return t._lumaData.defaultShaderFactory||=new ye(t),t._lumaData.defaultShaderFactory}device;cachingEnabled;destroyPolicy;debug;_cache={};get[Symbol.toStringTag](){return"ShaderFactory"}toString(){return`${this[Symbol.toStringTag]}(${this.device.id})`}constructor(t){this.device=t,this.cachingEnabled=t.props._cacheShaders,this.destroyPolicy=t.props._cacheDestroyPolicy,this.debug=!0}createShader(t){if(!this.cachingEnabled)return this.device.createShader(t);let e=this._hashShader(t),s=this._cache[e];if(s)s.useCount++,this.debug&&lt.log.log(3,`${this}: Reusing shader ${s.shader.id} count=${s.useCount}`)();else{let n=this.device.createShader({...t,id:t.id?`${t.id}-cached`:void 0});this._cache[e]=s={shader:n,useCount:1},this.debug&&lt.log.log(3,`${this}: Created new shader ${n.id}`)()}return s.shader}release(t){if(!this.cachingEnabled){t.destroy();return}let e=this._hashShader(t),s=this._cache[e];if(s)if(s.useCount--,s.useCount===0)this.destroyPolicy==="unused"&&(delete this._cache[e],s.shader.destroy(),this.debug&&lt.log.log(3,`${this}: Releasing shader ${t.id}, destroyed`)());else{if(s.useCount<0)throw new Error(`ShaderFactory: Shader ${t.id} released too many times`);this.debug&&lt.log.log(3,`${this}: Releasing shader ${t.id} count=${s.useCount}`)()}}_hashShader(t){return`${t.stage}:${t.source}`}},J=ye;z(J,"defaultProps",{...lt.Shader.defaultProps});function Ge(i,t){let e={},s="Values";if(i.attributes.length===0&&!i.varyings?.length)return{"No attributes or varyings":{[s]:"N/A"}};for(let n of i.attributes)if(n){let r=`${n.location} ${n.name}: ${n.type}`;e[`in ${r}`]={[s]:n.stepMode||"vertex"}}for(let n of i.varyings||[]){let r=`${n.location} ${n.name}`;e[`out ${r}`]={[s]:JSON.stringify(n)}}return e}var N=null,be=null;function qe(i,{id:t,minimap:e,opaque:s,top:n="0",left:r="0",rgbaScale:o=1}){N||(N=document.createElement("canvas"),N.id=t,N.title=t,N.style.zIndex="100",N.style.position="absolute",N.style.top=n,N.style.left=r,N.style.border="blue 5px solid",N.style.transform="scaleY(-1)",document.body.appendChild(N),be=N.getContext("2d")),(N.width!==i.width||N.height!==i.height)&&(N.width=i.width/2,N.height=i.height/2,N.style.width="400px",N.style.height="400px");let a=i.device.readPixelsToArrayWebGL(i),c=be?.createImageData(i.width,i.height);if(c){for(let h=0;h<a.length;h+=4)c.data[0+h+0]=a[h+0]*o,c.data[0+h+1]=a[h+1]*o,c.data[0+h+2]=a[h+2]*o,c.data[0+h+3]=s?255:a[h+3]*o;be?.putImageData(c,0,0)}}function jt(i,t,e){if(i===t)return!0;if(!e||!i||!t)return!1;if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let s=0;s<i.length;s++)if(!jt(i[s],t[s],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof i=="object"&&typeof t=="object"){let s=Object.keys(i),n=Object.keys(t);if(s.length!==n.length)return!1;for(let r of s)if(!t.hasOwnProperty(r)||!jt(i[r],t[r],e-1))return!1;return!0}return!1}var We=k(j(),1),mt=class{bufferLayouts;constructor(t){this.bufferLayouts=t}getBufferLayout(t){return this.bufferLayouts.find(e=>e.name===t)||null}getAttributeNamesForBuffer(t){return t.attributes?t.attributes?.map(e=>e.attribute):[t.name]}mergeBufferLayouts(t,e){let s=[...t];for(let n of e){let r=s.findIndex(o=>o.name===n.name);r<0?s.push(n):s[r]=n}return s}getBufferIndex(t){let e=this.bufferLayouts.findIndex(s=>s.name===t);return e===-1&&We.log.warn(`BufferLayout: Missing buffer for "${t}".`)(),e}};function Ye(i,t){let e=Object.fromEntries(i.attributes.map(n=>[n.name,n.location])),s=t.slice();return s.sort((n,r)=>{let o=n.attributes?n.attributes.map(h=>h.attribute):[n.name],a=r.attributes?r.attributes.map(h=>h.attribute):[r.name],c=Math.min(...o.map(h=>e[h])),l=Math.min(...a.map(h=>e[h]));return c-l}),s}var Vt=k(j(),1),Ze=k(ht(),1);function Xe(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function He(i){return Array.isArray(i)?i.length===0||typeof i[0]=="number":!1}function St(i){return Xe(i)||He(i)}function os(i){return St(i)||typeof i=="number"||typeof i=="boolean"}function Ke(i){let t={bindings:{},uniforms:{}};return Object.keys(i).forEach(e=>{let s=i[e];os(s)?t.uniforms[e]=s:t.bindings[e]=s}),t}var H=class{options={disableWarnings:!1};modules;moduleUniforms;moduleBindings;constructor(t,e){Object.assign(this.options,e);let s=(0,Ze.getShaderModuleDependencies)(Object.values(t).filter(n=>n.dependencies));for(let n of s)t[n.name]=n;Vt.log.log(1,"Creating ShaderInputs with modules",Object.keys(t))(),this.modules=t,this.moduleUniforms={},this.moduleBindings={};for(let[n,r]of Object.entries(t))this._addModule(r),r.name&&n!==r.name&&!this.options.disableWarnings&&Vt.log.warn(`Module name: ${n} vs ${r.name}`)()}destroy(){}setProps(t){for(let e of Object.keys(t)){let s=e,n=t[s]||{},r=this.modules[s];if(!r){this.options.disableWarnings||Vt.log.warn(`Module ${e} not found`)();continue}let o=this.moduleUniforms[s],a=this.moduleBindings[s],c=r.getUniforms?.(n,o)||n,{uniforms:l,bindings:h}=Ke(c);this.moduleUniforms[s]={...o,...l},this.moduleBindings[s]={...a,...h}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindingValues(){let t={};for(let e of Object.values(this.moduleBindings))Object.assign(t,e);return t}getDebugTable(){let t={};for(let[e,s]of Object.entries(this.moduleUniforms))for(let[n,r]of Object.entries(s))t[`${e}.${n}`]={type:this.modules[e].uniformTypes?.[n],value:String(r)};return t}_addModule(t){let e=t.name;this.moduleUniforms[e]=t.defaultUniforms||{},this.moduleBindings[e]={}}};var rt=k(j(),1);var Me="";function Qe(i){Me=i}async function Gt(i,t){let e=new Image;return e.crossOrigin=t?.crossOrigin||"anonymous",e.src=i.startsWith("http")?i:Me+i,await e.decode(),t?await createImageBitmap(e,t):await createImageBitmap(e)}async function Je(i,t){return await new Promise((e,s)=>{try{let n=new Image;n.onload=()=>e(n),n.onerror=()=>s(new Error(`Could not load image ${i}.`)),n.crossOrigin=t?.crossOrigin||"anonymous",n.src=i.startsWith("http")?i:Me+i}catch(n){s(n)}})}var as=["+X","-X","+Y","-Y","+Z","-Z"];var cs=["+X","-X","+Y","-Y","+Z","-Z"],ve=class{device;id;props;texture;sampler;view;ready;isReady=!1;destroyed=!1;resolveReady=()=>{};rejectReady=()=>{};get[Symbol.toStringTag](){return"AsyncTexture"}toString(){return`AsyncTexture:"${this.id}"(${this.isReady?"ready":"loading"})`}constructor(t,e){this.device=t;let s=C("async-texture");this.props={...ve.defaultProps,id:s,...e},this.id=this.props.id,e={...e},typeof e?.data=="string"&&e.dimension==="2d"&&(e.data=Gt(e.data)),e.mipmaps&&(e.mipLevels="auto"),this.ready=new Promise((n,r)=>{this.resolveReady=()=>{this.isReady=!0,n()},this.rejectReady=r}),this.initAsync(e)}async initAsync(t){let e=t.data,s=await ti(e).then(void 0,this.rejectReady);if(this.destroyed)return;let n=this.props.width&&this.props.height?{width:this.props.width,height:this.props.height}:this.getTextureDataSize(s);if(!n)throw new Error("Texture size could not be determined");let r={...n,...t,data:void 0,mipLevels:1},o=this.device.getMipLevelCount(r.width,r.height);if(r.mipLevels=this.props.mipLevels==="auto"?o:Math.min(o,this.props.mipLevels),this.texture=this.device.createTexture(r),this.sampler=this.texture.sampler,this.view=this.texture.view,t.data)switch(this.props.dimension){case"1d":this._setTexture1DData(this.texture,s);break;case"2d":this._setTexture2DData(s);break;case"3d":this._setTexture3DData(this.texture,s);break;case"2d-array":this._setTextureArrayData(this.texture,s);break;case"cube":this._setTextureCubeData(this.texture,s);break;case"cube-array":this._setTextureCubeArrayData(this.texture,s);break}this.props.mipmaps&&this.generateMipmaps(),rt.log.info(1,`${this} loaded`),this.resolveReady()}destroy(){this.texture&&(this.texture.destroy(),this.texture=null),this.destroyed=!0}generateMipmaps(){this.texture.generateMipmapsWebGL()}setSampler(t={}){this.texture.setSampler(t instanceof rt.Sampler?t:this.device.createSampler(t))}resize(t){if(!this.isReady)throw new Error("Cannot resize texture before it is ready");if(t.width===this.texture.width&&t.height===this.texture.height)return!1;if(this.texture){let e=this.texture;this.texture=e.clone(t),e.destroy()}return!0}isTextureLevelData(t){let e=t?.data;return ArrayBuffer.isView(e)}getTextureDataSize(t){if(!t||ArrayBuffer.isView(t))return null;if(Array.isArray(t))return this.getTextureDataSize(t[0]);if(this.device.isExternalImage(t))return this.device.getExternalImageSize(t);if(t&&typeof t=="object"&&t.constructor===Object){let s=Object.values(t)[0];return{width:s.width,height:s.height}}throw new Error("texture size deduction failed")}getCubeFaceDepth(t){switch(t){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(t)}}setTextureData(t){}_setTexture1DData(t,e){throw new Error("setTexture1DData not supported in WebGL.")}_setTexture2DData(t,e=0){if(!this.texture)throw new Error("Texture not initialized");let s=this._normalizeTextureData(t);s.length>1&&this.props.mipmaps!==!1&&rt.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let n=0;n<s.length;n++){let r=s[n];this.device.isExternalImage(r)?this.texture.copyExternalImage({image:r,depth:e,mipLevel:n,flipY:!0}):this.texture.copyImageData({data:r.data,mipLevel:n})}}_setTexture3DData(t,e){if(this.texture?.props.dimension!=="3d")throw new Error(this.id);for(let s=0;s<e.length;s++)this._setTexture2DData(e[s],s)}_setTextureCubeData(t,e){if(this.texture?.props.dimension!=="cube")throw new Error(this.id);for(let[s,n]of Object.entries(e)){let r=cs.indexOf(s);this._setTexture2DData(n,r)}}_setTextureArrayData(t,e){if(this.texture?.props.dimension!=="2d-array")throw new Error(this.id);for(let s=0;s<e.length;s++)this._setTexture2DData(e[s],s)}_setTextureCubeArrayData(t,e){throw new Error("setTextureCubeArrayData not supported in WebGL2.")}_setTextureCubeFaceData(t,e,s,n=0){Array.isArray(e)&&e.length>1&&this.props.mipmaps!==!1&&rt.log.warn(`${this.id} has mipmap and multiple LODs.`)();let r=as.indexOf(s);this._setTexture2DData(e,r)}_normalizeTextureData(t){let e=this.texture,s;return ArrayBuffer.isView(t)?s=[{data:t,width:e.width,height:e.height}]:Array.isArray(t)?s=t:s=[t],s}},tt=ve;z(tt,"defaultProps",{...rt.Texture.defaultProps,data:null,mipmaps:!1});async function ti(i){if(i=await i,Array.isArray(i))return await Promise.all(i.map(ti));if(i&&typeof i=="object"&&i.constructor===Object){let t=i,e=await Promise.all(Object.values(t)),s=Object.keys(t),n={};for(let r=0;r<s.length;r++)n[s[r]]=e[r];return n}return i}var dt=2,hs=1e4,_e=class{device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;isInstanced=void 0;instanceCount=0;vertexCount;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};vertexArray;transformFeedback=null;pipeline;shaderInputs;_uniformStore;_attributeInfos={};_gpuGeometry=null;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;get[Symbol.toStringTag](){return"Model"}toString(){return`Model(${this.id})`}constructor(t,e){this.props={..._e.defaultProps,...e},e=this.props,this.id=e.id||C("model"),this.device=t,Object.assign(this.userData,e.userData);let s=Object.fromEntries(this.props.modules?.map(c=>[c.name,c])||[]),n=e.shaderInputs||new H(s,{disableWarnings:this.props.disableWarnings});this.setShaderInputs(n);let r=ds(t),o=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){let{source:c,getUniforms:l}=this.props.shaderAssembler.assembleWGSLShader({platformInfo:r,...this.props,modules:o});this.source=c,this._getModuleUniforms=l,this.props.shaderLayout||=(0,qt.getShaderLayoutFromWGSL)(this.source)}else{let{vs:c,fs:l,getUniforms:h}=this.props.shaderAssembler.assembleGLSLShaderPair({platformInfo:r,...this.props,modules:o});this.vs=c,this.fs=l,this._getModuleUniforms=h}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,e.geometry&&this.setGeometry(e.geometry),this.pipelineFactory=e.pipelineFactory||Q.getDefaultPipelineFactory(this.device),this.shaderFactory=e.shaderFactory||J.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in e&&(this.isInstanced=e.isInstanced),e.instanceCount&&this.setInstanceCount(e.instanceCount),e.vertexCount&&this.setVertexCount(e.vertexCount),e.indexBuffer&&this.setIndexBuffer(e.indexBuffer),e.attributes&&this.setAttributes(e.attributes),e.constantAttributes&&this.setConstantAttributes(e.constantAttributes),e.bindings&&this.setBindings(e.bindings),e.transformFeedback&&(this.transformFeedback=e.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");let t=this._needsRedraw;return this._needsRedraw=!1,t}setNeedsRedraw(t){this._needsRedraw||=t}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(t){let e=this._areBindingsLoading();if(e)return S.log.info(dt,`>>> DRAWING ABORTED ${this.id}: ${e} not loaded`)(),!1;try{t.pushDebugGroup(`${this}.predraw(${t})`),this.predraw()}finally{t.popDebugGroup()}let s;try{t.pushDebugGroup(`${this}.draw(${t})`),this._logDrawCallStart(),this.pipeline=this._updatePipeline();let n=this._getBindings();this.pipeline.setBindings(n,{disableWarnings:this.props.disableWarnings});let{indexBuffer:r}=this.vertexArray,o=r?r.byteLength/(r.indexType==="uint32"?4:2):void 0;s=this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:o,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{t.popDebugGroup(),this._logDrawCallEnd()}return this._logFramebuffer(t),s?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",s}setGeometry(t){this._gpuGeometry?.destroy();let e=t&&Ve(this.device,t);if(e){this.setTopology(e.topology||"triangle-list");let s=new mt(this.bufferLayout);this.bufferLayout=s.mergeBufferLayouts(e.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(e)}this._gpuGeometry=e}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){let e=new mt(this.bufferLayout);this.bufferLayout=this._gpuGeometry?e.mergeBufferLayouts(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){jt(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(t){this.instanceCount=t,this.isInstanced===void 0&&t>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(t){this.vertexCount=t,this.setNeedsRedraw("vertexCount")}setShaderInputs(t){this.shaderInputs=t,this._uniformStore=new S.UniformStore(this.shaderInputs.modules);for(let[e,s]of Object.entries(this.shaderInputs.modules))if(ls(s)){let n=this._uniformStore.getManagedUniformBuffer(this.device,e);this.bindings[`${e}Uniforms`]=n}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setBindings(this.shaderInputs.getBindingValues()),this.setNeedsRedraw("shaderInputs")}setBindings(t){Object.assign(this.bindings,t),this.setNeedsRedraw("bindings")}setTransformFeedback(t){this.transformFeedback=t,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t),this.setNeedsRedraw("indexBuffer")}setAttributes(t,e){let s=e?.disableWarnings??this.props.disableWarnings;t.indices&&S.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)(),this.bufferLayout=Ye(this.pipeline.shaderLayout,this.bufferLayout);let n=new mt(this.bufferLayout);for(let[r,o]of Object.entries(t)){let a=n.getBufferLayout(r);if(!a){s||S.log.warn(`Model(${this.id}): Missing layout for buffer "${r}".`)();continue}let c=n.getAttributeNamesForBuffer(a),l=!1;for(let h of c){let d=this._attributeInfos[h];if(d){let f=this.device.type==="webgpu"?n.getBufferIndex(d.bufferName):d.location;this.vertexArray.setBuffer(f,o),l=!0}}!l&&!s&&S.log.warn(`Model(${this.id}): Ignoring buffer "${o.id}" for unknown attribute "${r}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(t,e){for(let[s,n]of Object.entries(t)){let r=this._attributeInfos[s];r?this.vertexArray.setConstantWebGL(r.location,n):(e?.disableWarnings??this.props.disableWarnings)||S.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${s}"`)()}this.setNeedsRedraw("constants")}_areBindingsLoading(){for(let t of Object.values(this.bindings))if(t instanceof tt&&!t.isReady)return t.id;return!1}_getBindings(){let t={};for(let[e,s]of Object.entries(this.bindings))s instanceof tt?s.isReady&&(t[e]=s.texture):t[e]=s;return t}_getBindingsUpdateTimestamp(){let t=0;for(let e of Object.values(this.bindings))e instanceof S.TextureView?t=Math.max(t,e.texture.updateTimestamp):e instanceof S.Buffer||e instanceof S.Texture?t=Math.max(t,e.updateTimestamp):e instanceof tt?t=e.texture?Math.max(t,e.texture.updateTimestamp):1/0:e instanceof S.Sampler||(t=Math.max(t,e.buffer.updateTimestamp));return t}_setGeometryAttributes(t){let e={...t.attributes};for(let[s]of Object.entries(e))!this.pipeline.shaderLayout.attributes.find(n=>n.name===s)&&s!=="positions"&&delete e[s];this.vertexCount=t.vertexCount,this.setIndexBuffer(t.indices||null),this.setAttributes(t.attributes,{disableWarnings:!0}),this.setAttributes(e,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate||=t,this.setNeedsRedraw(t)}_updatePipeline(){if(this._pipelineNeedsUpdate){let t=null,e=null;this.pipeline&&(S.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),t=this.pipeline.vs,e=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let s=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debugShaders:this.props.debugShaders}),n=null;this.source?n=s:this.fs&&(n=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debugShaders:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,bindings:this._getBindings(),vs:s,fs:n}),this._attributeInfos=(0,S.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout),t&&this.shaderFactory.release(t),e&&this.shaderFactory.release(e)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let t=S.log.level>3?0:hs;S.log.level<2||Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,S.log.group(dt,`>>> DRAWING MODEL ${this.id}`,{collapsed:S.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=Ge(this.pipeline.shaderLayout,this.id);S.log.table(dt,t)();let e=this.shaderInputs.getDebugTable();S.log.table(dt,e)();let s=this._getAttributeDebugTable();S.log.table(dt,this._attributeInfos)(),S.log.table(dt,s)(),S.log.groupEnd(dt)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(t){let e=this.device.props.debugFramebuffers;if(this._drawCount++,!e)return;let s=t.props.framebuffer;s&&qe(s,{id:s.id,minimap:!0})}_getAttributeDebugTable(){let t={};for(let[e,s]of Object.entries(this._attributeInfos)){let n=this.vertexArray.attributes[s.location];t[s.location]={name:e,type:s.shaderType,values:n?this._getBufferOrConstantValues(n,s.bufferDataType):"null"}}if(this.vertexArray.indexBuffer){let{indexBuffer:e}=this.vertexArray,s=e.indexType==="uint32"?new Uint32Array(e.debugData):new Uint16Array(e.debugData);t.indices={name:"indices",type:e.indexType,values:s.toString()}}return t}_getBufferOrConstantValues(t,e){let s=(0,S.getTypedArrayConstructor)(e);return(t instanceof S.Buffer?new s(t.debugData):t).toString()}},W=_e;z(W,"defaultProps",{...S.RenderPipeline.defaultProps,source:void 0,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:qt.ShaderAssembler.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0});function ls(i){return Boolean(i.uniformTypes&&!fs(i.uniformTypes))}function ds(i){return{type:i.type,shaderLanguage:i.info.shadingLanguage,shaderLanguageVersion:i.info.shadingLanguageVersion,gpu:i.info.gpu,features:i.features}}function fs(i){for(let t in i)return!1;return!0}var ei=k(j(),1),ii=k(ht(),1);var Wt=class{device;model;transformFeedback;static isSupported(t){return t?.info?.type==="webgl"}constructor(t,e=Wt.defaultProps){if(!Wt.isSupported(t))throw new Error("BufferTransform not yet implemented on WebGPU");this.device=t,this.model=new W(this.device,{id:e.id||"buffer-transform-model",fs:e.fs||(0,ii.getPassthroughFS)(),topology:e.topology||"point-list",varyings:e.outputs||e.varyings,...e}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:e.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(t){t?.inputBuffers&&this.model.setAttributes(t.inputBuffers),t?.outputBuffers&&this.transformFeedback.setBuffers(t.outputBuffers);let e=this.device.beginRenderPass(t);this.model.draw(e),e.end()}getBuffer(t){return this.transformFeedback.getBuffer(t)}readAsync(t){let e=this.getBuffer(t);if(!e)throw new Error("BufferTransform#getBuffer");if(e instanceof ei.Buffer)return e.readAsync();let{buffer:s,byteOffset:n=0,byteLength:r=s.byteLength}=e;return s.readAsync(n,r)}},It=Wt;z(It,"defaultProps",{...W.defaultProps,outputs:void 0,feedbackBuffers:void 0});var si=k(ht(),1);var us="transform_output",Yt=class{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(t,e){this.device=t,this.sampler=t.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new W(this.device,{id:e.id||C("texture-transform-model"),fs:e.fs||(0,si.getPassthroughFS)({input:e.targetTextureVarying,inputChannels:e.targetTextureChannels,output:us}),vertexCount:e.vertexCount,...e}),this._initialize(e),Object.seal(this)}destroy(){this.model.destroy();for(let t of this.bindings)t.framebuffer?.destroy()}delete(){this.destroy()}run(t){let{framebuffer:e}=this.bindings[this.currentIndex],s=this.device.beginRenderPass({framebuffer:e,...t});this.model.draw(s),s.end(),this.device.submit()}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(t){this._updateBindings(t)}_updateBindings(t){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t)}_updateBinding(t,{sourceBuffers:e,sourceTextures:s,targetTexture:n}){if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,s),Object.assign(t.sourceBuffers,e),n){t.targetTexture=n;let{width:r,height:o}=n;t.framebuffer&&t.framebuffer.destroy(),t.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:r,height:o,colorAttachments:[n]}),t.framebuffer.resize({width:r,height:o})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:e}=this.bindings[t];for(let s in e)e[s].sampler=this.sampler}};var B=class{id;topology;vertexCount;indices;attributes;userData={};constructor(t){let{attributes:e={},indices:s=null,vertexCount:n=null}=t;this.id=t.id||C("geometry"),this.topology=t.topology,s&&(this.indices=ArrayBuffer.isView(s)?{value:s,size:1}:s),this.attributes={};for(let[r,o]of Object.entries(e)){let a=ArrayBuffer.isView(o)?{value:o}:o;if(!ArrayBuffer.isView(a.value))throw new Error(`${this._print(r)}: must be typed array or object with value as typed array`);if((r==="POSITION"||r==="positions")&&!a.size&&(a.size=3),r==="indices"){if(this.indices)throw new Error("Multiple indices detected");this.indices=a}else this.attributes[r]=a}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=n||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,e){return this}_calculateVertexCount(t,e){if(e)return e.value.length;let s=1/0;for(let n of Object.values(t)){let{value:r,size:o,constant:a}=n;!a&&r&&o!==void 0&&o>=1&&(s=Math.min(s,r.length/o))}return s}};var ps=`struct VertexInputs {
8
8
  @location(0) clipSpacePosition: vec2<f32>,
9
9
  @location(1) texCoord: vec2<f32>,
10
10
  @location(2) coordinate: vec2<f32>
@@ -1 +1 @@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zD,0FAA0F;IAC1F,OAAO,CAAC,gBAAgB;IAaxB,yDAAyD;IACzD,OAAO,CAAC,SAAS;IAsBjB,sEAAsE;IACtE,OAAO,CAAC,oBAAoB;IAM5B,qEAAqE;IACrE,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,QAAQ;CAMjB"}
@@ -51,13 +51,13 @@ export class PipelineFactory {
51
51
  pipeline.hash = hash;
52
52
  cache[hash] = { pipeline, useCount: 1 };
53
53
  if (this.debug) {
54
- log.warn(`${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
54
+ log.log(3, `${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
55
55
  }
56
56
  }
57
57
  else {
58
58
  cache[hash].useCount++;
59
59
  if (this.debug) {
60
- log.warn(`${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
60
+ log.log(3, `${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
61
61
  }
62
62
  }
63
63
  return pipeline;
@@ -79,13 +79,13 @@ export class PipelineFactory {
79
79
  pipeline.hash = hash;
80
80
  cache[hash] = { pipeline, useCount: 1 };
81
81
  if (this.debug) {
82
- log.warn(`${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
82
+ log.log(3, `${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
83
83
  }
84
84
  }
85
85
  else {
86
86
  cache[hash].useCount++;
87
87
  if (this.debug) {
88
- log.warn(`${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
88
+ log.log(3, `${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
89
89
  }
90
90
  }
91
91
  return pipeline;
@@ -101,7 +101,7 @@ export class PipelineFactory {
101
101
  if (cache[hash].useCount === 0) {
102
102
  this._destroyPipeline(pipeline);
103
103
  if (this.debug) {
104
- log.warn(`${this}: ${pipeline} released and destroyed`)();
104
+ log.log(3, `${this}: ${pipeline} released and destroyed`)();
105
105
  }
106
106
  }
107
107
  else if (cache[hash].useCount < 0) {
@@ -109,7 +109,7 @@ export class PipelineFactory {
109
109
  cache[hash].useCount = 0;
110
110
  }
111
111
  else if (this.debug) {
112
- log.warn(`${this}: ${pipeline} released, count=${cache[hash].useCount}`)();
112
+ log.log(3, `${this}: ${pipeline} released, count=${cache[hash].useCount}`)();
113
113
  }
114
114
  }
115
115
  // PRIVATE
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline-factory.js","sourceRoot":"","sources":["../../src/factories/pipeline-factory.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAS,cAAc,EAAE,eAAe,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAC,GAAG,EAAC,wBAAqB;AAOjC;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAC,YAAY,GAAmC,EAAC,GAAG,cAAc,CAAC,YAAY,EAAC,CAAC;IAEvF,0EAA0E;IAC1E,MAAM,CAAC,yBAAyB,CAAC,MAAc;QAC7C,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC;YACxC,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAoB,CAAC;IACvE,CAAC;IAEQ,MAAM,CAAS;IACf,cAAc,CAAU;IACxB,aAAa,CAAqB;IAClC,KAAK,CAAU;IAEhB,YAAY,GAAW,CAAC,CAAC;IAChB,OAAO,GAA2B,EAAE,CAAC;IACrC,oBAAoB,GAA4C,EAAE,CAAC;IACnE,qBAAqB,GAA6C,EAAE,CAAC;IAEtF,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,OAAO,mBAAmB,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,CA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+42,13 @@ export class ShaderFactory {
42
42
  });
43
43
  this._cache[key] = cacheEntry = { shader, useCount: 1 };
44
44
  if (this.debug) {
45
- log.warn(`${this}: Created new shader ${shader.id}`)();
45
+ log.log(3, `${this}: Created new shader ${shader.id}`)();
46
46
  }
47
47
  }
48
48
  else {
49
49
  cacheEntry.useCount++;
50
50
  if (this.debug) {
51
- log.warn(`${this}: Reusing shader ${cacheEntry.shader.id} count=${cacheEntry.useCount}`)();
51
+ log.log(3, `${this}: Reusing shader ${cacheEntry.shader.id} count=${cacheEntry.useCount}`)();
52
52
  }
53
53
  }
54
54
  return cacheEntry.shader;
@@ -68,7 +68,7 @@ export class ShaderFactory {
68
68
  delete this._cache[key];
69
69
  cacheEntry.shader.destroy();
70
70
  if (this.debug) {
71
- log.warn(`${this}: Releasing shader ${shader.id}, destroyed`)();
71
+ log.log(3, `${this}: Releasing shader ${shader.id}, destroyed`)();
72
72
  }
73
73
  }
74
74
  }
@@ -76,7 +76,7 @@ export class ShaderFactory {
76
76
  throw new Error(`ShaderFactory: Shader ${shader.id} released too many times`);
77
77
  }
78
78
  else if (this.debug) {
79
- log.warn(`${this}: Releasing shader ${shader.id} count=${cacheEntry.useCount}`)();
79
+ log.log(3, `${this}: Releasing shader ${shader.id} count=${cacheEntry.useCount}`)();
80
80
  }
81
81
  }
82
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shader-factory.js","sourceRoot":"","sources":["../../src/factories/shader-factory.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAS,MAAM,EAAe,GAAG,EAAC,MAAM,eAAe,CAAC;AAE/D,kDAAkD;AAClD,MAAM,OAAO,aAAa;IACxB,MAAM,CAAU,YAAY,GAA0B,EAAC,GAAG,MAAM,CAAC,YAAY,EAAC,CAAC;IAE/E,iGAAiG;IACjG,MAAM,CAAC,uBAAuB,CAAC,MAAc;QAC3C,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,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C,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,sBAAsB,MAAM,CAAC,EAAE,UAAU,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;YACtF,CAAC;QACH,CAAC;IACH,CAAC;IAED,UAAU;IAEA,WAAW,CAAC,KAA2B;QAC/C,OAAO,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC"}
package/dist/index.cjs CHANGED
@@ -827,12 +827,12 @@ var _PipelineFactory = class {
827
827
  pipeline.hash = hash;
828
828
  cache[hash] = { pipeline, useCount: 1 };
829
829
  if (this.debug) {
830
- import_core4.log.warn(`${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
830
+ import_core4.log.log(3, `${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
831
831
  }
832
832
  } else {
833
833
  cache[hash].useCount++;
834
834
  if (this.debug) {
835
- import_core4.log.warn(`${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
835
+ import_core4.log.log(3, `${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
836
836
  }
837
837
  }
838
838
  return pipeline;
@@ -855,12 +855,12 @@ var _PipelineFactory = class {
855
855
  pipeline.hash = hash;
856
856
  cache[hash] = { pipeline, useCount: 1 };
857
857
  if (this.debug) {
858
- import_core4.log.warn(`${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
858
+ import_core4.log.log(3, `${this}: ${pipeline} created, count=${cache[hash].useCount}`)();
859
859
  }
860
860
  } else {
861
861
  cache[hash].useCount++;
862
862
  if (this.debug) {
863
- import_core4.log.warn(`${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
863
+ import_core4.log.log(3, `${this}: ${cache[hash].pipeline} reused, count=${cache[hash].useCount}, (id=${props.id})`)();
864
864
  }
865
865
  }
866
866
  return pipeline;
@@ -876,13 +876,13 @@ var _PipelineFactory = class {
876
876
  if (cache[hash].useCount === 0) {
877
877
  this._destroyPipeline(pipeline);
878
878
  if (this.debug) {
879
- import_core4.log.warn(`${this}: ${pipeline} released and destroyed`)();
879
+ import_core4.log.log(3, `${this}: ${pipeline} released and destroyed`)();
880
880
  }
881
881
  } else if (cache[hash].useCount < 0) {
882
882
  import_core4.log.error(`${this}: ${pipeline} released, useCount < 0, resetting`)();
883
883
  cache[hash].useCount = 0;
884
884
  } else if (this.debug) {
885
- import_core4.log.warn(`${this}: ${pipeline} released, count=${cache[hash].useCount}`)();
885
+ import_core4.log.log(3, `${this}: ${pipeline} released, count=${cache[hash].useCount}`)();
886
886
  }
887
887
  }
888
888
  // PRIVATE
@@ -987,12 +987,12 @@ var _ShaderFactory = class {
987
987
  });
988
988
  this._cache[key] = cacheEntry = { shader, useCount: 1 };
989
989
  if (this.debug) {
990
- import_core5.log.warn(`${this}: Created new shader ${shader.id}`)();
990
+ import_core5.log.log(3, `${this}: Created new shader ${shader.id}`)();
991
991
  }
992
992
  } else {
993
993
  cacheEntry.useCount++;
994
994
  if (this.debug) {
995
- import_core5.log.warn(`${this}: Reusing shader ${cacheEntry.shader.id} count=${cacheEntry.useCount}`)();
995
+ import_core5.log.log(3, `${this}: Reusing shader ${cacheEntry.shader.id} count=${cacheEntry.useCount}`)();
996
996
  }
997
997
  }
998
998
  return cacheEntry.shader;
@@ -1012,13 +1012,13 @@ var _ShaderFactory = class {
1012
1012
  delete this._cache[key];
1013
1013
  cacheEntry.shader.destroy();
1014
1014
  if (this.debug) {
1015
- import_core5.log.warn(`${this}: Releasing shader ${shader.id}, destroyed`)();
1015
+ import_core5.log.log(3, `${this}: Releasing shader ${shader.id}, destroyed`)();
1016
1016
  }
1017
1017
  }
1018
1018
  } else if (cacheEntry.useCount < 0) {
1019
1019
  throw new Error(`ShaderFactory: Shader ${shader.id} released too many times`);
1020
1020
  } else if (this.debug) {
1021
- import_core5.log.warn(`${this}: Releasing shader ${shader.id} count=${cacheEntry.useCount}`)();
1021
+ import_core5.log.log(3, `${this}: Releasing shader ${shader.id} count=${cacheEntry.useCount}`)();
1022
1022
  }
1023
1023
  }
1024
1024
  }