@deck.gl/extensions 9.0.0-alpha.6 → 9.0.0-beta.1
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/dist.dev.js +2680 -2548
- package/dist/es5/brushing/shader-module.js +2 -2
- package/dist/es5/brushing/shader-module.js.map +1 -1
- package/dist/es5/clip/clip-extension.js +4 -4
- package/dist/es5/clip/clip-extension.js.map +1 -1
- package/dist/es5/collision-filter/collision-filter-pass.js +4 -2
- package/dist/es5/collision-filter/collision-filter-pass.js.map +1 -1
- package/dist/es5/collision-filter/shader-module.js +1 -1
- package/dist/es5/collision-filter/shader-module.js.map +1 -1
- package/dist/es5/data-filter/aggregator.js +2 -2
- package/dist/es5/data-filter/aggregator.js.map +1 -1
- package/dist/es5/data-filter/shader-module.js +2 -2
- package/dist/es5/data-filter/shader-module.js.map +1 -1
- package/dist/es5/fill-style/shaders.glsl.js +3 -3
- package/dist/es5/fill-style/shaders.glsl.js.map +1 -1
- package/dist/es5/fp64/project64.js.map +1 -1
- package/dist/es5/mask/shader-module.js +4 -4
- package/dist/es5/mask/shader-module.js.map +1 -1
- package/dist/es5/path-style/shaders.glsl.js +4 -4
- package/dist/es5/path-style/shaders.glsl.js.map +1 -1
- package/dist/es5/terrain/shader-module.js +8 -6
- package/dist/es5/terrain/shader-module.js.map +1 -1
- package/dist/esm/brushing/shader-module.js +4 -4
- package/dist/esm/brushing/shader-module.js.map +1 -1
- package/dist/esm/clip/clip-extension.js +4 -4
- package/dist/esm/clip/clip-extension.js.map +1 -1
- package/dist/esm/collision-filter/collision-filter-pass.js +4 -2
- package/dist/esm/collision-filter/collision-filter-pass.js.map +1 -1
- package/dist/esm/collision-filter/shader-module.js +3 -3
- package/dist/esm/collision-filter/shader-module.js.map +1 -1
- package/dist/esm/data-filter/aggregator.js +11 -7
- package/dist/esm/data-filter/aggregator.js.map +1 -1
- package/dist/esm/data-filter/shader-module.js +4 -4
- package/dist/esm/data-filter/shader-module.js.map +1 -1
- package/dist/esm/fill-style/shaders.glsl.js +10 -10
- package/dist/esm/fill-style/shaders.glsl.js.map +1 -1
- package/dist/esm/fp64/project64.js.map +1 -1
- package/dist/esm/mask/shader-module.js +5 -5
- package/dist/esm/mask/shader-module.js.map +1 -1
- package/dist/esm/path-style/shaders.glsl.js +9 -13
- package/dist/esm/path-style/shaders.glsl.js.map +1 -1
- package/dist/esm/terrain/shader-module.js +8 -6
- package/dist/esm/terrain/shader-module.js.map +1 -1
- package/dist.min.js +140 -143
- package/package.json +8 -8
- package/src/brushing/shader-module.ts +6 -5
- package/src/clip/clip-extension.ts +6 -5
- package/src/collision-filter/collision-filter-pass.ts +4 -2
- package/src/collision-filter/shader-module.ts +4 -4
- package/src/data-filter/aggregator.ts +11 -7
- package/src/data-filter/shader-module.ts +5 -6
- package/src/fill-style/shaders.glsl.ts +12 -11
- package/src/fp64/project64.ts +2 -1
- package/src/mask/shader-module.ts +6 -6
- package/src/path-style/shaders.glsl.ts +9 -13
- package/src/terrain/shader-module.ts +8 -8
- package/typed/brushing/brushing-extension.d.ts +1 -1
- package/typed/brushing/brushing-extension.d.ts.map +1 -1
- package/typed/brushing/shader-module.d.ts +3 -2
- package/typed/brushing/shader-module.d.ts.map +1 -1
- package/typed/clip/clip-extension.d.ts +4 -3
- package/typed/clip/clip-extension.d.ts.map +1 -1
- package/typed/collision-filter/collision-filter-extension.d.ts +1 -1
- package/typed/collision-filter/collision-filter-extension.d.ts.map +1 -1
- package/typed/collision-filter/collision-filter-pass.d.ts +5 -3
- package/typed/collision-filter/collision-filter-pass.d.ts.map +1 -1
- package/typed/collision-filter/shader-module.d.ts +2 -2
- package/typed/collision-filter/shader-module.d.ts.map +1 -1
- package/typed/data-filter/aggregator.d.ts.map +1 -1
- package/typed/data-filter/data-filter-extension.d.ts +2 -2
- package/typed/data-filter/data-filter-extension.d.ts.map +1 -1
- package/typed/data-filter/shader-module.d.ts +2 -2
- package/typed/data-filter/shader-module.d.ts.map +1 -1
- package/typed/fill-style/fill-style-extension.d.ts +2 -2
- package/typed/fill-style/fill-style-extension.d.ts.map +1 -1
- package/typed/fill-style/shaders.glsl.d.ts +3 -2
- package/typed/fill-style/shaders.glsl.d.ts.map +1 -1
- package/typed/fp64/project64.d.ts +3 -2
- package/typed/fp64/project64.d.ts.map +1 -1
- package/typed/mask/mask-effect.d.ts +2 -2
- package/typed/mask/mask-effect.d.ts.map +1 -1
- package/typed/mask/mask-extension.d.ts +1 -1
- package/typed/mask/mask-extension.d.ts.map +1 -1
- package/typed/mask/mask-pass.d.ts +1 -1
- package/typed/mask/mask-pass.d.ts.map +1 -1
- package/typed/mask/shader-module.d.ts +2 -2
- package/typed/mask/shader-module.d.ts.map +1 -1
- package/typed/path-style/path-style-extension.d.ts +2 -2
- package/typed/path-style/path-style-extension.d.ts.map +1 -1
- package/typed/path-style/shaders.glsl.d.ts.map +1 -1
- package/typed/terrain/shader-module.d.ts +5 -3
- package/typed/terrain/shader-module.d.ts.map +1 -1
- package/typed/terrain/terrain-extension.d.ts +1 -1
- package/typed/terrain/terrain-extension.d.ts.map +1 -1
- package/typed/terrain/terrain-pass.d.ts +1 -1
- package/typed/terrain/terrain-pass.d.ts.map +1 -1
- package/typed/terrain/terrain-picking-pass.d.ts +1 -1
- package/typed/terrain/terrain-picking-pass.d.ts.map +1 -1
- package/typed/utils/projection-utils.d.ts +1 -1
- package/typed/utils/projection-utils.d.ts.map +1 -1
|
@@ -16,7 +16,7 @@ export const terrainModule = {
|
|
|
16
16
|
uniform float terrain_mode;
|
|
17
17
|
uniform sampler2D terrain_map;
|
|
18
18
|
uniform vec4 terrain_bounds;
|
|
19
|
-
|
|
19
|
+
out vec3 commonPos;
|
|
20
20
|
${TERRAIN_MODE_CONSTANTS}
|
|
21
21
|
`,
|
|
22
22
|
'vs:#main-start': `
|
|
@@ -38,7 +38,7 @@ if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
|
|
|
38
38
|
vec3 anchorCommon = project_position(anchor);
|
|
39
39
|
vec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;
|
|
40
40
|
if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {
|
|
41
|
-
float terrainZ =
|
|
41
|
+
float terrainZ = texture(terrain_map, texCoords).r;
|
|
42
42
|
geometry.position.z += terrainZ;
|
|
43
43
|
position = project_common_position_to_clipspace(geometry.position);
|
|
44
44
|
}
|
|
@@ -48,19 +48,19 @@ if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
|
|
|
48
48
|
uniform float terrain_mode;
|
|
49
49
|
uniform sampler2D terrain_map;
|
|
50
50
|
uniform vec4 terrain_bounds;
|
|
51
|
-
|
|
51
|
+
in vec3 commonPos;
|
|
52
52
|
${TERRAIN_MODE_CONSTANTS}
|
|
53
53
|
`,
|
|
54
54
|
'fs:#main-start': `
|
|
55
55
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
56
|
-
|
|
56
|
+
fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
`,
|
|
60
60
|
'fs:DECKGL_FILTER_COLOR': `
|
|
61
61
|
if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {
|
|
62
62
|
vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
|
|
63
|
-
vec4 pixel =
|
|
63
|
+
vec4 pixel = texture(terrain_map, texCoords);
|
|
64
64
|
if (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {
|
|
65
65
|
color = pixel;
|
|
66
66
|
} else {
|
|
@@ -97,7 +97,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
97
97
|
sampler = heightMap;
|
|
98
98
|
bounds = heightMapBounds;
|
|
99
99
|
} else if (terrainCover) {
|
|
100
|
-
|
|
100
|
+
var _opts$picking;
|
|
101
|
+
|
|
102
|
+
const isPicking = (_opts$picking = opts.picking) === null || _opts$picking === void 0 ? void 0 : _opts$picking.isActive;
|
|
101
103
|
sampler = isPicking ? terrainCover.getPickingFramebuffer() : terrainCover.getRenderFramebuffer();
|
|
102
104
|
|
|
103
105
|
if (isPicking) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/terrain/shader-module.ts"],"names":["project","TERRAIN_MODE","NONE","WRITE_HEIGHT_MAP","USE_HEIGHT_MAP","USE_COVER","USE_COVER_ONLY","SKIP","TERRAIN_MODE_CONSTANTS","Object","keys","map","key","join","terrainModule","name","dependencies","inject","getUniforms","opts","uniforms","drawToTerrainHeightMap","heightMap","heightMapBounds","dummyHeightMap","terrainCover","useTerrainHeightMap","terrainSkipRender","project_uCommonOrigin","mode","sampler","bounds","isPicking","
|
|
1
|
+
{"version":3,"sources":["../../../src/terrain/shader-module.ts"],"names":["project","TERRAIN_MODE","NONE","WRITE_HEIGHT_MAP","USE_HEIGHT_MAP","USE_COVER","USE_COVER_ONLY","SKIP","TERRAIN_MODE_CONSTANTS","Object","keys","map","key","join","terrainModule","name","dependencies","inject","getUniforms","opts","uniforms","drawToTerrainHeightMap","heightMap","heightMapBounds","dummyHeightMap","terrainCover","useTerrainHeightMap","terrainSkipRender","project_uCommonOrigin","mode","sampler","bounds","isPicking","picking","isActive","getPickingFramebuffer","getRenderFramebuffer","terrain_mode","terrain_map","terrain_bounds"],"mappings":"AAGA,SAAQA,OAAR,QAAsB,eAAtB;AAmBA,OAAO,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,CADoB;AAG1BC,EAAAA,gBAAgB,EAAE,CAHQ;AAK1BC,EAAAA,cAAc,EAAE,CALU;AAO1BC,EAAAA,SAAS,EAAE,CAPe;AAS1BC,EAAAA,cAAc,EAAE,CATU;AAW1BC,EAAAA,IAAI,EAAE;AAXoB,CA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AI,CAAJ,EAAO,CAAP,EAAU,CAAV;AAXC,OAAP;AAaD;;AACD,WAAO,IAAP;AACD;AA5H0B,CAAtB","sourcesContent":["/* eslint-disable camelcase */\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\nimport {project} from '@deck.gl/core';\n\nimport type {Texture} from '@luma.gl/core';\nimport type {Bounds} from '../utils/projection-utils';\nimport type {TerrainCover} from './terrain-cover';\n\n/** Module parameters expected by the terrain shader module */\nexport type TerrainModuleSettings = {\n picking: {isActive?: boolean};\n heightMap: Texture | null;\n heightMapBounds?: Bounds | null;\n dummyHeightMap: Texture;\n terrainCover?: TerrainCover | null;\n drawToTerrainHeightMap?: boolean;\n useTerrainHeightMap?: boolean;\n terrainSkipRender?: boolean;\n};\n\n/** A model can have one of the following modes */\nexport const TERRAIN_MODE = {\n NONE: 0,\n /** A terrain layer rendering encoded ground elevation into the height map */\n WRITE_HEIGHT_MAP: 1,\n /** An offset layer reading encoded ground elevation from the height map */\n USE_HEIGHT_MAP: 2,\n /** A terrain layer rendering to screen, using the cover fbo overlaid with its own texture */\n USE_COVER: 3,\n /** A terrain layer rendering to screen, using the cover fbo as texture */\n USE_COVER_ONLY: 4,\n /** Draped layer is rendered into a texture, and never to screen */\n SKIP: 5\n};\n\nconst TERRAIN_MODE_CONSTANTS = Object.keys(TERRAIN_MODE)\n .map(key => `const float TERRAIN_MODE_${key} = ${TERRAIN_MODE[key]}.0;`)\n .join('\\n');\n\n// @ts-expect-error\nexport const terrainModule = {\n name: 'terrain',\n dependencies: [project],\n inject: {\n 'vs:#decl': `\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nout vec3 commonPos;\n${TERRAIN_MODE_CONSTANTS}\n `,\n 'vs:#main-start': `\nif (terrain_mode == TERRAIN_MODE_SKIP) {\n gl_Position = vec4(0.0);\n return;\n}\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\ncommonPos = geometry.position.xyz;\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\n vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\n position = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);\n commonPos.z += project_uCommonOrigin.z;\n}\nif (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {\n vec3 anchor = geometry.worldPosition;\n anchor.z = 0.0;\n vec3 anchorCommon = project_position(anchor);\n vec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;\n if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {\n float terrainZ = texture(terrain_map, texCoords).r;\n geometry.position.z += terrainZ;\n position = project_common_position_to_clipspace(geometry.position);\n }\n}\n `,\n 'fs:#decl': `\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nin vec3 commonPos;\n${TERRAIN_MODE_CONSTANTS}\n `,\n 'fs:#main-start': `\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\n fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);\n return;\n}\n `,\n 'fs:DECKGL_FILTER_COLOR': `\nif ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {\n vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\n vec4 pixel = texture(terrain_map, texCoords);\n if (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {\n color = pixel;\n } else {\n // pixel is premultiplied\n color = pixel + color * (1.0 - pixel.a);\n }\n return;\n}\n `\n },\n // eslint-disable-next-line complexity\n getUniforms: (opts: Partial<TerrainModuleSettings> = {}, uniforms) => {\n if ('dummyHeightMap' in opts) {\n const {\n drawToTerrainHeightMap,\n heightMap,\n heightMapBounds,\n dummyHeightMap,\n terrainCover,\n useTerrainHeightMap,\n terrainSkipRender\n } = opts;\n const {project_uCommonOrigin} = uniforms;\n\n let mode: number = terrainSkipRender ? TERRAIN_MODE.SKIP : TERRAIN_MODE.NONE;\n // height map if case USE_HEIGHT_MAP, terrain cover if USE_COVER, otherwise empty\n let sampler = dummyHeightMap as Texture;\n // height map bounds if case USE_HEIGHT_MAP, terrain cover bounds if USE_COVER, otherwise null\n let bounds: number[] | null = null;\n if (drawToTerrainHeightMap) {\n mode = TERRAIN_MODE.WRITE_HEIGHT_MAP;\n bounds = heightMapBounds!;\n } else if (useTerrainHeightMap && heightMap) {\n mode = TERRAIN_MODE.USE_HEIGHT_MAP;\n sampler = heightMap;\n bounds = heightMapBounds!;\n } else if (terrainCover) {\n // This is a terrain layer\n const isPicking = opts.picking?.isActive;\n // @ts-expect-error\n sampler = isPicking\n ? terrainCover.getPickingFramebuffer()\n : terrainCover.getRenderFramebuffer();\n if (isPicking) {\n // Never render the layer itself in picking pass\n mode = TERRAIN_MODE.SKIP;\n }\n if (sampler) {\n mode = mode === TERRAIN_MODE.SKIP ? TERRAIN_MODE.USE_COVER_ONLY : TERRAIN_MODE.USE_COVER;\n bounds = terrainCover.bounds;\n } else {\n sampler = dummyHeightMap!;\n }\n }\n\n /* eslint-disable camelcase */\n return {\n terrain_mode: mode,\n terrain_map: sampler,\n // Convert bounds to the common space, as [minX, minY, width, height]\n terrain_bounds: bounds\n ? [\n bounds[0] - project_uCommonOrigin[0],\n bounds[1] - project_uCommonOrigin[1],\n bounds[2] - bounds[0],\n bounds[3] - bounds[1]\n ]\n : [0, 0, 0, 0]\n };\n }\n return null;\n }\n} as ShaderModule<TerrainModuleSettings>;\n"],"file":"shader-module.js"}
|