1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,443317,99023,134810,e=>{"use strict";var t=e.i(706145);let i=`\ 2out vec4 transform_output; 3void main() { 4 transform_output = vec4(0); 5}`,r=`#version 300 es 6${i}`;var s=e.i(81905);class n extends s.Resource{width;height;updateTimestamp;get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,n.defaultProps);const i=this.props.source?e.getExternalImageSize(this.props.source):null;this.width=this.props.width||i?.width||0,this.height=this.props.height||i?.height||0,this.updateTimestamp=e.incrementTimestamp()}static defaultProps={...s.Resource.defaultProps,source:void 0,width:0,height:0,colorSpace:"srgb",sampler:{}}}var a=e.i(825458),o=e.i(96204),u=e.i(749494),d=e.i(602774),f=e.i(325945),h=e.i(287785),l=e.i(652349),p=e.i(912828),c=e.i(69004),g=e.i(965880),m=e.i(466234),b=e.i(741033),y=e.i(896875),v=e.i(3311),x=e.i(795104);class _{id;topology;vertexCount;indices;attributes;bufferLayout;userData={};constructor(e){const{attributes:t={},indices:i=null,vertexCount:r=null}=e;for(const[r,s]of(this.id=e.id||(0,x.uid)("geometry"),this.topology=e.topology,i&&(this.indices=ArrayBuffer.isView(i)?{value:i,size:1}:i),this.attributes={},Object.entries(t))){const e=ArrayBuffer.isView(s)?{value:s}:s;if(!ArrayBuffer.isView(e.value))throw Error(`${this._print(r)}: must be typed array or object with value as typed array`);if("POSITION"!==r&&"positions"!==r||e.size||(e.size=3),"indices"===r){if(this.indices)throw Error("Multiple indices detected");this.indices=e}else{const t=B(r),i=Object.keys(this.attributes).find(e=>B(e)===t);i&&delete this.attributes[i],this.attributes[r]=e}}this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=r||this._calculateVertexCount(this.attributes,this.indices),this.bufferLayout=e.bufferLayout||function(e){let t=[];for(let[i,r]of Object.entries(e)){if(!r)continue;let{value:e,size:s,normalized:n}=r;if(void 0===s)throw Error(`Attribute ${i} is missing a size`);t.push({name:B(i),format:v.vertexFormatDecoder.getVertexFormatFromAttribute(e,s,n)})}return t}(this.attributes)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,t){return this}_calculateVertexCount(e,t){if(t)return t.value.length;let i=1/0;for(let t of Object.values(e)){if(!t)continue;let{value:e,size:r,constant:s}=t;!s&&e&&void 0!==r&&r>=1&&(i=Math.min(i,e.length/r))}return i}}function B(e){switch(e){case"POSITION":return"positions";case"NORMAL":return"normals";case"TEXCOORD_0":return"texCoords";case"TEXCOORD_1":return"texCoords1";case"COLOR_0":return"colors";default:return e}}function A(e,t){return Math.ceil(e/t)*t}e.s(["Geometry",0,_,"getGeometryShaderAttributeName",0,B],99023);class w{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){if(this.id=e.id||(0,x.uid)("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&!(this.indices.usage&t.Buffer.INDEX))throw Error("Index buffer must have INDEX usage")}destroy(){for(let e of(this.indices?.destroy(),Object.values(this.attributes)))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices||null}_calculateVertexCount(e){return e.byteLength/12}}let L="__debugFramebufferState";function S(e,t){if(!e)return t;let i=Number.parseInt(e,10);return Number.isFinite(i)?i:t}function I(e,t,i){if(e===t)return!0;if(!i||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!I(e[r],t[r],i-1))return!1;return!0}if(Array.isArray(t))return!1;if("object"==typeof e&&"object"==typeof t){let r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(let s of r)if(!t.hasOwnProperty(s)||!I(e[s],t[s],i-1))return!1;return!0}return!1}var C=e.i(515826);class F{bufferLayouts;constructor(e){this.bufferLayouts=e}getBufferLayout(e){return this.bufferLayouts.find(t=>t.name===e)||null}getAttributeNamesForBuffer(e){return(0,C.getBufferLayoutAttributeNames)(e)}mergeBufferLayouts(e,t){let i=[...e];for(let e of t){let t=i.findIndex(t=>t.name===e.name);t<0?i.push(e):i[t]=e}return i}}var D=e.i(965891),N=e.i(305887),R=e.i(311583);function T(e){return null!==e&&"object"==typeof e&&"resolveTextureBinding"in e&&"function"==typeof e.resolveTextureBinding}let O="render pipeline initialization failed",M=["stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];class ${static defaultProps={...u.RenderPipeline.defaultProps,source:void 0,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],plugins:[],geometry:null,indexBuffer:null,indexCount:void 0,firstVertex:0,firstIndex:0,attributes:{},constantAttributes:{},bindings:{},uniforms:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,material:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:y.ShaderAssembler.getDefaultShaderAssembler("glsl"),debugShaders:void 0,disableWarnings:void 0};device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;isInstanced=void 0;instanceCount=0;vertexCount;indexCount;firstVertex;firstIndex;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};vertexArray;transformFeedback=null;pipeline;shaderInputs;material=null;_uniformStore;_attributeInfos={};_gpuGeometry=null;props;
6_dynamicIndexBufferSource=null;_dynamicAttributeBufferSources={};_colorAttachmentFormats;_depthStencilAttachmentFormat;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_drawBlockedReason=!1;_destroyed=!1;_vertexCountSet=!1;_lastDrawTimestamp=-1;_bindingTable=[];get[Symbol.toStringTag](){return"Model"}toString(){return`Model(${this.id})`}constructor(e,t){const i=$.defaultProps.shaderAssembler,r=void 0!==t.vertexCount;this.props={...$.defaultProps,...t,shaderAssembler:t.shaderAssembler??(G(i,e.info.shadingLanguage)?i:y.ShaderAssembler.getDefaultShaderAssembler(e.info.shadingLanguage))},this._vertexCountSet=r,t=this.props,this.id=t.id||(0,x.uid)("model"),this.device=e,Object.assign(this.userData,t.userData),this.material=t.material||null;const s=function(e){return{type:e.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,limits:e.limits,features:e.features}}(e),n=(0,b.resolveShaderPlugins)(this.props.plugins,s.shaderLanguage),a=Object.fromEntries((0,b.mergeShaderPluginModules)(this.props.modules,n.modules).map(e=>[e.name,e])),o=t.shaderInputs||new N.ShaderInputs(a,{disableWarnings:this.props.disableWarnings});t.shaderInputs&&n.modules.length>0&&o.addModules(n.modules),this.setShaderInputs(o);const u=(0,D.mergeShaderModules)(this.props.modules,o.getModules()),h={...n.defines,...this.props.defines};if("webgl"===this.device.type&&(this.props._uniformBlockLayouts=(0,D.getShaderModuleUniformBlockLayouts)(u)),this.props.shaderLayout=(0,D.mergeShaderModuleBindingsIntoLayout)(this.props.shaderLayout,u)||null,"webgpu"===this.device.type&&this.props.source){const t=this.props.shaderAssembler;(0,l.assert)(G(t,"wgsl"));const{source:i,getUniforms:r,bindingTable:a,shaderLayout:o}=t.assembleWGSLShader({platformInfo:s,...this.props,modules:u,defines:h,pluginInjections:n.injections,pluginVertexInputs:n.vertexInputs,pluginVaryings:n.varyings});this.source=i,this._getModuleUniforms=r,this._bindingTable=a;const d=function(e,t){return e&&0!==Object.keys(t).length?{...e,attributes:e.attributes.map(e=>{let i=e.name.startsWith("_luma_")?e.name.slice(6):null;return i&&t[i]?{...e,name:i}:e})}:e}(o??e.getShaderLayout?.(this.source),n.vertexInputs),f=(0,D.mergeInferredShaderLayout)(this.props.shaderLayout,d,Object.keys(n.vertexInputs));this.props.shaderLayout=(0,D.mergeShaderModuleBindingsIntoLayout)(f||null,u)||null}else{const e=this.props.shaderAssembler;(0,l.assert)(G(e,"glsl"));const{vs:t,fs:i,getUniforms:r}=e.assembleGLSLShaderPair({platformInfo:s,...this.props,modules:u,defines:h,pluginInjections:n.injections,pluginVertexInputs:n.vertexInputs,pluginVaryings:n.varyings});this.vs=t,this.fs=i,this._getModuleUniforms=r,this._bindingTable=[]}this.vertexCount=this.props.vertexCount,this.indexCount=this.props.indexCount,this.firstVertex=this.props.firstVertex,this.firstIndex=this.props.firstIndex,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,this._colorAttachmentFormats=this.props.colorAttachmentFormats,this._depthStencilAttachmentFormat=this.props.depthStencilAttachmentFormat,t.geometry&&this.setGeometry(t.geometry),this.pipelineFactory=t.pipelineFactory||d.PipelineFactory.getDefaultPipelineFactory(this.device),this.shaderFactory=t.shaderFactory||f.ShaderFactory.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in t&&(this.isInstanced=t.isInstanced),t.instanceCount&&this.setInstanceCount(t.instanceCount),t.vertexCount&&this.setVertexCount(t.vertexCount),t.indexBuffer&&this.setIndexBuffer(t.indexBuffer),t.attributes&&this.setAttributes(t.attributes),t.constantAttributes&&this.setConstantAttributes(t.constantAttributes),t.bindings&&this.setBindings(t.bindings),t.transformFeedback&&(this.transformFeedback=t.transformFeedback)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.pipeline.fs!==this.pipeline.vs&&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 e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}getBindingDebugTable(){return this._bindingTable}predraw(e){this._syncDynamicBuffers(),this.updateShaderInputs(e),this.material?.updateShaderInputs(e),this.pipeline=this._updatePipeline()}draw(e){let t;if(this._drawBlockedReason&&!this._pipelineNeedsUpdate)return p.log.info(2,`>>> DRAWING ABORTED ${this.id}: ${this._drawBlockedReason}`)(),!1;let i=this._areBindingsLoading();if(i)return p.log.info(2,`>>> DRAWING ABORTED ${this.id}: ${i} not loaded`)(),!1;this._syncAttachmentFormats(e);try{e.pushDebugGroup(`${this}.predraw(${e})`),"webgpu"===this.device.type?(this.updateShaderInputs(),this.material?.updateShaderInputs(),this._syncDynamicBuffers(),this.pipeline=this._updatePipeline()):this.predraw(this.device.commandEncoder)}finally{e.popDebugGroup()}let r=this.pipeline.isErrored;try{if(e.pushDebugGroup(`${this}.draw(${e})`),this._logDrawCallStart(),this.pipeline=this._updatePipeline(),r=this.pipeline.isErrored)p.log.info(2,`>>> DRAWING ABORTED ${this.id}: ${O}`)(),t=!1;else{let i=this.vertexArray.getDrawValidationError();if(i)p.log.info(2,`>>> DRAWING ABORTED ${this.id}: ${i}`)(),this._drawBlockedReason=i,t=!1;else{let i=this._getCurrentShaderLayout(),r=this._getBindings(i),s=this._getBindGroups(i,r),{indexBuffer:n}=this.vertexArray,a=n?this.indexCount??(this._vertexCountSet?this.vertexCount:n.byteLength/("uint32"===n.indexType?4:2)):void 0;e.setPipeline(this.pipeline),e.setBindings(s,{_bindGroupCacheKeys:this._getBindGroupCacheKeys()}),e.setVertexArray(this.vertexArray),t=!0===this.isInstanced&&0===this.instanceCount||e.draw({isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.isInstanced?this.instanceCount:void 0,indexCount:a,firstVertex:this.first
6Vertex,firstIndex:this.firstIndex,transformFeedback:this.transformFeedback||void 0,uniforms:this.props.uniforms,parameters:this.parameters,topology:this.topology})}}}finally{e.popDebugGroup(),this._logDrawCallEnd()}return this._logFramebuffer(e),t?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):r?(this._needsRedraw=O,this._drawBlockedReason=O):this._drawBlockedReason?this._needsRedraw=this._drawBlockedReason:this._needsRedraw="waiting for resource initialization",t}setGeometry(e){this._gpuGeometry?.destroy();let i=e&&function(e,i){if(i instanceof w)return i;let r=function(e,t={}){var i,r;let s=t.bufferName||"geometry";if(function(e,t){if(1!==e.bufferLayout.length)return!1;let i=e.bufferLayout[0];return i.name===t&&!!i.attributes?.length&&!!e.attributes[t]}(e,s))return e;let n=t.minAttributeAlignment||4,a=(i=e,(r=t.attributes)?r.map(e=>[e,i.attributes[e]]):Object.entries(i.attributes)),o=[],u=0,d=1/0;for(let[e,t]of a){if(!t)continue;if(t.constant)throw Error(`Attribute ${e} is constant`);let{value:i,size:r,normalized:s}=t;if(!ArrayBuffer.isView(i))throw Error(`Attribute ${e} is missing typed array data`);if(void 0===r)throw Error(`Attribute ${e} is missing a size`);let a=v.vertexFormatDecoder.getVertexFormatFromAttribute(i,r,s),f=v.vertexFormatDecoder.getVertexFormatInfo(a);u=A(u,n),o.push({sourceName:e,attributeName:B(e),value:i,size:r,format:a,byteOffset:u,byteLength:f.byteLength}),u+=f.byteLength;let h=i.length/r;if(!Number.isInteger(h))throw Error(`Attribute ${e} length is not divisible by size`);d=Math.min(d,h)}if(0===o.length||!Number.isFinite(d))throw Error(`Geometry ${e.id} has no interleavable attributes`);let f=A(u,n),h=new ArrayBuffer(d*f);for(let e of o)!function(e,t,i,r){let s=r.value.constructor,n=s.BYTES_PER_ELEMENT;if(r.byteOffset%n!=0||i%n!=0)throw Error(`Attribute ${r.sourceName} is not aligned to its component type`);let a=new s(e),o=r.value,u=r.byteOffset/n,d=i/n;for(let e=0;e<t;e++){let t=e*r.size,i=e*d+u;for(let e=0;e<r.size;e++)a[i+e]=o[t+e]}}(h,d,f,e);return new _({id:e.id,topology:e.topology||"triangle-list",vertexCount:e.vertexCount,indices:e.indices,attributes:{[s]:{value:new Uint8Array(h),size:f,byteStride:f}},bufferLayout:[{name:s,stepMode:"vertex",byteStride:f,attributes:o.map(e=>({attribute:e.attributeName,format:e.format,byteOffset:e.byteOffset}))}]})}(i),s=function(e,i){if(!i.indices)return;let r=i.indices.value;return e.createBuffer({usage:t.Buffer.INDEX,data:r})}(e,r),{attributes:n,bufferLayout:a}=function(e,t){let i={};for(let[r,s]of Object.entries(t.attributes)){let n=t.bufferLayout.find(e=>e.name===r)?.name||B(r);s&&(i[n]=e.createBuffer({data:s.value,id:`${r}-buffer`}))}return{attributes:i,bufferLayout:t.bufferLayout,vertexCount:t.vertexCount}}(e,r);return new w({topology:r.topology||"triangle-list",bufferLayout:a,vertexCount:r.vertexCount,indices:s,attributes:n})}(this.device,e);if(i){this.setTopology(i.topology||"triangle-list");let e=new F(this.bufferLayout);this.bufferLayout=e.mergeBufferLayouts(i.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i)}this._gpuGeometry=i}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){let t=new F(this.bufferLayout),i=this._gpuGeometry?t.mergeBufferLayouts(e,this._gpuGeometry.bufferLayout):e;!I(i,this.bufferLayout,-1)&&(this.bufferLayout=i,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(e){I(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(e){this.instanceCount=e,void 0===this.isInstanced&&e>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(e){this.vertexCount=e,this._vertexCountSet=!0,this.setNeedsRedraw("vertexCount")}setIndexCount(e){this.indexCount=e,this.setNeedsRedraw("indexCount")}setDrawOffsets({firstVertex:e,firstIndex:t}
6){this.firstVertex=e,this.firstIndex=t,this.setNeedsRedraw("drawOffsets")}setShaderInputs(e){for(let[t,i]of(this.shaderInputs=e,this._uniformStore=new h.UniformStore(this.device,this.shaderInputs.modules),Object.entries(this.shaderInputs.modules)))if((0,D.shaderModuleHasUniforms)(i)&&!this.material?.ownsModule(t)){let e=this._uniformStore.getManagedUniformBuffer(t);this.bindings[`${t}Uniforms`]=e}this.setNeedsRedraw("shaderInputs")}setMaterial(e){this.material=e,this.setNeedsRedraw("material")}updateShaderInputs(e){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues(),e),this.setBindings(this._getNonMaterialBindings(this.shaderInputs.getBindingValues())),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){let t=e instanceof R.DynamicBuffer?e.buffer:e;this.indexBuffer=t,this._dynamicIndexBufferSource=e instanceof R.DynamicBuffer?{source:e,generation:e.generation}:null,this.vertexArray.setIndexBuffer(t),this.setNeedsRedraw("indexBuffer")}setAttributes(e,t){var i,r;let s,n;this._drawBlockedReason=!1;let a=t?.disableWarnings??this.props.disableWarnings;e.indices&&p.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)(),this.bufferLayout=(i=this.pipeline.shaderLayout,r=this.bufferLayout,s=(0,C.getShaderAttributeLocationMap)(i),(n=r.slice()).sort((e,t)=>(0,C.getMinimumAttributeLocation)((0,C.getBufferLayoutAttributeNames)(e).map(e=>s[e]))-(0,C.getMinimumAttributeLocation)((0,C.getBufferLayoutAttributeNames)(t).map(e=>s[e]))),n);let o=new F(this.bufferLayout);for(let[t,i]of Object.entries(e)){let e=i instanceof R.DynamicBuffer?i.buffer:i,r=o.getBufferLayout(t);if(!r){a||p.log.warn(`Model(${this.id}): Missing layout for buffer "${t}".`)();continue}let s=o.getAttributeNamesForBuffer(r),n=!1;for(let t of s){let r=this._attributeInfos[t];if(r){let t="webgpu"===this.device.type?this.vertexArray.getBufferSlot(r.bufferName):r.location;if(null===t){a||p.log.warn(`Model(${this.id}): Missing vertex array slot for buffer "${r.bufferName}".`)();continue}this.vertexArray.setBuffer(t,e),i instanceof R.DynamicBuffer?this._dynamicAttributeBufferSources[t]={source:i,generation:i.generation}:delete this._dynamicAttributeBufferSources[t],n=!0}}n||a||p.log.warn(`Model(${this.id}): Ignoring buffer "${e.id}" for unknown attribute "${t}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,t){for(let[i,r]of Object.entries(e)){let e=this._attributeInfos[i];e?this.vertexArray.setConstantWebGL(e.location,r):(t?.disableWarnings??this.props.disableWarnings)||p.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${i}"`)()}this.setNeedsRedraw("constants")}_areBindingsLoading(){for(let e of Object.values(this.bindings))if(T(e)&&!e.isReady)return e.id;for(let e of Object.values(this.material?.bindings||{}))if(T(e)&&!e.isReady)return e.id;return!1}_getBindings(e=this._getCurrentShaderLayout()){let t={};for(let[i,r]of Object.entries(this.bindings)){let s=function(e,t,i){if(T(t)){var r;let s,n=(r={fallbackGroup:0},(s=(0,m.getShaderLayoutBinding)(i,e,{ignoreWarnings:!0}),s?.type==="texture"||s?.type==="external-texture")?s:0===i.bindings.length&&r?.fallbackGroup!==void 0?{type:"texture",name:e,group:r.fallbackGroup,location:0}:null);return n?t.resolveTextureBinding(n):null}return t instanceof R.DynamicBuffer?t.buffer:(0,R.isBufferRangeBinding)(t)?(0,R.resolveBufferRangeBinding)(t):t}(i,r,e);s&&(t[i]=s)}return t}_getBindGroups(e=this._getCurrentShaderLayout(),t=this._getBindings(e)){let i=e.bindings.length?(0,m.normalizeBindingsByGroup)(e,t):{0:t};if(!this.material)return i;for(let[t,r]of Object.entries(this.material.getBindingsByGroup(e))){let e=Number(t);i[e]={...i[e]||{},...r}}return i}_getBindGroupCacheKeys(){let e=this.material?.getBindGroupCacheKey(3);return e?{3:e}:{}}_getBindingsUpdateTimestamp(){let e=0;for(let t of(this._dynamicIndexBufferSource&&(e=Math.max(e,this._dynamicIndexBufferSource.source.updateTimestamp)),Object.values(this._dynamicAttributeBufferSources)))e=Math.max(e,t.source.updateTimestamp);for(let i of Object.values(this.bindings))i instanceof o.TextureView?e=Math.max(e,i.texture.updateTimestamp):i instanceof t.Buffer||i instanceof a.Texture||i instanceof n||i instanceof R.DynamicBuffer?e=Math.max(e,i.updateTimestamp):T(i)?e=i.isReady?Math.max(e,i.updateTimestamp):1/0:(0,R.isBufferRangeBinding)(i)&&(e=Math.max(e,(i.buffer instanceof R.DynamicBuffer,i.buffer.updateTimestamp)));return Math.max(e,this.material?.getBindingsUpdateTimestamp()||0)}_setGeometryAttributes(e){let t={...e.attributes};for(let[e]of Object.entries(t))this.pipeline.shaderLayout.attributes.find(t=>t.name===e)||"positions"===e||delete t[e];this.vertexCount=e.vertexCount,this._vertexCountSet=!0,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(t,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this._drawBlockedReason=!1,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,t=null;this.pipeline&&(p.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,t=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let i=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debugShaders:this.props.debugShaders}),r=null;this.source?r=i:this.fs&&(r=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,bindings:void 0,bufferLayout:this.bufferLayout,colorAttachmentFormats:this._colorAttachmentFormats,depthStencilAttachmentFormat:this._depthStencilAttachmentFormat,topology:this.topology,parameters:this.parameters,bindGroups:void 0,vs:i,fs:r}),this._attributeInfos=(0,g.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),t&&t!==e&&this.shaderFactory.release(t)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let e=p.log.level>3?0:1e4;p.log.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=
6Date.now(),this._logOpen=!0,p.log.group(2,`>>> DRAWING MODEL ${this.id}`,{collapsed:p.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=function(e,t){let i={},r="Values";if(0===e.attributes.length&&!e.varyings?.length)return{"No attributes or varyings":{[r]:"N/A"}};for(let t of e.attributes)if(t){let e=`${t.location} ${t.name}: ${t.type}`;i[`in ${e}`]={[r]:t.stepMode||"vertex"}}for(let t of e.varyings||[]){let e=`${t.location} ${t.name}`;i[`out ${e}`]={[r]:JSON.stringify(t)}}return i}(this.pipeline.shaderLayout,this.id);p.log.table(2,e)();let t=this.shaderInputs.getDebugTable();p.log.table(2,t)();let i=this._getAttributeDebugTable();p.log.table(2,this._attributeInfos)(),p.log.table(2,i)(),p.log.groupEnd(2)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){let t=this.device.props.debugFramebuffers;if(this._drawCount++,!t)return;let i=e.props.framebuffer;!function(e,t,i){var r;if("webgl"!==e.device.type)return;let s=(r=e.device,r.userData[L]||={flushing:!1,queuedFramebuffers:[]},r.userData[L]);if(!s.flushing){let r;if(!(r=e.props.framebuffer)||null===r.handle)return function(e,t,i){if(0===i.queuedFramebuffers.length)return;let{gl:r}=e.device,s=r.getParameter(36010),n=r.getParameter(36006),[a,o]=e.device.getDefaultCanvasContext().getDrawingBufferSize(),u=S(t.top,8),d=S(t.left,8);i.flushing=!0;try{for(let e of i.queuedFramebuffers){let[i,s,n,f,h]=function(e){let{framebuffer:t,targetWidth:i,targetHeight:r,topPx:s,leftPx:n,minimap:a}=e,o=a?Math.max(Math.floor(i/4),1):i,u=a?Math.max(Math.floor(r/4),1):r,d=Math.min(o/t.width,u/t.height),f=Math.max(Math.floor(t.width*d),1),h=Math.max(Math.floor(t.height*d),1),l=Math.max(r-s-h,0);return[n,l,n+f,l+h,h]}({framebuffer:e,targetWidth:a,targetHeight:o,topPx:u,leftPx:d,minimap:t.minimap});r.bindFramebuffer(36008,e.handle),r.bindFramebuffer(36009,null),r.blitFramebuffer(0,0,e.width,e.height,i,s,n,f,16384,9728),u+=h+8}}finally{r.bindFramebuffer(36008,s),r.bindFramebuffer(36009,n),i.flushing=!1}}(e,i,s);t&&"colorAttachments"in t&&null!==t.handle&&!s.queuedFramebuffers.includes(t)&&s.queuedFramebuffers.push(t)}}(e,i,{id:i?.id||`${this.id}-framebuffer`,minimap:!0})}_getAttributeDebugTable(){let e={};for(let[t,i]of Object.entries(this._attributeInfos)){let r=this.vertexArray.attributes[i.location];e[i.location]={name:t,type:i.shaderType,values:r?this._getBufferOrConstantValues(r,i.bufferDataType):"null"}}if(this.vertexArray.indexBuffer){let{indexBuffer:t}=this.vertexArray,i="uint32"===t.indexType?new Uint32Array(t.debugData):new Uint16Array(t.debugData);e.indices={name:"indices",type:t.indexType,values:i.toString()}}return e}_getBufferOrConstantValues(e,i){let r=c.dataTypeDecoder.getTypedArrayConstructor(i);return(e instanceof t.Buffer?new r(e.debugData):e).toString()}_getNonMaterialBindings(e){if(!this.material)return e;let t={};for(let[i,r]of Object.entries(e))this.material.ownsBinding(i)||(t[i]=r);return t}_getCurrentShaderLayout(){return this.pipeline?.shaderLayout||this.props.shaderLayout||{bindings:[]}}_syncDynamicBuffers(){if(this._dynamicIndexBufferSource&&this._dynamicIndexBufferSource.generation!==this._dynamicIndexBufferSource.source.generation){let e=this._dynamicIndexBufferSource.source.buffer;this.indexBuffer=e,this.vertexArray.setIndexBuffer(e),this._dynamicIndexBufferSource.generation=this._dynamicIndexBufferSource.source.generation,this.setNeedsRedraw("dynamic index buffer")}for(let[e,t]of Object.entries(this._dynamicAttributeBufferSources))t.generation!==t.source.generation&&(this.vertexArray.setBuffer(Number(e),t.source.buffer),t.generation=t.source.generation,this.setNeedsRedraw("dynamic attribute buffer"))}_syncAttachmentFormats(e){var t;if("webgpu"!==this.device.type)return;let i=e.framebuffer||e.props.framebuffer,r=e.props,s=r.colorAttachmentFormats??i?.colorAttachments?.map(e=>{var t;return(t=e?.texture?.format)&&!k(t)?t:null}),n=!1===r.depthStencilAttachmentFormat?void 0:r.depthStencilAttachmentFormat??((t=i?.depthStencilAttachment?.texture?.format)&&k(t)?t:void 0);I(this._colorAttachmentFormats,s,1)&&this._depthStencilAttachmentFormat===n||(this._colorAttachmentFormats=s,this._depthStencilAttachmentFormat=n,this._setPipelineNeedsUpdate("attachment formats"))}}function G(e,t){return(void 0===e.shaderLanguage||e.shaderLanguage===t)&&("glsl"===t?"assembleGLSLShaderPair"in e&&"function"==typeof e.assembleGLSLShaderPair:"assembleWGSLShader"in e&&"function"==typeof e.assembleWGSLShader)}function k(e){return M.includes(e)}e.s(["Model",0,$],134810);class P{device;model;transformFeedback;static defaultProps={...$.defaultProps,feedbackBufferMode:"separate",outputs:void 0,feedbackBuffers:void 0};static isSupported(e){return e?.info?.type==="webgl"}constructor(e,t=P.defaultProps){if(!P.isSupported(e))throw Error("BufferTransform not yet implemented on WebGPU");this.device=e,this.model=new $(this.device,{id:t.id||"buffer-transform-model",fs:t.fs||function(){let{input
6:e,inputChannels:t,output:i}={};if(!e)return r;if(!t)throw Error("inputChannels");let s=function(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw Error(`invalid channels: ${e}`)}}(t),n=function(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw Error(`invalid channels: ${t}`)}}(e,t);return`\ 7#version 300 es 8in ${s} ${e}; 9out vec4 ${i}; 10void main() { 11 ${i} = ${n}; 12}`}(),topology:t.topology||"point-list",varyings:t.outputs||t.varyings,...t,bufferMode:t.bufferMode||("interleaved"===t.feedbackBufferMode?35980:35981)}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:t.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){e?.inputBuffers&&this.model.setAttributes(e.inputBuffers),e?.outputBuffers&&this.transformFeedback.setBuffers(e.outputBuffers);let t=this.device.beginRenderPass({discard:!0,...e});this.model.draw(t),t.end()}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){let i=this.getBuffer(e);if(!i)throw Error("BufferTransform#getBuffer");if(i instanceof t.Buffer)return i.readAsync();let{buffer:r,byteOffset:s=0,byteLength:n=r.byteLength}=i;return r.readAsync(s,n)}}e.s(["BufferTransform",0,P],443317)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.