@luma.gl/engine 9.0.16 → 9.0.19

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/index.d.ts CHANGED
@@ -37,7 +37,6 @@ export type { SphereGeometryProps } from "./geometries/sphere-geometry.js";
37
37
  export { SphereGeometry } from "./geometries/sphere-geometry.js";
38
38
  export type { TruncatedConeGeometryProps } from "./geometries/truncated-cone-geometry.js";
39
39
  export { TruncatedConeGeometry } from "./geometries/truncated-cone-geometry.js";
40
- export type { ShaderModuleInputs } from "./shader-inputs.js";
41
40
  export { ShaderInputs as _ShaderInputs } from "./shader-inputs.js";
42
41
  export type { ComputationProps } from "./computation.js";
43
42
  export { Computation } from "./computation.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAC,gCAA6B;AAC9C,OAAO,EAAC,SAAS,EAAC,kCAA+B;AACjD,YAAY,EAAC,cAAc,EAAC,4CAAyC;AAErE,OAAO,EAAC,qBAAqB,EAAC,oDAAiD;AAE/E,YAAY,EAAC,kBAAkB,EAAC,2CAAwC;AACxE,OAAO,EAAC,aAAa,EAAC,2CAAwC;AAE9D,YAAY,EAAC,sBAAsB,EAAC,gDAA6C;AACjF,OAAO,EAAC,iBAAiB,EAAC,gDAA6C;AAEvE,YAAY,EAAC,UAAU,EAAC,yBAAsB;AAC9C,OAAO,EAAC,KAAK,EAAC,yBAAsB;AAGpC,YAAY,EAAC,oBAAoB,EAAC,wCAAqC;AACvE,OAAO,EAAC,eAAe,EAAC,wCAAqC;AAC7D,YAAY,EAAC,qBAAqB,EAAC,yCAAsC;AACzE,OAAO,EAAC,gBAAgB,EAAC,yCAAsC;AAE/D,OAAO,EAAC,eAAe,EAAC,kCAA+B;AACvD,OAAO,EAAC,aAAa,EAAC,gCAA6B;AAGnD,OAAO,EAAC,SAAS,EAAC,4BAAyB;AAG3C,O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,EAAC,4CAAyC;AACnE,YAAY,EAAC,kBAAkB,EAAC,uCAAoC;AACpE,OAAO,EAAC,aAAa,EAAC,uCAAoC;AAC1D,YAAY,EAAC,mBAAmB,EAAC,wCAAqC;AACtE,OAAO,EAAC,cAAc,EAAC,wCAAqC;AAC5D,YAAY,EAAC,0BAA0B,EAAC,gDAA6C;AACrF,OAAO,EAAC,qBAAqB,EAAC,gDAA6C;AAG3E,OAAO,EAAC,YAAY,IAAI,aAAa,EAAC,2BAAwB;AAC9D,YAAY,EAAC,gBAAgB,EAAC,yBAAsB;AACpD,OAAO,EAAC,WAAW,EAAC,yBAAsB"}
package/dist/index.js CHANGED
@@ -25,5 +25,6 @@ export { IcoSphereGeometry } from "./geometries/ico-sphere-geometry.js";
25
25
  export { PlaneGeometry } from "./geometries/plane-geometry.js";
26
26
  export { SphereGeometry } from "./geometries/sphere-geometry.js";
27
27
  export { TruncatedConeGeometry } from "./geometries/truncated-cone-geometry.js";
28
+ // EXPERIMENTAL
28
29
  export { ShaderInputs as _ShaderInputs } from "./shader-inputs.js";
29
30
  export { Computation } from "./computation.js";
@@ -1,17 +1,5 @@
1
- import type { UniformValue, Texture, Sampler } from '@luma.gl/core';
2
- import { ShaderModuleInstance } from '@luma.gl/shadertools';
3
- /** Minimal ShaderModule subset, we don't need shader code etc */
4
- export type ShaderModuleInputs<PropsT extends Record<string, unknown> = Record<string, unknown>, UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, BindingsT extends Record<string, Texture | Sampler> = Record<string, Texture | Sampler>> = {
5
- defaultUniforms?: UniformsT;
6
- getUniforms?: (settings: Partial<PropsT>, prevUniforms?: UniformsT) => UniformsT;
7
- /** Not used. Used to access props type */
8
- props?: PropsT;
9
- bindings?: Record<keyof BindingsT, {
10
- location: number;
11
- type: 'texture' | 'sampler' | 'uniforms';
12
- }>;
13
- uniformTypes?: any;
14
- };
1
+ import type { Binding, UniformValue } from '@luma.gl/core';
2
+ import { ShaderModule, ShaderModuleInstance } from '@luma.gl/shadertools';
15
3
  /**
16
4
  * ShaderInputs holds uniform and binding values for one or more shader modules,
17
5
  * - It can generate binary data for any uniform buffer
@@ -25,12 +13,12 @@ export declare class ShaderInputs<ShaderPropsT extends Partial<Record<string, Re
25
13
  * @todo should should this include the resolved dependencies?
26
14
  */
27
15
  modules: Readonly<{
28
- [P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>;
16
+ [P in keyof ShaderPropsT]: ShaderModule<ShaderPropsT[P]>;
29
17
  }>;
30
18
  /** Stores the uniform values for each module */
31
19
  moduleUniforms: Record<keyof ShaderPropsT, Record<string, UniformValue>>;
32
20
  /** Stores the uniform bindings for each module */
33
- moduleBindings: Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;
21
+ moduleBindings: Record<keyof ShaderPropsT, Record<string, Binding>>;
34
22
  /** Tracks if uniforms have changed */
35
23
  moduleUniformsChanged: Record<keyof ShaderPropsT, false | string>;
36
24
  /**
@@ -38,7 +26,7 @@ export declare class ShaderInputs<ShaderPropsT extends Partial<Record<string, Re
38
26
  * @param modules
39
27
  */
40
28
  constructor(modules: {
41
- [P in keyof ShaderPropsT]?: ShaderModuleInputs<ShaderPropsT[P]>;
29
+ [P in keyof ShaderPropsT]?: ShaderModule<ShaderPropsT[P], any>;
42
30
  });
43
31
  /** Destroy */
44
32
  destroy(): void;
@@ -57,7 +45,7 @@ export declare class ShaderInputs<ShaderPropsT extends Partial<Record<string, Re
57
45
  /** Get all uniform values for all modules */
58
46
  getUniformValues(): Record<keyof ShaderPropsT, Record<string, UniformValue>>;
59
47
  /** Merges all bindings for the shader (from the various modules) */
60
- getBindings(): Record<string, Texture | Sampler>;
48
+ getBindings(): Record<string, Binding>;
61
49
  getDebugTable(): Record<string, Record<string, unknown>>;
62
50
  }
63
51
  //# sourceMappingURL=shader-inputs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shader-inputs.d.ts","sourceRoot":"","sources":["../src/shader-inputs.ts"],"names":[],"mappings":"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,YAAY,CAAC,CAAC;IAI5E,oEAAoE;IACpE,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQtC,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAYzD"}
@@ -64,7 +64,7 @@ export class ShaderInputs {
64
64
  }
65
65
  const oldUniforms = this.moduleUniforms[moduleName];
66
66
  const oldBindings = this.moduleBindings[moduleName];
67
- const uniformsAndBindings = module.getUniforms?.(moduleProps, this.moduleUniforms[moduleName]) || moduleProps;
67
+ const uniformsAndBindings = module.getUniforms?.(moduleProps, oldUniforms) || moduleProps;
68
68
  const { uniforms, bindings } = splitUniformsAndBindings(uniformsAndBindings);
69
69
  this.moduleUniforms[moduleName] = { ...oldUniforms, ...uniforms };
70
70
  this.moduleBindings[moduleName] = { ...oldBindings, ...bindings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/engine",
3
- "version": "9.0.16",
3
+ "version": "9.0.19",
4
4
  "description": "3D Engine Components for luma.gl",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,10 +43,10 @@
43
43
  "@luma.gl/core": "^9.0.0"
44
44
  },
45
45
  "dependencies": {
46
- "@luma.gl/shadertools": "9.0.16",
46
+ "@luma.gl/shadertools": "9.0.19",
47
47
  "@math.gl/core": "^4.0.0",
48
48
  "@probe.gl/log": "^4.0.2",
49
49
  "@probe.gl/stats": "^4.0.2"
50
50
  },
51
- "gitHead": "b1f2597d6efc8aa223ddb3bf6b1530510f17ea40"
51
+ "gitHead": "5e1ede7bdaf2c9ccdbd167804601537e93dc4225"
52
52
  }
package/src/index.ts CHANGED
@@ -57,7 +57,6 @@ export type {TruncatedConeGeometryProps} from './geometries/truncated-cone-geome
57
57
  export {TruncatedConeGeometry} from './geometries/truncated-cone-geometry';
58
58
 
59
59
  // EXPERIMENTAL
60
- export type {ShaderModuleInputs} from './shader-inputs';
61
60
  export {ShaderInputs as _ShaderInputs} from './shader-inputs';
62
61
  export type {ComputationProps} from './computation';
63
62
  export {Computation} from './computation';
@@ -2,33 +2,10 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {UniformValue, Texture, Sampler} from '@luma.gl/core';
5
+ import type {Binding, UniformValue} from '@luma.gl/core';
6
6
  import {log, splitUniformsAndBindings} from '@luma.gl/core';
7
7
  // import type {ShaderUniformType, UniformValue, UniformFormat, UniformInfoDevice, Texture, Sampler} from '@luma.gl/core';
8
- import {_resolveModules, ShaderModuleInstance} from '@luma.gl/shadertools';
9
-
10
- /** Minimal ShaderModule subset, we don't need shader code etc */
11
- export type ShaderModuleInputs<
12
- PropsT extends Record<string, unknown> = Record<string, unknown>,
13
- UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>,
14
- BindingsT extends Record<string, Texture | Sampler> = Record<string, Texture | Sampler>
15
- > = {
16
- defaultUniforms?: UniformsT;
17
- getUniforms?: (settings: Partial<PropsT>, prevUniforms?: UniformsT) => UniformsT;
18
-
19
- /** Not used. Used to access props type */
20
- props?: PropsT;
21
-
22
- bindings?: Record<
23
- keyof BindingsT,
24
- {
25
- location: number;
26
- type: 'texture' | 'sampler' | 'uniforms';
27
- }
28
- >;
29
-
30
- uniformTypes?: any;
31
- };
8
+ import {_resolveModules, ShaderModule, ShaderModuleInstance} from '@luma.gl/shadertools';
32
9
 
33
10
  /**
34
11
  * ShaderInputs holds uniform and binding values for one or more shader modules,
@@ -46,12 +23,12 @@ export class ShaderInputs<
46
23
  * The map of modules
47
24
  * @todo should should this include the resolved dependencies?
48
25
  */
49
- modules: Readonly<{[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>}>;
26
+ modules: Readonly<{[P in keyof ShaderPropsT]: ShaderModule<ShaderPropsT[P]>}>;
50
27
 
51
28
  /** Stores the uniform values for each module */
52
29
  moduleUniforms: Record<keyof ShaderPropsT, Record<string, UniformValue>>;
53
30
  /** Stores the uniform bindings for each module */
54
- moduleBindings: Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;
31
+ moduleBindings: Record<keyof ShaderPropsT, Record<string, Binding>>;
55
32
  /** Tracks if uniforms have changed */
56
33
  moduleUniformsChanged: Record<keyof ShaderPropsT, false | string>;
57
34
 
@@ -59,7 +36,7 @@ export class ShaderInputs<
59
36
  * Create a new UniformStore instance
60
37
  * @param modules
61
38
  */
62
- constructor(modules: {[P in keyof ShaderPropsT]?: ShaderModuleInputs<ShaderPropsT[P]>}) {
39
+ constructor(modules: {[P in keyof ShaderPropsT]?: ShaderModule<ShaderPropsT[P], any>}) {
63
40
  // Extract modules with dependencies
64
41
  const resolvedModules = _resolveModules(
65
42
  Object.values(modules).filter(module => module.dependencies)
@@ -72,9 +49,9 @@ export class ShaderInputs<
72
49
  log.log(1, 'Creating ShaderInputs with modules', Object.keys(modules))();
73
50
 
74
51
  // Store the module definitions and create storage for uniform values and binding values, per module
75
- this.modules = modules as {[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>};
52
+ this.modules = modules as {[P in keyof ShaderPropsT]: ShaderModule<ShaderPropsT[P]>};
76
53
  this.moduleUniforms = {} as Record<keyof ShaderPropsT, Record<string, UniformValue>>;
77
- this.moduleBindings = {} as Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;
54
+ this.moduleBindings = {} as Record<keyof ShaderPropsT, Record<string, Binding>>;
78
55
 
79
56
  // Initialize the modules
80
57
  for (const [name, module] of Object.entries(modules)) {
@@ -103,10 +80,10 @@ export class ShaderInputs<
103
80
  continue; // eslint-disable-line no-continue
104
81
  }
105
82
 
106
- const oldUniforms = this.moduleUniforms[moduleName];
83
+ const oldUniforms = this.moduleUniforms[moduleName] as (typeof module)['uniforms'];
107
84
  const oldBindings = this.moduleBindings[moduleName];
108
85
  const uniformsAndBindings =
109
- module.getUniforms?.(moduleProps, this.moduleUniforms[moduleName]) || (moduleProps as any);
86
+ module.getUniforms?.(moduleProps, oldUniforms) || (moduleProps as any);
110
87
 
111
88
  const {uniforms, bindings} = splitUniformsAndBindings(uniformsAndBindings);
112
89
  this.moduleUniforms[moduleName] = {...oldUniforms, ...uniforms};
@@ -136,8 +113,8 @@ export class ShaderInputs<
136
113
  }
137
114
 
138
115
  /** Merges all bindings for the shader (from the various modules) */
139
- getBindings(): Record<string, Texture | Sampler> {
140
- const bindings = {} as Record<string, Texture | Sampler>;
116
+ getBindings(): Record<string, Binding> {
117
+ const bindings = {} as Record<string, Binding>;
141
118
  for (const moduleBindings of Object.values(this.moduleBindings)) {
142
119
  Object.assign(bindings, moduleBindings);
143
120
  }
@@ -149,7 +126,7 @@ export class ShaderInputs<
149
126
  for (const [moduleName, module] of Object.entries(this.moduleUniforms)) {
150
127
  for (const [key, value] of Object.entries(module)) {
151
128
  table[`${moduleName}.${key}`] = {
152
- type: this.modules[moduleName].uniformTypes?.[key],
129
+ type: this.modules[moduleName].uniformTypes?.[key as keyof ShaderPropsT],
153
130
  value: String(value)
154
131
  };
155
132
  }