@deck.gl/extensions 8.9.0-beta.1 → 8.9.0-beta.3
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 +285 -464
- package/dist/es5/clip/clip.js.map +1 -1
- package/dist/es5/{collide/collide-effect.js → collision-filter/collision-filter-effect.js} +81 -73
- 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/shader-module.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 +16 -9
- 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 +7 -7
- 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/clip/clip.js.map +1 -1
- package/dist/esm/{collide/collide-effect.js → collision-filter/collision-filter-effect.js} +72 -66
- 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/shader-module.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 +15 -9
- 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 +6 -7
- 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/clip/clip.ts +1 -1
- package/src/{collide/collide-effect.ts → collision-filter/collision-filter-effect.ts} +83 -79
- 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/shader-module.ts +1 -1
- package/src/index.ts +3 -3
- package/src/mask/mask-effect.ts +23 -14
- 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 +6 -7
- package/src/terrain/terrain.ts +10 -10
- package/src/{common → utils}/projection-utils.ts +4 -2
- package/typed/clip/clip.d.ts +4 -1
- package/typed/clip/clip.d.ts.map +1 -1
- package/typed/collide/collide-effect.d.ts +1 -1
- package/typed/collide/collide-effect.d.ts.map +1 -1
- 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/shader-module.d.ts.map +1 -1
- package/typed/index.d.ts +3 -3
- package/typed/index.d.ts.map +1 -1
- package/typed/mask/mask-effect.d.ts +3 -3
- 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/height-map.d.ts +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-effect.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
|
|
|
@@ -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
|
|
@@ -2521,7 +2449,7 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2521
2449
|
viewports,
|
|
2522
2450
|
onViewportActive,
|
|
2523
2451
|
views,
|
|
2524
|
-
|
|
2452
|
+
isPicking
|
|
2525
2453
|
}) {
|
|
2526
2454
|
let didRender = false;
|
|
2527
2455
|
if (!this.dummyMaskMap) {
|
|
@@ -2530,7 +2458,7 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2530
2458
|
height: 1
|
|
2531
2459
|
});
|
|
2532
2460
|
}
|
|
2533
|
-
if (
|
|
2461
|
+
if (isPicking) {
|
|
2534
2462
|
return {
|
|
2535
2463
|
didRender
|
|
2536
2464
|
};
|
|
@@ -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,
|
|
@@ -2585,20 +2519,19 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
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,
|
|
@@ -2703,44 +2636,44 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2703
2636
|
viewports,
|
|
2704
2637
|
onViewportActive,
|
|
2705
2638
|
views,
|
|
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
|
});
|
|
2714
2647
|
}
|
|
2715
|
-
if (
|
|
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,20 @@ 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, 0) || renderInfo.layerBounds.some((b, i) => !equals(b, oldRenderInfo.layerBounds[i]));
|
|
2773
|
-
this.channels[
|
|
2705
|
+
const needsRender = viewportChanged || renderInfo === oldRenderInfo || !(0, import_core25._deepEqual)(oldRenderInfo.layers, renderInfo.layers, 0) || 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",
|
|
2712
|
+
isPicking: true,
|
|
2779
2713
|
layers: renderInfo.layers,
|
|
2780
2714
|
effects,
|
|
2781
2715
|
layerFilter,
|
|
@@ -2783,76 +2717,80 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2783
2717
|
onViewportActive,
|
|
2784
2718
|
views,
|
|
2785
2719
|
moduleParameters: {
|
|
2786
|
-
|
|
2787
|
-
devicePixelRatio: (0, import_core23.cssToDeviceRatio)(
|
|
2720
|
+
dummyCollisionMap: this.dummyCollisionMap,
|
|
2721
|
+
devicePixelRatio: (0, import_core23.cssToDeviceRatio)(collisionFBO.gl) / DOWNSCALE
|
|
2788
2722
|
}
|
|
2789
2723
|
});
|
|
2790
2724
|
}
|
|
2791
2725
|
}
|
|
2792
|
-
|
|
2726
|
+
_groupByCollisionGroup(gl, collisionLayers) {
|
|
2793
2727
|
const channelMap = {};
|
|
2794
|
-
for (const layer of
|
|
2728
|
+
for (const layer of collisionLayers) {
|
|
2795
2729
|
const {
|
|
2796
|
-
|
|
2730
|
+
collisionGroup
|
|
2797
2731
|
} = layer.props;
|
|
2798
|
-
let channelInfo = channelMap[
|
|
2732
|
+
let channelInfo = channelMap[collisionGroup];
|
|
2799
2733
|
if (!channelInfo) {
|
|
2800
2734
|
channelInfo = {
|
|
2801
|
-
|
|
2735
|
+
collisionGroup,
|
|
2802
2736
|
layers: [],
|
|
2803
|
-
layerBounds: []
|
|
2737
|
+
layerBounds: [],
|
|
2738
|
+
allLayersLoaded: true
|
|
2804
2739
|
};
|
|
2805
|
-
channelMap[
|
|
2740
|
+
channelMap[collisionGroup] = channelInfo;
|
|
2806
2741
|
}
|
|
2807
2742
|
channelInfo.layers.push(layer);
|
|
2808
2743
|
channelInfo.layerBounds.push(layer.getBounds());
|
|
2744
|
+
if (!layer.isLoaded) {
|
|
2745
|
+
channelInfo.allLayersLoaded = false;
|
|
2746
|
+
}
|
|
2809
2747
|
}
|
|
2810
|
-
for (const
|
|
2811
|
-
if (!this.
|
|
2812
|
-
this.createFBO(gl,
|
|
2748
|
+
for (const collisionGroup of Object.keys(channelMap)) {
|
|
2749
|
+
if (!this.collisionFBOs[collisionGroup]) {
|
|
2750
|
+
this.createFBO(gl, collisionGroup);
|
|
2813
2751
|
}
|
|
2814
|
-
if (!this.channels[
|
|
2815
|
-
this.channels[
|
|
2752
|
+
if (!this.channels[collisionGroup]) {
|
|
2753
|
+
this.channels[collisionGroup] = channelMap[collisionGroup];
|
|
2816
2754
|
}
|
|
2817
2755
|
}
|
|
2818
|
-
for (const
|
|
2819
|
-
if (!channelMap[
|
|
2820
|
-
this.destroyFBO(
|
|
2756
|
+
for (const collisionGroup of Object.keys(this.collisionFBOs)) {
|
|
2757
|
+
if (!channelMap[collisionGroup]) {
|
|
2758
|
+
this.destroyFBO(collisionGroup);
|
|
2821
2759
|
}
|
|
2822
2760
|
}
|
|
2823
2761
|
return channelMap;
|
|
2824
2762
|
}
|
|
2825
2763
|
getModuleParameters(layer) {
|
|
2826
2764
|
const {
|
|
2827
|
-
|
|
2765
|
+
collisionGroup
|
|
2828
2766
|
} = layer.props;
|
|
2829
2767
|
const {
|
|
2830
|
-
|
|
2831
|
-
|
|
2768
|
+
collisionFBOs,
|
|
2769
|
+
dummyCollisionMap
|
|
2832
2770
|
} = this;
|
|
2833
2771
|
return {
|
|
2834
|
-
|
|
2835
|
-
|
|
2772
|
+
collisionFBO: collisionFBOs[collisionGroup],
|
|
2773
|
+
dummyCollisionMap
|
|
2836
2774
|
};
|
|
2837
2775
|
}
|
|
2838
2776
|
cleanup() {
|
|
2839
|
-
if (this.
|
|
2840
|
-
this.
|
|
2841
|
-
this.
|
|
2777
|
+
if (this.dummyCollisionMap) {
|
|
2778
|
+
this.dummyCollisionMap.delete();
|
|
2779
|
+
this.dummyCollisionMap = void 0;
|
|
2842
2780
|
}
|
|
2843
2781
|
this.channels = {};
|
|
2844
|
-
for (const
|
|
2845
|
-
this.destroyFBO(
|
|
2782
|
+
for (const collisionGroup of Object.keys(this.collisionFBOs)) {
|
|
2783
|
+
this.destroyFBO(collisionGroup);
|
|
2846
2784
|
}
|
|
2847
|
-
this.
|
|
2785
|
+
this.collisionFBOs = {};
|
|
2848
2786
|
this.lastViewport = void 0;
|
|
2849
2787
|
}
|
|
2850
|
-
createFBO(gl,
|
|
2788
|
+
createFBO(gl, collisionGroup) {
|
|
2851
2789
|
const {
|
|
2852
2790
|
width,
|
|
2853
2791
|
height
|
|
2854
2792
|
} = gl.canvas;
|
|
2855
|
-
const
|
|
2793
|
+
const collisionMap = new import_core23.Texture2D(gl, {
|
|
2856
2794
|
width,
|
|
2857
2795
|
height,
|
|
2858
2796
|
parameters: {
|
|
@@ -2867,40 +2805,40 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2867
2805
|
width,
|
|
2868
2806
|
height
|
|
2869
2807
|
});
|
|
2870
|
-
this.
|
|
2871
|
-
id: `
|
|
2808
|
+
this.collisionFBOs[collisionGroup] = new import_core23.Framebuffer(gl, {
|
|
2809
|
+
id: `Collision-${collisionGroup}`,
|
|
2872
2810
|
width,
|
|
2873
2811
|
height,
|
|
2874
2812
|
attachments: {
|
|
2875
|
-
[gl.COLOR_ATTACHMENT0]:
|
|
2813
|
+
[gl.COLOR_ATTACHMENT0]: collisionMap,
|
|
2876
2814
|
[gl.DEPTH_ATTACHMENT]: depthBuffer
|
|
2877
2815
|
}
|
|
2878
2816
|
});
|
|
2879
2817
|
}
|
|
2880
|
-
destroyFBO(
|
|
2881
|
-
const fbo = this.
|
|
2818
|
+
destroyFBO(collisionGroup) {
|
|
2819
|
+
const fbo = this.collisionFBOs[collisionGroup];
|
|
2882
2820
|
for (const attachment of Object.values(fbo.attachments)) {
|
|
2883
2821
|
attachment.delete();
|
|
2884
2822
|
}
|
|
2885
2823
|
fbo.delete();
|
|
2886
|
-
delete this.
|
|
2824
|
+
delete this.collisionFBOs[collisionGroup];
|
|
2887
2825
|
}
|
|
2888
2826
|
};
|
|
2889
2827
|
|
|
2890
|
-
// src/
|
|
2828
|
+
// src/collision-filter/collision-filter.ts
|
|
2891
2829
|
var defaultProps6 = {
|
|
2892
|
-
|
|
2830
|
+
getCollisionPriority: {
|
|
2893
2831
|
type: "accessor",
|
|
2894
2832
|
value: 0
|
|
2895
2833
|
},
|
|
2896
|
-
|
|
2897
|
-
|
|
2834
|
+
collisionEnabled: true,
|
|
2835
|
+
collisionGroup: {
|
|
2898
2836
|
type: "string",
|
|
2899
2837
|
value: "default"
|
|
2900
2838
|
},
|
|
2901
|
-
|
|
2839
|
+
collisionTestProps: {}
|
|
2902
2840
|
};
|
|
2903
|
-
var
|
|
2841
|
+
var CollisionFilterExtension = class extends import_core26.LayerExtension {
|
|
2904
2842
|
getShaders() {
|
|
2905
2843
|
return {
|
|
2906
2844
|
modules: [shader_module_default2]
|
|
@@ -2912,33 +2850,33 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2912
2850
|
moduleParameters
|
|
2913
2851
|
}) {
|
|
2914
2852
|
const {
|
|
2915
|
-
|
|
2853
|
+
collisionEnabled
|
|
2916
2854
|
} = this.props;
|
|
2917
2855
|
const {
|
|
2918
|
-
|
|
2919
|
-
|
|
2856
|
+
collisionFBO,
|
|
2857
|
+
drawToCollisionMap
|
|
2920
2858
|
} = moduleParameters;
|
|
2921
|
-
const enabled =
|
|
2922
|
-
uniforms.
|
|
2923
|
-
if (
|
|
2924
|
-
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;
|
|
2925
2863
|
}
|
|
2926
2864
|
}
|
|
2927
2865
|
initializeState(context, extension) {
|
|
2928
2866
|
if (this.getAttributeManager() === null) {
|
|
2929
2867
|
return;
|
|
2930
2868
|
}
|
|
2931
|
-
this.context.deck?._addDefaultEffect(new
|
|
2869
|
+
this.context.deck?._addDefaultEffect(new CollisionFilterEffect());
|
|
2932
2870
|
const attributeManager = this.getAttributeManager();
|
|
2933
2871
|
attributeManager.add({
|
|
2934
|
-
|
|
2872
|
+
collisionPriorities: {
|
|
2935
2873
|
size: 1,
|
|
2936
|
-
accessor: "
|
|
2874
|
+
accessor: "getCollisionPriority",
|
|
2937
2875
|
shaderAttributes: {
|
|
2938
|
-
|
|
2876
|
+
collisionPriorities: {
|
|
2939
2877
|
divisor: 0
|
|
2940
2878
|
},
|
|
2941
|
-
|
|
2879
|
+
instanceCollisionPriorities: {
|
|
2942
2880
|
divisor: 1
|
|
2943
2881
|
}
|
|
2944
2882
|
}
|
|
@@ -2946,11 +2884,11 @@ float collide_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
|
2946
2884
|
});
|
|
2947
2885
|
}
|
|
2948
2886
|
getNeedsPickingBuffer() {
|
|
2949
|
-
return this.props.
|
|
2887
|
+
return this.props.collisionEnabled;
|
|
2950
2888
|
}
|
|
2951
2889
|
};
|
|
2952
|
-
__publicField(
|
|
2953
|
-
__publicField(
|
|
2890
|
+
__publicField(CollisionFilterExtension, "defaultProps", defaultProps6);
|
|
2891
|
+
__publicField(CollisionFilterExtension, "extensionName", "CollisionFilterExtension");
|
|
2954
2892
|
|
|
2955
2893
|
// src/mask/mask.ts
|
|
2956
2894
|
var import_core28 = __toESM(require_core());
|
|
@@ -3108,11 +3046,11 @@ varying vec2 mask_texCoords;
|
|
|
3108
3046
|
__publicField(MaskExtension, "extensionName", "MaskExtension");
|
|
3109
3047
|
|
|
3110
3048
|
// src/terrain/terrain.ts
|
|
3111
|
-
var
|
|
3049
|
+
var import_core38 = __toESM(require_core());
|
|
3112
3050
|
|
|
3113
3051
|
// src/terrain/terrain-effect.ts
|
|
3114
|
-
var
|
|
3115
|
-
var
|
|
3052
|
+
var import_core36 = __toESM(require_core2());
|
|
3053
|
+
var import_core37 = __toESM(require_core());
|
|
3116
3054
|
|
|
3117
3055
|
// src/terrain/shader-module.ts
|
|
3118
3056
|
var import_core29 = __toESM(require_core());
|
|
@@ -3257,122 +3195,6 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3257
3195
|
});
|
|
3258
3196
|
}
|
|
3259
3197
|
|
|
3260
|
-
// src/common/projection-utils.ts
|
|
3261
|
-
var import_core31 = __toESM(require_core());
|
|
3262
|
-
function joinLayerBounds(layers, viewport) {
|
|
3263
|
-
const bounds = [Infinity, Infinity, -Infinity, -Infinity];
|
|
3264
|
-
for (const layer of layers) {
|
|
3265
|
-
const layerBounds = layer.getBounds();
|
|
3266
|
-
if (layerBounds) {
|
|
3267
|
-
const bottomLeftCommon = layer.projectPosition(layerBounds[0], {
|
|
3268
|
-
viewport,
|
|
3269
|
-
autoOffset: false
|
|
3270
|
-
});
|
|
3271
|
-
const topRightCommon = layer.projectPosition(layerBounds[1], {
|
|
3272
|
-
viewport,
|
|
3273
|
-
autoOffset: false
|
|
3274
|
-
});
|
|
3275
|
-
bounds[0] = Math.min(bounds[0], bottomLeftCommon[0]);
|
|
3276
|
-
bounds[1] = Math.min(bounds[1], bottomLeftCommon[1]);
|
|
3277
|
-
bounds[2] = Math.max(bounds[2], topRightCommon[0]);
|
|
3278
|
-
bounds[3] = Math.max(bounds[3], topRightCommon[1]);
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
|
-
if (Number.isFinite(bounds[0])) {
|
|
3282
|
-
return bounds;
|
|
3283
|
-
}
|
|
3284
|
-
return null;
|
|
3285
|
-
}
|
|
3286
|
-
var MAX_VIEWPORT_SIZE = 2048;
|
|
3287
|
-
function makeViewport(opts) {
|
|
3288
|
-
const {
|
|
3289
|
-
bounds,
|
|
3290
|
-
viewport,
|
|
3291
|
-
border = 0
|
|
3292
|
-
} = opts;
|
|
3293
|
-
const {
|
|
3294
|
-
isGeospatial
|
|
3295
|
-
} = viewport;
|
|
3296
|
-
if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) {
|
|
3297
|
-
return null;
|
|
3298
|
-
}
|
|
3299
|
-
const centerWorld = viewport.unprojectPosition([(bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2, 0]);
|
|
3300
|
-
const maxSize = MAX_VIEWPORT_SIZE - border * 2;
|
|
3301
|
-
let {
|
|
3302
|
-
width,
|
|
3303
|
-
height,
|
|
3304
|
-
zoom
|
|
3305
|
-
} = opts;
|
|
3306
|
-
if (zoom === void 0) {
|
|
3307
|
-
const scale = Math.min(width / (bounds[2] - bounds[0]), height / (bounds[3] - bounds[1]));
|
|
3308
|
-
zoom = Math.min(Math.log2(scale), 20);
|
|
3309
|
-
} else if (!width || !height) {
|
|
3310
|
-
const scale = 2 ** zoom;
|
|
3311
|
-
width = Math.round(Math.abs(bounds[2] - bounds[0]) * scale);
|
|
3312
|
-
height = Math.round(Math.abs(bounds[3] - bounds[1]) * scale);
|
|
3313
|
-
if (width > maxSize || height > maxSize) {
|
|
3314
|
-
const r = maxSize / Math.max(width, height);
|
|
3315
|
-
width = Math.round(width * r);
|
|
3316
|
-
height = Math.round(height * r);
|
|
3317
|
-
zoom += Math.log2(r);
|
|
3318
|
-
}
|
|
3319
|
-
}
|
|
3320
|
-
return isGeospatial ? new import_core31.WebMercatorViewport({
|
|
3321
|
-
x: border,
|
|
3322
|
-
y: border,
|
|
3323
|
-
width,
|
|
3324
|
-
height,
|
|
3325
|
-
longitude: centerWorld[0],
|
|
3326
|
-
latitude: centerWorld[1],
|
|
3327
|
-
zoom,
|
|
3328
|
-
orthographic: true
|
|
3329
|
-
}) : new import_core31.OrthographicViewport({
|
|
3330
|
-
x: border,
|
|
3331
|
-
y: border,
|
|
3332
|
-
width,
|
|
3333
|
-
height,
|
|
3334
|
-
target: centerWorld,
|
|
3335
|
-
zoom,
|
|
3336
|
-
flipY: false
|
|
3337
|
-
});
|
|
3338
|
-
}
|
|
3339
|
-
function getViewportBounds(viewport, zRange) {
|
|
3340
|
-
let viewportBoundsWorld;
|
|
3341
|
-
if (zRange && zRange.length === 2) {
|
|
3342
|
-
const [minZ, maxZ] = zRange;
|
|
3343
|
-
const bounds0 = viewport.getBounds({
|
|
3344
|
-
z: minZ
|
|
3345
|
-
});
|
|
3346
|
-
const bounds1 = viewport.getBounds({
|
|
3347
|
-
z: maxZ
|
|
3348
|
-
});
|
|
3349
|
-
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])];
|
|
3350
|
-
} else {
|
|
3351
|
-
viewportBoundsWorld = viewport.getBounds();
|
|
3352
|
-
}
|
|
3353
|
-
const viewportBottomLeftCommon = viewport.projectPosition(viewportBoundsWorld.slice(0, 2));
|
|
3354
|
-
const viewportTopRightCommon = viewport.projectPosition(viewportBoundsWorld.slice(2, 4));
|
|
3355
|
-
return [viewportBottomLeftCommon[0], viewportBottomLeftCommon[1], viewportTopRightCommon[0], viewportTopRightCommon[1]];
|
|
3356
|
-
}
|
|
3357
|
-
function getRenderBounds(layerBounds, viewport, zRange) {
|
|
3358
|
-
if (!layerBounds) {
|
|
3359
|
-
return [0, 0, 1, 1];
|
|
3360
|
-
}
|
|
3361
|
-
const viewportBounds = getViewportBounds(viewport, zRange);
|
|
3362
|
-
const paddedBounds = doubleBounds(viewportBounds);
|
|
3363
|
-
if (layerBounds[2] - layerBounds[0] <= paddedBounds[2] - paddedBounds[0] && layerBounds[3] - layerBounds[1] <= paddedBounds[3] - paddedBounds[1]) {
|
|
3364
|
-
return layerBounds;
|
|
3365
|
-
}
|
|
3366
|
-
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])];
|
|
3367
|
-
}
|
|
3368
|
-
function doubleBounds(bounds) {
|
|
3369
|
-
const dx = bounds[2] - bounds[0];
|
|
3370
|
-
const dy = bounds[3] - bounds[1];
|
|
3371
|
-
const centerX = (bounds[0] + bounds[2]) / 2;
|
|
3372
|
-
const centerY = (bounds[1] + bounds[3]) / 2;
|
|
3373
|
-
return [centerX - dx, centerY - dy, centerX + dx, centerY + dy];
|
|
3374
|
-
}
|
|
3375
|
-
|
|
3376
3198
|
// src/terrain/terrain-cover.ts
|
|
3377
3199
|
var TerrainCover = class {
|
|
3378
3200
|
isDirty = true;
|
|
@@ -3536,9 +3358,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3536
3358
|
}
|
|
3537
3359
|
|
|
3538
3360
|
// src/terrain/terrain-pass.ts
|
|
3539
|
-
var
|
|
3540
|
-
var
|
|
3541
|
-
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 {
|
|
3542
3364
|
getRenderableLayers(viewport, opts) {
|
|
3543
3365
|
const {
|
|
3544
3366
|
layers
|
|
@@ -3560,7 +3382,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3560
3382
|
return;
|
|
3561
3383
|
}
|
|
3562
3384
|
target.resize(viewport);
|
|
3563
|
-
(0,
|
|
3385
|
+
(0, import_core31.withParameters)(this.gl, {
|
|
3564
3386
|
clearColor: [0, 0, 0, 0],
|
|
3565
3387
|
blend: true,
|
|
3566
3388
|
blendFunc: [esm_default.ONE, esm_default.ONE],
|
|
@@ -3583,7 +3405,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3583
3405
|
}
|
|
3584
3406
|
const layers = terrainCover.filterLayers(opts.layers);
|
|
3585
3407
|
target.resize(viewport);
|
|
3586
|
-
(0,
|
|
3408
|
+
(0, import_core31.withParameters)(this.gl, {
|
|
3587
3409
|
depthTest: false
|
|
3588
3410
|
}, () => this.render({
|
|
3589
3411
|
...opts,
|
|
@@ -3597,9 +3419,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3597
3419
|
};
|
|
3598
3420
|
|
|
3599
3421
|
// src/terrain/terrain-picking-pass.ts
|
|
3600
|
-
var
|
|
3601
|
-
var
|
|
3602
|
-
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 {
|
|
3603
3425
|
drawParameters = {};
|
|
3604
3426
|
getRenderableLayers(viewport, opts) {
|
|
3605
3427
|
const {
|
|
@@ -3630,7 +3452,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3630
3452
|
layers.unshift(terrainLayer);
|
|
3631
3453
|
}
|
|
3632
3454
|
target.resize(viewport);
|
|
3633
|
-
(0,
|
|
3455
|
+
(0, import_core34.withParameters)(this.gl, {
|
|
3634
3456
|
depthTest: false
|
|
3635
3457
|
}, () => this.render({
|
|
3636
3458
|
...opts,
|
|
@@ -3655,7 +3477,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3655
3477
|
};
|
|
3656
3478
|
|
|
3657
3479
|
// src/terrain/height-map-builder.ts
|
|
3658
|
-
var
|
|
3480
|
+
var import_core35 = __toESM(require_core2());
|
|
3659
3481
|
var MAP_MAX_SIZE = 2048;
|
|
3660
3482
|
var HeightMapBuilder = class {
|
|
3661
3483
|
renderViewport = null;
|
|
@@ -3665,7 +3487,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3665
3487
|
layersBoundsCommon = null;
|
|
3666
3488
|
lastViewport = null;
|
|
3667
3489
|
static isSupported(gl) {
|
|
3668
|
-
return
|
|
3490
|
+
return import_core35.Framebuffer.isSupported(gl, {
|
|
3669
3491
|
colorBufferFloat: true
|
|
3670
3492
|
});
|
|
3671
3493
|
}
|
|
@@ -3732,7 +3554,7 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3732
3554
|
isDrapingEnabled = false;
|
|
3733
3555
|
terrainCovers = /* @__PURE__ */ new Map();
|
|
3734
3556
|
initialize(gl) {
|
|
3735
|
-
this.dummyHeightMap = new
|
|
3557
|
+
this.dummyHeightMap = new import_core36.Texture2D(gl, {
|
|
3736
3558
|
width: 1,
|
|
3737
3559
|
height: 1,
|
|
3738
3560
|
data: new Uint8Array([0, 0, 0, 0])
|
|
@@ -3746,9 +3568,9 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3746
3568
|
if (HeightMapBuilder.isSupported(gl)) {
|
|
3747
3569
|
this.heightMap = new HeightMapBuilder(gl);
|
|
3748
3570
|
} else {
|
|
3749
|
-
|
|
3571
|
+
import_core37.log.warn("Terrain offset mode is not supported by this browser")();
|
|
3750
3572
|
}
|
|
3751
|
-
|
|
3573
|
+
import_core36.ProgramManager.getDefaultProgramManager(gl).addDefaultModule(terrainModule);
|
|
3752
3574
|
}
|
|
3753
3575
|
preRender(gl, opts) {
|
|
3754
3576
|
if (!this.dummyHeightMap) {
|
|
@@ -3767,9 +3589,8 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
3767
3589
|
}
|
|
3768
3590
|
const {
|
|
3769
3591
|
viewports,
|
|
3770
|
-
|
|
3592
|
+
isPicking = false
|
|
3771
3593
|
} = opts;
|
|
3772
|
-
const isPicking = pass.startsWith("picking");
|
|
3773
3594
|
this.isPicking = isPicking;
|
|
3774
3595
|
this.isDrapingEnabled = true;
|
|
3775
3596
|
const viewport = viewports[0];
|
|
@@ -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
|
}
|