@luma.gl/engine 9.0.0-alpha.26 → 9.0.0-alpha.27
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 +238 -37
- package/dist/index.cjs +64 -38
- package/dist/model/model.d.ts +8 -2
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +41 -10
- package/dist/model/model.js.map +1 -1
- package/dist.min.js +69 -69
- package/package.json +6 -6
- package/src/model/model.ts +73 -14
package/dist/model/model.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Device, Buffer, RenderPipelineProps, RenderPass, Binding, PrimitiveTopology } from '@luma.gl/api';
|
|
2
2
|
import { RenderPipeline } from '@luma.gl/api';
|
|
3
3
|
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
4
4
|
import type { Geometry } from '../geometry/geometry';
|
|
5
5
|
import { PipelineFactory } from '../lib/pipeline-factory';
|
|
6
|
+
import { TypedArray } from '@math.gl/core';
|
|
6
7
|
export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
7
8
|
vs?: {
|
|
8
9
|
glsl?: string;
|
|
@@ -40,7 +41,12 @@ export declare class Model {
|
|
|
40
41
|
setProps(props: ModelProps): this;
|
|
41
42
|
updateModuleSettings(props: Record<string, any>): this;
|
|
42
43
|
setIndexBuffer(indices: Buffer): this;
|
|
43
|
-
|
|
44
|
+
_splitAttributes(attributes: Record<string, Buffer | TypedArray>, filterBuffers?: boolean): {
|
|
45
|
+
bufferAttributes: Record<string, Buffer>;
|
|
46
|
+
constantAttributes: Record<string, TypedArray>;
|
|
47
|
+
indices?: Buffer;
|
|
48
|
+
};
|
|
49
|
+
setAttributes(attributes: Record<string, Buffer | TypedArray>, filterBuffers?: boolean): void;
|
|
44
50
|
/** Set the bindings */
|
|
45
51
|
setBindings(bindings: Record<string, Binding>): this;
|
|
46
52
|
setUniforms(uniforms: Record<string, any>): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,OAAO,EACP,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG;IAEhE,EAAE,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACpD,EAAE,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,mEAAmE;IACnE,eAAe,CAAC,EAAE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,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,IAAI;IAgB7F,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"}
|
package/dist/model/model.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { Buffer } from '@luma.gl/api';
|
|
2
3
|
import { RenderPipeline } from '@luma.gl/api';
|
|
3
4
|
import { getAttributeBuffersFromGeometry, getIndexBufferFromGeometry } from "./model-utils.js";
|
|
4
5
|
import { PipelineFactory } from "../lib/pipeline-factory.js";
|
|
@@ -108,18 +109,48 @@ export class Model {
|
|
|
108
109
|
this.pipeline.setIndexBuffer(indices);
|
|
109
110
|
return this;
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
_splitAttributes(attributes, filterBuffers) {
|
|
113
|
+
const bufferAttributes = {};
|
|
114
|
+
const constantAttributes = {};
|
|
115
|
+
const indices = attributes.indices;
|
|
116
|
+
delete attributes.indices;
|
|
117
|
+
for (const name in attributes) {
|
|
118
|
+
let attribute = attributes[name];
|
|
119
|
+
if (attribute instanceof Buffer) {
|
|
120
|
+
bufferAttributes[name] = attribute;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (attribute.getValue) {
|
|
124
|
+
attribute = attribute.getValue();
|
|
125
|
+
console.warn("attribute ".concat(name, ": getValue() will be removed"));
|
|
126
|
+
}
|
|
127
|
+
if (ArrayBuffer.isView(attribute) && !attribute) {
|
|
128
|
+
constantAttributes[name] = attribute;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (filterBuffers && attribute[name]._buffer) {
|
|
132
|
+
buffer[name] = attribute[name]._buffer;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
bufferAttributes,
|
|
137
|
+
constantAttributes,
|
|
138
|
+
indices
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
setAttributes(attributes, filterBuffers) {
|
|
142
|
+
const {
|
|
143
|
+
bufferAttributes,
|
|
144
|
+
constantAttributes,
|
|
145
|
+
indices
|
|
146
|
+
} = this._splitAttributes(attributes, filterBuffers);
|
|
147
|
+
if (indices) {
|
|
148
|
+
this.setIndexBuffer(indices);
|
|
118
149
|
console.warn('luma.gl: indices should not be part of attributes');
|
|
119
150
|
}
|
|
120
|
-
this.pipeline.setAttributes(
|
|
121
|
-
|
|
122
|
-
|
|
151
|
+
this.pipeline.setAttributes(bufferAttributes);
|
|
152
|
+
this.pipeline.setConstantAttributes(constantAttributes);
|
|
153
|
+
Object.assign(this.props.attributes, bufferAttributes, constantAttributes);
|
|
123
154
|
}
|
|
124
155
|
setBindings(bindings) {
|
|
125
156
|
this.pipeline.setBindings(bindings);
|
package/dist/model/model.js.map
CHANGED
|
@@ -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","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,EAAE,CAAC,CAAC;EAClBC,QAAQ,EAAE,IAAI;EACdC,eAAe,EAAEN;AACnB,CAAC;AAGD,OAAO,MAAMO,KAAK,CAAC;EAgBjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,aAZlB,IAAI;IAAAA,eAAA;IAAAA,eA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,IAAI;EACb;EAEAX,WAAWA,CAACa,QAA6B,EAAQ;IAC/C,IAAI,CAACpB,QAAQ,CAACO,WAAW,CAACa,QAAQ,CAAC;IACnC3B,MAAM,CAACC,MAAM,CAAC,IAAI,CAACH,KAAK,CAAC6B,QAAQ,EAAEA,QAAQ,CAAC;IAC5C,OAAO,IAAI;EACb;EAEAd,YAAYA,CAACpB,QAAkB,EAAQ;IAGrC,MAAMsC,eAAe,GAAGpD,+BAA+B,CAAC,IAAI,CAACkB,MAAM,EAAEJ,QAAQ,CAAC;IAC9E,IAAI,CAAC+B,aAAa,CAACO,eAAe,CAAC;IAEnC,MAAMC,WAAW,GAAGpD,0BAA0B,CAAC,IAAI,CAACiB,MAAM,EAAEJ,QAAQ,CAAC;IACrE,IAAIuC,WAAW,EAAE;MACf,IAAI,CAACV,cAAc,CAACU,WAAW,CAAC;IAClC;EACF;AACF;AAGA,SAAS7B,eAAeA,CAACN,MAAc,EAAEoC,MAA+C,EAAU;EAEhG,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EAEA,QAAQpC,MAAM,CAACqC,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":["Buffer","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","_splitAttributes","filterBuffers","bufferAttributes","constantAttributes","name","attribute","getValue","console","warn","concat","ArrayBuffer","isView","_buffer","buffer","setConstantAttributes","geometryBuffers","indexBuffer","shader","info","type","wgsl","glsl"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport {\n Device,\n Buffer,\n RenderPipelineProps,\n RenderPass,\n Binding,\n PrimitiveTopology\n} 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';\nimport {TypedArray} from '@math.gl/core';\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 =\n 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 // Temporary hack to support deck.gl's dependency on luma.gl v8 Model attribute API.\n _splitAttributes(\n attributes: Record<string, Buffer | TypedArray>,\n filterBuffers?: boolean\n ): {\n bufferAttributes: Record<string, Buffer>;\n constantAttributes: Record<string, TypedArray>;\n indices?: Buffer;\n } {\n const bufferAttributes: Record<string, Buffer> = {};\n const constantAttributes: Record<string, TypedArray> = {};\n const indices: Buffer | undefined = attributes.indices as Buffer;\n\n delete attributes.indices;\n\n for (const name in attributes) {\n let attribute = attributes[name];\n\n if (attribute instanceof Buffer) {\n bufferAttributes[name] = attribute;\n continue;\n }\n\n // The `getValue` call provides support for deck.gl `Attribute` class\n // TODO - remove once deck refactoring completes\n // @ts-ignore\n if (attribute.getValue) {\n // @ts-ignore\n attribute = attribute.getValue();\n console.warn(`attribute ${name}: getValue() will be removed`);\n }\n\n if (ArrayBuffer.isView(attribute) && !attribute) {\n constantAttributes[name] = attribute as unknown as TypedArray;\n continue;\n }\n\n // @ts-ignore\n if (filterBuffers && attribute[name]._buffer) {\n // @ts-ignore\n buffer[name] = attribute[name]._buffer;\n }\n }\n\n return {bufferAttributes, constantAttributes, indices};\n }\n\n setAttributes(attributes: Record<string, Buffer | TypedArray>, filterBuffers?: boolean): void {\n const {bufferAttributes, constantAttributes, indices} = this._splitAttributes(attributes, filterBuffers);\n\n // Temporary HACK since deck.gl v9 sets indices as part of attributes\n if (indices) {\n this.setIndexBuffer(indices);\n console.warn('luma.gl: indices should not be part of attributes');\n }\n\n this.pipeline.setAttributes(bufferAttributes);\n // TODO - WebGL only. We may have to allocate buffers on WebGPU\n this.pipeline.setConstantAttributes(constantAttributes);\n\n Object.assign(this.props.attributes, bufferAttributes, constantAttributes);\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":";AAEA,SAEEA,MAAM,QAKD,cAAc;AACrB,SAAQC,cAAc,QAAO,cAAc;AAAC,SAGpCC,+BAA+B,EAAEC,0BAA0B;AAAA,SAC3DC,eAAe;AAevB,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,EAAE,CAAC,CAAC;EAClBC,QAAQ,EAAE,IAAI;EACdC,eAAe,EAAEN;AACnB,CAAC;AAGD,OAAO,MAAMO,KAAK,CAAC;EAgBjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,e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