@luma.gl/engine
Advanced tools
Comparing version 9.0.16 to 9.0.17
@@ -40,3 +40,2 @@ export { Timeline } from "./animation/timeline.js"; | ||
export { TruncatedConeGeometry } from "./geometries/truncated-cone-geometry.js"; | ||
export type { ShaderModuleInputs } from "./shader-inputs.js"; | ||
export { ShaderInputs as _ShaderInputs } from "./shader-inputs.js"; | ||
@@ -43,0 +42,0 @@ export type { ComputationProps } from "./computation.js"; |
@@ -28,3 +28,4 @@ // luma.gl Engine API | ||
export { TruncatedConeGeometry } from "./geometries/truncated-cone-geometry.js"; | ||
// EXPERIMENTAL | ||
export { ShaderInputs as _ShaderInputs } from "./shader-inputs.js"; | ||
export { Computation } from "./computation.js"; |
@@ -1,15 +0,3 @@ | ||
import type { UniformValue, Texture, Sampler } from '@luma.gl/core'; | ||
import { ShaderModuleInstance } from '@luma.gl/shadertools'; | ||
/** Minimal ShaderModule subset, we don't need shader code etc */ | ||
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>> = { | ||
defaultUniforms?: UniformsT; | ||
getUniforms?: (settings: Partial<PropsT>, prevUniforms?: UniformsT) => UniformsT; | ||
/** Not used. Used to access props type */ | ||
props?: PropsT; | ||
bindings?: Record<keyof BindingsT, { | ||
location: number; | ||
type: 'texture' | 'sampler' | 'uniforms'; | ||
}>; | ||
uniformTypes?: any; | ||
}; | ||
import type { Binding, UniformValue } from '@luma.gl/core'; | ||
import { ShaderModule, ShaderModuleInstance } from '@luma.gl/shadertools'; | ||
/** | ||
@@ -28,3 +16,3 @@ * ShaderInputs holds uniform and binding values for one or more shader modules, | ||
modules: Readonly<{ | ||
[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>; | ||
[P in keyof ShaderPropsT]: ShaderModule<ShaderPropsT[P]>; | ||
}>; | ||
@@ -34,3 +22,3 @@ /** Stores the uniform values for each module */ | ||
/** Stores the uniform bindings for each module */ | ||
moduleBindings: Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>; | ||
moduleBindings: Record<keyof ShaderPropsT, Record<string, Binding>>; | ||
/** Tracks if uniforms have changed */ | ||
@@ -43,3 +31,3 @@ moduleUniformsChanged: Record<keyof ShaderPropsT, false | string>; | ||
constructor(modules: { | ||
[P in keyof ShaderPropsT]?: ShaderModuleInputs<ShaderPropsT[P]>; | ||
[P in keyof ShaderPropsT]?: ShaderModule<ShaderPropsT[P], any>; | ||
}); | ||
@@ -63,5 +51,5 @@ /** Destroy */ | ||
/** Merges all bindings for the shader (from the various modules) */ | ||
getBindings(): Record<string, Texture | Sampler>; | ||
getBindings(): Record<string, Binding>; | ||
getDebugTable(): Record<string, Record<string, unknown>>; | ||
} | ||
//# sourceMappingURL=shader-inputs.d.ts.map |
@@ -67,3 +67,3 @@ // luma.gl | ||
const oldBindings = this.moduleBindings[moduleName]; | ||
const uniformsAndBindings = module.getUniforms?.(moduleProps, this.moduleUniforms[moduleName]) || moduleProps; | ||
const uniformsAndBindings = module.getUniforms?.(moduleProps, oldUniforms) || moduleProps; | ||
const { uniforms, bindings } = splitUniformsAndBindings(uniformsAndBindings); | ||
@@ -70,0 +70,0 @@ this.moduleUniforms[moduleName] = { ...oldUniforms, ...uniforms }; |
{ | ||
"name": "@luma.gl/engine", | ||
"version": "9.0.16", | ||
"version": "9.0.17", | ||
"description": "3D Engine Components for luma.gl", | ||
@@ -46,3 +46,3 @@ "type": "module", | ||
"dependencies": { | ||
"@luma.gl/shadertools": "9.0.16", | ||
"@luma.gl/shadertools": "9.0.17", | ||
"@math.gl/core": "^4.0.0", | ||
@@ -52,3 +52,3 @@ "@probe.gl/log": "^4.0.2", | ||
}, | ||
"gitHead": "b1f2597d6efc8aa223ddb3bf6b1530510f17ea40" | ||
"gitHead": "f348f3221ab2842ffa877b6c99e0e9e4df82426e" | ||
} |
@@ -60,5 +60,4 @@ // luma.gl Engine API | ||
// EXPERIMENTAL | ||
export type {ShaderModuleInputs} from './shader-inputs'; | ||
export {ShaderInputs as _ShaderInputs} from './shader-inputs'; | ||
export type {ComputationProps} from './computation'; | ||
export {Computation} from './computation'; |
@@ -5,30 +5,7 @@ // luma.gl | ||
import type {UniformValue, Texture, Sampler} from '@luma.gl/core'; | ||
import type {Binding, UniformValue} from '@luma.gl/core'; | ||
import {log, splitUniformsAndBindings} from '@luma.gl/core'; | ||
// import type {ShaderUniformType, UniformValue, UniformFormat, UniformInfoDevice, Texture, Sampler} from '@luma.gl/core'; | ||
import {_resolveModules, ShaderModuleInstance} from '@luma.gl/shadertools'; | ||
import {_resolveModules, ShaderModule, ShaderModuleInstance} from '@luma.gl/shadertools'; | ||
/** Minimal ShaderModule subset, we don't need shader code etc */ | ||
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> | ||
> = { | ||
defaultUniforms?: UniformsT; | ||
getUniforms?: (settings: Partial<PropsT>, prevUniforms?: UniformsT) => UniformsT; | ||
/** Not used. Used to access props type */ | ||
props?: PropsT; | ||
bindings?: Record< | ||
keyof BindingsT, | ||
{ | ||
location: number; | ||
type: 'texture' | 'sampler' | 'uniforms'; | ||
} | ||
>; | ||
uniformTypes?: any; | ||
}; | ||
/** | ||
@@ -50,3 +27,3 @@ * ShaderInputs holds uniform and binding values for one or more shader modules, | ||
*/ | ||
modules: Readonly<{[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>}>; | ||
modules: Readonly<{[P in keyof ShaderPropsT]: ShaderModule<ShaderPropsT[P]>}>; | ||
@@ -56,3 +33,3 @@ /** Stores the uniform values for each module */ | ||
/** Stores the uniform bindings for each module */ | ||
moduleBindings: Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>; | ||
moduleBindings: Record<keyof ShaderPropsT, Record<string, Binding>>; | ||
/** Tracks if uniforms have changed */ | ||
@@ -65,3 +42,3 @@ moduleUniformsChanged: Record<keyof ShaderPropsT, false | string>; | ||
*/ | ||
constructor(modules: {[P in keyof ShaderPropsT]?: ShaderModuleInputs<ShaderPropsT[P]>}) { | ||
constructor(modules: {[P in keyof ShaderPropsT]?: ShaderModule<ShaderPropsT[P], any>}) { | ||
// Extract modules with dependencies | ||
@@ -79,5 +56,5 @@ const resolvedModules = _resolveModules( | ||
// Store the module definitions and create storage for uniform values and binding values, per module | ||
this.modules = modules as {[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>}; | ||
this.modules = modules as {[P in keyof ShaderPropsT]: ShaderModule<ShaderPropsT[P]>}; | ||
this.moduleUniforms = {} as Record<keyof ShaderPropsT, Record<string, UniformValue>>; | ||
this.moduleBindings = {} as Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>; | ||
this.moduleBindings = {} as Record<keyof ShaderPropsT, Record<string, Binding>>; | ||
@@ -111,6 +88,6 @@ // Initialize the modules | ||
const oldUniforms = this.moduleUniforms[moduleName]; | ||
const oldUniforms = this.moduleUniforms[moduleName] as (typeof module)['uniforms']; | ||
const oldBindings = this.moduleBindings[moduleName]; | ||
const uniformsAndBindings = | ||
module.getUniforms?.(moduleProps, this.moduleUniforms[moduleName]) || (moduleProps as any); | ||
module.getUniforms?.(moduleProps, oldUniforms) || (moduleProps as any); | ||
@@ -145,4 +122,4 @@ const {uniforms, bindings} = splitUniformsAndBindings(uniformsAndBindings); | ||
/** Merges all bindings for the shader (from the various modules) */ | ||
getBindings(): Record<string, Texture | Sampler> { | ||
const bindings = {} as Record<string, Texture | Sampler>; | ||
getBindings(): Record<string, Binding> { | ||
const bindings = {} as Record<string, Binding>; | ||
for (const moduleBindings of Object.values(this.moduleBindings)) { | ||
@@ -159,3 +136,3 @@ Object.assign(bindings, moduleBindings); | ||
table[`${moduleName}.${key}`] = { | ||
type: this.modules[moduleName].uniformTypes?.[key], | ||
type: this.modules[moduleName].uniformTypes?.[key as keyof ShaderPropsT], | ||
value: String(value) | ||
@@ -162,0 +139,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1099027
22709
+ Added@luma.gl/shadertools@9.0.17(transitive)
- Removed@luma.gl/shadertools@9.0.16(transitive)
Updated@luma.gl/shadertools@9.0.17