bruce-cesium 7.9.0 → 7.9.2
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/bruce-cesium.es5.js +772 -86
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +770 -83
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/internal/cesium-patch-pick-splat.js +127 -0
- package/dist/lib/internal/cesium-patch-pick-splat.js.map +1 -0
- package/dist/lib/internal/cesium-patch-pick-through-ground.js +155 -0
- package/dist/lib/internal/cesium-patch-pick-through-ground.js.map +1 -0
- package/dist/lib/internal/cesium-patch-splat-order.js +73 -0
- package/dist/lib/internal/cesium-patch-splat-order.js.map +1 -0
- package/dist/lib/rendering/render-managers/common/entity-label.js +4 -4
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +60 -2
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/rendering/xgrids-render-engine.js +3 -0
- package/dist/lib/rendering/xgrids-render-engine.js.map +1 -1
- package/dist/lib/utils/drawing-utils.js +241 -75
- package/dist/lib/utils/drawing-utils.js.map +1 -1
- package/dist/lib/viewer/camera-controls.js +134 -1
- package/dist/lib/viewer/camera-controls.js.map +1 -1
- package/dist/lib/viewer/viewer-utils.js +6 -0
- package/dist/lib/viewer/viewer-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/internal/cesium-patch-pick-splat.d.ts +8 -0
- package/dist/types/internal/cesium-patch-pick-through-ground.d.ts +7 -0
- package/dist/types/internal/cesium-patch-splat-order.d.ts +2 -0
- package/dist/types/rendering/visuals-register.d.ts +3 -0
- package/dist/types/utils/drawing-utils.d.ts +7 -1
- package/dist/types/viewer/camera-controls.d.ts +4 -0
- package/package.json +1 -1
package/dist/lib/bruce-cesium.js
CHANGED
|
@@ -97,7 +97,7 @@ __exportStar(require("./widgets/widget-info-view"), exports);
|
|
|
97
97
|
__exportStar(require("./widgets/widget-left-panel"), exports);
|
|
98
98
|
__exportStar(require("./widgets/widget-nav-compass"), exports);
|
|
99
99
|
__exportStar(require("./widgets/widget-view-bar"), exports);
|
|
100
|
-
exports.VERSION = "7.9.
|
|
100
|
+
exports.VERSION = "7.9.2";
|
|
101
101
|
/**
|
|
102
102
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
103
103
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Makes XGrids splats pick only where they are visibly drawn, not across their faint halos.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IsSplatRaycastPrecise = exports.IsSplatPickVisible = exports.HasSplats = exports.TrackSplats = exports.InstallPickSplatPatch = exports.IsSplatPick = exports.FixSplatPick = exports.SPLAT_PICK_MIN_ALPHA = void 0;
|
|
7
|
+
const PICK_SPLAT_PATCH_KEY = "_nextspacePickSplatPatch";
|
|
8
|
+
// The XGrids SDK compiles its splat shaders with this define.
|
|
9
|
+
const SPLAT_DEFINE = "LccShader";
|
|
10
|
+
// CesiumJS's derived pick shader keeps every fragment with any alpha at all.
|
|
11
|
+
const ANY_ALPHA = /(out_FragColor|out_FragData_0|gl_FragColor)\.a == 0\.0/;
|
|
12
|
+
/*
|
|
13
|
+
* The least opacity a splat fragment needs to be picked; tuned against the SDK's own raycast on real scans.
|
|
14
|
+
*/
|
|
15
|
+
exports.SPLAT_PICK_MIN_ALPHA = 0.25;
|
|
16
|
+
/*
|
|
17
|
+
* Raises the alpha a derived splat "pick" shader needs before it keeps a fragment, returning whether it did.
|
|
18
|
+
*/
|
|
19
|
+
function FixSplatPick(keyword, options) {
|
|
20
|
+
const fragment = options === null || options === void 0 ? void 0 : options.fragmentShaderSource;
|
|
21
|
+
const defines = fragment === null || fragment === void 0 ? void 0 : fragment.defines;
|
|
22
|
+
const sources = fragment === null || fragment === void 0 ? void 0 : fragment.sources;
|
|
23
|
+
if (keyword !== "pick" ||
|
|
24
|
+
!Array.isArray(defines) ||
|
|
25
|
+
!Array.isArray(sources) ||
|
|
26
|
+
!defines.includes(SPLAT_DEFINE) ||
|
|
27
|
+
!sources.some(x => typeof x === "string" && ANY_ALPHA.test(x))) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
fragment.sources = sources.map(x => typeof x === "string" ? x.replace(ANY_ALPHA, `$1.a < ${exports.SPLAT_PICK_MIN_ALPHA.toFixed(3)}`) : x);
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
exports.FixSplatPick = FixSplatPick;
|
|
34
|
+
/*
|
|
35
|
+
* Whether a pick result is an XGrids splat mesh rather than a Cesium primitive or Entity.
|
|
36
|
+
*/
|
|
37
|
+
function IsSplatPick(picked) {
|
|
38
|
+
var _a;
|
|
39
|
+
return Boolean(picked &&
|
|
40
|
+
typeof picked.id === "string" &&
|
|
41
|
+
typeof ((_a = picked.primitive) === null || _a === void 0 ? void 0 : _a.splatCount) === "number");
|
|
42
|
+
}
|
|
43
|
+
exports.IsSplatPick = IsSplatPick;
|
|
44
|
+
/*
|
|
45
|
+
* Patches a viewer's shader cache so splat pick shaders drop their near-transparent fragments.
|
|
46
|
+
*/
|
|
47
|
+
function InstallPickSplatPatch(viewer) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const cache = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.scene) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.shaderCache;
|
|
50
|
+
if (!cache || typeof cache.createDerivedShaderProgram !== "function") {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (cache[PICK_SPLAT_PATCH_KEY]) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const original = cache.createDerivedShaderProgram;
|
|
57
|
+
cache.createDerivedShaderProgram = function (shaderProgram, keyword, options) {
|
|
58
|
+
try {
|
|
59
|
+
FixSplatPick(keyword, options);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
console.error("Failed to fix a splat pick shader.", e);
|
|
63
|
+
}
|
|
64
|
+
return original.call(this, shaderProgram, keyword, options);
|
|
65
|
+
};
|
|
66
|
+
cache[PICK_SPLAT_PATCH_KEY] = true;
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
exports.InstallPickSplatPatch = InstallPickSplatPatch;
|
|
70
|
+
// The XGrids render objects drawn on a viewer, so picking only looks for splats when there are some.
|
|
71
|
+
const SPLATS_KEY = "_nextspaceSplats";
|
|
72
|
+
/*
|
|
73
|
+
* Records that a splat render object is drawn on, or removed from, a viewer.
|
|
74
|
+
*/
|
|
75
|
+
function TrackSplats(viewer, renderObject, drawn) {
|
|
76
|
+
var _a;
|
|
77
|
+
if (!viewer || !renderObject) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const set = (_a = viewer[SPLATS_KEY]) !== null && _a !== void 0 ? _a : (viewer[SPLATS_KEY] = new Set());
|
|
81
|
+
if (drawn) {
|
|
82
|
+
set.add(renderObject);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
set.delete(renderObject);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.TrackSplats = TrackSplats;
|
|
89
|
+
/*
|
|
90
|
+
* Whether any XGrids splats are drawn on a viewer.
|
|
91
|
+
*/
|
|
92
|
+
function HasSplats(viewer) {
|
|
93
|
+
var _a;
|
|
94
|
+
return Boolean((_a = viewer === null || viewer === void 0 ? void 0 : viewer[SPLATS_KEY]) === null || _a === void 0 ? void 0 : _a.size);
|
|
95
|
+
}
|
|
96
|
+
exports.HasSplats = HasSplats;
|
|
97
|
+
/*
|
|
98
|
+
* Whether pick results for splats follow what is visibly drawn, so a splat can be trusted to hide what is behind it.
|
|
99
|
+
*/
|
|
100
|
+
function IsSplatPickVisible(viewer) {
|
|
101
|
+
var _a, _b, _c;
|
|
102
|
+
return Boolean((_c = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.scene) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.shaderCache) === null || _c === void 0 ? void 0 : _c[PICK_SPLAT_PATCH_KEY]);
|
|
103
|
+
}
|
|
104
|
+
exports.IsSplatPickVisible = IsSplatPickVisible;
|
|
105
|
+
/*
|
|
106
|
+
* Whether the SDK raycasts splats as opacity-weighted ellipsoids (usePrecisionRaycast) rather than points.
|
|
107
|
+
*/
|
|
108
|
+
function IsSplatRaycastPrecise(viewer) {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
const set = viewer === null || viewer === void 0 ? void 0 : viewer[SPLATS_KEY];
|
|
111
|
+
if (!(set === null || set === void 0 ? void 0 : set.size)) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
for (const object of Array.from(set)) {
|
|
115
|
+
try {
|
|
116
|
+
if ((_b = (_a = object === null || object === void 0 ? void 0 : object.getCurrentConfig) === null || _a === void 0 ? void 0 : _a.call(object)) === null || _b === void 0 ? void 0 : _b.usePrecisionRaycast) {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
// A disposed scan has no config; the others still answer.
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
exports.IsSplatRaycastPrecise = IsSplatRaycastPrecise;
|
|
127
|
+
//# sourceMappingURL=cesium-patch-pick-splat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cesium-patch-pick-splat.js","sourceRoot":"","sources":["../../../src/internal/cesium-patch-pick-splat.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,8DAA8D;AAC9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ACP,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;KACzB;SACI;QACD,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;KAC5B;AACL,CAAC;AAXD,kCAWC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,MAAW;;IACjC,OAAO,OAAO,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,UAAU,CAAC,0CAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAFD,8BAEC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,MAAW;;IAC1C,OAAO,OAAO,CAAC,MAAA,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,OAAO,0CAAE,WAAW,0CAAG,oBAAoB,CAAC,CAAC,CAAC;AAChF,CAAC;AAFD,gDAEC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,MAAW;;IAC7C,MAAM,GAAG,GAAa,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,UAAU,CAAC,CAAC;IAC3C,IAAI,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;IACD,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,IAAI;YACA,IAAI,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,sDAAI,0CAAE,mBAAmB,EAAE;gBACnD,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,CAAC,EAAE;YACN,0DAA0D;SAC7D;KACJ;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAhBD,sDAgBC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallPickThroughGroundPatch = exports.GetPickDepthKind = exports.GetPlaneEye = exports.GetDepthPlaneWorld = exports.PICK_THROUGH_GROUND_FS = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Makes pickPosition return an opaque primitive drawn through the ground, not the ground above it, with occlusion off.
|
|
6
|
+
*/
|
|
7
|
+
const Cesium = require("cesium");
|
|
8
|
+
const PICK_THROUGH_GROUND_PATCH_KEY = "_nextspacePickThroughGroundPatch";
|
|
9
|
+
// What the patch saw of the pick depth copy, read by GetPickDepthKind.
|
|
10
|
+
const PICK_DEPTH_KIND_KEY = "_nextspacePickDepthKind";
|
|
11
|
+
// From CesiumJS 1.118 the pick depth copy merges the globe's depth in; only that shader names this variable.
|
|
12
|
+
const MERGE_MARK = "globeDepthPacked";
|
|
13
|
+
// Before 1.118 the copy is a plain repack of the scene depth.
|
|
14
|
+
const LEGACY_MARK = "czm_packDepth(texture";
|
|
15
|
+
/*
|
|
16
|
+
* The merge CesiumJS uses, except that a scene depth farther than the globe is kept unless it is the depth plane.
|
|
17
|
+
*/
|
|
18
|
+
exports.PICK_THROUGH_GROUND_FS = `uniform highp sampler2D colorTexture;
|
|
19
|
+
uniform vec4 u_nextspaceDepthPlane;
|
|
20
|
+
uniform vec2 u_nextspaceFlags;
|
|
21
|
+
in vec2 v_textureCoordinates;
|
|
22
|
+
vec3 nextspaceEye(float depth)
|
|
23
|
+
{
|
|
24
|
+
vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;
|
|
25
|
+
if (u_nextspaceFlags.y > 0.5) {
|
|
26
|
+
float fromCamera = pow(2.0, depth * czm_log2FarDepthFromNearPlusOne) - 1.0 + czm_currentFrustum.x;
|
|
27
|
+
vec4 q = czm_inverseProjection * vec4(2.0 * uv - 1.0, 0.0, 1.0);
|
|
28
|
+
vec3 d = q.xyz / q.w;
|
|
29
|
+
return d * (fromCamera / -d.z);
|
|
30
|
+
}
|
|
31
|
+
vec4 e = czm_windowToEyeCoordinates(vec4(gl_FragCoord.xy, depth, 1.0));
|
|
32
|
+
return e.xyz / e.w;
|
|
33
|
+
}
|
|
34
|
+
void main()
|
|
35
|
+
{
|
|
36
|
+
vec4 globeDepthPacked = texture(czm_globeDepthTexture, v_textureCoordinates);
|
|
37
|
+
float globeDepth = czm_unpackDepth(globeDepthPacked);
|
|
38
|
+
float depth = texture(colorTexture, v_textureCoordinates).r;
|
|
39
|
+
bool sceneDepth = depth > 0.0 && depth < 1.0;
|
|
40
|
+
bool keepScene = globeDepth <= 0.0 || globeDepth >= 1.0 || depth < globeDepth && sceneDepth;
|
|
41
|
+
if (!keepScene && sceneDepth && u_nextspaceFlags.x > 0.5) {
|
|
42
|
+
vec3 p = nextspaceEye(depth);
|
|
43
|
+
keepScene = abs(dot(u_nextspaceDepthPlane.xyz, p) + u_nextspaceDepthPlane.w) > max(0.5, 0.002 * length(p));
|
|
44
|
+
}
|
|
45
|
+
out_FragColor = keepScene ? czm_packDepth(depth) : globeDepthPacked;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
/*
|
|
49
|
+
* The depth plane CesiumJS draws once the globe's depth is cleared, as a unit-normal plane in world coordinates.
|
|
50
|
+
*/
|
|
51
|
+
function GetDepthPlaneWorld(cameraPosition, radii, offset, result) {
|
|
52
|
+
// Mirrors DepthPlane's computeDepthQuad: the plane through the limb, in the ellipsoid's scaled space.
|
|
53
|
+
const rx = radii.x + offset;
|
|
54
|
+
const ry = radii.y + offset;
|
|
55
|
+
const rz = radii.z + offset;
|
|
56
|
+
const qx = cameraPosition.x / rx;
|
|
57
|
+
const qy = cameraPosition.y / ry;
|
|
58
|
+
const qz = cameraPosition.z / rz;
|
|
59
|
+
const qm = Math.sqrt(qx * qx + qy * qy + qz * qz);
|
|
60
|
+
const nx = qx / qm / rx;
|
|
61
|
+
const ny = qy / qm / ry;
|
|
62
|
+
const nz = qz / qm / rz;
|
|
63
|
+
const nm = Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
64
|
+
return Cesium.Cartesian4.fromElements(nx / nm, ny / nm, nz / nm, -(1 / qm) / nm, result);
|
|
65
|
+
}
|
|
66
|
+
exports.GetDepthPlaneWorld = GetDepthPlaneWorld;
|
|
67
|
+
/*
|
|
68
|
+
* Moves a world plane into eye coordinates, keeping its normal unit length so distances stay in metres.
|
|
69
|
+
*/
|
|
70
|
+
function GetPlaneEye(planeWorld, inverseView, result) {
|
|
71
|
+
const transposed = Cesium.Matrix4.transpose(inverseView, new Cesium.Matrix4());
|
|
72
|
+
Cesium.Matrix4.multiplyByVector(transposed, planeWorld, result);
|
|
73
|
+
const m = Math.sqrt(result.x * result.x + result.y * result.y + result.z * result.z);
|
|
74
|
+
return Cesium.Cartesian4.divideByScalar(result, m, result);
|
|
75
|
+
}
|
|
76
|
+
exports.GetPlaneEye = GetPlaneEye;
|
|
77
|
+
/*
|
|
78
|
+
* What the viewer's pick depth holds, as far as the patch has seen.
|
|
79
|
+
*/
|
|
80
|
+
function GetPickDepthKind(viewer) {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
return (_c = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.scene) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b[PICK_DEPTH_KIND_KEY]) !== null && _c !== void 0 ? _c : "unknown";
|
|
83
|
+
}
|
|
84
|
+
exports.GetPickDepthKind = GetPickDepthKind;
|
|
85
|
+
/*
|
|
86
|
+
* Patches the viewer's pick depth copy so a primitive seen through the ground picks itself.
|
|
87
|
+
*/
|
|
88
|
+
function InstallPickThroughGroundPatch(viewer) {
|
|
89
|
+
var _a, _b, _c;
|
|
90
|
+
const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
|
|
91
|
+
const context = scene === null || scene === void 0 ? void 0 : scene.context;
|
|
92
|
+
if (!context || typeof context.createViewportQuadCommand !== "function") {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (context[PICK_THROUGH_GROUND_PATCH_KEY]) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
const plane = new Cesium.Cartesian4();
|
|
99
|
+
const planeWorld = new Cesium.Cartesian4();
|
|
100
|
+
const flags = new Cesium.Cartesian2();
|
|
101
|
+
const updatePlane = () => {
|
|
102
|
+
var _a, _b, _c, _d;
|
|
103
|
+
const env = scene._environmentState;
|
|
104
|
+
const camera = scene.camera;
|
|
105
|
+
const on = Boolean((env === null || env === void 0 ? void 0 : env.clearGlobeDepth) &&
|
|
106
|
+
(env === null || env === void 0 ? void 0 : env.useDepthPlane) &&
|
|
107
|
+
((_a = camera === null || camera === void 0 ? void 0 : camera.frustum) === null || _a === void 0 ? void 0 : _a.fov) != null &&
|
|
108
|
+
scene.mode === Cesium.SceneMode.SCENE3D &&
|
|
109
|
+
scene.globe);
|
|
110
|
+
flags.x = on ? 1 : 0;
|
|
111
|
+
flags.y = ((_b = scene.frameState) === null || _b === void 0 ? void 0 : _b.useLogDepth) ? 1 : 0;
|
|
112
|
+
if (on) {
|
|
113
|
+
const offset = (_d = (_c = scene._depthPlane) === null || _c === void 0 ? void 0 : _c._ellipsoidOffset) !== null && _d !== void 0 ? _d : 0;
|
|
114
|
+
GetDepthPlaneWorld(camera.positionWC, scene.globe.ellipsoid.radii, offset, planeWorld);
|
|
115
|
+
GetPlaneEye(planeWorld, camera.inverseViewMatrix, plane);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const original = context.createViewportQuadCommand;
|
|
119
|
+
context.createViewportQuadCommand = function (fragmentShaderSource, overrides) {
|
|
120
|
+
try {
|
|
121
|
+
if (typeof fragmentShaderSource === "string" && (overrides === null || overrides === void 0 ? void 0 : overrides.uniformMap)) {
|
|
122
|
+
if (fragmentShaderSource.includes(MERGE_MARK) && overrides.uniformMap.colorTexture) {
|
|
123
|
+
context[PICK_DEPTH_KIND_KEY] = "merged";
|
|
124
|
+
overrides.uniformMap.u_nextspaceDepthPlane = () => {
|
|
125
|
+
updatePlane();
|
|
126
|
+
return plane;
|
|
127
|
+
};
|
|
128
|
+
overrides.uniformMap.u_nextspaceFlags = () => flags;
|
|
129
|
+
fragmentShaderSource = exports.PICK_THROUGH_GROUND_FS;
|
|
130
|
+
context[PICK_DEPTH_KIND_KEY] = "through-ground";
|
|
131
|
+
}
|
|
132
|
+
else if (fragmentShaderSource.includes(LEGACY_MARK) && overrides.uniformMap.u_texture) {
|
|
133
|
+
context[PICK_DEPTH_KIND_KEY] = "legacy";
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
console.error("Failed to patch the pick depth merge.", e);
|
|
139
|
+
}
|
|
140
|
+
return original.call(this, fragmentShaderSource, overrides);
|
|
141
|
+
};
|
|
142
|
+
// A pick depth made before this point rebuilds its copy on the next frame.
|
|
143
|
+
for (const view of [scene.view, scene.defaultView]) {
|
|
144
|
+
for (const pickDepth of (_a = view === null || view === void 0 ? void 0 : view.pickDepths) !== null && _a !== void 0 ? _a : []) {
|
|
145
|
+
if (pickDepth === null || pickDepth === void 0 ? void 0 : pickDepth._copyDepthCommand) {
|
|
146
|
+
(_c = (_b = pickDepth._copyDepthCommand.shaderProgram) === null || _b === void 0 ? void 0 : _b.destroy) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
147
|
+
pickDepth._copyDepthCommand = undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
context[PICK_THROUGH_GROUND_PATCH_KEY] = true;
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
exports.InstallPickThroughGroundPatch = InstallPickThroughGroundPatch;
|
|
155
|
+
//# sourceMappingURL=cesium-patch-pick-through-ground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cesium-patch-pick-through-ground.js","sourceRoot":"","sources":["../../../src/internal/cesium-patch-pick-through-ground.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,iCAAiC;AAEjC,MAAM,6BAA6B,GAAG,kCAAkC,CAAC;AAEzE,uEAAuE;AACvE,MAAM,mBAAmB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AI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,iBAAiB,EAAE;gBAC9B,MAAA,MAAA,SAAS,CAAC,iBAAiB,CAAC,aAAa,0CAAE,OAAO,kDAAI,CAAC;gBACvD,SAAS,CAAC,iBAAiB,GAAG,SAAS,CAAC;aAC3C;SACJ;KACJ;IACD,OAAO,CAAC,6BAA6B,CAAC,GAAG,IAAI,CAAC;IAC9C,OAAO,IAAI,CAAC;AAChB,CAAC;AAjED,sEAiEC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallSplatOrderPatch = exports.OrderSplatCommands = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Draws XGrids splats after the opaque meshes, so a mesh drawn later cannot paint over nearer splats.
|
|
6
|
+
*/
|
|
7
|
+
const Cesium = require("cesium");
|
|
8
|
+
const cesium_patch_pick_splat_1 = require("./cesium-patch-pick-splat");
|
|
9
|
+
const SPLAT_ORDER_PATCH_KEY = "_nextspaceSplatOrderPatch";
|
|
10
|
+
/*
|
|
11
|
+
* Whether a command is one of the XGrids SDK's splat draws.
|
|
12
|
+
*/
|
|
13
|
+
function isSplatCommand(command) {
|
|
14
|
+
var _a;
|
|
15
|
+
return typeof ((_a = command === null || command === void 0 ? void 0 : command.owner) === null || _a === void 0 ? void 0 : _a.splatCount) === "number";
|
|
16
|
+
}
|
|
17
|
+
/*
|
|
18
|
+
* Moves splat draws to the end of the opaque pass, keeping everything else in order, and returns how many moved.
|
|
19
|
+
*/
|
|
20
|
+
function OrderSplatCommands(list, opaquePass) {
|
|
21
|
+
const splats = [];
|
|
22
|
+
let kept = 0;
|
|
23
|
+
for (let i = 0; i < list.length; i++) {
|
|
24
|
+
const command = list[i];
|
|
25
|
+
if (isSplatCommand(command)) {
|
|
26
|
+
splats.push(command);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
list[kept++] = command;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (!splats.length) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
list.length = kept;
|
|
36
|
+
for (const command of splats) {
|
|
37
|
+
command.pass = opaquePass;
|
|
38
|
+
list.push(command);
|
|
39
|
+
}
|
|
40
|
+
return splats.length;
|
|
41
|
+
}
|
|
42
|
+
exports.OrderSplatCommands = OrderSplatCommands;
|
|
43
|
+
/*
|
|
44
|
+
* Patches a viewer's primitive update so splat draws come after its opaque meshes.
|
|
45
|
+
*/
|
|
46
|
+
function InstallSplatOrderPatch(viewer) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const primitives = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.scene) === null || _a === void 0 ? void 0 : _a.primitives;
|
|
49
|
+
const opaquePass = (_b = Cesium.Pass) === null || _b === void 0 ? void 0 : _b.OPAQUE;
|
|
50
|
+
if (!primitives || typeof primitives.update !== "function" || typeof opaquePass !== "number") {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (primitives[SPLAT_ORDER_PATCH_KEY]) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const original = primitives.update;
|
|
57
|
+
primitives.update = function (frameState) {
|
|
58
|
+
original.call(this, frameState);
|
|
59
|
+
if (!(0, cesium_patch_pick_splat_1.HasSplats)(viewer)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
OrderSplatCommands(frameState.commandList, opaquePass);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
console.error("Failed to order splat draws.", e);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
primitives[SPLAT_ORDER_PATCH_KEY] = true;
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
exports.InstallSplatOrderPatch = InstallSplatOrderPatch;
|
|
73
|
+
//# sourceMappingURL=cesium-patch-splat-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cesium-patch-splat-order.js","sourceRoot":"","sources":["../../../src/internal/cesium-patch-splat-order.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,iCAAiC;AACjC,uEAAsD;AAEtD,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAE1D;;GAEG;AACH,SAAS,cAAc,CAAC,OAAY;;IAChC,OAAO,OAAO,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,UAAU,CAAA,KAAK,QAAQ,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,IAAW,EAAE,UAAkB;IAC9D,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;YACzB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACxB;aACI;YACD,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;SAC1B;KACJ;IACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;QAChB,OAAO,CAAC,CAAC;KACZ;IACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,MAAM,OAAO,IAAI,MAAM,EAAE;QAC1B,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACtB;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;AACzB,CAAC;AArBD,gDAqBC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CAAC,MAAW;;IAC9C,MAAM,UAAU,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,UAAU,CAAC;IAC7C,MAAM,UAAU,GAAG,MAAC,MAAc,CAAC,IAAI,0CAAE,MAAM,CAAC;IAChD,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAC1F,OAAO,KAAK,CAAC;KAChB;IACD,IAAI,UAAU,CAAC,qBAAqB,CAAC,EAAE;QACnC,OAAO,IAAI,CAAC;KACf;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC;IACnC,UAAU,CAAC,MAAM,GAAG,UAAU,UAAe;QACzC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAChC,IAAI,CAAC,IAAA,mCAAS,EAAC,MAAM,CAAC,EAAE;YACpB,OAAO;SACV;QACD,IAAI;YACA,kBAAkB,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;SAC1D;QACD,OAAO,CAAC,EAAE;YACN,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC;SACpD;IACL,CAAC,CAAC;IACF,UAAU,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC;IACzC,OAAO,IAAI,CAAC;AAChB,CAAC;AAxBD,wDAwBC"}
|
|
@@ -3909,7 +3909,7 @@ var EntityLabel;
|
|
|
3909
3909
|
* If one exists then the action is ignored.
|
|
3910
3910
|
*/
|
|
3911
3911
|
function Attach(params) {
|
|
3912
|
-
var _a, _b, _c;
|
|
3912
|
+
var _a, _b, _c, _d;
|
|
3913
3913
|
const { rego, viewer, pos3d, visualRegister, api, options, groupId } = params;
|
|
3914
3914
|
if (!rego || !viewer) {
|
|
3915
3915
|
return;
|
|
@@ -3920,8 +3920,8 @@ var EntityLabel;
|
|
|
3920
3920
|
return Attach({
|
|
3921
3921
|
...params,
|
|
3922
3922
|
pos3d: undefined,
|
|
3923
|
-
options: (_a =
|
|
3924
|
-
groupId: (
|
|
3923
|
+
options: group ? group.options : (_b = (_a = visualRegister.GetLabelDefaults) === null || _a === void 0 ? void 0 : _a.call(visualRegister)) !== null && _b !== void 0 ? _b : options,
|
|
3924
|
+
groupId: (_c = group === null || group === void 0 ? void 0 : group.groupId) !== null && _c !== void 0 ? _c : groupId,
|
|
3925
3925
|
persistent: true
|
|
3926
3926
|
});
|
|
3927
3927
|
}
|
|
@@ -3931,7 +3931,7 @@ var EntityLabel;
|
|
|
3931
3931
|
if (rego[EntityLabel.ATTACH_KEY].Persistent && params.persistent !== true && !groupId) {
|
|
3932
3932
|
return rego[EntityLabel.ATTACH_KEY];
|
|
3933
3933
|
}
|
|
3934
|
-
rego[EntityLabel.ATTACH_KEY].Persistent = (
|
|
3934
|
+
rego[EntityLabel.ATTACH_KEY].Persistent = (_d = params.persistent) !== null && _d !== void 0 ? _d : Boolean(groupId);
|
|
3935
3935
|
rego[EntityLabel.ATTACH_KEY].Configure(options, groupId);
|
|
3936
3936
|
return rego[EntityLabel.ATTACH_KEY];
|
|
3937
3937
|
}
|