-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathcolumn-layer-uniforms.ts
More file actions
85 lines (79 loc) · 1.7 KB
/
column-layer-uniforms.ts
File metadata and controls
85 lines (79 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// deck.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import type {ShaderModule} from '@luma.gl/shadertools';
const uniformBlockWGSL = /* wgsl */ `\
struct ColumnUniforms {
radius: f32,
angle: f32,
offset: vec2<f32>,
extruded: f32,
stroked: f32,
isStroke: f32,
coverage: f32,
elevationScale: f32,
edgeDistance: f32,
widthScale: f32,
widthMinPixels: f32,
widthMaxPixels: f32,
radiusUnits: i32,
widthUnits: i32,
};
@group(0) @binding(3) var<uniform> column: ColumnUniforms;
`;
const uniformBlock = `\
uniform columnUniforms {
float radius;
float angle;
vec2 offset;
bool extruded;
bool stroked;
bool isStroke;
float coverage;
float elevationScale;
float edgeDistance;
float widthScale;
float widthMinPixels;
float widthMaxPixels;
highp int radiusUnits;
highp int widthUnits;
} column;
`;
export type ColumnProps = {
radius: number;
angle: number;
offset: Readonly<[number, number]>;
extruded: boolean;
stroked: boolean;
isStroke: boolean;
coverage: number;
elevationScale: number;
edgeDistance: number;
widthScale: number;
widthMinPixels: number;
widthMaxPixels: number;
radiusUnits: number;
widthUnits: number;
};
export const columnUniforms = {
name: 'column',
source: uniformBlockWGSL,
vs: uniformBlock,
fs: uniformBlock,
uniformTypes: {
radius: 'f32',
angle: 'f32',
offset: 'vec2<f32>',
extruded: 'f32',
stroked: 'f32',
isStroke: 'f32',
coverage: 'f32',
elevationScale: 'f32',
edgeDistance: 'f32',
widthScale: 'f32',
widthMinPixels: 'f32',
widthMaxPixels: 'f32',
radiusUnits: 'i32',
widthUnits: 'i32'
}
} as const satisfies ShaderModule<ColumnProps>;