@deck.gl/extensions 8.9.0-beta.2 → 8.9.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +281 -460
- package/dist/es5/{collide/collide-effect.js → collision-filter/collision-filter-effect.js} +79 -72
- package/dist/es5/collision-filter/collision-filter-effect.js.map +1 -0
- package/dist/es5/{collide/collide-pass.js → collision-filter/collision-filter-pass.js} +13 -13
- package/dist/es5/collision-filter/collision-filter-pass.js.map +1 -0
- package/dist/es5/{collide/collide.js → collision-filter/collision-filter.js} +30 -30
- package/dist/es5/collision-filter/collision-filter.js.map +1 -0
- package/dist/es5/collision-filter/shader-module.js +39 -0
- package/dist/es5/collision-filter/shader-module.js.map +1 -0
- package/dist/es5/data-filter/data-filter.js +1 -1
- package/dist/es5/data-filter/data-filter.js.map +1 -1
- package/dist/es5/index.js +4 -4
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/mask/mask-effect.js +17 -8
- package/dist/es5/mask/mask-effect.js.map +1 -1
- package/dist/es5/terrain/height-map-builder.js +1 -1
- package/dist/es5/terrain/height-map-builder.js.map +1 -1
- package/dist/es5/terrain/shader-module.js.map +1 -1
- package/dist/es5/terrain/terrain-cover.js +1 -1
- package/dist/es5/terrain/terrain-cover.js.map +1 -1
- package/dist/es5/terrain/terrain-effect.js +5 -5
- package/dist/es5/terrain/terrain-effect.js.map +1 -1
- package/dist/es5/terrain/terrain.js +7 -7
- package/dist/es5/terrain/terrain.js.map +1 -1
- package/dist/es5/{common → utils}/projection-utils.js +3 -1
- package/dist/es5/utils/projection-utils.js.map +1 -0
- package/dist/esm/{collide/collide-effect.js → collision-filter/collision-filter-effect.js} +69 -64
- package/dist/esm/collision-filter/collision-filter-effect.js.map +1 -0
- package/dist/esm/{collide/collide-pass.js → collision-filter/collision-filter-pass.js} +5 -5
- package/dist/esm/collision-filter/collision-filter-pass.js.map +1 -0
- package/dist/esm/collision-filter/collision-filter.js +78 -0
- package/dist/esm/collision-filter/collision-filter.js.map +1 -0
- package/dist/esm/collision-filter/shader-module.js +32 -0
- package/dist/esm/collision-filter/shader-module.js.map +1 -0
- package/dist/esm/data-filter/data-filter.js +1 -1
- package/dist/esm/data-filter/data-filter.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mask/mask-effect.js +14 -8
- package/dist/esm/mask/mask-effect.js.map +1 -1
- package/dist/esm/terrain/height-map-builder.js +1 -1
- package/dist/esm/terrain/height-map-builder.js.map +1 -1
- package/dist/esm/terrain/shader-module.js.map +1 -1
- package/dist/esm/terrain/terrain-cover.js +1 -1
- package/dist/esm/terrain/terrain-cover.js.map +1 -1
- package/dist/esm/terrain/terrain-effect.js +5 -5
- package/dist/esm/terrain/terrain-effect.js.map +1 -1
- package/dist/esm/terrain/terrain.js +7 -7
- package/dist/esm/terrain/terrain.js.map +1 -1
- package/dist/esm/{common → utils}/projection-utils.js +3 -1
- package/dist/esm/utils/projection-utils.js.map +1 -0
- package/dist.min.js +59 -62
- package/package.json +2 -2
- package/src/{collide/collide-effect.ts → collision-filter/collision-filter-effect.ts} +81 -78
- package/src/{collide/collide-pass.ts → collision-filter/collision-filter-pass.ts} +6 -6
- package/src/collision-filter/collision-filter.ts +83 -0
- package/src/collision-filter/shader-module.ts +113 -0
- package/src/data-filter/data-filter.ts +1 -1
- package/src/index.ts +3 -3
- package/src/mask/mask-effect.ts +32 -13
- package/src/terrain/height-map-builder.ts +2 -2
- package/src/terrain/shader-module.ts +4 -1
- package/src/terrain/terrain-cover.ts +2 -2
- package/src/terrain/terrain-effect.ts +5 -5
- package/src/terrain/terrain.ts +10 -10
- package/src/{common → utils}/projection-utils.ts +4 -2
- package/typed/collision-filter/collision-filter-effect.d.ts +28 -0
- package/typed/collision-filter/collision-filter-effect.d.ts.map +1 -0
- package/typed/collision-filter/collision-filter-pass.d.ts +14 -0
- package/typed/collision-filter/collision-filter-pass.d.ts.map +1 -0
- package/typed/collision-filter/collision-filter.d.ts +41 -0
- package/typed/collision-filter/collision-filter.d.ts.map +1 -0
- package/typed/collision-filter/shader-module.d.ts +4 -0
- package/typed/collision-filter/shader-module.d.ts.map +1 -0
- package/typed/data-filter/data-filter.d.ts +1 -1
- package/typed/index.d.ts +3 -3
- package/typed/index.d.ts.map +1 -1
- package/typed/mask/mask-effect.d.ts +2 -2
- package/typed/mask/mask-effect.d.ts.map +1 -1
- package/typed/terrain/height-map-builder.d.ts +2 -2
- package/typed/terrain/height-map-builder.d.ts.map +1 -1
- package/typed/terrain/shader-module.d.ts +1 -1
- package/typed/terrain/shader-module.d.ts.map +1 -1
- package/typed/terrain/terrain-cover.d.ts +2 -2
- package/typed/terrain/terrain-cover.d.ts.map +1 -1
- package/typed/terrain/terrain.d.ts +2 -2
- package/typed/terrain/terrain.d.ts.map +1 -1
- package/typed/utils/projection-utils.d.ts +27 -0
- package/typed/utils/projection-utils.d.ts.map +1 -0
- package/dist/es5/collide/collide-effect.js.map +0 -1
- package/dist/es5/collide/collide-pass.js.map +0 -1
- package/dist/es5/collide/collide.js.map +0 -1
- package/dist/es5/collide/shader-module.js +0 -39
- package/dist/es5/collide/shader-module.js.map +0 -1
- package/dist/es5/common/projection-utils.js.map +0 -1
- package/dist/es5/mask/utils.js +0 -136
- package/dist/es5/mask/utils.js.map +0 -1
- package/dist/esm/collide/collide-effect.js.map +0 -1
- package/dist/esm/collide/collide-pass.js.map +0 -1
- package/dist/esm/collide/collide.js +0 -78
- package/dist/esm/collide/collide.js.map +0 -1
- package/dist/esm/collide/shader-module.js +0 -32
- package/dist/esm/collide/shader-module.js.map +0 -1
- package/dist/esm/common/projection-utils.js.map +0 -1
- package/dist/esm/mask/utils.js +0 -109
- package/dist/esm/mask/utils.js.map +0 -1
- package/src/collide/collide.ts +0 -79
- package/src/collide/shader-module.ts +0 -113
- package/src/mask/utils.ts +0 -148
package/dist/dist.dev.js
CHANGED
|
@@ -7,8 +7,8 @@ var deck = (() => {
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __commonJS = (cb,
|
|
11
|
-
return
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
12
|
};
|
|
13
13
|
var __export = (target, all) => {
|
|
14
14
|
for (var name in all)
|
|
@@ -22,12 +22,12 @@ var deck = (() => {
|
|
|
22
22
|
}
|
|
23
23
|
return to;
|
|
24
24
|
};
|
|
25
|
-
var __reExport = (target,
|
|
26
|
-
var __toESM = (
|
|
27
|
-
isNodeMode || !
|
|
28
|
-
|
|
25
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
29
|
));
|
|
30
|
-
var __toCommonJS = (
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
31
|
var __publicField = (obj, key, value) => {
|
|
32
32
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
33
33
|
return value;
|
|
@@ -52,13 +52,13 @@ var deck = (() => {
|
|
|
52
52
|
__export(bundle_exports, {
|
|
53
53
|
BrushingExtension: () => BrushingExtension,
|
|
54
54
|
ClipExtension: () => ClipExtension,
|
|
55
|
-
|
|
55
|
+
CollisionFilterExtension: () => CollisionFilterExtension,
|
|
56
56
|
DataFilterExtension: () => DataFilterExtension,
|
|
57
57
|
FillStyleExtension: () => FillStyleExtension,
|
|
58
58
|
Fp64Extension: () => Fp64Extension,
|
|
59
59
|
MaskExtension: () => MaskExtension,
|
|
60
60
|
PathStyleExtension: () => PathStyleExtension,
|
|
61
|
-
|
|
61
|
+
_TerrainExtension: () => TerrainExtension,
|
|
62
62
|
project64: () => project64_default
|
|
63
63
|
});
|
|
64
64
|
|
|
@@ -1117,7 +1117,7 @@ void main() {
|
|
|
1117
1117
|
onFilteredItemsChange: {
|
|
1118
1118
|
type: "function",
|
|
1119
1119
|
value: null,
|
|
1120
|
-
|
|
1120
|
+
optional: true
|
|
1121
1121
|
},
|
|
1122
1122
|
filterEnabled: true,
|
|
1123
1123
|
filterRange: [-1, 1],
|
|
@@ -2121,36 +2121,36 @@ varying vec2 clip_commonPosition;
|
|
|
2121
2121
|
__publicField(ClipExtension, "defaultProps", defaultProps5);
|
|
2122
2122
|
__publicField(ClipExtension, "extensionName", "ClipExtension");
|
|
2123
2123
|
|
|
2124
|
-
// src/
|
|
2124
|
+
// src/collision-filter/collision-filter.ts
|
|
2125
2125
|
var import_core26 = __toESM(require_core());
|
|
2126
2126
|
|
|
2127
|
-
// src/
|
|
2127
|
+
// src/collision-filter/shader-module.ts
|
|
2128
2128
|
var import_core14 = __toESM(require_core());
|
|
2129
2129
|
var vs3 = `
|
|
2130
2130
|
#ifdef NON_INSTANCED_MODEL
|
|
2131
|
-
attribute float
|
|
2131
|
+
attribute float collisionPriorities;
|
|
2132
2132
|
#else
|
|
2133
|
-
attribute float
|
|
2133
|
+
attribute float instanceCollisionPriorities;
|
|
2134
2134
|
#endif
|
|
2135
2135
|
|
|
2136
|
-
uniform sampler2D
|
|
2137
|
-
uniform bool
|
|
2138
|
-
uniform bool
|
|
2136
|
+
uniform sampler2D collision_texture;
|
|
2137
|
+
uniform bool collision_sort;
|
|
2138
|
+
uniform bool collision_enabled;
|
|
2139
2139
|
|
|
2140
|
-
vec2
|
|
2141
|
-
vec4
|
|
2142
|
-
return (1.0 +
|
|
2140
|
+
vec2 collision_getCoords(vec4 position) {
|
|
2141
|
+
vec4 collision_clipspace = project_common_position_to_clipspace(position);
|
|
2142
|
+
return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
|
|
2143
2143
|
}
|
|
2144
2144
|
|
|
2145
|
-
float
|
|
2146
|
-
vec4
|
|
2147
|
-
float delta = dot(abs(
|
|
2145
|
+
float collision_match(vec2 tex, vec3 pickingColor) {
|
|
2146
|
+
vec4 collision_pickingColor = texture2D(collision_texture, tex);
|
|
2147
|
+
float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
|
|
2148
2148
|
float e = 0.001;
|
|
2149
2149
|
return step(delta, e);
|
|
2150
2150
|
}
|
|
2151
2151
|
|
|
2152
|
-
float
|
|
2153
|
-
if (!
|
|
2152
|
+
float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
2153
|
+
if (!collision_enabled) {
|
|
2154
2154
|
return 1.0;
|
|
2155
2155
|
}
|
|
2156
2156
|
|
|
@@ -2166,7 +2166,7 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2166
2166
|
for(int i = -N; i <= N; i++) {
|
|
2167
2167
|
delta.x = -step.x * floatN;
|
|
2168
2168
|
for(int j = -N; j <= N; j++) {
|
|
2169
|
-
accumulator +=
|
|
2169
|
+
accumulator += collision_match(texCoords + delta, pickingColor);
|
|
2170
2170
|
delta.x += step.x;
|
|
2171
2171
|
}
|
|
2172
2172
|
delta.y += step.y;
|
|
@@ -2178,62 +2178,62 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2178
2178
|
`;
|
|
2179
2179
|
var inject4 = {
|
|
2180
2180
|
"vs:#decl": `
|
|
2181
|
-
float
|
|
2181
|
+
float collision_fade = 1.0;
|
|
2182
2182
|
`,
|
|
2183
2183
|
"vs:DECKGL_FILTER_GL_POSITION": `
|
|
2184
|
-
if (
|
|
2184
|
+
if (collision_sort) {
|
|
2185
2185
|
#ifdef NON_INSTANCED_MODEL
|
|
2186
|
-
float
|
|
2186
|
+
float collisionPriority = collisionPriorities;
|
|
2187
2187
|
#else
|
|
2188
|
-
float
|
|
2188
|
+
float collisionPriority = instanceCollisionPriorities;
|
|
2189
2189
|
#endif
|
|
2190
|
-
position.z = -0.001 *
|
|
2190
|
+
position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000
|
|
2191
2191
|
}
|
|
2192
2192
|
|
|
2193
|
-
if (
|
|
2194
|
-
vec4
|
|
2195
|
-
vec2
|
|
2196
|
-
|
|
2197
|
-
if (
|
|
2193
|
+
if (collision_enabled) {
|
|
2194
|
+
vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
2195
|
+
vec2 collision_texCoords = collision_getCoords(collision_common_position);
|
|
2196
|
+
collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
|
|
2197
|
+
if (collision_fade < 0.0001) {
|
|
2198
2198
|
position = vec4(0.);
|
|
2199
2199
|
}
|
|
2200
2200
|
}
|
|
2201
2201
|
`,
|
|
2202
2202
|
"vs:DECKGL_FILTER_COLOR": `
|
|
2203
|
-
color.a *=
|
|
2203
|
+
color.a *= collision_fade;
|
|
2204
2204
|
`
|
|
2205
2205
|
};
|
|
2206
|
-
var
|
|
2207
|
-
if (!opts || !("
|
|
2206
|
+
var getCollisionUniforms = (opts, uniforms) => {
|
|
2207
|
+
if (!opts || !("dummyCollisionMap" in opts)) {
|
|
2208
2208
|
return {};
|
|
2209
2209
|
}
|
|
2210
2210
|
const {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2211
|
+
collisionFBO,
|
|
2212
|
+
drawToCollisionMap,
|
|
2213
|
+
dummyCollisionMap
|
|
2214
2214
|
} = opts;
|
|
2215
2215
|
return {
|
|
2216
|
-
|
|
2217
|
-
|
|
2216
|
+
collision_sort: Boolean(drawToCollisionMap),
|
|
2217
|
+
collision_texture: !drawToCollisionMap && collisionFBO ? collisionFBO : dummyCollisionMap
|
|
2218
2218
|
};
|
|
2219
2219
|
};
|
|
2220
2220
|
var shader_module_default2 = {
|
|
2221
|
-
name: "
|
|
2221
|
+
name: "collision",
|
|
2222
2222
|
dependencies: [import_core14.project],
|
|
2223
2223
|
vs: vs3,
|
|
2224
2224
|
inject: inject4,
|
|
2225
|
-
getUniforms:
|
|
2225
|
+
getUniforms: getCollisionUniforms
|
|
2226
2226
|
};
|
|
2227
2227
|
|
|
2228
|
-
// src/
|
|
2228
|
+
// src/collision-filter/collision-filter-effect.ts
|
|
2229
2229
|
var import_core23 = __toESM(require_core2());
|
|
2230
2230
|
var import_core25 = __toESM(require_core());
|
|
2231
2231
|
|
|
2232
|
-
// src/
|
|
2232
|
+
// src/collision-filter/collision-filter-pass.ts
|
|
2233
2233
|
var import_core15 = __toESM(require_core2());
|
|
2234
2234
|
var import_core16 = __toESM(require_core());
|
|
2235
|
-
var
|
|
2236
|
-
|
|
2235
|
+
var CollisionFilterPass = class extends import_core16._LayersPass {
|
|
2236
|
+
renderCollisionMap(target, options) {
|
|
2237
2237
|
const gl = this.gl;
|
|
2238
2238
|
const padding = 1;
|
|
2239
2239
|
return (0, import_core15.withParameters)(gl, {
|
|
@@ -2246,12 +2246,12 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2246
2246
|
}, () => this.render({
|
|
2247
2247
|
...options,
|
|
2248
2248
|
target,
|
|
2249
|
-
pass: "
|
|
2249
|
+
pass: "collision"
|
|
2250
2250
|
}));
|
|
2251
2251
|
}
|
|
2252
2252
|
getModuleParameters() {
|
|
2253
2253
|
return {
|
|
2254
|
-
|
|
2254
|
+
drawToCollisionMap: true,
|
|
2255
2255
|
pickingActive: 1,
|
|
2256
2256
|
pickingAttribute: false,
|
|
2257
2257
|
lightSources: {}
|
|
@@ -2317,194 +2317,122 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2317
2317
|
}
|
|
2318
2318
|
};
|
|
2319
2319
|
|
|
2320
|
-
// src/
|
|
2320
|
+
// src/utils/projection-utils.ts
|
|
2321
2321
|
var import_core19 = __toESM(require_core());
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
function clamp2(x, min, max) {
|
|
2325
|
-
return x < min ? min : x > max ? max : x;
|
|
2326
|
-
}
|
|
2327
|
-
function ieLog2(x) {
|
|
2328
|
-
return Math.log(x) * Math.LOG2E;
|
|
2329
|
-
}
|
|
2330
|
-
var log2 = Math.log2 || ieLog2;
|
|
2331
|
-
|
|
2332
|
-
// ../../node_modules/@math.gl/web-mercator/dist/esm/assert.js
|
|
2333
|
-
function assert(condition, message) {
|
|
2334
|
-
if (!condition) {
|
|
2335
|
-
throw new Error(message || "@math.gl/web-mercator: assertion failed.");
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
// ../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js
|
|
2340
|
-
var PI = Math.PI;
|
|
2341
|
-
var PI_4 = PI / 4;
|
|
2342
|
-
var DEGREES_TO_RADIANS2 = PI / 180;
|
|
2343
|
-
var RADIANS_TO_DEGREES2 = 180 / PI;
|
|
2344
|
-
var TILE_SIZE = 512;
|
|
2345
|
-
var MAX_LATITUDE = 85.051129;
|
|
2346
|
-
function lngLatToWorld(lngLat) {
|
|
2347
|
-
const [lng, lat] = lngLat;
|
|
2348
|
-
assert(Number.isFinite(lng));
|
|
2349
|
-
assert(Number.isFinite(lat) && lat >= -90 && lat <= 90, "invalid latitude");
|
|
2350
|
-
const lambda2 = lng * DEGREES_TO_RADIANS2;
|
|
2351
|
-
const phi2 = lat * DEGREES_TO_RADIANS2;
|
|
2352
|
-
const x = TILE_SIZE * (lambda2 + PI) / (2 * PI);
|
|
2353
|
-
const y = TILE_SIZE * (PI + Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI);
|
|
2354
|
-
return [x, y];
|
|
2355
|
-
}
|
|
2356
|
-
function worldToLngLat(xy) {
|
|
2357
|
-
const [x, y] = xy;
|
|
2358
|
-
const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
|
|
2359
|
-
const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
|
|
2360
|
-
return [lambda2 * RADIANS_TO_DEGREES2, phi2 * RADIANS_TO_DEGREES2];
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
// ../../node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js
|
|
2364
|
-
function fitBounds(options) {
|
|
2365
|
-
const {
|
|
2366
|
-
width,
|
|
2367
|
-
height,
|
|
2368
|
-
bounds,
|
|
2369
|
-
minExtent = 0,
|
|
2370
|
-
maxZoom = 24,
|
|
2371
|
-
offset = [0, 0]
|
|
2372
|
-
} = options;
|
|
2373
|
-
const [[west, south], [east, north]] = bounds;
|
|
2374
|
-
const padding = getPaddingObject(options.padding);
|
|
2375
|
-
const nw = lngLatToWorld([west, clamp2(north, -MAX_LATITUDE, MAX_LATITUDE)]);
|
|
2376
|
-
const se = lngLatToWorld([east, clamp2(south, -MAX_LATITUDE, MAX_LATITUDE)]);
|
|
2377
|
-
const size = [Math.max(Math.abs(se[0] - nw[0]), minExtent), Math.max(Math.abs(se[1] - nw[1]), minExtent)];
|
|
2378
|
-
const targetSize = [width - padding.left - padding.right - Math.abs(offset[0]) * 2, height - padding.top - padding.bottom - Math.abs(offset[1]) * 2];
|
|
2379
|
-
assert(targetSize[0] > 0 && targetSize[1] > 0);
|
|
2380
|
-
const scaleX = targetSize[0] / size[0];
|
|
2381
|
-
const scaleY = targetSize[1] / size[1];
|
|
2382
|
-
const offsetX = (padding.right - padding.left) / 2 / scaleX;
|
|
2383
|
-
const offsetY = (padding.bottom - padding.top) / 2 / scaleY;
|
|
2384
|
-
const center = [(se[0] + nw[0]) / 2 + offsetX, (se[1] + nw[1]) / 2 + offsetY];
|
|
2385
|
-
const centerLngLat = worldToLngLat(center);
|
|
2386
|
-
const zoom = Math.min(maxZoom, log2(Math.abs(Math.min(scaleX, scaleY))));
|
|
2387
|
-
assert(Number.isFinite(zoom));
|
|
2388
|
-
return {
|
|
2389
|
-
longitude: centerLngLat[0],
|
|
2390
|
-
latitude: centerLngLat[1],
|
|
2391
|
-
zoom
|
|
2392
|
-
};
|
|
2393
|
-
}
|
|
2394
|
-
function getPaddingObject(padding = 0) {
|
|
2395
|
-
if (typeof padding === "number") {
|
|
2396
|
-
return {
|
|
2397
|
-
top: padding,
|
|
2398
|
-
bottom: padding,
|
|
2399
|
-
left: padding,
|
|
2400
|
-
right: padding
|
|
2401
|
-
};
|
|
2402
|
-
}
|
|
2403
|
-
assert(Number.isFinite(padding.top) && Number.isFinite(padding.bottom) && Number.isFinite(padding.left) && Number.isFinite(padding.right));
|
|
2404
|
-
return padding;
|
|
2405
|
-
}
|
|
2406
|
-
|
|
2407
|
-
// ../../node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js
|
|
2408
|
-
var DEGREES_TO_RADIANS3 = Math.PI / 180;
|
|
2409
|
-
|
|
2410
|
-
// src/mask/utils.ts
|
|
2411
|
-
function getMaskBounds({
|
|
2412
|
-
layers,
|
|
2413
|
-
viewport
|
|
2414
|
-
}) {
|
|
2415
|
-
let bounds = null;
|
|
2322
|
+
function joinLayerBounds(layers, viewport) {
|
|
2323
|
+
const bounds = [Infinity, Infinity, -Infinity, -Infinity];
|
|
2416
2324
|
for (const layer of layers) {
|
|
2417
|
-
const
|
|
2418
|
-
if (
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
}
|
|
2325
|
+
const layerBounds = layer.getBounds();
|
|
2326
|
+
if (layerBounds) {
|
|
2327
|
+
const bottomLeftCommon = layer.projectPosition(layerBounds[0], {
|
|
2328
|
+
viewport,
|
|
2329
|
+
autoOffset: false
|
|
2330
|
+
});
|
|
2331
|
+
const topRightCommon = layer.projectPosition(layerBounds[1], {
|
|
2332
|
+
viewport,
|
|
2333
|
+
autoOffset: false
|
|
2334
|
+
});
|
|
2335
|
+
bounds[0] = Math.min(bounds[0], bottomLeftCommon[0]);
|
|
2336
|
+
bounds[1] = Math.min(bounds[1], bottomLeftCommon[1]);
|
|
2337
|
+
bounds[2] = Math.max(bounds[2], topRightCommon[0]);
|
|
2338
|
+
bounds[3] = Math.max(bounds[3], topRightCommon[1]);
|
|
2427
2339
|
}
|
|
2428
2340
|
}
|
|
2429
|
-
|
|
2430
|
-
if (!bounds) {
|
|
2431
|
-
return viewportBounds;
|
|
2432
|
-
}
|
|
2433
|
-
const paddedBounds = _doubleBounds(viewportBounds);
|
|
2434
|
-
if (bounds[2] - bounds[0] < paddedBounds[2] - paddedBounds[0] || bounds[3] - bounds[1] < paddedBounds[3] - paddedBounds[1]) {
|
|
2341
|
+
if (Number.isFinite(bounds[0])) {
|
|
2435
2342
|
return bounds;
|
|
2436
2343
|
}
|
|
2437
|
-
|
|
2438
|
-
bounds[1] = Math.max(bounds[1], paddedBounds[1]);
|
|
2439
|
-
bounds[2] = Math.min(bounds[2], paddedBounds[2]);
|
|
2440
|
-
bounds[3] = Math.min(bounds[3], paddedBounds[3]);
|
|
2441
|
-
return bounds;
|
|
2344
|
+
return null;
|
|
2442
2345
|
}
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2346
|
+
var MAX_VIEWPORT_SIZE = 2048;
|
|
2347
|
+
function makeViewport(opts) {
|
|
2348
|
+
const {
|
|
2349
|
+
bounds,
|
|
2350
|
+
viewport,
|
|
2351
|
+
border = 0
|
|
2352
|
+
} = opts;
|
|
2353
|
+
const {
|
|
2354
|
+
isGeospatial
|
|
2355
|
+
} = viewport;
|
|
2449
2356
|
if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) {
|
|
2450
2357
|
return null;
|
|
2451
2358
|
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
return null;
|
|
2455
|
-
}
|
|
2456
|
-
const padding = 1;
|
|
2457
|
-
width -= padding * 2;
|
|
2458
|
-
height -= padding * 2;
|
|
2459
|
-
if (viewport.isGeospatial) {
|
|
2460
|
-
const {
|
|
2461
|
-
longitude,
|
|
2462
|
-
latitude,
|
|
2463
|
-
zoom
|
|
2464
|
-
} = fitBounds({
|
|
2465
|
-
width,
|
|
2466
|
-
height,
|
|
2467
|
-
bounds: [[bounds[0], bounds[1]], [bounds[2], bounds[3]]],
|
|
2468
|
-
maxZoom: 20
|
|
2469
|
-
});
|
|
2470
|
-
return new import_core19.WebMercatorViewport({
|
|
2471
|
-
longitude,
|
|
2472
|
-
latitude,
|
|
2473
|
-
zoom,
|
|
2474
|
-
x: padding,
|
|
2475
|
-
y: padding,
|
|
2476
|
-
width,
|
|
2477
|
-
height
|
|
2478
|
-
});
|
|
2479
|
-
}
|
|
2480
|
-
const center = [(bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2, 0];
|
|
2481
|
-
const scale = Math.min(
|
|
2482
|
-
1048576,
|
|
2483
|
-
width / (bounds[2] - bounds[0]),
|
|
2484
|
-
height / (bounds[3] - bounds[1])
|
|
2485
|
-
);
|
|
2486
|
-
return new import_core19.OrthographicView({
|
|
2487
|
-
x: padding,
|
|
2488
|
-
y: padding
|
|
2489
|
-
}).makeViewport({
|
|
2359
|
+
const centerWorld = viewport.unprojectPosition([(bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2, 0]);
|
|
2360
|
+
let {
|
|
2490
2361
|
width,
|
|
2491
2362
|
height,
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2363
|
+
zoom
|
|
2364
|
+
} = opts;
|
|
2365
|
+
if (zoom === void 0) {
|
|
2366
|
+
width = width - border * 2;
|
|
2367
|
+
height = height - border * 2;
|
|
2368
|
+
const scale = Math.min(width / (bounds[2] - bounds[0]), height / (bounds[3] - bounds[1]));
|
|
2369
|
+
zoom = Math.min(Math.log2(scale), 20);
|
|
2370
|
+
} else if (!width || !height) {
|
|
2371
|
+
const scale = 2 ** zoom;
|
|
2372
|
+
width = Math.round(Math.abs(bounds[2] - bounds[0]) * scale);
|
|
2373
|
+
height = Math.round(Math.abs(bounds[3] - bounds[1]) * scale);
|
|
2374
|
+
const maxSize = MAX_VIEWPORT_SIZE - border * 2;
|
|
2375
|
+
if (width > maxSize || height > maxSize) {
|
|
2376
|
+
const r = maxSize / Math.max(width, height);
|
|
2377
|
+
width = Math.round(width * r);
|
|
2378
|
+
height = Math.round(height * r);
|
|
2379
|
+
zoom += Math.log2(r);
|
|
2495
2380
|
}
|
|
2381
|
+
}
|
|
2382
|
+
return isGeospatial ? new import_core19.WebMercatorViewport({
|
|
2383
|
+
x: border,
|
|
2384
|
+
y: border,
|
|
2385
|
+
width,
|
|
2386
|
+
height,
|
|
2387
|
+
longitude: centerWorld[0],
|
|
2388
|
+
latitude: centerWorld[1],
|
|
2389
|
+
zoom,
|
|
2390
|
+
orthographic: true
|
|
2391
|
+
}) : new import_core19.OrthographicViewport({
|
|
2392
|
+
x: border,
|
|
2393
|
+
y: border,
|
|
2394
|
+
width,
|
|
2395
|
+
height,
|
|
2396
|
+
target: centerWorld,
|
|
2397
|
+
zoom,
|
|
2398
|
+
flipY: false
|
|
2496
2399
|
});
|
|
2497
2400
|
}
|
|
2498
|
-
function
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2401
|
+
function getViewportBounds(viewport, zRange) {
|
|
2402
|
+
let viewportBoundsWorld;
|
|
2403
|
+
if (zRange && zRange.length === 2) {
|
|
2404
|
+
const [minZ, maxZ] = zRange;
|
|
2405
|
+
const bounds0 = viewport.getBounds({
|
|
2406
|
+
z: minZ
|
|
2407
|
+
});
|
|
2408
|
+
const bounds1 = viewport.getBounds({
|
|
2409
|
+
z: maxZ
|
|
2410
|
+
});
|
|
2411
|
+
viewportBoundsWorld = [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
|
|
2412
|
+
} else {
|
|
2413
|
+
viewportBoundsWorld = viewport.getBounds();
|
|
2414
|
+
}
|
|
2415
|
+
const viewportBottomLeftCommon = viewport.projectPosition(viewportBoundsWorld.slice(0, 2));
|
|
2416
|
+
const viewportTopRightCommon = viewport.projectPosition(viewportBoundsWorld.slice(2, 4));
|
|
2417
|
+
return [viewportBottomLeftCommon[0], viewportBottomLeftCommon[1], viewportTopRightCommon[0], viewportTopRightCommon[1]];
|
|
2418
|
+
}
|
|
2419
|
+
function getRenderBounds(layerBounds, viewport, zRange) {
|
|
2420
|
+
if (!layerBounds) {
|
|
2421
|
+
return [0, 0, 1, 1];
|
|
2422
|
+
}
|
|
2423
|
+
const viewportBounds = getViewportBounds(viewport, zRange);
|
|
2424
|
+
const paddedBounds = doubleBounds(viewportBounds);
|
|
2425
|
+
if (layerBounds[2] - layerBounds[0] <= paddedBounds[2] - paddedBounds[0] && layerBounds[3] - layerBounds[1] <= paddedBounds[3] - paddedBounds[1]) {
|
|
2426
|
+
return layerBounds;
|
|
2427
|
+
}
|
|
2428
|
+
return [Math.max(layerBounds[0], paddedBounds[0]), Math.max(layerBounds[1], paddedBounds[1]), Math.min(layerBounds[2], paddedBounds[2]), Math.min(layerBounds[3], paddedBounds[3])];
|
|
2429
|
+
}
|
|
2430
|
+
function doubleBounds(bounds) {
|
|
2431
|
+
const dx = bounds[2] - bounds[0];
|
|
2432
|
+
const dy = bounds[3] - bounds[1];
|
|
2433
|
+
const centerX = (bounds[0] + bounds[2]) / 2;
|
|
2434
|
+
const centerY = (bounds[1] + bounds[3]) / 2;
|
|
2435
|
+
return [centerX - dx, centerY - dy, centerX + dx, centerY + dy];
|
|
2508
2436
|
}
|
|
2509
2437
|
|
|
2510
2438
|
// src/mask/mask-effect.ts
|
|
@@ -2553,6 +2481,12 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2553
2481
|
const channelMap = this._sortMaskChannels(maskLayers);
|
|
2554
2482
|
const viewport = viewports[0];
|
|
2555
2483
|
const viewportChanged = !this.lastViewport || !this.lastViewport.equals(viewport);
|
|
2484
|
+
if (viewport.resolution !== void 0) {
|
|
2485
|
+
import_core20.log.warn("MaskExtension is not supported in GlobeView")();
|
|
2486
|
+
return {
|
|
2487
|
+
didRender
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2556
2490
|
for (const maskId in channelMap) {
|
|
2557
2491
|
const result = this._renderChannel(channelMap[maskId], {
|
|
2558
2492
|
layerFilter,
|
|
@@ -2579,26 +2513,25 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2579
2513
|
if (!oldChannelInfo) {
|
|
2580
2514
|
return didRender;
|
|
2581
2515
|
}
|
|
2582
|
-
const maskChanged = channelInfo === oldChannelInfo ||
|
|
2516
|
+
const maskChanged = channelInfo === oldChannelInfo || channelInfo.layers.length !== oldChannelInfo.layers.length || channelInfo.layers.some((layer, i) => layer !== oldChannelInfo.layers[i] || layer.props.transitions) || channelInfo.layerBounds.some((b, i) => b !== oldChannelInfo.layerBounds[i]);
|
|
2583
2517
|
channelInfo.bounds = oldChannelInfo.bounds;
|
|
2584
2518
|
channelInfo.maskBounds = oldChannelInfo.maskBounds;
|
|
2585
2519
|
this.channels[channelInfo.index] = channelInfo;
|
|
2586
2520
|
if (maskChanged || viewportChanged) {
|
|
2587
2521
|
this.lastViewport = viewport;
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
viewport
|
|
2591
|
-
});
|
|
2522
|
+
const layerBounds = joinLayerBounds(channelInfo.layers, viewport);
|
|
2523
|
+
channelInfo.bounds = layerBounds && getRenderBounds(layerBounds, viewport);
|
|
2592
2524
|
if (maskChanged || !equals(channelInfo.bounds, oldChannelInfo.bounds)) {
|
|
2593
2525
|
const {
|
|
2594
2526
|
maskPass,
|
|
2595
2527
|
maskMap
|
|
2596
2528
|
} = this;
|
|
2597
|
-
const maskViewport =
|
|
2529
|
+
const maskViewport = layerBounds && makeViewport({
|
|
2598
2530
|
bounds: channelInfo.bounds,
|
|
2599
2531
|
viewport,
|
|
2600
2532
|
width: maskMap.width,
|
|
2601
|
-
height: maskMap.height
|
|
2533
|
+
height: maskMap.height,
|
|
2534
|
+
border: 1
|
|
2602
2535
|
});
|
|
2603
2536
|
channelInfo.maskBounds = maskViewport ? maskViewport.getBounds() : [0, 0, 1, 1];
|
|
2604
2537
|
maskPass.render({
|
|
@@ -2687,15 +2620,15 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2687
2620
|
}
|
|
2688
2621
|
};
|
|
2689
2622
|
|
|
2690
|
-
// src/
|
|
2623
|
+
// src/collision-filter/collision-filter-effect.ts
|
|
2691
2624
|
var DOWNSCALE = 2;
|
|
2692
|
-
var
|
|
2693
|
-
id = "
|
|
2625
|
+
var CollisionFilterEffect = class {
|
|
2626
|
+
id = "collision-filter-effect";
|
|
2694
2627
|
props = null;
|
|
2695
2628
|
useInPicking = true;
|
|
2696
2629
|
order = 1;
|
|
2697
2630
|
channels = {};
|
|
2698
|
-
|
|
2631
|
+
collisionFBOs = {};
|
|
2699
2632
|
preRender(gl, {
|
|
2700
2633
|
effects: allEffects,
|
|
2701
2634
|
layers,
|
|
@@ -2706,8 +2639,8 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2706
2639
|
isPicking,
|
|
2707
2640
|
preRenderStats = {}
|
|
2708
2641
|
}) {
|
|
2709
|
-
if (!this.
|
|
2710
|
-
this.
|
|
2642
|
+
if (!this.dummyCollisionMap) {
|
|
2643
|
+
this.dummyCollisionMap = new import_core23.Texture2D(gl, {
|
|
2711
2644
|
width: 1,
|
|
2712
2645
|
height: 1
|
|
2713
2646
|
});
|
|
@@ -2715,32 +2648,32 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2715
2648
|
if (isPicking) {
|
|
2716
2649
|
return;
|
|
2717
2650
|
}
|
|
2718
|
-
const
|
|
2651
|
+
const collisionLayers = layers.filter(
|
|
2719
2652
|
({
|
|
2720
2653
|
props: {
|
|
2721
2654
|
visible,
|
|
2722
|
-
|
|
2655
|
+
collisionEnabled
|
|
2723
2656
|
}
|
|
2724
|
-
}) => visible &&
|
|
2657
|
+
}) => visible && collisionEnabled
|
|
2725
2658
|
);
|
|
2726
|
-
if (
|
|
2659
|
+
if (collisionLayers.length === 0) {
|
|
2727
2660
|
this.channels = {};
|
|
2728
2661
|
return;
|
|
2729
2662
|
}
|
|
2730
|
-
if (!this.
|
|
2731
|
-
this.
|
|
2732
|
-
id: "default-
|
|
2663
|
+
if (!this.collisionFilterPass) {
|
|
2664
|
+
this.collisionFilterPass = new CollisionFilterPass(gl, {
|
|
2665
|
+
id: "default-collision-filter"
|
|
2733
2666
|
});
|
|
2734
2667
|
}
|
|
2735
2668
|
const effects = allEffects?.filter((e) => e.constructor === MaskEffect);
|
|
2736
2669
|
const maskEffectRendered = preRenderStats["mask-effect"]?.didRender;
|
|
2737
|
-
const channels = this.
|
|
2670
|
+
const channels = this._groupByCollisionGroup(gl, collisionLayers);
|
|
2738
2671
|
const viewport = viewports[0];
|
|
2739
2672
|
const viewportChanged = !this.lastViewport || !this.lastViewport.equals(viewport) || maskEffectRendered;
|
|
2740
|
-
for (const
|
|
2741
|
-
const
|
|
2742
|
-
const renderInfo = channels[
|
|
2743
|
-
|
|
2673
|
+
for (const collisionGroup in channels) {
|
|
2674
|
+
const collisionFBO = this.collisionFBOs[collisionGroup];
|
|
2675
|
+
const renderInfo = channels[collisionGroup];
|
|
2676
|
+
collisionFBO.resize({
|
|
2744
2677
|
width: gl.canvas.width / DOWNSCALE,
|
|
2745
2678
|
height: gl.canvas.height / DOWNSCALE
|
|
2746
2679
|
});
|
|
@@ -2763,19 +2696,19 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2763
2696
|
viewportChanged
|
|
2764
2697
|
}) {
|
|
2765
2698
|
const {
|
|
2766
|
-
|
|
2699
|
+
collisionGroup
|
|
2767
2700
|
} = renderInfo;
|
|
2768
|
-
const oldRenderInfo = this.channels[
|
|
2701
|
+
const oldRenderInfo = this.channels[collisionGroup];
|
|
2769
2702
|
if (!oldRenderInfo) {
|
|
2770
2703
|
return;
|
|
2771
2704
|
}
|
|
2772
|
-
const needsRender = viewportChanged || renderInfo === oldRenderInfo || !(0, import_core25._deepEqual)(oldRenderInfo.layers, renderInfo.layers,
|
|
2773
|
-
this.channels[
|
|
2705
|
+
const needsRender = viewportChanged || renderInfo === oldRenderInfo || !(0, import_core25._deepEqual)(oldRenderInfo.layers, renderInfo.layers, 1) || renderInfo.layerBounds.some((b, i) => !equals(b, oldRenderInfo.layerBounds[i])) || renderInfo.allLayersLoaded !== oldRenderInfo.allLayersLoaded || renderInfo.layers.some((layer) => layer.props.transitions);
|
|
2706
|
+
this.channels[collisionGroup] = renderInfo;
|
|
2774
2707
|
if (needsRender) {
|
|
2775
2708
|
this.lastViewport = viewport;
|
|
2776
|
-
const
|
|
2777
|
-
this.
|
|
2778
|
-
pass: "
|
|
2709
|
+
const collisionFBO = this.collisionFBOs[collisionGroup];
|
|
2710
|
+
this.collisionFilterPass.renderCollisionMap(collisionFBO, {
|
|
2711
|
+
pass: "collision-filter",
|
|
2779
2712
|
isPicking: true,
|
|
2780
2713
|
layers: renderInfo.layers,
|
|
2781
2714
|
effects,
|
|
@@ -2784,76 +2717,80 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2784
2717
|
onViewportActive,
|
|
2785
2718
|
views,
|
|
2786
2719
|
moduleParameters: {
|
|
2787
|
-
|
|
2788
|
-
devicePixelRatio: (0, import_core23.cssToDeviceRatio)(
|
|
2720
|
+
dummyCollisionMap: this.dummyCollisionMap,
|
|
2721
|
+
devicePixelRatio: (0, import_core23.cssToDeviceRatio)(collisionFBO.gl) / DOWNSCALE
|
|
2789
2722
|
}
|
|
2790
2723
|
});
|
|
2791
2724
|
}
|
|
2792
2725
|
}
|
|
2793
|
-
|
|
2726
|
+
_groupByCollisionGroup(gl, collisionLayers) {
|
|
2794
2727
|
const channelMap = {};
|
|
2795
|
-
for (const layer of
|
|
2728
|
+
for (const layer of collisionLayers) {
|
|
2796
2729
|
const {
|
|
2797
|
-
|
|
2730
|
+
collisionGroup
|
|
2798
2731
|
} = layer.props;
|
|
2799
|
-
let channelInfo = channelMap[
|
|
2732
|
+
let channelInfo = channelMap[collisionGroup];
|
|
2800
2733
|
if (!channelInfo) {
|
|
2801
2734
|
channelInfo = {
|
|
2802
|
-
|
|
2735
|
+
collisionGroup,
|
|
2803
2736
|
layers: [],
|
|
2804
|
-
layerBounds: []
|
|
2737
|
+
layerBounds: [],
|
|
2738
|
+
allLayersLoaded: true
|
|
2805
2739
|
};
|
|
2806
|
-
channelMap[
|
|
2740
|
+
channelMap[collisionGroup] = channelInfo;
|
|
2807
2741
|
}
|
|
2808
2742
|
channelInfo.layers.push(layer);
|
|
2809
2743
|
channelInfo.layerBounds.push(layer.getBounds());
|
|
2744
|
+
if (!layer.isLoaded) {
|
|
2745
|
+
channelInfo.allLayersLoaded = false;
|
|
2746
|
+
}
|
|
2810
2747
|
}
|
|
2811
|
-
for (const
|
|
2812
|
-
if (!this.
|
|
2813
|
-
this.createFBO(gl,
|
|
2748
|
+
for (const collisionGroup of Object.keys(channelMap)) {
|
|
2749
|
+
if (!this.collisionFBOs[collisionGroup]) {
|
|
2750
|
+
this.createFBO(gl, collisionGroup);
|
|
2814
2751
|
}
|
|
2815
|
-
if (!this.channels[
|
|
2816
|
-
this.channels[
|
|
2752
|
+
if (!this.channels[collisionGroup]) {
|
|
2753
|
+
this.channels[collisionGroup] = channelMap[collisionGroup];
|
|
2817
2754
|
}
|
|
2818
2755
|
}
|
|
2819
|
-
for (const
|
|
2820
|
-
if (!channelMap[
|
|
2821
|
-
this.destroyFBO(
|
|
2756
|
+
for (const collisionGroup of Object.keys(this.collisionFBOs)) {
|
|
2757
|
+
if (!channelMap[collisionGroup]) {
|
|
2758
|
+
this.destroyFBO(collisionGroup);
|
|
2822
2759
|
}
|
|
2823
2760
|
}
|
|
2824
2761
|
return channelMap;
|
|
2825
2762
|
}
|
|
2826
2763
|
getModuleParameters(layer) {
|
|
2827
2764
|
const {
|
|
2828
|
-
|
|
2765
|
+
collisionGroup
|
|
2829
2766
|
} = layer.props;
|
|
2830
2767
|
const {
|
|
2831
|
-
|
|
2832
|
-
|
|
2768
|
+
collisionFBOs,
|
|
2769
|
+
dummyCollisionMap
|
|
2833
2770
|
} = this;
|
|
2834
2771
|
return {
|
|
2835
|
-
|
|
2836
|
-
|
|
2772
|
+
collisionFBO: collisionFBOs[collisionGroup],
|
|
2773
|
+
dummyCollisionMap
|
|
2837
2774
|
};
|
|
2838
2775
|
}
|
|
2839
2776
|
cleanup() {
|
|
2840
|
-
if (this.
|
|
2841
|
-
this.
|
|
2842
|
-
this.
|
|
2777
|
+
if (this.dummyCollisionMap) {
|
|
2778
|
+
this.dummyCollisionMap.delete();
|
|
2779
|
+
this.dummyCollisionMap = void 0;
|
|
2843
2780
|
}
|
|
2844
2781
|
this.channels = {};
|
|
2845
|
-
for (const
|
|
2846
|
-
this.destroyFBO(
|
|
2782
|
+
for (const collisionGroup of Object.keys(this.collisionFBOs)) {
|
|
2783
|
+
this.destroyFBO(collisionGroup);
|
|
2847
2784
|
}
|
|
2848
|
-
this.
|
|
2785
|
+
this.collisionFBOs = {};
|
|
2849
2786
|
this.lastViewport = void 0;
|
|
2850
2787
|
}
|
|
2851
|
-
createFBO(gl,
|
|
2788
|
+
createFBO(gl, collisionGroup) {
|
|
2852
2789
|
const {
|
|
2853
2790
|
width,
|
|
2854
2791
|
height
|
|
2855
2792
|
} = gl.canvas;
|
|
2856
|
-
const
|
|
2793
|
+
const collisionMap = new import_core23.Texture2D(gl, {
|
|
2857
2794
|
width,
|
|
2858
2795
|
height,
|
|
2859
2796
|
parameters: {
|
|
@@ -2868,40 +2805,40 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2868
2805
|
width,
|
|
2869
2806
|
height
|
|
2870
2807
|
});
|
|
2871
|
-
this.
|
|
2872
|
-
id: `
|
|
2808
|
+
this.collisionFBOs[collisionGroup] = new import_core23.Framebuffer(gl, {
|
|
2809
|
+
id: `Collision-${collisionGroup}`,
|
|
2873
2810
|
width,
|
|
2874
2811
|
height,
|
|
2875
2812
|
attachments: {
|
|
2876
|
-
[gl.COLOR_ATTACHMENT0]:
|
|
2813
|
+
[gl.COLOR_ATTACHMENT0]: collisionMap,
|
|
2877
2814
|
[gl.DEPTH_ATTACHMENT]: depthBuffer
|
|
2878
2815
|
}
|
|
2879
2816
|
});
|
|
2880
2817
|
}
|
|
2881
|
-
destroyFBO(
|
|
2882
|
-
const fbo = this.
|
|
2818
|
+
destroyFBO(collisionGroup) {
|
|
2819
|
+
const fbo = this.collisionFBOs[collisionGroup];
|
|
2883
2820
|
for (const attachment of Object.values(fbo.attachments)) {
|
|
2884
2821
|
attachment.delete();
|
|
2885
2822
|
}
|
|
2886
2823
|
fbo.delete();
|
|
2887
|
-
delete this.
|
|
2824
|
+
delete this.collisionFBOs[collisionGroup];
|
|
2888
2825
|
}
|
|
2889
2826
|
};
|
|
2890
2827
|
|
|
2891
|
-
// src/
|
|
2828
|
+
// src/collision-filter/collision-filter.ts
|
|
2892
2829
|
var defaultProps6 = {
|
|
2893
|
-
|
|
2830
|
+
getCollisionPriority: {
|
|
2894
2831
|
type: "accessor",
|
|
2895
2832
|
value: 0
|
|
2896
2833
|
},
|
|
2897
|
-
|
|
2898
|
-
|
|
2834
|
+
collisionEnabled: true,
|
|
2835
|
+
collisionGroup: {
|
|
2899
2836
|
type: "string",
|
|
2900
2837
|
value: "default"
|
|
2901
2838
|
},
|
|
2902
|
-
|
|
2839
|
+
collisionTestProps: {}
|
|
2903
2840
|
};
|
|
2904
|
-
var
|
|
2841
|
+
var CollisionFilterExtension = class extends import_core26.LayerExtension {
|
|
2905
2842
|
getShaders() {
|
|
2906
2843
|
return {
|
|
2907
2844
|
modules: [shader_module_default2]
|
|
@@ -2913,33 +2850,33 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2913
2850
|
moduleParameters
|
|
2914
2851
|
}) {
|
|
2915
2852
|
const {
|
|
2916
|
-
|
|
2853
|
+
collisionEnabled
|
|
2917
2854
|
} = this.props;
|
|
2918
2855
|
const {
|
|
2919
|
-
|
|
2920
|
-
|
|
2856
|
+
collisionFBO,
|
|
2857
|
+
drawToCollisionMap
|
|
2921
2858
|
} = moduleParameters;
|
|
2922
|
-
const enabled =
|
|
2923
|
-
uniforms.
|
|
2924
|
-
if (
|
|
2925
|
-
this.props = this.clone(this.props.
|
|
2859
|
+
const enabled = collisionEnabled && Boolean(collisionFBO);
|
|
2860
|
+
uniforms.collision_enabled = enabled;
|
|
2861
|
+
if (drawToCollisionMap) {
|
|
2862
|
+
this.props = this.clone(this.props.collisionTestProps).props;
|
|
2926
2863
|
}
|
|
2927
2864
|
}
|
|
2928
2865
|
initializeState(context, extension) {
|
|
2929
2866
|
if (this.getAttributeManager() === null) {
|
|
2930
2867
|
return;
|
|
2931
2868
|
}
|
|
2932
|
-
this.context.deck?._addDefaultEffect(new
|
|
2869
|
+
this.context.deck?._addDefaultEffect(new CollisionFilterEffect());
|
|
2933
2870
|
const attributeManager = this.getAttributeManager();
|
|
2934
2871
|
attributeManager.add({
|
|
2935
|
-
|
|
2872
|
+
collisionPriorities: {
|
|
2936
2873
|
size: 1,
|
|
2937
|
-
accessor: "
|
|
2874
|
+
accessor: "getCollisionPriority",
|
|
2938
2875
|
shaderAttributes: {
|
|
2939
|
-
|
|
2876
|
+
collisionPriorities: {
|
|
2940
2877
|
divisor: 0
|
|
2941
2878
|
},
|
|
2942
|
-
|
|
2879
|
+
instanceCollisionPriorities: {
|
|
2943
2880
|
divisor: 1
|
|
2944
2881
|
}
|
|
2945
2882
|
}
|
|
@@ -2947,11 +2884,11 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2947
2884
|
});
|
|
2948
2885
|
}
|
|
2949
2886
|
getNeedsPickingBuffer() {
|
|
2950
|
-
return this.props.
|
|
2887
|
+
return this.props.collisionEnabled;
|
|
2951
2888
|
}
|
|
2952
2889
|
};
|
|
2953
|
-
__publicField(
|
|
2954
|
-
__publicField(
|
|
2890
|
+
__publicField(CollisionFilterExtension, "defaultProps", defaultProps6);
|
|
2891
|
+
__publicField(CollisionFilterExtension, "extensionName", "CollisionFilterExtension");
|
|
2955
2892
|
|
|
2956
2893
|
// src/mask/mask.ts
|
|
2957
2894
|
var import_core28 = __toESM(require_core());
|
|
@@ -3109,11 +3046,11 @@ varying vec2 mask_texCoords;
|
|
|
3109
3046
|
__publicField(MaskExtension, "extensionName", "MaskExtension");
|
|
3110
3047
|
|
|
3111
3048
|
// src/terrain/terrain.ts
|
|
3112
|
-
var
|
|
3049
|
+
var import_core38 = __toESM(require_core());
|
|
3113
3050
|
|
|
3114
3051
|
// src/terrain/terrain-effect.ts
|
|
3115
|
-
var
|
|
3116
|
-
var
|
|
3052
|
+
var import_core36 = __toESM(require_core2());
|
|
3053
|
+
var import_core37 = __toESM(require_core());
|
|
3117
3054
|
|
|
3118
3055
|
// src/terrain/shader-module.ts
|
|
3119
3056
|
var import_core29 = __toESM(require_core());
|
|
@@ -3258,122 +3195,6 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3258
3195
|
});
|
|
3259
3196
|
}
|
|
3260
3197
|
|
|
3261
|
-
// src/common/projection-utils.ts
|
|
3262
|
-
var import_core31 = __toESM(require_core());
|
|
3263
|
-
function joinLayerBounds(layers, viewport) {
|
|
3264
|
-
const bounds = [Infinity, Infinity, -Infinity, -Infinity];
|
|
3265
|
-
for (const layer of layers) {
|
|
3266
|
-
const layerBounds = layer.getBounds();
|
|
3267
|
-
if (layerBounds) {
|
|
3268
|
-
const bottomLeftCommon = layer.projectPosition(layerBounds[0], {
|
|
3269
|
-
viewport,
|
|
3270
|
-
autoOffset: false
|
|
3271
|
-
});
|
|
3272
|
-
const topRightCommon = layer.projectPosition(layerBounds[1], {
|
|
3273
|
-
viewport,
|
|
3274
|
-
autoOffset: false
|
|
3275
|
-
});
|
|
3276
|
-
bounds[0] = Math.min(bounds[0], bottomLeftCommon[0]);
|
|
3277
|
-
bounds[1] = Math.min(bounds[1], bottomLeftCommon[1]);
|
|
3278
|
-
bounds[2] = Math.max(bounds[2], topRightCommon[0]);
|
|
3279
|
-
bounds[3] = Math.max(bounds[3], topRightCommon[1]);
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
if (Number.isFinite(bounds[0])) {
|
|
3283
|
-
return bounds;
|
|
3284
|
-
}
|
|
3285
|
-
return null;
|
|
3286
|
-
}
|
|
3287
|
-
var MAX_VIEWPORT_SIZE = 2048;
|
|
3288
|
-
function makeViewport(opts) {
|
|
3289
|
-
const {
|
|
3290
|
-
bounds,
|
|
3291
|
-
viewport,
|
|
3292
|
-
border = 0
|
|
3293
|
-
} = opts;
|
|
3294
|
-
const {
|
|
3295
|
-
isGeospatial
|
|
3296
|
-
} = viewport;
|
|
3297
|
-
if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) {
|
|
3298
|
-
return null;
|
|
3299
|
-
}
|
|
3300
|
-
const centerWorld = viewport.unprojectPosition([(bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2, 0]);
|
|
3301
|
-
const maxSize = MAX_VIEWPORT_SIZE - border * 2;
|
|
3302
|
-
let {
|
|
3303
|
-
width,
|
|
3304
|
-
height,
|
|
3305
|
-
zoom
|
|
3306
|
-
} = opts;
|
|
3307
|
-
if (zoom === void 0) {
|
|
3308
|
-
const scale = Math.min(width / (bounds[2] - bounds[0]), height / (bounds[3] - bounds[1]));
|
|
3309
|
-
zoom = Math.min(Math.log2(scale), 20);
|
|
3310
|
-
} else if (!width || !height) {
|
|
3311
|
-
const scale = 2 ** zoom;
|
|
3312
|
-
width = Math.round(Math.abs(bounds[2] - bounds[0]) * scale);
|
|
3313
|
-
height = Math.round(Math.abs(bounds[3] - bounds[1]) * scale);
|
|
3314
|
-
if (width > maxSize || height > maxSize) {
|
|
3315
|
-
const r = maxSize / Math.max(width, height);
|
|
3316
|
-
width = Math.round(width * r);
|
|
3317
|
-
height = Math.round(height * r);
|
|
3318
|
-
zoom += Math.log2(r);
|
|
3319
|
-
}
|
|
3320
|
-
}
|
|
3321
|
-
return isGeospatial ? new import_core31.WebMercatorViewport({
|
|
3322
|
-
x: border,
|
|
3323
|
-
y: border,
|
|
3324
|
-
width,
|
|
3325
|
-
height,
|
|
3326
|
-
longitude: centerWorld[0],
|
|
3327
|
-
latitude: centerWorld[1],
|
|
3328
|
-
zoom,
|
|
3329
|
-
orthographic: true
|
|
3330
|
-
}) : new import_core31.OrthographicViewport({
|
|
3331
|
-
x: border,
|
|
3332
|
-
y: border,
|
|
3333
|
-
width,
|
|
3334
|
-
height,
|
|
3335
|
-
target: centerWorld,
|
|
3336
|
-
zoom,
|
|
3337
|
-
flipY: false
|
|
3338
|
-
});
|
|
3339
|
-
}
|
|
3340
|
-
function getViewportBounds(viewport, zRange) {
|
|
3341
|
-
let viewportBoundsWorld;
|
|
3342
|
-
if (zRange && zRange.length === 2) {
|
|
3343
|
-
const [minZ, maxZ] = zRange;
|
|
3344
|
-
const bounds0 = viewport.getBounds({
|
|
3345
|
-
z: minZ
|
|
3346
|
-
});
|
|
3347
|
-
const bounds1 = viewport.getBounds({
|
|
3348
|
-
z: maxZ
|
|
3349
|
-
});
|
|
3350
|
-
viewportBoundsWorld = [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
|
|
3351
|
-
} else {
|
|
3352
|
-
viewportBoundsWorld = viewport.getBounds();
|
|
3353
|
-
}
|
|
3354
|
-
const viewportBottomLeftCommon = viewport.projectPosition(viewportBoundsWorld.slice(0, 2));
|
|
3355
|
-
const viewportTopRightCommon = viewport.projectPosition(viewportBoundsWorld.slice(2, 4));
|
|
3356
|
-
return [viewportBottomLeftCommon[0], viewportBottomLeftCommon[1], viewportTopRightCommon[0], viewportTopRightCommon[1]];
|
|
3357
|
-
}
|
|
3358
|
-
function getRenderBounds(layerBounds, viewport, zRange) {
|
|
3359
|
-
if (!layerBounds) {
|
|
3360
|
-
return [0, 0, 1, 1];
|
|
3361
|
-
}
|
|
3362
|
-
const viewportBounds = getViewportBounds(viewport, zRange);
|
|
3363
|
-
const paddedBounds = doubleBounds(viewportBounds);
|
|
3364
|
-
if (layerBounds[2] - layerBounds[0] <= paddedBounds[2] - paddedBounds[0] && layerBounds[3] - layerBounds[1] <= paddedBounds[3] - paddedBounds[1]) {
|
|
3365
|
-
return layerBounds;
|
|
3366
|
-
}
|
|
3367
|
-
return [Math.max(layerBounds[0], paddedBounds[0]), Math.max(layerBounds[1], paddedBounds[1]), Math.min(layerBounds[2], paddedBounds[2]), Math.min(layerBounds[3], paddedBounds[3])];
|
|
3368
|
-
}
|
|
3369
|
-
function doubleBounds(bounds) {
|
|
3370
|
-
const dx = bounds[2] - bounds[0];
|
|
3371
|
-
const dy = bounds[3] - bounds[1];
|
|
3372
|
-
const centerX = (bounds[0] + bounds[2]) / 2;
|
|
3373
|
-
const centerY = (bounds[1] + bounds[3]) / 2;
|
|
3374
|
-
return [centerX - dx, centerY - dy, centerX + dx, centerY + dy];
|
|
3375
|
-
}
|
|
3376
|
-
|
|
3377
3198
|
// src/terrain/terrain-cover.ts
|
|
3378
3199
|
var TerrainCover = class {
|
|
3379
3200
|
isDirty = true;
|
|
@@ -3537,9 +3358,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3537
3358
|
}
|
|
3538
3359
|
|
|
3539
3360
|
// src/terrain/terrain-pass.ts
|
|
3540
|
-
var
|
|
3541
|
-
var
|
|
3542
|
-
var TerrainPass = class extends
|
|
3361
|
+
var import_core31 = __toESM(require_core2());
|
|
3362
|
+
var import_core32 = __toESM(require_core());
|
|
3363
|
+
var TerrainPass = class extends import_core32._LayersPass {
|
|
3543
3364
|
getRenderableLayers(viewport, opts) {
|
|
3544
3365
|
const {
|
|
3545
3366
|
layers
|
|
@@ -3561,7 +3382,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3561
3382
|
return;
|
|
3562
3383
|
}
|
|
3563
3384
|
target.resize(viewport);
|
|
3564
|
-
(0,
|
|
3385
|
+
(0, import_core31.withParameters)(this.gl, {
|
|
3565
3386
|
clearColor: [0, 0, 0, 0],
|
|
3566
3387
|
blend: true,
|
|
3567
3388
|
blendFunc: [esm_default.ONE, esm_default.ONE],
|
|
@@ -3584,7 +3405,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3584
3405
|
}
|
|
3585
3406
|
const layers = terrainCover.filterLayers(opts.layers);
|
|
3586
3407
|
target.resize(viewport);
|
|
3587
|
-
(0,
|
|
3408
|
+
(0, import_core31.withParameters)(this.gl, {
|
|
3588
3409
|
depthTest: false
|
|
3589
3410
|
}, () => this.render({
|
|
3590
3411
|
...opts,
|
|
@@ -3598,9 +3419,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3598
3419
|
};
|
|
3599
3420
|
|
|
3600
3421
|
// src/terrain/terrain-picking-pass.ts
|
|
3601
|
-
var
|
|
3602
|
-
var
|
|
3603
|
-
var TerrainPickingPass = class extends
|
|
3422
|
+
var import_core33 = __toESM(require_core());
|
|
3423
|
+
var import_core34 = __toESM(require_core2());
|
|
3424
|
+
var TerrainPickingPass = class extends import_core33._PickLayersPass {
|
|
3604
3425
|
drawParameters = {};
|
|
3605
3426
|
getRenderableLayers(viewport, opts) {
|
|
3606
3427
|
const {
|
|
@@ -3631,7 +3452,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3631
3452
|
layers.unshift(terrainLayer);
|
|
3632
3453
|
}
|
|
3633
3454
|
target.resize(viewport);
|
|
3634
|
-
(0,
|
|
3455
|
+
(0, import_core34.withParameters)(this.gl, {
|
|
3635
3456
|
depthTest: false
|
|
3636
3457
|
}, () => this.render({
|
|
3637
3458
|
...opts,
|
|
@@ -3656,7 +3477,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3656
3477
|
};
|
|
3657
3478
|
|
|
3658
3479
|
// src/terrain/height-map-builder.ts
|
|
3659
|
-
var
|
|
3480
|
+
var import_core35 = __toESM(require_core2());
|
|
3660
3481
|
var MAP_MAX_SIZE = 2048;
|
|
3661
3482
|
var HeightMapBuilder = class {
|
|
3662
3483
|
renderViewport = null;
|
|
@@ -3666,7 +3487,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3666
3487
|
layersBoundsCommon = null;
|
|
3667
3488
|
lastViewport = null;
|
|
3668
3489
|
static isSupported(gl) {
|
|
3669
|
-
return
|
|
3490
|
+
return import_core35.Framebuffer.isSupported(gl, {
|
|
3670
3491
|
colorBufferFloat: true
|
|
3671
3492
|
});
|
|
3672
3493
|
}
|
|
@@ -3733,7 +3554,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3733
3554
|
isDrapingEnabled = false;
|
|
3734
3555
|
terrainCovers = /* @__PURE__ */ new Map();
|
|
3735
3556
|
initialize(gl) {
|
|
3736
|
-
this.dummyHeightMap = new
|
|
3557
|
+
this.dummyHeightMap = new import_core36.Texture2D(gl, {
|
|
3737
3558
|
width: 1,
|
|
3738
3559
|
height: 1,
|
|
3739
3560
|
data: new Uint8Array([0, 0, 0, 0])
|
|
@@ -3747,9 +3568,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3747
3568
|
if (HeightMapBuilder.isSupported(gl)) {
|
|
3748
3569
|
this.heightMap = new HeightMapBuilder(gl);
|
|
3749
3570
|
} else {
|
|
3750
|
-
|
|
3571
|
+
import_core37.log.warn("Terrain offset mode is not supported by this browser")();
|
|
3751
3572
|
}
|
|
3752
|
-
|
|
3573
|
+
import_core36.ProgramManager.getDefaultProgramManager(gl).addDefaultModule(terrainModule);
|
|
3753
3574
|
}
|
|
3754
3575
|
preRender(gl, opts) {
|
|
3755
3576
|
if (!this.dummyHeightMap) {
|
|
@@ -3779,25 +3600,25 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3779
3600
|
return;
|
|
3780
3601
|
}
|
|
3781
3602
|
if (!isPicking) {
|
|
3782
|
-
const offsetLayers = layers.filter((l) => l.state.
|
|
3603
|
+
const offsetLayers = layers.filter((l) => l.state.terrainDrawMode === "offset");
|
|
3783
3604
|
if (offsetLayers.length > 0) {
|
|
3784
3605
|
this._updateHeightMap(terrainLayers, viewport, opts);
|
|
3785
3606
|
}
|
|
3786
3607
|
}
|
|
3787
|
-
const drapeLayers = layers.filter((l) => l.state.
|
|
3608
|
+
const drapeLayers = layers.filter((l) => l.state.terrainDrawMode === "drape");
|
|
3788
3609
|
this._updateTerrainCovers(terrainLayers, drapeLayers, viewport, opts);
|
|
3789
3610
|
}
|
|
3790
3611
|
getModuleParameters(layer) {
|
|
3791
3612
|
const {
|
|
3792
|
-
|
|
3613
|
+
terrainDrawMode
|
|
3793
3614
|
} = layer.state;
|
|
3794
3615
|
return {
|
|
3795
3616
|
heightMap: this.heightMap?.getRenderFramebuffer(),
|
|
3796
3617
|
heightMapBounds: this.heightMap?.bounds,
|
|
3797
3618
|
dummyHeightMap: this.dummyHeightMap,
|
|
3798
3619
|
terrainCover: this.isDrapingEnabled ? this.terrainCovers.get(layer.id) : null,
|
|
3799
|
-
useTerrainHeightMap:
|
|
3800
|
-
terrainSkipRender:
|
|
3620
|
+
useTerrainHeightMap: terrainDrawMode === "offset",
|
|
3621
|
+
terrainSkipRender: terrainDrawMode === "drape" || !layer.props.operation.includes("draw")
|
|
3801
3622
|
};
|
|
3802
3623
|
}
|
|
3803
3624
|
cleanup() {
|
|
@@ -3900,9 +3721,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3900
3721
|
|
|
3901
3722
|
// src/terrain/terrain.ts
|
|
3902
3723
|
var defaultProps8 = {
|
|
3903
|
-
|
|
3724
|
+
terrainDrawMode: void 0
|
|
3904
3725
|
};
|
|
3905
|
-
var TerrainExtension = class extends
|
|
3726
|
+
var TerrainExtension = class extends import_core38.LayerExtension {
|
|
3906
3727
|
getShaders() {
|
|
3907
3728
|
return {
|
|
3908
3729
|
modules: [terrainModule]
|
|
@@ -3916,25 +3737,25 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3916
3737
|
props,
|
|
3917
3738
|
oldProps
|
|
3918
3739
|
} = params;
|
|
3919
|
-
if (this.state.
|
|
3740
|
+
if (this.state.terrainDrawMode && props.terrainDrawMode === oldProps.terrainDrawMode && props.extruded === oldProps.extruded) {
|
|
3920
3741
|
return;
|
|
3921
3742
|
}
|
|
3922
3743
|
let {
|
|
3923
|
-
|
|
3744
|
+
terrainDrawMode
|
|
3924
3745
|
} = props;
|
|
3925
|
-
if (!
|
|
3746
|
+
if (!terrainDrawMode) {
|
|
3926
3747
|
const is3d = this.props.extruded;
|
|
3927
3748
|
const attributes = this.getAttributeManager()?.attributes;
|
|
3928
3749
|
const hasAnchor = attributes && "instancePositions" in attributes;
|
|
3929
|
-
|
|
3750
|
+
terrainDrawMode = is3d || hasAnchor ? "offset" : "drape";
|
|
3930
3751
|
}
|
|
3931
3752
|
this.setState({
|
|
3932
|
-
|
|
3753
|
+
terrainDrawMode
|
|
3933
3754
|
});
|
|
3934
3755
|
}
|
|
3935
3756
|
onNeedsRedraw() {
|
|
3936
3757
|
const state = this.state;
|
|
3937
|
-
if (state.
|
|
3758
|
+
if (state.terrainDrawMode === "drape") {
|
|
3938
3759
|
state.terrainCoverNeedsRedraw = true;
|
|
3939
3760
|
}
|
|
3940
3761
|
}
|