@deck.gl/extensions 9.0.0-beta.2 → 9.0.0-beta.4

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.
Files changed (244) hide show
  1. package/dist/brushing/brushing-extension.js +80 -0
  2. package/{typed → dist}/brushing/shader-module.d.ts +1 -1
  3. package/{typed → dist}/brushing/shader-module.d.ts.map +1 -1
  4. package/dist/{esm/brushing → brushing}/shader-module.js +24 -30
  5. package/dist/clip/clip-extension.js +117 -0
  6. package/{typed → dist}/collision-filter/collision-filter-effect.d.ts.map +1 -1
  7. package/dist/collision-filter/collision-filter-effect.js +193 -0
  8. package/dist/collision-filter/collision-filter-extension.js +49 -0
  9. package/{typed → dist}/collision-filter/collision-filter-pass.d.ts.map +1 -1
  10. package/dist/collision-filter/collision-filter-pass.js +25 -0
  11. package/dist/{esm/collision-filter → collision-filter}/shader-module.js +17 -24
  12. package/dist/data-filter/aggregator.js +104 -0
  13. package/{typed → dist}/data-filter/data-filter-extension.d.ts +36 -5
  14. package/dist/data-filter/data-filter-extension.d.ts.map +1 -0
  15. package/dist/data-filter/data-filter-extension.js +243 -0
  16. package/{typed → dist}/data-filter/shader-module.d.ts +1 -1
  17. package/dist/data-filter/shader-module.d.ts.map +1 -0
  18. package/dist/data-filter/shader-module.js +187 -0
  19. package/dist/dist.dev.js +1847 -13033
  20. package/dist/fill-style/fill-style-extension.js +118 -0
  21. package/dist/{esm/fill-style → fill-style}/shaders.glsl.js +37 -43
  22. package/dist/fp64/fp64-extension.js +35 -0
  23. package/dist/{esm/fp64 → fp64}/project64.glsl.js +19 -1
  24. package/dist/fp64/project64.js +50 -0
  25. package/dist/index.cjs +2814 -0
  26. package/dist/index.cjs.map +7 -0
  27. package/dist/index.d.ts +19 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +11 -0
  30. package/{typed → dist}/mask/mask-effect.d.ts +1 -1
  31. package/dist/mask/mask-effect.d.ts.map +1 -0
  32. package/dist/mask/mask-effect.js +194 -0
  33. package/dist/mask/mask-extension.js +57 -0
  34. package/{typed → dist}/mask/mask-pass.d.ts.map +1 -1
  35. package/dist/mask/mask-pass.js +44 -0
  36. package/dist/{esm/mask → mask}/shader-module.js +18 -21
  37. package/dist/path-style/path-style-extension.js +111 -0
  38. package/dist/{esm/path-style → path-style}/shaders.glsl.js +20 -13
  39. package/{typed → dist}/terrain/height-map-builder.d.ts +1 -1
  40. package/dist/terrain/height-map-builder.d.ts.map +1 -0
  41. package/dist/terrain/height-map-builder.js +104 -0
  42. package/{typed → dist}/terrain/shader-module.d.ts +2 -2
  43. package/dist/terrain/shader-module.d.ts.map +1 -0
  44. package/dist/terrain/shader-module.js +139 -0
  45. package/{typed → dist}/terrain/terrain-cover.d.ts +1 -1
  46. package/dist/terrain/terrain-cover.d.ts.map +1 -0
  47. package/dist/terrain/terrain-cover.js +187 -0
  48. package/{typed → dist}/terrain/terrain-effect.d.ts +1 -1
  49. package/dist/terrain/terrain-effect.d.ts.map +1 -0
  50. package/dist/terrain/terrain-effect.js +184 -0
  51. package/dist/terrain/terrain-extension.js +44 -0
  52. package/{typed → dist}/terrain/terrain-pass.d.ts +2 -2
  53. package/dist/terrain/terrain-pass.d.ts.map +1 -0
  54. package/dist/terrain/terrain-pass.js +61 -0
  55. package/{typed → dist}/terrain/terrain-picking-pass.d.ts +1 -1
  56. package/dist/terrain/terrain-picking-pass.d.ts.map +1 -0
  57. package/dist/terrain/terrain-picking-pass.js +66 -0
  58. package/dist/terrain/utils.js +21 -0
  59. package/{typed → dist}/utils/debug.d.ts.map +1 -1
  60. package/dist/utils/debug.js +50 -0
  61. package/dist/utils/projection-utils.js +153 -0
  62. package/dist.min.js +104 -208
  63. package/package.json +19 -12
  64. package/src/collision-filter/collision-filter-effect.ts +12 -8
  65. package/src/collision-filter/collision-filter-pass.ts +1 -3
  66. package/src/data-filter/data-filter-extension.ts +136 -29
  67. package/src/data-filter/shader-module.ts +31 -3
  68. package/src/mask/mask-effect.ts +0 -1
  69. package/src/mask/mask-pass.ts +1 -3
  70. package/src/terrain/terrain-effect.ts +8 -2
  71. package/src/terrain/terrain-pass.ts +2 -5
  72. package/src/terrain/terrain-picking-pass.ts +1 -3
  73. package/src/utils/debug.ts +1 -2
  74. package/dist/es5/brushing/brushing-extension.js +0 -108
  75. package/dist/es5/brushing/brushing-extension.js.map +0 -1
  76. package/dist/es5/brushing/shader-module.js +0 -50
  77. package/dist/es5/brushing/shader-module.js.map +0 -1
  78. package/dist/es5/clip/clip-extension.js +0 -98
  79. package/dist/es5/clip/clip-extension.js.map +0 -1
  80. package/dist/es5/collision-filter/collision-filter-effect.js +0 -294
  81. package/dist/es5/collision-filter/collision-filter-effect.js.map +0 -1
  82. package/dist/es5/collision-filter/collision-filter-extension.js +0 -109
  83. package/dist/es5/collision-filter/collision-filter-extension.js.map +0 -1
  84. package/dist/es5/collision-filter/collision-filter-pass.js +0 -79
  85. package/dist/es5/collision-filter/collision-filter-pass.js.map +0 -1
  86. package/dist/es5/collision-filter/shader-module.js +0 -39
  87. package/dist/es5/collision-filter/shader-module.js.map +0 -1
  88. package/dist/es5/data-filter/aggregator.js +0 -79
  89. package/dist/es5/data-filter/aggregator.js.map +0 -1
  90. package/dist/es5/data-filter/data-filter-extension.js +0 -236
  91. package/dist/es5/data-filter/data-filter-extension.js.map +0 -1
  92. package/dist/es5/data-filter/shader-module.js +0 -122
  93. package/dist/es5/data-filter/shader-module.js.map +0 -1
  94. package/dist/es5/fill-style/fill-style-extension.js +0 -190
  95. package/dist/es5/fill-style/fill-style-extension.js.map +0 -1
  96. package/dist/es5/fill-style/shaders.glsl.js +0 -59
  97. package/dist/es5/fill-style/shaders.glsl.js.map +0 -1
  98. package/dist/es5/fp64/fp64-extension.js +0 -55
  99. package/dist/es5/fp64/fp64-extension.js.map +0 -1
  100. package/dist/es5/fp64/project64.glsl.js +0 -9
  101. package/dist/es5/fp64/project64.glsl.js.map +0 -1
  102. package/dist/es5/fp64/project64.js +0 -52
  103. package/dist/es5/fp64/project64.js.map +0 -1
  104. package/dist/es5/index.js +0 -88
  105. package/dist/es5/index.js.map +0 -1
  106. package/dist/es5/mask/mask-effect.js +0 -279
  107. package/dist/es5/mask/mask-effect.js.map +0 -1
  108. package/dist/es5/mask/mask-extension.js +0 -113
  109. package/dist/es5/mask/mask-extension.js.map +0 -1
  110. package/dist/es5/mask/mask-pass.js +0 -106
  111. package/dist/es5/mask/mask-pass.js.map +0 -1
  112. package/dist/es5/mask/shader-module.js +0 -38
  113. package/dist/es5/mask/shader-module.js.map +0 -1
  114. package/dist/es5/path-style/path-style-extension.js +0 -169
  115. package/dist/es5/path-style/path-style-extension.js.map +0 -1
  116. package/dist/es5/path-style/shaders.glsl.js +0 -25
  117. package/dist/es5/path-style/shaders.glsl.js.map +0 -1
  118. package/dist/es5/terrain/height-map-builder.js +0 -111
  119. package/dist/es5/terrain/height-map-builder.js.map +0 -1
  120. package/dist/es5/terrain/shader-module.js +0 -86
  121. package/dist/es5/terrain/shader-module.js.map +0 -1
  122. package/dist/es5/terrain/terrain-cover.js +0 -256
  123. package/dist/es5/terrain/terrain-cover.js.map +0 -1
  124. package/dist/es5/terrain/terrain-effect.js +0 -326
  125. package/dist/es5/terrain/terrain-effect.js.map +0 -1
  126. package/dist/es5/terrain/terrain-extension.js +0 -94
  127. package/dist/es5/terrain/terrain-extension.js.map +0 -1
  128. package/dist/es5/terrain/terrain-pass.js +0 -121
  129. package/dist/es5/terrain/terrain-pass.js.map +0 -1
  130. package/dist/es5/terrain/terrain-picking-pass.js +0 -124
  131. package/dist/es5/terrain/terrain-picking-pass.js.map +0 -1
  132. package/dist/es5/terrain/utils.js +0 -35
  133. package/dist/es5/terrain/utils.js.map +0 -1
  134. package/dist/es5/utils/debug.js +0 -71
  135. package/dist/es5/utils/debug.js.map +0 -1
  136. package/dist/es5/utils/projection-utils.js +0 -168
  137. package/dist/es5/utils/projection-utils.js.map +0 -1
  138. package/dist/esm/brushing/brushing-extension.js +0 -68
  139. package/dist/esm/brushing/brushing-extension.js.map +0 -1
  140. package/dist/esm/brushing/shader-module.js.map +0 -1
  141. package/dist/esm/clip/clip-extension.js +0 -86
  142. package/dist/esm/clip/clip-extension.js.map +0 -1
  143. package/dist/esm/collision-filter/collision-filter-effect.js +0 -246
  144. package/dist/esm/collision-filter/collision-filter-effect.js.map +0 -1
  145. package/dist/esm/collision-filter/collision-filter-extension.js +0 -75
  146. package/dist/esm/collision-filter/collision-filter-extension.js.map +0 -1
  147. package/dist/esm/collision-filter/collision-filter-pass.js +0 -32
  148. package/dist/esm/collision-filter/collision-filter-pass.js.map +0 -1
  149. package/dist/esm/collision-filter/shader-module.js.map +0 -1
  150. package/dist/esm/data-filter/aggregator.js +0 -102
  151. package/dist/esm/data-filter/aggregator.js.map +0 -1
  152. package/dist/esm/data-filter/data-filter-extension.js +0 -189
  153. package/dist/esm/data-filter/data-filter-extension.js.map +0 -1
  154. package/dist/esm/data-filter/shader-module.js +0 -164
  155. package/dist/esm/data-filter/shader-module.js.map +0 -1
  156. package/dist/esm/fill-style/fill-style-extension.js +0 -156
  157. package/dist/esm/fill-style/fill-style-extension.js.map +0 -1
  158. package/dist/esm/fill-style/shaders.glsl.js.map +0 -1
  159. package/dist/esm/fp64/fp64-extension.js +0 -20
  160. package/dist/esm/fp64/fp64-extension.js.map +0 -1
  161. package/dist/esm/fp64/project64.glsl.js.map +0 -1
  162. package/dist/esm/fp64/project64.js +0 -43
  163. package/dist/esm/fp64/project64.js.map +0 -1
  164. package/dist/esm/index.js +0 -11
  165. package/dist/esm/index.js.map +0 -1
  166. package/dist/esm/mask/mask-effect.js +0 -228
  167. package/dist/esm/mask/mask-effect.js.map +0 -1
  168. package/dist/esm/mask/mask-extension.js +0 -83
  169. package/dist/esm/mask/mask-extension.js.map +0 -1
  170. package/dist/esm/mask/mask-pass.js +0 -58
  171. package/dist/esm/mask/mask-pass.js.map +0 -1
  172. package/dist/esm/mask/shader-module.js.map +0 -1
  173. package/dist/esm/path-style/path-style-extension.js +0 -130
  174. package/dist/esm/path-style/path-style-extension.js.map +0 -1
  175. package/dist/esm/path-style/shaders.glsl.js.map +0 -1
  176. package/dist/esm/terrain/height-map-builder.js +0 -86
  177. package/dist/esm/terrain/height-map-builder.js.map +0 -1
  178. package/dist/esm/terrain/shader-module.js +0 -127
  179. package/dist/esm/terrain/shader-module.js.map +0 -1
  180. package/dist/esm/terrain/terrain-cover.js +0 -212
  181. package/dist/esm/terrain/terrain-cover.js.map +0 -1
  182. package/dist/esm/terrain/terrain-effect.js +0 -219
  183. package/dist/esm/terrain/terrain-effect.js.map +0 -1
  184. package/dist/esm/terrain/terrain-extension.js +0 -59
  185. package/dist/esm/terrain/terrain-extension.js.map +0 -1
  186. package/dist/esm/terrain/terrain-pass.js +0 -71
  187. package/dist/esm/terrain/terrain-pass.js.map +0 -1
  188. package/dist/esm/terrain/terrain-picking-pass.js +0 -73
  189. package/dist/esm/terrain/terrain-picking-pass.js.map +0 -1
  190. package/dist/esm/terrain/utils.js +0 -19
  191. package/dist/esm/terrain/utils.js.map +0 -1
  192. package/dist/esm/utils/debug.js +0 -61
  193. package/dist/esm/utils/debug.js.map +0 -1
  194. package/dist/esm/utils/projection-utils.js +0 -134
  195. package/dist/esm/utils/projection-utils.js.map +0 -1
  196. package/typed/data-filter/data-filter-extension.d.ts.map +0 -1
  197. package/typed/data-filter/shader-module.d.ts.map +0 -1
  198. package/typed/index.d.ts +0 -19
  199. package/typed/index.d.ts.map +0 -1
  200. package/typed/mask/mask-effect.d.ts.map +0 -1
  201. package/typed/terrain/height-map-builder.d.ts.map +0 -1
  202. package/typed/terrain/shader-module.d.ts.map +0 -1
  203. package/typed/terrain/terrain-cover.d.ts.map +0 -1
  204. package/typed/terrain/terrain-effect.d.ts.map +0 -1
  205. package/typed/terrain/terrain-pass.d.ts.map +0 -1
  206. package/typed/terrain/terrain-picking-pass.d.ts.map +0 -1
  207. /package/{typed → dist}/brushing/brushing-extension.d.ts +0 -0
  208. /package/{typed → dist}/brushing/brushing-extension.d.ts.map +0 -0
  209. /package/{typed → dist}/clip/clip-extension.d.ts +0 -0
  210. /package/{typed → dist}/clip/clip-extension.d.ts.map +0 -0
  211. /package/{typed → dist}/collision-filter/collision-filter-effect.d.ts +0 -0
  212. /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts +0 -0
  213. /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts.map +0 -0
  214. /package/{typed → dist}/collision-filter/collision-filter-pass.d.ts +0 -0
  215. /package/{typed → dist}/collision-filter/shader-module.d.ts +0 -0
  216. /package/{typed → dist}/collision-filter/shader-module.d.ts.map +0 -0
  217. /package/{typed → dist}/data-filter/aggregator.d.ts +0 -0
  218. /package/{typed → dist}/data-filter/aggregator.d.ts.map +0 -0
  219. /package/{typed → dist}/fill-style/fill-style-extension.d.ts +0 -0
  220. /package/{typed → dist}/fill-style/fill-style-extension.d.ts.map +0 -0
  221. /package/{typed → dist}/fill-style/shaders.glsl.d.ts +0 -0
  222. /package/{typed → dist}/fill-style/shaders.glsl.d.ts.map +0 -0
  223. /package/{typed → dist}/fp64/fp64-extension.d.ts +0 -0
  224. /package/{typed → dist}/fp64/fp64-extension.d.ts.map +0 -0
  225. /package/{typed → dist}/fp64/project64.d.ts +0 -0
  226. /package/{typed → dist}/fp64/project64.d.ts.map +0 -0
  227. /package/{typed → dist}/fp64/project64.glsl.d.ts +0 -0
  228. /package/{typed → dist}/fp64/project64.glsl.d.ts.map +0 -0
  229. /package/{typed → dist}/mask/mask-extension.d.ts +0 -0
  230. /package/{typed → dist}/mask/mask-extension.d.ts.map +0 -0
  231. /package/{typed → dist}/mask/mask-pass.d.ts +0 -0
  232. /package/{typed → dist}/mask/shader-module.d.ts +0 -0
  233. /package/{typed → dist}/mask/shader-module.d.ts.map +0 -0
  234. /package/{typed → dist}/path-style/path-style-extension.d.ts +0 -0
  235. /package/{typed → dist}/path-style/path-style-extension.d.ts.map +0 -0
  236. /package/{typed → dist}/path-style/shaders.glsl.d.ts +0 -0
  237. /package/{typed → dist}/path-style/shaders.glsl.d.ts.map +0 -0
  238. /package/{typed → dist}/terrain/terrain-extension.d.ts +0 -0
  239. /package/{typed → dist}/terrain/terrain-extension.d.ts.map +0 -0
  240. /package/{typed → dist}/terrain/utils.d.ts +0 -0
  241. /package/{typed → dist}/terrain/utils.d.ts.map +0 -0
  242. /package/{typed → dist}/utils/debug.d.ts +0 -0
  243. /package/{typed → dist}/utils/projection-utils.d.ts +0 -0
  244. /package/{typed → dist}/utils/projection-utils.d.ts.map +0 -0
@@ -0,0 +1,194 @@
1
+ import { log } from '@deck.gl/core';
2
+ import { equals } from '@math.gl/core';
3
+ import MaskPass from "./mask-pass.js";
4
+ import { joinLayerBounds, getRenderBounds, makeViewport } from "../utils/projection-utils.js";
5
+ // Class to manage mask effect
6
+ export default class MaskEffect {
7
+ constructor() {
8
+ this.id = 'mask-effect';
9
+ this.props = null;
10
+ this.useInPicking = true;
11
+ this.order = 0;
12
+ this.channels = [];
13
+ this.masks = null;
14
+ }
15
+ preRender(device, { layers, layerFilter, viewports, onViewportActive, views, isPicking }) {
16
+ let didRender = false;
17
+ if (!this.dummyMaskMap) {
18
+ this.dummyMaskMap = device.createTexture({
19
+ width: 1,
20
+ height: 1
21
+ });
22
+ }
23
+ if (isPicking) {
24
+ // Do not update on picking pass
25
+ return { didRender };
26
+ }
27
+ const maskLayers = layers.filter(l => l.props.visible && l.props.operation.includes('mask'));
28
+ if (maskLayers.length === 0) {
29
+ this.masks = null;
30
+ this.channels.length = 0;
31
+ return { didRender };
32
+ }
33
+ this.masks = {};
34
+ if (!this.maskPass) {
35
+ this.maskPass = new MaskPass(device, { id: 'default-mask' });
36
+ this.maskMap = this.maskPass.maskMap;
37
+ }
38
+ // Map layers to channels
39
+ const channelMap = this._sortMaskChannels(maskLayers);
40
+ // TODO - support multiple views
41
+ const viewport = viewports[0];
42
+ const viewportChanged = !this.lastViewport || !this.lastViewport.equals(viewport);
43
+ if (viewport.resolution !== undefined) {
44
+ log.warn('MaskExtension is not supported in GlobeView')();
45
+ return { didRender };
46
+ }
47
+ for (const maskId in channelMap) {
48
+ const result = this._renderChannel(channelMap[maskId], {
49
+ layerFilter,
50
+ onViewportActive,
51
+ views,
52
+ viewport,
53
+ viewportChanged
54
+ });
55
+ didRender ||= result;
56
+ }
57
+ // debugFBO(this.maskMap, {opaque: true});
58
+ return { didRender };
59
+ }
60
+ /* eslint-disable-next-line complexity */
61
+ _renderChannel(channelInfo, { layerFilter, onViewportActive, views, viewport, viewportChanged }) {
62
+ let didRender = false;
63
+ const oldChannelInfo = this.channels[channelInfo.index];
64
+ if (!oldChannelInfo) {
65
+ return didRender;
66
+ }
67
+ const maskChanged =
68
+ // If a channel is new
69
+ channelInfo === oldChannelInfo ||
70
+ // If sublayers have changed
71
+ channelInfo.layers.length !== oldChannelInfo.layers.length ||
72
+ channelInfo.layers.some((layer, i) =>
73
+ // Layer instance is updated
74
+ // Layer props might have changed
75
+ // Undetermined props could have an effect on the output geometry of a mask layer,
76
+ // for example getRadius+updateTriggers, radiusScale, modelMatrix
77
+ layer !== oldChannelInfo.layers[i] ||
78
+ // Some prop is in transition
79
+ layer.props.transitions) ||
80
+ // If a sublayer's positions have been updated, the cached bounds will change shallowly
81
+ channelInfo.layerBounds.some((b, i) => b !== oldChannelInfo.layerBounds[i]);
82
+ channelInfo.bounds = oldChannelInfo.bounds;
83
+ channelInfo.maskBounds = oldChannelInfo.maskBounds;
84
+ this.channels[channelInfo.index] = channelInfo;
85
+ if (maskChanged || viewportChanged) {
86
+ // Recalculate mask bounds
87
+ this.lastViewport = viewport;
88
+ const layerBounds = joinLayerBounds(channelInfo.layers, viewport);
89
+ channelInfo.bounds = layerBounds && getRenderBounds(layerBounds, viewport);
90
+ if (maskChanged || !equals(channelInfo.bounds, oldChannelInfo.bounds)) {
91
+ // Rerender mask FBO
92
+ const { maskPass, maskMap } = this;
93
+ const maskViewport = layerBounds &&
94
+ makeViewport({
95
+ bounds: channelInfo.bounds,
96
+ viewport,
97
+ width: maskMap.width,
98
+ height: maskMap.height,
99
+ border: 1
100
+ });
101
+ channelInfo.maskBounds = maskViewport ? maskViewport.getBounds() : [0, 0, 1, 1];
102
+ // @ts-ignore (2532) This method is only called from preRender where maskPass is defined
103
+ maskPass.render({
104
+ pass: 'mask',
105
+ channel: channelInfo.index,
106
+ layers: channelInfo.layers,
107
+ layerFilter,
108
+ viewports: maskViewport ? [maskViewport] : [],
109
+ onViewportActive,
110
+ views,
111
+ moduleParameters: {
112
+ devicePixelRatio: 1
113
+ }
114
+ });
115
+ didRender = true;
116
+ }
117
+ }
118
+ // @ts-ignore (2532) This method is only called from preRender where masks is defined
119
+ this.masks[channelInfo.id] = {
120
+ index: channelInfo.index,
121
+ bounds: channelInfo.maskBounds,
122
+ coordinateOrigin: channelInfo.coordinateOrigin,
123
+ coordinateSystem: channelInfo.coordinateSystem
124
+ };
125
+ return didRender;
126
+ }
127
+ /**
128
+ * Find a channel to render each mask into
129
+ * If a maskId already exists, diff and update the existing channel
130
+ * Otherwise replace a removed mask
131
+ * Otherwise create a new channel
132
+ * Returns a map from mask layer id to channel info
133
+ */
134
+ _sortMaskChannels(maskLayers) {
135
+ const channelMap = {};
136
+ let channelCount = 0;
137
+ for (const layer of maskLayers) {
138
+ const { id } = layer.root;
139
+ let channelInfo = channelMap[id];
140
+ if (!channelInfo) {
141
+ if (++channelCount > 4) {
142
+ log.warn('Too many mask layers. The max supported is 4')();
143
+ continue; // eslint-disable-line no-continue
144
+ }
145
+ channelInfo = {
146
+ id,
147
+ index: this.channels.findIndex(c => c?.id === id),
148
+ layers: [],
149
+ layerBounds: [],
150
+ coordinateOrigin: layer.root.props.coordinateOrigin,
151
+ coordinateSystem: layer.root.props.coordinateSystem
152
+ };
153
+ channelMap[id] = channelInfo;
154
+ }
155
+ channelInfo.layers.push(layer);
156
+ channelInfo.layerBounds.push(layer.getBounds());
157
+ }
158
+ for (let i = 0; i < 4; i++) {
159
+ const channelInfo = this.channels[i];
160
+ if (!channelInfo || !(channelInfo.id in channelMap)) {
161
+ // The mask id at this channel no longer exists
162
+ this.channels[i] = null;
163
+ }
164
+ }
165
+ for (const maskId in channelMap) {
166
+ const channelInfo = channelMap[maskId];
167
+ if (channelInfo.index < 0) {
168
+ channelInfo.index = this.channels.findIndex(c => !c);
169
+ this.channels[channelInfo.index] = channelInfo;
170
+ }
171
+ }
172
+ return channelMap;
173
+ }
174
+ getModuleParameters() {
175
+ return {
176
+ maskMap: this.masks ? this.maskMap : this.dummyMaskMap,
177
+ maskChannels: this.masks
178
+ };
179
+ }
180
+ cleanup() {
181
+ if (this.dummyMaskMap) {
182
+ this.dummyMaskMap.delete();
183
+ this.dummyMaskMap = undefined;
184
+ }
185
+ if (this.maskPass) {
186
+ this.maskPass.delete();
187
+ this.maskPass = undefined;
188
+ this.maskMap = undefined;
189
+ }
190
+ this.lastViewport = undefined;
191
+ this.masks = null;
192
+ this.channels.length = 0;
193
+ }
194
+ }
@@ -0,0 +1,57 @@
1
+ import { COORDINATE_SYSTEM, LayerExtension, log } from '@deck.gl/core';
2
+ import mask from "./shader-module.js";
3
+ import MaskEffect from "./mask-effect.js";
4
+ const defaultProps = {
5
+ maskId: '',
6
+ maskByInstance: undefined,
7
+ maskInverted: false
8
+ };
9
+ /** Allows layers to show/hide objects by a geofence. */
10
+ export default class MaskExtension extends LayerExtension {
11
+ static { this.defaultProps = defaultProps; }
12
+ static { this.extensionName = 'MaskExtension'; }
13
+ initializeState() {
14
+ this.context.deck?._addDefaultEffect(new MaskEffect());
15
+ }
16
+ getShaders() {
17
+ // Infer by geometry if 'maskByInstance' prop isn't explictly set
18
+ let maskByInstance = 'instancePositions' in this.getAttributeManager().attributes;
19
+ // Users can override by setting the `maskByInstance` prop
20
+ if (this.props.maskByInstance !== undefined) {
21
+ maskByInstance = Boolean(this.props.maskByInstance);
22
+ }
23
+ this.state.maskByInstance = maskByInstance;
24
+ return {
25
+ modules: [mask]
26
+ };
27
+ }
28
+ /* eslint-disable camelcase */
29
+ draw({ uniforms, context, moduleParameters }) {
30
+ uniforms.mask_maskByInstance = this.state.maskByInstance;
31
+ const { maskId, maskInverted } = this.props;
32
+ const { maskChannels } = moduleParameters;
33
+ const { viewport } = context;
34
+ if (maskChannels && maskChannels[maskId]) {
35
+ const { index, bounds, coordinateOrigin: fromCoordinateOrigin } = maskChannels[maskId];
36
+ let { coordinateSystem: fromCoordinateSystem } = maskChannels[maskId];
37
+ uniforms.mask_enabled = true;
38
+ uniforms.mask_channel = index;
39
+ uniforms.mask_inverted = maskInverted;
40
+ if (fromCoordinateSystem === COORDINATE_SYSTEM.DEFAULT) {
41
+ fromCoordinateSystem = viewport.isGeospatial
42
+ ? COORDINATE_SYSTEM.LNGLAT
43
+ : COORDINATE_SYSTEM.CARTESIAN;
44
+ }
45
+ const opts = { modelMatrix: null, fromCoordinateOrigin, fromCoordinateSystem };
46
+ const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);
47
+ const tr = this.projectPosition([bounds[2], bounds[3], 0], opts);
48
+ uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];
49
+ }
50
+ else {
51
+ if (maskId) {
52
+ log.warn(`Could not find a mask layer with id: ${maskId}`)();
53
+ }
54
+ uniforms.mask_enabled = false;
55
+ }
56
+ }
57
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"mask-pass.d.ts","sourceRoot":"","sources":["../../src/mask/mask-pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAGhE,OAAO,EAAC,WAAW,IAAI,UAAU,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAEjF,KAAK,qBAAqB,GAAG,uBAAuB,GAAG;IACrD,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,WAAW,CAAC;gBAEL,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC;IAyBjE,MAAM,CAAC,OAAO,EAAE,qBAAqB;IAkBrC,eAAe,CAAC,KAAK,KAAA;IAIrB,MAAM;CAIP"}
1
+ {"version":3,"file":"mask-pass.d.ts","sourceRoot":"","sources":["../../src/mask/mask-pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAC,WAAW,IAAI,UAAU,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAEjF,KAAK,qBAAqB,GAAG,uBAAuB,GAAG;IACrD,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,WAAW,CAAC;gBAEL,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC;IAyBjE,MAAM,CAAC,OAAO,EAAE,qBAAqB;IAiBrC,eAAe,CAAC,KAAK,KAAA;IAIrB,MAAM;CAIP"}
@@ -0,0 +1,44 @@
1
+ import { GL } from '@luma.gl/constants';
2
+ import { _LayersPass as LayersPass } from '@deck.gl/core';
3
+ export default class MaskPass extends LayersPass {
4
+ constructor(device, props) {
5
+ super(device, props);
6
+ const { mapSize = 2048 } = props;
7
+ this.maskMap = device.createTexture({
8
+ format: 'rgba8unorm',
9
+ width: mapSize,
10
+ height: mapSize,
11
+ sampler: {
12
+ minFilter: 'linear',
13
+ magFilter: 'linear',
14
+ addressModeU: 'clamp-to-edge',
15
+ addressModeV: 'clamp-to-edge'
16
+ }
17
+ });
18
+ this.fbo = device.createFramebuffer({
19
+ id: 'maskmap',
20
+ width: mapSize,
21
+ height: mapSize,
22
+ colorAttachments: [this.maskMap]
23
+ });
24
+ }
25
+ render(options) {
26
+ const colorMask = [false, false, false, false];
27
+ colorMask[options.channel] = true;
28
+ const clearColor = [255, 255, 255, 255];
29
+ return this.device.withParametersWebGL({
30
+ blend: true,
31
+ blendFunc: [GL.ZERO, GL.ONE],
32
+ blendEquation: GL.FUNC_SUBTRACT,
33
+ colorMask,
34
+ depthTest: false
35
+ }, () => super.render({ ...options, clearColor, target: this.fbo, pass: 'mask' }));
36
+ }
37
+ shouldDrawLayer(layer) {
38
+ return layer.props.operation.includes('mask');
39
+ }
40
+ delete() {
41
+ this.fbo.delete();
42
+ this.maskMap.delete();
43
+ }
44
+ }
@@ -35,10 +35,10 @@ bool mask_isInBounds(vec2 texCoords) {
35
35
  }
36
36
  `;
37
37
  const inject = {
38
- 'vs:#decl': `
38
+ 'vs:#decl': `
39
39
  out vec2 mask_texCoords;
40
40
  `,
41
- 'vs:#main-end': `
41
+ 'vs:#main-end': `
42
42
  vec4 mask_common_position;
43
43
  if (mask_maskByInstance) {
44
44
  mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
@@ -47,10 +47,10 @@ out vec2 mask_texCoords;
47
47
  }
48
48
  mask_texCoords = mask_getCoords(mask_common_position);
49
49
  `,
50
- 'fs:#decl': `
50
+ 'fs:#decl': `
51
51
  in vec2 mask_texCoords;
52
52
  `,
53
- 'fs:#main-start': `
53
+ 'fs:#main-start': `
54
54
  if (mask_enabled) {
55
55
  bool mask = mask_isInBounds(mask_texCoords);
56
56
 
@@ -62,23 +62,20 @@ in vec2 mask_texCoords;
62
62
  }
63
63
  `
64
64
  };
65
-
66
- const getMaskUniforms = opts => {
67
- if (opts && 'maskMap' in opts) {
68
- return {
69
- mask_texture: opts.maskMap
70
- };
71
- }
72
-
73
- return {};
65
+ /* eslint-disable camelcase */
66
+ const getMaskUniforms = (opts) => {
67
+ if (opts && 'maskMap' in opts) {
68
+ return {
69
+ mask_texture: opts.maskMap
70
+ };
71
+ }
72
+ return {};
74
73
  };
75
-
76
74
  export default {
77
- name: 'mask',
78
- dependencies: [project],
79
- vs,
80
- fs,
81
- inject,
82
- getUniforms: getMaskUniforms
75
+ name: 'mask',
76
+ dependencies: [project],
77
+ vs,
78
+ fs,
79
+ inject,
80
+ getUniforms: getMaskUniforms
83
81
  };
84
- //# sourceMappingURL=shader-module.js.map
@@ -0,0 +1,111 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { LayerExtension, _mergeShaders as mergeShaders } from '@deck.gl/core';
21
+ import { vec3 } from '@math.gl/core';
22
+ import { dashShaders, offsetShaders } from "./shaders.glsl.js";
23
+ const defaultProps = {
24
+ getDashArray: { type: 'accessor', value: [0, 0] },
25
+ getOffset: { type: 'accessor', value: 0 },
26
+ dashJustified: false,
27
+ dashGapPickable: false
28
+ };
29
+ /** Adds selected features to the `PathLayer` and composite layers that render the `PathLayer`. */
30
+ export default class PathStyleExtension extends LayerExtension {
31
+ static { this.defaultProps = defaultProps; }
32
+ static { this.extensionName = 'PathStyleExtension'; }
33
+ constructor({ dash = false, offset = false, highPrecisionDash = false } = {}) {
34
+ super({ dash: dash || highPrecisionDash, offset, highPrecisionDash });
35
+ }
36
+ isEnabled(layer) {
37
+ return 'pathTesselator' in layer.state;
38
+ }
39
+ getShaders(extension) {
40
+ if (!extension.isEnabled(this)) {
41
+ return null;
42
+ }
43
+ // Merge shader injection
44
+ let result = {};
45
+ if (extension.opts.dash) {
46
+ result = mergeShaders(result, dashShaders);
47
+ }
48
+ if (extension.opts.offset) {
49
+ result = mergeShaders(result, offsetShaders);
50
+ }
51
+ return result;
52
+ }
53
+ initializeState(context, extension) {
54
+ const attributeManager = this.getAttributeManager();
55
+ if (!attributeManager || !extension.isEnabled(this)) {
56
+ // This extension only works with the PathLayer
57
+ return;
58
+ }
59
+ if (extension.opts.dash) {
60
+ attributeManager.addInstanced({
61
+ instanceDashArrays: { size: 2, accessor: 'getDashArray' },
62
+ instanceDashOffsets: extension.opts.highPrecisionDash
63
+ ? {
64
+ size: 1,
65
+ accessor: 'getPath',
66
+ transform: extension.getDashOffsets.bind(this)
67
+ }
68
+ : {
69
+ size: 1,
70
+ update: attribute => {
71
+ attribute.constant = true;
72
+ attribute.value = [0];
73
+ }
74
+ }
75
+ });
76
+ }
77
+ if (extension.opts.offset) {
78
+ attributeManager.addInstanced({
79
+ instanceOffsets: { size: 1, accessor: 'getOffset' }
80
+ });
81
+ }
82
+ }
83
+ updateState(params, extension) {
84
+ if (!extension.isEnabled(this)) {
85
+ return;
86
+ }
87
+ const uniforms = {};
88
+ if (extension.opts.dash) {
89
+ uniforms.dashAlignMode = this.props.dashJustified ? 1 : 0;
90
+ uniforms.dashGapPickable = Boolean(this.props.dashGapPickable);
91
+ }
92
+ this.state.model?.setUniforms(uniforms);
93
+ }
94
+ getDashOffsets(path) {
95
+ const result = [0];
96
+ const positionSize = this.props.positionFormat === 'XY' ? 2 : 3;
97
+ const isNested = Array.isArray(path[0]);
98
+ const geometrySize = isNested ? path.length : path.length / positionSize;
99
+ let p;
100
+ let prevP;
101
+ for (let i = 0; i < geometrySize - 1; i++) {
102
+ p = isNested ? path[i] : path.slice(i * positionSize, i * positionSize + positionSize);
103
+ p = this.projectPosition(p);
104
+ if (i > 0) {
105
+ result[i] = result[i - 1] + vec3.dist(prevP, p);
106
+ }
107
+ prevP = p;
108
+ }
109
+ return result;
110
+ }
111
+ }
@@ -1,23 +1,31 @@
1
1
  export const dashShaders = {
2
- inject: {
3
- 'vs:#decl': `
2
+ inject: {
3
+ 'vs:#decl': `
4
4
  in vec2 instanceDashArrays;
5
5
  in float instanceDashOffsets;
6
6
  out vec2 vDashArray;
7
7
  out float vDashOffset;
8
8
  `,
9
- 'vs:#main-end': `
9
+ 'vs:#main-end': `
10
10
  vDashArray = instanceDashArrays;
11
11
  vDashOffset = instanceDashOffsets / width.x;
12
12
  `,
13
- 'fs:#decl': `
13
+ 'fs:#decl': `
14
14
  uniform float dashAlignMode;
15
15
  uniform float capType;
16
16
  uniform bool dashGapPickable;
17
17
  in vec2 vDashArray;
18
18
  in float vDashOffset;
19
19
  `,
20
- 'fs:#main-start': `
20
+ // if given position is in the gap part of the dashed line
21
+ // dashArray.x: solid stroke length, relative to width
22
+ // dashArray.y: gap length, relative to width
23
+ // alignMode:
24
+ // 0 - no adjustment
25
+ // o---- ---- ---- ---- o---- -o---- ---- o
26
+ // 1 - stretch to fit, draw half dash at each end for nicer joints
27
+ // o-- ---- ---- ---- --o-- --o-- ---- --o
28
+ 'fs:#main-start': `
21
29
  float solidLength = vDashArray.x;
22
30
  float gapLength = vDashArray.y;
23
31
  float unitLength = solidLength + gapLength;
@@ -54,31 +62,30 @@ in float vDashOffset;
54
62
  }
55
63
  }
56
64
  `
57
- }
65
+ }
58
66
  };
59
67
  export const offsetShaders = {
60
- inject: {
61
- 'vs:#decl': `
68
+ inject: {
69
+ 'vs:#decl': `
62
70
  in float instanceOffsets;
63
71
  `,
64
- 'vs:DECKGL_FILTER_SIZE': `
72
+ 'vs:DECKGL_FILTER_SIZE': `
65
73
  float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
66
74
  size *= offsetWidth;
67
75
  `,
68
- 'vs:#main-end': `
76
+ 'vs:#main-end': `
69
77
  float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
70
78
  float offsetDir = sign(instanceOffsets);
71
79
  vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
72
80
  vPathPosition.y *= offsetWidth;
73
81
  vPathLength *= offsetWidth;
74
82
  `,
75
- 'fs:#main-start': `
83
+ 'fs:#main-start': `
76
84
  float isInside;
77
85
  isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
78
86
  if (isInside == 0.0) {
79
87
  discard;
80
88
  }
81
89
  `
82
- }
90
+ }
83
91
  };
84
- //# sourceMappingURL=shaders.glsl.js.map
@@ -1,5 +1,5 @@
1
1
  import { Device, Framebuffer } from '@luma.gl/core';
2
- import { Bounds } from '../utils/projection-utils';
2
+ import { Bounds } from "../utils/projection-utils.js";
3
3
  import type { Viewport, Layer } from '@deck.gl/core';
4
4
  /**
5
5
  * Manages the lifecycle of the height map (a framebuffer that encodes elevation).
@@ -0,0 +1 @@
1
+ {"version":3,"file":"height-map-builder.d.ts","sourceRoot":"","sources":["../../src/terrain/height-map-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAiD,MAAM,EAAC,qCAAkC;AAGjG,OAAO,KAAK,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAInD;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B,6CAA6C;IAC7C,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAQ;IACvC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7B,SAAS,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC;IAC5B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,2BAA2B;IAC3B,OAAO,CAAC,MAAM,CAAe;IAC7B,6BAA6B;IAC7B,OAAO,CAAC,YAAY,CAAuC;IAC3D,mDAAmD;IACnD,OAAO,CAAC,kBAAkB,CAAuB;IACjD,OAAO,CAAC,YAAY,CAAyB;IAE7C,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;gBAI/B,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACH,oBAAoB,IAAI,WAAW,GAAG,IAAI;IAU1C,yEAAyE;IACzE,YAAY,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAE;QAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAC,GAAG,OAAO;IAiEhF,MAAM;CAMP"}
@@ -0,0 +1,104 @@
1
+ import { joinLayerBounds, getRenderBounds, makeViewport } from "../utils/projection-utils.js";
2
+ import { createRenderTarget } from "./utils.js";
3
+ const MAP_MAX_SIZE = 2048;
4
+ /**
5
+ * Manages the lifecycle of the height map (a framebuffer that encodes elevation).
6
+ * One instance of height map is is shared across all layers. It is updated when the viewport changes
7
+ * or when some terrain source layer's data changes.
8
+ * During the draw call of any terrainDrawMode:offset layers,
9
+ * the vertex shader reads from this framebuffer to retrieve its z offset.
10
+ */
11
+ export class HeightMapBuilder {
12
+ static isSupported(device) {
13
+ return device.isTextureFormatRenderable('rgba32float');
14
+ }
15
+ constructor(device) {
16
+ /** Viewport used to draw into the texture */
17
+ this.renderViewport = null;
18
+ /** Bounds of the height map texture, in cartesian space */
19
+ this.bounds = null;
20
+ /** Last rendered layers */
21
+ this.layers = [];
22
+ /** Last layer.getBounds() */
23
+ this.layersBounds = [];
24
+ /** The union of layersBounds in cartesian space */
25
+ this.layersBoundsCommon = null;
26
+ this.lastViewport = null;
27
+ this.device = device;
28
+ }
29
+ /** Returns the height map framebuffer for read/write access.
30
+ * Returns null when the texture is invalid.
31
+ */
32
+ getRenderFramebuffer() {
33
+ if (!this.renderViewport) {
34
+ return null;
35
+ }
36
+ if (!this.fbo) {
37
+ this.fbo = createRenderTarget(this.device, { id: 'height-map', float: true });
38
+ }
39
+ return this.fbo;
40
+ }
41
+ /** Called every render cycle to check if the framebuffer needs update */
42
+ shouldUpdate({ layers, viewport }) {
43
+ const layersChanged = layers.length !== this.layers.length ||
44
+ layers.some((layer, i) =>
45
+ // Layer instance is updated
46
+ // Layer props might have changed
47
+ // Undetermined props could have an effect on the output geometry of a terrain source,
48
+ // for example getElevation+updateTriggers, elevationScale, modelMatrix
49
+ layer !== this.layers[i] ||
50
+ // Some prop is in transition
51
+ layer.props.transitions ||
52
+ // Layer's geometry bounds have changed
53
+ layer.getBounds() !== this.layersBounds[i]);
54
+ if (layersChanged) {
55
+ // Recalculate cached bounds
56
+ this.layers = layers;
57
+ this.layersBounds = layers.map(layer => layer.getBounds());
58
+ this.layersBoundsCommon = joinLayerBounds(layers, viewport);
59
+ }
60
+ const viewportChanged = !this.lastViewport || !viewport.equals(this.lastViewport);
61
+ if (!this.layersBoundsCommon) {
62
+ this.renderViewport = null;
63
+ }
64
+ else if (layersChanged || viewportChanged) {
65
+ const bounds = getRenderBounds(this.layersBoundsCommon, viewport);
66
+ if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) {
67
+ this.renderViewport = null;
68
+ return false;
69
+ }
70
+ this.bounds = bounds;
71
+ this.lastViewport = viewport;
72
+ const scale = viewport.scale;
73
+ const pixelWidth = (bounds[2] - bounds[0]) * scale;
74
+ const pixelHeight = (bounds[3] - bounds[1]) * scale;
75
+ this.renderViewport =
76
+ pixelWidth > 0 || pixelHeight > 0
77
+ ? makeViewport({
78
+ // It's not important whether the geometry is visible in this viewport, because
79
+ // vertices will not use the standard project_to_clipspace in the DRAW_TO_HEIGHT_MAP shader
80
+ // However the viewport must have the same center and zoom as the screen viewport
81
+ // So that projection uniforms used for calculating z are the same
82
+ bounds: [
83
+ viewport.center[0] - 1,
84
+ viewport.center[1] - 1,
85
+ viewport.center[0] + 1,
86
+ viewport.center[1] + 1
87
+ ],
88
+ zoom: viewport.zoom,
89
+ width: Math.min(pixelWidth, MAP_MAX_SIZE),
90
+ height: Math.min(pixelHeight, MAP_MAX_SIZE),
91
+ viewport
92
+ })
93
+ : null;
94
+ return true;
95
+ }
96
+ return false;
97
+ }
98
+ delete() {
99
+ if (this.fbo) {
100
+ this.fbo.colorAttachments[0].delete();
101
+ this.fbo.delete();
102
+ }
103
+ }
104
+ }
@@ -1,7 +1,7 @@
1
1
  import type { ShaderModule } from '@luma.gl/shadertools';
2
2
  import type { Texture } from '@luma.gl/core';
3
- import type { Bounds } from '../utils/projection-utils';
4
- import type { TerrainCover } from './terrain-cover';
3
+ import type { Bounds } from "../utils/projection-utils.js";
4
+ import type { TerrainCover } from "./terrain-cover.js";
5
5
  /** Module parameters expected by the terrain shader module */
6
6
  export type TerrainModuleSettings = {
7
7
  picking: {