@luma.gl/engine 9.0.0-beta.4 → 9.0.0-beta.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.
Files changed (78) hide show
  1. package/dist/animation/key-frames.js +54 -54
  2. package/dist/animation/timeline.js +95 -100
  3. package/dist/animation-loop/animation-loop-template.js +17 -5
  4. package/dist/animation-loop/animation-loop.js +425 -356
  5. package/dist/animation-loop/animation-props.js +0 -1
  6. package/dist/animation-loop/make-animation-loop.js +27 -25
  7. package/dist/debug/copy-texture-to-image.js +39 -43
  8. package/dist/debug/debug-framebuffer.js +43 -39
  9. package/dist/debug/debug-shader-layout.js +24 -25
  10. package/dist/debug/pixel-data-utils.js +33 -36
  11. package/dist/dist.dev.js +3784 -8643
  12. package/dist/geometries/cone-geometry.js +12 -18
  13. package/dist/geometries/cube-geometry.js +189 -62
  14. package/dist/geometries/cylinder-geometry.js +10 -15
  15. package/dist/geometries/ico-sphere-geometry.js +142 -161
  16. package/dist/geometries/plane-geometry.js +94 -112
  17. package/dist/geometries/sphere-geometry.js +77 -96
  18. package/dist/geometries/truncated-cone-geometry.js +100 -118
  19. package/dist/geometry/geometry-table.js +0 -1
  20. package/dist/geometry/geometry-utils.js +35 -32
  21. package/dist/geometry/geometry.js +77 -71
  22. package/dist/geometry/gpu-geometry.js +80 -99
  23. package/dist/geometry/gpu-table.js +41 -1
  24. package/dist/index.cjs +80 -127
  25. package/dist/index.cjs.map +7 -0
  26. package/dist/index.js +27 -24
  27. package/dist/lib/clip-space.js +25 -30
  28. package/dist/lib/pipeline-factory.d.ts +1 -5
  29. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  30. package/dist/lib/pipeline-factory.js +61 -68
  31. package/dist/model/model.d.ts +2 -2
  32. package/dist/model/model.d.ts.map +1 -1
  33. package/dist/model/model.js +539 -413
  34. package/dist/scenegraph/group-node.js +69 -84
  35. package/dist/scenegraph/model-node.js +32 -25
  36. package/dist/scenegraph/scenegraph-node.js +136 -124
  37. package/dist/shader-inputs.js +96 -58
  38. package/dist/transform/buffer-transform.js +65 -58
  39. package/dist/transform/texture-transform.d.ts.map +1 -1
  40. package/dist/transform/texture-transform.js +108 -115
  41. package/dist.min.js +2 -272
  42. package/package.json +10 -9
  43. package/src/lib/pipeline-factory.ts +8 -21
  44. package/src/model/model.ts +5 -5
  45. package/src/transform/buffer-transform.ts +3 -3
  46. package/src/transform/texture-transform.ts +0 -2
  47. package/dist/animation/key-frames.js.map +0 -1
  48. package/dist/animation/timeline.js.map +0 -1
  49. package/dist/animation-loop/animation-loop-template.js.map +0 -1
  50. package/dist/animation-loop/animation-loop.js.map +0 -1
  51. package/dist/animation-loop/animation-props.js.map +0 -1
  52. package/dist/animation-loop/make-animation-loop.js.map +0 -1
  53. package/dist/debug/copy-texture-to-image.js.map +0 -1
  54. package/dist/debug/debug-framebuffer.js.map +0 -1
  55. package/dist/debug/debug-shader-layout.js.map +0 -1
  56. package/dist/debug/pixel-data-utils.js.map +0 -1
  57. package/dist/geometries/cone-geometry.js.map +0 -1
  58. package/dist/geometries/cube-geometry.js.map +0 -1
  59. package/dist/geometries/cylinder-geometry.js.map +0 -1
  60. package/dist/geometries/ico-sphere-geometry.js.map +0 -1
  61. package/dist/geometries/plane-geometry.js.map +0 -1
  62. package/dist/geometries/sphere-geometry.js.map +0 -1
  63. package/dist/geometries/truncated-cone-geometry.js.map +0 -1
  64. package/dist/geometry/geometry-table.js.map +0 -1
  65. package/dist/geometry/geometry-utils.js.map +0 -1
  66. package/dist/geometry/geometry.js.map +0 -1
  67. package/dist/geometry/gpu-geometry.js.map +0 -1
  68. package/dist/geometry/gpu-table.js.map +0 -1
  69. package/dist/index.js.map +0 -1
  70. package/dist/lib/clip-space.js.map +0 -1
  71. package/dist/lib/pipeline-factory.js.map +0 -1
  72. package/dist/model/model.js.map +0 -1
  73. package/dist/scenegraph/group-node.js.map +0 -1
  74. package/dist/scenegraph/model-node.js.map +0 -1
  75. package/dist/scenegraph/scenegraph-node.js.map +0 -1
  76. package/dist/shader-inputs.js.map +0 -1
  77. package/dist/transform/buffer-transform.js.map +0 -1
  78. package/dist/transform/texture-transform.js.map +0 -1
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["Timeline","KeyFrames","AnimationLoopTemplate","AnimationLoop","makeAnimationLoop","Model","BufferTransform","TextureTransform","PipelineFactory","ClipSpace","ScenegraphNode","GroupNode","ModelNode","Geometry","GPUGeometry","ConeGeometry","CubeGeometry","CylinderGeometry","IcoSphereGeometry","PlaneGeometry","SphereGeometry","TruncatedConeGeometry","ShaderInputs","_ShaderInputs"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl Engine API\n\n// Animation\nexport {Timeline} from './animation/timeline';\nexport {KeyFrames} from './animation/key-frames';\nexport type {AnimationProps} from './animation-loop/animation-props';\n\nexport {AnimationLoopTemplate} from './animation-loop/animation-loop-template';\n\nexport type {AnimationLoopProps} from './animation-loop/animation-loop';\nexport {AnimationLoop} from './animation-loop/animation-loop';\n\nexport type {MakeAnimationLoopProps} from './animation-loop/make-animation-loop';\nexport {makeAnimationLoop} from './animation-loop/make-animation-loop';\n\nexport type {ModelProps} from './model/model';\nexport {Model} from './model/model';\n\n// Transforms\nexport type {BufferTransformProps} from './transform/buffer-transform';\nexport {BufferTransform} from './transform/buffer-transform';\nexport type {TextureTransformProps} from './transform/texture-transform';\nexport {TextureTransform} from './transform/texture-transform';\n\nexport {PipelineFactory} from './lib/pipeline-factory';\n\n// Utils\nexport {ClipSpace} from './lib/clip-space';\n\n// Scenegraph Core nodes\nexport {ScenegraphNode} from './scenegraph/scenegraph-node';\nexport {GroupNode} from './scenegraph/group-node';\nexport type {ModelNodeProps} from './scenegraph/model-node';\nexport {ModelNode} from './scenegraph/model-node';\n\n// Geometries\nexport type {GeometryProps} from './geometry/geometry';\nexport {Geometry} from './geometry/geometry';\nexport type {GPUGeometryProps} from './geometry/gpu-geometry';\nexport {GPUGeometry} from './geometry/gpu-geometry';\n\n// Primitives\nexport type {ConeGeometryProps} from './geometries/cone-geometry';\nexport {ConeGeometry} from './geometries/cone-geometry';\nexport type {CubeGeometryProps} from './geometries/cube-geometry';\nexport {CubeGeometry} from './geometries/cube-geometry';\nexport type {CylinderGeometryProps} from './geometries/cylinder-geometry';\nexport {CylinderGeometry} from './geometries/cylinder-geometry';\nexport type {IcoSphereGeometryProps} from './geometries/ico-sphere-geometry';\nexport {IcoSphereGeometry} from './geometries/ico-sphere-geometry';\nexport type {PlaneGeometryProps} from './geometries/plane-geometry';\nexport {PlaneGeometry} from './geometries/plane-geometry';\nexport type {SphereGeometryProps} from './geometries/sphere-geometry';\nexport {SphereGeometry} from './geometries/sphere-geometry';\nexport type {TruncatedConeGeometryProps} from './geometries/truncated-cone-geometry';\nexport {TruncatedConeGeometry} from './geometries/truncated-cone-geometry';\n\n// EXPERIMENTAL\nexport type {ShaderModuleInputs} from './shader-inputs';\nexport {ShaderInputs as _ShaderInputs} from './shader-inputs';\n"],"mappings":"SAGQA,QAAQ;AAAA,SACRC,SAAS;AAAA,SAGTC,qBAAqB;AAAA,SAGrBC,aAAa;AAAA,SAGbC,iBAAiB;AAAA,SAGjBC,KAAK;AAAA,SAILC,eAAe;AAAA,SAEfC,gBAAgB;AAAA,SAEhBC,eAAe;AAAA,SAGfC,SAAS;AAAA,SAGTC,cAAc;AAAA,SACdC,SAAS;AAAA,SAETC,SAAS;AAAA,SAITC,QAAQ;AAAA,SAERC,WAAW;AAAA,SAIXC,YAAY;AAAA,SAEZC,YAAY;AAAA,SAEZC,gBAAgB;AAAA,SAEhBC,iBAAiB;AAAA,SAEjBC,aAAa;AAAA,SAEbC,cAAc;AAAA,SAEdC,qBAAqB;AAAA,SAIrBC,YAAY,IAAIC,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"clip-space.js","names":["glsl","Model","Geometry","CLIPSPACE_VERTEX_SHADER","POSITIONS","ClipSpace","constructor","device","opts","TEX_COORDS","map","coord","vs","vertexCount","geometry","topology","attributes","aClipSpacePosition","size","value","Float32Array","aTexCoord","aCoordinate"],"sources":["../../src/lib/clip-space.ts"],"sourcesContent":["\n// ClipSpace\nimport {Device, glsl} from '@luma.gl/core';\nimport {Model, ModelProps} from '../model/model';\nimport {Geometry} from '../geometry/geometry';\n\nconst CLIPSPACE_VERTEX_SHADER = glsl`\\\n#version 300 es\nin vec2 aClipSpacePosition;\nin vec2 aTexCoord;\nin vec2 aCoordinate;\n\nout vec2 position;\nout vec2 coordinate;\nout vec2 uv;\n\nvoid main(void) {\n gl_Position = vec4(aClipSpacePosition, 0., 1.);\n position = aClipSpacePosition;\n coordinate = aCoordinate;\n uv = aTexCoord;\n}\n`;\n\n/* eslint-disable indent, no-multi-spaces */\nconst POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];\n\n/**\n * A flat geometry that covers the \"visible area\" that the GPU renders.\n */\nexport class ClipSpace extends Model {\n constructor(device: Device, opts: Omit<ModelProps, 'vs' | 'vertexCount' | 'geometry'>) {\n const TEX_COORDS = POSITIONS.map((coord) => (coord === -1 ? 0 : coord));\n\n super(\n device,\n {\n ...opts,\n vs: CLIPSPACE_VERTEX_SHADER,\n vertexCount: 4,\n geometry: new Geometry({\n topology: 'triangle-strip',\n vertexCount: 4,\n attributes: {\n aClipSpacePosition: {size: 2, value: new Float32Array(POSITIONS)},\n aTexCoord: {size: 2, value: new Float32Array(TEX_COORDS)},\n aCoordinate: {size: 2, value: new Float32Array(TEX_COORDS)}\n }\n })\n }\n );\n }\n}\n"],"mappings":"AAEA,SAAgBA,IAAI,QAAO,eAAe;AAAC,SACnCC,KAAK;AAAA,SACLC,QAAQ;AAEhB,MAAMC,uBAAuB,GAAGH,IAAK;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAGD,MAAMI,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAK9C,OAAO,MAAMC,SAAS,SAASJ,KAAK,CAAC;EACnCK,WAAWA,CAACC,MAAc,EAAEC,IAAyD,EAAE;IACrF,MAAMC,UAAU,GAAGL,SAAS,CAACM,GAAG,CAAEC,KAAK,IAAMA,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,GAAGA,KAAM,CAAC;IAEvE,KAAK,CACHJ,MAAM,EACN;MACE,GAAGC,IAAI;MACPI,EAAE,EAAET,uBAAuB;MAC3BU,WAAW,EAAE,CAAC;MACdC,QAAQ,EAAE,IAAIZ,QAAQ,CAAC;QACrBa,QAAQ,EAAE,gBAAgB;QAC1BF,WAAW,EAAE,CAAC;QACdG,UAAU,EAAE;UACVC,kBAAkB,EAAE;YAACC,IAAI,EAAE,CAAC;YAAEC,KAAK,EAAE,IAAIC,YAAY,CAAChB,SAAS;UAAC,CAAC;UACjEiB,SAAS,EAAE;YAACH,IAAI,EAAE,CAAC;YAAEC,KAAK,EAAE,IAAIC,YAAY,CAACX,UAAU;UAAC,CAAC;UACzDa,WAAW,EAAE;YAACJ,IAAI,EAAE,CAAC;YAAEC,KAAK,EAAE,IAAIC,YAAY,CAACX,UAAU;UAAC;QAC5D;MACF,CAAC;IACH,CACF,CAAC;EACH;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline-factory.js","names":["RenderPipeline","PipelineFactory","getDefaultPipelineFactory","device","_lumaData","defaultPipelineFactory","constructor","_hashCounter","_hashes","_useCounts","_pipelineCache","createRenderPipeline","options","props","defaultProps","hash","_hashRenderPipeline","pipeline","vs","createShader","stage","source","fs","release","destroy","vsHash","_getHash","fsHash","varyingHash","info","type","parameterHash","JSON","stringify","parameters","bufferLayoutHash","bufferLayout","topology","key","undefined"],"sources":["../../src/lib/pipeline-factory.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {RenderPipelineProps} from '@luma.gl/core';\nimport {Device, RenderPipeline} from '@luma.gl/core';\n\n/** Todo - should be same as RenderPipelineProps */\nexport type PipelineFactoryProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Only accepts string shaders\n vs: string;\n fs: string;\n};\n\n/**\n * Efficiently creates / caches pipelines\n */\nexport class PipelineFactory {\n static defaultProps: Required<PipelineFactoryProps> = {\n ...RenderPipeline.defaultProps,\n vs: undefined!,\n fs: undefined!\n };\n\n readonly device: Device;\n\n private _hashCounter: number = 0;\n private readonly _hashes: Record<string, number> = {};\n private readonly _useCounts: Record<string, number> = {};\n private readonly _pipelineCache: Record<string, RenderPipeline> = {};\n\n static getDefaultPipelineFactory(device: Device): PipelineFactory {\n device._lumaData.defaultPipelineFactory =\n device._lumaData.defaultPipelineFactory || new PipelineFactory(device);\n return device._lumaData.defaultPipelineFactory as PipelineFactory;\n }\n\n constructor(device: Device) {\n this.device = device;\n }\n\n createRenderPipeline(options: PipelineFactoryProps): RenderPipeline {\n const props: Required<PipelineFactoryProps> = {...PipelineFactory.defaultProps, ...options};\n\n const hash = this._hashRenderPipeline({...props});\n\n if (!this._pipelineCache[hash]) {\n const pipeline = this.device.createRenderPipeline({\n ...props,\n vs: this.device.createShader({stage: 'vertex', source: props.vs}),\n fs: props.fs ? this.device.createShader({stage: 'fragment', source: props.fs}) : null\n });\n\n pipeline.hash = hash;\n this._pipelineCache[hash] = pipeline;\n this._useCounts[hash] = 0;\n }\n\n this._useCounts[hash]++;\n\n return this._pipelineCache[hash];\n }\n\n release(pipeline: RenderPipeline): void {\n const hash = pipeline.hash;\n this._useCounts[hash]--;\n if (this._useCounts[hash] === 0) {\n this._pipelineCache[hash].destroy();\n delete this._pipelineCache[hash];\n delete this._useCounts[hash];\n }\n }\n\n // PRIVATE\n\n /** Calculate a hash based on all the inputs for a render pipeline */\n private _hashRenderPipeline(props: PipelineFactoryProps): string {\n const vsHash = this._getHash(props.vs);\n const fsHash = props.fs ? this._getHash(props.fs) : 0;\n\n // WebGL specific\n // const {varyings = [], bufferMode = {}} = props;\n // const varyingHashes = varyings.map((v) => this._getHash(v));\n const varyingHash = '-'; // `${varyingHashes.join('/')}B${bufferMode}`\n\n switch (this.device.info.type) {\n case 'webgpu':\n // On WebGPU we need to rebuild the pipeline if topology, parameters or bufferLayout change\n const parameterHash = this._getHash(JSON.stringify(props.parameters));\n const bufferLayoutHash = this._getHash(JSON.stringify(props.bufferLayout));\n // TODO - Can json.stringify() generate different strings for equivalent objects if order of params is different?\n // create a deepHash() to deduplicate?\n return `${vsHash}/${fsHash}V${varyingHash}T${props.topology}P${parameterHash}BL${bufferLayoutHash}}`;\n default:\n // WebGL is more dynamic\n return `${vsHash}/${fsHash}V${varyingHash}`;\n }\n }\n\n private _getHash(key: string): number {\n if (this._hashes[key] === undefined) {\n this._hashes[key] = this._hashCounter++;\n }\n return this._hashes[key];\n }\n}\n"],"mappings":"AAEA,SAAgBA,cAAc,QAAO,eAAe;AAYpD,OAAO,MAAMC,eAAe,CAAC;EAc3B,OAAOC,yBAAyBA,CAACC,MAAc,EAAmB;IAChEA,MAAM,CAACC,SAAS,CAACC,sBAAsB,GACrCF,MAAM,CAACC,SAAS,CAACC,sBAAsB,IAAI,IAAIJ,eAAe,CAACE,MAAM,CAAC;IACxE,OAAOA,MAAM,CAACC,SAAS,CAACC,sBAAsB;EAChD;EAEAC,WAAWA,CAACH,MAAc,EAAE;IAAA,KAbnBA,MAAM;IAAA,KAEPI,YAAY,GAAW,CAAC;IAAA,KACfC,OAAO,GAA2B,CAAC,CAAC;IAAA,KACpCC,UAAU,GAA2B,CAAC,CAAC;IAAA,KACvCC,cAAc,GAAmC,CAAC,CAAC;IASlE,IAAI,CAACP,MAAM,GAAGA,MAAM;EACtB;EAEAQ,oBAAoBA,CAACC,OAA6B,EAAkB;IAClE,MAAMC,KAAqC,GAAG;MAAC,GAAGZ,eAAe,CAACa,YAAY;MAAE,GAAGF;IAAO,CAAC;IAE3F,MAAMG,IAAI,GAAG,IAAI,CAACC,mBAAmB,CAAC;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;IACtC,MAAMS,MAAM,GAAGd,KAAK,CAACS,EAAE,GAAG,IAAI,CAACI,QAAQ,CAACb,KAAK,CAACS,EAAE,CAAC,GAAG,CAAC;IAKrD,MAAMM,WAAW,GAAG,GAAG;IAEvB,QAAQ,IAAI,CAACzB,MAAM,CAAC0B,IAAI,CAACC,IAAI;MAC3B,KAAK,QAAQ;QAEX,MAAMC,aAAa,GAAG,IAAI,CAACL,QAAQ,CAACM,IAAI,CAACC,SAAS,CAACpB,KAAK,CAACqB,UAAU,CAAC,CAAC;QACrE,MAAMC,gBAAgB,GAAG,IAAI,CAACT,QAAQ,CAACM,IAAI,CAACC,SAAS,CAACpB,KAAK,CAACuB,YAAY,CAAC,CAAC;QAG1E,OAAQ,GAAEX,MAAO,IAAGE,MAAO,IAAGC,WAAY,IAAGf,KAAK,CAACwB,QAAS,IAAGN,aAAc,KAAII,gBAAiB,GAAE;MACtG;QAEE,OAAQ,GAAEV,MAAO,IAAGE,MAAO,IAAGC,WAAY,EAAC;IAC/C;EACF;EAEQF,QAAQA,CAACY,GAAW,EAAU;IACpC,IAAI,IAAI,CAAC9B,OAAO,CAAC8B,GAAG,CAAC,KAAKC,SAAS,EAAE;MACnC,IAAI,CAAC/B,OAAO,CAAC8B,GAAG,CAAC,GAAG,IAAI,CAAC/B,YAAY,EAAE;IACzC;IACA,OAAO,IAAI,CAACC,OAAO,CAAC8B,GAAG,CAAC;EAC1B;AACF;AAxFarC,eAAe,CACnBa,YAAY,GAAmC;EACpD,GAAGd,cAAc,CAACc,YAAY;EAC9BI,EAAE,EAAEqB,SAAU;EACdjB,EAAE,EAAEiB;AACN,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","names":["Buffer","RenderPipeline","UniformStore","getTypedArrayFromDataType","log","uid","deepEqual","splitUniformsAndBindings","isNumberArray","getAttributeInfosFromLayouts","ShaderAssembler","getShaderLayoutFromWGSL","ShaderInputs","makeGPUGeometry","PipelineFactory","getDebugTableForShaderLayout","debugFramebuffer","LOG_DRAW_PRIORITY","LOG_DRAW_TIMEOUT","Model","constructor","device","props","_this$props$modules","_this$props$modules2","_this$shaderInputs","id","vs","fs","pipelineFactory","userData","parameters","topology","bufferLayout","vertexCount","instanceCount","indexBuffer","bufferAttributes","constantAttributes","bindings","uniforms","vertexArray","transformFeedback","pipeline","shaderInputs","_uniformStore","_pipelineNeedsUpdate","_attributeInfos","_gpuGeometry","_getModuleUniforms","_lastLogTime","_logOpen","_drawCount","defaultProps","Object","assign","moduleMap","fromEntries","modules","map","module","name","setShaderInputs","isWebGPU","info","type","source","_this$props","shaderLayout","_this$props2","wgsl","platformInfo","getPlatformInfo","length","getModules","getUniforms","shaderAssembler","assembleShaders","geometry","setGeometry","getDefaultPipelineFactory","_updatePipeline","createVertexArray","renderPipeline","_setGeometryAttributes","setVertexCount","setInstanceCount","indices","Error","setIndexBuffer","attributes","setAttributes","setConstantAttributes","setBindings","setUniforms","moduleSettings","warn","updateModuleSettings","seal","destroy","release","predraw","updateShaderInputs","draw","renderPass","_logDrawCallStart","indexCount","byteLength","indexType","undefined","_logDrawCallEnd","_logFramebuffer","gpuGeometry","setTopology","mergeBufferLayouts","attributeName","entries","find","layout","_setPipelineNeedsUpdate","setBufferLayout","setParameters","moduleName","keys","uniformBuffer","getManagedUniformBuffer","setShaderModuleProps","filter","k","uniform","getUniformValues","setTransformFeedback","buffers","_option","bufferName","buffer","getAttributeNames","includes","attributeNames","set","attributeInfo","setBuffer","location","value","setConstant","reason","createShader","stage","createRenderPipeline","logDrawTimeout","level","Date","now","group","collapsed","shaderLayoutTable","table","uniformTable","getDebugTable","attributeTable","_getAttributeDebugTable","groupEnd","debugFramebuffers","get","framebuffer","minimap","shaderType","values","_getBufferOrConstantValues","bufferDataType","Uint32Array","debugData","Uint16Array","toString","attribute","dataType","TypedArrayConstructor","typedArray","handle","defines","varyings","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push","shaderLanguage","shadingLanguage","shaderLanguageVersion","shadingLanguageVersion","gpu","features","_bufferLayout$attribu"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, RenderPipelineProps, RenderPipelineParameters} from '@luma.gl/core';\nimport type {BufferLayout, VertexArray, TransformFeedback} from '@luma.gl/core';\nimport type {AttributeInfo, Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';\nimport {\n Device,\n Buffer,\n RenderPipeline,\n RenderPass,\n UniformStore,\n getTypedArrayFromDataType\n} from '@luma.gl/core';\nimport {log, uid, deepEqual, splitUniformsAndBindings, isNumberArray} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler, getShaderLayoutFromWGSL} from '@luma.gl/shadertools';\nimport {ShaderInputs} from '../shader-inputs';\nimport type {Geometry} from '../geometry/geometry';\nimport {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';\nimport {PipelineFactory} from '../lib/pipeline-factory';\nimport {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';\nimport {debugFramebuffer} from '../debug/debug-framebuffer';\n\nconst LOG_DRAW_PRIORITY = 2;\nconst LOG_DRAW_TIMEOUT = 10000;\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n source?: string;\n vs: {glsl?: string; wgsl?: string} | string | null;\n fs: {glsl?: string; wgsl?: string} | string | null;\n /** shadertool shader modules (added to shader code) */\n modules?: ShaderModule[];\n /** Shadertool module defines (configures shader code)*/\n defines?: Record<string, string | number | boolean>;\n // TODO - injections, hooks etc?\n\n /** Shader inputs, used to generated uniform buffers and bindings */\n shaderInputs?: ShaderInputs;\n /** pipeline factory to use to create render pipelines. Defaults to default factory for the device */\n pipelineFactory?: PipelineFactory;\n /** Shader assembler. Defaults to the ShaderAssembler.getShaderAssembler() */\n shaderAssembler?: ShaderAssembler;\n\n /** Parameters that are built into the pipeline */\n parameters?: RenderPipelineParameters;\n\n /** Geometry */\n geometry?: GPUGeometry | Geometry | null;\n\n /** Vertex count */\n vertexCount?: number;\n /** instance count */\n instanceCount?: number;\n\n indexBuffer?: Buffer | null;\n /** @note this is really a map of buffers, not a map of attributes */\n attributes?: Record<string, Buffer>;\n /** */\n constantAttributes?: Record<string, TypedArray>;\n\n /** @internal For use with {@link TransformFeedback}, WebGL 2 only. */\n varyings?: string[];\n\n transformFeedback?: TransformFeedback;\n\n /** Mapped uniforms for shadertool modules */\n moduleSettings?: Record<string, Record<string, any>>;\n};\n\n/**\n * v9 Model API\n * A model\n * - automatically reuses pipelines (programs) when possible\n * - automatically rebuilds pipelines if necessary to accommodate changed settings\n * shadertools integration\n * - accepts modules and performs shader transpilation\n */\nexport class Model {\n static defaultProps: Required<ModelProps> = {\n ...RenderPipeline.defaultProps,\n source: null,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: undefined!,\n geometry: null,\n indexBuffer: null,\n attributes: {},\n constantAttributes: {},\n varyings: [],\n\n shaderInputs: undefined!,\n pipelineFactory: undefined!,\n transformFeedback: undefined,\n shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()\n };\n\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string;\n readonly pipelineFactory: PipelineFactory;\n userData: {[key: string]: any} = {};\n\n // Fixed properties (change can trigger pipeline rebuild)\n\n /** The render pipeline GPU parameters, depth testing etc */\n parameters: RenderPipelineParameters;\n\n /** The primitive topology */\n topology: PrimitiveTopology;\n /** Buffer layout */\n bufferLayout: BufferLayout[];\n\n // Dynamic properties\n\n /** Vertex count */\n vertexCount: number;\n /** instance count */\n instanceCount: number = 0;\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Buffer-valued attributes */\n bufferAttributes: Record<string, Buffer> = {};\n /** Constant-valued attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Bindings (textures, samplers, uniform buffers) */\n bindings: Record<string, Binding> = {};\n /** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/\n uniforms: Record<string, UniformValue> = {};\n\n /**\n * VertexArray\n * @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!\n * @todo - allow application to define multiple vertex arrays?\n * */\n vertexArray: VertexArray;\n\n /** TransformFeedback, WebGL 2 only. */\n transformFeedback: TransformFeedback | null = null;\n\n /** The underlying GPU \"program\". @note May be recreated if parameters change */\n pipeline: RenderPipeline;\n\n /** ShaderInputs instance */\n shaderInputs: ShaderInputs;\n\n _uniformStore: UniformStore;\n\n _pipelineNeedsUpdate: string | false = 'newly created';\n _attributeInfos: Record<string, AttributeInfo> = {};\n _gpuGeometry: GPUGeometry | null = null;\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n private props: Required<ModelProps>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...Model.defaultProps, ...props};\n props = this.props;\n this.id = props.id || uid('model');\n this.device = device;\n\n Object.assign(this.userData, props.userData);\n\n // Setup shader module inputs\n const moduleMap = Object.fromEntries(\n this.props.modules?.map(module => [module.name, module]) || []\n );\n this.setShaderInputs(props.shaderInputs || new ShaderInputs(moduleMap));\n\n const isWebGPU = this.device.info.type === 'webgpu';\n // TODO - hack to support unified WGSL shader\n // TODO - this is wrong, compile a single shader\n if (this.props.source) {\n if (isWebGPU) {\n this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.props.source);\n }\n this.props.fs = this.props.source;\n this.props.vs = this.props.source;\n }\n\n // Support WGSL shader layout introspection\n if (isWebGPU && typeof this.props.vs !== 'string') {\n this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.props.vs.wgsl);\n }\n\n // Setup shader assembler\n const platformInfo = getPlatformInfo(device);\n\n // Extract modules from shader inputs if not supplied\n const modules =\n (this.props.modules?.length > 0 ? this.props.modules : this.shaderInputs?.getModules()) || [];\n\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders({\n platformInfo,\n ...this.props,\n modules\n });\n\n this.vs = vs;\n this.fs = fs;\n this._getModuleUniforms = getUniforms;\n\n this.vertexCount = this.props.vertexCount;\n this.instanceCount = this.props.instanceCount;\n\n this.topology = this.props.topology;\n this.bufferLayout = this.props.bufferLayout;\n this.parameters = this.props.parameters;\n\n // Geometry, if provided, sets topology and vertex cound\n if (props.geometry) {\n this._gpuGeometry = this.setGeometry(props.geometry);\n }\n\n this.pipelineFactory =\n props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n\n // Create the pipeline\n // @note order is important\n this.pipeline = this._updatePipeline();\n\n this.vertexArray = device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Now we can apply geometry attributes\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n\n // Apply any dynamic settings that will not trigger pipeline change\n if (props.vertexCount) {\n this.setVertexCount(props.vertexCount);\n }\n if (props.instanceCount) {\n this.setInstanceCount(props.instanceCount);\n }\n // @ts-expect-error\n if (props.indices) {\n throw new Error('Model.props.indices removed. Use props.indexBuffer');\n }\n if (props.indexBuffer) {\n this.setIndexBuffer(props.indexBuffer);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.constantAttributes) {\n this.setConstantAttributes(props.constantAttributes);\n }\n if (props.bindings) {\n this.setBindings(props.bindings);\n }\n if (props.uniforms) {\n this.setUniforms(props.uniforms);\n }\n if (props.moduleSettings) {\n log.warn('Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()')();\n this.updateModuleSettings(props.moduleSettings);\n }\n if (props.transformFeedback) {\n this.transformFeedback = props.transformFeedback;\n }\n\n // WebGL1?\n // this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms\n\n // Catch any access to non-standard props\n Object.seal(this);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n this._uniformStore.destroy();\n }\n\n // Draw call\n\n predraw() {\n // Update uniform buffers if needed\n this.updateShaderInputs();\n }\n\n draw(renderPass: RenderPass): void {\n this.predraw();\n\n try {\n this._logDrawCallStart();\n\n // Check if the pipeline is invalidated\n // TODO - this is likely the worst place to do this from performance perspective. Perhaps add a predraw()?\n this.pipeline = this._updatePipeline();\n\n // Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw\n // Any caching needs to be done inside the pipeline functions\n this.pipeline.setBindings(this.bindings);\n this.pipeline.setUniforms(this.uniforms);\n\n const {indexBuffer} = this.vertexArray;\n const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === 'uint32' ? 4 : 2) : undefined;\n \n this.pipeline.draw({\n renderPass,\n vertexArray: this.vertexArray,\n vertexCount: this.vertexCount,\n instanceCount: this.instanceCount,\n indexCount,\n transformFeedback: this.transformFeedback\n });\n } finally {\n this._logDrawCallEnd();\n }\n this._logFramebuffer(renderPass);\n }\n\n // Update fixed fields (can trigger pipeline rebuild)\n\n /**\n * Updates the optional geometry\n * Geometry, set topology and bufferLayout\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setGeometry(geometry: GPUGeometry | Geometry): GPUGeometry {\n const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);\n this.setTopology(gpuGeometry.topology || 'triangle-list');\n this.bufferLayout = mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout);\n if (this.vertexArray) {\n this._setGeometryAttributes(gpuGeometry);\n }\n return gpuGeometry;\n }\n\n /**\n * Updates the optional geometry attributes\n * Geometry, sets several attributes, indexBuffer, and also vertex count\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n _setGeometryAttributes(gpuGeometry: GPUGeometry): void {\n // Filter geometry attribute so that we don't issue warnings for unused attributes\n const attributes = {...gpuGeometry.attributes};\n for (const [attributeName] of Object.entries(attributes)) {\n if (\n !this.pipeline.shaderLayout.attributes.find(layout => layout.name === attributeName) &&\n attributeName !== 'positions'\n ) {\n delete attributes[attributeName];\n }\n }\n\n // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setIndexBuffer(gpuGeometry.indices);\n this.setAttributes(gpuGeometry.attributes, 'ignore-unknown');\n this.setAttributes(attributes);\n }\n\n /**\n * Updates the primitive topology ('triangle-list', 'triangle-strip' etc).\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setTopology(topology: PrimitiveTopology): void {\n if (topology !== this.topology) {\n this.topology = topology;\n this._setPipelineNeedsUpdate('topology');\n }\n }\n\n /**\n * Updates the buffer layout.\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setBufferLayout(bufferLayout: BufferLayout[]): void {\n this.bufferLayout = this._gpuGeometry\n ? mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout)\n : bufferLayout;\n this._setPipelineNeedsUpdate('bufferLayout');\n\n // Recreate the pipeline\n this.pipeline = this._updatePipeline();\n\n // vertex array needs to be updated if we update buffer layout,\n // but not if we update parameters\n this.vertexArray = this.device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Reapply geometry attributes to the new vertex array\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n }\n\n /**\n * Set GPU parameters.\n * @note Can trigger a pipeline rebuild / pipeline cache fetch.\n * @param parameters\n */\n setParameters(parameters: RenderPipelineParameters) {\n if (!deepEqual(parameters, this.parameters, 2)) {\n this.parameters = parameters;\n this._setPipelineNeedsUpdate('parameters');\n }\n }\n\n // Update dynamic fields\n\n /**\n * Updates the vertex count (used in draw calls)\n * @note Any attributes with stepMode=vertex need to be at least this big\n */\n setVertexCount(vertexCount: number): void {\n this.vertexCount = vertexCount;\n }\n\n /**\n * Updates the instance count (used in draw calls)\n * @note Any attributes with stepMode=instance need to be at least this big\n */\n setInstanceCount(instanceCount: number): void {\n this.instanceCount = instanceCount;\n }\n\n setShaderInputs(shaderInputs: ShaderInputs): void {\n this.shaderInputs = shaderInputs;\n this._uniformStore = new UniformStore(this.shaderInputs.modules);\n // Create uniform buffer bindings for all modules\n for (const moduleName of Object.keys(this.shaderInputs.modules)) {\n const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);\n this.bindings[`${moduleName}Uniforms`] = uniformBuffer;\n }\n }\n\n /**\n * Updates shader module settings (which results in uniforms being set)\n */\n setShaderModuleProps(props: Record<string, any>): void {\n const uniforms = this._getModuleUniforms(props);\n\n // Extract textures & framebuffers set by the modules\n // TODO better way to extract bindings\n const keys = Object.keys(uniforms).filter(k => {\n const uniform = uniforms[k];\n return !isNumberArray(uniform) && typeof uniform !== 'number' && typeof uniform !== 'boolean';\n });\n const bindings: Record<string, Binding> = {};\n for (const k of keys) {\n bindings[k] = uniforms[k];\n delete uniforms[k];\n }\n }\n\n updateShaderInputs(): void {\n this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());\n }\n\n /**\n * @deprecated Updates shader module settings (which results in uniforms being set)\n */\n updateModuleSettings(props: Record<string, any>): void {\n log.warn('Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()')();\n const {bindings, uniforms} = splitUniformsAndBindings(this._getModuleUniforms(props));\n Object.assign(this.bindings, bindings);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets bindings (textures, samplers, uniform buffers)\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * Sets individual uniforms\n * @deprecated WebGL only, use uniform buffers for portability\n * @param uniforms\n * @returns self for chaining\n */\n setUniforms(uniforms: Record<string, UniformValue>): void {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets the index buffer\n * @todo - how to unset it if we change geometry?\n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n this.vertexArray.setIndexBuffer(indexBuffer);\n }\n\n /**\n * Updates optional transform feedback. WebGL 2 only.\n */\n setTransformFeedback(transformFeedback: TransformFeedback | null): void {\n this.transformFeedback = transformFeedback;\n }\n\n /**\n * Sets attributes (buffers)\n * @note Overrides any attributes previously set with the same name\n */\n setAttributes(buffers: Record<string, Buffer>, _option?: 'ignore-unknown'): void {\n if (buffers.indices) {\n log.warn(\n `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`\n )();\n }\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n const bufferLayout = this.bufferLayout.find(layout => getAttributeNames(layout).includes(bufferName));\n if (!bufferLayout) {\n log.warn(`Model(${this.id}): Missing layout for buffer \"${bufferName}\".`)();\n continue; // eslint-disable-line no-continue\n }\n\n // For an interleaved attribute we may need to set multiple attributes\n const attributeNames = getAttributeNames(bufferLayout);\n let set = false;\n for (const attributeName of attributeNames) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setBuffer(attributeInfo.location, buffer);\n set = true;\n }\n }\n if (!set && _option !== 'ignore-unknown') {\n log.warn(\n `Model(${this.id}): Ignoring buffer \"${buffer.id}\" for unknown attribute \"${bufferName}\"`\n )();\n }\n }\n }\n\n /**\n * Sets constant attributes\n * @note Overrides any attributes previously set with the same name\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param constantAttributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [attributeName, value] of Object.entries(attributes)) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setConstant(attributeInfo.location, value);\n } else {\n log.warn(\n `Model \"${this.id}: Ignoring constant supplied for unknown attribute \"${attributeName}\"`\n )();\n }\n }\n }\n\n _setPipelineNeedsUpdate(reason: string): void {\n this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;\n }\n\n _updatePipeline(): RenderPipeline {\n if (this._pipelineNeedsUpdate) {\n if (this.pipeline) {\n log.log(\n 1,\n `Model ${this.id}: Recreating pipeline because \"${this._pipelineNeedsUpdate}\".`\n )();\n }\n \n this._pipelineNeedsUpdate = false;\n\n const vs = this.device.createShader({\n id: `${this.id}-vertex`,\n stage: 'vertex',\n source: this.vs\n });\n\n const fs = this.fs\n ? this.device.createShader({\n id: `${this.id}-fragment`,\n stage: 'fragment',\n source: this.fs\n })\n : null;\n\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs,\n fs\n });\n\n this._attributeInfos = getAttributeInfosFromLayouts(\n this.pipeline.shaderLayout,\n this.bufferLayout\n );\n }\n return this.pipeline;\n }\n\n /** Throttle draw call logging */\n _lastLogTime = 0;\n _logOpen = false;\n\n _logDrawCallStart(): void {\n // IF level is 4 or higher, log every frame.\n const logDrawTimeout = log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;\n if (log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {\n return;\n }\n\n this._lastLogTime = Date.now();\n this._logOpen = true;\n\n log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, {collapsed: log.level <= 2})();\n }\n\n _logDrawCallEnd(): void {\n if (this._logOpen) {\n const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout, this.id);\n\n // log.table(logLevel, attributeTable)();\n // log.table(logLevel, uniformTable)();\n log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();\n\n const uniformTable = this.shaderInputs.getDebugTable();\n // Add any global uniforms\n for (const [name, value] of Object.entries(this.uniforms)) {\n uniformTable[name] = {value};\n }\n log.table(LOG_DRAW_PRIORITY, uniformTable)();\n\n const attributeTable = this._getAttributeDebugTable();\n log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();\n log.table(LOG_DRAW_PRIORITY, attributeTable)();\n\n log.groupEnd(LOG_DRAW_PRIORITY)();\n this._logOpen = false;\n }\n }\n\n protected _drawCount = 0;\n _logFramebuffer(renderPass: RenderPass): void {\n const debugFramebuffers = log.get('framebuffer');\n this._drawCount++;\n // Update first 3 frames and then every 60 frames\n if (!debugFramebuffers || ((this._drawCount++ > 3) && (this._drawCount % 60))) {\n return;\n }\n // TODO - display framebuffer output in debug window\n const framebuffer = renderPass.props.framebuffer;\n if (framebuffer) {\n debugFramebuffer(framebuffer, {id: framebuffer.id, minimap: true});\n // log.image({logLevel: LOG_DRAW_PRIORITY, message: `${framebuffer.id} %c sup?`, image})();\n }\n }\n\n _getAttributeDebugTable(): Record<string, Record<string, unknown>> {\n const table: Record<string, Record<string, unknown>> = {};\n for (const [name, attributeInfo] of Object.entries(this._attributeInfos)) {\n table[attributeInfo.location] = {\n name,\n type: attributeInfo.shaderType,\n values: this._getBufferOrConstantValues(\n this.vertexArray.attributes[attributeInfo.location],\n attributeInfo.bufferDataType\n )\n };\n }\n if (this.vertexArray.indexBuffer) {\n const {indexBuffer} = this.vertexArray;\n const values =\n indexBuffer.indexType === 'uint32'\n ? new Uint32Array(indexBuffer.debugData)\n : new Uint16Array(indexBuffer.debugData);\n table.indices = {\n name: 'indices',\n type: indexBuffer.indexType,\n values: values.toString()\n };\n }\n return table;\n }\n\n // TODO - fix typing of luma data types\n _getBufferOrConstantValues(attribute: Buffer | TypedArray, dataType: any): string {\n const TypedArrayConstructor = getTypedArrayFromDataType(dataType);\n const typedArray =\n attribute instanceof Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;\n return typedArray.toString();\n }\n}\n\n// HELPERS\n\n/** TODO - move to core, document add tests */\nfunction mergeBufferLayouts(layouts1: BufferLayout[], layouts2: BufferLayout[]): BufferLayout[] {\n const layouts = [...layouts1];\n for (const attribute of layouts2) {\n const index = layouts.findIndex(attribute2 => attribute2.name === attribute.name);\n if (index < 0) {\n layouts.push(attribute);\n } else {\n layouts[index] = attribute;\n }\n }\n return layouts;\n}\n\n/** Create a shadertools platform info from the Device */\nexport function getPlatformInfo(device: Device): PlatformInfo {\n return {\n type: device.info.type,\n shaderLanguage: device.info.shadingLanguage,\n shaderLanguageVersion: device.info.shadingLanguageVersion as 100 | 300,\n gpu: device.info.gpu,\n features: device.features\n };\n}\n\n/** Get attribute names from a BufferLayout */\nfunction getAttributeNames(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@ -1 +0,0 @@
1
- {"version":3,"file":"group-node.js","names":["Matrix4","Vector3","log","ScenegraphNode","GroupNode","constructor","props","arguments","length","undefined","Array","isArray","children","assert","every","child","getBounds","result","Infinity","traverse","node","_ref","worldMatrix","bounds","min","max","center","add","divide","transformAsPoint","halfSize","subtract","transformAsVector","v","position","multiply","i","Math","Number","isFinite","destroy","forEach","removeAll","_len","_key","push","remove","indexOf","splice","visitor","modelMatrix","multiplyRight","matrix"],"sources":["../../src/scenegraph/group-node.ts"],"sourcesContent":["import {Matrix4, Vector3} from '@math.gl/core';\nimport {log} from '@luma.gl/core';\nimport {ScenegraphNode, ScenegraphNodeProps} from './scenegraph-node';\n\nexport type GroupNodeProps = ScenegraphNodeProps & {\n children?: ScenegraphNode[];\n}\n\nexport class GroupNode extends ScenegraphNode {\n children: ScenegraphNode[];\n\n constructor(children: ScenegraphNode[]);\n constructor(props?: GroupNodeProps);\n\n constructor(props: ScenegraphNode[] | GroupNodeProps = {}) {\n props = Array.isArray(props) ? {children: props} : props;\n const {children = []} = props;\n log.assert(\n children.every((child) => child instanceof ScenegraphNode),\n 'every child must an instance of ScenegraphNode'\n );\n super(props);\n this.children = children;\n }\n\n override getBounds(): [number[], number[]] | null {\n const result: [number[], number[]] = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];\n\n this.traverse((node, {worldMatrix}) => {\n const bounds = node.getBounds();\n if (!bounds) {\n return;\n }\n const [min, max] = bounds;\n const center = new Vector3(min).add(max).divide([2, 2, 2]);\n worldMatrix.transformAsPoint(center, center);\n const halfSize = new Vector3(max).subtract(min).divide([2, 2, 2]);\n worldMatrix.transformAsVector(halfSize, halfSize);\n\n for (let v = 0; v < 8; v++) {\n // Test all 8 corners of the box\n const position = new Vector3(\n v & 0b001 ? -1 : 1,\n v & 0b010 ? -1 : 1,\n v & 0b100 ? -1 : 1\n ).multiply(halfSize).add(center);\n\n for (let i = 0; i < 3; i++) {\n result[0][i] = Math.min(result[0][i], position[i]);\n result[1][i] = Math.max(result[1][i], position[i]);\n }\n }\n });\n if (!Number.isFinite(result[0][0])) {\n return null;\n }\n return result;\n }\n\n override destroy(): void {\n this.children.forEach((child) => child.destroy());\n this.removeAll();\n super.destroy();\n }\n\n // Unpacks arrays and nested arrays of children\n add(...children: (ScenegraphNode | ScenegraphNode[])[]): this {\n for (const child of children) {\n if (Array.isArray(child)) {\n this.add(...child);\n } else {\n this.children.push(child);\n }\n }\n return this;\n }\n\n remove(child: ScenegraphNode): this {\n const children = this.children;\n const indexOf = children.indexOf(child);\n if (indexOf > -1) {\n children.splice(indexOf, 1);\n }\n return this;\n }\n\n removeAll(): this {\n this.children = [];\n return this;\n }\n\n traverse(visitor: (node: ScenegraphNode, context: {worldMatrix: Matrix4}) => void, {worldMatrix = new Matrix4()} = {}) {\n const modelMatrix = new Matrix4(worldMatrix).multiplyRight(this.matrix);\n\n for (const child of this.children) {\n if (child instanceof GroupNode) {\n child.traverse(visitor, {worldMatrix: modelMatrix});\n } else {\n visitor(child, {worldMatrix: modelMatrix});\n }\n }\n }\n}\n"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,eAAe;AAC9C,SAAQC,GAAG,QAAO,eAAe;AAAC,SAC1BC,cAAc;AAMtB,OAAO,MAAMC,SAAS,SAASD,cAAc,CAAC;EAM5CE,WAAWA,CAAA,EAAgD;IAAA,IAA/CC,KAAwC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACvDD,KAAK,GAAGI,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,GAAG;MAACM,QAAQ,EAAEN;IAAK,CAAC,GAAGA,KAAK;IACxD,MAAM;MAACM,QAAQ,GAAG;IAAE,CAAC,GAAGN,KAAK;IAC7BJ,GAAG,CAACW,MAAM,CACRD,QAAQ,CAACE,KAAK,CAAEC,KAAK,IAAKA,KAAK,YAAYZ,cAAc,CAAC,EAC1D,gDACF,CAAC;I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AAC,EAAE;QACxB,IAAI,CAACY,GAAG,CAAC,GAAGZ,KAAK,CAAC;MACpB,CAAC,MAAM;QACL,IAAI,CAACH,QAAQ,CAACiC,IAAI,CAAC9B,KAAK,CAAC;MAC3B;IACF;IACA,OAAO,IAAI;EACb;EAEA+B,MAAMA,CAAC/B,KAAqB,EAAQ;IAClC,MAAMH,QAAQ,GAAG,IAAI,CAACA,QAAQ;IAC9B,MAAMmC,OAAO,GAAGnC,QAAQ,CAACmC,OAAO,CAAChC,KAAK,CAAC;IACvC,IAAIgC,OAAO,GAAG,CAAC,CAAC,EAAE;MAChBnC,QAAQ,CAACoC,MAAM,CAACD,OAAO,EAAE,CAAC,CAAC;IAC7B;IACA,OAAO,IAAI;EACb;EAEAL,SAASA,CAAA,EAAS;IAChB,IAAI,CAAC9B,QAAQ,GAAG,EAAE;IAClB,OAAO,IAAI;EACb;EAEAO,QAAQA,CAAC8B,OAAwE,EAAsC;IAAA,IAApC;MAAC3B,WAAW,GAAG,IAAItB,OAAO,CAAC;IAAC,CAAC,GAAAO,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACnH,MAAM2C,WAAW,GAAG,IAAIlD,OAAO,CAACsB,WAAW,CAAC,CAAC6B,aAAa,CAAC,IAAI,CAACC,MAAM,CAAC;IAEvE,KAAK,MAAMrC,KAAK,IAAI,IAAI,CAACH,QAAQ,EAAE;MACjC,IAAIG,KAAK,YAAYX,SAAS,EAAE;QAC9BW,KAAK,CAACI,QAAQ,CAAC8B,OAAO,EAAE;UAAC3B,WAAW,EAAE4B;QAAW,CAAC,CAAC;MACrD,CAAC,MAAM;QACLD,OAAO,CAAClC,KAAK,EAAE;UAACO,WAAW,EAAE4B;QAAW,CAAC,CAAC;MAC5C;IACF;EACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-node.js","names":["ScenegraphNode","ModelNode","constructor","props","model","bounds","managedResources","setProps","getBounds","destroy","forEach","resource","draw","renderPass"],"sources":["../../src/scenegraph/model-node.ts"],"sourcesContent":["import {RenderPass} from '@luma.gl/core';\nimport {ScenegraphNode, ScenegraphNodeProps} from './scenegraph-node';\nimport {Model} from '../model/model';\n\nexport type ModelNodeProps = ScenegraphNodeProps & {\n model: Model;\n managedResources?: any[];\n bounds?: [number[], number[]];\n}\n\nexport class ModelNode extends ScenegraphNode {\n readonly model: Model;\n bounds: [number[], number[]] | null = null;\n managedResources: any[];\n\n // TODO - is this used? override callbacks to make sure we call them with this\n // onBeforeRender = null;\n // onAfterRender = null;\n // AfterRender = null;\n\n constructor(props: ModelNodeProps) {\n super(props);\n\n // Create new Model or used supplied Model\n this.model = props.model;\n this.managedResources = props.managedResources || [];\n this.bounds = props.bounds || null;\n this.setProps(props);\n }\n\n override getBounds(): [number[], number[]] | null {\n return this.bounds;\n }\n\n override destroy(): void {\n if (this.model) {\n this.model.destroy();\n // @ts-expect-error\n this.model = null;\n }\n this.managedResources.forEach((resource) => resource.destroy());\n this.managedResources = [];\n }\n\n // Expose model methods\n draw(renderPass?: RenderPass) {\n // Return value indicates if something was actually drawn\n return this.model.draw(renderPass);\n }\n}\n"],"mappings":"SACQA,cAAc;AAStB,OAAO,MAAMC,SAAS,SAASD,cAAc,CAAC;EAU5CE,WAAWA,CAACC,KAAqB,EAAE;IACjC,KAAK,CAACA,KAAK,CAAC;IAAC,KAVNC,KAAK;IAAA,KACdC,MAAM,GAAgC,IAAI;IAAA,KAC1CC,gBAAgB;IAWd,IAAI,CAACF,KAAK,GAAGD,KAAK,CAACC,KAAK;IACxB,IAAI,CAACE,gBAAgB,GAAGH,KAAK,CAACG,gBAAgB,IAAI,EAAE;IACpD,IAAI,CAACD,MAAM,GAAGF,KAAK,CAACE,MAAM,IAAI,IAAI;IAClC,IAAI,CAACE,QAAQ,CAACJ,KAAK,CAAC;EACtB;EAESK,SAASA,CAAA,EAAgC;IAChD,OAAO,IAAI,CAACH,MAAM;EACpB;EAESI,OAAOA,CAAA,EAAS;IACvB,IAAI,IAAI,CAACL,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACK,OAAO,CAAC,CAAC;MAEpB,IAAI,CAACL,KAAK,GAAG,IAAI;IACnB;IACA,IAAI,CAACE,gBAAgB,CAACI,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAACF,OAAO,CAAC,CAAC,CAAC;IAC/D,IAAI,CAACH,gBAAgB,GAAG,EAAE;EAC5B;EAGAM,IAAIA,CAACC,UAAuB,EAAE;IAE5B,OAAO,IAAI,CAACT,KAAK,CAACQ,IAAI,CAACC,UAAU,CAAC;EACpC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"scenegraph-node.js","names":["assert","uid","Vector3","Matrix4","ScenegraphNode","constructor","props","arguments","length","undefined","id","matrix","display","position","rotation","scale","userData","name","_setScenegraphNodeProps","getBounds","destroy","delete","setProps","toString","setPosition","setRotation","setScale","setMatrix","copyMatrix","copy","setMatrixComponents","components","update","updateMatrix","pos","rot","identity","translate","rotateXYZ","options","getCoordinateUniforms","viewMatrix","modelMatrix","worldMatrix","multiplyRight","worldInverse","invert","worldInverseTranspose","transpose","objectMatrix","worldInverseMatrix","worldInverseTransposeMatrix","Object","assign"],"sources":["../../src/scenegraph/scenegraph-node.ts"],"sourcesContent":["import {assert, uid, NumberArray} from '@luma.gl/core';\nimport {Vector3, Matrix4} from '@math.gl/core';\n\n/** Properties for creating a new Scenegraph */\nexport type ScenegraphNodeProps = {\n id?: string;\n /** whether to display the object at all */\n display?: boolean;\n matrix?: NumberArray;\n position?: NumberArray;\n rotation?: NumberArray;\n scale?: NumberArray;\n update?: boolean\n};\n\nexport class ScenegraphNode {\n readonly id: string;\n matrix: Matrix4 = new Matrix4();\n\n display = true; \n position = new Vector3();\n rotation = new Vector3();\n scale = new Vector3(1, 1, 1);\n userData: Record<string, unknown> = {};\n\n props: ScenegraphNodeProps = {};\n\n constructor(props: ScenegraphNodeProps = {}) {\n const {id} = props;\n\n this.id = id || uid(this.constructor.name);\n\n this._setScenegraphNodeProps(props);\n }\n\n getBounds(): [number[], number[]] | null {\n return null;\n }\n\n destroy(): void {}\n\n /** @deprecated use .destroy() */\n delete(): void {\n this.destroy();\n }\n setProps(props: ScenegraphNodeProps): this {\n this._setScenegraphNodeProps(props);\n return this;\n }\n\n toString(): string {\n return `{type: ScenegraphNode, id: ${this.id})}`;\n }\n\n setPosition(position: any): this {\n assert(position.length === 3, 'setPosition requires vector argument');\n this.position = position;\n return this;\n }\n\n setRotation(rotation: any): this {\n assert(rotation.length === 3, 'setRotation requires vector argument');\n this.rotation = rotation;\n return this;\n }\n\n setScale(scale: any): this {\n assert(scale.length === 3, 'setScale requires vector argument');\n this.scale = scale;\n return this;\n }\n\n setMatrix(matrix: any, copyMatrix: boolean = true): void {\n if (copyMatrix) {\n this.matrix.copy(matrix);\n } else {\n this.matrix = matrix;\n }\n }\n\n setMatrixComponents(components: {\n position?: any;\n rotation?: any;\n scale?: any;\n update?: boolean;\n }): this {\n const {position, rotation, scale, update = true} = components;\n if (position) {\n this.setPosition(position);\n }\n if (rotation) {\n this.setRotation(rotation);\n }\n if (scale) {\n this.setScale(scale);\n }\n if (update) {\n this.updateMatrix();\n }\n return this;\n }\n\n updateMatrix(): this {\n const pos = this.position;\n const rot = this.rotation;\n const scale = this.scale;\n\n this.matrix.identity();\n this.matrix.translate(pos);\n this.matrix.rotateXYZ(rot);\n this.matrix.scale(scale);\n return this;\n }\n\n update(options: {position?: any; rotation?: any; scale?: any} = {}): this {\n const {position, rotation, scale} = options;\n if (position) {\n this.setPosition(position);\n }\n if (rotation) {\n this.setRotation(rotation);\n }\n if (scale) {\n this.setScale(scale);\n }\n this.updateMatrix();\n return this;\n }\n\n getCoordinateUniforms(\n viewMatrix: any,\n modelMatrix?: any\n ): {\n viewMatrix: any;\n modelMatrix: any;\n objectMatrix: any;\n worldMatrix: any;\n worldInverseMatrix: any;\n worldInverseTransposeMatrix: any;\n } {\n // TODO - solve multiple class problem\n // assert(viewMatrix instanceof Matrix4);\n assert(viewMatrix);\n modelMatrix = modelMatrix || this.matrix;\n const worldMatrix = new Matrix4(viewMatrix).multiplyRight(modelMatrix);\n const worldInverse = worldMatrix.invert();\n const worldInverseTranspose = worldInverse.transpose();\n\n return {\n viewMatrix,\n modelMatrix,\n objectMatrix: modelMatrix,\n worldMatrix,\n worldInverseMatrix: worldInverse,\n worldInverseTransposeMatrix: worldInverseTranspose\n };\n }\n\n // TODO - copied code, not yet vetted\n /*\n transform() {\n if (!this.parent) {\n this.endPosition.set(this.position);\n this.endRotation.set(this.rotation);\n this.endScale.set(this.scale);\n } else {\n const parent = this.parent;\n this.endPosition.set(this.position.add(parent.endPosition));\n this.endRotation.set(this.rotation.add(parent.endRotation));\n this.endScale.set(this.scale.add(parent.endScale));\n }\n\n const ch = this.children;\n for (let i = 0; i < ch.length; ++i) {\n ch[i].transform();\n }\n\n return this;\n }\n */\n\n _setScenegraphNodeProps(props: ScenegraphNodeProps): void {\n if ('display' in props) {\n this.display = props.display;\n }\n\n if ('position' in props) {\n this.setPosition(props.position);\n }\n if ('rotation' in props) {\n this.setRotation(props.rotation);\n }\n if ('scale' in props) {\n this.setScale(props.scale);\n }\n\n // Matrix overwrites other props\n if ('matrix' in props) {\n this.setMatrix(props.matrix);\n }\n\n Object.assign(this.props, props);\n }\n}\n"],"mappings":"AAAA,SAAQA,MAAM,EAAEC,GAAG,QAAoB,eAAe;AACtD,SAAQC,OAAO,EAAEC,OAAO,QAAO,eAAe;AAc9C,OAAO,MAAMC,cAAc,CAAC;EAY1BC,WAAWA,CAAA,EAAkC;IAAA,IAAjCC,KAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,KAXlCG,EAAE;IAAA,KACXC,MAAM,GAAY,IAAIR,OAAO,CAAC,CAAC;IAAA,KAE/BS,OAAO,GAAG,IAAI;IAAA,KACdC,QAAQ,GAAG,IAAIX,OAAO,C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,CAACQ,QAAQ,CAAC;IAClC;IACA,IAAI,OAAO,IAAIR,KAAK,EAAE;MACpB,IAAI,CAACoB,QAAQ,CAACpB,KAAK,CAACS,KAAK,CAAC;IAC5B;IAGA,IAAI,QAAQ,IAAIT,KAAK,EAAE;MACrB,IAAI,CAACqB,SAAS,CAACrB,KAAK,CAACK,MAAM,CAAC;IAC9B;IAEAyC,MAAM,CAACC,MAAM,CAAC,IAAI,CAAC/C,KAAK,EAAEA,KAAK,CAAC;EAClC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"shader-inputs.js","names":["log","_resolveModules","ShaderInputs","constructor","modules","moduleUniforms","moduleBindings","moduleUniformsChanged","allModules","Object","values","map","m","name","module","entries","moduleName","defaultUniforms","destroy","setProps","props","keys","_module$getUniforms","moduleProps","warn","oldUniforms","uniforms","getUniforms","call","getModules","getUniformValues","getBindings","bindings","assign","getDebugTable","table","key","value","_this$modules$moduleN","type","uniformTypes","String"],"sources":["../src/shader-inputs.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {UniformValue, Texture, Sampler} from '@luma.gl/core';\nimport {log} from '@luma.gl/core';\n// import type {ShaderUniformType, UniformValue, UniformFormat, UniformInfoDevice, Texture, Sampler} from '@luma.gl/core';\nimport {_resolveModules, ShaderModuleInstance} from '@luma.gl/shadertools'\n\n\n/** Minimal ShaderModule subset, we don't need shader code etc */\nexport type ShaderModuleInputs<\n PropsT extends Record<string, unknown> = Record<string, unknown>,\n UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>,\n BindingsT extends Record<string, Texture | Sampler> = Record<string, Texture | Sampler>\n> = {\n defaultUniforms?: UniformsT;\n getUniforms?: (settings: Partial<PropsT>, prevUniforms?: UniformsT) => UniformsT;\n\n /** Not used. Used to access props type */\n props?: PropsT;\n\n bindings?: Record<\n keyof BindingsT,\n {\n location: number;\n type: 'texture' | 'sampler' | 'uniforms';\n }\n >;\n\n uniformTypes?: any;\n};\n\n/**\n * ShaderInputs holds uniform and binding values for one or more shader modules,\n * - It can generate binary data for any uniform buffer\n * - It can manage a uniform buffer for each block\n * - It can update managed uniform buffers with a single call\n * - It performs some book keeping on what has changed to minimize unnecessary writes to uniform buffers.\n */\nexport class ShaderInputs<\n ShaderPropsT extends Partial<Record<string, Record<string, unknown>>> = Partial<\n Record<string, Record<string, unknown>>\n >\n> {\n /** \n * The map of modules \n * @todo should should this include the resolved dependencies?\n */\n modules: Readonly<{[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>}>;\n\n /** Stores the uniform values for each module */\n moduleUniforms: Record<keyof ShaderPropsT, Record<string, UniformValue>>;\n /** Stores the uniform bindings for each module */\n moduleBindings: Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;\n /** Tracks if uniforms have changed */\n moduleUniformsChanged: Record<keyof ShaderPropsT, false | string>;\n\n /**\n * Create a new UniformStore instance\n * @param modules\n */\n constructor(modules: {[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>}) {\n // TODO - get all dependencies from modules\n const allModules =_resolveModules(Object.values(modules));\n log.log(1, 'Creating ShaderInputs with modules', allModules.map(m => m.name))();\n\n // Store the module definitions and create storage for uniform values and binding values, per module\n this.modules = modules;\n this.moduleUniforms = {} as Record<keyof ShaderPropsT, Record<string, UniformValue>>;\n this.moduleBindings = {} as Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;\n\n // Initialize the modules\n for (const [name, module] of Object.entries(modules)) {\n const moduleName = name as keyof ShaderPropsT;\n\n // Get default uniforms from module\n this.moduleUniforms[moduleName] = module.defaultUniforms || {};\n this.moduleBindings[moduleName] = {};\n }\n }\n\n /** Destroy */\n destroy(): void {}\n\n /**\n * Set module props\n */\n setProps(props: Partial<{[P in keyof ShaderPropsT]?: Partial<ShaderPropsT[P]>}>): void {\n for (const name of Object.keys(props)) {\n const moduleName = name as keyof ShaderPropsT;\n const moduleProps = props[moduleName];\n const module = this.modules[moduleName];\n if (!module) {\n // Ignore props for unregistered modules\n log.warn(`Module ${name} not found`)();\n continue; // eslint-disable-line no-continue\n }\n\n const oldUniforms = this.moduleUniforms[moduleName]; \n const uniforms = module.getUniforms?.(moduleProps, this.moduleUniforms[moduleName]) || moduleProps as any;\n // console.error(uniforms)\n this.moduleUniforms[moduleName] = {...oldUniforms, ...uniforms};\n // this.moduleUniformsChanged ||= moduleName;\n\n // console.log(`setProps(${String(moduleName)}`, moduleName, this.moduleUniforms[moduleName])\n\n // TODO - Get Module bindings\n // const bindings = module.getBindings?.(moduleProps);\n // this.moduleUniforms[moduleName] = bindings;\n }\n }\n\n /** Merges all bindings for the shader (from the various modules) */\n // getUniformBlocks(): Record<string, Texture | Sampler> {\n // return this.moduleUniforms;\n // }\n\n /** \n * Return the map of modules \n * @todo should should this include the resolved dependencies?\n */\n getModules(): ShaderModuleInstance[] {\n return Object.values(this.modules);\n }\n\n /** Get all uniform values for all modules */\n getUniformValues(): Record<keyof ShaderPropsT, Record<string, UniformValue>> {\n return this.moduleUniforms;\n }\n\n /** Merges all bindings for the shader (from the various modules) */\n getBindings(): Record<string, Texture | Sampler> {\n const bindings = {} as Record<string, Texture | Sampler>;\n for (const moduleBindings of Object.values(this.moduleBindings)) {\n Object.assign(bindings, moduleBindings);\n }\n return bindings;\n }\n\n getDebugTable(): Record<string, Record<string, unknown>> {\n const table: Record<string,Record<string, unknown>> = {};\n for (const [moduleName, module] of Object.entries(this.moduleUniforms)) {\n for (const [key, value] of Object.entries(module)) {\n table[`${moduleName}.${key}`] = {\n type: this.modules[moduleName].uniformTypes?.[key],\n value: String(value)\n };\n }\n }\n return table;\n }\n}\n"],"mappings":"AAEA,SAAQA,GAAG,QAAO,eAAe;AAEjC,SAAQC,eAAe,QAA6B,sBAAsB;AAiC1E,OAAO,MAAMC,YAAY,CAIvB;EAkBAC,WAAWA,CAACC,OAAyE,EAAE;IAAA,KAbvFA,OAAO;IAAA,KAGPC,cAAc;IAAA,KAEdC,cAAc;IAAA,KAEdC,qBAAqB;IAQnB,MAAMC,UAA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":"buffer-transform.js","names":["Buffer","assert","getPassthroughFS","Model","BufferTransform","isSupported","device","features","has","constructor","props","arguments","length","undefined","defaultProps","model","transformFeedback","id","fs","version","topology","createTransformFeedback","layout","pipeline","shaderLayout","buffers","feedbackBuffers","setTransformFeedback","Object","seal","destroy","delete","run","options","renderPass","beginRenderPass","draw","end","update","console","warn","getBuffer","varyingName","readAsync","result","buffer","byteOffset","byteLength"],"sources":["../../src/transform/buffer-transform.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {Device, Buffer, BufferRange, TransformFeedback, assert, RenderPassProps} from '@luma.gl/core';\nimport {getPassthroughFS} from '@luma.gl/shadertools';\nimport {Model} from '../model/model';\nimport type { ModelProps } from '..';\n\n/**\n * Properties for creating a {@link BufferTransform}\n * @deprecated\n */\nexport type BufferTransformProps = Omit<ModelProps, 'fs'> & {\n fs?: ModelProps['fs']; // override as optional\n feedbackBuffers?: Record<string, Buffer | BufferRange>;\n};\n\n/**\n * Creates a pipeline for buffer→buffer transforms.\n * @deprecated\n */\nexport class BufferTransform {\n readonly device: Device;\n readonly model: Model;\n readonly transformFeedback: TransformFeedback;\n\n /** @deprecated Use device feature test. */\n static isSupported(device: Device): boolean {\n return device.features.has('transform-feedback-webgl2');\n }\n\n constructor(device: Device, props: BufferTransformProps = Model.defaultProps) {\n assert(device.features.has('transform-feedback-webgl2'), 'Device must support transform feedback');\n\n this.device = device;\n\n this.model = new Model(this.device, {\n id: props.id || 'buffer-transform-model',\n fs: props.fs || getPassthroughFS({version: 300}),\n topology: props.topology || 'point-list',\n ...props,\n });\n\n this.transformFeedback = this.device.createTransformFeedback({\n layout: this.model.pipeline.shaderLayout,\n buffers: props.feedbackBuffers,\n });\n\n this.model.setTransformFeedback(this.transformFeedback);\n\n Object.seal(this);\n }\n\n /** Destroy owned resources. */\n destroy(): void {\n if (this.model) {\n this.model.destroy();\n }\n }\n\n /** @deprecated Use {@link destroy}. */\n delete(): void {\n this.destroy();\n }\n\n /** Run one transform loop. */\n run(options?: RenderPassProps): void {\n const renderPass = this.device.beginRenderPass(options);\n this.model.draw(renderPass);\n renderPass.end();\n }\n\n /** @deprecated */\n update(...args: any[]): void {\n // TODO(v9): Method should likely be removed for v9. Keeping a method stub\n // to assist with migrating DeckGL usage.\n // eslint-disable-next-line no-console\n console.warn('TextureTransform#update() not implemented');\n }\n\n /** Returns the {@link Buffer} or {@link BufferRange} for given varying name. */\n getBuffer(varyingName: string): Buffer | BufferRange | null {\n return this.transformFeedback.getBuffer(varyingName);\n }\n\n readAsync(varyingName: string): Promise<Uint8Array> {\n const result = this.getBuffer(varyingName);\n if (result instanceof Buffer) {\n return result.readAsync();\n }\n const {buffer, byteOffset = 0, byteLength = buffer.byteLength} = result;\n return buffer.readAsync(byteOffset, byteLength);\n }\n}\n"],"mappings":"AAGA,SAAgBA,MAAM,EAAkCC,MAAM,QAAwB,eAAe;AACrG,SAAQC,gBAAgB,QAAO,sBAAsB;AAAC,SAC9CC,KAAK;AAgBb,OAAO,MAAMC,eAAe,CAAC;EAM3B,OAAOC,WAAWA,CAACC,MAAc,EAAW;IAC1C,OAAOA,MAAM,CAACC,QAAQ,CAACC,GAAG,CAAC,2BAA2B,CAAC;EACzD;EAEAC,WAAWA,CAACH,MAAc,EAAoD;IAAA,IAAlDI,KAA2B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGR,KAAK,CAACW,YAAY;IAAA,KATnER,MAAM;IAAA,KACNS,KAAK;IAAA,KACLC,iBAAiB;IAQxBf,MAAM,CAACK,MAAM,CAACC,QAAQ,CAACC,GAAG,CAAC,2BAA2B,CAAC,EAAE,wCAAwC,CAAC;IAElG,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACS,KAAK,GAAG,IAAIZ,KAAK,CAAC,IAAI,CAACG,MAAM,EAAE;MAClCW,EAAE,EAAEP,KAAK,CAACO,EAAE,IAAI,wBAAwB;MACx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,CAACD,SAAS,CAAC,CAAC;IAC3B;IACA,MAAM;MAACE,MAAM;MAAEC,UAAU,GAAG,CAAC;MAAEC,UAAU,GAAGF,MAAM,CAACE;IAAU,CAAC,GAAGH,MAAM;IACvE,OAAOC,MAAM,CAACF,SAAS,CAACG,UAAU,EAAEC,UAAU,CAAC;EACjD;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"texture-transform.js","names":["Model","getPassthroughFS","FS_OUTPUT_VARIABLE","TextureTransform","constructor","device","props","model","sampler","currentIndex","samplerTextureMap","bindings","resources","createSampler","addressModeU","addressModeV","minFilter","magFilter","mipmapFilter","id","fs","version","input","targetTextureVarying","inputChannels","targetTextureChannels","output","vertexCount","_initialize","Object","seal","destroy","delete","run","options","framebuffer","renderPass","beginRenderPass","draw","end","update","console","warn","getData","packed","arguments","length","undefined","Error","getTargetTexture","targetTexture","getFramebuffer","currentResources","_updateBindings","_updateBinding","binding","_ref","sourceBuffers","sourceTextures","assign","width","height","createFramebuffer","colorAttachments","resize","_setSourceTextureParameters","index","name"],"sources":["../../src/transform/texture-transform.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport { Buffer, Device, Framebuffer, RenderPassProps, Sampler, Texture } from '@luma.gl/core';\nimport { Model, ModelProps } from '../model/model';\nimport { getPassthroughFS } from '@luma.gl/shadertools';\n\n/**\n * Properties for creating a {@link TextureTransform}\n * @deprecated\n */\nexport type TextureTransformProps = Omit<ModelProps, 'fs'> & {\n fs?: ModelProps['fs']; // override as optional\n /** @deprecated TODO(donmccurdy): Needed? */\n inject?: Record<string, string>;\n /** @deprecated TODO(donmccurdy): Needed? */\n framebuffer?: Framebuffer;\n /** @deprecated TODO(donmccurdy): Model already handles this? */\n sourceBuffers?: Record<string, Buffer>;\n /** @deprecated TODO(donmccurdy): Model already handles this? */\n sourceTextures?: Record<string, Texture>;\n targetTexture: Texture;\n targetTextureChannels: 1 | 2 | 3 | 4;\n targetTextureVarying: string;\n};\n\n\ntype TextureBinding = {\n sourceBuffers: Record<string, Buffer>;\n sourceTextures: Record<string, Texture>;\n targetTexture: Texture;\n framebuffer?: Framebuffer;\n};\n\nconst FS_OUTPUT_VARIABLE = 'transform_output';\n\n/**\n * Creates a pipeline for texture→texture transforms.\n * @deprecated\n */\nexport class TextureTransform {\n readonly device: Device;\n readonly model: Model;\n readonly sampler: Sampler;\n \n currentIndex = 0;\n samplerTextureMap: Record<string, any> | null = null;\n bindings: TextureBinding[] = []; // each element is an object : {sourceTextures, targetTexture, framebuffer}\n resources: Record<string, any> = {}; // resources to be deleted\n\n constructor(device: Device, props: TextureTransformProps) {\n this.device = device;\n\n // For precise picking of element IDs.\n this.sampler = device.createSampler({\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge',\n minFilter: 'nearest',\n magFilter: 'nearest',\n mipmapFilter: 'nearest',\n });\n\n this.model = new Model(this.device, {\n id: props.id || 'texture-transform-model',\n fs: props.fs || getPassthroughFS({\n version: 300,\n input: props.targetTextureVarying,\n inputChannels: props.targetTextureChannels,\n output: FS_OUTPUT_VARIABLE\n }),\n vertexCount: props.vertexCount, // TODO(donmccurdy): Naming?\n ...props\n });\n\n this._initialize(props);\n Object.seal(this);\n }\n\n // Delete owned resources.\n destroy(): void {}\n\n /** @deprecated Use {@link destroy}. */\n delete(): void {\n this.destroy();\n }\n\n run(options?: RenderPassProps): void {\n const {framebuffer} = this.bindings[this.currentIndex];\n const renderPass = this.device.beginRenderPass({framebuffer, ...options});\n this.model.draw(renderPass);\n renderPass.end();\n }\n\n /** @deprecated */\n update(...args: any[]): void {\n // TODO(v9): Method should likely be removed for v9. Keeping a method stub\n // to assist with migrating DeckGL usage.\n // eslint-disable-next-line no-console\n console.warn('TextureTransform#update() not implemented');\n }\n\n\n getData({packed = false} = {}) {\n // TODO(v9): Method should likely be removed for v9. Keeping a method stub\n // to assist with migrating DeckGL usage.\n throw new Error('getData() not implemented');\n }\n\n getTargetTexture(): Texture {\n const {targetTexture} = this.bindings[this.currentIndex];\n return targetTexture;\n }\n\n\n getFramebuffer(): Framebuffer {\n const currentResources = this.bindings[this.currentIndex];\n return currentResources.framebuffer;\n }\n\n // Private\n\n _initialize(props: TextureTransformProps): void {\n this._updateBindings(props);\n }\n\n _updateBindings(props: TextureTransformProps) {\n this.bindings[this.currentIndex] = this._updateBinding(this.bindings[this.currentIndex], props);\n }\n\n _updateBinding(\n binding: TextureBinding,\n {sourceBuffers, sourceTextures, targetTexture}: TextureTransformProps\n ): TextureBinding {\n if (!binding) {\n binding = {\n sourceBuffers: {},\n sourceTextures: {},\n targetTexture: null\n };\n }\n Object.assign(binding.sourceTextures, sourceTextures);\n Object.assign(binding.sourceBuffers, sourceBuffers);\n if (targetTexture) {\n binding.targetTexture = targetTexture;\n const {width, height} = targetTexture;\n // TODO(donmccurdy): When is this called, and is this expected?\n if (binding.framebuffer) {\n binding.framebuffer.destroy();\n }\n binding.framebuffer = this.device.createFramebuffer({\n id: 'transform-framebuffer',\n width,\n height,\n colorAttachments: [targetTexture]\n });\n binding.framebuffer.resize({width, height});\n }\n return binding;\n }\n\n // set texture filtering parameters on source textures.\n _setSourceTextureParameters(): void {\n const index = this.currentIndex;\n const {sourceTextures} = this.bindings[index];\n for (const name in sourceTextures) {\n sourceTextures[name].sampler = this.sampler;\n }\n }\n}\n"],"mappings":"SAISA,KAAK;AACd,SAASC,gBAAgB,QAAQ,sBAAsB;AA6BvD,MAAMC,kBAAkB,GAAG,kBAAkB;AAM7C,OAAO,MAAMC,gBAAgB,CAAC;EAU5BC,WAAWA,CAACC,MAAc,EAAEC,KAA4B,EAAE;IAAA,KATjDD,MAAM;IAAA,KACNE,KAAK;IAAA,KACLC,OAAO;IAAA,KAEhBC,YAAY,GAAG,CAAC;IAAA,KAChBC,iBAAiB,GAA+B,IAAI;IAAA,KACpDC,QAAQ,GAAqB,EAAE;IAAA,KAC/BC,SAAS,GAAwB,CAAC,CAAC;IAGjC,IAAI,CAACP,MAAM,GAAGA,MAAM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