@luma.gl/engine 9.0.0-alpha.25 → 9.0.0-alpha.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -1369,9 +1369,9 @@ var __exports__ = (() => {
1369
1369
  };
1370
1370
  if ((props.usage || 0) & Buffer2.INDEX && !props.indexType) {
1371
1371
  if (props.data instanceof Uint32Array) {
1372
- props.indexType = "uint32";
1372
+ newProps.indexType = "uint32";
1373
1373
  } else if (props.data instanceof Uint16Array) {
1374
- props.indexType = "uint16";
1374
+ newProps.indexType = "uint16";
1375
1375
  }
1376
1376
  }
1377
1377
  return newProps;
@@ -1581,7 +1581,7 @@ var __exports__ = (() => {
1581
1581
  * Use devicePixelRatio to set canvas width and height
1582
1582
  * @note this is a raw port of luma.gl v8 code. Might be worth a review
1583
1583
  */
1584
- setDevicePixelRatio(devicePixelRatio2, options = {}) {
1584
+ setDevicePixelRatio(devicePixelRatio, options = {}) {
1585
1585
  if (!this.htmlCanvas) {
1586
1586
  return;
1587
1587
  }
@@ -1589,13 +1589,13 @@ var __exports__ = (() => {
1589
1589
  let clientHeight = "height" in options ? options.height : this.htmlCanvas.clientHeight;
1590
1590
  if (!clientWidth || !clientHeight) {
1591
1591
  log.log(1, "Canvas clientWidth/clientHeight is 0")();
1592
- devicePixelRatio2 = 1;
1592
+ devicePixelRatio = 1;
1593
1593
  clientWidth = this.htmlCanvas.width || 1;
1594
1594
  clientHeight = this.htmlCanvas.height || 1;
1595
1595
  }
1596
1596
  const cachedSize = this._canvasSizeInfo;
1597
- if (cachedSize.clientWidth !== clientWidth || cachedSize.clientHeight !== clientHeight || cachedSize.devicePixelRatio !== devicePixelRatio2) {
1598
- let clampedPixelRatio = devicePixelRatio2;
1597
+ if (cachedSize.clientWidth !== clientWidth || cachedSize.clientHeight !== clientHeight || cachedSize.devicePixelRatio !== devicePixelRatio) {
1598
+ let clampedPixelRatio = devicePixelRatio;
1599
1599
  const canvasWidth = Math.floor(clientWidth * clampedPixelRatio);
1600
1600
  const canvasHeight = Math.floor(clientHeight * clampedPixelRatio);
1601
1601
  this.htmlCanvas.width = canvasWidth;
@@ -1609,7 +1609,7 @@ var __exports__ = (() => {
1609
1609
  }
1610
1610
  this._canvasSizeInfo.clientWidth = clientWidth;
1611
1611
  this._canvasSizeInfo.clientHeight = clientHeight;
1612
- this._canvasSizeInfo.devicePixelRatio = devicePixelRatio2;
1612
+ this._canvasSizeInfo.devicePixelRatio = devicePixelRatio;
1613
1613
  }
1614
1614
  }
1615
1615
  // PRIVATE
@@ -2042,7 +2042,11 @@ var __exports__ = (() => {
2042
2042
  constructor(device, props) {
2043
2043
  super(device, props, _RenderPass.defaultProps);
2044
2044
  }
2045
- /** A small set of parameters can be changed between every draw call (viewport, scissorRect, blendColor, stencilReference) */
2045
+ /** Call when rendering is done in this pass. */
2046
+ /**
2047
+ * A small set of parameters can be changed between every draw call
2048
+ * (viewport, scissorRect, blendColor, stencilReference)
2049
+ */
2046
2050
  // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;
2047
2051
  // beginOcclusionQuery(queryIndex: number): void;
2048
2052
  // endOcclusionQuery(): void;
@@ -5830,6 +5834,7 @@ void main() {
5830
5834
  };
5831
5835
  var Model = class {
5832
5836
  fs = null;
5837
+ userData = {};
5833
5838
  constructor(device, props) {
5834
5839
  this.props = {
5835
5840
  ...DEFAULT_MODEL_PROPS,
@@ -5838,6 +5843,7 @@ void main() {
5838
5843
  props = this.props;
5839
5844
  this.id = this.props.id;
5840
5845
  this.device = device;
5846
+ Object.assign(this.userData, this.props.userData);
5841
5847
  if (!props.vs) {
5842
5848
  throw new Error("no vertex shader");
5843
5849
  }
@@ -5911,6 +5917,14 @@ void main() {
5911
5917
  return this;
5912
5918
  }
5913
5919
  setAttributes(attributes) {
5920
+ if (attributes.indices) {
5921
+ this.setIndexBuffer(attributes.indices);
5922
+ attributes = {
5923
+ ...attributes
5924
+ };
5925
+ delete attributes.indices;
5926
+ console.warn("luma.gl: indices should not be part of attributes");
5927
+ }
5914
5928
  this.pipeline.setAttributes(attributes);
5915
5929
  Object.assign(this.props.attributes, attributes);
5916
5930
  return this;
@@ -10981,6 +10995,7 @@ void main(void) {}`;
10981
10995
  */
10982
10996
  resize(options) {
10983
10997
  if (this.canvas) {
10998
+ const devicePixelRatio = this.getDevicePixelRatio(options?.useDevicePixels);
10984
10999
  this.setDevicePixelRatio(devicePixelRatio, options);
10985
11000
  return;
10986
11001
  }
package/dist/index.cjs CHANGED
@@ -862,10 +862,12 @@ var DEFAULT_MODEL_PROPS = __spreadProps(__spreadValues({}, import_api5.RenderPip
862
862
  var Model = class {
863
863
  constructor(device, props) {
864
864
  this.fs = null;
865
+ this.userData = {};
865
866
  this.props = __spreadValues(__spreadValues({}, DEFAULT_MODEL_PROPS), props);
866
867
  props = this.props;
867
868
  this.id = this.props.id;
868
869
  this.device = device;
870
+ Object.assign(this.userData, this.props.userData);
869
871
  if (!props.vs) {
870
872
  throw new Error("no vertex shader");
871
873
  }
@@ -935,6 +937,12 @@ var Model = class {
935
937
  return this;
936
938
  }
937
939
  setAttributes(attributes) {
940
+ if (attributes.indices) {
941
+ this.setIndexBuffer(attributes.indices);
942
+ attributes = __spreadValues({}, attributes);
943
+ delete attributes.indices;
944
+ console.warn("luma.gl: indices should not be part of attributes");
945
+ }
938
946
  this.pipeline.setAttributes(attributes);
939
947
  Object.assign(this.props.attributes, attributes);
940
948
  return this;
@@ -27,6 +27,9 @@ export declare class Model {
27
27
  readonly fs: string | null;
28
28
  readonly topology: PrimitiveTopology;
29
29
  readonly vertexCount: number;
30
+ userData: {
31
+ [key: string]: any;
32
+ };
30
33
  readonly pipelineFactory: PipelineFactory;
31
34
  pipeline: RenderPipeline;
32
35
  props: Required<ModelProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE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,kBAAkB,CAAuE;gBAErF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU;IA8C7C,OAAO,IAAI,IAAI;IAIf,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IASlC,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAmBjC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMtD,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMrC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAavD,uBAAuB;IACvB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMpD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMhD,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAWvC"}
@@ -23,6 +23,7 @@ export class Model {
23
23
  _defineProperty(this, "fs", null);
24
24
  _defineProperty(this, "topology", void 0);
25
25
  _defineProperty(this, "vertexCount", void 0);
26
+ _defineProperty(this, "userData", {});
26
27
  _defineProperty(this, "pipelineFactory", void 0);
27
28
  _defineProperty(this, "pipeline", void 0);
28
29
  _defineProperty(this, "props", void 0);
@@ -34,6 +35,7 @@ export class Model {
34
35
  props = this.props;
35
36
  this.id = this.props.id;
36
37
  this.device = device;
38
+ Object.assign(this.userData, this.props.userData);
37
39
  if (!props.vs) {
38
40
  throw new Error('no vertex shader');
39
41
  }
@@ -107,6 +109,14 @@ export class Model {
107
109
  return this;
108
110
  }
109
111
  setAttributes(attributes) {
112
+ if (attributes.indices) {
113
+ this.setIndexBuffer(attributes.indices);
114
+ attributes = {
115
+ ...attributes
116
+ };
117
+ delete attributes.indices;
118
+ console.warn('luma.gl: indices should not be part of attributes');
119
+ }
110
120
  this.pipeline.setAttributes(attributes);
111
121
  Object.assign(this.props.attributes, attributes);
112
122
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","names":["RenderPipeline","getAttributeBuffersFromGeometry","getIndexBufferFromGeometry","PipelineFactory","DEFAULT_MODEL_PROPS","_DEFAULT_PROPS","vs","fs","id","handle","undefined","userData","defines","modules","moduleSettings","geometry","pipelineFactory","Model","constructor","device","props","_defineProperty","Error","getShaderSource","vertexCount","topology","getDefaultPipelineFactory","pipeline","getUniforms","createRenderPipeline","parameters","layout","_getModuleUniforms","_setGeometry","setUniforms","setProps","destroy","release","draw","renderPass","instanceCount","indices","setIndexBuffer","attributes","setAttributes","bindings","setBindings","uniforms","updateModuleSettings","Object","assign","geometryBuffers","indexBuffer","shader","info","type","wgsl","glsl"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, Buffer, RenderPipelineProps, RenderPass, Binding, PrimitiveTopology} from '@luma.gl/api';\nimport {RenderPipeline} from '@luma.gl/api';\nimport type { ShaderModule } from '@luma.gl/shadertools';\nimport type {Geometry} from '../geometry/geometry';\nimport {getAttributeBuffersFromGeometry, getIndexBufferFromGeometry} from './model-utils';\nimport {PipelineFactory} from '../lib/pipeline-factory';\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string\n vs?: {glsl?: string; wgsl?: string} | string | null;\n fs?: {glsl?: string; wgsl?: string} | string | null;\n defines?: Record<string, string | number | boolean>;\n modules?: ShaderModule[];\n moduleSettings?: Record<string, Record<string, any>>;\n geometry?: Geometry | null;\n /** deprecated pipeline factory to use to create renderpipelines */\n pipelineFactory?: PipelineFactory;\n};\n\nconst DEFAULT_MODEL_PROPS: Required<ModelProps> = {\n ...RenderPipeline._DEFAULT_PROPS,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: {},\n geometry: null,\n pipelineFactory: undefined\n};\n\n/** v9 API */\nexport class Model {\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string | null = null;\n readonly topology: PrimitiveTopology;\n readonly vertexCount;\n\n readonly pipelineFactory: PipelineFactory;\n pipeline: RenderPipeline;\n\n props: Required<ModelProps>;\n\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...DEFAULT_MODEL_PROPS, ...props};\n props = this.props;\n this.id = this.props.id;\n this.device = device;\n\n // Create the pipeline\n if (!props.vs) {\n throw new Error('no vertex shader');\n }\n this.vs = getShaderSource(this.device, props.vs);\n if (props.fs) {\n this.fs = getShaderSource(this.device, props.fs);\n }\n\n this.vertexCount = this.props.vertexCount;\n this.topology = this.props.topology;\n\n if (this.props.geometry) {\n this.vertexCount = this.props.geometry.vertexCount;\n this.topology = this.props.geometry.topology || 'triangle-list';\n }\n\n this.pipelineFactory = this.props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n const {pipeline, getUniforms} = this.pipelineFactory.createRenderPipeline({\n ...this.props,\n vs: this.vs,\n fs: this.fs,\n topology: this.topology,\n defines: props.defines,\n parameters: props.parameters,\n layout: props.layout\n });\n\n this.pipeline = pipeline;\n this._getModuleUniforms = getUniforms;\n\n if (this.props.geometry) {\n this._setGeometry(this.props.geometry);\n }\n this.setUniforms(this._getModuleUniforms()) // Get all default module uniforms\n this.setProps(this.props);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n }\n\n draw(renderPass: RenderPass): this {\n this.pipeline.draw({\n renderPass,\n vertexCount: this.vertexCount,\n instanceCount: this.props.instanceCount\n });\n return this;\n }\n\n setProps(props: ModelProps): this {\n if (props.indices) {\n this.setIndexBuffer(props.indices);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\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 this.updateModuleSettings(props.moduleSettings);\n }\n return this;\n }\n\n updateModuleSettings(props: Record<string, any>): this {\n const uniforms = this._getModuleUniforms(props);\n this.setUniforms(uniforms);\n return this;\n }\n\n setIndexBuffer(indices: Buffer): this {\n this.pipeline.setIndexBuffer(indices);\n // this._indices = indices;\n return this;\n }\n\n setAttributes(attributes: Record<string, Buffer>): this {\n this.pipeline.setAttributes(attributes);\n Object.assign(this.props.attributes, attributes);\n return this;\n }\n\n /** Set the bindings */\n setBindings(bindings: Record<string, Binding>): this {\n this.pipeline.setBindings(bindings);\n Object.assign(this.props.bindings, bindings);\n return this;\n }\n\n setUniforms(uniforms: Record<string, any>): this {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.props.uniforms, uniforms);\n return this;\n }\n\n _setGeometry(geometry: Geometry): void {\n // this._deleteGeometryBuffers();\n\n const geometryBuffers = getAttributeBuffersFromGeometry(this.device, geometry);\n this.setAttributes(geometryBuffers);\n\n const indexBuffer = getIndexBufferFromGeometry(this.device, geometry);\n if (indexBuffer) {\n this.setIndexBuffer(indexBuffer);\n }\n }\n}\n\n/** Create a shader from the different overloads */\nfunction getShaderSource(device: Device, shader: string | {glsl?: string; wgsl?: string}): string {\n // TODO - detect WGSL/GLSL and throw an error if not supported\n if (typeof shader === 'string') {\n return shader;\n }\n\n switch (device.info.type) {\n case 'webgpu':\n if (shader?.wgsl) {\n return shader.wgsl;\n }\n throw new Error('WebGPU does not support GLSL shaders');\n\n default:\n if (shader?.glsl) {\n return shader.glsl;\n }\n throw new Error('WebGL does not support WGSL shaders');\n }\n}\n"],"mappings":";AAGA,SAAQA,cAAc,QAAO,cAAc;AAAC,SAGpCC,+BAA+B,EAAEC,0BAA0B;AAAA,SAC3DC,eAAe;AAcvB,MAAMC,mBAAyC,GAAG;EAChD,GAAGJ,cAAc,CAACK,cAAc;EAChCC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAEC,SAAS;EACjBC,QAAQ,EAAE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AACa,QAA6B,EAAQ;IAC/C,IAAI,CAACpB,QAAQ,CAACO,WAAW,CAACa,QAAQ,CAAC;IACnCE,MAAM,CAACC,MAAM,CAAC,IAAI,CAAC9B,KAAK,CAAC2B,QAAQ,EAAEA,QAAQ,CAAC;IAC5C,OAAO,IAAI;EACb;EAEAd,YAAYA,CAAClB,QAAkB,EAAQ;IAGrC,MAAMoC,eAAe,GAAGlD,+BAA+B,CAAC,IAAI,CAACkB,MAAM,EAAEJ,QAAQ,CAAC;IAC9E,IAAI,CAAC6B,aAAa,CAACO,eAAe,CAAC;IAEnC,MAAMC,WAAW,GAAGlD,0BAA0B,CAAC,IAAI,CAACiB,MAAM,EAAEJ,QAAQ,CAAC;IACrE,IAAIqC,WAAW,EAAE;MACf,IAAI,CAACV,cAAc,CAACU,WAAW,CAAC;IAClC;EACF;AACF;AAGA,SAAS7B,eAAeA,CAACJ,MAAc,EAAEkC,MAA+C,EAAU;EAEhG,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EAEA,QAAQlC,MAAM,CAACmC,IAAI,CAACC,IAAI;IACtB,KAAK,QAAQ;MACX,IAAIF,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEG,IAAI,EAAE;QAChB,OAAOH,MAAM,CAACG,IAAI;MACpB;MACA,MAAM,IAAIlC,KAAK,CAAC,sCAAsC,CAAC;IAEzD;MACE,IAAI+B,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEI,IAAI,EAAE;QAChB,OAAOJ,MAAM,CAACI,IAAI;MACpB;MACA,MAAM,IAAInC,KAAK,CAAC,qCAAqC,CAAC;EAC1D;AACF"}
1
+ {"version":3,"file":"model.js","names":["RenderPipeline","getAttributeBuffersFromGeometry","getIndexBufferFromGeometry","PipelineFactory","DEFAULT_MODEL_PROPS","_DEFAULT_PROPS","vs","fs","id","handle","undefined","userData","defines","modules","moduleSettings","geometry","pipelineFactory","Model","constructor","device","props","_defineProperty","Object","assign","Error","getShaderSource","vertexCount","topology","getDefaultPipelineFactory","pipeline","getUniforms","createRenderPipeline","parameters","layout","_getModuleUniforms","_setGeometry","setUniforms","setProps","destroy","release","draw","renderPass","instanceCount","indices","setIndexBuffer","attributes","setAttributes","bindings","setBindings","uniforms","updateModuleSettings","console","warn","geometryBuffers","indexBuffer","shader","info","type","wgsl","glsl"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, Buffer, RenderPipelineProps, RenderPass, Binding, PrimitiveTopology} from '@luma.gl/api';\nimport {RenderPipeline} from '@luma.gl/api';\nimport type { ShaderModule } from '@luma.gl/shadertools';\nimport type {Geometry} from '../geometry/geometry';\nimport {getAttributeBuffersFromGeometry, getIndexBufferFromGeometry} from './model-utils';\nimport {PipelineFactory} from '../lib/pipeline-factory';\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string\n vs?: {glsl?: string; wgsl?: string} | string | null;\n fs?: {glsl?: string; wgsl?: string} | string | null;\n defines?: Record<string, string | number | boolean>;\n modules?: ShaderModule[];\n moduleSettings?: Record<string, Record<string, any>>;\n geometry?: Geometry | null;\n /** deprecated pipeline factory to use to create renderpipelines */\n pipelineFactory?: PipelineFactory;\n};\n\nconst DEFAULT_MODEL_PROPS: Required<ModelProps> = {\n ...RenderPipeline._DEFAULT_PROPS,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: {},\n geometry: null,\n pipelineFactory: undefined\n};\n\n/** v9 API */\nexport class Model {\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string | null = null;\n readonly topology: PrimitiveTopology;\n readonly vertexCount;\n userData: {[key: string]: any} = {};\n\n readonly pipelineFactory: PipelineFactory;\n pipeline: RenderPipeline;\n\n props: Required<ModelProps>;\n\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...DEFAULT_MODEL_PROPS, ...props};\n props = this.props;\n this.id = this.props.id;\n this.device = device;\n\n Object.assign(this.userData, this.props.userData);\n \n // Create the pipeline\n if (!props.vs) {\n throw new Error('no vertex shader');\n }\n this.vs = getShaderSource(this.device, props.vs);\n if (props.fs) {\n this.fs = getShaderSource(this.device, props.fs);\n }\n\n this.vertexCount = this.props.vertexCount;\n this.topology = this.props.topology;\n\n if (this.props.geometry) {\n this.vertexCount = this.props.geometry.vertexCount;\n this.topology = this.props.geometry.topology || 'triangle-list';\n }\n\n this.pipelineFactory = this.props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n const {pipeline, getUniforms} = this.pipelineFactory.createRenderPipeline({\n ...this.props,\n vs: this.vs,\n fs: this.fs,\n topology: this.topology,\n defines: props.defines,\n parameters: props.parameters,\n layout: props.layout\n });\n\n this.pipeline = pipeline;\n this._getModuleUniforms = getUniforms;\n\n if (this.props.geometry) {\n this._setGeometry(this.props.geometry);\n }\n this.setUniforms(this._getModuleUniforms()) // Get all default module uniforms\n this.setProps(this.props);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n }\n\n draw(renderPass: RenderPass): this {\n this.pipeline.draw({\n renderPass,\n vertexCount: this.vertexCount,\n instanceCount: this.props.instanceCount\n });\n return this;\n }\n\n setProps(props: ModelProps): this {\n if (props.indices) {\n this.setIndexBuffer(props.indices);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\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 this.updateModuleSettings(props.moduleSettings);\n }\n return this;\n }\n\n updateModuleSettings(props: Record<string, any>): this {\n const uniforms = this._getModuleUniforms(props);\n this.setUniforms(uniforms);\n return this;\n }\n\n setIndexBuffer(indices: Buffer): this {\n this.pipeline.setIndexBuffer(indices);\n // this._indices = indices;\n return this;\n }\n\n setAttributes(attributes: Record<string, Buffer>): this {\n // Temporary HACK since deck.gl v9 sets indices as part of attributes\n if (attributes.indices) {\n this.setIndexBuffer(attributes.indices);\n attributes = {...attributes};\n delete attributes.indices;\n console.warn('luma.gl: indices should not be part of attributes')\n }\n this.pipeline.setAttributes(attributes);\n Object.assign(this.props.attributes, attributes);\n return this;\n }\n\n /** Set the bindings */\n setBindings(bindings: Record<string, Binding>): this {\n this.pipeline.setBindings(bindings);\n Object.assign(this.props.bindings, bindings);\n return this;\n }\n\n setUniforms(uniforms: Record<string, any>): this {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.props.uniforms, uniforms);\n return this;\n }\n\n _setGeometry(geometry: Geometry): void {\n // this._deleteGeometryBuffers();\n\n const geometryBuffers = getAttributeBuffersFromGeometry(this.device, geometry);\n this.setAttributes(geometryBuffers);\n\n const indexBuffer = getIndexBufferFromGeometry(this.device, geometry);\n if (indexBuffer) {\n this.setIndexBuffer(indexBuffer);\n }\n }\n}\n\n/** Create a shader from the different overloads */\nfunction getShaderSource(device: Device, shader: string | {glsl?: string; wgsl?: string}): string {\n // TODO - detect WGSL/GLSL and throw an error if not supported\n if (typeof shader === 'string') {\n return shader;\n }\n\n switch (device.info.type) {\n case 'webgpu':\n if (shader?.wgsl) {\n return shader.wgsl;\n }\n throw new Error('WebGPU does not support GLSL shaders');\n\n default:\n if (shader?.glsl) {\n return shader.glsl;\n }\n throw new Error('WebGL does not support WGSL shaders');\n }\n}\n"],"mappings":";AAGA,SAAQA,cAAc,QAAO,cAAc;AAAC,SAGpCC,+BAA+B,EAAEC,0BAA0B;AAAA,SAC3DC,eAAe;AAcvB,MAAMC,mBAAyC,GAAG;EAChD,GAAGJ,cAAc,CAACK,cAAc;EAChCC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAEC,SAAS;EACjBC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,CAAC,CAAC;EACXC,OAAO,EAAE,EAAE;EACXC,cAAc,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