@kepler.gl/effects 3.3.0-alpha.23 → 3.3.0-alpha.25
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/cjs/animation-utils.js +1 -1
- package/dist/cjs/animation-utils.js.map +1 -1
- package/dist/cjs/custom-deck-lighting-effect.js +143 -18
- package/dist/cjs/custom-deck-lighting-effect.js.map +1 -1
- package/dist/custom-deck-lighting-effect.d.ts +2 -1
- package/dist/esm/animation-utils.js +1 -1
- package/dist/esm/animation-utils.js.map +1 -1
- package/dist/esm/custom-deck-lighting-effect.js +144 -19
- package/dist/esm/custom-deck-lighting-effect.js.map +1 -1
- package/package.json +5 -5
|
@@ -16,7 +16,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
16
16
|
// SPDX-License-Identifier: MIT
|
|
17
17
|
// Copyright contributors to the kepler.gl project
|
|
18
18
|
|
|
19
|
-
var NON_ANIMATABLE_PARAMETERS = new Set(['animateHeight', 'heightEnd', 'linearEasing']);
|
|
19
|
+
var NON_ANIMATABLE_PARAMETERS = new Set(['animateHeight', 'heightEnd', 'linearEasing', 'shadowMapResolution']);
|
|
20
20
|
var MAX_DATE_TIMESTAMP = 8.64e15;
|
|
21
21
|
function isAnimatableParameter(description) {
|
|
22
22
|
var name = description.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-utils.js","names":["NON_ANIMATABLE_PARAMETERS","Set","MAX_DATE_TIMESTAMP","isAnimatableParameter","description","name","type","min","max","defaultValue","startsWith","has","Number","isFinite","Array","isArray","length","every","undefined","getAnimatableEffectParameters","effect","getParameterDescriptions","filter","validateEffectAnimation","animation","descriptions","_typeof2","result","_iterator","_createForOfIteratorHelper","_step","_loop","value","Object","prototype","hasOwnProperty","call","entry","easing","clampValue","Math","validateValue","from","map","abs","endValue","hasStart","startValue","_objectSpread","_ret","s","n","done","err","e","f","keys"],"sources":["../../src/animation-utils.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport type {Effect, EffectAnimation, EffectParameterDescription} from '@kepler.gl/types';\n\nconst NON_ANIMATABLE_PARAMETERS = new Set(['animateHeight'
|
|
1
|
+
{"version":3,"file":"animation-utils.js","names":["NON_ANIMATABLE_PARAMETERS","Set","MAX_DATE_TIMESTAMP","isAnimatableParameter","description","name","type","min","max","defaultValue","startsWith","has","Number","isFinite","Array","isArray","length","every","undefined","getAnimatableEffectParameters","effect","getParameterDescriptions","filter","validateEffectAnimation","animation","descriptions","_typeof2","result","_iterator","_createForOfIteratorHelper","_step","_loop","value","Object","prototype","hasOwnProperty","call","entry","easing","clampValue","Math","validateValue","from","map","abs","endValue","hasStart","startValue","_objectSpread","_ret","s","n","done","err","e","f","keys"],"sources":["../../src/animation-utils.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport type {Effect, EffectAnimation, EffectParameterDescription} from '@kepler.gl/types';\n\nconst NON_ANIMATABLE_PARAMETERS = new Set([\n 'animateHeight',\n 'heightEnd',\n 'linearEasing',\n 'shadowMapResolution'\n]);\nconst MAX_DATE_TIMESTAMP = 8.64e15;\n\nfunction isAnimatableParameter(description: EffectParameterDescription): boolean {\n const {name, type, min, max, defaultValue} = description;\n if (\n name.startsWith('_') ||\n NON_ANIMATABLE_PARAMETERS.has(name) ||\n !Number.isFinite(min) ||\n !Number.isFinite(max) ||\n min > max\n ) {\n return false;\n }\n if (type === 'array' || type === 'color') {\n return (\n Array.isArray(defaultValue) && defaultValue.length > 0 && defaultValue.every(Number.isFinite)\n );\n }\n return type === undefined || type === 'number';\n}\n\nexport function getAnimatableEffectParameters(\n effect: Pick<Effect, 'getParameterDescriptions'>\n): EffectParameterDescription[] {\n return effect.getParameterDescriptions().filter(isAnimatableParameter);\n}\n\n/** Validate optional endpoints without creating animations for missing or invalid values. */\nexport function validateEffectAnimation(\n animation: unknown,\n descriptions: EffectParameterDescription[]\n): EffectAnimation | undefined {\n if (!animation || typeof animation !== 'object' || Array.isArray(animation)) {\n return undefined;\n }\n\n const result: EffectAnimation = {};\n for (const description of descriptions.filter(isAnimatableParameter)) {\n const {name, type, min, max, defaultValue} = description;\n if (!Object.prototype.hasOwnProperty.call(animation, name)) continue;\n const entry = (\n animation as Record<string, {startValue?: unknown; endValue?: unknown; easing?: unknown}>\n )[name];\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) continue;\n if (entry.easing !== 'linear' && entry.easing !== 'easeInOut') continue;\n\n const clampValue = (value: number) => Math.max(min, Math.min(max, value));\n const validateValue = (value: unknown): number | number[] | undefined => {\n if (type === 'array' || type === 'color') {\n if (\n !Array.isArray(value) ||\n value.length !== (defaultValue as number[]).length ||\n !Array.from(value).every(Number.isFinite)\n ) {\n return undefined;\n }\n return value.map(clampValue);\n }\n if (\n typeof value !== 'number' ||\n !Number.isFinite(value) ||\n (name === 'timestamp' && Math.abs(value) > MAX_DATE_TIMESTAMP)\n ) {\n return undefined;\n }\n return clampValue(value);\n };\n const endValue = validateValue(entry.endValue);\n const hasStart = Object.prototype.hasOwnProperty.call(entry, 'startValue');\n const startValue = hasStart ? validateValue(entry.startValue) : undefined;\n if (endValue === undefined || (hasStart && startValue === undefined)) continue;\n result[name] = {\n ...(hasStart ? {startValue} : {}),\n endValue,\n easing: entry.easing\n };\n }\n return Object.keys(result).length ? result : undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;AAIA,IAAMA,yBAAyB,GAAG,IAAIC,GAAG,CAAC,CACxC,eAAe,EACf,WAAW,EACX,cAAc,EACd,qBAAqB,CACtB,CAAC;AACF,IAAMC,kBAAkB,GAAG,OAAO;AAElC,SAASC,qBAAqBA,CAACC,WAAuC,EAAW;EAC/E,IAAOC,IAAI,GAAkCD,WAAW,CAAjDC,IAAI;IAAEC,IAAI,GAA4BF,WAAW,CAA3CE,IAAI;IAAEC,GAAG,GAAuBH,WAAW,CAArCG,GAAG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AACZ,KAAK,CAAC,GAAG9B,kBAAmB,EAC9D;YACA,OAAOgB,SAAS;UAClB;UACA,OAAOqB,UAAU,CAACP,KAAK,CAAC;QAC1B,CAAC;QACD,IAAMa,QAAQ,GAAGJ,aAAa,CAACJ,KAAK,CAACQ,QAAQ,CAAC;QAC9C,IAAMC,QAAQ,GAAGb,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACC,KAAK,EAAE,YAAY,CAAC;QAC1E,IAAMU,UAAU,GAAGD,QAAQ,GAAGL,aAAa,CAACJ,KAAK,CAACU,UAAU,CAAC,GAAG7B,SAAS;QACzE,IAAI2B,QAAQ,KAAK3B,SAAS,IAAK4B,QAAQ,IAAIC,UAAU,KAAK7B,SAAU;QACpES,MAAM,CAACtB,IAAI,CAAC,GAAA2C,aAAA,CAAAA,aAAA,KACNF,QAAQ,GAAG;UAACC,UAAU,EAAVA;QAAU,CAAC,GAAG,CAAC,CAAC;UAChCF,QAAQ,EAARA,QAAQ;UACRP,MAAM,EAAED,KAAK,CAACC;QAAM,EACrB;MACH,CAAC;MAAAW,IAAA;IAvCD,KAAArB,SAAA,CAAAsB,CAAA,MAAApB,KAAA,GAAAF,SAAA,CAAAuB,CAAA,IAAAC,IAAA;MAAAH,IAAA,GAAAlB,KAAA;MAAA,IAAAkB,IAAA,QAE8D;IAAS;EAqCtE,SAAAI,GAAA;IAAAzB,SAAA,CAAA0B,CAAA,CAAAD,GAAA;EAAA;IAAAzB,SAAA,CAAA2B,CAAA;EAAA;EACD,OAAOtB,MAAM,CAACuB,IAAI,CAAC7B,MAAM,CAAC,CAACX,MAAM,GAAGW,MAAM,GAAGT,SAAS;AACxD","ignoreList":[]}
|
|
@@ -18,12 +18,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
18
18
|
var _core = require("@deck.gl/core");
|
|
19
19
|
var _constants = require("@kepler.gl/constants");
|
|
20
20
|
var _tileViewportFix = require("./tile-viewport-fix");
|
|
21
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
22
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
23
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
24
21
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
25
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
23
|
function _superPropGet(t, o, e, r) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
24
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
25
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
26
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // SPDX-License-Identifier: MIT
|
|
29
29
|
// Copyright contributors to the kepler.gl project
|
|
@@ -55,6 +55,69 @@ function patchShadowPassDepth(pass) {
|
|
|
55
55
|
|
|
56
56
|
/** Extended shadow module props with our custom field. */
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* ShadowPass exclusively owns its attachments, but passes them to luma as
|
|
60
|
+
* external textures. In luma 9.4.2 framebuffer.resize tracks the replacement
|
|
61
|
+
* color view, not its texture. A quality toggle otherwise leaks that texture.
|
|
62
|
+
*/
|
|
63
|
+
function ownShadowAttachments(fbo) {
|
|
64
|
+
var getTextures = function getTextures() {
|
|
65
|
+
var _fbo$colorAttachments, _fbo$depthStencilAtta;
|
|
66
|
+
var color = (_fbo$colorAttachments = fbo.colorAttachments[0]) === null || _fbo$colorAttachments === void 0 ? void 0 : _fbo$colorAttachments.texture;
|
|
67
|
+
var depth = (_fbo$depthStencilAtta = fbo.depthStencilAttachment) === null || _fbo$depthStencilAtta === void 0 ? void 0 : _fbo$depthStencilAtta.texture;
|
|
68
|
+
return [color, depth].filter(function (texture) {
|
|
69
|
+
return Boolean(texture);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
var _iterator = _createForOfIteratorHelper(getTextures()),
|
|
73
|
+
_step;
|
|
74
|
+
try {
|
|
75
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
76
|
+
var texture = _step.value;
|
|
77
|
+
fbo.attachResource(texture);
|
|
78
|
+
}
|
|
79
|
+
} catch (err) {
|
|
80
|
+
_iterator.e(err);
|
|
81
|
+
} finally {
|
|
82
|
+
_iterator.f();
|
|
83
|
+
}
|
|
84
|
+
var resize = fbo.resize.bind(fbo);
|
|
85
|
+
fbo.resize = function (size) {
|
|
86
|
+
var previous = getTextures();
|
|
87
|
+
try {
|
|
88
|
+
if (Array.isArray(size)) resize(size);else if (size) resize(size);else resize();
|
|
89
|
+
} finally {
|
|
90
|
+
var current = getTextures();
|
|
91
|
+
var _iterator2 = _createForOfIteratorHelper(previous),
|
|
92
|
+
_step2;
|
|
93
|
+
try {
|
|
94
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
95
|
+
var texture = _step2.value;
|
|
96
|
+
if (!current.includes(texture)) {
|
|
97
|
+
fbo.destroyAttachedResource(texture);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} catch (err) {
|
|
101
|
+
_iterator2.e(err);
|
|
102
|
+
} finally {
|
|
103
|
+
_iterator2.f();
|
|
104
|
+
}
|
|
105
|
+
var _iterator3 = _createForOfIteratorHelper(current),
|
|
106
|
+
_step3;
|
|
107
|
+
try {
|
|
108
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
109
|
+
var _texture = _step3.value;
|
|
110
|
+
fbo.attachResource(_texture);
|
|
111
|
+
}
|
|
112
|
+
} catch (err) {
|
|
113
|
+
_iterator3.e(err);
|
|
114
|
+
} finally {
|
|
115
|
+
_iterator3.f();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
58
121
|
/**
|
|
59
122
|
* Video export shares MapLibre's canvas. Luma's cssToDeviceRatio() can lag that
|
|
60
123
|
* bitmap, so ShadowPass draws into a corner of its FBO and the rest samples as
|
|
@@ -62,13 +125,62 @@ function patchShadowPassDepth(pass) {
|
|
|
62
125
|
* afterward so the color pass / basemap stay aligned.
|
|
63
126
|
*/
|
|
64
127
|
function alignExportShadowPass(shadowPass, isExportMode) {
|
|
128
|
+
var getResolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
129
|
+
return _constants.SHADOW_MAP_RESOLUTIONS.auto;
|
|
130
|
+
};
|
|
65
131
|
var render = shadowPass.render.bind(shadowPass);
|
|
132
|
+
var ownsAttachments = false;
|
|
66
133
|
shadowPass.render = function (params) {
|
|
67
|
-
var _shadowPass$device, _shadowPass$device2, _params$
|
|
68
|
-
if (!isExportMode())
|
|
134
|
+
var _shadowPass$device, _shadowPass$device2, _params$viewports2, _gl$getParameter, _gl$DEPTH_RANGE, _gl$depthRange;
|
|
135
|
+
if (!isExportMode()) {
|
|
136
|
+
var _params$viewports, _device$limits$maxTex, _device$limits;
|
|
137
|
+
var scale = getResolution();
|
|
138
|
+
if (scale !== _constants.SHADOW_MAP_RESOLUTIONS.low && scale !== _constants.SHADOW_MAP_RESOLUTIONS.high) {
|
|
139
|
+
return render(params);
|
|
140
|
+
}
|
|
141
|
+
var _device = shadowPass.device;
|
|
142
|
+
var _canvasContext = _device === null || _device === void 0 ? void 0 : _device.canvasContext;
|
|
143
|
+
var _viewport = params === null || params === void 0 || (_params$viewports = params.viewports) === null || _params$viewports === void 0 ? void 0 : _params$viewports[0];
|
|
144
|
+
if ((_device === null || _device === void 0 ? void 0 : _device.type) !== 'webgl' || !_canvasContext || params.viewports.length !== 1 || !(_viewport !== null && _viewport !== void 0 && _viewport.width) || !_viewport.height || _viewport.x || _viewport.y) {
|
|
145
|
+
return render(params);
|
|
146
|
+
}
|
|
147
|
+
var _prevSize = _canvasContext.getDrawingBufferSize;
|
|
148
|
+
var _prevRatio = _canvasContext.cssToDeviceRatio;
|
|
149
|
+
var ratio = _prevRatio.call(_canvasContext);
|
|
150
|
+
var _width = _viewport.width,
|
|
151
|
+
_height = _viewport.height;
|
|
152
|
+
if (!Number.isFinite(ratio) || ratio <= 0 || _width * ratio * scale < 1 || _height * ratio * scale < 1) {
|
|
153
|
+
return render(params);
|
|
154
|
+
}
|
|
155
|
+
// Never increase to more than ~48 MiB of raw RGBA8 + depth16 per map.
|
|
156
|
+
// If Auto already exceeds the bound, High must not reduce its quality.
|
|
157
|
+
var limit = Math.min((_device$limits$maxTex = (_device$limits = _device.limits) === null || _device$limits === void 0 ? void 0 : _device$limits.maxTextureDimension2D) !== null && _device$limits$maxTex !== void 0 ? _device$limits$maxTex : 4096, 4096);
|
|
158
|
+
var maxRatio = Math.min(limit / _width, limit / _height, Math.sqrt(8e6 / (_width * _height)));
|
|
159
|
+
var scaledRatio = scale === _constants.SHADOW_MAP_RESOLUTIONS.high ? Math.max(ratio, Math.min(ratio * scale, maxRatio)) : ratio * scale;
|
|
160
|
+
if (!Number.isFinite(scaledRatio) || scaledRatio === ratio) return render(params);
|
|
161
|
+
if (!ownsAttachments && shadowPass.fbo) {
|
|
162
|
+
ownShadowAttachments(shadowPass.fbo);
|
|
163
|
+
ownsAttachments = true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ShadowPass and LayersPass must see the same ratio: one allocates the
|
|
167
|
+
// texture, the other scales its viewport. Color and picking keep Auto.
|
|
168
|
+
_canvasContext.getDrawingBufferSize = function () {
|
|
169
|
+
return [Math.floor(_width * scaledRatio), Math.floor(_height * scaledRatio)];
|
|
170
|
+
};
|
|
171
|
+
_canvasContext.cssToDeviceRatio = function () {
|
|
172
|
+
return scaledRatio;
|
|
173
|
+
};
|
|
174
|
+
try {
|
|
175
|
+
return render(params);
|
|
176
|
+
} finally {
|
|
177
|
+
_canvasContext.getDrawingBufferSize = _prevSize;
|
|
178
|
+
_canvasContext.cssToDeviceRatio = _prevRatio;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
69
181
|
var gl = (_shadowPass$device = shadowPass.device) === null || _shadowPass$device === void 0 ? void 0 : _shadowPass$device.gl;
|
|
70
182
|
var canvasContext = (_shadowPass$device2 = shadowPass.device) === null || _shadowPass$device2 === void 0 ? void 0 : _shadowPass$device2.canvasContext;
|
|
71
|
-
var viewport = params === null || params === void 0 || (_params$
|
|
183
|
+
var viewport = params === null || params === void 0 || (_params$viewports2 = params.viewports) === null || _params$viewports2 === void 0 ? void 0 : _params$viewports2[0];
|
|
72
184
|
var width = gl === null || gl === void 0 ? void 0 : gl.drawingBufferWidth;
|
|
73
185
|
var height = gl === null || gl === void 0 ? void 0 : gl.drawingBufferHeight;
|
|
74
186
|
if (!gl || !canvasContext || !(viewport !== null && viewport !== void 0 && viewport.width) || !width || !height) {
|
|
@@ -197,9 +309,11 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
197
309
|
(0, _defineProperty2["default"])(_this, "useInPicking", true);
|
|
198
310
|
(0, _defineProperty2["default"])(_this, "outputUniformShadow", void 0);
|
|
199
311
|
(0, _defineProperty2["default"])(_this, "isExportMode", void 0);
|
|
312
|
+
(0, _defineProperty2["default"])(_this, "shadowMapResolution", void 0);
|
|
200
313
|
(0, _defineProperty2["default"])(_this, "isPicking", false);
|
|
201
314
|
_this.outputUniformShadow = false;
|
|
202
315
|
_this.isExportMode = false;
|
|
316
|
+
_this.shadowMapResolution = _constants.SHADOW_MAP_RESOLUTIONS.auto;
|
|
203
317
|
return _this;
|
|
204
318
|
}
|
|
205
319
|
(0, _inherits2["default"])(CustomDeckLightingEffect, _LightingEffect);
|
|
@@ -217,20 +331,22 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
217
331
|
deck = context.deck;
|
|
218
332
|
if (this._private.shadow && !this._private.dummyShadowMap) {
|
|
219
333
|
this._private._createShadowPasses(device);
|
|
220
|
-
var
|
|
221
|
-
|
|
334
|
+
var _iterator4 = _createForOfIteratorHelper(this._private.shadowPasses),
|
|
335
|
+
_step4;
|
|
222
336
|
try {
|
|
223
|
-
for (
|
|
224
|
-
var shadowPass =
|
|
337
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
338
|
+
var shadowPass = _step4.value;
|
|
225
339
|
patchShadowPassDepth(shadowPass);
|
|
226
340
|
alignExportShadowPass(shadowPass, function () {
|
|
227
341
|
return _this2.isExportMode;
|
|
342
|
+
}, function () {
|
|
343
|
+
return _this2.shadowMapResolution;
|
|
228
344
|
});
|
|
229
345
|
}
|
|
230
346
|
} catch (err) {
|
|
231
|
-
|
|
347
|
+
_iterator4.e(err);
|
|
232
348
|
} finally {
|
|
233
|
-
|
|
349
|
+
_iterator4.f();
|
|
234
350
|
}
|
|
235
351
|
deck._addDefaultShaderModule(CustomShadowModule || _core.shadow);
|
|
236
352
|
deck._addDefaultShaderModule(shadowMapHoverFixModule);
|
|
@@ -248,6 +364,15 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
248
364
|
this.isPicking = Boolean(opts.isPicking);
|
|
249
365
|
if (this.isPicking || !this._private.shadow) return;
|
|
250
366
|
|
|
367
|
+
// kepler turns shadows on by setting `shadow` directly (updateEffect in
|
|
368
|
+
// effect-utils), not through setProps, so deck.gl does not call setup()
|
|
369
|
+
// again. An effect set up while its shadows were off (a map loaded with
|
|
370
|
+
// Light & Shadow disabled) has no shadow passes and no shadow module:
|
|
371
|
+
// create them now. deck.gl rebuilds the layers with the module next frame.
|
|
372
|
+
if (!this._private.dummyShadowMap && this.context) {
|
|
373
|
+
this.setup(this.context);
|
|
374
|
+
}
|
|
375
|
+
|
|
251
376
|
// Filter editor layers out of the shadow pass so they don't cast shadows.
|
|
252
377
|
var originalLayers = opts.layers;
|
|
253
378
|
opts.layers = originalLayers.filter(function (l) {
|
|
@@ -264,17 +389,17 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
264
389
|
}, {
|
|
265
390
|
key: "cleanup",
|
|
266
391
|
value: function cleanup(context) {
|
|
267
|
-
var
|
|
268
|
-
|
|
392
|
+
var _iterator5 = _createForOfIteratorHelper(this._private.shadowPasses),
|
|
393
|
+
_step5;
|
|
269
394
|
try {
|
|
270
|
-
for (
|
|
271
|
-
var shadowPass =
|
|
395
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
396
|
+
var shadowPass = _step5.value;
|
|
272
397
|
shadowPass["delete"]();
|
|
273
398
|
}
|
|
274
399
|
} catch (err) {
|
|
275
|
-
|
|
400
|
+
_iterator5.e(err);
|
|
276
401
|
} finally {
|
|
277
|
-
|
|
402
|
+
_iterator5.f();
|
|
278
403
|
}
|
|
279
404
|
this._private.shadowPasses.length = 0;
|
|
280
405
|
if (this._private.dummyShadowMap) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-deck-lighting-effect.js","names":["_core","require","_constants","_tileViewportFix","_createForOfIteratorHelper","r","e","t","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","_arrayLikeToArray","toString","slice","constructor","name","from","test","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","apply","Boolean","prototype","valueOf","_superPropGet","p","_get2","ownKeys","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","DEFAULT_LIGHTING_EFFECT","LightingEffect","SHADOW_PASS_DEPTH_PARAMETERS","depthTest","depthMask","polygonOffsetFill","polygonOffset","patchShadowPassDepth","pass","originalGetLayerParameters","getLayerParameters","bind","layer","layerIndex","viewport","alignExportShadowPass","shadowPass","isExportMode","render","params","_shadowPass$device","_shadowPass$device2","_params$viewports","_gl$getParameter","_gl$DEPTH_RANGE","_gl$depthRange","gl","device","canvasContext","viewports","width","drawingBufferWidth","height","drawingBufferHeight","prevSize","getDrawingBufferSize","prevRatio","cssToDeviceRatio","prevDepth","getParameter","DEPTH_RANGE","depthRange","_gl$depthRange2","insertBefore","source","target","textToInsert","at","indexOf","createCustomShadowModule","shadow","mod","uboField","vs","fs","concat","replace","inject","uniformTypes","outputUniformShadow","useSimplePhong","originalGetUniforms","getUniforms","opts","undefined","context","CustomShadowModule","PICKING_FILTER_COLOR_ORDER","shadowMapHoverFixModule","exports","order","injection","isPbrLayer","_layer$props","_layer$props2","props","_lighting","pbrMaterial","CustomDeckLightingEffect","_LightingEffect","_this","_classCallCheck2","_inherits2","_createClass2","key","get","setup","_this2","deck","_private","dummyShadowMap","_createShadowPasses","_iterator","shadowPasses","_step","err","_addDefaultShaderModule","createTexture","preRender","_unpatch","isPicking","originalLayers","layers","l","id","startsWith","EDITOR_LAYER_ID","unpatch","patchTileViewportIds","cleanup","_iterator2","_step2","destroy","_removeDefaultShaderModule","getShaderModuleProps","otherShaderModuleProps","shadowEnabled","lighting","enabled","unlit","phongMaterial","gouraudMaterial","defaults","_default"],"sources":["../../src/custom-deck-lighting-effect.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {LightingEffect, shadow} from '@deck.gl/core';\nimport type {Texture} from '@luma.gl/core';\nimport type {ShaderModule} from '@luma.gl/shadertools';\nimport {EDITOR_LAYER_ID} from '@kepler.gl/constants';\nimport {patchTileViewportIds} from './tile-viewport-fix';\n\n// A plain LightingEffect() — its constructor calls _applyDefaultLights()\n// which populates the same default lights that deck.gl's EffectManager\n// uses internally. This is used to restore the original shading.\nconst DEFAULT_LIGHTING_EFFECT = new LightingEffect();\n\n/**\n * Exposes private members of LightingEffect that we need to access.\n * These are runtime-accessible but TypeScript marks them as private.\n */\ninterface LightingEffectPrivate {\n shadow: boolean;\n shadowPasses: {\n delete(): void;\n render(params: Record<string, unknown>): void;\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n }[];\n dummyShadowMap: Texture | null;\n _createShadowPasses(device: unknown): void;\n}\n\n// WebGL applies GL-style depthTest/depthMask; deck.gl's ShadowPass only sets\n// depthWriteEnabled. Disable polygonOffset so a later ground plane is not\n// pulled toward the sun and cannot overwrite building walls in the shadow map.\nconst SHADOW_PASS_DEPTH_PARAMETERS = {\n depthTest: true,\n depthMask: true,\n polygonOffsetFill: false,\n polygonOffset: [0, 0]\n};\n\nexport function patchShadowPassDepth(pass: {\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n}) {\n const originalGetLayerParameters = pass.getLayerParameters.bind(pass);\n pass.getLayerParameters = (layer, layerIndex, viewport) => ({\n ...originalGetLayerParameters(layer, layerIndex, viewport),\n ...SHADOW_PASS_DEPTH_PARAMETERS\n });\n}\n\n/** Extended shadow module props with our custom field. */\ninterface CustomShadowProps {\n outputUniformShadow?: boolean;\n useSimplePhong?: boolean;\n dummyShadowMap?: Texture | null;\n [key: string]: unknown;\n}\n\n/**\n * Video export shares MapLibre's canvas. Luma's cssToDeviceRatio() can lag that\n * bitmap, so ShadowPass draws into a corner of its FBO and the rest samples as\n * fully shadowed. For the shadow pass only, read the live GL buffer; restore\n * afterward so the color pass / basemap stay aligned.\n */\nexport function alignExportShadowPass(shadowPass: any, isExportMode: () => boolean): void {\n const render = shadowPass.render.bind(shadowPass);\n shadowPass.render = params => {\n if (!isExportMode()) return render(params);\n\n const gl = shadowPass.device?.gl;\n const canvasContext = shadowPass.device?.canvasContext;\n const viewport = params?.viewports?.[0];\n const width = gl?.drawingBufferWidth;\n const height = gl?.drawingBufferHeight;\n if (!gl || !canvasContext || !viewport?.width || !width || !height) {\n return render(params);\n }\n\n const prevSize = canvasContext.getDrawingBufferSize;\n const prevRatio = canvasContext.cssToDeviceRatio;\n const prevDepth = gl.getParameter?.(gl.DEPTH_RANGE ?? 0x0b70);\n canvasContext.getDrawingBufferSize = () => [width, height];\n canvasContext.cssToDeviceRatio = () => width / viewport.width;\n gl.depthRange?.(0, 1);\n try {\n return render(params);\n } finally {\n canvasContext.getDrawingBufferSize = prevSize;\n canvasContext.cssToDeviceRatio = prevRatio;\n if (prevDepth) gl.depthRange?.(prevDepth[0], prevDepth[1]);\n }\n };\n}\n\n/**\n * Insert text before a target string in shader source.\n */\nfunction insertBefore(source: string, target: string, textToInsert: string): string {\n const at = source.indexOf(target);\n if (at < 0) return source;\n return source.slice(0, at) + textToInsert + source.slice(at);\n}\n\n/**\n * Create a patched shadow module that adds:\n * - `outputUniformShadow`: when true, shadow_getShadowWeight returns 1.0\n * (full uniform shadow) instead of sampling the shadow map.\n * - `useSimplePhong`: when true, replaces PBR lighting with simple\n * Lambertian diffuse (ambient + NdotL) for 3D tile layers, avoiding\n * the PBR microfacet specular artifacts on flat surfaces.\n *\n * Also fixes the vertex injection to be a no-op when shadows are disabled,\n * preventing position corruption in billboard layers (e.g. the editor layer).\n */\nfunction createCustomShadowModule(): ShaderModule | null {\n if (!shadow) return null;\n\n const mod = {...shadow} as Record<string, any>;\n\n const uboField = ' float outputUniformShadow;\\n float useSimplePhong;\\n';\n mod.vs = insertBefore(mod.vs, '} shadow;', uboField);\n mod.fs = insertBefore(mod.fs, '} shadow;', uboField);\n\n // Add a varying to carry the common-space position for simple phong normals.\n mod.vs = `out vec3 custom_vWorldPos;\\n${mod.vs}`;\n mod.fs = `in vec3 custom_vWorldPos;\\n${mod.fs}`;\n\n mod.fs = insertBefore(\n mod.fs,\n 'vec4 rgbaDepth = texture(shadowMap, position.xy);',\n 'if (shadow.outputUniformShadow > 0.5) return 1.0;\\n '\n );\n\n // Patch the VS so the fallback returns the caller's position instead of\n // gl_Position (which is uninitialised when the hook fires in billboard\n // layers like PathLayer / the editor polygon tool).\n mod.vs = mod.vs\n .replace(\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace)',\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace, vec4 currentPosition)'\n )\n .replace(/return gl_Position;\\s*\\}/, 'return currentPosition;\\n}');\n\n mod.inject = {\n ...shadow.inject,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n position = shadow_setVertexPosition(geometry.position, position);\n custom_vWorldPos = geometry.position.xyz;\n `,\n 'fs:DECKGL_FILTER_COLOR': `\n #ifdef LIGHTING_FRAGMENT\n if (shadow.useSimplePhong > 0.5) {\n vec3 spDx = dFdx(custom_vWorldPos);\n vec3 spDy = dFdy(custom_vWorldPos);\n vec3 spN = normalize(cross(spDx, spDy));\n vec3 spLit = lighting.ambientColor;\n for (int i = 0; i < 3; i++) {\n if (i >= lighting.directionalLightCount) break;\n vec3 spDir = lighting_getDirectionalLight(i).direction;\n float spNdotL = max(dot(spN, -normalize(spDir)), 0.0);\n spLit += lighting_getDirectionalLight(i).color * spNdotL;\n }\n color.rgb *= spLit;\n }\n #endif\n color = shadow_filterShadowColor(color);\n `\n };\n\n mod.uniformTypes = {\n ...shadow.uniformTypes,\n outputUniformShadow: 'f32',\n useSimplePhong: 'f32'\n };\n\n const originalGetUniforms = shadow.getUniforms as (\n opts: Record<string, unknown>,\n prevUniforms: Record<string, unknown>\n ) => Record<string, unknown>;\n mod.getUniforms = (opts: CustomShadowProps = {}, context = {}) => {\n const u = originalGetUniforms(opts, context);\n u.outputUniformShadow = opts.outputUniformShadow ? 1.0 : 0.0;\n u.useSimplePhong = opts.useSimplePhong ? 1.0 : 0.0;\n return u;\n };\n\n return mod as unknown as ShaderModule;\n}\n\nconst CustomShadowModule = createCustomShadowModule();\n\n// deck.gl picking injects at order 99 and blends highlightColor over the\n// fragment. In the shadow pass that overwrites encoded depth, so a hovered\n// extruded feature stops casting a shadow. Re-encode after picking.\n// Color-pass highlight compositing is unchanged (shadow still runs first).\nconst PICKING_FILTER_COLOR_ORDER = 99;\n\nexport const shadowMapHoverFixModule = {\n name: 'shadow-map-hover-fix',\n inject: {\n 'fs:DECKGL_FILTER_COLOR': {\n order: PICKING_FILTER_COLOR_ORDER + 1,\n injection: `\n if (shadow.drawShadowMap) {\n color = shadow_filterShadowColor(color);\n }\n `\n }\n }\n} as unknown as ShaderModule;\n\n/**\n * Detect layers that use the PBR shader module (3D tile sublayers:\n * ScenegraphLayer sets `_lighting: 'pbr'`, SimpleMeshLayer sets `pbrMaterial`).\n */\nfunction isPbrLayer(layer: any): boolean {\n return layer.props?._lighting === 'pbr' || layer.props?.pbrMaterial !== undefined;\n}\n\n/**\n * Custom LightingEffect for kepler.gl.\n *\n * Extends deck.gl's LightingEffect with:\n * - A patched shadow module with `outputUniformShadow` for uniform shadow\n * during nighttime (avoids partial shadows from below).\n * - Simple phong replacement for PBR layers (avoids microfacet specular).\n * - Shadow-map depth re-encoded after picking highlight so hovered extruded\n * features still cast shadows.\n * - getShaderModuleProps override that always provides dummyShadowMap\n * to prevent \"Bad texture binding\" errors when shadows are disabled.\n */\nclass CustomDeckLightingEffect extends LightingEffect {\n // Picking still needs the sampler bindings for the installed shadow shader.\n useInPicking = true;\n outputUniformShadow: boolean;\n isExportMode: boolean;\n private isPicking = false;\n\n private get _private(): LightingEffectPrivate {\n return this as unknown as LightingEffectPrivate;\n }\n\n constructor(props) {\n super(props);\n this.outputUniformShadow = false;\n this.isExportMode = false;\n }\n\n setup(context) {\n this.context = context;\n const {device, deck} = context;\n if (this._private.shadow && !this._private.dummyShadowMap) {\n this._private._createShadowPasses(device);\n for (const shadowPass of this._private.shadowPasses) {\n patchShadowPassDepth(shadowPass);\n alignExportShadowPass(shadowPass, () => this.isExportMode);\n }\n deck._addDefaultShaderModule(CustomShadowModule || shadow);\n deck._addDefaultShaderModule(shadowMapHoverFixModule);\n this._private.dummyShadowMap = device.createTexture({width: 1, height: 1});\n }\n }\n\n preRender(opts) {\n // Effects resolve their props before deck sets the picking shader flag.\n this.isPicking = Boolean(opts.isPicking);\n if (this.isPicking || !this._private.shadow) return;\n\n // Filter editor layers out of the shadow pass so they don't cast shadows.\n const originalLayers = opts.layers;\n opts.layers = originalLayers.filter(l => !l.id.startsWith(EDITOR_LAYER_ID));\n\n let unpatch: (() => void) | undefined;\n if (this.isExportMode) {\n unpatch = patchTileViewportIds(opts);\n }\n\n super.preRender(opts);\n\n unpatch?.();\n\n opts.layers = originalLayers;\n }\n\n cleanup(context) {\n for (const shadowPass of this._private.shadowPasses) {\n shadowPass.delete();\n }\n this._private.shadowPasses.length = 0;\n if (this._private.dummyShadowMap) {\n this._private.dummyShadowMap.destroy();\n this._private.dummyShadowMap = null;\n context.deck._removeDefaultShaderModule(CustomShadowModule || shadow);\n context.deck._removeDefaultShaderModule(shadowMapHoverFixModule);\n }\n }\n\n getShaderModuleProps(layer, otherShaderModuleProps) {\n // Picking and editor layers need sampler bindings without shadow calculations.\n if (this.isPicking || layer.id.startsWith(EDITOR_LAYER_ID)) {\n return {\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n lighting: {enabled: false},\n pbrMaterial: {unlit: 1},\n phongMaterial: null,\n gouraudMaterial: null\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n // When the effect is disabled (ghost kept alive to preserve the shadow\n // shader module), delegate to a default LightingEffect so phong/gouraud\n // layers get the same shading they had before the effect was ever added.\n if (!this._private.shadow) {\n const defaults = DEFAULT_LIGHTING_EFFECT.getShaderModuleProps(layer, otherShaderModuleProps);\n return {\n ...defaults,\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n pbrMaterial: {unlit: 1}\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n const props = super.getShaderModuleProps(layer, otherShaderModuleProps);\n\n if (\n props.shadow &&\n !(props.shadow as CustomShadowProps).dummyShadowMap &&\n this._private.dummyShadowMap\n ) {\n (props.shadow as CustomShadowProps).dummyShadowMap = this._private.dummyShadowMap;\n }\n\n if (props.shadow) {\n (props.shadow as CustomShadowProps).outputUniformShadow = this.outputUniformShadow;\n }\n\n if (isPbrLayer(layer)) {\n // PBR layers: disable PBR lighting (unlit=1 → outputs base texture color),\n // keep directional lights in the lighting uniforms, and enable our simple\n // phong replacement in the DECKGL_FILTER_COLOR hook. This gives us\n // ambient + NdotL diffuse without PBR microfacet specular artifacts.\n // Light direction is sky→surface (deck.gl convention), negated in GLSL.\n (props as any).pbrMaterial = {unlit: 1};\n if (props.shadow) {\n (props.shadow as CustomShadowProps).useSimplePhong = true;\n }\n return props;\n }\n\n (props as any).pbrMaterial = {unlit: 0};\n\n return props;\n }\n}\n\nexport default CustomDeckLightingEffect;\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAAyD,SAAAG,2BAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,yBAAAC,MA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ACA;QACA;QACA;QACC+D,KAAK,CAASE,WAAW,GAAG;UAAC0C,KAAK,EAAE;QAAC,CAAC;QACvC,IAAI5C,KAAK,CAACzB,MAAM,EAAE;UACfyB,KAAK,CAACzB,MAAM,CAAuBU,cAAc,GAAG,IAAI;QAC3D;QACA,OAAOe,KAAK;MACd;MAECA,KAAK,CAASE,WAAW,GAAG;QAAC0C,KAAK,EAAE;MAAC,CAAC;MAEvC,OAAO5C,KAAK;IACd;EAAC;AAAA,EA9HoC1E,oBAAc;AAAA,IAAA0H,QAAA,GAAAtD,OAAA,cAiItCS,wBAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"custom-deck-lighting-effect.js","names":["_core","require","_constants","_tileViewportFix","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","_superPropGet","r","p","_get2","_createForOfIteratorHelper","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","a","u","next","_arrayLikeToArray","toString","slice","name","from","test","ownKeys","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","DEFAULT_LIGHTING_EFFECT","LightingEffect","SHADOW_PASS_DEPTH_PARAMETERS","depthTest","depthMask","polygonOffsetFill","polygonOffset","patchShadowPassDepth","pass","originalGetLayerParameters","getLayerParameters","bind","layer","layerIndex","viewport","ownShadowAttachments","fbo","getTextures","_fbo$colorAttachments","_fbo$depthStencilAtta","color","colorAttachments","texture","depth","depthStencilAttachment","_iterator","_step","attachResource","err","resize","size","previous","current","_iterator2","_step2","includes","destroyAttachedResource","_iterator3","_step3","alignExportShadowPass","shadowPass","isExportMode","getResolution","undefined","SHADOW_MAP_RESOLUTIONS","auto","render","ownsAttachments","params","_shadowPass$device","_shadowPass$device2","_params$viewports2","_gl$getParameter","_gl$DEPTH_RANGE","_gl$depthRange","_params$viewports","_device$limits$maxTex","_device$limits","scale","low","high","device","canvasContext","viewports","type","width","height","x","y","prevSize","getDrawingBufferSize","prevRatio","cssToDeviceRatio","ratio","Number","isFinite","limit","Math","min","limits","maxTextureDimension2D","maxRatio","sqrt","scaledRatio","max","floor","gl","drawingBufferWidth","drawingBufferHeight","prevDepth","getParameter","DEPTH_RANGE","depthRange","_gl$depthRange2","insertBefore","source","target","textToInsert","at","indexOf","createCustomShadowModule","shadow","mod","uboField","vs","fs","concat","replace","inject","uniformTypes","outputUniformShadow","useSimplePhong","originalGetUniforms","getUniforms","opts","context","CustomShadowModule","PICKING_FILTER_COLOR_ORDER","shadowMapHoverFixModule","exports","order","injection","isPbrLayer","_layer$props","_layer$props2","props","_lighting","pbrMaterial","CustomDeckLightingEffect","_LightingEffect","_this","_classCallCheck2","shadowMapResolution","_inherits2","_createClass2","key","get","setup","_this2","deck","_private","dummyShadowMap","_createShadowPasses","_iterator4","shadowPasses","_step4","_addDefaultShaderModule","createTexture","preRender","_unpatch","isPicking","originalLayers","layers","l","id","startsWith","EDITOR_LAYER_ID","unpatch","patchTileViewportIds","cleanup","_iterator5","_step5","destroy","_removeDefaultShaderModule","getShaderModuleProps","otherShaderModuleProps","shadowEnabled","lighting","enabled","unlit","phongMaterial","gouraudMaterial","defaults","_default"],"sources":["../../src/custom-deck-lighting-effect.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {LightingEffect, shadow} from '@deck.gl/core';\nimport type {Framebuffer, Texture} from '@luma.gl/core';\nimport type {ShaderModule} from '@luma.gl/shadertools';\nimport {EDITOR_LAYER_ID, SHADOW_MAP_RESOLUTIONS} from '@kepler.gl/constants';\nimport {patchTileViewportIds} from './tile-viewport-fix';\n\n// A plain LightingEffect() — its constructor calls _applyDefaultLights()\n// which populates the same default lights that deck.gl's EffectManager\n// uses internally. This is used to restore the original shading.\nconst DEFAULT_LIGHTING_EFFECT = new LightingEffect();\n\n/**\n * Exposes private members of LightingEffect that we need to access.\n * These are runtime-accessible but TypeScript marks them as private.\n */\ninterface LightingEffectPrivate {\n shadow: boolean;\n shadowPasses: {\n delete(): void;\n render(params: Record<string, unknown>): void;\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n }[];\n dummyShadowMap: Texture | null;\n _createShadowPasses(device: unknown): void;\n}\n\n// WebGL applies GL-style depthTest/depthMask; deck.gl's ShadowPass only sets\n// depthWriteEnabled. Disable polygonOffset so a later ground plane is not\n// pulled toward the sun and cannot overwrite building walls in the shadow map.\nconst SHADOW_PASS_DEPTH_PARAMETERS = {\n depthTest: true,\n depthMask: true,\n polygonOffsetFill: false,\n polygonOffset: [0, 0]\n};\n\nexport function patchShadowPassDepth(pass: {\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n}) {\n const originalGetLayerParameters = pass.getLayerParameters.bind(pass);\n pass.getLayerParameters = (layer, layerIndex, viewport) => ({\n ...originalGetLayerParameters(layer, layerIndex, viewport),\n ...SHADOW_PASS_DEPTH_PARAMETERS\n });\n}\n\n/** Extended shadow module props with our custom field. */\ninterface CustomShadowProps {\n outputUniformShadow?: boolean;\n useSimplePhong?: boolean;\n dummyShadowMap?: Texture | null;\n [key: string]: unknown;\n}\n\n/**\n * ShadowPass exclusively owns its attachments, but passes them to luma as\n * external textures. In luma 9.4.2 framebuffer.resize tracks the replacement\n * color view, not its texture. A quality toggle otherwise leaks that texture.\n */\nfunction ownShadowAttachments(fbo: Framebuffer): void {\n const getTextures = () => {\n const color = fbo.colorAttachments[0]?.texture;\n const depth = fbo.depthStencilAttachment?.texture;\n return [color, depth].filter((texture): texture is Texture => Boolean(texture));\n };\n for (const texture of getTextures()) fbo.attachResource(texture);\n\n const resize = fbo.resize.bind(fbo);\n fbo.resize = (size?: {width: number; height: number} | [number, number]) => {\n const previous = getTextures();\n try {\n if (Array.isArray(size)) resize(size);\n else if (size) resize(size);\n else resize();\n } finally {\n const current = getTextures();\n for (const texture of previous) {\n if (!current.includes(texture)) {\n fbo.destroyAttachedResource(texture);\n }\n }\n for (const texture of current) fbo.attachResource(texture);\n }\n };\n}\n\n/**\n * Video export shares MapLibre's canvas. Luma's cssToDeviceRatio() can lag that\n * bitmap, so ShadowPass draws into a corner of its FBO and the rest samples as\n * fully shadowed. For the shadow pass only, read the live GL buffer; restore\n * afterward so the color pass / basemap stay aligned.\n */\nexport function alignExportShadowPass(\n shadowPass: any,\n isExportMode: () => boolean,\n getResolution: () => number = () => SHADOW_MAP_RESOLUTIONS.auto\n): void {\n const render = shadowPass.render.bind(shadowPass);\n let ownsAttachments = false;\n shadowPass.render = params => {\n if (!isExportMode()) {\n const scale = getResolution();\n if (scale !== SHADOW_MAP_RESOLUTIONS.low && scale !== SHADOW_MAP_RESOLUTIONS.high) {\n return render(params);\n }\n\n const {device} = shadowPass;\n const canvasContext = device?.canvasContext;\n const viewport = params?.viewports?.[0];\n if (\n device?.type !== 'webgl' ||\n !canvasContext ||\n params.viewports.length !== 1 ||\n !viewport?.width ||\n !viewport.height ||\n viewport.x ||\n viewport.y\n ) {\n return render(params);\n }\n\n const prevSize = canvasContext.getDrawingBufferSize;\n const prevRatio = canvasContext.cssToDeviceRatio;\n const ratio = prevRatio.call(canvasContext);\n const {width, height} = viewport;\n if (\n !Number.isFinite(ratio) ||\n ratio <= 0 ||\n width * ratio * scale < 1 ||\n height * ratio * scale < 1\n ) {\n return render(params);\n }\n // Never increase to more than ~48 MiB of raw RGBA8 + depth16 per map.\n // If Auto already exceeds the bound, High must not reduce its quality.\n const limit = Math.min(device.limits?.maxTextureDimension2D ?? 4096, 4096);\n const maxRatio = Math.min(limit / width, limit / height, Math.sqrt(8e6 / (width * height)));\n const scaledRatio =\n scale === SHADOW_MAP_RESOLUTIONS.high\n ? Math.max(ratio, Math.min(ratio * scale, maxRatio))\n : ratio * scale;\n if (!Number.isFinite(scaledRatio) || scaledRatio === ratio) return render(params);\n\n if (!ownsAttachments && shadowPass.fbo) {\n ownShadowAttachments(shadowPass.fbo);\n ownsAttachments = true;\n }\n\n // ShadowPass and LayersPass must see the same ratio: one allocates the\n // texture, the other scales its viewport. Color and picking keep Auto.\n canvasContext.getDrawingBufferSize = () => [\n Math.floor(width * scaledRatio),\n Math.floor(height * scaledRatio)\n ];\n canvasContext.cssToDeviceRatio = () => scaledRatio;\n try {\n return render(params);\n } finally {\n canvasContext.getDrawingBufferSize = prevSize;\n canvasContext.cssToDeviceRatio = prevRatio;\n }\n }\n\n const gl = shadowPass.device?.gl;\n const canvasContext = shadowPass.device?.canvasContext;\n const viewport = params?.viewports?.[0];\n const width = gl?.drawingBufferWidth;\n const height = gl?.drawingBufferHeight;\n if (!gl || !canvasContext || !viewport?.width || !width || !height) {\n return render(params);\n }\n\n const prevSize = canvasContext.getDrawingBufferSize;\n const prevRatio = canvasContext.cssToDeviceRatio;\n const prevDepth = gl.getParameter?.(gl.DEPTH_RANGE ?? 0x0b70);\n canvasContext.getDrawingBufferSize = () => [width, height];\n canvasContext.cssToDeviceRatio = () => width / viewport.width;\n gl.depthRange?.(0, 1);\n try {\n return render(params);\n } finally {\n canvasContext.getDrawingBufferSize = prevSize;\n canvasContext.cssToDeviceRatio = prevRatio;\n if (prevDepth) gl.depthRange?.(prevDepth[0], prevDepth[1]);\n }\n };\n}\n\n/**\n * Insert text before a target string in shader source.\n */\nfunction insertBefore(source: string, target: string, textToInsert: string): string {\n const at = source.indexOf(target);\n if (at < 0) return source;\n return source.slice(0, at) + textToInsert + source.slice(at);\n}\n\n/**\n * Create a patched shadow module that adds:\n * - `outputUniformShadow`: when true, shadow_getShadowWeight returns 1.0\n * (full uniform shadow) instead of sampling the shadow map.\n * - `useSimplePhong`: when true, replaces PBR lighting with simple\n * Lambertian diffuse (ambient + NdotL) for 3D tile layers, avoiding\n * the PBR microfacet specular artifacts on flat surfaces.\n *\n * Also fixes the vertex injection to be a no-op when shadows are disabled,\n * preventing position corruption in billboard layers (e.g. the editor layer).\n */\nfunction createCustomShadowModule(): ShaderModule | null {\n if (!shadow) return null;\n\n const mod = {...shadow} as Record<string, any>;\n\n const uboField = ' float outputUniformShadow;\\n float useSimplePhong;\\n';\n mod.vs = insertBefore(mod.vs, '} shadow;', uboField);\n mod.fs = insertBefore(mod.fs, '} shadow;', uboField);\n\n // Add a varying to carry the common-space position for simple phong normals.\n mod.vs = `out vec3 custom_vWorldPos;\\n${mod.vs}`;\n mod.fs = `in vec3 custom_vWorldPos;\\n${mod.fs}`;\n\n mod.fs = insertBefore(\n mod.fs,\n 'vec4 rgbaDepth = texture(shadowMap, position.xy);',\n 'if (shadow.outputUniformShadow > 0.5) return 1.0;\\n '\n );\n\n // Patch the VS so the fallback returns the caller's position instead of\n // gl_Position (which is uninitialised when the hook fires in billboard\n // layers like PathLayer / the editor polygon tool).\n mod.vs = mod.vs\n .replace(\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace)',\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace, vec4 currentPosition)'\n )\n .replace(/return gl_Position;\\s*\\}/, 'return currentPosition;\\n}');\n\n mod.inject = {\n ...shadow.inject,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n position = shadow_setVertexPosition(geometry.position, position);\n custom_vWorldPos = geometry.position.xyz;\n `,\n 'fs:DECKGL_FILTER_COLOR': `\n #ifdef LIGHTING_FRAGMENT\n if (shadow.useSimplePhong > 0.5) {\n vec3 spDx = dFdx(custom_vWorldPos);\n vec3 spDy = dFdy(custom_vWorldPos);\n vec3 spN = normalize(cross(spDx, spDy));\n vec3 spLit = lighting.ambientColor;\n for (int i = 0; i < 3; i++) {\n if (i >= lighting.directionalLightCount) break;\n vec3 spDir = lighting_getDirectionalLight(i).direction;\n float spNdotL = max(dot(spN, -normalize(spDir)), 0.0);\n spLit += lighting_getDirectionalLight(i).color * spNdotL;\n }\n color.rgb *= spLit;\n }\n #endif\n color = shadow_filterShadowColor(color);\n `\n };\n\n mod.uniformTypes = {\n ...shadow.uniformTypes,\n outputUniformShadow: 'f32',\n useSimplePhong: 'f32'\n };\n\n const originalGetUniforms = shadow.getUniforms as (\n opts: Record<string, unknown>,\n prevUniforms: Record<string, unknown>\n ) => Record<string, unknown>;\n mod.getUniforms = (opts: CustomShadowProps = {}, context = {}) => {\n const u = originalGetUniforms(opts, context);\n u.outputUniformShadow = opts.outputUniformShadow ? 1.0 : 0.0;\n u.useSimplePhong = opts.useSimplePhong ? 1.0 : 0.0;\n return u;\n };\n\n return mod as unknown as ShaderModule;\n}\n\nconst CustomShadowModule = createCustomShadowModule();\n\n// deck.gl picking injects at order 99 and blends highlightColor over the\n// fragment. In the shadow pass that overwrites encoded depth, so a hovered\n// extruded feature stops casting a shadow. Re-encode after picking.\n// Color-pass highlight compositing is unchanged (shadow still runs first).\nconst PICKING_FILTER_COLOR_ORDER = 99;\n\nexport const shadowMapHoverFixModule = {\n name: 'shadow-map-hover-fix',\n inject: {\n 'fs:DECKGL_FILTER_COLOR': {\n order: PICKING_FILTER_COLOR_ORDER + 1,\n injection: `\n if (shadow.drawShadowMap) {\n color = shadow_filterShadowColor(color);\n }\n `\n }\n }\n} as unknown as ShaderModule;\n\n/**\n * Detect layers that use the PBR shader module (3D tile sublayers:\n * ScenegraphLayer sets `_lighting: 'pbr'`, SimpleMeshLayer sets `pbrMaterial`).\n */\nfunction isPbrLayer(layer: any): boolean {\n return layer.props?._lighting === 'pbr' || layer.props?.pbrMaterial !== undefined;\n}\n\n/**\n * Custom LightingEffect for kepler.gl.\n *\n * Extends deck.gl's LightingEffect with:\n * - A patched shadow module with `outputUniformShadow` for uniform shadow\n * during nighttime (avoids partial shadows from below).\n * - Simple phong replacement for PBR layers (avoids microfacet specular).\n * - Shadow-map depth re-encoded after picking highlight so hovered extruded\n * features still cast shadows.\n * - getShaderModuleProps override that always provides dummyShadowMap\n * to prevent \"Bad texture binding\" errors when shadows are disabled.\n */\nclass CustomDeckLightingEffect extends LightingEffect {\n // Picking still needs the sampler bindings for the installed shadow shader.\n useInPicking = true;\n outputUniformShadow: boolean;\n isExportMode: boolean;\n shadowMapResolution: number;\n private isPicking = false;\n\n private get _private(): LightingEffectPrivate {\n return this as unknown as LightingEffectPrivate;\n }\n\n constructor(props) {\n super(props);\n this.outputUniformShadow = false;\n this.isExportMode = false;\n this.shadowMapResolution = SHADOW_MAP_RESOLUTIONS.auto;\n }\n\n setup(context) {\n this.context = context;\n const {device, deck} = context;\n if (this._private.shadow && !this._private.dummyShadowMap) {\n this._private._createShadowPasses(device);\n for (const shadowPass of this._private.shadowPasses) {\n patchShadowPassDepth(shadowPass);\n alignExportShadowPass(\n shadowPass,\n () => this.isExportMode,\n () => this.shadowMapResolution\n );\n }\n deck._addDefaultShaderModule(CustomShadowModule || shadow);\n deck._addDefaultShaderModule(shadowMapHoverFixModule);\n this._private.dummyShadowMap = device.createTexture({width: 1, height: 1});\n }\n }\n\n preRender(opts) {\n // Effects resolve their props before deck sets the picking shader flag.\n this.isPicking = Boolean(opts.isPicking);\n if (this.isPicking || !this._private.shadow) return;\n\n // kepler turns shadows on by setting `shadow` directly (updateEffect in\n // effect-utils), not through setProps, so deck.gl does not call setup()\n // again. An effect set up while its shadows were off (a map loaded with\n // Light & Shadow disabled) has no shadow passes and no shadow module:\n // create them now. deck.gl rebuilds the layers with the module next frame.\n if (!this._private.dummyShadowMap && this.context) {\n this.setup(this.context);\n }\n\n // Filter editor layers out of the shadow pass so they don't cast shadows.\n const originalLayers = opts.layers;\n opts.layers = originalLayers.filter(l => !l.id.startsWith(EDITOR_LAYER_ID));\n\n let unpatch: (() => void) | undefined;\n if (this.isExportMode) {\n unpatch = patchTileViewportIds(opts);\n }\n\n super.preRender(opts);\n\n unpatch?.();\n\n opts.layers = originalLayers;\n }\n\n cleanup(context) {\n for (const shadowPass of this._private.shadowPasses) {\n shadowPass.delete();\n }\n this._private.shadowPasses.length = 0;\n if (this._private.dummyShadowMap) {\n this._private.dummyShadowMap.destroy();\n this._private.dummyShadowMap = null;\n context.deck._removeDefaultShaderModule(CustomShadowModule || shadow);\n context.deck._removeDefaultShaderModule(shadowMapHoverFixModule);\n }\n }\n\n getShaderModuleProps(layer, otherShaderModuleProps) {\n // Picking and editor layers need sampler bindings without shadow calculations.\n if (this.isPicking || layer.id.startsWith(EDITOR_LAYER_ID)) {\n return {\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n lighting: {enabled: false},\n pbrMaterial: {unlit: 1},\n phongMaterial: null,\n gouraudMaterial: null\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n // When the effect is disabled (ghost kept alive to preserve the shadow\n // shader module), delegate to a default LightingEffect so phong/gouraud\n // layers get the same shading they had before the effect was ever added.\n if (!this._private.shadow) {\n const defaults = DEFAULT_LIGHTING_EFFECT.getShaderModuleProps(layer, otherShaderModuleProps);\n return {\n ...defaults,\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n pbrMaterial: {unlit: 1}\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n const props = super.getShaderModuleProps(layer, otherShaderModuleProps);\n\n if (\n props.shadow &&\n !(props.shadow as CustomShadowProps).dummyShadowMap &&\n this._private.dummyShadowMap\n ) {\n (props.shadow as CustomShadowProps).dummyShadowMap = this._private.dummyShadowMap;\n }\n\n if (props.shadow) {\n (props.shadow as CustomShadowProps).outputUniformShadow = this.outputUniformShadow;\n }\n\n if (isPbrLayer(layer)) {\n // PBR layers: disable PBR lighting (unlit=1 → outputs base texture color),\n // keep directional lights in the lighting uniforms, and enable our simple\n // phong replacement in the DECKGL_FILTER_COLOR hook. This gives us\n // ambient + NdotL diffuse without PBR microfacet specular artifacts.\n // Light direction is sky→surface (deck.gl convention), negated in GLSL.\n (props as any).pbrMaterial = {unlit: 1};\n if (props.shadow) {\n (props.shadow as CustomShadowProps).useSimplePhong = true;\n }\n return props;\n }\n\n (props as any).pbrMaterial = {unlit: 0};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AC;UACDd,WAAW,EAAE;YAAC0C,KAAK,EAAE;UAAC;QAAC;MAE3B;MAEA,IAAM5C,KAAK,GAAAxK,aAAA,CAAA2K,wBAAA,oCAA8BpH,KAAK,EAAEyJ,sBAAsB,EAAC;MAEvE,IACExC,KAAK,CAACxB,MAAM,IACZ,CAAEwB,KAAK,CAACxB,MAAM,CAAuBwC,cAAc,IACnD,IAAI,CAACD,QAAQ,CAACC,cAAc,EAC5B;QACChB,KAAK,CAACxB,MAAM,CAAuBwC,cAAc,GAAG,IAAI,CAACD,QAAQ,CAACC,cAAc;MACnF;MAEA,IAAIhB,KAAK,CAACxB,MAAM,EAAE;QACfwB,KAAK,CAACxB,MAAM,CAAuBS,mBAAmB,GAAG,IAAI,CAACA,mBAAmB;MACpF;MAEA,IAAIY,UAAU,CAAC9G,KAAK,CAAC,EAAE;QACrB;QACA;QACA;QACA;QACA;QACCiH,KAAK,CAASE,WAAW,GAAG;UAAC0C,KAAK,EAAE;QAAC,CAAC;QACvC,IAAI5C,KAAK,CAACxB,MAAM,EAAE;UACfwB,KAAK,CAACxB,MAAM,CAAuBU,cAAc,GAAG,IAAI;QAC3D;QACA,OAAOc,KAAK;MACd;MAECA,KAAK,CAASE,WAAW,GAAG;QAAC0C,KAAK,EAAE;MAAC,CAAC;MAEvC,OAAO5C,KAAK;IACd;EAAC;AAAA,EA7IoC5H,oBAAc;AAAA,IAAA4K,QAAA,GAAAtD,OAAA,cAgJtCS,wBAAwB","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ export declare function patchShadowPassDepth(pass: {
|
|
|
10
10
|
* fully shadowed. For the shadow pass only, read the live GL buffer; restore
|
|
11
11
|
* afterward so the color pass / basemap stay aligned.
|
|
12
12
|
*/
|
|
13
|
-
export declare function alignExportShadowPass(shadowPass: any, isExportMode: () => boolean): void;
|
|
13
|
+
export declare function alignExportShadowPass(shadowPass: any, isExportMode: () => boolean, getResolution?: () => number): void;
|
|
14
14
|
export declare const shadowMapHoverFixModule: ShaderModule;
|
|
15
15
|
/**
|
|
16
16
|
* Custom LightingEffect for kepler.gl.
|
|
@@ -28,6 +28,7 @@ declare class CustomDeckLightingEffect extends LightingEffect {
|
|
|
28
28
|
useInPicking: boolean;
|
|
29
29
|
outputUniformShadow: boolean;
|
|
30
30
|
isExportMode: boolean;
|
|
31
|
+
shadowMapResolution: number;
|
|
31
32
|
private isPicking;
|
|
32
33
|
private get _private();
|
|
33
34
|
constructor(props: any);
|
|
@@ -8,7 +8,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
8
8
|
// SPDX-License-Identifier: MIT
|
|
9
9
|
// Copyright contributors to the kepler.gl project
|
|
10
10
|
|
|
11
|
-
var NON_ANIMATABLE_PARAMETERS = new Set(['animateHeight', 'heightEnd', 'linearEasing']);
|
|
11
|
+
var NON_ANIMATABLE_PARAMETERS = new Set(['animateHeight', 'heightEnd', 'linearEasing', 'shadowMapResolution']);
|
|
12
12
|
var MAX_DATE_TIMESTAMP = 8.64e15;
|
|
13
13
|
function isAnimatableParameter(description) {
|
|
14
14
|
var name = description.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-utils.js","names":["NON_ANIMATABLE_PARAMETERS","Set","MAX_DATE_TIMESTAMP","isAnimatableParameter","description","name","type","min","max","defaultValue","startsWith","has","Number","isFinite","Array","isArray","length","every","undefined","getAnimatableEffectParameters","effect","getParameterDescriptions","filter","validateEffectAnimation","animation","descriptions","_typeof","result","_iterator","_createForOfIteratorHelper","_step","_loop","value","Object","prototype","hasOwnProperty","call","entry","easing","clampValue","Math","validateValue","from","map","abs","endValue","hasStart","startValue","_objectSpread","_ret","s","n","done","err","e","f","keys"],"sources":["../../src/animation-utils.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport type {Effect, EffectAnimation, EffectParameterDescription} from '@kepler.gl/types';\n\nconst NON_ANIMATABLE_PARAMETERS = new Set(['animateHeight'
|
|
1
|
+
{"version":3,"file":"animation-utils.js","names":["NON_ANIMATABLE_PARAMETERS","Set","MAX_DATE_TIMESTAMP","isAnimatableParameter","description","name","type","min","max","defaultValue","startsWith","has","Number","isFinite","Array","isArray","length","every","undefined","getAnimatableEffectParameters","effect","getParameterDescriptions","filter","validateEffectAnimation","animation","descriptions","_typeof","result","_iterator","_createForOfIteratorHelper","_step","_loop","value","Object","prototype","hasOwnProperty","call","entry","easing","clampValue","Math","validateValue","from","map","abs","endValue","hasStart","startValue","_objectSpread","_ret","s","n","done","err","e","f","keys"],"sources":["../../src/animation-utils.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport type {Effect, EffectAnimation, EffectParameterDescription} from '@kepler.gl/types';\n\nconst NON_ANIMATABLE_PARAMETERS = new Set([\n 'animateHeight',\n 'heightEnd',\n 'linearEasing',\n 'shadowMapResolution'\n]);\nconst MAX_DATE_TIMESTAMP = 8.64e15;\n\nfunction isAnimatableParameter(description: EffectParameterDescription): boolean {\n const {name, type, min, max, defaultValue} = description;\n if (\n name.startsWith('_') ||\n NON_ANIMATABLE_PARAMETERS.has(name) ||\n !Number.isFinite(min) ||\n !Number.isFinite(max) ||\n min > max\n ) {\n return false;\n }\n if (type === 'array' || type === 'color') {\n return (\n Array.isArray(defaultValue) && defaultValue.length > 0 && defaultValue.every(Number.isFinite)\n );\n }\n return type === undefined || type === 'number';\n}\n\nexport function getAnimatableEffectParameters(\n effect: Pick<Effect, 'getParameterDescriptions'>\n): EffectParameterDescription[] {\n return effect.getParameterDescriptions().filter(isAnimatableParameter);\n}\n\n/** Validate optional endpoints without creating animations for missing or invalid values. */\nexport function validateEffectAnimation(\n animation: unknown,\n descriptions: EffectParameterDescription[]\n): EffectAnimation | undefined {\n if (!animation || typeof animation !== 'object' || Array.isArray(animation)) {\n return undefined;\n }\n\n const result: EffectAnimation = {};\n for (const description of descriptions.filter(isAnimatableParameter)) {\n const {name, type, min, max, defaultValue} = description;\n if (!Object.prototype.hasOwnProperty.call(animation, name)) continue;\n const entry = (\n animation as Record<string, {startValue?: unknown; endValue?: unknown; easing?: unknown}>\n )[name];\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) continue;\n if (entry.easing !== 'linear' && entry.easing !== 'easeInOut') continue;\n\n const clampValue = (value: number) => Math.max(min, Math.min(max, value));\n const validateValue = (value: unknown): number | number[] | undefined => {\n if (type === 'array' || type === 'color') {\n if (\n !Array.isArray(value) ||\n value.length !== (defaultValue as number[]).length ||\n !Array.from(value).every(Number.isFinite)\n ) {\n return undefined;\n }\n return value.map(clampValue);\n }\n if (\n typeof value !== 'number' ||\n !Number.isFinite(value) ||\n (name === 'timestamp' && Math.abs(value) > MAX_DATE_TIMESTAMP)\n ) {\n return undefined;\n }\n return clampValue(value);\n };\n const endValue = validateValue(entry.endValue);\n const hasStart = Object.prototype.hasOwnProperty.call(entry, 'startValue');\n const startValue = hasStart ? validateValue(entry.startValue) : undefined;\n if (endValue === undefined || (hasStart && startValue === undefined)) continue;\n result[name] = {\n ...(hasStart ? {startValue} : {}),\n endValue,\n easing: entry.easing\n };\n }\n return Object.keys(result).length ? result : undefined;\n}\n"],"mappings":";;;;;;;AAAA;AACA;;AAIA,IAAMA,yBAAyB,GAAG,IAAIC,GAAG,CAAC,CACxC,eAAe,EACf,WAAW,EACX,cAAc,EACd,qBAAqB,CACtB,CAAC;AACF,IAAMC,kBAAkB,GAAG,OAAO;AAElC,SAASC,qBAAqBA,CAACC,WAAuC,EAAW;EAC/E,IAAOC,IAAI,GAAkCD,WAAW,CAAjDC,IAAI;IAAEC,IAAI,GAA4BF,WAAW,CAA3CE,IAAI;IAAEC,GAAG,GAAuBH,WAAW,CAArCG,GAAG;IAAEC,GAAG,GAAkBJ,WAAW,CAAhCI,GAAG;IAAEC,YAAY,GAAIL,WAAW,CAA3BK,YAAY;EACzC,IACEJ,IAAI,CAACK,UAAU,CAAC,GAAG,CAAC,IACpBV,yBAAyB,CAACW,GAAG,CAAC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AACQ,QAAQ,CAAC;QAC9C,IAAMC,QAAQ,GAAGb,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACC,KAAK,EAAE,YAAY,CAAC;QAC1E,IAAMU,UAAU,GAAGD,QAAQ,GAAGL,aAAa,CAACJ,KAAK,CAACU,UAAU,CAAC,GAAG7B,SAAS;QACzE,IAAI2B,QAAQ,KAAK3B,SAAS,IAAK4B,QAAQ,IAAIC,UAAU,KAAK7B,SAAU;QACpES,MAAM,CAACtB,IAAI,CAAC,GAAA2C,aAAA,CAAAA,aAAA,KACNF,QAAQ,GAAG;UAACC,UAAU,EAAVA;QAAU,CAAC,GAAG,CAAC,CAAC;UAChCF,QAAQ,EAARA,QAAQ;UACRP,MAAM,EAAED,KAAK,CAACC;QAAM,EACrB;MACH,CAAC;MAAAW,IAAA;IAvCD,KAAArB,SAAA,CAAAsB,CAAA,MAAApB,KAAA,GAAAF,SAAA,CAAAuB,CAAA,IAAAC,IAAA;MAAAH,IAAA,GAAAlB,KAAA;MAAA,IAAAkB,IAAA,QAE8D;IAAS;EAqCtE,SAAAI,GAAA;IAAAzB,SAAA,CAAA0B,CAAA,CAAAD,GAAA;EAAA;IAAAzB,SAAA,CAAA2B,CAAA;EAAA;EACD,OAAOtB,MAAM,CAACuB,IAAI,CAAC7B,MAAM,CAAC,CAACX,MAAM,GAAGW,MAAM,GAAGT,SAAS;AACxD","ignoreList":[]}
|
|
@@ -5,19 +5,19 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
|
5
5
|
import _get from "@babel/runtime/helpers/esm/get";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
9
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
10
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
11
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
// SPDX-License-Identifier: MIT
|
|
17
17
|
// Copyright contributors to the kepler.gl project
|
|
18
18
|
|
|
19
19
|
import { LightingEffect, shadow } from '@deck.gl/core';
|
|
20
|
-
import { EDITOR_LAYER_ID } from '@kepler.gl/constants';
|
|
20
|
+
import { EDITOR_LAYER_ID, SHADOW_MAP_RESOLUTIONS } from '@kepler.gl/constants';
|
|
21
21
|
import { patchTileViewportIds } from './tile-viewport-fix';
|
|
22
22
|
|
|
23
23
|
// A plain LightingEffect() — its constructor calls _applyDefaultLights()
|
|
@@ -48,6 +48,69 @@ export function patchShadowPassDepth(pass) {
|
|
|
48
48
|
|
|
49
49
|
/** Extended shadow module props with our custom field. */
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* ShadowPass exclusively owns its attachments, but passes them to luma as
|
|
53
|
+
* external textures. In luma 9.4.2 framebuffer.resize tracks the replacement
|
|
54
|
+
* color view, not its texture. A quality toggle otherwise leaks that texture.
|
|
55
|
+
*/
|
|
56
|
+
function ownShadowAttachments(fbo) {
|
|
57
|
+
var getTextures = function getTextures() {
|
|
58
|
+
var _fbo$colorAttachments, _fbo$depthStencilAtta;
|
|
59
|
+
var color = (_fbo$colorAttachments = fbo.colorAttachments[0]) === null || _fbo$colorAttachments === void 0 ? void 0 : _fbo$colorAttachments.texture;
|
|
60
|
+
var depth = (_fbo$depthStencilAtta = fbo.depthStencilAttachment) === null || _fbo$depthStencilAtta === void 0 ? void 0 : _fbo$depthStencilAtta.texture;
|
|
61
|
+
return [color, depth].filter(function (texture) {
|
|
62
|
+
return Boolean(texture);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
var _iterator = _createForOfIteratorHelper(getTextures()),
|
|
66
|
+
_step;
|
|
67
|
+
try {
|
|
68
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
69
|
+
var texture = _step.value;
|
|
70
|
+
fbo.attachResource(texture);
|
|
71
|
+
}
|
|
72
|
+
} catch (err) {
|
|
73
|
+
_iterator.e(err);
|
|
74
|
+
} finally {
|
|
75
|
+
_iterator.f();
|
|
76
|
+
}
|
|
77
|
+
var resize = fbo.resize.bind(fbo);
|
|
78
|
+
fbo.resize = function (size) {
|
|
79
|
+
var previous = getTextures();
|
|
80
|
+
try {
|
|
81
|
+
if (Array.isArray(size)) resize(size);else if (size) resize(size);else resize();
|
|
82
|
+
} finally {
|
|
83
|
+
var current = getTextures();
|
|
84
|
+
var _iterator2 = _createForOfIteratorHelper(previous),
|
|
85
|
+
_step2;
|
|
86
|
+
try {
|
|
87
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
88
|
+
var texture = _step2.value;
|
|
89
|
+
if (!current.includes(texture)) {
|
|
90
|
+
fbo.destroyAttachedResource(texture);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
} catch (err) {
|
|
94
|
+
_iterator2.e(err);
|
|
95
|
+
} finally {
|
|
96
|
+
_iterator2.f();
|
|
97
|
+
}
|
|
98
|
+
var _iterator3 = _createForOfIteratorHelper(current),
|
|
99
|
+
_step3;
|
|
100
|
+
try {
|
|
101
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
102
|
+
var _texture = _step3.value;
|
|
103
|
+
fbo.attachResource(_texture);
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
_iterator3.e(err);
|
|
107
|
+
} finally {
|
|
108
|
+
_iterator3.f();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
51
114
|
/**
|
|
52
115
|
* Video export shares MapLibre's canvas. Luma's cssToDeviceRatio() can lag that
|
|
53
116
|
* bitmap, so ShadowPass draws into a corner of its FBO and the rest samples as
|
|
@@ -55,13 +118,62 @@ export function patchShadowPassDepth(pass) {
|
|
|
55
118
|
* afterward so the color pass / basemap stay aligned.
|
|
56
119
|
*/
|
|
57
120
|
export function alignExportShadowPass(shadowPass, isExportMode) {
|
|
121
|
+
var getResolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
122
|
+
return SHADOW_MAP_RESOLUTIONS.auto;
|
|
123
|
+
};
|
|
58
124
|
var render = shadowPass.render.bind(shadowPass);
|
|
125
|
+
var ownsAttachments = false;
|
|
59
126
|
shadowPass.render = function (params) {
|
|
60
|
-
var _shadowPass$device, _shadowPass$device2, _params$
|
|
61
|
-
if (!isExportMode())
|
|
127
|
+
var _shadowPass$device, _shadowPass$device2, _params$viewports2, _gl$getParameter, _gl$DEPTH_RANGE, _gl$depthRange;
|
|
128
|
+
if (!isExportMode()) {
|
|
129
|
+
var _params$viewports, _device$limits$maxTex, _device$limits;
|
|
130
|
+
var scale = getResolution();
|
|
131
|
+
if (scale !== SHADOW_MAP_RESOLUTIONS.low && scale !== SHADOW_MAP_RESOLUTIONS.high) {
|
|
132
|
+
return render(params);
|
|
133
|
+
}
|
|
134
|
+
var _device = shadowPass.device;
|
|
135
|
+
var _canvasContext = _device === null || _device === void 0 ? void 0 : _device.canvasContext;
|
|
136
|
+
var _viewport = params === null || params === void 0 || (_params$viewports = params.viewports) === null || _params$viewports === void 0 ? void 0 : _params$viewports[0];
|
|
137
|
+
if ((_device === null || _device === void 0 ? void 0 : _device.type) !== 'webgl' || !_canvasContext || params.viewports.length !== 1 || !(_viewport !== null && _viewport !== void 0 && _viewport.width) || !_viewport.height || _viewport.x || _viewport.y) {
|
|
138
|
+
return render(params);
|
|
139
|
+
}
|
|
140
|
+
var _prevSize = _canvasContext.getDrawingBufferSize;
|
|
141
|
+
var _prevRatio = _canvasContext.cssToDeviceRatio;
|
|
142
|
+
var ratio = _prevRatio.call(_canvasContext);
|
|
143
|
+
var _width = _viewport.width,
|
|
144
|
+
_height = _viewport.height;
|
|
145
|
+
if (!Number.isFinite(ratio) || ratio <= 0 || _width * ratio * scale < 1 || _height * ratio * scale < 1) {
|
|
146
|
+
return render(params);
|
|
147
|
+
}
|
|
148
|
+
// Never increase to more than ~48 MiB of raw RGBA8 + depth16 per map.
|
|
149
|
+
// If Auto already exceeds the bound, High must not reduce its quality.
|
|
150
|
+
var limit = Math.min((_device$limits$maxTex = (_device$limits = _device.limits) === null || _device$limits === void 0 ? void 0 : _device$limits.maxTextureDimension2D) !== null && _device$limits$maxTex !== void 0 ? _device$limits$maxTex : 4096, 4096);
|
|
151
|
+
var maxRatio = Math.min(limit / _width, limit / _height, Math.sqrt(8e6 / (_width * _height)));
|
|
152
|
+
var scaledRatio = scale === SHADOW_MAP_RESOLUTIONS.high ? Math.max(ratio, Math.min(ratio * scale, maxRatio)) : ratio * scale;
|
|
153
|
+
if (!Number.isFinite(scaledRatio) || scaledRatio === ratio) return render(params);
|
|
154
|
+
if (!ownsAttachments && shadowPass.fbo) {
|
|
155
|
+
ownShadowAttachments(shadowPass.fbo);
|
|
156
|
+
ownsAttachments = true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// ShadowPass and LayersPass must see the same ratio: one allocates the
|
|
160
|
+
// texture, the other scales its viewport. Color and picking keep Auto.
|
|
161
|
+
_canvasContext.getDrawingBufferSize = function () {
|
|
162
|
+
return [Math.floor(_width * scaledRatio), Math.floor(_height * scaledRatio)];
|
|
163
|
+
};
|
|
164
|
+
_canvasContext.cssToDeviceRatio = function () {
|
|
165
|
+
return scaledRatio;
|
|
166
|
+
};
|
|
167
|
+
try {
|
|
168
|
+
return render(params);
|
|
169
|
+
} finally {
|
|
170
|
+
_canvasContext.getDrawingBufferSize = _prevSize;
|
|
171
|
+
_canvasContext.cssToDeviceRatio = _prevRatio;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
62
174
|
var gl = (_shadowPass$device = shadowPass.device) === null || _shadowPass$device === void 0 ? void 0 : _shadowPass$device.gl;
|
|
63
175
|
var canvasContext = (_shadowPass$device2 = shadowPass.device) === null || _shadowPass$device2 === void 0 ? void 0 : _shadowPass$device2.canvasContext;
|
|
64
|
-
var viewport = params === null || params === void 0 || (_params$
|
|
176
|
+
var viewport = params === null || params === void 0 || (_params$viewports2 = params.viewports) === null || _params$viewports2 === void 0 ? void 0 : _params$viewports2[0];
|
|
65
177
|
var width = gl === null || gl === void 0 ? void 0 : gl.drawingBufferWidth;
|
|
66
178
|
var height = gl === null || gl === void 0 ? void 0 : gl.drawingBufferHeight;
|
|
67
179
|
if (!gl || !canvasContext || !(viewport !== null && viewport !== void 0 && viewport.width) || !width || !height) {
|
|
@@ -190,9 +302,11 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
190
302
|
_defineProperty(_this, "useInPicking", true);
|
|
191
303
|
_defineProperty(_this, "outputUniformShadow", void 0);
|
|
192
304
|
_defineProperty(_this, "isExportMode", void 0);
|
|
305
|
+
_defineProperty(_this, "shadowMapResolution", void 0);
|
|
193
306
|
_defineProperty(_this, "isPicking", false);
|
|
194
307
|
_this.outputUniformShadow = false;
|
|
195
308
|
_this.isExportMode = false;
|
|
309
|
+
_this.shadowMapResolution = SHADOW_MAP_RESOLUTIONS.auto;
|
|
196
310
|
return _this;
|
|
197
311
|
}
|
|
198
312
|
_inherits(CustomDeckLightingEffect, _LightingEffect);
|
|
@@ -210,20 +324,22 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
210
324
|
deck = context.deck;
|
|
211
325
|
if (this._private.shadow && !this._private.dummyShadowMap) {
|
|
212
326
|
this._private._createShadowPasses(device);
|
|
213
|
-
var
|
|
214
|
-
|
|
327
|
+
var _iterator4 = _createForOfIteratorHelper(this._private.shadowPasses),
|
|
328
|
+
_step4;
|
|
215
329
|
try {
|
|
216
|
-
for (
|
|
217
|
-
var shadowPass =
|
|
330
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
331
|
+
var shadowPass = _step4.value;
|
|
218
332
|
patchShadowPassDepth(shadowPass);
|
|
219
333
|
alignExportShadowPass(shadowPass, function () {
|
|
220
334
|
return _this2.isExportMode;
|
|
335
|
+
}, function () {
|
|
336
|
+
return _this2.shadowMapResolution;
|
|
221
337
|
});
|
|
222
338
|
}
|
|
223
339
|
} catch (err) {
|
|
224
|
-
|
|
340
|
+
_iterator4.e(err);
|
|
225
341
|
} finally {
|
|
226
|
-
|
|
342
|
+
_iterator4.f();
|
|
227
343
|
}
|
|
228
344
|
deck._addDefaultShaderModule(CustomShadowModule || shadow);
|
|
229
345
|
deck._addDefaultShaderModule(shadowMapHoverFixModule);
|
|
@@ -241,6 +357,15 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
241
357
|
this.isPicking = Boolean(opts.isPicking);
|
|
242
358
|
if (this.isPicking || !this._private.shadow) return;
|
|
243
359
|
|
|
360
|
+
// kepler turns shadows on by setting `shadow` directly (updateEffect in
|
|
361
|
+
// effect-utils), not through setProps, so deck.gl does not call setup()
|
|
362
|
+
// again. An effect set up while its shadows were off (a map loaded with
|
|
363
|
+
// Light & Shadow disabled) has no shadow passes and no shadow module:
|
|
364
|
+
// create them now. deck.gl rebuilds the layers with the module next frame.
|
|
365
|
+
if (!this._private.dummyShadowMap && this.context) {
|
|
366
|
+
this.setup(this.context);
|
|
367
|
+
}
|
|
368
|
+
|
|
244
369
|
// Filter editor layers out of the shadow pass so they don't cast shadows.
|
|
245
370
|
var originalLayers = opts.layers;
|
|
246
371
|
opts.layers = originalLayers.filter(function (l) {
|
|
@@ -257,17 +382,17 @@ var CustomDeckLightingEffect = /*#__PURE__*/function (_LightingEffect) {
|
|
|
257
382
|
}, {
|
|
258
383
|
key: "cleanup",
|
|
259
384
|
value: function cleanup(context) {
|
|
260
|
-
var
|
|
261
|
-
|
|
385
|
+
var _iterator5 = _createForOfIteratorHelper(this._private.shadowPasses),
|
|
386
|
+
_step5;
|
|
262
387
|
try {
|
|
263
|
-
for (
|
|
264
|
-
var shadowPass =
|
|
388
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
389
|
+
var shadowPass = _step5.value;
|
|
265
390
|
shadowPass["delete"]();
|
|
266
391
|
}
|
|
267
392
|
} catch (err) {
|
|
268
|
-
|
|
393
|
+
_iterator5.e(err);
|
|
269
394
|
} finally {
|
|
270
|
-
|
|
395
|
+
_iterator5.f();
|
|
271
396
|
}
|
|
272
397
|
this._private.shadowPasses.length = 0;
|
|
273
398
|
if (this._private.dummyShadowMap) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-deck-lighting-effect.js","names":["LightingEffect","shadow","EDITOR_LAYER_ID","patchTileViewportIds","DEFAULT_LIGHTING_EFFECT","SHADOW_PASS_DEPTH_PARAMETERS","depthTest","depthMask","polygonOffsetFill","polygonOffset","patchShadowPassDepth","pass","originalGetLayerParameters","getLayerParameters","bind","layer","layerIndex","viewport","_objectSpread","alignExportShadowPass","shadowPass","isExportMode","render","params","_shadowPass$device","_shadowPass$device2","_params$viewports","_gl$getParameter","_gl$DEPTH_RANGE","_gl$depthRange","gl","device","canvasContext","viewports","width","drawingBufferWidth","height","drawingBufferHeight","prevSize","getDrawingBufferSize","prevRatio","cssToDeviceRatio","prevDepth","getParameter","call","DEPTH_RANGE","depthRange","_gl$depthRange2","insertBefore","source","target","textToInsert","at","indexOf","slice","createCustomShadowModule","mod","uboField","vs","fs","concat","replace","inject","uniformTypes","outputUniformShadow","useSimplePhong","originalGetUniforms","getUniforms","opts","arguments","length","undefined","context","u","CustomShadowModule","PICKING_FILTER_COLOR_ORDER","shadowMapHoverFixModule","name","order","injection","isPbrLayer","_layer$props","_layer$props2","props","_lighting","pbrMaterial","CustomDeckLightingEffect","_LightingEffect","_this","_classCallCheck","_callSuper","_defineProperty","_inherits","_createClass","key","get","value","setup","_this2","deck","_private","dummyShadowMap","_createShadowPasses","_iterator","_createForOfIteratorHelper","shadowPasses","_step","s","n","done","err","e","f","_addDefaultShaderModule","createTexture","preRender","_unpatch","isPicking","Boolean","originalLayers","layers","filter","l","id","startsWith","unpatch","_superPropGet","cleanup","_iterator2","_step2","destroy","_removeDefaultShaderModule","getShaderModuleProps","otherShaderModuleProps","shadowEnabled","lighting","enabled","unlit","phongMaterial","gouraudMaterial","defaults"],"sources":["../../src/custom-deck-lighting-effect.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {LightingEffect, shadow} from '@deck.gl/core';\nimport type {Texture} from '@luma.gl/core';\nimport type {ShaderModule} from '@luma.gl/shadertools';\nimport {EDITOR_LAYER_ID} from '@kepler.gl/constants';\nimport {patchTileViewportIds} from './tile-viewport-fix';\n\n// A plain LightingEffect() — its constructor calls _applyDefaultLights()\n// which populates the same default lights that deck.gl's EffectManager\n// uses internally. This is used to restore the original shading.\nconst DEFAULT_LIGHTING_EFFECT = new LightingEffect();\n\n/**\n * Exposes private members of LightingEffect that we need to access.\n * These are runtime-accessible but TypeScript marks them as private.\n */\ninterface LightingEffectPrivate {\n shadow: boolean;\n shadowPasses: {\n delete(): void;\n render(params: Record<string, unknown>): void;\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n }[];\n dummyShadowMap: Texture | null;\n _createShadowPasses(device: unknown): void;\n}\n\n// WebGL applies GL-style depthTest/depthMask; deck.gl's ShadowPass only sets\n// depthWriteEnabled. Disable polygonOffset so a later ground plane is not\n// pulled toward the sun and cannot overwrite building walls in the shadow map.\nconst SHADOW_PASS_DEPTH_PARAMETERS = {\n depthTest: true,\n depthMask: true,\n polygonOffsetFill: false,\n polygonOffset: [0, 0]\n};\n\nexport function patchShadowPassDepth(pass: {\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n}) {\n const originalGetLayerParameters = pass.getLayerParameters.bind(pass);\n pass.getLayerParameters = (layer, layerIndex, viewport) => ({\n ...originalGetLayerParameters(layer, layerIndex, viewport),\n ...SHADOW_PASS_DEPTH_PARAMETERS\n });\n}\n\n/** Extended shadow module props with our custom field. */\ninterface CustomShadowProps {\n outputUniformShadow?: boolean;\n useSimplePhong?: boolean;\n dummyShadowMap?: Texture | null;\n [key: string]: unknown;\n}\n\n/**\n * Video export shares MapLibre's canvas. Luma's cssToDeviceRatio() can lag that\n * bitmap, so ShadowPass draws into a corner of its FBO and the rest samples as\n * fully shadowed. For the shadow pass only, read the live GL buffer; restore\n * afterward so the color pass / basemap stay aligned.\n */\nexport function alignExportShadowPass(shadowPass: any, isExportMode: () => boolean): void {\n const render = shadowPass.render.bind(shadowPass);\n shadowPass.render = params => {\n if (!isExportMode()) return render(params);\n\n const gl = shadowPass.device?.gl;\n const canvasContext = shadowPass.device?.canvasContext;\n const viewport = params?.viewports?.[0];\n const width = gl?.drawingBufferWidth;\n const height = gl?.drawingBufferHeight;\n if (!gl || !canvasContext || !viewport?.width || !width || !height) {\n return render(params);\n }\n\n const prevSize = canvasContext.getDrawingBufferSize;\n const prevRatio = canvasContext.cssToDeviceRatio;\n const prevDepth = gl.getParameter?.(gl.DEPTH_RANGE ?? 0x0b70);\n canvasContext.getDrawingBufferSize = () => [width, height];\n canvasContext.cssToDeviceRatio = () => width / viewport.width;\n gl.depthRange?.(0, 1);\n try {\n return render(params);\n } finally {\n canvasContext.getDrawingBufferSize = prevSize;\n canvasContext.cssToDeviceRatio = prevRatio;\n if (prevDepth) gl.depthRange?.(prevDepth[0], prevDepth[1]);\n }\n };\n}\n\n/**\n * Insert text before a target string in shader source.\n */\nfunction insertBefore(source: string, target: string, textToInsert: string): string {\n const at = source.indexOf(target);\n if (at < 0) return source;\n return source.slice(0, at) + textToInsert + source.slice(at);\n}\n\n/**\n * Create a patched shadow module that adds:\n * - `outputUniformShadow`: when true, shadow_getShadowWeight returns 1.0\n * (full uniform shadow) instead of sampling the shadow map.\n * - `useSimplePhong`: when true, replaces PBR lighting with simple\n * Lambertian diffuse (ambient + NdotL) for 3D tile layers, avoiding\n * the PBR microfacet specular artifacts on flat surfaces.\n *\n * Also fixes the vertex injection to be a no-op when shadows are disabled,\n * preventing position corruption in billboard layers (e.g. the editor layer).\n */\nfunction createCustomShadowModule(): ShaderModule | null {\n if (!shadow) return null;\n\n const mod = {...shadow} as Record<string, any>;\n\n const uboField = ' float outputUniformShadow;\\n float useSimplePhong;\\n';\n mod.vs = insertBefore(mod.vs, '} shadow;', uboField);\n mod.fs = insertBefore(mod.fs, '} shadow;', uboField);\n\n // Add a varying to carry the common-space position for simple phong normals.\n mod.vs = `out vec3 custom_vWorldPos;\\n${mod.vs}`;\n mod.fs = `in vec3 custom_vWorldPos;\\n${mod.fs}`;\n\n mod.fs = insertBefore(\n mod.fs,\n 'vec4 rgbaDepth = texture(shadowMap, position.xy);',\n 'if (shadow.outputUniformShadow > 0.5) return 1.0;\\n '\n );\n\n // Patch the VS so the fallback returns the caller's position instead of\n // gl_Position (which is uninitialised when the hook fires in billboard\n // layers like PathLayer / the editor polygon tool).\n mod.vs = mod.vs\n .replace(\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace)',\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace, vec4 currentPosition)'\n )\n .replace(/return gl_Position;\\s*\\}/, 'return currentPosition;\\n}');\n\n mod.inject = {\n ...shadow.inject,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n position = shadow_setVertexPosition(geometry.position, position);\n custom_vWorldPos = geometry.position.xyz;\n `,\n 'fs:DECKGL_FILTER_COLOR': `\n #ifdef LIGHTING_FRAGMENT\n if (shadow.useSimplePhong > 0.5) {\n vec3 spDx = dFdx(custom_vWorldPos);\n vec3 spDy = dFdy(custom_vWorldPos);\n vec3 spN = normalize(cross(spDx, spDy));\n vec3 spLit = lighting.ambientColor;\n for (int i = 0; i < 3; i++) {\n if (i >= lighting.directionalLightCount) break;\n vec3 spDir = lighting_getDirectionalLight(i).direction;\n float spNdotL = max(dot(spN, -normalize(spDir)), 0.0);\n spLit += lighting_getDirectionalLight(i).color * spNdotL;\n }\n color.rgb *= spLit;\n }\n #endif\n color = shadow_filterShadowColor(color);\n `\n };\n\n mod.uniformTypes = {\n ...shadow.uniformTypes,\n outputUniformShadow: 'f32',\n useSimplePhong: 'f32'\n };\n\n const originalGetUniforms = shadow.getUniforms as (\n opts: Record<string, unknown>,\n prevUniforms: Record<string, unknown>\n ) => Record<string, unknown>;\n mod.getUniforms = (opts: CustomShadowProps = {}, context = {}) => {\n const u = originalGetUniforms(opts, context);\n u.outputUniformShadow = opts.outputUniformShadow ? 1.0 : 0.0;\n u.useSimplePhong = opts.useSimplePhong ? 1.0 : 0.0;\n return u;\n };\n\n return mod as unknown as ShaderModule;\n}\n\nconst CustomShadowModule = createCustomShadowModule();\n\n// deck.gl picking injects at order 99 and blends highlightColor over the\n// fragment. In the shadow pass that overwrites encoded depth, so a hovered\n// extruded feature stops casting a shadow. Re-encode after picking.\n// Color-pass highlight compositing is unchanged (shadow still runs first).\nconst PICKING_FILTER_COLOR_ORDER = 99;\n\nexport const shadowMapHoverFixModule = {\n name: 'shadow-map-hover-fix',\n inject: {\n 'fs:DECKGL_FILTER_COLOR': {\n order: PICKING_FILTER_COLOR_ORDER + 1,\n injection: `\n if (shadow.drawShadowMap) {\n color = shadow_filterShadowColor(color);\n }\n `\n }\n }\n} as unknown as ShaderModule;\n\n/**\n * Detect layers that use the PBR shader module (3D tile sublayers:\n * ScenegraphLayer sets `_lighting: 'pbr'`, SimpleMeshLayer sets `pbrMaterial`).\n */\nfunction isPbrLayer(layer: any): boolean {\n return layer.props?._lighting === 'pbr' || layer.props?.pbrMaterial !== undefined;\n}\n\n/**\n * Custom LightingEffect for kepler.gl.\n *\n * Extends deck.gl's LightingEffect with:\n * - A patched shadow module with `outputUniformShadow` for uniform shadow\n * during nighttime (avoids partial shadows from below).\n * - Simple phong replacement for PBR layers (avoids microfacet specular).\n * - Shadow-map depth re-encoded after picking highlight so hovered extruded\n * features still cast shadows.\n * - getShaderModuleProps override that always provides dummyShadowMap\n * to prevent \"Bad texture binding\" errors when shadows are disabled.\n */\nclass CustomDeckLightingEffect extends LightingEffect {\n // Picking still needs the sampler bindings for the installed shadow shader.\n useInPicking = true;\n outputUniformShadow: boolean;\n isExportMode: boolean;\n private isPicking = false;\n\n private get _private(): LightingEffectPrivate {\n return this as unknown as LightingEffectPrivate;\n }\n\n constructor(props) {\n super(props);\n this.outputUniformShadow = false;\n this.isExportMode = false;\n }\n\n setup(context) {\n this.context = context;\n const {device, deck} = context;\n if (this._private.shadow && !this._private.dummyShadowMap) {\n this._private._createShadowPasses(device);\n for (const shadowPass of this._private.shadowPasses) {\n patchShadowPassDepth(shadowPass);\n alignExportShadowPass(shadowPass, () => this.isExportMode);\n }\n deck._addDefaultShaderModule(CustomShadowModule || shadow);\n deck._addDefaultShaderModule(shadowMapHoverFixModule);\n this._private.dummyShadowMap = device.createTexture({width: 1, height: 1});\n }\n }\n\n preRender(opts) {\n // Effects resolve their props before deck sets the picking shader flag.\n this.isPicking = Boolean(opts.isPicking);\n if (this.isPicking || !this._private.shadow) return;\n\n // Filter editor layers out of the shadow pass so they don't cast shadows.\n const originalLayers = opts.layers;\n opts.layers = originalLayers.filter(l => !l.id.startsWith(EDITOR_LAYER_ID));\n\n let unpatch: (() => void) | undefined;\n if (this.isExportMode) {\n unpatch = patchTileViewportIds(opts);\n }\n\n super.preRender(opts);\n\n unpatch?.();\n\n opts.layers = originalLayers;\n }\n\n cleanup(context) {\n for (const shadowPass of this._private.shadowPasses) {\n shadowPass.delete();\n }\n this._private.shadowPasses.length = 0;\n if (this._private.dummyShadowMap) {\n this._private.dummyShadowMap.destroy();\n this._private.dummyShadowMap = null;\n context.deck._removeDefaultShaderModule(CustomShadowModule || shadow);\n context.deck._removeDefaultShaderModule(shadowMapHoverFixModule);\n }\n }\n\n getShaderModuleProps(layer, otherShaderModuleProps) {\n // Picking and editor layers need sampler bindings without shadow calculations.\n if (this.isPicking || layer.id.startsWith(EDITOR_LAYER_ID)) {\n return {\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n lighting: {enabled: false},\n pbrMaterial: {unlit: 1},\n phongMaterial: null,\n gouraudMaterial: null\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n // When the effect is disabled (ghost kept alive to preserve the shadow\n // shader module), delegate to a default LightingEffect so phong/gouraud\n // layers get the same shading they had before the effect was ever added.\n if (!this._private.shadow) {\n const defaults = DEFAULT_LIGHTING_EFFECT.getShaderModuleProps(layer, otherShaderModuleProps);\n return {\n ...defaults,\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n pbrMaterial: {unlit: 1}\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n const props = super.getShaderModuleProps(layer, otherShaderModuleProps);\n\n if (\n props.shadow &&\n !(props.shadow as CustomShadowProps).dummyShadowMap &&\n this._private.dummyShadowMap\n ) {\n (props.shadow as CustomShadowProps).dummyShadowMap = this._private.dummyShadowMap;\n }\n\n if (props.shadow) {\n (props.shadow as CustomShadowProps).outputUniformShadow = this.outputUniformShadow;\n }\n\n if (isPbrLayer(layer)) {\n // PBR layers: disable PBR lighting (unlit=1 → outputs base texture color),\n // keep directional lights in the lighting uniforms, and enable our simple\n // phong replacement in the DECKGL_FILTER_COLOR hook. This gives us\n // ambient + NdotL diffuse without PBR microfacet specular artifacts.\n // Light direction is sky→surface (deck.gl convention), negated in GLSL.\n (props as any).pbrMaterial = {unlit: 1};\n if (props.shadow) {\n (props.shadow as CustomShadowProps).useSimplePhong = true;\n }\n return props;\n }\n\n (props as any).pbrMaterial = {unlit: 0};\n\n return props;\n }\n}\n\nexport default CustomDeckLightingEffect;\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;AAEA,SAAQA,cAAc,EAAEC,MAAM,QAAO,eAAe;AAGpD,SAAQC,eAAe,QAAO,sBAAsB;AACpD,SAAQC,oBAAoB,QAAO,qBAAqB;;AAExD;AACA;AACA;AACA,IAAMC,uBAAuB,GAAG,IAAIJ,cAAc,CAAC,CAAC;;AAEpD;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA,IAAMK,4BAA4B,GAAG;EACnCC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,IAAI;EACfC,iBAAiB,EAAE,KAAK;EACxBC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC;AACtB,CAAC;AAED,OAAO,SAASC,oBAAoBA,CAACC,IAMpC,EAA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AK;IACd;EAAC;AAAA,EA9HoCnF,cAAc;AAiIrD,eAAesF,wBAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"custom-deck-lighting-effect.js","names":["LightingEffect","shadow","EDITOR_LAYER_ID","SHADOW_MAP_RESOLUTIONS","patchTileViewportIds","DEFAULT_LIGHTING_EFFECT","SHADOW_PASS_DEPTH_PARAMETERS","depthTest","depthMask","polygonOffsetFill","polygonOffset","patchShadowPassDepth","pass","originalGetLayerParameters","getLayerParameters","bind","layer","layerIndex","viewport","_objectSpread","ownShadowAttachments","fbo","getTextures","_fbo$colorAttachments","_fbo$depthStencilAtta","color","colorAttachments","texture","depth","depthStencilAttachment","filter","Boolean","_iterator","_createForOfIteratorHelper","_step","s","n","done","value","attachResource","err","e","f","resize","size","previous","Array","isArray","current","_iterator2","_step2","includes","destroyAttachedResource","_iterator3","_step3","alignExportShadowPass","shadowPass","isExportMode","getResolution","arguments","length","undefined","auto","render","ownsAttachments","params","_shadowPass$device","_shadowPass$device2","_params$viewports2","_gl$getParameter","_gl$DEPTH_RANGE","_gl$depthRange","_params$viewports","_device$limits$maxTex","_device$limits","scale","low","high","device","canvasContext","viewports","type","width","height","x","y","prevSize","getDrawingBufferSize","prevRatio","cssToDeviceRatio","ratio","call","Number","isFinite","limit","Math","min","limits","maxTextureDimension2D","maxRatio","sqrt","scaledRatio","max","floor","gl","drawingBufferWidth","drawingBufferHeight","prevDepth","getParameter","DEPTH_RANGE","depthRange","_gl$depthRange2","insertBefore","source","target","textToInsert","at","indexOf","slice","createCustomShadowModule","mod","uboField","vs","fs","concat","replace","inject","uniformTypes","outputUniformShadow","useSimplePhong","originalGetUniforms","getUniforms","opts","context","u","CustomShadowModule","PICKING_FILTER_COLOR_ORDER","shadowMapHoverFixModule","name","order","injection","isPbrLayer","_layer$props","_layer$props2","props","_lighting","pbrMaterial","CustomDeckLightingEffect","_LightingEffect","_this","_classCallCheck","_callSuper","_defineProperty","shadowMapResolution","_inherits","_createClass","key","get","setup","_this2","deck","_private","dummyShadowMap","_createShadowPasses","_iterator4","shadowPasses","_step4","_addDefaultShaderModule","createTexture","preRender","_unpatch","isPicking","originalLayers","layers","l","id","startsWith","unpatch","_superPropGet","cleanup","_iterator5","_step5","destroy","_removeDefaultShaderModule","getShaderModuleProps","otherShaderModuleProps","shadowEnabled","lighting","enabled","unlit","phongMaterial","gouraudMaterial","defaults"],"sources":["../../src/custom-deck-lighting-effect.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {LightingEffect, shadow} from '@deck.gl/core';\nimport type {Framebuffer, Texture} from '@luma.gl/core';\nimport type {ShaderModule} from '@luma.gl/shadertools';\nimport {EDITOR_LAYER_ID, SHADOW_MAP_RESOLUTIONS} from '@kepler.gl/constants';\nimport {patchTileViewportIds} from './tile-viewport-fix';\n\n// A plain LightingEffect() — its constructor calls _applyDefaultLights()\n// which populates the same default lights that deck.gl's EffectManager\n// uses internally. This is used to restore the original shading.\nconst DEFAULT_LIGHTING_EFFECT = new LightingEffect();\n\n/**\n * Exposes private members of LightingEffect that we need to access.\n * These are runtime-accessible but TypeScript marks them as private.\n */\ninterface LightingEffectPrivate {\n shadow: boolean;\n shadowPasses: {\n delete(): void;\n render(params: Record<string, unknown>): void;\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n }[];\n dummyShadowMap: Texture | null;\n _createShadowPasses(device: unknown): void;\n}\n\n// WebGL applies GL-style depthTest/depthMask; deck.gl's ShadowPass only sets\n// depthWriteEnabled. Disable polygonOffset so a later ground plane is not\n// pulled toward the sun and cannot overwrite building walls in the shadow map.\nconst SHADOW_PASS_DEPTH_PARAMETERS = {\n depthTest: true,\n depthMask: true,\n polygonOffsetFill: false,\n polygonOffset: [0, 0]\n};\n\nexport function patchShadowPassDepth(pass: {\n getLayerParameters: (\n layer: unknown,\n layerIndex: number,\n viewport: unknown\n ) => Record<string, unknown>;\n}) {\n const originalGetLayerParameters = pass.getLayerParameters.bind(pass);\n pass.getLayerParameters = (layer, layerIndex, viewport) => ({\n ...originalGetLayerParameters(layer, layerIndex, viewport),\n ...SHADOW_PASS_DEPTH_PARAMETERS\n });\n}\n\n/** Extended shadow module props with our custom field. */\ninterface CustomShadowProps {\n outputUniformShadow?: boolean;\n useSimplePhong?: boolean;\n dummyShadowMap?: Texture | null;\n [key: string]: unknown;\n}\n\n/**\n * ShadowPass exclusively owns its attachments, but passes them to luma as\n * external textures. In luma 9.4.2 framebuffer.resize tracks the replacement\n * color view, not its texture. A quality toggle otherwise leaks that texture.\n */\nfunction ownShadowAttachments(fbo: Framebuffer): void {\n const getTextures = () => {\n const color = fbo.colorAttachments[0]?.texture;\n const depth = fbo.depthStencilAttachment?.texture;\n return [color, depth].filter((texture): texture is Texture => Boolean(texture));\n };\n for (const texture of getTextures()) fbo.attachResource(texture);\n\n const resize = fbo.resize.bind(fbo);\n fbo.resize = (size?: {width: number; height: number} | [number, number]) => {\n const previous = getTextures();\n try {\n if (Array.isArray(size)) resize(size);\n else if (size) resize(size);\n else resize();\n } finally {\n const current = getTextures();\n for (const texture of previous) {\n if (!current.includes(texture)) {\n fbo.destroyAttachedResource(texture);\n }\n }\n for (const texture of current) fbo.attachResource(texture);\n }\n };\n}\n\n/**\n * Video export shares MapLibre's canvas. Luma's cssToDeviceRatio() can lag that\n * bitmap, so ShadowPass draws into a corner of its FBO and the rest samples as\n * fully shadowed. For the shadow pass only, read the live GL buffer; restore\n * afterward so the color pass / basemap stay aligned.\n */\nexport function alignExportShadowPass(\n shadowPass: any,\n isExportMode: () => boolean,\n getResolution: () => number = () => SHADOW_MAP_RESOLUTIONS.auto\n): void {\n const render = shadowPass.render.bind(shadowPass);\n let ownsAttachments = false;\n shadowPass.render = params => {\n if (!isExportMode()) {\n const scale = getResolution();\n if (scale !== SHADOW_MAP_RESOLUTIONS.low && scale !== SHADOW_MAP_RESOLUTIONS.high) {\n return render(params);\n }\n\n const {device} = shadowPass;\n const canvasContext = device?.canvasContext;\n const viewport = params?.viewports?.[0];\n if (\n device?.type !== 'webgl' ||\n !canvasContext ||\n params.viewports.length !== 1 ||\n !viewport?.width ||\n !viewport.height ||\n viewport.x ||\n viewport.y\n ) {\n return render(params);\n }\n\n const prevSize = canvasContext.getDrawingBufferSize;\n const prevRatio = canvasContext.cssToDeviceRatio;\n const ratio = prevRatio.call(canvasContext);\n const {width, height} = viewport;\n if (\n !Number.isFinite(ratio) ||\n ratio <= 0 ||\n width * ratio * scale < 1 ||\n height * ratio * scale < 1\n ) {\n return render(params);\n }\n // Never increase to more than ~48 MiB of raw RGBA8 + depth16 per map.\n // If Auto already exceeds the bound, High must not reduce its quality.\n const limit = Math.min(device.limits?.maxTextureDimension2D ?? 4096, 4096);\n const maxRatio = Math.min(limit / width, limit / height, Math.sqrt(8e6 / (width * height)));\n const scaledRatio =\n scale === SHADOW_MAP_RESOLUTIONS.high\n ? Math.max(ratio, Math.min(ratio * scale, maxRatio))\n : ratio * scale;\n if (!Number.isFinite(scaledRatio) || scaledRatio === ratio) return render(params);\n\n if (!ownsAttachments && shadowPass.fbo) {\n ownShadowAttachments(shadowPass.fbo);\n ownsAttachments = true;\n }\n\n // ShadowPass and LayersPass must see the same ratio: one allocates the\n // texture, the other scales its viewport. Color and picking keep Auto.\n canvasContext.getDrawingBufferSize = () => [\n Math.floor(width * scaledRatio),\n Math.floor(height * scaledRatio)\n ];\n canvasContext.cssToDeviceRatio = () => scaledRatio;\n try {\n return render(params);\n } finally {\n canvasContext.getDrawingBufferSize = prevSize;\n canvasContext.cssToDeviceRatio = prevRatio;\n }\n }\n\n const gl = shadowPass.device?.gl;\n const canvasContext = shadowPass.device?.canvasContext;\n const viewport = params?.viewports?.[0];\n const width = gl?.drawingBufferWidth;\n const height = gl?.drawingBufferHeight;\n if (!gl || !canvasContext || !viewport?.width || !width || !height) {\n return render(params);\n }\n\n const prevSize = canvasContext.getDrawingBufferSize;\n const prevRatio = canvasContext.cssToDeviceRatio;\n const prevDepth = gl.getParameter?.(gl.DEPTH_RANGE ?? 0x0b70);\n canvasContext.getDrawingBufferSize = () => [width, height];\n canvasContext.cssToDeviceRatio = () => width / viewport.width;\n gl.depthRange?.(0, 1);\n try {\n return render(params);\n } finally {\n canvasContext.getDrawingBufferSize = prevSize;\n canvasContext.cssToDeviceRatio = prevRatio;\n if (prevDepth) gl.depthRange?.(prevDepth[0], prevDepth[1]);\n }\n };\n}\n\n/**\n * Insert text before a target string in shader source.\n */\nfunction insertBefore(source: string, target: string, textToInsert: string): string {\n const at = source.indexOf(target);\n if (at < 0) return source;\n return source.slice(0, at) + textToInsert + source.slice(at);\n}\n\n/**\n * Create a patched shadow module that adds:\n * - `outputUniformShadow`: when true, shadow_getShadowWeight returns 1.0\n * (full uniform shadow) instead of sampling the shadow map.\n * - `useSimplePhong`: when true, replaces PBR lighting with simple\n * Lambertian diffuse (ambient + NdotL) for 3D tile layers, avoiding\n * the PBR microfacet specular artifacts on flat surfaces.\n *\n * Also fixes the vertex injection to be a no-op when shadows are disabled,\n * preventing position corruption in billboard layers (e.g. the editor layer).\n */\nfunction createCustomShadowModule(): ShaderModule | null {\n if (!shadow) return null;\n\n const mod = {...shadow} as Record<string, any>;\n\n const uboField = ' float outputUniformShadow;\\n float useSimplePhong;\\n';\n mod.vs = insertBefore(mod.vs, '} shadow;', uboField);\n mod.fs = insertBefore(mod.fs, '} shadow;', uboField);\n\n // Add a varying to carry the common-space position for simple phong normals.\n mod.vs = `out vec3 custom_vWorldPos;\\n${mod.vs}`;\n mod.fs = `in vec3 custom_vWorldPos;\\n${mod.fs}`;\n\n mod.fs = insertBefore(\n mod.fs,\n 'vec4 rgbaDepth = texture(shadowMap, position.xy);',\n 'if (shadow.outputUniformShadow > 0.5) return 1.0;\\n '\n );\n\n // Patch the VS so the fallback returns the caller's position instead of\n // gl_Position (which is uninitialised when the hook fires in billboard\n // layers like PathLayer / the editor polygon tool).\n mod.vs = mod.vs\n .replace(\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace)',\n 'vec4 shadow_setVertexPosition(vec4 position_commonspace, vec4 currentPosition)'\n )\n .replace(/return gl_Position;\\s*\\}/, 'return currentPosition;\\n}');\n\n mod.inject = {\n ...shadow.inject,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n position = shadow_setVertexPosition(geometry.position, position);\n custom_vWorldPos = geometry.position.xyz;\n `,\n 'fs:DECKGL_FILTER_COLOR': `\n #ifdef LIGHTING_FRAGMENT\n if (shadow.useSimplePhong > 0.5) {\n vec3 spDx = dFdx(custom_vWorldPos);\n vec3 spDy = dFdy(custom_vWorldPos);\n vec3 spN = normalize(cross(spDx, spDy));\n vec3 spLit = lighting.ambientColor;\n for (int i = 0; i < 3; i++) {\n if (i >= lighting.directionalLightCount) break;\n vec3 spDir = lighting_getDirectionalLight(i).direction;\n float spNdotL = max(dot(spN, -normalize(spDir)), 0.0);\n spLit += lighting_getDirectionalLight(i).color * spNdotL;\n }\n color.rgb *= spLit;\n }\n #endif\n color = shadow_filterShadowColor(color);\n `\n };\n\n mod.uniformTypes = {\n ...shadow.uniformTypes,\n outputUniformShadow: 'f32',\n useSimplePhong: 'f32'\n };\n\n const originalGetUniforms = shadow.getUniforms as (\n opts: Record<string, unknown>,\n prevUniforms: Record<string, unknown>\n ) => Record<string, unknown>;\n mod.getUniforms = (opts: CustomShadowProps = {}, context = {}) => {\n const u = originalGetUniforms(opts, context);\n u.outputUniformShadow = opts.outputUniformShadow ? 1.0 : 0.0;\n u.useSimplePhong = opts.useSimplePhong ? 1.0 : 0.0;\n return u;\n };\n\n return mod as unknown as ShaderModule;\n}\n\nconst CustomShadowModule = createCustomShadowModule();\n\n// deck.gl picking injects at order 99 and blends highlightColor over the\n// fragment. In the shadow pass that overwrites encoded depth, so a hovered\n// extruded feature stops casting a shadow. Re-encode after picking.\n// Color-pass highlight compositing is unchanged (shadow still runs first).\nconst PICKING_FILTER_COLOR_ORDER = 99;\n\nexport const shadowMapHoverFixModule = {\n name: 'shadow-map-hover-fix',\n inject: {\n 'fs:DECKGL_FILTER_COLOR': {\n order: PICKING_FILTER_COLOR_ORDER + 1,\n injection: `\n if (shadow.drawShadowMap) {\n color = shadow_filterShadowColor(color);\n }\n `\n }\n }\n} as unknown as ShaderModule;\n\n/**\n * Detect layers that use the PBR shader module (3D tile sublayers:\n * ScenegraphLayer sets `_lighting: 'pbr'`, SimpleMeshLayer sets `pbrMaterial`).\n */\nfunction isPbrLayer(layer: any): boolean {\n return layer.props?._lighting === 'pbr' || layer.props?.pbrMaterial !== undefined;\n}\n\n/**\n * Custom LightingEffect for kepler.gl.\n *\n * Extends deck.gl's LightingEffect with:\n * - A patched shadow module with `outputUniformShadow` for uniform shadow\n * during nighttime (avoids partial shadows from below).\n * - Simple phong replacement for PBR layers (avoids microfacet specular).\n * - Shadow-map depth re-encoded after picking highlight so hovered extruded\n * features still cast shadows.\n * - getShaderModuleProps override that always provides dummyShadowMap\n * to prevent \"Bad texture binding\" errors when shadows are disabled.\n */\nclass CustomDeckLightingEffect extends LightingEffect {\n // Picking still needs the sampler bindings for the installed shadow shader.\n useInPicking = true;\n outputUniformShadow: boolean;\n isExportMode: boolean;\n shadowMapResolution: number;\n private isPicking = false;\n\n private get _private(): LightingEffectPrivate {\n return this as unknown as LightingEffectPrivate;\n }\n\n constructor(props) {\n super(props);\n this.outputUniformShadow = false;\n this.isExportMode = false;\n this.shadowMapResolution = SHADOW_MAP_RESOLUTIONS.auto;\n }\n\n setup(context) {\n this.context = context;\n const {device, deck} = context;\n if (this._private.shadow && !this._private.dummyShadowMap) {\n this._private._createShadowPasses(device);\n for (const shadowPass of this._private.shadowPasses) {\n patchShadowPassDepth(shadowPass);\n alignExportShadowPass(\n shadowPass,\n () => this.isExportMode,\n () => this.shadowMapResolution\n );\n }\n deck._addDefaultShaderModule(CustomShadowModule || shadow);\n deck._addDefaultShaderModule(shadowMapHoverFixModule);\n this._private.dummyShadowMap = device.createTexture({width: 1, height: 1});\n }\n }\n\n preRender(opts) {\n // Effects resolve their props before deck sets the picking shader flag.\n this.isPicking = Boolean(opts.isPicking);\n if (this.isPicking || !this._private.shadow) return;\n\n // kepler turns shadows on by setting `shadow` directly (updateEffect in\n // effect-utils), not through setProps, so deck.gl does not call setup()\n // again. An effect set up while its shadows were off (a map loaded with\n // Light & Shadow disabled) has no shadow passes and no shadow module:\n // create them now. deck.gl rebuilds the layers with the module next frame.\n if (!this._private.dummyShadowMap && this.context) {\n this.setup(this.context);\n }\n\n // Filter editor layers out of the shadow pass so they don't cast shadows.\n const originalLayers = opts.layers;\n opts.layers = originalLayers.filter(l => !l.id.startsWith(EDITOR_LAYER_ID));\n\n let unpatch: (() => void) | undefined;\n if (this.isExportMode) {\n unpatch = patchTileViewportIds(opts);\n }\n\n super.preRender(opts);\n\n unpatch?.();\n\n opts.layers = originalLayers;\n }\n\n cleanup(context) {\n for (const shadowPass of this._private.shadowPasses) {\n shadowPass.delete();\n }\n this._private.shadowPasses.length = 0;\n if (this._private.dummyShadowMap) {\n this._private.dummyShadowMap.destroy();\n this._private.dummyShadowMap = null;\n context.deck._removeDefaultShaderModule(CustomShadowModule || shadow);\n context.deck._removeDefaultShaderModule(shadowMapHoverFixModule);\n }\n }\n\n getShaderModuleProps(layer, otherShaderModuleProps) {\n // Picking and editor layers need sampler bindings without shadow calculations.\n if (this.isPicking || layer.id.startsWith(EDITOR_LAYER_ID)) {\n return {\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n lighting: {enabled: false},\n pbrMaterial: {unlit: 1},\n phongMaterial: null,\n gouraudMaterial: null\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n // When the effect is disabled (ghost kept alive to preserve the shadow\n // shader module), delegate to a default LightingEffect so phong/gouraud\n // layers get the same shading they had before the effect was ever added.\n if (!this._private.shadow) {\n const defaults = DEFAULT_LIGHTING_EFFECT.getShaderModuleProps(layer, otherShaderModuleProps);\n return {\n ...defaults,\n shadow: {\n shadowEnabled: false,\n dummyShadowMap: this._private.dummyShadowMap\n },\n pbrMaterial: {unlit: 1}\n } as unknown as ReturnType<LightingEffect['getShaderModuleProps']>;\n }\n\n const props = super.getShaderModuleProps(layer, otherShaderModuleProps);\n\n if (\n props.shadow &&\n !(props.shadow as CustomShadowProps).dummyShadowMap &&\n this._private.dummyShadowMap\n ) {\n (props.shadow as CustomShadowProps).dummyShadowMap = this._private.dummyShadowMap;\n }\n\n if (props.shadow) {\n (props.shadow as CustomShadowProps).outputUniformShadow = this.outputUniformShadow;\n }\n\n if (isPbrLayer(layer)) {\n // PBR layers: disable PBR lighting (unlit=1 → outputs base texture color),\n // keep directional lights in the lighting uniforms, and enable our simple\n // phong replacement in the DECKGL_FILTER_COLOR hook. This gives us\n // ambient + NdotL diffuse without PBR microfacet specular artifacts.\n // Light direction is sky→surface (deck.gl convention), negated in GLSL.\n (props as any).pbrMaterial = {unlit: 1};\n if (props.shadow) {\n (props.shadow as CustomShadowProps).useSimplePhong = true;\n }\n return props;\n }\n\n (props as any).pbrMaterial = {unlit: 0};\n\n return props;\n }\n}\n\nexport default CustomDeckLightingEffect;\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;AAEA,SAAQA,cAAc,EAAEC,MAAM,QAAO,eAAe;AAGpD,SAAQC,eAAe,EAAEC,sBAAsB,QAAO,sBAAsB;AAC5E,SAAQC,oBAAoB,QAAO,qBAAqB;;AAExD;AACA;AACA;AACA,IAAMC,uBAAuB,GAAG,IAAIL,cAAc,CAAC,CAAC;;AAEpD;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA,IAAMM,4BAA4B,GAAG;EACnCC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,IAAI;EACfC,iBAAiB,EAAE,KAAK;EACxBC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC;AACtB,CAAC;AAED,OAAO,SAASC,oBAAoBA,CAACC,IAMpC,EAAE;EACD,IAAMC,0BAA0B,GAAGD,IAAI,CAACE,kBAAkB,CAACC,IAAI,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;QACA;QACA;QACA;QACCgI,KAAK,CAASE,WAAW,GAAG;UAAC2C,KAAK,EAAE;QAAC,CAAC;QACvC,IAAI7C,KAAK,CAAC/I,MAAM,EAAE;UACf+I,KAAK,CAAC/I,MAAM,CAAuBgI,cAAc,GAAG,IAAI;QAC3D;QACA,OAAOe,KAAK;MACd;MAECA,KAAK,CAASE,WAAW,GAAG;QAAC2C,KAAK,EAAE;MAAC,CAAC;MAEvC,OAAO7C,KAAK;IACd;EAAC;AAAA,EA7IoChJ,cAAc;AAgJrD,eAAemJ,wBAAwB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kepler.gl/effects",
|
|
3
3
|
"author": "Shan He <shan@uber.com>",
|
|
4
|
-
"version": "3.3.0-alpha.
|
|
4
|
+
"version": "3.3.0-alpha.25",
|
|
5
5
|
"description": "kepler.gl viaual effects",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@deck.gl/core": "^9.4.1",
|
|
32
|
-
"@kepler.gl/common-utils": "3.3.0-alpha.
|
|
33
|
-
"@kepler.gl/constants": "3.3.0-alpha.
|
|
34
|
-
"@kepler.gl/types": "3.3.0-alpha.
|
|
35
|
-
"@kepler.gl/utils": "3.3.0-alpha.
|
|
32
|
+
"@kepler.gl/common-utils": "3.3.0-alpha.25",
|
|
33
|
+
"@kepler.gl/constants": "3.3.0-alpha.25",
|
|
34
|
+
"@kepler.gl/types": "3.3.0-alpha.25",
|
|
35
|
+
"@kepler.gl/utils": "3.3.0-alpha.25",
|
|
36
36
|
"@luma.gl/core": "^9.4.2",
|
|
37
37
|
"@luma.gl/effects": "^9.4.2",
|
|
38
38
|
"@luma.gl/engine": "^9.4.2",
|