// deck.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors import type {ShaderModule} from '@luma.gl/shadertools'; import type {LayerProps} from '../../types/layer-props'; const uniformBlockWGSL = /* wgsl */ `\ struct LayerUniforms { opacity: f32, }; @group(0) @binding(auto) var layer: LayerUniforms; `; const uniformBlock = `\ layout(std140) uniform layerUniforms { uniform float opacity; } layer; `; export type LayerUniforms = { opacity?: number; }; export const layerUniforms = { name: 'layer', source: uniformBlockWGSL, vs: uniformBlock, fs: uniformBlock, getUniforms: (props: Partial) => { return { // apply gamma to opacity to make it visually "linear" // TODO - v10: use raw opacity? opacity: Math.pow(props.opacity!, 1 / 2.2) }; }, uniformTypes: { opacity: 'f32' } } as const satisfies ShaderModule;