@vertexvis/viewer 0.13.1 → 0.13.2-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{browser.esm-31b03292.js → browser.esm-075810bf.js} +1 -1
- package/dist/cjs/{bundle.esm-dc0a8361.js → bundle.esm-618a5fe9.js} +80 -28
- package/dist/cjs/{config-90ee43d5.js → config-fb124bac.js} +2 -2
- package/dist/cjs/{cursors-ad2fd395.js → cursors-d71f6a74.js} +1 -1
- package/dist/cjs/{dom-dd265f48.js → dom-57ef84e9.js} +1 -1
- package/dist/cjs/{entities-aa59890e.js → entities-90f1347a.js} +3 -3
- package/dist/cjs/index.cjs.js +14 -12
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{mapper-f6e6cafe.js → mapper-80ee2957.js} +2 -2
- package/dist/cjs/{markup-fb1553b1.js → markup-7f7de5f2.js} +2 -2
- package/dist/cjs/{measurement-aba1e0e8.js → measurement-f1ae9248.js} +2 -2
- package/dist/cjs/{model-4ec0c36e.js → model-55abd9ab.js} +1 -1
- package/dist/cjs/{overlays-40c6cbc7.js → overlays-68e8eff2.js} +2 -2
- package/dist/cjs/{png-decoder-27d25eed.js → png-decoder-076131d8.js} +1 -1
- package/dist/cjs/{results-bc325974.js → results-e9496869.js} +1 -1
- package/dist/cjs/{scene-d420fd26.js → scene-92728420.js} +188 -90
- package/dist/cjs/{streamAttributes-d6236448.js → streamAttributes-81eb52f2.js} +1508 -43
- package/dist/cjs/{utils-545b1865.js → utils-463cd52e.js} +1 -1
- package/dist/cjs/{utils-f80be307.js → utils-6397efca.js} +1 -1
- package/dist/cjs/vertex-scene-tree-search_3.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-dom-element_3.cjs.entry.js +8 -7
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +20 -15
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +6 -6
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +10 -10
- package/dist/cjs/vertex-viewer-measurement-tool.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-measurements.cjs.entry.js +8 -8
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer.cjs.entry.js +287 -80
- package/dist/cjs/viewer.cjs.js +1 -1
- package/dist/cjs/{viewport-8c39089f.js → viewport-54b1389d.js} +34 -2
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.css +1 -1
- package/dist/collection/components/viewer/viewer.js +68 -4
- package/dist/collection/components/viewer-dom-renderer/renderer2d.js +1 -1
- package/dist/collection/components/viewer-dom-renderer/renderer3d.js +4 -2
- package/dist/collection/components/viewer-dom-renderer/viewer-dom-renderer.js +5 -6
- package/dist/collection/components/viewer-measurement-distance/hitTest.js +9 -4
- package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js +5 -5
- package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays.js +3 -3
- package/dist/collection/index.js +2 -2
- package/dist/collection/lib/errors.js +8 -1
- package/dist/collection/lib/interactions/index.js +3 -1
- package/dist/collection/lib/interactions/interactionApi.js +4 -25
- package/dist/collection/lib/interactions/interactionApiOrthographic.js +136 -0
- package/dist/collection/lib/interactions/interactionApiPerspective.js +51 -0
- package/dist/collection/lib/interactions/multiTouchInteractionHandler.js +3 -2
- package/dist/collection/lib/mappers/frameStreaming.js +27 -5
- package/dist/collection/lib/rendering/matrices.js +13 -4
- package/dist/collection/lib/rendering/vectors.js +7 -0
- package/dist/collection/lib/scenes/__mocks__/mocks.js +2 -2
- package/dist/collection/lib/scenes/camera.js +163 -83
- package/dist/collection/lib/scenes/mapper.js +3 -2
- package/dist/collection/lib/scenes/scene.js +22 -9
- package/dist/collection/lib/types/clippingPlanes.js +48 -20
- package/dist/collection/lib/types/depthBuffer.js +32 -3
- package/dist/collection/lib/types/frame.js +133 -24
- package/dist/collection/lib/types/frameCamera.js +87 -6
- package/dist/collection/lib/types/viewport.js +34 -2
- package/dist/collection/testing/fixtures.js +28 -15
- package/dist/collection/testing/viewer.js +5 -3
- package/dist/custom-elements/index.js +2135 -283
- package/dist/esm/{browser.esm-59e914f6.js → browser.esm-e72d80ad.js} +1 -1
- package/dist/esm/{bundle.esm-d899b2d5.js → bundle.esm-8ceccb91.js} +80 -29
- package/dist/esm/{config-604c644e.js → config-fb7cd8ff.js} +2 -2
- package/dist/esm/{cursors-a7ec4adb.js → cursors-fc2deed7.js} +1 -1
- package/dist/esm/{dom-780d25be.js → dom-2cd18856.js} +1 -1
- package/dist/esm/{entities-759d97cd.js → entities-78557270.js} +3 -3
- package/dist/esm/index.js +12 -12
- package/dist/esm/index.mjs +12 -12
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/{mapper-4b815e31.js → mapper-da36de17.js} +2 -2
- package/dist/esm/{markup-1d177b4a.js → markup-c313d99c.js} +2 -2
- package/dist/esm/{measurement-12cdbf5c.js → measurement-544b69d5.js} +2 -2
- package/dist/esm/{model-e5a4f00f.js → model-2a34b443.js} +1 -1
- package/dist/esm/{overlays-1919b192.js → overlays-354e275c.js} +2 -2
- package/dist/esm/{png-decoder-3f1fa486.js → png-decoder-07de80d1.js} +1 -1
- package/dist/esm/{results-994bdb50.js → results-4d0c3568.js} +1 -1
- package/dist/esm/{scene-2c2460d5.js → scene-2bfcce74.js} +188 -90
- package/dist/esm/{streamAttributes-d623bb60.js → streamAttributes-d0b384b3.js} +1502 -44
- package/dist/esm/{utils-83a19677.js → utils-3ea0acdd.js} +1 -1
- package/dist/esm/{utils-5e57bf24.js → utils-e0941c61.js} +1 -1
- package/dist/esm/vertex-scene-tree-search_3.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +4 -4
- package/dist/esm/vertex-viewer-dom-element_3.entry.js +8 -7
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js +3 -3
- package/dist/esm/vertex-viewer-markup-tool.entry.js +4 -4
- package/dist/esm/vertex-viewer-markup.entry.js +4 -4
- package/dist/esm/vertex-viewer-measurement-details.entry.js +3 -3
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +20 -15
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +6 -6
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +10 -10
- package/dist/esm/vertex-viewer-measurement-tool.entry.js +5 -5
- package/dist/esm/vertex-viewer-measurements.entry.js +8 -8
- package/dist/esm/vertex-viewer-view-cube.entry.js +3 -3
- package/dist/esm/vertex-viewer.entry.js +287 -80
- package/dist/esm/viewer.js +1 -1
- package/dist/esm/{viewport-01c886ea.js → viewport-5cc7b128.js} +34 -2
- package/dist/types/components/scene-tree-table-cell/scene-tree-table-cell.d.ts +1 -1
- package/dist/types/components/viewer/viewer.d.ts +8 -0
- package/dist/types/components/viewer-dom-renderer/renderer2d.d.ts +2 -2
- package/dist/types/components/viewer-dom-renderer/renderer3d.d.ts +3 -3
- package/dist/types/components/viewer-dom-renderer/viewer-dom-renderer.d.ts +2 -2
- package/dist/types/components/viewer-measurement-distance/hitTest.d.ts +3 -2
- package/dist/types/components/viewer-measurement-distance/utils.d.ts +2 -2
- package/dist/types/components/viewer-measurement-distance/viewer-measurement-distance.d.ts +2 -2
- package/dist/types/components/viewer-measurement-overlays/viewer-measurement-overlays-components.d.ts +2 -2
- package/dist/types/components/viewer-measurement-overlays/viewer-measurement-overlays.d.ts +2 -2
- package/dist/types/components.d.ts +15 -7
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/errors.d.ts +3 -0
- package/dist/types/lib/interactions/index.d.ts +2 -0
- package/dist/types/lib/interactions/interactionApi.d.ts +34 -26
- package/dist/types/lib/interactions/interactionApiOrthographic.d.ts +35 -0
- package/dist/types/lib/interactions/interactionApiPerspective.d.ts +21 -0
- package/dist/types/lib/mappers/frameStreaming.d.ts +2 -0
- package/dist/types/lib/rendering/vectors.d.ts +2 -0
- package/dist/types/lib/scenes/__mocks__/mocks.d.ts +2 -2
- package/dist/types/lib/scenes/camera.d.ts +101 -38
- package/dist/types/lib/scenes/scene.d.ts +1 -1
- package/dist/types/lib/types/clippingPlanes.d.ts +3 -1
- package/dist/types/lib/types/depthBuffer.d.ts +28 -6
- package/dist/types/lib/types/frame.d.ts +80 -11
- package/dist/types/lib/types/frameCamera.d.ts +22 -3
- package/dist/types/lib/types/viewport.d.ts +24 -4
- package/dist/types/testing/fixtures.d.ts +8 -5
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-f8d01b8a.entry.js → p-0a189e62.entry.js} +1 -1
- package/dist/viewer/{p-e07377fa.entry.js → p-1ca95f9a.entry.js} +1 -1
- package/dist/viewer/{p-d00e9203.js → p-3561d910.js} +1 -1
- package/dist/viewer/p-388a43f7.js +4 -0
- package/dist/viewer/{p-3810c24d.js → p-3f0f83ad.js} +1 -1
- package/dist/viewer/{p-8decee06.entry.js → p-41028d3b.entry.js} +1 -1
- package/dist/viewer/{p-439220c6.js → p-487e054a.js} +1 -1
- package/dist/viewer/p-49d36e94.entry.js +4 -0
- package/dist/viewer/{p-da2f4a56.js → p-5b342e97.js} +1 -1
- package/dist/viewer/p-661f0612.js +18 -0
- package/dist/viewer/{p-364ce21c.js → p-69058178.js} +1 -1
- package/dist/viewer/{p-353cfc7a.entry.js → p-73a5eacc.entry.js} +1 -1
- package/dist/viewer/p-77be081a.js +4 -0
- package/dist/viewer/{p-a0df0e0c.js → p-809d09d9.js} +1 -1
- package/dist/viewer/{p-d90f2f6d.entry.js → p-858bd2c7.entry.js} +1 -1
- package/dist/viewer/{p-25eaab00.entry.js → p-89b66838.entry.js} +1 -1
- package/dist/viewer/p-a93a63a9.js +4 -0
- package/dist/viewer/{p-df292b56.entry.js → p-b043b076.entry.js} +1 -1
- package/dist/viewer/{p-915d95ad.entry.js → p-b0ac6b3c.entry.js} +1 -1
- package/dist/viewer/{p-fec1a8d0.entry.js → p-b7624ff2.entry.js} +1 -1
- package/dist/viewer/{p-f7cb7e59.js → p-b8774c9c.js} +1 -1
- package/dist/viewer/{p-67446e35.js → p-bcb66f97.js} +1 -1
- package/dist/viewer/p-bcde5521.entry.js +4 -0
- package/dist/viewer/{p-7cad9bf4.js → p-d1584404.js} +1 -1
- package/dist/viewer/p-d32b54cb.js +4 -0
- package/dist/viewer/{p-f755af5a.entry.js → p-d3a20af4.entry.js} +1 -1
- package/dist/viewer/{p-c62cb926.entry.js → p-d9f99f4d.entry.js} +1 -1
- package/dist/viewer/p-e38458da.js +4 -0
- package/dist/viewer/{p-301660cf.js → p-e75bba97.js} +2 -2
- package/dist/viewer/{p-6e80f8b0.entry.js → p-ebd55df7.entry.js} +1 -1
- package/dist/viewer/{p-671c113c.entry.js → p-f0411993.entry.js} +1 -1
- package/dist/viewer/{p-2cefb1b0.js → p-fa9a0bed.js} +1 -1
- package/dist/viewer/p-ffdeb08c.js +4 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +8 -8
- package/dist/viewer/p-081e6873.js +0 -4
- package/dist/viewer/p-085e908a.js +0 -4
- package/dist/viewer/p-0aba71fd.js +0 -18
- package/dist/viewer/p-3f6ac74f.js +0 -4
- package/dist/viewer/p-423410be.js +0 -4
- package/dist/viewer/p-432267bc.entry.js +0 -4
- package/dist/viewer/p-4985fad5.js +0 -4
- package/dist/viewer/p-e2297df2.entry.js +0 -4
- package/dist/viewer/p-fe11d694.js +0 -4
|
@@ -3113,11 +3113,11 @@ function v1(options, buf, offset) {
|
|
|
3113
3113
|
return buf || stringify(b);
|
|
3114
3114
|
}
|
|
3115
3115
|
|
|
3116
|
-
var create$
|
|
3116
|
+
var create$f = function () { return v1(); };
|
|
3117
3117
|
|
|
3118
3118
|
var uuid = /*#__PURE__*/Object.freeze({
|
|
3119
3119
|
__proto__: null,
|
|
3120
|
-
create: create$
|
|
3120
|
+
create: create$f
|
|
3121
3121
|
});
|
|
3122
3122
|
|
|
3123
3123
|
var EventDispatcher = /** @class */ (function () {
|
|
@@ -3214,7 +3214,7 @@ const defaultColor = {
|
|
|
3214
3214
|
* @param hex
|
|
3215
3215
|
* @param opacity
|
|
3216
3216
|
*/
|
|
3217
|
-
const create$
|
|
3217
|
+
const create$e = (r, g, b, opacity) => {
|
|
3218
3218
|
return Object.assign(Object.assign({}, defaultColor), { opacity: opacity || 100, glossiness: opacity || 10, diffuse: {
|
|
3219
3219
|
r,
|
|
3220
3220
|
g,
|
|
@@ -3265,7 +3265,7 @@ const defaultSelectionMaterial = {
|
|
|
3265
3265
|
|
|
3266
3266
|
const colorMaterial = /*#__PURE__*/Object.freeze({
|
|
3267
3267
|
__proto__: null,
|
|
3268
|
-
create: create$
|
|
3268
|
+
create: create$e,
|
|
3269
3269
|
fromHex: fromHex,
|
|
3270
3270
|
defaultSelectionMaterial: defaultSelectionMaterial
|
|
3271
3271
|
});
|
|
@@ -15118,7 +15118,7 @@ function lerp$2(a, b, t) {
|
|
|
15118
15118
|
/**
|
|
15119
15119
|
* Returns a new `Point` with the given horizontal and vertical position.
|
|
15120
15120
|
*/
|
|
15121
|
-
function create$
|
|
15121
|
+
function create$c(x, y) {
|
|
15122
15122
|
if (x === void 0) { x = 0; }
|
|
15123
15123
|
if (y === void 0) { y = 0; }
|
|
15124
15124
|
return { x: x, y: y };
|
|
@@ -15129,7 +15129,7 @@ function create$b(x, y) {
|
|
|
15129
15129
|
function polar(length, radians) {
|
|
15130
15130
|
var x = Math.cos(radians) * length;
|
|
15131
15131
|
var y = Math.sin(radians) * length;
|
|
15132
|
-
return create$
|
|
15132
|
+
return create$c(x, y);
|
|
15133
15133
|
}
|
|
15134
15134
|
/**
|
|
15135
15135
|
* Returns the distance between two points.
|
|
@@ -15175,7 +15175,7 @@ function lerp$1(a, b, t) {
|
|
|
15175
15175
|
* Returns a new `Point` where `x` and `y` are inverted.
|
|
15176
15176
|
*/
|
|
15177
15177
|
function negate$1(pt) {
|
|
15178
|
-
return create$
|
|
15178
|
+
return create$c(-pt.x, -pt.y);
|
|
15179
15179
|
}
|
|
15180
15180
|
/**
|
|
15181
15181
|
* Returns a new `Point` where `x` and `y` are multiplied by the given scale
|
|
@@ -15197,17 +15197,17 @@ function fromJson$4(json) {
|
|
|
15197
15197
|
var obj = JSON.parse(json);
|
|
15198
15198
|
if (Array.isArray(obj)) {
|
|
15199
15199
|
var x = obj[0], y = obj[1];
|
|
15200
|
-
return create$
|
|
15200
|
+
return create$c(x, y);
|
|
15201
15201
|
}
|
|
15202
15202
|
else {
|
|
15203
15203
|
var x = obj.x, y = obj.y;
|
|
15204
|
-
return create$
|
|
15204
|
+
return create$c(x, y);
|
|
15205
15205
|
}
|
|
15206
15206
|
}
|
|
15207
15207
|
|
|
15208
15208
|
var point = /*#__PURE__*/Object.freeze({
|
|
15209
15209
|
__proto__: null,
|
|
15210
|
-
create: create$
|
|
15210
|
+
create: create$c,
|
|
15211
15211
|
polar: polar,
|
|
15212
15212
|
distance: distance$2,
|
|
15213
15213
|
subtract: subtract$1,
|
|
@@ -15509,6 +15509,39 @@ function makePerspective(near, far, fovY, aspect) {
|
|
|
15509
15509
|
var bottom = -ymax;
|
|
15510
15510
|
return makeFrustum(left, right, top, bottom, near, far);
|
|
15511
15511
|
}
|
|
15512
|
+
/**
|
|
15513
|
+
* Creates an orthographic projection matrix.
|
|
15514
|
+
*
|
|
15515
|
+
* Related to: gluOrtho. The viewing volume is cube-shaped and defined by
|
|
15516
|
+
* the six parameters. The left and right values represent the coordinates of
|
|
15517
|
+
* the vertical clipping planes, top and bottom values represent the coordinates
|
|
15518
|
+
* of the horizontal clipping planes, and near and far values represent the
|
|
15519
|
+
* coordinates of the depth clipping planes.
|
|
15520
|
+
*
|
|
15521
|
+
* @param left The coordinate of the left horizontal clipping plane.
|
|
15522
|
+
* @param right The coordinate of the right horizontal clipping plane.
|
|
15523
|
+
* @param bottom The coordinate of the bottom vertical clipping plane.
|
|
15524
|
+
* @param top The coordinate of the top vertical clipping plane.
|
|
15525
|
+
* @param near The coordinate of the near depth clipping plane.
|
|
15526
|
+
* @param far The coordinate of the far depth clipping plane.
|
|
15527
|
+
* @returns A matrix.
|
|
15528
|
+
*/
|
|
15529
|
+
function makeOrthographic(left, right, bottom, top, near, far) {
|
|
15530
|
+
var w = 1.0 / (right - left);
|
|
15531
|
+
var h = 1.0 / (top - bottom);
|
|
15532
|
+
var d = 1.0 / (far - near);
|
|
15533
|
+
var x = (right + left) * w;
|
|
15534
|
+
var y = (top + bottom) * h;
|
|
15535
|
+
var z = (far + near) * d;
|
|
15536
|
+
/* eslint-disable prettier/prettier */
|
|
15537
|
+
return [
|
|
15538
|
+
2 * w, 0, 0, -x,
|
|
15539
|
+
0, 2 * h, 0, -y,
|
|
15540
|
+
0, 0, -2 * d, -z,
|
|
15541
|
+
0, 0, 0, 1
|
|
15542
|
+
];
|
|
15543
|
+
/* eslint-enable prettier/prettier */
|
|
15544
|
+
}
|
|
15512
15545
|
/**
|
|
15513
15546
|
* Matrix becomes a combination of an inverse translation and rotation.
|
|
15514
15547
|
*
|
|
@@ -15769,6 +15802,7 @@ var matrix4 = /*#__PURE__*/Object.freeze({
|
|
|
15769
15802
|
makeRotationAxis: makeRotationAxis,
|
|
15770
15803
|
makeFrustum: makeFrustum,
|
|
15771
15804
|
makePerspective: makePerspective,
|
|
15805
|
+
makeOrthographic: makeOrthographic,
|
|
15772
15806
|
makeLookAtView: makeLookAtView,
|
|
15773
15807
|
makeLookAt: makeLookAt,
|
|
15774
15808
|
invert: invert,
|
|
@@ -15781,7 +15815,7 @@ var matrix4 = /*#__PURE__*/Object.freeze({
|
|
|
15781
15815
|
isType: isType$2
|
|
15782
15816
|
});
|
|
15783
15817
|
|
|
15784
|
-
function create$
|
|
15818
|
+
function create$b() {
|
|
15785
15819
|
var _a, _b, _c, _d, _e, _f;
|
|
15786
15820
|
var args = [];
|
|
15787
15821
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -15845,11 +15879,11 @@ function fromJson$3(json) {
|
|
|
15845
15879
|
var obj = JSON.parse(json);
|
|
15846
15880
|
if (Array.isArray(obj)) {
|
|
15847
15881
|
var x = obj[0], y = obj[1], z = obj[2];
|
|
15848
|
-
return create$
|
|
15882
|
+
return create$b(x, y, z);
|
|
15849
15883
|
}
|
|
15850
15884
|
else {
|
|
15851
15885
|
var x = obj.x, y = obj.y, z = obj.z;
|
|
15852
|
-
return create$
|
|
15886
|
+
return create$b(x, y, z);
|
|
15853
15887
|
}
|
|
15854
15888
|
}
|
|
15855
15889
|
/**
|
|
@@ -15864,7 +15898,7 @@ function fromArray(nums, offset) {
|
|
|
15864
15898
|
var x = nums[offset];
|
|
15865
15899
|
var y = nums[offset + 1];
|
|
15866
15900
|
var z = nums[offset + 2];
|
|
15867
|
-
return create$
|
|
15901
|
+
return create$b(x, y, z);
|
|
15868
15902
|
}
|
|
15869
15903
|
/**
|
|
15870
15904
|
* Converts a Vector3 to an array where the values of the vector will be
|
|
@@ -15881,43 +15915,43 @@ function toArray(_a) {
|
|
|
15881
15915
|
* Returns a directional vector on the positive x axis, Vector3(1, 0, 0).
|
|
15882
15916
|
*/
|
|
15883
15917
|
function right() {
|
|
15884
|
-
return create$
|
|
15918
|
+
return create$b(1, 0, 0);
|
|
15885
15919
|
}
|
|
15886
15920
|
/**
|
|
15887
15921
|
* Returns a directional vector on the positive y axis, Vector3(0, 1, 0).
|
|
15888
15922
|
*/
|
|
15889
15923
|
function up() {
|
|
15890
|
-
return create$
|
|
15924
|
+
return create$b(0, 1, 0);
|
|
15891
15925
|
}
|
|
15892
15926
|
/**
|
|
15893
15927
|
* Returns a directional vector on the positive z axis, Vector3(0, 0, -1).
|
|
15894
15928
|
*/
|
|
15895
15929
|
function forward() {
|
|
15896
|
-
return create$
|
|
15930
|
+
return create$b(0, 0, -1);
|
|
15897
15931
|
}
|
|
15898
15932
|
/**
|
|
15899
15933
|
* Returns a directional vector on the negative x axis, Vector3(-1, 0, 0).
|
|
15900
15934
|
*/
|
|
15901
15935
|
function left() {
|
|
15902
|
-
return create$
|
|
15936
|
+
return create$b(-1, 0, 0);
|
|
15903
15937
|
}
|
|
15904
15938
|
/**
|
|
15905
15939
|
* Returns a directional vector on the negative y axis, Vector3(0, -1, 0).
|
|
15906
15940
|
*/
|
|
15907
15941
|
function down() {
|
|
15908
|
-
return create$
|
|
15942
|
+
return create$b(0, -1, 0);
|
|
15909
15943
|
}
|
|
15910
15944
|
/**
|
|
15911
15945
|
* Returns a directional vector on the negative z axis, Vector3(0, 0, 1).
|
|
15912
15946
|
*/
|
|
15913
15947
|
function back() {
|
|
15914
|
-
return create$
|
|
15948
|
+
return create$b(0, 0, 1);
|
|
15915
15949
|
}
|
|
15916
15950
|
/**
|
|
15917
15951
|
* Returns a vector at the origin, Vector3(0, 0, 0).
|
|
15918
15952
|
*/
|
|
15919
15953
|
function origin() {
|
|
15920
|
-
return create$
|
|
15954
|
+
return create$b(0, 0, 0);
|
|
15921
15955
|
}
|
|
15922
15956
|
/**
|
|
15923
15957
|
* Returns a vector with that will have a magnitude of 1.
|
|
@@ -16100,13 +16134,13 @@ function isEqual$2(a, b) {
|
|
|
16100
16134
|
* Returns a vector that contains the largest components of `a` and `b`.
|
|
16101
16135
|
*/
|
|
16102
16136
|
function max(a, b) {
|
|
16103
|
-
return create$
|
|
16137
|
+
return create$b(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z));
|
|
16104
16138
|
}
|
|
16105
16139
|
/**
|
|
16106
16140
|
* Returns a vector that contains the smallest components of `a` and `b`.
|
|
16107
16141
|
*/
|
|
16108
16142
|
function min(a, b) {
|
|
16109
|
-
return create$
|
|
16143
|
+
return create$b(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z));
|
|
16110
16144
|
}
|
|
16111
16145
|
/**
|
|
16112
16146
|
* Returns a vector that each of its component negated.
|
|
@@ -16144,7 +16178,7 @@ function transformNdcToWorldSpace(ndc, worldMatrix, projectionMatrixInverse) {
|
|
|
16144
16178
|
|
|
16145
16179
|
var vector3 = /*#__PURE__*/Object.freeze({
|
|
16146
16180
|
__proto__: null,
|
|
16147
|
-
create: create$
|
|
16181
|
+
create: create$b,
|
|
16148
16182
|
isValid: isValid,
|
|
16149
16183
|
fromMatrixScale: fromMatrixScale,
|
|
16150
16184
|
fromMatrixPosition: fromMatrixPosition,
|
|
@@ -16184,7 +16218,7 @@ var vector3 = /*#__PURE__*/Object.freeze({
|
|
|
16184
16218
|
/**
|
|
16185
16219
|
* Returns a `BoundingBox` with the given min and max points.
|
|
16186
16220
|
*/
|
|
16187
|
-
var create$
|
|
16221
|
+
var create$a = function (min, max) {
|
|
16188
16222
|
return { min: min, max: max };
|
|
16189
16223
|
};
|
|
16190
16224
|
/**
|
|
@@ -16192,7 +16226,7 @@ var create$9 = function (min, max) {
|
|
|
16192
16226
|
* are contained by the bounding box.
|
|
16193
16227
|
*/
|
|
16194
16228
|
var fromVectors = function (vectors) {
|
|
16195
|
-
return union.apply(void 0, vectors.map(function (v) { return create$
|
|
16229
|
+
return union.apply(void 0, vectors.map(function (v) { return create$a(v, v); }));
|
|
16196
16230
|
};
|
|
16197
16231
|
/**
|
|
16198
16232
|
* Returns the center point of the given `BoundingBox`.
|
|
@@ -16207,19 +16241,36 @@ function union(box) {
|
|
|
16207
16241
|
}
|
|
16208
16242
|
var boxes = __spreadArray([box], rest, true);
|
|
16209
16243
|
return boxes.reduce(function (a, b) {
|
|
16210
|
-
return create$
|
|
16244
|
+
return create$a(min(a.min, b.min), max(a.max, b.max));
|
|
16211
16245
|
});
|
|
16212
16246
|
}
|
|
16213
16247
|
/* eslint-enable padding-line-between-statements */
|
|
16214
16248
|
|
|
16215
16249
|
var boundingBox = /*#__PURE__*/Object.freeze({
|
|
16216
16250
|
__proto__: null,
|
|
16217
|
-
create: create$
|
|
16251
|
+
create: create$a,
|
|
16218
16252
|
fromVectors: fromVectors,
|
|
16219
16253
|
center: center$3,
|
|
16220
16254
|
union: union
|
|
16221
16255
|
});
|
|
16222
16256
|
|
|
16257
|
+
/**
|
|
16258
|
+
* Returns a `BoundingSphere` that encompasses the provided `BoundingBox`.
|
|
16259
|
+
*/
|
|
16260
|
+
var create$9 = function (boundingBox$1) {
|
|
16261
|
+
var boundingBoxCenter = center$3(boundingBox$1);
|
|
16262
|
+
var centerToBoundingPlane = subtract(boundingBox$1.max, boundingBoxCenter);
|
|
16263
|
+
var radius = magnitude(centerToBoundingPlane);
|
|
16264
|
+
var length = Math.max(radius, magnitude(boundingBoxCenter));
|
|
16265
|
+
var epsilon = length === 0 ? 1.0 : length * 1e-6;
|
|
16266
|
+
return { center: boundingBoxCenter, radius: radius, epsilon: epsilon };
|
|
16267
|
+
};
|
|
16268
|
+
|
|
16269
|
+
var boundingSphere = /*#__PURE__*/Object.freeze({
|
|
16270
|
+
__proto__: null,
|
|
16271
|
+
create: create$9
|
|
16272
|
+
});
|
|
16273
|
+
|
|
16223
16274
|
/**
|
|
16224
16275
|
* Returns a new `Rectangle` with the given position and size.
|
|
16225
16276
|
*/
|
|
@@ -16341,13 +16392,13 @@ function center$2(rect) {
|
|
|
16341
16392
|
* Returns the top-left position of the rectangle, as a point.
|
|
16342
16393
|
*/
|
|
16343
16394
|
function topLeft(rect) {
|
|
16344
|
-
return create$
|
|
16395
|
+
return create$c(rect.x, rect.y);
|
|
16345
16396
|
}
|
|
16346
16397
|
/**
|
|
16347
16398
|
* Returns the bottom-right position of the rectangle, as a point.
|
|
16348
16399
|
*/
|
|
16349
16400
|
function bottomRight(rect) {
|
|
16350
|
-
return create$
|
|
16401
|
+
return create$c(rect.x + rect.width, rect.y + rect.height);
|
|
16351
16402
|
}
|
|
16352
16403
|
/**
|
|
16353
16404
|
* Returns `true` if the given rectangle has a portrait aspect ratio.
|
|
@@ -16552,7 +16603,7 @@ var fitToRatio = function (ratio, dimensions) {
|
|
|
16552
16603
|
* Converts a dimension to a rectangle, with an optional position.
|
|
16553
16604
|
*/
|
|
16554
16605
|
function toRectangle(dimensions, position) {
|
|
16555
|
-
if (position === void 0) { position = create$
|
|
16606
|
+
if (position === void 0) { position = create$c(); }
|
|
16556
16607
|
return fromPointAndDimensions(position, dimensions);
|
|
16557
16608
|
}
|
|
16558
16609
|
|
|
@@ -16854,7 +16905,7 @@ var translate = function (dx, dy, matrix) {
|
|
|
16854
16905
|
var transformPoint = function (matrix, pt) {
|
|
16855
16906
|
var x = matrix.a * pt.x + matrix.c * pt.y + matrix.tx;
|
|
16856
16907
|
var y = matrix.b * pt.x + matrix.d * pt.y + matrix.ty;
|
|
16857
|
-
return create$
|
|
16908
|
+
return create$c(x, y);
|
|
16858
16909
|
};
|
|
16859
16910
|
|
|
16860
16911
|
var matrix = /*#__PURE__*/Object.freeze({
|
|
@@ -17185,7 +17236,7 @@ var quaternion = /*#__PURE__*/Object.freeze({
|
|
|
17185
17236
|
* @param value The values of the ray.
|
|
17186
17237
|
* @returns A new ray.
|
|
17187
17238
|
*/
|
|
17188
|
-
function create$
|
|
17239
|
+
function create$d(value) {
|
|
17189
17240
|
var _a, _b;
|
|
17190
17241
|
if (value === void 0) { value = {}; }
|
|
17191
17242
|
return {
|
|
@@ -17240,7 +17291,7 @@ function intersectPlane(ray, plane) {
|
|
|
17240
17291
|
|
|
17241
17292
|
var ray = /*#__PURE__*/Object.freeze({
|
|
17242
17293
|
__proto__: null,
|
|
17243
|
-
create: create$
|
|
17294
|
+
create: create$d,
|
|
17244
17295
|
at: at,
|
|
17245
17296
|
distanceToPlane: distanceToPlane,
|
|
17246
17297
|
intersectPlane: intersectPlane
|
|
@@ -19925,6 +19976,522 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
19925
19976
|
*/
|
|
19926
19977
|
const stream = {};
|
|
19927
19978
|
|
|
19979
|
+
stream.PerspectiveCamera = (function() {
|
|
19980
|
+
|
|
19981
|
+
/**
|
|
19982
|
+
* Properties of a PerspectiveCamera.
|
|
19983
|
+
* @memberof vertexvis.protobuf.stream
|
|
19984
|
+
* @interface IPerspectiveCamera
|
|
19985
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [position] PerspectiveCamera position
|
|
19986
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [lookAt] PerspectiveCamera lookAt
|
|
19987
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [up] PerspectiveCamera up
|
|
19988
|
+
*/
|
|
19989
|
+
|
|
19990
|
+
/**
|
|
19991
|
+
* Constructs a new PerspectiveCamera.
|
|
19992
|
+
* @memberof vertexvis.protobuf.stream
|
|
19993
|
+
* @classdesc Represents a PerspectiveCamera.
|
|
19994
|
+
* @implements IPerspectiveCamera
|
|
19995
|
+
* @constructor
|
|
19996
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera=} [properties] Properties to set
|
|
19997
|
+
*/
|
|
19998
|
+
function PerspectiveCamera(properties) {
|
|
19999
|
+
if (properties)
|
|
20000
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
20001
|
+
if (properties[keys[i]] != null)
|
|
20002
|
+
this[keys[i]] = properties[keys[i]];
|
|
20003
|
+
}
|
|
20004
|
+
|
|
20005
|
+
/**
|
|
20006
|
+
* PerspectiveCamera position.
|
|
20007
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} position
|
|
20008
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20009
|
+
* @instance
|
|
20010
|
+
*/
|
|
20011
|
+
PerspectiveCamera.prototype.position = null;
|
|
20012
|
+
|
|
20013
|
+
/**
|
|
20014
|
+
* PerspectiveCamera lookAt.
|
|
20015
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} lookAt
|
|
20016
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20017
|
+
* @instance
|
|
20018
|
+
*/
|
|
20019
|
+
PerspectiveCamera.prototype.lookAt = null;
|
|
20020
|
+
|
|
20021
|
+
/**
|
|
20022
|
+
* PerspectiveCamera up.
|
|
20023
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} up
|
|
20024
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20025
|
+
* @instance
|
|
20026
|
+
*/
|
|
20027
|
+
PerspectiveCamera.prototype.up = null;
|
|
20028
|
+
|
|
20029
|
+
/**
|
|
20030
|
+
* Creates a new PerspectiveCamera instance using the specified properties.
|
|
20031
|
+
* @function create
|
|
20032
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20033
|
+
* @static
|
|
20034
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera=} [properties] Properties to set
|
|
20035
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera instance
|
|
20036
|
+
*/
|
|
20037
|
+
PerspectiveCamera.create = function create(properties) {
|
|
20038
|
+
return new PerspectiveCamera(properties);
|
|
20039
|
+
};
|
|
20040
|
+
|
|
20041
|
+
/**
|
|
20042
|
+
* Encodes the specified PerspectiveCamera message. Does not implicitly {@link vertexvis.protobuf.stream.PerspectiveCamera.verify|verify} messages.
|
|
20043
|
+
* @function encode
|
|
20044
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20045
|
+
* @static
|
|
20046
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera} message PerspectiveCamera message or plain object to encode
|
|
20047
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
20048
|
+
* @returns {$protobuf.Writer} Writer
|
|
20049
|
+
*/
|
|
20050
|
+
PerspectiveCamera.encode = function encode(message, writer) {
|
|
20051
|
+
if (!writer)
|
|
20052
|
+
writer = $Writer$1.create();
|
|
20053
|
+
if (message.position != null && Object.hasOwnProperty.call(message, "position"))
|
|
20054
|
+
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.position, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
|
20055
|
+
if (message.lookAt != null && Object.hasOwnProperty.call(message, "lookAt"))
|
|
20056
|
+
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.lookAt, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
|
20057
|
+
if (message.up != null && Object.hasOwnProperty.call(message, "up"))
|
|
20058
|
+
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.up, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
20059
|
+
return writer;
|
|
20060
|
+
};
|
|
20061
|
+
|
|
20062
|
+
/**
|
|
20063
|
+
* Encodes the specified PerspectiveCamera message, length delimited. Does not implicitly {@link vertexvis.protobuf.stream.PerspectiveCamera.verify|verify} messages.
|
|
20064
|
+
* @function encodeDelimited
|
|
20065
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20066
|
+
* @static
|
|
20067
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera} message PerspectiveCamera message or plain object to encode
|
|
20068
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
20069
|
+
* @returns {$protobuf.Writer} Writer
|
|
20070
|
+
*/
|
|
20071
|
+
PerspectiveCamera.encodeDelimited = function encodeDelimited(message, writer) {
|
|
20072
|
+
return this.encode(message, writer).ldelim();
|
|
20073
|
+
};
|
|
20074
|
+
|
|
20075
|
+
/**
|
|
20076
|
+
* Decodes a PerspectiveCamera message from the specified reader or buffer.
|
|
20077
|
+
* @function decode
|
|
20078
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20079
|
+
* @static
|
|
20080
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
20081
|
+
* @param {number} [length] Message length if known beforehand
|
|
20082
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera
|
|
20083
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
20084
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
20085
|
+
*/
|
|
20086
|
+
PerspectiveCamera.decode = function decode(reader, length) {
|
|
20087
|
+
if (!(reader instanceof $Reader$1))
|
|
20088
|
+
reader = $Reader$1.create(reader);
|
|
20089
|
+
let end = length === undefined ? reader.len : reader.pos + length, message = new $root$1.vertexvis.protobuf.stream.PerspectiveCamera();
|
|
20090
|
+
while (reader.pos < end) {
|
|
20091
|
+
let tag = reader.uint32();
|
|
20092
|
+
switch (tag >>> 3) {
|
|
20093
|
+
case 1:
|
|
20094
|
+
message.position = $root$1.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
20095
|
+
break;
|
|
20096
|
+
case 2:
|
|
20097
|
+
message.lookAt = $root$1.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
20098
|
+
break;
|
|
20099
|
+
case 3:
|
|
20100
|
+
message.up = $root$1.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
20101
|
+
break;
|
|
20102
|
+
default:
|
|
20103
|
+
reader.skipType(tag & 7);
|
|
20104
|
+
break;
|
|
20105
|
+
}
|
|
20106
|
+
}
|
|
20107
|
+
return message;
|
|
20108
|
+
};
|
|
20109
|
+
|
|
20110
|
+
/**
|
|
20111
|
+
* Decodes a PerspectiveCamera message from the specified reader or buffer, length delimited.
|
|
20112
|
+
* @function decodeDelimited
|
|
20113
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20114
|
+
* @static
|
|
20115
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
20116
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera
|
|
20117
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
20118
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
20119
|
+
*/
|
|
20120
|
+
PerspectiveCamera.decodeDelimited = function decodeDelimited(reader) {
|
|
20121
|
+
if (!(reader instanceof $Reader$1))
|
|
20122
|
+
reader = new $Reader$1(reader);
|
|
20123
|
+
return this.decode(reader, reader.uint32());
|
|
20124
|
+
};
|
|
20125
|
+
|
|
20126
|
+
/**
|
|
20127
|
+
* Verifies a PerspectiveCamera message.
|
|
20128
|
+
* @function verify
|
|
20129
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20130
|
+
* @static
|
|
20131
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
20132
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
20133
|
+
*/
|
|
20134
|
+
PerspectiveCamera.verify = function verify(message) {
|
|
20135
|
+
if (typeof message !== "object" || message === null)
|
|
20136
|
+
return "object expected";
|
|
20137
|
+
if (message.position != null && message.hasOwnProperty("position")) {
|
|
20138
|
+
let error = $root$1.vertexvis.protobuf.core.Vector3f.verify(message.position);
|
|
20139
|
+
if (error)
|
|
20140
|
+
return "position." + error;
|
|
20141
|
+
}
|
|
20142
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt")) {
|
|
20143
|
+
let error = $root$1.vertexvis.protobuf.core.Vector3f.verify(message.lookAt);
|
|
20144
|
+
if (error)
|
|
20145
|
+
return "lookAt." + error;
|
|
20146
|
+
}
|
|
20147
|
+
if (message.up != null && message.hasOwnProperty("up")) {
|
|
20148
|
+
let error = $root$1.vertexvis.protobuf.core.Vector3f.verify(message.up);
|
|
20149
|
+
if (error)
|
|
20150
|
+
return "up." + error;
|
|
20151
|
+
}
|
|
20152
|
+
return null;
|
|
20153
|
+
};
|
|
20154
|
+
|
|
20155
|
+
/**
|
|
20156
|
+
* Creates a PerspectiveCamera message from a plain object. Also converts values to their respective internal types.
|
|
20157
|
+
* @function fromObject
|
|
20158
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20159
|
+
* @static
|
|
20160
|
+
* @param {Object.<string,*>} object Plain object
|
|
20161
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera
|
|
20162
|
+
*/
|
|
20163
|
+
PerspectiveCamera.fromObject = function fromObject(object) {
|
|
20164
|
+
if (object instanceof $root$1.vertexvis.protobuf.stream.PerspectiveCamera)
|
|
20165
|
+
return object;
|
|
20166
|
+
let message = new $root$1.vertexvis.protobuf.stream.PerspectiveCamera();
|
|
20167
|
+
if (object.position != null) {
|
|
20168
|
+
if (typeof object.position !== "object")
|
|
20169
|
+
throw TypeError(".vertexvis.protobuf.stream.PerspectiveCamera.position: object expected");
|
|
20170
|
+
message.position = $root$1.vertexvis.protobuf.core.Vector3f.fromObject(object.position);
|
|
20171
|
+
}
|
|
20172
|
+
if (object.lookAt != null) {
|
|
20173
|
+
if (typeof object.lookAt !== "object")
|
|
20174
|
+
throw TypeError(".vertexvis.protobuf.stream.PerspectiveCamera.lookAt: object expected");
|
|
20175
|
+
message.lookAt = $root$1.vertexvis.protobuf.core.Vector3f.fromObject(object.lookAt);
|
|
20176
|
+
}
|
|
20177
|
+
if (object.up != null) {
|
|
20178
|
+
if (typeof object.up !== "object")
|
|
20179
|
+
throw TypeError(".vertexvis.protobuf.stream.PerspectiveCamera.up: object expected");
|
|
20180
|
+
message.up = $root$1.vertexvis.protobuf.core.Vector3f.fromObject(object.up);
|
|
20181
|
+
}
|
|
20182
|
+
return message;
|
|
20183
|
+
};
|
|
20184
|
+
|
|
20185
|
+
/**
|
|
20186
|
+
* Creates a plain object from a PerspectiveCamera message. Also converts values to other types if specified.
|
|
20187
|
+
* @function toObject
|
|
20188
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20189
|
+
* @static
|
|
20190
|
+
* @param {vertexvis.protobuf.stream.PerspectiveCamera} message PerspectiveCamera
|
|
20191
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
20192
|
+
* @returns {Object.<string,*>} Plain object
|
|
20193
|
+
*/
|
|
20194
|
+
PerspectiveCamera.toObject = function toObject(message, options) {
|
|
20195
|
+
if (!options)
|
|
20196
|
+
options = {};
|
|
20197
|
+
let object = {};
|
|
20198
|
+
if (options.defaults) {
|
|
20199
|
+
object.position = null;
|
|
20200
|
+
object.lookAt = null;
|
|
20201
|
+
object.up = null;
|
|
20202
|
+
}
|
|
20203
|
+
if (message.position != null && message.hasOwnProperty("position"))
|
|
20204
|
+
object.position = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.position, options);
|
|
20205
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt"))
|
|
20206
|
+
object.lookAt = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.lookAt, options);
|
|
20207
|
+
if (message.up != null && message.hasOwnProperty("up"))
|
|
20208
|
+
object.up = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.up, options);
|
|
20209
|
+
return object;
|
|
20210
|
+
};
|
|
20211
|
+
|
|
20212
|
+
/**
|
|
20213
|
+
* Converts this PerspectiveCamera to JSON.
|
|
20214
|
+
* @function toJSON
|
|
20215
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
20216
|
+
* @instance
|
|
20217
|
+
* @returns {Object.<string,*>} JSON object
|
|
20218
|
+
*/
|
|
20219
|
+
PerspectiveCamera.prototype.toJSON = function toJSON() {
|
|
20220
|
+
return this.constructor.toObject(this, minimal$2.util.toJSONOptions);
|
|
20221
|
+
};
|
|
20222
|
+
|
|
20223
|
+
return PerspectiveCamera;
|
|
20224
|
+
})();
|
|
20225
|
+
|
|
20226
|
+
stream.OrthographicCamera = (function() {
|
|
20227
|
+
|
|
20228
|
+
/**
|
|
20229
|
+
* Properties of an OrthographicCamera.
|
|
20230
|
+
* @memberof vertexvis.protobuf.stream
|
|
20231
|
+
* @interface IOrthographicCamera
|
|
20232
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [viewVector] OrthographicCamera viewVector
|
|
20233
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [lookAt] OrthographicCamera lookAt
|
|
20234
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [up] OrthographicCamera up
|
|
20235
|
+
* @property {number|null} [fovHeight] OrthographicCamera fovHeight
|
|
20236
|
+
*/
|
|
20237
|
+
|
|
20238
|
+
/**
|
|
20239
|
+
* Constructs a new OrthographicCamera.
|
|
20240
|
+
* @memberof vertexvis.protobuf.stream
|
|
20241
|
+
* @classdesc Represents an OrthographicCamera.
|
|
20242
|
+
* @implements IOrthographicCamera
|
|
20243
|
+
* @constructor
|
|
20244
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera=} [properties] Properties to set
|
|
20245
|
+
*/
|
|
20246
|
+
function OrthographicCamera(properties) {
|
|
20247
|
+
if (properties)
|
|
20248
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
20249
|
+
if (properties[keys[i]] != null)
|
|
20250
|
+
this[keys[i]] = properties[keys[i]];
|
|
20251
|
+
}
|
|
20252
|
+
|
|
20253
|
+
/**
|
|
20254
|
+
* OrthographicCamera viewVector.
|
|
20255
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} viewVector
|
|
20256
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20257
|
+
* @instance
|
|
20258
|
+
*/
|
|
20259
|
+
OrthographicCamera.prototype.viewVector = null;
|
|
20260
|
+
|
|
20261
|
+
/**
|
|
20262
|
+
* OrthographicCamera lookAt.
|
|
20263
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} lookAt
|
|
20264
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20265
|
+
* @instance
|
|
20266
|
+
*/
|
|
20267
|
+
OrthographicCamera.prototype.lookAt = null;
|
|
20268
|
+
|
|
20269
|
+
/**
|
|
20270
|
+
* OrthographicCamera up.
|
|
20271
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} up
|
|
20272
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20273
|
+
* @instance
|
|
20274
|
+
*/
|
|
20275
|
+
OrthographicCamera.prototype.up = null;
|
|
20276
|
+
|
|
20277
|
+
/**
|
|
20278
|
+
* OrthographicCamera fovHeight.
|
|
20279
|
+
* @member {number} fovHeight
|
|
20280
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20281
|
+
* @instance
|
|
20282
|
+
*/
|
|
20283
|
+
OrthographicCamera.prototype.fovHeight = 0;
|
|
20284
|
+
|
|
20285
|
+
/**
|
|
20286
|
+
* Creates a new OrthographicCamera instance using the specified properties.
|
|
20287
|
+
* @function create
|
|
20288
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20289
|
+
* @static
|
|
20290
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera=} [properties] Properties to set
|
|
20291
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera instance
|
|
20292
|
+
*/
|
|
20293
|
+
OrthographicCamera.create = function create(properties) {
|
|
20294
|
+
return new OrthographicCamera(properties);
|
|
20295
|
+
};
|
|
20296
|
+
|
|
20297
|
+
/**
|
|
20298
|
+
* Encodes the specified OrthographicCamera message. Does not implicitly {@link vertexvis.protobuf.stream.OrthographicCamera.verify|verify} messages.
|
|
20299
|
+
* @function encode
|
|
20300
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20301
|
+
* @static
|
|
20302
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera} message OrthographicCamera message or plain object to encode
|
|
20303
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
20304
|
+
* @returns {$protobuf.Writer} Writer
|
|
20305
|
+
*/
|
|
20306
|
+
OrthographicCamera.encode = function encode(message, writer) {
|
|
20307
|
+
if (!writer)
|
|
20308
|
+
writer = $Writer$1.create();
|
|
20309
|
+
if (message.viewVector != null && Object.hasOwnProperty.call(message, "viewVector"))
|
|
20310
|
+
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.viewVector, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
|
20311
|
+
if (message.lookAt != null && Object.hasOwnProperty.call(message, "lookAt"))
|
|
20312
|
+
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.lookAt, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
|
20313
|
+
if (message.up != null && Object.hasOwnProperty.call(message, "up"))
|
|
20314
|
+
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.up, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
20315
|
+
if (message.fovHeight != null && Object.hasOwnProperty.call(message, "fovHeight"))
|
|
20316
|
+
writer.uint32(/* id 4, wireType 5 =*/37).float(message.fovHeight);
|
|
20317
|
+
return writer;
|
|
20318
|
+
};
|
|
20319
|
+
|
|
20320
|
+
/**
|
|
20321
|
+
* Encodes the specified OrthographicCamera message, length delimited. Does not implicitly {@link vertexvis.protobuf.stream.OrthographicCamera.verify|verify} messages.
|
|
20322
|
+
* @function encodeDelimited
|
|
20323
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20324
|
+
* @static
|
|
20325
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera} message OrthographicCamera message or plain object to encode
|
|
20326
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
20327
|
+
* @returns {$protobuf.Writer} Writer
|
|
20328
|
+
*/
|
|
20329
|
+
OrthographicCamera.encodeDelimited = function encodeDelimited(message, writer) {
|
|
20330
|
+
return this.encode(message, writer).ldelim();
|
|
20331
|
+
};
|
|
20332
|
+
|
|
20333
|
+
/**
|
|
20334
|
+
* Decodes an OrthographicCamera message from the specified reader or buffer.
|
|
20335
|
+
* @function decode
|
|
20336
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20337
|
+
* @static
|
|
20338
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
20339
|
+
* @param {number} [length] Message length if known beforehand
|
|
20340
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera
|
|
20341
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
20342
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
20343
|
+
*/
|
|
20344
|
+
OrthographicCamera.decode = function decode(reader, length) {
|
|
20345
|
+
if (!(reader instanceof $Reader$1))
|
|
20346
|
+
reader = $Reader$1.create(reader);
|
|
20347
|
+
let end = length === undefined ? reader.len : reader.pos + length, message = new $root$1.vertexvis.protobuf.stream.OrthographicCamera();
|
|
20348
|
+
while (reader.pos < end) {
|
|
20349
|
+
let tag = reader.uint32();
|
|
20350
|
+
switch (tag >>> 3) {
|
|
20351
|
+
case 1:
|
|
20352
|
+
message.viewVector = $root$1.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
20353
|
+
break;
|
|
20354
|
+
case 2:
|
|
20355
|
+
message.lookAt = $root$1.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
20356
|
+
break;
|
|
20357
|
+
case 3:
|
|
20358
|
+
message.up = $root$1.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
20359
|
+
break;
|
|
20360
|
+
case 4:
|
|
20361
|
+
message.fovHeight = reader.float();
|
|
20362
|
+
break;
|
|
20363
|
+
default:
|
|
20364
|
+
reader.skipType(tag & 7);
|
|
20365
|
+
break;
|
|
20366
|
+
}
|
|
20367
|
+
}
|
|
20368
|
+
return message;
|
|
20369
|
+
};
|
|
20370
|
+
|
|
20371
|
+
/**
|
|
20372
|
+
* Decodes an OrthographicCamera message from the specified reader or buffer, length delimited.
|
|
20373
|
+
* @function decodeDelimited
|
|
20374
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20375
|
+
* @static
|
|
20376
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
20377
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera
|
|
20378
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
20379
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
20380
|
+
*/
|
|
20381
|
+
OrthographicCamera.decodeDelimited = function decodeDelimited(reader) {
|
|
20382
|
+
if (!(reader instanceof $Reader$1))
|
|
20383
|
+
reader = new $Reader$1(reader);
|
|
20384
|
+
return this.decode(reader, reader.uint32());
|
|
20385
|
+
};
|
|
20386
|
+
|
|
20387
|
+
/**
|
|
20388
|
+
* Verifies an OrthographicCamera message.
|
|
20389
|
+
* @function verify
|
|
20390
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20391
|
+
* @static
|
|
20392
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
20393
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
20394
|
+
*/
|
|
20395
|
+
OrthographicCamera.verify = function verify(message) {
|
|
20396
|
+
if (typeof message !== "object" || message === null)
|
|
20397
|
+
return "object expected";
|
|
20398
|
+
if (message.viewVector != null && message.hasOwnProperty("viewVector")) {
|
|
20399
|
+
let error = $root$1.vertexvis.protobuf.core.Vector3f.verify(message.viewVector);
|
|
20400
|
+
if (error)
|
|
20401
|
+
return "viewVector." + error;
|
|
20402
|
+
}
|
|
20403
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt")) {
|
|
20404
|
+
let error = $root$1.vertexvis.protobuf.core.Vector3f.verify(message.lookAt);
|
|
20405
|
+
if (error)
|
|
20406
|
+
return "lookAt." + error;
|
|
20407
|
+
}
|
|
20408
|
+
if (message.up != null && message.hasOwnProperty("up")) {
|
|
20409
|
+
let error = $root$1.vertexvis.protobuf.core.Vector3f.verify(message.up);
|
|
20410
|
+
if (error)
|
|
20411
|
+
return "up." + error;
|
|
20412
|
+
}
|
|
20413
|
+
if (message.fovHeight != null && message.hasOwnProperty("fovHeight"))
|
|
20414
|
+
if (typeof message.fovHeight !== "number")
|
|
20415
|
+
return "fovHeight: number expected";
|
|
20416
|
+
return null;
|
|
20417
|
+
};
|
|
20418
|
+
|
|
20419
|
+
/**
|
|
20420
|
+
* Creates an OrthographicCamera message from a plain object. Also converts values to their respective internal types.
|
|
20421
|
+
* @function fromObject
|
|
20422
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20423
|
+
* @static
|
|
20424
|
+
* @param {Object.<string,*>} object Plain object
|
|
20425
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera
|
|
20426
|
+
*/
|
|
20427
|
+
OrthographicCamera.fromObject = function fromObject(object) {
|
|
20428
|
+
if (object instanceof $root$1.vertexvis.protobuf.stream.OrthographicCamera)
|
|
20429
|
+
return object;
|
|
20430
|
+
let message = new $root$1.vertexvis.protobuf.stream.OrthographicCamera();
|
|
20431
|
+
if (object.viewVector != null) {
|
|
20432
|
+
if (typeof object.viewVector !== "object")
|
|
20433
|
+
throw TypeError(".vertexvis.protobuf.stream.OrthographicCamera.viewVector: object expected");
|
|
20434
|
+
message.viewVector = $root$1.vertexvis.protobuf.core.Vector3f.fromObject(object.viewVector);
|
|
20435
|
+
}
|
|
20436
|
+
if (object.lookAt != null) {
|
|
20437
|
+
if (typeof object.lookAt !== "object")
|
|
20438
|
+
throw TypeError(".vertexvis.protobuf.stream.OrthographicCamera.lookAt: object expected");
|
|
20439
|
+
message.lookAt = $root$1.vertexvis.protobuf.core.Vector3f.fromObject(object.lookAt);
|
|
20440
|
+
}
|
|
20441
|
+
if (object.up != null) {
|
|
20442
|
+
if (typeof object.up !== "object")
|
|
20443
|
+
throw TypeError(".vertexvis.protobuf.stream.OrthographicCamera.up: object expected");
|
|
20444
|
+
message.up = $root$1.vertexvis.protobuf.core.Vector3f.fromObject(object.up);
|
|
20445
|
+
}
|
|
20446
|
+
if (object.fovHeight != null)
|
|
20447
|
+
message.fovHeight = Number(object.fovHeight);
|
|
20448
|
+
return message;
|
|
20449
|
+
};
|
|
20450
|
+
|
|
20451
|
+
/**
|
|
20452
|
+
* Creates a plain object from an OrthographicCamera message. Also converts values to other types if specified.
|
|
20453
|
+
* @function toObject
|
|
20454
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20455
|
+
* @static
|
|
20456
|
+
* @param {vertexvis.protobuf.stream.OrthographicCamera} message OrthographicCamera
|
|
20457
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
20458
|
+
* @returns {Object.<string,*>} Plain object
|
|
20459
|
+
*/
|
|
20460
|
+
OrthographicCamera.toObject = function toObject(message, options) {
|
|
20461
|
+
if (!options)
|
|
20462
|
+
options = {};
|
|
20463
|
+
let object = {};
|
|
20464
|
+
if (options.defaults) {
|
|
20465
|
+
object.viewVector = null;
|
|
20466
|
+
object.lookAt = null;
|
|
20467
|
+
object.up = null;
|
|
20468
|
+
object.fovHeight = 0;
|
|
20469
|
+
}
|
|
20470
|
+
if (message.viewVector != null && message.hasOwnProperty("viewVector"))
|
|
20471
|
+
object.viewVector = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.viewVector, options);
|
|
20472
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt"))
|
|
20473
|
+
object.lookAt = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.lookAt, options);
|
|
20474
|
+
if (message.up != null && message.hasOwnProperty("up"))
|
|
20475
|
+
object.up = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.up, options);
|
|
20476
|
+
if (message.fovHeight != null && message.hasOwnProperty("fovHeight"))
|
|
20477
|
+
object.fovHeight = options.json && !isFinite(message.fovHeight) ? String(message.fovHeight) : message.fovHeight;
|
|
20478
|
+
return object;
|
|
20479
|
+
};
|
|
20480
|
+
|
|
20481
|
+
/**
|
|
20482
|
+
* Converts this OrthographicCamera to JSON.
|
|
20483
|
+
* @function toJSON
|
|
20484
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
20485
|
+
* @instance
|
|
20486
|
+
* @returns {Object.<string,*>} JSON object
|
|
20487
|
+
*/
|
|
20488
|
+
OrthographicCamera.prototype.toJSON = function toJSON() {
|
|
20489
|
+
return this.constructor.toObject(this, minimal$2.util.toJSONOptions);
|
|
20490
|
+
};
|
|
20491
|
+
|
|
20492
|
+
return OrthographicCamera;
|
|
20493
|
+
})();
|
|
20494
|
+
|
|
19928
20495
|
stream.Camera = (function() {
|
|
19929
20496
|
|
|
19930
20497
|
/**
|
|
@@ -19934,6 +20501,8 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
19934
20501
|
* @property {vertexvis.protobuf.core.IVector3f|null} [position] Camera position
|
|
19935
20502
|
* @property {vertexvis.protobuf.core.IVector3f|null} [lookAt] Camera lookAt
|
|
19936
20503
|
* @property {vertexvis.protobuf.core.IVector3f|null} [up] Camera up
|
|
20504
|
+
* @property {vertexvis.protobuf.stream.IPerspectiveCamera|null} [perspective] Camera perspective
|
|
20505
|
+
* @property {vertexvis.protobuf.stream.IOrthographicCamera|null} [orthographic] Camera orthographic
|
|
19937
20506
|
*/
|
|
19938
20507
|
|
|
19939
20508
|
/**
|
|
@@ -19975,6 +20544,36 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
19975
20544
|
*/
|
|
19976
20545
|
Camera.prototype.up = null;
|
|
19977
20546
|
|
|
20547
|
+
/**
|
|
20548
|
+
* Camera perspective.
|
|
20549
|
+
* @member {vertexvis.protobuf.stream.IPerspectiveCamera|null|undefined} perspective
|
|
20550
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
20551
|
+
* @instance
|
|
20552
|
+
*/
|
|
20553
|
+
Camera.prototype.perspective = null;
|
|
20554
|
+
|
|
20555
|
+
/**
|
|
20556
|
+
* Camera orthographic.
|
|
20557
|
+
* @member {vertexvis.protobuf.stream.IOrthographicCamera|null|undefined} orthographic
|
|
20558
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
20559
|
+
* @instance
|
|
20560
|
+
*/
|
|
20561
|
+
Camera.prototype.orthographic = null;
|
|
20562
|
+
|
|
20563
|
+
// OneOf field names bound to virtual getters and setters
|
|
20564
|
+
let $oneOfFields;
|
|
20565
|
+
|
|
20566
|
+
/**
|
|
20567
|
+
* Camera type.
|
|
20568
|
+
* @member {"perspective"|"orthographic"|undefined} type
|
|
20569
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
20570
|
+
* @instance
|
|
20571
|
+
*/
|
|
20572
|
+
Object.defineProperty(Camera.prototype, "type", {
|
|
20573
|
+
get: $util$1.oneOfGetter($oneOfFields = ["perspective", "orthographic"]),
|
|
20574
|
+
set: $util$1.oneOfSetter($oneOfFields)
|
|
20575
|
+
});
|
|
20576
|
+
|
|
19978
20577
|
/**
|
|
19979
20578
|
* Creates a new Camera instance using the specified properties.
|
|
19980
20579
|
* @function create
|
|
@@ -20005,6 +20604,10 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
20005
20604
|
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.lookAt, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
|
20006
20605
|
if (message.up != null && Object.hasOwnProperty.call(message, "up"))
|
|
20007
20606
|
$root$1.vertexvis.protobuf.core.Vector3f.encode(message.up, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
20607
|
+
if (message.perspective != null && Object.hasOwnProperty.call(message, "perspective"))
|
|
20608
|
+
$root$1.vertexvis.protobuf.stream.PerspectiveCamera.encode(message.perspective, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
|
20609
|
+
if (message.orthographic != null && Object.hasOwnProperty.call(message, "orthographic"))
|
|
20610
|
+
$root$1.vertexvis.protobuf.stream.OrthographicCamera.encode(message.orthographic, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
|
|
20008
20611
|
return writer;
|
|
20009
20612
|
};
|
|
20010
20613
|
|
|
@@ -20048,6 +20651,12 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
20048
20651
|
case 3:
|
|
20049
20652
|
message.up = $root$1.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
20050
20653
|
break;
|
|
20654
|
+
case 4:
|
|
20655
|
+
message.perspective = $root$1.vertexvis.protobuf.stream.PerspectiveCamera.decode(reader, reader.uint32());
|
|
20656
|
+
break;
|
|
20657
|
+
case 5:
|
|
20658
|
+
message.orthographic = $root$1.vertexvis.protobuf.stream.OrthographicCamera.decode(reader, reader.uint32());
|
|
20659
|
+
break;
|
|
20051
20660
|
default:
|
|
20052
20661
|
reader.skipType(tag & 7);
|
|
20053
20662
|
break;
|
|
@@ -20083,6 +20692,7 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
20083
20692
|
Camera.verify = function verify(message) {
|
|
20084
20693
|
if (typeof message !== "object" || message === null)
|
|
20085
20694
|
return "object expected";
|
|
20695
|
+
let properties = {};
|
|
20086
20696
|
if (message.position != null && message.hasOwnProperty("position")) {
|
|
20087
20697
|
let error = $root$1.vertexvis.protobuf.core.Vector3f.verify(message.position);
|
|
20088
20698
|
if (error)
|
|
@@ -20098,6 +20708,24 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
20098
20708
|
if (error)
|
|
20099
20709
|
return "up." + error;
|
|
20100
20710
|
}
|
|
20711
|
+
if (message.perspective != null && message.hasOwnProperty("perspective")) {
|
|
20712
|
+
properties.type = 1;
|
|
20713
|
+
{
|
|
20714
|
+
let error = $root$1.vertexvis.protobuf.stream.PerspectiveCamera.verify(message.perspective);
|
|
20715
|
+
if (error)
|
|
20716
|
+
return "perspective." + error;
|
|
20717
|
+
}
|
|
20718
|
+
}
|
|
20719
|
+
if (message.orthographic != null && message.hasOwnProperty("orthographic")) {
|
|
20720
|
+
if (properties.type === 1)
|
|
20721
|
+
return "type: multiple values";
|
|
20722
|
+
properties.type = 1;
|
|
20723
|
+
{
|
|
20724
|
+
let error = $root$1.vertexvis.protobuf.stream.OrthographicCamera.verify(message.orthographic);
|
|
20725
|
+
if (error)
|
|
20726
|
+
return "orthographic." + error;
|
|
20727
|
+
}
|
|
20728
|
+
}
|
|
20101
20729
|
return null;
|
|
20102
20730
|
};
|
|
20103
20731
|
|
|
@@ -20128,6 +20756,16 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
20128
20756
|
throw TypeError(".vertexvis.protobuf.stream.Camera.up: object expected");
|
|
20129
20757
|
message.up = $root$1.vertexvis.protobuf.core.Vector3f.fromObject(object.up);
|
|
20130
20758
|
}
|
|
20759
|
+
if (object.perspective != null) {
|
|
20760
|
+
if (typeof object.perspective !== "object")
|
|
20761
|
+
throw TypeError(".vertexvis.protobuf.stream.Camera.perspective: object expected");
|
|
20762
|
+
message.perspective = $root$1.vertexvis.protobuf.stream.PerspectiveCamera.fromObject(object.perspective);
|
|
20763
|
+
}
|
|
20764
|
+
if (object.orthographic != null) {
|
|
20765
|
+
if (typeof object.orthographic !== "object")
|
|
20766
|
+
throw TypeError(".vertexvis.protobuf.stream.Camera.orthographic: object expected");
|
|
20767
|
+
message.orthographic = $root$1.vertexvis.protobuf.stream.OrthographicCamera.fromObject(object.orthographic);
|
|
20768
|
+
}
|
|
20131
20769
|
return message;
|
|
20132
20770
|
};
|
|
20133
20771
|
|
|
@@ -20155,6 +20793,16 @@ const vertexvis$1 = $root$1.vertexvis = (() => {
|
|
|
20155
20793
|
object.lookAt = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.lookAt, options);
|
|
20156
20794
|
if (message.up != null && message.hasOwnProperty("up"))
|
|
20157
20795
|
object.up = $root$1.vertexvis.protobuf.core.Vector3f.toObject(message.up, options);
|
|
20796
|
+
if (message.perspective != null && message.hasOwnProperty("perspective")) {
|
|
20797
|
+
object.perspective = $root$1.vertexvis.protobuf.stream.PerspectiveCamera.toObject(message.perspective, options);
|
|
20798
|
+
if (options.oneofs)
|
|
20799
|
+
object.type = "perspective";
|
|
20800
|
+
}
|
|
20801
|
+
if (message.orthographic != null && message.hasOwnProperty("orthographic")) {
|
|
20802
|
+
object.orthographic = $root$1.vertexvis.protobuf.stream.OrthographicCamera.toObject(message.orthographic, options);
|
|
20803
|
+
if (options.oneofs)
|
|
20804
|
+
object.type = "orthographic";
|
|
20805
|
+
}
|
|
20158
20806
|
return object;
|
|
20159
20807
|
};
|
|
20160
20808
|
|
|
@@ -53062,25 +53710,125 @@ const defaultAnimationConfig = {
|
|
|
53062
53710
|
durationMs: DEFAULT_ANIMATION_DURATION,
|
|
53063
53711
|
};
|
|
53064
53712
|
|
|
53065
|
-
function
|
|
53713
|
+
function isPerspectiveFrameCamera(camera) {
|
|
53714
|
+
return (camera.position != null &&
|
|
53715
|
+
camera.fovHeight == null);
|
|
53716
|
+
}
|
|
53717
|
+
function isOrthographicFrameCamera(camera) {
|
|
53718
|
+
const asOrtho = camera;
|
|
53719
|
+
return asOrtho.viewVector != null && asOrtho.fovHeight != null;
|
|
53720
|
+
}
|
|
53721
|
+
function withPositionAndViewVector(camera) {
|
|
53722
|
+
if (isOrthographicFrameCamera(camera)) {
|
|
53723
|
+
return Object.assign(Object.assign({}, camera), { position: vector3.add(camera.lookAt, vector3.negate(camera.viewVector)) });
|
|
53724
|
+
}
|
|
53725
|
+
else {
|
|
53726
|
+
return Object.assign(Object.assign({}, camera), { viewVector: vector3.subtract(camera.lookAt, camera.position) });
|
|
53727
|
+
}
|
|
53728
|
+
}
|
|
53729
|
+
function toOrthographic(data, boundingBox$1) {
|
|
53730
|
+
var _a;
|
|
53731
|
+
const viewVector = vector3.subtract(data.lookAt, data.position);
|
|
53066
53732
|
const boundingBoxCenter = boundingBox.center(boundingBox$1);
|
|
53067
|
-
const cameraToCenter = vector3.subtract(camera.position, boundingBoxCenter);
|
|
53068
53733
|
const centerToBoundingPlane = vector3.subtract(boundingBox$1.max, boundingBoxCenter);
|
|
53069
|
-
const
|
|
53070
|
-
const
|
|
53071
|
-
|
|
53072
|
-
|
|
53073
|
-
|
|
53074
|
-
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53078
|
-
|
|
53734
|
+
const radius = vector3.magnitude(centerToBoundingPlane);
|
|
53735
|
+
const scale = radius / vector3.magnitude(viewVector);
|
|
53736
|
+
return {
|
|
53737
|
+
viewVector: vector3.scale(scale, viewVector),
|
|
53738
|
+
up: data.up,
|
|
53739
|
+
lookAt: data.lookAt,
|
|
53740
|
+
fovHeight: 2 *
|
|
53741
|
+
vector3.magnitude(viewVector) *
|
|
53742
|
+
Math.tan(angle.toRadians(((_a = data.fovY) !== null && _a !== void 0 ? _a : 45) / 2.0)),
|
|
53743
|
+
};
|
|
53744
|
+
}
|
|
53745
|
+
function toPerspective(data, fovY = 45) {
|
|
53746
|
+
const expectedMagnitude = data.fovHeight / (2 * Math.tan(angle.toRadians(fovY / 2.0)));
|
|
53747
|
+
const receivedMagnitude = vector3.magnitude(data.viewVector);
|
|
53748
|
+
const magnitudeScale = expectedMagnitude / receivedMagnitude;
|
|
53749
|
+
return {
|
|
53750
|
+
position: vector3.add(data.lookAt, vector3.negate(vector3.scale(magnitudeScale, data.viewVector))),
|
|
53751
|
+
up: data.up,
|
|
53752
|
+
lookAt: data.lookAt,
|
|
53753
|
+
fovY,
|
|
53754
|
+
};
|
|
53755
|
+
}
|
|
53756
|
+
function toProtobuf(camera) {
|
|
53757
|
+
if (isOrthographicFrameCamera(camera)) {
|
|
53758
|
+
return {
|
|
53759
|
+
orthographic: {
|
|
53760
|
+
viewVector: Object.assign({}, camera.viewVector),
|
|
53761
|
+
lookAt: Object.assign({}, camera.lookAt),
|
|
53762
|
+
up: Object.assign({}, camera.up),
|
|
53763
|
+
fovHeight: camera.fovHeight,
|
|
53764
|
+
},
|
|
53765
|
+
};
|
|
53766
|
+
}
|
|
53767
|
+
else if (isPerspectiveFrameCamera(camera)) {
|
|
53768
|
+
return {
|
|
53769
|
+
perspective: {
|
|
53770
|
+
position: Object.assign({}, camera.position),
|
|
53771
|
+
lookAt: Object.assign({}, camera.lookAt),
|
|
53772
|
+
up: Object.assign({}, camera.up),
|
|
53773
|
+
},
|
|
53774
|
+
position: Object.assign({}, camera.position),
|
|
53775
|
+
lookAt: Object.assign({}, camera.lookAt),
|
|
53776
|
+
up: Object.assign({}, camera.up),
|
|
53777
|
+
};
|
|
53079
53778
|
}
|
|
53080
53779
|
else {
|
|
53081
|
-
|
|
53780
|
+
return Object.assign({}, camera);
|
|
53781
|
+
}
|
|
53782
|
+
}
|
|
53783
|
+
|
|
53784
|
+
function fromBoundingBoxAndLookAtCamera(boundingBox, camera) {
|
|
53785
|
+
return isOrthographicFrameCamera(camera)
|
|
53786
|
+
? fromBoundingBoxAndOrthographicCamera(boundingBox)
|
|
53787
|
+
: fromBoundingBoxAndPerspectiveCamera(boundingBox, camera);
|
|
53788
|
+
}
|
|
53789
|
+
// Logic pulled from https://github.com/Vertexvis/rendering-client-lib-java/blob/master/src/main/java/com/vertexvis/rendering/graphics/PerspectiveCamera.java#L65
|
|
53790
|
+
// and needs to remain in sync with that computation.
|
|
53791
|
+
// TODO: revisit computation of these values in a single location
|
|
53792
|
+
function fromBoundingBoxAndPerspectiveCamera(boundingBox, camera) {
|
|
53793
|
+
const boundingSphere$1 = boundingSphere.create(boundingBox);
|
|
53794
|
+
const minRange = boundingSphere$1.epsilon * 1e2;
|
|
53795
|
+
const signedDistToEye = vector3.dot(vector3.subtract(boundingSphere$1.center, camera.position), vector3.normalize(vector3.subtract(camera.lookAt, camera.position)));
|
|
53796
|
+
const bRadius = Math.max(boundingSphere$1.radius, minRange);
|
|
53797
|
+
let newFar = bRadius + signedDistToEye < minRange
|
|
53798
|
+
? bRadius * 3.0
|
|
53799
|
+
: bRadius + signedDistToEye;
|
|
53800
|
+
let newNear = newFar - bRadius * 2.0 < minRange
|
|
53801
|
+
? Math.min(minRange, newFar)
|
|
53802
|
+
: newFar - bRadius * 2.0;
|
|
53803
|
+
if (newFar - newNear < minRange) {
|
|
53804
|
+
newNear = Math.max(newNear, minRange);
|
|
53805
|
+
newFar += newNear + minRange;
|
|
53806
|
+
}
|
|
53807
|
+
else if (newNear / newFar < 0.0001) {
|
|
53808
|
+
newNear = newFar * 0.0001;
|
|
53809
|
+
}
|
|
53810
|
+
if (newNear > newFar - bRadius * 2.0) {
|
|
53811
|
+
if (newNear > 1000 + minRange) {
|
|
53812
|
+
newFar -= newNear - 1000;
|
|
53813
|
+
newNear = 1000;
|
|
53814
|
+
}
|
|
53082
53815
|
}
|
|
53083
|
-
return {
|
|
53816
|
+
return {
|
|
53817
|
+
near: newNear,
|
|
53818
|
+
far: newFar,
|
|
53819
|
+
};
|
|
53820
|
+
}
|
|
53821
|
+
// Logic pulled from https://github.com/Vertexvis/rendering-client-lib-java/blob/master/src/main/java/com/vertexvis/rendering/graphics/OrthographicCamera.java#L35
|
|
53822
|
+
// and needs to remain in sync with that computation.
|
|
53823
|
+
// TODO: revisit computation of these values in a single location
|
|
53824
|
+
function fromBoundingBoxAndOrthographicCamera(boundingBox, camera) {
|
|
53825
|
+
const boundingSphere$1 = boundingSphere.create(boundingBox);
|
|
53826
|
+
const minRange = boundingSphere$1.epsilon * 1e2;
|
|
53827
|
+
const bRadius = Math.max(boundingSphere$1.radius, minRange);
|
|
53828
|
+
return {
|
|
53829
|
+
near: -bRadius,
|
|
53830
|
+
far: bRadius,
|
|
53831
|
+
};
|
|
53084
53832
|
}
|
|
53085
53833
|
|
|
53086
53834
|
function create$2(data = {}) {
|
|
@@ -53182,6 +53930,13 @@ class InvalidArgumentError extends CustomError {
|
|
|
53182
53930
|
Object.setPrototypeOf(this, InvalidArgumentError.prototype);
|
|
53183
53931
|
}
|
|
53184
53932
|
}
|
|
53933
|
+
class InvalidCameraError extends CustomError {
|
|
53934
|
+
constructor(message, e) {
|
|
53935
|
+
super(message, e);
|
|
53936
|
+
// Allows for `instanceof` checks.
|
|
53937
|
+
Object.setPrototypeOf(this, InvalidCameraError.prototype);
|
|
53938
|
+
}
|
|
53939
|
+
}
|
|
53185
53940
|
|
|
53186
53941
|
function fromUrn(urn) {
|
|
53187
53942
|
const uri$1 = uri.parse(urn);
|
|
@@ -53266,7 +54021,7 @@ class DepthBuffer {
|
|
|
53266
54021
|
/**
|
|
53267
54022
|
* Computes the depth from a 2D point within the coordinate space of the depth
|
|
53268
54023
|
* buffer. The returned depth is a value that's between the near and far plane
|
|
53269
|
-
* of the camera.
|
|
54024
|
+
* of the perspective camera.
|
|
53270
54025
|
*
|
|
53271
54026
|
* @param point A 2D point within the viewport.
|
|
53272
54027
|
* @param fallbackNormalizedDepth A fallback value if the depth is the max
|
|
@@ -53278,6 +54033,21 @@ class DepthBuffer {
|
|
|
53278
54033
|
const depth = this.getNormalizedDepthAtPoint(point, fallbackNormalizedDepth);
|
|
53279
54034
|
return depth * (far - near) + near;
|
|
53280
54035
|
}
|
|
54036
|
+
/**
|
|
54037
|
+
* Computes the depth from a 2D point within the coordinate space of the depth
|
|
54038
|
+
* buffer. The returned depth is a value that's between the near and far plane
|
|
54039
|
+
* of the orthographic camera.
|
|
54040
|
+
*
|
|
54041
|
+
* @param point A 2D point within the viewport.
|
|
54042
|
+
* @param fallbackNormalizedDepth A fallback value if the depth is the max
|
|
54043
|
+
* depth value, or cannot be determined.
|
|
54044
|
+
* @returns A depth between the near and far plane.
|
|
54045
|
+
*/
|
|
54046
|
+
getOrthographicDepthAtPoint(point, fallbackNormalizedDepth) {
|
|
54047
|
+
const { near, far } = this.camera;
|
|
54048
|
+
const depth = this.getNormalizedDepthAtPoint(point, fallbackNormalizedDepth);
|
|
54049
|
+
return depth * (far - near) + near / 2;
|
|
54050
|
+
}
|
|
53281
54051
|
/**
|
|
53282
54052
|
* Computes a depth from a 2D point within the coordinate space of the frame.
|
|
53283
54053
|
* The returned depth is a normalized value (`[0, 1]`) between the near and
|
|
@@ -53318,7 +54088,7 @@ class DepthBuffer {
|
|
|
53318
54088
|
return this.getNormalizedDepthAtPoint(point) < 1;
|
|
53319
54089
|
}
|
|
53320
54090
|
/**
|
|
53321
|
-
* Computes a 3D point in world space coordinates from the depth value at the
|
|
54091
|
+
* Computes a 3D point in perspective world space coordinates from the depth value at the
|
|
53322
54092
|
* given pixel and ray.
|
|
53323
54093
|
*
|
|
53324
54094
|
* @param point A pixel to use for reading a depth value.
|
|
@@ -53338,6 +54108,20 @@ class DepthBuffer {
|
|
|
53338
54108
|
(vector3.magnitude(vv) * vector3.magnitude(eyeToWorldPt));
|
|
53339
54109
|
return ray.at(ray$1, distance / angle);
|
|
53340
54110
|
}
|
|
54111
|
+
/**
|
|
54112
|
+
* Computes a 3D point in orthographic world space coordinates from the depth value at the
|
|
54113
|
+
* given pixel and ray.
|
|
54114
|
+
*
|
|
54115
|
+
* @param point A pixel to use for reading a depth value.
|
|
54116
|
+
* @param ray A ray that specifies the origin and direction.
|
|
54117
|
+
* @param fallbackNormalizedDepth A fallback value if the depth is the max
|
|
54118
|
+
* depth value, or cannot be determined.
|
|
54119
|
+
* @returns A point in world space coordinates.
|
|
54120
|
+
*/
|
|
54121
|
+
getOrthographicWorldPoint(point, ray$1, fallbackNormalizedDepth) {
|
|
54122
|
+
const distance = this.getOrthographicDepthAtPoint(point, fallbackNormalizedDepth);
|
|
54123
|
+
return ray.at(ray$1, distance);
|
|
54124
|
+
}
|
|
53341
54125
|
/**
|
|
53342
54126
|
* Returns `true` if the given point in world space is occluded by any
|
|
53343
54127
|
* geometry.
|
|
@@ -53529,6 +54313,12 @@ const decodePng = async (bytes) => {
|
|
|
53529
54313
|
// Prefetch the worker and initialize the pool.
|
|
53530
54314
|
getPool();
|
|
53531
54315
|
|
|
54316
|
+
function constrainViewVector(viewVector, boundingSphere) {
|
|
54317
|
+
const magnitude = vector3.magnitude(viewVector);
|
|
54318
|
+
const scale = boundingSphere.radius / magnitude;
|
|
54319
|
+
return vector3.scale(scale, viewVector);
|
|
54320
|
+
}
|
|
54321
|
+
|
|
53532
54322
|
class Frame {
|
|
53533
54323
|
constructor(correlationIds, sequenceNumber, dimensions, image, scene, depthBufferBytes, featureMapBytes) {
|
|
53534
54324
|
this.correlationIds = correlationIds;
|
|
@@ -53581,19 +54371,14 @@ class FrameScene {
|
|
|
53581
54371
|
this.hasChanged = hasChanged;
|
|
53582
54372
|
}
|
|
53583
54373
|
}
|
|
53584
|
-
class
|
|
53585
|
-
constructor(position, lookAt, up, near, far, aspectRatio
|
|
54374
|
+
class FrameCameraBase {
|
|
54375
|
+
constructor(position, lookAt, up, near, far, aspectRatio) {
|
|
53586
54376
|
this.position = position;
|
|
53587
54377
|
this.lookAt = lookAt;
|
|
53588
54378
|
this.up = up;
|
|
53589
54379
|
this.near = near;
|
|
53590
54380
|
this.far = far;
|
|
53591
54381
|
this.aspectRatio = aspectRatio;
|
|
53592
|
-
this.fovY = fovY;
|
|
53593
|
-
}
|
|
53594
|
-
static fromBoundingBox(camera, boundingBox, aspectRatio) {
|
|
53595
|
-
const { near, far } = fromBoundingBoxAndLookAtCamera(boundingBox, camera);
|
|
53596
|
-
return new FramePerspectiveCamera(camera.position, camera.lookAt, camera.up, near, far, aspectRatio, 45);
|
|
53597
54382
|
}
|
|
53598
54383
|
get direction() {
|
|
53599
54384
|
return vector3.normalize(this.viewVector);
|
|
@@ -53616,22 +54401,29 @@ class FramePerspectiveCamera {
|
|
|
53616
54401
|
get projectionViewMatrix() {
|
|
53617
54402
|
return this.computeCameraMatrices().projectionViewMatrix;
|
|
53618
54403
|
}
|
|
53619
|
-
|
|
53620
|
-
|
|
53621
|
-
|
|
53622
|
-
|
|
53623
|
-
|
|
53624
|
-
|
|
53625
|
-
|
|
53626
|
-
this.cameraMatrices = {
|
|
53627
|
-
viewMatrix,
|
|
53628
|
-
worldMatrix,
|
|
53629
|
-
projectionMatrix,
|
|
53630
|
-
projectionMatrixInverse,
|
|
53631
|
-
projectionViewMatrix,
|
|
53632
|
-
};
|
|
54404
|
+
get frustumProjectionViewMatrix() {
|
|
54405
|
+
return this.computeCameraMatrices().projectionViewMatrix;
|
|
54406
|
+
}
|
|
54407
|
+
static fromBoundingBox(camera, boundingBox, aspectRatio) {
|
|
54408
|
+
const { near, far } = fromBoundingBoxAndLookAtCamera(boundingBox, camera);
|
|
54409
|
+
if (isOrthographicFrameCamera(camera)) {
|
|
54410
|
+
return new FrameOrthographicCamera(constrainViewVector(camera.viewVector, boundingSphere.create(boundingBox)), camera.lookAt, camera.up, near, far, aspectRatio, camera.fovHeight);
|
|
53633
54411
|
}
|
|
53634
|
-
|
|
54412
|
+
else {
|
|
54413
|
+
return new FramePerspectiveCamera(camera.position, camera.lookAt, camera.up, near, far, aspectRatio, 45);
|
|
54414
|
+
}
|
|
54415
|
+
}
|
|
54416
|
+
/**
|
|
54417
|
+
* Returns whether this `FrameCameraBase` is an orthographic camera.
|
|
54418
|
+
*/
|
|
54419
|
+
isOrthographic() {
|
|
54420
|
+
return false;
|
|
54421
|
+
}
|
|
54422
|
+
/**
|
|
54423
|
+
* Returns whether this `FrameCameraBase` is a perspective camera.
|
|
54424
|
+
*/
|
|
54425
|
+
isPerspective() {
|
|
54426
|
+
return false;
|
|
53635
54427
|
}
|
|
53636
54428
|
/**
|
|
53637
54429
|
* Checks if the given point, in world space, is behind the near plane
|
|
@@ -53662,6 +54454,111 @@ class FramePerspectiveCamera {
|
|
|
53662
54454
|
const pt = plane.intersectLine(nearP, vl);
|
|
53663
54455
|
return pt != null ? vector3.add(pt, position) : undefined;
|
|
53664
54456
|
}
|
|
54457
|
+
computeCameraMatrices() {
|
|
54458
|
+
if (this.cameraMatrices == null) {
|
|
54459
|
+
return {
|
|
54460
|
+
viewMatrix: matrix4.makeIdentity(),
|
|
54461
|
+
worldMatrix: matrix4.makeIdentity(),
|
|
54462
|
+
projectionMatrix: matrix4.makeIdentity(),
|
|
54463
|
+
projectionMatrixInverse: matrix4.makeIdentity(),
|
|
54464
|
+
projectionViewMatrix: matrix4.makeIdentity(),
|
|
54465
|
+
};
|
|
54466
|
+
}
|
|
54467
|
+
return this.cameraMatrices;
|
|
54468
|
+
}
|
|
54469
|
+
updateCameraMatrices(cameraMatrices) {
|
|
54470
|
+
this.cameraMatrices = cameraMatrices;
|
|
54471
|
+
return this.cameraMatrices;
|
|
54472
|
+
}
|
|
54473
|
+
}
|
|
54474
|
+
class FramePerspectiveCamera extends FrameCameraBase {
|
|
54475
|
+
constructor(position, lookAt, up, near, far, aspectRatio, fovY = 45) {
|
|
54476
|
+
super(position, lookAt, up, near, far, aspectRatio);
|
|
54477
|
+
this.position = position;
|
|
54478
|
+
this.lookAt = lookAt;
|
|
54479
|
+
this.up = up;
|
|
54480
|
+
this.near = near;
|
|
54481
|
+
this.far = far;
|
|
54482
|
+
this.aspectRatio = aspectRatio;
|
|
54483
|
+
this.fovY = fovY;
|
|
54484
|
+
}
|
|
54485
|
+
/**
|
|
54486
|
+
* Converts this `FramePerspectiveCamera` to a `FrameOrthographicCamera` using
|
|
54487
|
+
* the provided `boundingBox` to compute the viewing frustum.
|
|
54488
|
+
*
|
|
54489
|
+
* @param boundingBox The visible bounding box.
|
|
54490
|
+
*/
|
|
54491
|
+
toOrthographic(boundingBox) {
|
|
54492
|
+
return FrameCameraBase.fromBoundingBox(toOrthographic(this, boundingBox), boundingBox, this.aspectRatio);
|
|
54493
|
+
}
|
|
54494
|
+
isPerspective() {
|
|
54495
|
+
return true;
|
|
54496
|
+
}
|
|
54497
|
+
computeCameraMatrices() {
|
|
54498
|
+
if (this.cameraMatrices == null) {
|
|
54499
|
+
const viewMatrix = matrix4.makeLookAtView(this.position, this.lookAt, this.up);
|
|
54500
|
+
const worldMatrix = matrix4.invert(viewMatrix);
|
|
54501
|
+
const projectionMatrix = matrix4.makePerspective(this.near, this.far, this.fovY, this.aspectRatio);
|
|
54502
|
+
const projectionMatrixInverse = matrix4.invert(projectionMatrix);
|
|
54503
|
+
const projectionViewMatrix = matrix4.multiply(projectionMatrix, viewMatrix);
|
|
54504
|
+
return super.updateCameraMatrices({
|
|
54505
|
+
viewMatrix,
|
|
54506
|
+
worldMatrix,
|
|
54507
|
+
projectionMatrix,
|
|
54508
|
+
projectionMatrixInverse,
|
|
54509
|
+
projectionViewMatrix,
|
|
54510
|
+
});
|
|
54511
|
+
}
|
|
54512
|
+
return this.cameraMatrices;
|
|
54513
|
+
}
|
|
54514
|
+
}
|
|
54515
|
+
class FrameOrthographicCamera extends FrameCameraBase {
|
|
54516
|
+
constructor(viewVector, lookAt, up, near, far, aspectRatio, fovHeight) {
|
|
54517
|
+
super(vector3.add(lookAt, vector3.negate(viewVector)), lookAt, up, near, far, aspectRatio);
|
|
54518
|
+
this.lookAt = lookAt;
|
|
54519
|
+
this.up = up;
|
|
54520
|
+
this.near = near;
|
|
54521
|
+
this.far = far;
|
|
54522
|
+
this.aspectRatio = aspectRatio;
|
|
54523
|
+
this.fovHeight = fovHeight;
|
|
54524
|
+
this.top = fovHeight * 0.5;
|
|
54525
|
+
this.bottom = -this.top;
|
|
54526
|
+
this.right = this.top * aspectRatio;
|
|
54527
|
+
this.left = -this.right;
|
|
54528
|
+
}
|
|
54529
|
+
/**
|
|
54530
|
+
* Converts this `FrameOrthographicCamera` to a `FramePerspectiveCamera` using
|
|
54531
|
+
* the provided `boundingBox` to compute the near and far clipping planes.
|
|
54532
|
+
*
|
|
54533
|
+
* @param boundingBox The visible bounding box.
|
|
54534
|
+
*/
|
|
54535
|
+
toPerspective(boundingBox) {
|
|
54536
|
+
return FrameCameraBase.fromBoundingBox(toPerspective(this), boundingBox, this.aspectRatio);
|
|
54537
|
+
}
|
|
54538
|
+
isOrthographic() {
|
|
54539
|
+
return true;
|
|
54540
|
+
}
|
|
54541
|
+
get frustumProjectionViewMatrix() {
|
|
54542
|
+
const frustumProjectionMatrix = matrix4.makeFrustum(this.left, this.right, this.top, this.bottom, this.near, this.far);
|
|
54543
|
+
return matrix4.multiply(frustumProjectionMatrix, this.computeCameraMatrices().viewMatrix);
|
|
54544
|
+
}
|
|
54545
|
+
computeCameraMatrices() {
|
|
54546
|
+
if (this.cameraMatrices == null) {
|
|
54547
|
+
const viewMatrix = matrix4.makeLookAtView(this.position, this.lookAt, this.up);
|
|
54548
|
+
const worldMatrix = matrix4.invert(viewMatrix);
|
|
54549
|
+
const projectionMatrix = matrix4.makeOrthographic(this.left, this.right, this.bottom, this.top, this.near, this.far);
|
|
54550
|
+
const projectionMatrixInverse = matrix4.invert(projectionMatrix);
|
|
54551
|
+
const projectionViewMatrix = matrix4.multiply(projectionMatrix, viewMatrix);
|
|
54552
|
+
return super.updateCameraMatrices({
|
|
54553
|
+
viewMatrix,
|
|
54554
|
+
worldMatrix,
|
|
54555
|
+
projectionMatrix,
|
|
54556
|
+
projectionMatrixInverse,
|
|
54557
|
+
projectionViewMatrix,
|
|
54558
|
+
});
|
|
54559
|
+
}
|
|
54560
|
+
return this.cameraMatrices;
|
|
54561
|
+
}
|
|
53665
54562
|
}
|
|
53666
54563
|
|
|
53667
54564
|
class ArrowMarkup {
|
|
@@ -54497,7 +55394,7 @@ class Viewport {
|
|
|
54497
55394
|
return point.scale(pt, 1 / scaleX, 1 / scaleY);
|
|
54498
55395
|
}
|
|
54499
55396
|
/**
|
|
54500
|
-
* Transforms a point in viewport coordinates to a point in world space
|
|
55397
|
+
* Transforms a point in viewport coordinates to a point in perspective world space
|
|
54501
55398
|
* coordinates. This method expects a depth buffer in order to compute a value
|
|
54502
55399
|
* for the Z axis.
|
|
54503
55400
|
*
|
|
@@ -54512,6 +55409,21 @@ class Viewport {
|
|
|
54512
55409
|
const ray = this.transformPointToRay(pt, depthBuffer, depthBuffer.camera);
|
|
54513
55410
|
return depthBuffer.getWorldPoint(depthPt, ray, fallbackNormalizedDepth);
|
|
54514
55411
|
}
|
|
55412
|
+
/**
|
|
55413
|
+
* Transforms a point in viewport coordinates to a point in orthographic world space
|
|
55414
|
+
* coordinates. This method expects a depth buffer in order to compute a value
|
|
55415
|
+
* for the Z axis.
|
|
55416
|
+
*
|
|
55417
|
+
* @param pt A point in viewport coordinates.
|
|
55418
|
+
* @param depthBuffer A depth buffer for computing the Z axis.
|
|
55419
|
+
* @param fallbackNormalizedDepth A fallback value if the depth is the max
|
|
55420
|
+
* depth value, or cannot be determined.
|
|
55421
|
+
*/
|
|
55422
|
+
transformPointToOrthographicWorldSpace(pt, depthBuffer, fallbackNormalizedDepth) {
|
|
55423
|
+
const depthPt = this.transformPointToFrame(pt, depthBuffer);
|
|
55424
|
+
const ray = this.transformPointToOrthographicRay(pt, depthBuffer, depthBuffer.camera);
|
|
55425
|
+
return depthBuffer.getOrthographicWorldPoint(depthPt, ray, fallbackNormalizedDepth);
|
|
55426
|
+
}
|
|
54515
55427
|
/**
|
|
54516
55428
|
* Transforms a point in viewport coordinates to a ray. The returned ray will
|
|
54517
55429
|
* have an origin that is at the position of the camera with a direction that
|
|
@@ -54529,6 +55441,23 @@ class Viewport {
|
|
|
54529
55441
|
const direction = vector3.normalize(vector3.subtract(world, origin));
|
|
54530
55442
|
return ray.create({ origin, direction });
|
|
54531
55443
|
}
|
|
55444
|
+
/**
|
|
55445
|
+
* Transforms a point in viewport coordinates to a ray. The returned ray will
|
|
55446
|
+
* have an origin that is at the world point of viewport coordinate with a direction that
|
|
55447
|
+
* is pointing into world space away from the camera.
|
|
55448
|
+
*
|
|
55449
|
+
* @param pt A point in viewport coordinates.
|
|
55450
|
+
* @param image An image of a frame.
|
|
55451
|
+
* @param camera A camera used to determine orientation of the scene.
|
|
55452
|
+
*/
|
|
55453
|
+
transformPointToOrthographicRay(pt, image, camera) {
|
|
55454
|
+
const ndc = this.transformScreenPointToNdc(pt, image);
|
|
55455
|
+
const world = vector3.transformNdcToWorldSpace(vector3.create(ndc.x, ndc.y, 0.5), camera.worldMatrix, camera.projectionMatrixInverse);
|
|
55456
|
+
return ray.create({
|
|
55457
|
+
origin: world,
|
|
55458
|
+
direction: vector3.normalize(camera.viewVector),
|
|
55459
|
+
});
|
|
55460
|
+
}
|
|
54532
55461
|
/**
|
|
54533
55462
|
* Maps a screen point to normalized device coordinates (NDC). A screen point
|
|
54534
55463
|
* at 0,0 represents the top-left of the viewport.
|
|
@@ -54600,7 +55529,29 @@ function fromPbScalarWrapper() {
|
|
|
54600
55529
|
return mapper.defineMapper((value) => (value === null || value === void 0 ? void 0 : value.value) || undefined, (value) => value);
|
|
54601
55530
|
}
|
|
54602
55531
|
|
|
54603
|
-
const
|
|
55532
|
+
const fromPbPerspectiveCamera = mapper.defineMapper(mapper.read(mapper.mapProp('position', mapper.compose(mapper.required('position'), fromPbVector3f)), mapper.mapProp('lookAt', mapper.compose(mapper.required('lookAt'), fromPbVector3f)), mapper.mapProp('up', mapper.compose(mapper.required('up'), fromPbVector3f))), ([position, lookAt, up]) => ({
|
|
55533
|
+
position,
|
|
55534
|
+
lookAt,
|
|
55535
|
+
up,
|
|
55536
|
+
// TODO: map fovY property when available
|
|
55537
|
+
fovY: 45,
|
|
55538
|
+
}));
|
|
55539
|
+
const fromPbOrthographicCamera = mapper.defineMapper(mapper.read(mapper.mapProp('viewVector', mapper.compose(mapper.required('viewVector'), fromPbVector3f)), mapper.mapProp('lookAt', mapper.compose(mapper.required('lookAt'), fromPbVector3f)), mapper.mapProp('up', mapper.compose(mapper.required('up'), fromPbVector3f)), mapper.mapProp('fovHeight', mapper.required('fovHeight'))), ([viewVector, lookAt, up, fovHeight]) => ({
|
|
55540
|
+
viewVector,
|
|
55541
|
+
lookAt,
|
|
55542
|
+
up,
|
|
55543
|
+
fovHeight,
|
|
55544
|
+
}));
|
|
55545
|
+
const fromPbCamera = mapper.defineMapper(mapper.read(mapper.mapProp('position', mapper.ifDefined(fromPbVector3f)), mapper.mapProp('lookAt', mapper.ifDefined(fromPbVector3f)), mapper.mapProp('up', mapper.ifDefined(fromPbVector3f)), mapper.mapProp('perspective', mapper.ifDefined(fromPbPerspectiveCamera)), mapper.mapProp('orthographic', mapper.ifDefined(fromPbOrthographicCamera))), ([position, lookAt, up, perspective, orthographic]) => {
|
|
55546
|
+
var _a;
|
|
55547
|
+
return (_a = perspective !== null && perspective !== void 0 ? perspective : orthographic) !== null && _a !== void 0 ? _a : {
|
|
55548
|
+
position: position !== null && position !== void 0 ? position : vector3.back(),
|
|
55549
|
+
lookAt: lookAt !== null && lookAt !== void 0 ? lookAt : vector3.origin(),
|
|
55550
|
+
up: up !== null && up !== void 0 ? up : vector3.up(),
|
|
55551
|
+
// TODO: map fovY property when available
|
|
55552
|
+
fovY: 45,
|
|
55553
|
+
};
|
|
55554
|
+
});
|
|
54604
55555
|
const fromPbSectionPlane = mapper.defineMapper(mapper.read(mapper.mapProp('normal', mapper.compose(mapper.required('normal'), fromPbVector3f)), mapper.requiredProp('offset')), ([normal, offset]) => ({ normal, offset }));
|
|
54605
55556
|
const fromPbImageAttributes = mapper.defineMapper(mapper.read(mapper.mapProp('frameDimensions', mapper.compose(mapper.required('frameDimensions'), fromPbDim)), mapper.mapProp('imageRect', mapper.compose(mapper.required('imageRect'), fromPbRect)), mapper.mapProp('scaleFactor', mapper.required('scaleFactor'))), ([frameDimensions, imageRect, imageScale]) => ({
|
|
54606
55557
|
frameDimensions,
|
|
@@ -54620,7 +55571,7 @@ const fromPbSceneAttributes = mapper.defineMapper(mapper.read(mapper.mapProp('ca
|
|
|
54620
55571
|
hasChanged,
|
|
54621
55572
|
}));
|
|
54622
55573
|
const fromPbFrameSceneAttributes = mapper.defineMapper(mapper.read(mapper.mapProp('sceneAttributes', mapper.compose(mapper.required('sceneAttributes'), fromPbSceneAttributes))), ([sceneAttr]) => sceneAttr);
|
|
54623
|
-
const fromPbFrameCamera = mapper.defineMapper(mapper.read(fromPbFrameSceneAttributes, fromPbFrameImageAttributes), ([sceneAttr, imageAttr]) =>
|
|
55574
|
+
const fromPbFrameCamera = mapper.defineMapper(mapper.read(fromPbFrameSceneAttributes, fromPbFrameImageAttributes), ([sceneAttr, imageAttr]) => FrameCameraBase.fromBoundingBox(sceneAttr.camera, sceneAttr.boundingBox, dimensions.aspectRatio(imageAttr.frameDimensions)));
|
|
54624
55575
|
function fromPbFrameScene(worldOrientation) {
|
|
54625
55576
|
return mapper.defineMapper(mapper.read(fromPbFrameSceneAttributes, fromPbFrameCamera), ([sceneAttr, camera]) => new FrameScene(camera, sceneAttr.boundingBox, sceneAttr.crossSectioning, worldOrientation, sceneAttr.hasChanged));
|
|
54626
55577
|
}
|
|
@@ -57325,26 +58276,26 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57325
58276
|
*/
|
|
57326
58277
|
const stream = {};
|
|
57327
58278
|
|
|
57328
|
-
stream.
|
|
58279
|
+
stream.PerspectiveCamera = (function() {
|
|
57329
58280
|
|
|
57330
58281
|
/**
|
|
57331
|
-
* Properties of a
|
|
58282
|
+
* Properties of a PerspectiveCamera.
|
|
57332
58283
|
* @memberof vertexvis.protobuf.stream
|
|
57333
|
-
* @interface
|
|
57334
|
-
* @property {vertexvis.protobuf.core.IVector3f|null} [position]
|
|
57335
|
-
* @property {vertexvis.protobuf.core.IVector3f|null} [lookAt]
|
|
57336
|
-
* @property {vertexvis.protobuf.core.IVector3f|null} [up]
|
|
58284
|
+
* @interface IPerspectiveCamera
|
|
58285
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [position] PerspectiveCamera position
|
|
58286
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [lookAt] PerspectiveCamera lookAt
|
|
58287
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [up] PerspectiveCamera up
|
|
57337
58288
|
*/
|
|
57338
58289
|
|
|
57339
58290
|
/**
|
|
57340
|
-
* Constructs a new
|
|
58291
|
+
* Constructs a new PerspectiveCamera.
|
|
57341
58292
|
* @memberof vertexvis.protobuf.stream
|
|
57342
|
-
* @classdesc Represents a
|
|
57343
|
-
* @implements
|
|
58293
|
+
* @classdesc Represents a PerspectiveCamera.
|
|
58294
|
+
* @implements IPerspectiveCamera
|
|
57344
58295
|
* @constructor
|
|
57345
|
-
* @param {vertexvis.protobuf.stream.
|
|
58296
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera=} [properties] Properties to set
|
|
57346
58297
|
*/
|
|
57347
|
-
function
|
|
58298
|
+
function PerspectiveCamera(properties) {
|
|
57348
58299
|
if (properties)
|
|
57349
58300
|
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
57350
58301
|
if (properties[keys[i]] != null)
|
|
@@ -57352,51 +58303,51 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57352
58303
|
}
|
|
57353
58304
|
|
|
57354
58305
|
/**
|
|
57355
|
-
*
|
|
58306
|
+
* PerspectiveCamera position.
|
|
57356
58307
|
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} position
|
|
57357
|
-
* @memberof vertexvis.protobuf.stream.
|
|
58308
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
57358
58309
|
* @instance
|
|
57359
58310
|
*/
|
|
57360
|
-
|
|
58311
|
+
PerspectiveCamera.prototype.position = null;
|
|
57361
58312
|
|
|
57362
58313
|
/**
|
|
57363
|
-
*
|
|
58314
|
+
* PerspectiveCamera lookAt.
|
|
57364
58315
|
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} lookAt
|
|
57365
|
-
* @memberof vertexvis.protobuf.stream.
|
|
58316
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
57366
58317
|
* @instance
|
|
57367
58318
|
*/
|
|
57368
|
-
|
|
58319
|
+
PerspectiveCamera.prototype.lookAt = null;
|
|
57369
58320
|
|
|
57370
58321
|
/**
|
|
57371
|
-
*
|
|
58322
|
+
* PerspectiveCamera up.
|
|
57372
58323
|
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} up
|
|
57373
|
-
* @memberof vertexvis.protobuf.stream.
|
|
58324
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
57374
58325
|
* @instance
|
|
57375
58326
|
*/
|
|
57376
|
-
|
|
58327
|
+
PerspectiveCamera.prototype.up = null;
|
|
57377
58328
|
|
|
57378
58329
|
/**
|
|
57379
|
-
* Creates a new
|
|
58330
|
+
* Creates a new PerspectiveCamera instance using the specified properties.
|
|
57380
58331
|
* @function create
|
|
57381
|
-
* @memberof vertexvis.protobuf.stream.
|
|
58332
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
57382
58333
|
* @static
|
|
57383
|
-
* @param {vertexvis.protobuf.stream.
|
|
57384
|
-
* @returns {vertexvis.protobuf.stream.
|
|
58334
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera=} [properties] Properties to set
|
|
58335
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera instance
|
|
57385
58336
|
*/
|
|
57386
|
-
|
|
57387
|
-
return new
|
|
58337
|
+
PerspectiveCamera.create = function create(properties) {
|
|
58338
|
+
return new PerspectiveCamera(properties);
|
|
57388
58339
|
};
|
|
57389
58340
|
|
|
57390
58341
|
/**
|
|
57391
|
-
* Encodes the specified
|
|
58342
|
+
* Encodes the specified PerspectiveCamera message. Does not implicitly {@link vertexvis.protobuf.stream.PerspectiveCamera.verify|verify} messages.
|
|
57392
58343
|
* @function encode
|
|
57393
|
-
* @memberof vertexvis.protobuf.stream.
|
|
58344
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
57394
58345
|
* @static
|
|
57395
|
-
* @param {vertexvis.protobuf.stream.
|
|
58346
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera} message PerspectiveCamera message or plain object to encode
|
|
57396
58347
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
57397
58348
|
* @returns {$protobuf.Writer} Writer
|
|
57398
58349
|
*/
|
|
57399
|
-
|
|
58350
|
+
PerspectiveCamera.encode = function encode(message, writer) {
|
|
57400
58351
|
if (!writer)
|
|
57401
58352
|
writer = $Writer.create();
|
|
57402
58353
|
if (message.position != null && Object.hasOwnProperty.call(message, "position"))
|
|
@@ -57409,33 +58360,33 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57409
58360
|
};
|
|
57410
58361
|
|
|
57411
58362
|
/**
|
|
57412
|
-
* Encodes the specified
|
|
58363
|
+
* Encodes the specified PerspectiveCamera message, length delimited. Does not implicitly {@link vertexvis.protobuf.stream.PerspectiveCamera.verify|verify} messages.
|
|
57413
58364
|
* @function encodeDelimited
|
|
57414
|
-
* @memberof vertexvis.protobuf.stream.
|
|
58365
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
57415
58366
|
* @static
|
|
57416
|
-
* @param {vertexvis.protobuf.stream.
|
|
58367
|
+
* @param {vertexvis.protobuf.stream.IPerspectiveCamera} message PerspectiveCamera message or plain object to encode
|
|
57417
58368
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
57418
58369
|
* @returns {$protobuf.Writer} Writer
|
|
57419
58370
|
*/
|
|
57420
|
-
|
|
58371
|
+
PerspectiveCamera.encodeDelimited = function encodeDelimited(message, writer) {
|
|
57421
58372
|
return this.encode(message, writer).ldelim();
|
|
57422
58373
|
};
|
|
57423
58374
|
|
|
57424
58375
|
/**
|
|
57425
|
-
* Decodes a
|
|
58376
|
+
* Decodes a PerspectiveCamera message from the specified reader or buffer.
|
|
57426
58377
|
* @function decode
|
|
57427
|
-
* @memberof vertexvis.protobuf.stream.
|
|
58378
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
57428
58379
|
* @static
|
|
57429
58380
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
57430
58381
|
* @param {number} [length] Message length if known beforehand
|
|
57431
|
-
* @returns {vertexvis.protobuf.stream.
|
|
58382
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera
|
|
57432
58383
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
57433
58384
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
57434
58385
|
*/
|
|
57435
|
-
|
|
58386
|
+
PerspectiveCamera.decode = function decode(reader, length) {
|
|
57436
58387
|
if (!(reader instanceof $Reader))
|
|
57437
58388
|
reader = $Reader.create(reader);
|
|
57438
|
-
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.vertexvis.protobuf.stream.
|
|
58389
|
+
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.vertexvis.protobuf.stream.PerspectiveCamera();
|
|
57439
58390
|
while (reader.pos < end) {
|
|
57440
58391
|
let tag = reader.uint32();
|
|
57441
58392
|
switch (tag >>> 3) {
|
|
@@ -57456,6 +58407,564 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57456
58407
|
return message;
|
|
57457
58408
|
};
|
|
57458
58409
|
|
|
58410
|
+
/**
|
|
58411
|
+
* Decodes a PerspectiveCamera message from the specified reader or buffer, length delimited.
|
|
58412
|
+
* @function decodeDelimited
|
|
58413
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
58414
|
+
* @static
|
|
58415
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
58416
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera
|
|
58417
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
58418
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
58419
|
+
*/
|
|
58420
|
+
PerspectiveCamera.decodeDelimited = function decodeDelimited(reader) {
|
|
58421
|
+
if (!(reader instanceof $Reader))
|
|
58422
|
+
reader = new $Reader(reader);
|
|
58423
|
+
return this.decode(reader, reader.uint32());
|
|
58424
|
+
};
|
|
58425
|
+
|
|
58426
|
+
/**
|
|
58427
|
+
* Verifies a PerspectiveCamera message.
|
|
58428
|
+
* @function verify
|
|
58429
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
58430
|
+
* @static
|
|
58431
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
58432
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
58433
|
+
*/
|
|
58434
|
+
PerspectiveCamera.verify = function verify(message) {
|
|
58435
|
+
if (typeof message !== "object" || message === null)
|
|
58436
|
+
return "object expected";
|
|
58437
|
+
if (message.position != null && message.hasOwnProperty("position")) {
|
|
58438
|
+
let error = $root.vertexvis.protobuf.core.Vector3f.verify(message.position);
|
|
58439
|
+
if (error)
|
|
58440
|
+
return "position." + error;
|
|
58441
|
+
}
|
|
58442
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt")) {
|
|
58443
|
+
let error = $root.vertexvis.protobuf.core.Vector3f.verify(message.lookAt);
|
|
58444
|
+
if (error)
|
|
58445
|
+
return "lookAt." + error;
|
|
58446
|
+
}
|
|
58447
|
+
if (message.up != null && message.hasOwnProperty("up")) {
|
|
58448
|
+
let error = $root.vertexvis.protobuf.core.Vector3f.verify(message.up);
|
|
58449
|
+
if (error)
|
|
58450
|
+
return "up." + error;
|
|
58451
|
+
}
|
|
58452
|
+
return null;
|
|
58453
|
+
};
|
|
58454
|
+
|
|
58455
|
+
/**
|
|
58456
|
+
* Creates a PerspectiveCamera message from a plain object. Also converts values to their respective internal types.
|
|
58457
|
+
* @function fromObject
|
|
58458
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
58459
|
+
* @static
|
|
58460
|
+
* @param {Object.<string,*>} object Plain object
|
|
58461
|
+
* @returns {vertexvis.protobuf.stream.PerspectiveCamera} PerspectiveCamera
|
|
58462
|
+
*/
|
|
58463
|
+
PerspectiveCamera.fromObject = function fromObject(object) {
|
|
58464
|
+
if (object instanceof $root.vertexvis.protobuf.stream.PerspectiveCamera)
|
|
58465
|
+
return object;
|
|
58466
|
+
let message = new $root.vertexvis.protobuf.stream.PerspectiveCamera();
|
|
58467
|
+
if (object.position != null) {
|
|
58468
|
+
if (typeof object.position !== "object")
|
|
58469
|
+
throw TypeError(".vertexvis.protobuf.stream.PerspectiveCamera.position: object expected");
|
|
58470
|
+
message.position = $root.vertexvis.protobuf.core.Vector3f.fromObject(object.position);
|
|
58471
|
+
}
|
|
58472
|
+
if (object.lookAt != null) {
|
|
58473
|
+
if (typeof object.lookAt !== "object")
|
|
58474
|
+
throw TypeError(".vertexvis.protobuf.stream.PerspectiveCamera.lookAt: object expected");
|
|
58475
|
+
message.lookAt = $root.vertexvis.protobuf.core.Vector3f.fromObject(object.lookAt);
|
|
58476
|
+
}
|
|
58477
|
+
if (object.up != null) {
|
|
58478
|
+
if (typeof object.up !== "object")
|
|
58479
|
+
throw TypeError(".vertexvis.protobuf.stream.PerspectiveCamera.up: object expected");
|
|
58480
|
+
message.up = $root.vertexvis.protobuf.core.Vector3f.fromObject(object.up);
|
|
58481
|
+
}
|
|
58482
|
+
return message;
|
|
58483
|
+
};
|
|
58484
|
+
|
|
58485
|
+
/**
|
|
58486
|
+
* Creates a plain object from a PerspectiveCamera message. Also converts values to other types if specified.
|
|
58487
|
+
* @function toObject
|
|
58488
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
58489
|
+
* @static
|
|
58490
|
+
* @param {vertexvis.protobuf.stream.PerspectiveCamera} message PerspectiveCamera
|
|
58491
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
58492
|
+
* @returns {Object.<string,*>} Plain object
|
|
58493
|
+
*/
|
|
58494
|
+
PerspectiveCamera.toObject = function toObject(message, options) {
|
|
58495
|
+
if (!options)
|
|
58496
|
+
options = {};
|
|
58497
|
+
let object = {};
|
|
58498
|
+
if (options.defaults) {
|
|
58499
|
+
object.position = null;
|
|
58500
|
+
object.lookAt = null;
|
|
58501
|
+
object.up = null;
|
|
58502
|
+
}
|
|
58503
|
+
if (message.position != null && message.hasOwnProperty("position"))
|
|
58504
|
+
object.position = $root.vertexvis.protobuf.core.Vector3f.toObject(message.position, options);
|
|
58505
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt"))
|
|
58506
|
+
object.lookAt = $root.vertexvis.protobuf.core.Vector3f.toObject(message.lookAt, options);
|
|
58507
|
+
if (message.up != null && message.hasOwnProperty("up"))
|
|
58508
|
+
object.up = $root.vertexvis.protobuf.core.Vector3f.toObject(message.up, options);
|
|
58509
|
+
return object;
|
|
58510
|
+
};
|
|
58511
|
+
|
|
58512
|
+
/**
|
|
58513
|
+
* Converts this PerspectiveCamera to JSON.
|
|
58514
|
+
* @function toJSON
|
|
58515
|
+
* @memberof vertexvis.protobuf.stream.PerspectiveCamera
|
|
58516
|
+
* @instance
|
|
58517
|
+
* @returns {Object.<string,*>} JSON object
|
|
58518
|
+
*/
|
|
58519
|
+
PerspectiveCamera.prototype.toJSON = function toJSON() {
|
|
58520
|
+
return this.constructor.toObject(this, minimal.util.toJSONOptions);
|
|
58521
|
+
};
|
|
58522
|
+
|
|
58523
|
+
return PerspectiveCamera;
|
|
58524
|
+
})();
|
|
58525
|
+
|
|
58526
|
+
stream.OrthographicCamera = (function() {
|
|
58527
|
+
|
|
58528
|
+
/**
|
|
58529
|
+
* Properties of an OrthographicCamera.
|
|
58530
|
+
* @memberof vertexvis.protobuf.stream
|
|
58531
|
+
* @interface IOrthographicCamera
|
|
58532
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [viewVector] OrthographicCamera viewVector
|
|
58533
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [lookAt] OrthographicCamera lookAt
|
|
58534
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [up] OrthographicCamera up
|
|
58535
|
+
* @property {number|null} [fovHeight] OrthographicCamera fovHeight
|
|
58536
|
+
*/
|
|
58537
|
+
|
|
58538
|
+
/**
|
|
58539
|
+
* Constructs a new OrthographicCamera.
|
|
58540
|
+
* @memberof vertexvis.protobuf.stream
|
|
58541
|
+
* @classdesc Represents an OrthographicCamera.
|
|
58542
|
+
* @implements IOrthographicCamera
|
|
58543
|
+
* @constructor
|
|
58544
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera=} [properties] Properties to set
|
|
58545
|
+
*/
|
|
58546
|
+
function OrthographicCamera(properties) {
|
|
58547
|
+
if (properties)
|
|
58548
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
58549
|
+
if (properties[keys[i]] != null)
|
|
58550
|
+
this[keys[i]] = properties[keys[i]];
|
|
58551
|
+
}
|
|
58552
|
+
|
|
58553
|
+
/**
|
|
58554
|
+
* OrthographicCamera viewVector.
|
|
58555
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} viewVector
|
|
58556
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58557
|
+
* @instance
|
|
58558
|
+
*/
|
|
58559
|
+
OrthographicCamera.prototype.viewVector = null;
|
|
58560
|
+
|
|
58561
|
+
/**
|
|
58562
|
+
* OrthographicCamera lookAt.
|
|
58563
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} lookAt
|
|
58564
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58565
|
+
* @instance
|
|
58566
|
+
*/
|
|
58567
|
+
OrthographicCamera.prototype.lookAt = null;
|
|
58568
|
+
|
|
58569
|
+
/**
|
|
58570
|
+
* OrthographicCamera up.
|
|
58571
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} up
|
|
58572
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58573
|
+
* @instance
|
|
58574
|
+
*/
|
|
58575
|
+
OrthographicCamera.prototype.up = null;
|
|
58576
|
+
|
|
58577
|
+
/**
|
|
58578
|
+
* OrthographicCamera fovHeight.
|
|
58579
|
+
* @member {number} fovHeight
|
|
58580
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58581
|
+
* @instance
|
|
58582
|
+
*/
|
|
58583
|
+
OrthographicCamera.prototype.fovHeight = 0;
|
|
58584
|
+
|
|
58585
|
+
/**
|
|
58586
|
+
* Creates a new OrthographicCamera instance using the specified properties.
|
|
58587
|
+
* @function create
|
|
58588
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58589
|
+
* @static
|
|
58590
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera=} [properties] Properties to set
|
|
58591
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera instance
|
|
58592
|
+
*/
|
|
58593
|
+
OrthographicCamera.create = function create(properties) {
|
|
58594
|
+
return new OrthographicCamera(properties);
|
|
58595
|
+
};
|
|
58596
|
+
|
|
58597
|
+
/**
|
|
58598
|
+
* Encodes the specified OrthographicCamera message. Does not implicitly {@link vertexvis.protobuf.stream.OrthographicCamera.verify|verify} messages.
|
|
58599
|
+
* @function encode
|
|
58600
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58601
|
+
* @static
|
|
58602
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera} message OrthographicCamera message or plain object to encode
|
|
58603
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
58604
|
+
* @returns {$protobuf.Writer} Writer
|
|
58605
|
+
*/
|
|
58606
|
+
OrthographicCamera.encode = function encode(message, writer) {
|
|
58607
|
+
if (!writer)
|
|
58608
|
+
writer = $Writer.create();
|
|
58609
|
+
if (message.viewVector != null && Object.hasOwnProperty.call(message, "viewVector"))
|
|
58610
|
+
$root.vertexvis.protobuf.core.Vector3f.encode(message.viewVector, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
|
58611
|
+
if (message.lookAt != null && Object.hasOwnProperty.call(message, "lookAt"))
|
|
58612
|
+
$root.vertexvis.protobuf.core.Vector3f.encode(message.lookAt, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
|
58613
|
+
if (message.up != null && Object.hasOwnProperty.call(message, "up"))
|
|
58614
|
+
$root.vertexvis.protobuf.core.Vector3f.encode(message.up, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
58615
|
+
if (message.fovHeight != null && Object.hasOwnProperty.call(message, "fovHeight"))
|
|
58616
|
+
writer.uint32(/* id 4, wireType 5 =*/37).float(message.fovHeight);
|
|
58617
|
+
return writer;
|
|
58618
|
+
};
|
|
58619
|
+
|
|
58620
|
+
/**
|
|
58621
|
+
* Encodes the specified OrthographicCamera message, length delimited. Does not implicitly {@link vertexvis.protobuf.stream.OrthographicCamera.verify|verify} messages.
|
|
58622
|
+
* @function encodeDelimited
|
|
58623
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58624
|
+
* @static
|
|
58625
|
+
* @param {vertexvis.protobuf.stream.IOrthographicCamera} message OrthographicCamera message or plain object to encode
|
|
58626
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
58627
|
+
* @returns {$protobuf.Writer} Writer
|
|
58628
|
+
*/
|
|
58629
|
+
OrthographicCamera.encodeDelimited = function encodeDelimited(message, writer) {
|
|
58630
|
+
return this.encode(message, writer).ldelim();
|
|
58631
|
+
};
|
|
58632
|
+
|
|
58633
|
+
/**
|
|
58634
|
+
* Decodes an OrthographicCamera message from the specified reader or buffer.
|
|
58635
|
+
* @function decode
|
|
58636
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58637
|
+
* @static
|
|
58638
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
58639
|
+
* @param {number} [length] Message length if known beforehand
|
|
58640
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera
|
|
58641
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
58642
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
58643
|
+
*/
|
|
58644
|
+
OrthographicCamera.decode = function decode(reader, length) {
|
|
58645
|
+
if (!(reader instanceof $Reader))
|
|
58646
|
+
reader = $Reader.create(reader);
|
|
58647
|
+
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.vertexvis.protobuf.stream.OrthographicCamera();
|
|
58648
|
+
while (reader.pos < end) {
|
|
58649
|
+
let tag = reader.uint32();
|
|
58650
|
+
switch (tag >>> 3) {
|
|
58651
|
+
case 1:
|
|
58652
|
+
message.viewVector = $root.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
58653
|
+
break;
|
|
58654
|
+
case 2:
|
|
58655
|
+
message.lookAt = $root.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
58656
|
+
break;
|
|
58657
|
+
case 3:
|
|
58658
|
+
message.up = $root.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
58659
|
+
break;
|
|
58660
|
+
case 4:
|
|
58661
|
+
message.fovHeight = reader.float();
|
|
58662
|
+
break;
|
|
58663
|
+
default:
|
|
58664
|
+
reader.skipType(tag & 7);
|
|
58665
|
+
break;
|
|
58666
|
+
}
|
|
58667
|
+
}
|
|
58668
|
+
return message;
|
|
58669
|
+
};
|
|
58670
|
+
|
|
58671
|
+
/**
|
|
58672
|
+
* Decodes an OrthographicCamera message from the specified reader or buffer, length delimited.
|
|
58673
|
+
* @function decodeDelimited
|
|
58674
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58675
|
+
* @static
|
|
58676
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
58677
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera
|
|
58678
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
58679
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
58680
|
+
*/
|
|
58681
|
+
OrthographicCamera.decodeDelimited = function decodeDelimited(reader) {
|
|
58682
|
+
if (!(reader instanceof $Reader))
|
|
58683
|
+
reader = new $Reader(reader);
|
|
58684
|
+
return this.decode(reader, reader.uint32());
|
|
58685
|
+
};
|
|
58686
|
+
|
|
58687
|
+
/**
|
|
58688
|
+
* Verifies an OrthographicCamera message.
|
|
58689
|
+
* @function verify
|
|
58690
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58691
|
+
* @static
|
|
58692
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
58693
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
58694
|
+
*/
|
|
58695
|
+
OrthographicCamera.verify = function verify(message) {
|
|
58696
|
+
if (typeof message !== "object" || message === null)
|
|
58697
|
+
return "object expected";
|
|
58698
|
+
if (message.viewVector != null && message.hasOwnProperty("viewVector")) {
|
|
58699
|
+
let error = $root.vertexvis.protobuf.core.Vector3f.verify(message.viewVector);
|
|
58700
|
+
if (error)
|
|
58701
|
+
return "viewVector." + error;
|
|
58702
|
+
}
|
|
58703
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt")) {
|
|
58704
|
+
let error = $root.vertexvis.protobuf.core.Vector3f.verify(message.lookAt);
|
|
58705
|
+
if (error)
|
|
58706
|
+
return "lookAt." + error;
|
|
58707
|
+
}
|
|
58708
|
+
if (message.up != null && message.hasOwnProperty("up")) {
|
|
58709
|
+
let error = $root.vertexvis.protobuf.core.Vector3f.verify(message.up);
|
|
58710
|
+
if (error)
|
|
58711
|
+
return "up." + error;
|
|
58712
|
+
}
|
|
58713
|
+
if (message.fovHeight != null && message.hasOwnProperty("fovHeight"))
|
|
58714
|
+
if (typeof message.fovHeight !== "number")
|
|
58715
|
+
return "fovHeight: number expected";
|
|
58716
|
+
return null;
|
|
58717
|
+
};
|
|
58718
|
+
|
|
58719
|
+
/**
|
|
58720
|
+
* Creates an OrthographicCamera message from a plain object. Also converts values to their respective internal types.
|
|
58721
|
+
* @function fromObject
|
|
58722
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58723
|
+
* @static
|
|
58724
|
+
* @param {Object.<string,*>} object Plain object
|
|
58725
|
+
* @returns {vertexvis.protobuf.stream.OrthographicCamera} OrthographicCamera
|
|
58726
|
+
*/
|
|
58727
|
+
OrthographicCamera.fromObject = function fromObject(object) {
|
|
58728
|
+
if (object instanceof $root.vertexvis.protobuf.stream.OrthographicCamera)
|
|
58729
|
+
return object;
|
|
58730
|
+
let message = new $root.vertexvis.protobuf.stream.OrthographicCamera();
|
|
58731
|
+
if (object.viewVector != null) {
|
|
58732
|
+
if (typeof object.viewVector !== "object")
|
|
58733
|
+
throw TypeError(".vertexvis.protobuf.stream.OrthographicCamera.viewVector: object expected");
|
|
58734
|
+
message.viewVector = $root.vertexvis.protobuf.core.Vector3f.fromObject(object.viewVector);
|
|
58735
|
+
}
|
|
58736
|
+
if (object.lookAt != null) {
|
|
58737
|
+
if (typeof object.lookAt !== "object")
|
|
58738
|
+
throw TypeError(".vertexvis.protobuf.stream.OrthographicCamera.lookAt: object expected");
|
|
58739
|
+
message.lookAt = $root.vertexvis.protobuf.core.Vector3f.fromObject(object.lookAt);
|
|
58740
|
+
}
|
|
58741
|
+
if (object.up != null) {
|
|
58742
|
+
if (typeof object.up !== "object")
|
|
58743
|
+
throw TypeError(".vertexvis.protobuf.stream.OrthographicCamera.up: object expected");
|
|
58744
|
+
message.up = $root.vertexvis.protobuf.core.Vector3f.fromObject(object.up);
|
|
58745
|
+
}
|
|
58746
|
+
if (object.fovHeight != null)
|
|
58747
|
+
message.fovHeight = Number(object.fovHeight);
|
|
58748
|
+
return message;
|
|
58749
|
+
};
|
|
58750
|
+
|
|
58751
|
+
/**
|
|
58752
|
+
* Creates a plain object from an OrthographicCamera message. Also converts values to other types if specified.
|
|
58753
|
+
* @function toObject
|
|
58754
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58755
|
+
* @static
|
|
58756
|
+
* @param {vertexvis.protobuf.stream.OrthographicCamera} message OrthographicCamera
|
|
58757
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
58758
|
+
* @returns {Object.<string,*>} Plain object
|
|
58759
|
+
*/
|
|
58760
|
+
OrthographicCamera.toObject = function toObject(message, options) {
|
|
58761
|
+
if (!options)
|
|
58762
|
+
options = {};
|
|
58763
|
+
let object = {};
|
|
58764
|
+
if (options.defaults) {
|
|
58765
|
+
object.viewVector = null;
|
|
58766
|
+
object.lookAt = null;
|
|
58767
|
+
object.up = null;
|
|
58768
|
+
object.fovHeight = 0;
|
|
58769
|
+
}
|
|
58770
|
+
if (message.viewVector != null && message.hasOwnProperty("viewVector"))
|
|
58771
|
+
object.viewVector = $root.vertexvis.protobuf.core.Vector3f.toObject(message.viewVector, options);
|
|
58772
|
+
if (message.lookAt != null && message.hasOwnProperty("lookAt"))
|
|
58773
|
+
object.lookAt = $root.vertexvis.protobuf.core.Vector3f.toObject(message.lookAt, options);
|
|
58774
|
+
if (message.up != null && message.hasOwnProperty("up"))
|
|
58775
|
+
object.up = $root.vertexvis.protobuf.core.Vector3f.toObject(message.up, options);
|
|
58776
|
+
if (message.fovHeight != null && message.hasOwnProperty("fovHeight"))
|
|
58777
|
+
object.fovHeight = options.json && !isFinite(message.fovHeight) ? String(message.fovHeight) : message.fovHeight;
|
|
58778
|
+
return object;
|
|
58779
|
+
};
|
|
58780
|
+
|
|
58781
|
+
/**
|
|
58782
|
+
* Converts this OrthographicCamera to JSON.
|
|
58783
|
+
* @function toJSON
|
|
58784
|
+
* @memberof vertexvis.protobuf.stream.OrthographicCamera
|
|
58785
|
+
* @instance
|
|
58786
|
+
* @returns {Object.<string,*>} JSON object
|
|
58787
|
+
*/
|
|
58788
|
+
OrthographicCamera.prototype.toJSON = function toJSON() {
|
|
58789
|
+
return this.constructor.toObject(this, minimal.util.toJSONOptions);
|
|
58790
|
+
};
|
|
58791
|
+
|
|
58792
|
+
return OrthographicCamera;
|
|
58793
|
+
})();
|
|
58794
|
+
|
|
58795
|
+
stream.Camera = (function() {
|
|
58796
|
+
|
|
58797
|
+
/**
|
|
58798
|
+
* Properties of a Camera.
|
|
58799
|
+
* @memberof vertexvis.protobuf.stream
|
|
58800
|
+
* @interface ICamera
|
|
58801
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [position] Camera position
|
|
58802
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [lookAt] Camera lookAt
|
|
58803
|
+
* @property {vertexvis.protobuf.core.IVector3f|null} [up] Camera up
|
|
58804
|
+
* @property {vertexvis.protobuf.stream.IPerspectiveCamera|null} [perspective] Camera perspective
|
|
58805
|
+
* @property {vertexvis.protobuf.stream.IOrthographicCamera|null} [orthographic] Camera orthographic
|
|
58806
|
+
*/
|
|
58807
|
+
|
|
58808
|
+
/**
|
|
58809
|
+
* Constructs a new Camera.
|
|
58810
|
+
* @memberof vertexvis.protobuf.stream
|
|
58811
|
+
* @classdesc Represents a Camera.
|
|
58812
|
+
* @implements ICamera
|
|
58813
|
+
* @constructor
|
|
58814
|
+
* @param {vertexvis.protobuf.stream.ICamera=} [properties] Properties to set
|
|
58815
|
+
*/
|
|
58816
|
+
function Camera(properties) {
|
|
58817
|
+
if (properties)
|
|
58818
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
58819
|
+
if (properties[keys[i]] != null)
|
|
58820
|
+
this[keys[i]] = properties[keys[i]];
|
|
58821
|
+
}
|
|
58822
|
+
|
|
58823
|
+
/**
|
|
58824
|
+
* Camera position.
|
|
58825
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} position
|
|
58826
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58827
|
+
* @instance
|
|
58828
|
+
*/
|
|
58829
|
+
Camera.prototype.position = null;
|
|
58830
|
+
|
|
58831
|
+
/**
|
|
58832
|
+
* Camera lookAt.
|
|
58833
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} lookAt
|
|
58834
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58835
|
+
* @instance
|
|
58836
|
+
*/
|
|
58837
|
+
Camera.prototype.lookAt = null;
|
|
58838
|
+
|
|
58839
|
+
/**
|
|
58840
|
+
* Camera up.
|
|
58841
|
+
* @member {vertexvis.protobuf.core.IVector3f|null|undefined} up
|
|
58842
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58843
|
+
* @instance
|
|
58844
|
+
*/
|
|
58845
|
+
Camera.prototype.up = null;
|
|
58846
|
+
|
|
58847
|
+
/**
|
|
58848
|
+
* Camera perspective.
|
|
58849
|
+
* @member {vertexvis.protobuf.stream.IPerspectiveCamera|null|undefined} perspective
|
|
58850
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58851
|
+
* @instance
|
|
58852
|
+
*/
|
|
58853
|
+
Camera.prototype.perspective = null;
|
|
58854
|
+
|
|
58855
|
+
/**
|
|
58856
|
+
* Camera orthographic.
|
|
58857
|
+
* @member {vertexvis.protobuf.stream.IOrthographicCamera|null|undefined} orthographic
|
|
58858
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58859
|
+
* @instance
|
|
58860
|
+
*/
|
|
58861
|
+
Camera.prototype.orthographic = null;
|
|
58862
|
+
|
|
58863
|
+
// OneOf field names bound to virtual getters and setters
|
|
58864
|
+
let $oneOfFields;
|
|
58865
|
+
|
|
58866
|
+
/**
|
|
58867
|
+
* Camera type.
|
|
58868
|
+
* @member {"perspective"|"orthographic"|undefined} type
|
|
58869
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58870
|
+
* @instance
|
|
58871
|
+
*/
|
|
58872
|
+
Object.defineProperty(Camera.prototype, "type", {
|
|
58873
|
+
get: $util.oneOfGetter($oneOfFields = ["perspective", "orthographic"]),
|
|
58874
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
58875
|
+
});
|
|
58876
|
+
|
|
58877
|
+
/**
|
|
58878
|
+
* Creates a new Camera instance using the specified properties.
|
|
58879
|
+
* @function create
|
|
58880
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58881
|
+
* @static
|
|
58882
|
+
* @param {vertexvis.protobuf.stream.ICamera=} [properties] Properties to set
|
|
58883
|
+
* @returns {vertexvis.protobuf.stream.Camera} Camera instance
|
|
58884
|
+
*/
|
|
58885
|
+
Camera.create = function create(properties) {
|
|
58886
|
+
return new Camera(properties);
|
|
58887
|
+
};
|
|
58888
|
+
|
|
58889
|
+
/**
|
|
58890
|
+
* Encodes the specified Camera message. Does not implicitly {@link vertexvis.protobuf.stream.Camera.verify|verify} messages.
|
|
58891
|
+
* @function encode
|
|
58892
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58893
|
+
* @static
|
|
58894
|
+
* @param {vertexvis.protobuf.stream.ICamera} message Camera message or plain object to encode
|
|
58895
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
58896
|
+
* @returns {$protobuf.Writer} Writer
|
|
58897
|
+
*/
|
|
58898
|
+
Camera.encode = function encode(message, writer) {
|
|
58899
|
+
if (!writer)
|
|
58900
|
+
writer = $Writer.create();
|
|
58901
|
+
if (message.position != null && Object.hasOwnProperty.call(message, "position"))
|
|
58902
|
+
$root.vertexvis.protobuf.core.Vector3f.encode(message.position, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
|
58903
|
+
if (message.lookAt != null && Object.hasOwnProperty.call(message, "lookAt"))
|
|
58904
|
+
$root.vertexvis.protobuf.core.Vector3f.encode(message.lookAt, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
|
58905
|
+
if (message.up != null && Object.hasOwnProperty.call(message, "up"))
|
|
58906
|
+
$root.vertexvis.protobuf.core.Vector3f.encode(message.up, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
58907
|
+
if (message.perspective != null && Object.hasOwnProperty.call(message, "perspective"))
|
|
58908
|
+
$root.vertexvis.protobuf.stream.PerspectiveCamera.encode(message.perspective, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
|
58909
|
+
if (message.orthographic != null && Object.hasOwnProperty.call(message, "orthographic"))
|
|
58910
|
+
$root.vertexvis.protobuf.stream.OrthographicCamera.encode(message.orthographic, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
|
|
58911
|
+
return writer;
|
|
58912
|
+
};
|
|
58913
|
+
|
|
58914
|
+
/**
|
|
58915
|
+
* Encodes the specified Camera message, length delimited. Does not implicitly {@link vertexvis.protobuf.stream.Camera.verify|verify} messages.
|
|
58916
|
+
* @function encodeDelimited
|
|
58917
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58918
|
+
* @static
|
|
58919
|
+
* @param {vertexvis.protobuf.stream.ICamera} message Camera message or plain object to encode
|
|
58920
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
58921
|
+
* @returns {$protobuf.Writer} Writer
|
|
58922
|
+
*/
|
|
58923
|
+
Camera.encodeDelimited = function encodeDelimited(message, writer) {
|
|
58924
|
+
return this.encode(message, writer).ldelim();
|
|
58925
|
+
};
|
|
58926
|
+
|
|
58927
|
+
/**
|
|
58928
|
+
* Decodes a Camera message from the specified reader or buffer.
|
|
58929
|
+
* @function decode
|
|
58930
|
+
* @memberof vertexvis.protobuf.stream.Camera
|
|
58931
|
+
* @static
|
|
58932
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
58933
|
+
* @param {number} [length] Message length if known beforehand
|
|
58934
|
+
* @returns {vertexvis.protobuf.stream.Camera} Camera
|
|
58935
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
58936
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
58937
|
+
*/
|
|
58938
|
+
Camera.decode = function decode(reader, length) {
|
|
58939
|
+
if (!(reader instanceof $Reader))
|
|
58940
|
+
reader = $Reader.create(reader);
|
|
58941
|
+
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.vertexvis.protobuf.stream.Camera();
|
|
58942
|
+
while (reader.pos < end) {
|
|
58943
|
+
let tag = reader.uint32();
|
|
58944
|
+
switch (tag >>> 3) {
|
|
58945
|
+
case 1:
|
|
58946
|
+
message.position = $root.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
58947
|
+
break;
|
|
58948
|
+
case 2:
|
|
58949
|
+
message.lookAt = $root.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
58950
|
+
break;
|
|
58951
|
+
case 3:
|
|
58952
|
+
message.up = $root.vertexvis.protobuf.core.Vector3f.decode(reader, reader.uint32());
|
|
58953
|
+
break;
|
|
58954
|
+
case 4:
|
|
58955
|
+
message.perspective = $root.vertexvis.protobuf.stream.PerspectiveCamera.decode(reader, reader.uint32());
|
|
58956
|
+
break;
|
|
58957
|
+
case 5:
|
|
58958
|
+
message.orthographic = $root.vertexvis.protobuf.stream.OrthographicCamera.decode(reader, reader.uint32());
|
|
58959
|
+
break;
|
|
58960
|
+
default:
|
|
58961
|
+
reader.skipType(tag & 7);
|
|
58962
|
+
break;
|
|
58963
|
+
}
|
|
58964
|
+
}
|
|
58965
|
+
return message;
|
|
58966
|
+
};
|
|
58967
|
+
|
|
57459
58968
|
/**
|
|
57460
58969
|
* Decodes a Camera message from the specified reader or buffer, length delimited.
|
|
57461
58970
|
* @function decodeDelimited
|
|
@@ -57483,6 +58992,7 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57483
58992
|
Camera.verify = function verify(message) {
|
|
57484
58993
|
if (typeof message !== "object" || message === null)
|
|
57485
58994
|
return "object expected";
|
|
58995
|
+
let properties = {};
|
|
57486
58996
|
if (message.position != null && message.hasOwnProperty("position")) {
|
|
57487
58997
|
let error = $root.vertexvis.protobuf.core.Vector3f.verify(message.position);
|
|
57488
58998
|
if (error)
|
|
@@ -57498,6 +59008,24 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57498
59008
|
if (error)
|
|
57499
59009
|
return "up." + error;
|
|
57500
59010
|
}
|
|
59011
|
+
if (message.perspective != null && message.hasOwnProperty("perspective")) {
|
|
59012
|
+
properties.type = 1;
|
|
59013
|
+
{
|
|
59014
|
+
let error = $root.vertexvis.protobuf.stream.PerspectiveCamera.verify(message.perspective);
|
|
59015
|
+
if (error)
|
|
59016
|
+
return "perspective." + error;
|
|
59017
|
+
}
|
|
59018
|
+
}
|
|
59019
|
+
if (message.orthographic != null && message.hasOwnProperty("orthographic")) {
|
|
59020
|
+
if (properties.type === 1)
|
|
59021
|
+
return "type: multiple values";
|
|
59022
|
+
properties.type = 1;
|
|
59023
|
+
{
|
|
59024
|
+
let error = $root.vertexvis.protobuf.stream.OrthographicCamera.verify(message.orthographic);
|
|
59025
|
+
if (error)
|
|
59026
|
+
return "orthographic." + error;
|
|
59027
|
+
}
|
|
59028
|
+
}
|
|
57501
59029
|
return null;
|
|
57502
59030
|
};
|
|
57503
59031
|
|
|
@@ -57528,6 +59056,16 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57528
59056
|
throw TypeError(".vertexvis.protobuf.stream.Camera.up: object expected");
|
|
57529
59057
|
message.up = $root.vertexvis.protobuf.core.Vector3f.fromObject(object.up);
|
|
57530
59058
|
}
|
|
59059
|
+
if (object.perspective != null) {
|
|
59060
|
+
if (typeof object.perspective !== "object")
|
|
59061
|
+
throw TypeError(".vertexvis.protobuf.stream.Camera.perspective: object expected");
|
|
59062
|
+
message.perspective = $root.vertexvis.protobuf.stream.PerspectiveCamera.fromObject(object.perspective);
|
|
59063
|
+
}
|
|
59064
|
+
if (object.orthographic != null) {
|
|
59065
|
+
if (typeof object.orthographic !== "object")
|
|
59066
|
+
throw TypeError(".vertexvis.protobuf.stream.Camera.orthographic: object expected");
|
|
59067
|
+
message.orthographic = $root.vertexvis.protobuf.stream.OrthographicCamera.fromObject(object.orthographic);
|
|
59068
|
+
}
|
|
57531
59069
|
return message;
|
|
57532
59070
|
};
|
|
57533
59071
|
|
|
@@ -57555,6 +59093,16 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
57555
59093
|
object.lookAt = $root.vertexvis.protobuf.core.Vector3f.toObject(message.lookAt, options);
|
|
57556
59094
|
if (message.up != null && message.hasOwnProperty("up"))
|
|
57557
59095
|
object.up = $root.vertexvis.protobuf.core.Vector3f.toObject(message.up, options);
|
|
59096
|
+
if (message.perspective != null && message.hasOwnProperty("perspective")) {
|
|
59097
|
+
object.perspective = $root.vertexvis.protobuf.stream.PerspectiveCamera.toObject(message.perspective, options);
|
|
59098
|
+
if (options.oneofs)
|
|
59099
|
+
object.type = "perspective";
|
|
59100
|
+
}
|
|
59101
|
+
if (message.orthographic != null && message.hasOwnProperty("orthographic")) {
|
|
59102
|
+
object.orthographic = $root.vertexvis.protobuf.stream.OrthographicCamera.toObject(message.orthographic, options);
|
|
59103
|
+
if (options.oneofs)
|
|
59104
|
+
object.type = "orthographic";
|
|
59105
|
+
}
|
|
57558
59106
|
return object;
|
|
57559
59107
|
};
|
|
57560
59108
|
|
|
@@ -88637,7 +90185,7 @@ function buildFlyToOperation(frameCorrelationId, options, animation) {
|
|
|
88637
90185
|
}) });
|
|
88638
90186
|
}
|
|
88639
90187
|
case 'camera': {
|
|
88640
|
-
return Object.assign(Object.assign({}, payload), { camera: options.flyTo.data });
|
|
90188
|
+
return Object.assign(Object.assign({}, payload), { camera: toProtobuf(options.flyTo.data) });
|
|
88641
90189
|
}
|
|
88642
90190
|
case 'bounding-box': {
|
|
88643
90191
|
return Object.assign(Object.assign({}, payload), { boundingBox: {
|
|
@@ -88771,32 +90319,19 @@ class FlyToExecutor {
|
|
|
88771
90319
|
* a new instance of the class with the updated properties.
|
|
88772
90320
|
*/
|
|
88773
90321
|
class Camera {
|
|
88774
|
-
constructor(stream, aspect, data, boundingBox, decodeFrame) {
|
|
90322
|
+
constructor(stream, aspect, data, boundingBox, decodeFrame, flyToOptions) {
|
|
88775
90323
|
this.stream = stream;
|
|
88776
90324
|
this.aspect = aspect;
|
|
88777
90325
|
this.data = data;
|
|
88778
90326
|
this.boundingBox = boundingBox;
|
|
88779
90327
|
this.decodeFrame = decodeFrame;
|
|
90328
|
+
this.flyToOptions = flyToOptions;
|
|
88780
90329
|
}
|
|
88781
|
-
|
|
88782
|
-
|
|
88783
|
-
* be contained within the camera's view.
|
|
88784
|
-
*
|
|
88785
|
-
* @param boundingBox The bounding box to position to.
|
|
88786
|
-
*/
|
|
88787
|
-
fitToBoundingBox(boundingBox$1) {
|
|
88788
|
-
const radius = 1.1 *
|
|
88789
|
-
vector3.magnitude(vector3.subtract(boundingBox$1.max, boundingBox.center(boundingBox$1)));
|
|
88790
|
-
// ratio of the height of the frustum to the distance along the view vector
|
|
88791
|
-
let hOverD = Math.tan(this.fovY * PI_OVER_360);
|
|
88792
|
-
if (this.aspectRatio < 1.0) {
|
|
88793
|
-
hOverD *= this.aspectRatio;
|
|
88794
|
-
}
|
|
88795
|
-
const distance = Math.abs(radius / hOverD);
|
|
88796
|
-
const vvec = vector3.scale(distance, vector3.normalize(this.viewVector()));
|
|
90330
|
+
fitCameraToBoundingBox(boundingBox$1, distance, viewVector) {
|
|
90331
|
+
const vvec = vector3.scale(distance, vector3.normalize(viewVector));
|
|
88797
90332
|
const lookAt = boundingBox.center(boundingBox$1);
|
|
88798
90333
|
const position = vector3.subtract(lookAt, vvec);
|
|
88799
|
-
return this.update({ lookAt, position });
|
|
90334
|
+
return this.update({ lookAt, position, viewVector: vvec });
|
|
88800
90335
|
}
|
|
88801
90336
|
/**
|
|
88802
90337
|
* Returns the distance from the camera's position to the center
|
|
@@ -88804,12 +90339,11 @@ class Camera {
|
|
|
88804
90339
|
*
|
|
88805
90340
|
* @param boundingBox - The bounding box to determine distance from.
|
|
88806
90341
|
*/
|
|
88807
|
-
|
|
88808
|
-
const
|
|
88809
|
-
const boundingBoxCenter = boundingBox.center(
|
|
88810
|
-
const cameraToCenter = vector3.subtract(
|
|
88811
|
-
|
|
88812
|
-
return distanceToCenterAlongViewVec;
|
|
90342
|
+
signedDistanceToBoundingBoxCenter(boundingBox$1) {
|
|
90343
|
+
const { position, viewVector } = withPositionAndViewVector(this.data);
|
|
90344
|
+
const boundingBoxCenter = boundingBox.center(boundingBox$1 !== null && boundingBox$1 !== void 0 ? boundingBox$1 : this.boundingBox);
|
|
90345
|
+
const cameraToCenter = vector3.subtract(boundingBoxCenter, position);
|
|
90346
|
+
return (vector3.dot(viewVector, cameraToCenter) / vector3.magnitude(viewVector));
|
|
88813
90347
|
}
|
|
88814
90348
|
/**
|
|
88815
90349
|
* Specifies that the next render of the camera will be repositioned to one of
|
|
@@ -88820,26 +90354,14 @@ class Camera {
|
|
|
88820
90354
|
*/
|
|
88821
90355
|
flyTo(paramsOrQuery) {
|
|
88822
90356
|
if (typeof paramsOrQuery !== 'function') {
|
|
88823
|
-
|
|
88824
|
-
|
|
90357
|
+
return this.updateFlyToOptions({
|
|
90358
|
+
flyTo: this.buildFlyToType(paramsOrQuery),
|
|
90359
|
+
});
|
|
88825
90360
|
}
|
|
88826
90361
|
else {
|
|
88827
|
-
this.
|
|
88828
|
-
return this;
|
|
90362
|
+
return this.updateFlyToOptions(paramsOrQuery(new FlyToExecutor()).build());
|
|
88829
90363
|
}
|
|
88830
90364
|
}
|
|
88831
|
-
/**
|
|
88832
|
-
* Shifts the position of the camera by the given delta.
|
|
88833
|
-
*
|
|
88834
|
-
* @param delta The number of units to shift the camera on the X, Y, and Z
|
|
88835
|
-
* axis.
|
|
88836
|
-
*/
|
|
88837
|
-
moveBy(delta) {
|
|
88838
|
-
return this.update({
|
|
88839
|
-
position: vector3.add(this.position, delta),
|
|
88840
|
-
lookAt: vector3.add(this.lookAt, delta),
|
|
88841
|
-
});
|
|
88842
|
-
}
|
|
88843
90365
|
viewAll() {
|
|
88844
90366
|
return this.fitToBoundingBox(this.boundingBox);
|
|
88845
90367
|
}
|
|
@@ -88871,7 +90393,7 @@ class Camera {
|
|
|
88871
90393
|
}
|
|
88872
90394
|
else {
|
|
88873
90395
|
this.stream.replaceCamera({
|
|
88874
|
-
camera: this.data,
|
|
90396
|
+
camera: toProtobuf(this.data),
|
|
88875
90397
|
frameCorrelationId: { value: corrId },
|
|
88876
90398
|
});
|
|
88877
90399
|
return new CameraRenderResult(this.stream, this.decodeFrame, {
|
|
@@ -88891,22 +90413,7 @@ class Camera {
|
|
|
88891
90413
|
* @param axis A normalized vector to rotate around.
|
|
88892
90414
|
*/
|
|
88893
90415
|
rotateAroundAxis(angleInRadians, axis) {
|
|
88894
|
-
return this.rotateAroundAxisAtPoint(angleInRadians, this.lookAt, axis);
|
|
88895
|
-
}
|
|
88896
|
-
/**
|
|
88897
|
-
* Repositions the camera by rotating its current position around an axis
|
|
88898
|
-
* defined at a specific world point.
|
|
88899
|
-
*
|
|
88900
|
-
* @param angleInRadians The angle, in radians, to rotate.
|
|
88901
|
-
* @param point The point in world space to place the axis at.
|
|
88902
|
-
* @param axis A normalized vector to rotate around.
|
|
88903
|
-
*/
|
|
88904
|
-
rotateAroundAxisAtPoint(angleInRadians, point, axis) {
|
|
88905
|
-
return this.update({
|
|
88906
|
-
position: vector3.rotateAboutAxis(angleInRadians, this.position, axis, point),
|
|
88907
|
-
lookAt: vector3.rotateAboutAxis(angleInRadians, this.lookAt, axis, point),
|
|
88908
|
-
up: vector3.rotateAboutAxis(angleInRadians, this.up, axis, vector3.origin()),
|
|
88909
|
-
});
|
|
90416
|
+
return this.rotateAroundAxisAtPoint(angleInRadians, this.data.lookAt, axis);
|
|
88910
90417
|
}
|
|
88911
90418
|
/**
|
|
88912
90419
|
* Updates the `position` and `up` vectors of the camera to the given standard
|
|
@@ -88918,24 +90425,11 @@ class Camera {
|
|
|
88918
90425
|
standardView(standardView) {
|
|
88919
90426
|
return this.update({
|
|
88920
90427
|
position: standardView.position,
|
|
90428
|
+
viewVector: vector3.subtract(vector3.origin(), standardView.position),
|
|
88921
90429
|
lookAt: vector3.origin(),
|
|
88922
90430
|
up: standardView.up,
|
|
88923
90431
|
});
|
|
88924
90432
|
}
|
|
88925
|
-
/**
|
|
88926
|
-
* Updates the `position`, `lookAt` and/or `up` vectors of the camera.
|
|
88927
|
-
*
|
|
88928
|
-
* @param camera The values to update the camera to.
|
|
88929
|
-
*/
|
|
88930
|
-
update(camera) {
|
|
88931
|
-
return new Camera(this.stream, this.aspectRatio, Object.assign(Object.assign({}, this.data), camera), this.boundingBox, this.decodeFrame);
|
|
88932
|
-
}
|
|
88933
|
-
/**
|
|
88934
|
-
* Returns a `FramePerspectiveCamera` representation.
|
|
88935
|
-
*/
|
|
88936
|
-
toFrameCamera() {
|
|
88937
|
-
return new FramePerspectiveCamera(this.position, this.lookAt, this.up, this.near, this.far, this.aspectRatio, this.fovY);
|
|
88938
|
-
}
|
|
88939
90433
|
buildFlyToType(options) {
|
|
88940
90434
|
if (options.boundingBox != null) {
|
|
88941
90435
|
return { type: 'bounding-box', data: options.boundingBox };
|
|
@@ -88956,36 +90450,76 @@ class Camera {
|
|
|
88956
90450
|
computeClippingPlanes(camera) {
|
|
88957
90451
|
return fromBoundingBoxAndLookAtCamera(this.boundingBox, camera);
|
|
88958
90452
|
}
|
|
90453
|
+
}
|
|
90454
|
+
class PerspectiveCamera extends Camera {
|
|
90455
|
+
constructor(stream, aspect, perspectiveData, boundingBox, decodeFrame, flyToOptions) {
|
|
90456
|
+
super(stream, aspect, perspectiveData, boundingBox, decodeFrame, flyToOptions);
|
|
90457
|
+
this.perspectiveData = perspectiveData;
|
|
90458
|
+
}
|
|
88959
90459
|
/**
|
|
88960
|
-
*
|
|
88961
|
-
*
|
|
90460
|
+
* Shifts the position of the camera by the given delta.
|
|
90461
|
+
*
|
|
90462
|
+
* @param delta The number of units to shift the camera on the X, Y, and Z
|
|
90463
|
+
* axis.
|
|
88962
90464
|
*/
|
|
88963
|
-
|
|
90465
|
+
moveBy(delta) {
|
|
90466
|
+
return this.update({
|
|
90467
|
+
position: vector3.add(this.position, delta),
|
|
90468
|
+
lookAt: vector3.add(this.lookAt, delta),
|
|
90469
|
+
});
|
|
90470
|
+
}
|
|
90471
|
+
rotateAroundAxisAtPoint(angleInRadians, point, axis) {
|
|
90472
|
+
return this.update({
|
|
90473
|
+
position: vector3.rotateAboutAxis(angleInRadians, this.position, axis, point),
|
|
90474
|
+
lookAt: vector3.rotateAboutAxis(angleInRadians, this.lookAt, axis, point),
|
|
90475
|
+
up: vector3.rotateAboutAxis(angleInRadians, this.up, axis, vector3.origin()),
|
|
90476
|
+
});
|
|
90477
|
+
}
|
|
90478
|
+
fitToBoundingBox(boundingBox$1) {
|
|
90479
|
+
var _a;
|
|
90480
|
+
const radius = 1.1 *
|
|
90481
|
+
vector3.magnitude(vector3.subtract(boundingBox$1.max, boundingBox.center(boundingBox$1)));
|
|
90482
|
+
// ratio of the height of the frustum to the distance along the view vector
|
|
90483
|
+
let hOverD = Math.tan(((_a = this.fovY) !== null && _a !== void 0 ? _a : 45) * PI_OVER_360);
|
|
90484
|
+
if (this.aspect < 1.0) {
|
|
90485
|
+
hOverD *= this.aspect;
|
|
90486
|
+
}
|
|
90487
|
+
const distance = Math.abs(radius / hOverD);
|
|
90488
|
+
return super.fitCameraToBoundingBox(boundingBox$1, distance, this.viewVector);
|
|
90489
|
+
}
|
|
90490
|
+
update(camera) {
|
|
90491
|
+
return new PerspectiveCamera(this.stream, this.aspect, Object.assign(Object.assign({}, this.perspectiveData), camera), this.boundingBox, this.decodeFrame, this.flyToOptions);
|
|
90492
|
+
}
|
|
90493
|
+
toFrameCamera() {
|
|
90494
|
+
var _a;
|
|
90495
|
+
return new FramePerspectiveCamera(this.position, this.lookAt, this.up, this.near, this.far, this.aspectRatio, (_a = this.fovY) !== null && _a !== void 0 ? _a : 45);
|
|
90496
|
+
}
|
|
90497
|
+
get viewVector() {
|
|
88964
90498
|
return vector3.subtract(this.lookAt, this.position);
|
|
88965
90499
|
}
|
|
88966
90500
|
/**
|
|
88967
90501
|
* The position vector for the camera, in world space coordinates.
|
|
88968
90502
|
*/
|
|
88969
90503
|
get position() {
|
|
88970
|
-
return Object.assign({}, this.
|
|
90504
|
+
return Object.assign({}, this.perspectiveData.position);
|
|
88971
90505
|
}
|
|
88972
90506
|
/**
|
|
88973
90507
|
* A normalized vector representing the up direction.
|
|
88974
90508
|
*/
|
|
88975
90509
|
get up() {
|
|
88976
|
-
return Object.assign({}, this.
|
|
90510
|
+
return Object.assign({}, this.perspectiveData.up);
|
|
88977
90511
|
}
|
|
88978
90512
|
/**
|
|
88979
90513
|
* A vector, in world space coordinates, of where the camera is pointed at.
|
|
88980
90514
|
*/
|
|
88981
90515
|
get lookAt() {
|
|
88982
|
-
return Object.assign({}, this.
|
|
90516
|
+
return Object.assign({}, this.perspectiveData.lookAt);
|
|
88983
90517
|
}
|
|
88984
90518
|
/**
|
|
88985
90519
|
* The camera's field of view.
|
|
88986
90520
|
*/
|
|
88987
90521
|
get fovY() {
|
|
88988
|
-
return
|
|
90522
|
+
return this.perspectiveData.fovY;
|
|
88989
90523
|
}
|
|
88990
90524
|
/**
|
|
88991
90525
|
* The aspect ratio of the camera.
|
|
@@ -88997,16 +90531,108 @@ class Camera {
|
|
|
88997
90531
|
* The camera's near clipping plane.
|
|
88998
90532
|
*/
|
|
88999
90533
|
get near() {
|
|
89000
|
-
const { near } = this.computeClippingPlanes(this.
|
|
90534
|
+
const { near } = this.computeClippingPlanes(this.perspectiveData);
|
|
89001
90535
|
return near;
|
|
89002
90536
|
}
|
|
89003
90537
|
/**
|
|
89004
90538
|
* The camera's far clipping plane.
|
|
89005
90539
|
*/
|
|
89006
90540
|
get far() {
|
|
89007
|
-
const { far } = this.computeClippingPlanes(this.
|
|
90541
|
+
const { far } = this.computeClippingPlanes(this.perspectiveData);
|
|
89008
90542
|
return far;
|
|
89009
90543
|
}
|
|
90544
|
+
updateFlyToOptions(flyToOptions) {
|
|
90545
|
+
return new PerspectiveCamera(this.stream, this.aspect, this.perspectiveData, this.boundingBox, this.decodeFrame, flyToOptions);
|
|
90546
|
+
}
|
|
90547
|
+
}
|
|
90548
|
+
class OrthographicCamera extends Camera {
|
|
90549
|
+
constructor(stream, aspect, orthographicData, boundingBox, decodeFrame, flyToOptions) {
|
|
90550
|
+
super(stream, aspect, orthographicData, boundingBox, decodeFrame, flyToOptions);
|
|
90551
|
+
this.orthographicData = orthographicData;
|
|
90552
|
+
}
|
|
90553
|
+
/**
|
|
90554
|
+
* Shifts the position of the camera by the given delta.
|
|
90555
|
+
*
|
|
90556
|
+
* @param delta The number of units to shift the camera on the X, Y, and Z
|
|
90557
|
+
* axis.
|
|
90558
|
+
*/
|
|
90559
|
+
moveBy(delta) {
|
|
90560
|
+
return this.update({
|
|
90561
|
+
lookAt: vector3.add(this.lookAt, delta),
|
|
90562
|
+
});
|
|
90563
|
+
}
|
|
90564
|
+
rotateAroundAxisAtPoint(angleInRadians, point, axis) {
|
|
90565
|
+
const updatedLookAt = vector3.rotateAboutAxis(angleInRadians, this.lookAt, axis, point);
|
|
90566
|
+
const updatedPosition = vector3.rotateAboutAxis(angleInRadians, this.position, axis, point);
|
|
90567
|
+
const viewVector = constrainViewVector(vector3.subtract(updatedLookAt, updatedPosition), boundingSphere.create(this.boundingBox));
|
|
90568
|
+
return this.update({
|
|
90569
|
+
viewVector: viewVector,
|
|
90570
|
+
lookAt: updatedLookAt,
|
|
90571
|
+
up: vector3.rotateAboutAxis(angleInRadians, this.up, axis, vector3.origin()),
|
|
90572
|
+
});
|
|
90573
|
+
}
|
|
90574
|
+
fitToBoundingBox(boundingBox) {
|
|
90575
|
+
const boundingSphere$1 = boundingSphere.create(boundingBox);
|
|
90576
|
+
const fitAll = super.fitCameraToBoundingBox(boundingBox, boundingSphere$1.radius, this.viewVector);
|
|
90577
|
+
return this.update({
|
|
90578
|
+
lookAt: fitAll.lookAt,
|
|
90579
|
+
viewVector: fitAll.viewVector,
|
|
90580
|
+
fovHeight: boundingSphere$1.radius * 2,
|
|
90581
|
+
});
|
|
90582
|
+
}
|
|
90583
|
+
update(camera) {
|
|
90584
|
+
return new OrthographicCamera(this.stream, this.aspect, Object.assign(Object.assign({}, this.orthographicData), camera), this.boundingBox, this.decodeFrame, this.flyToOptions);
|
|
90585
|
+
}
|
|
90586
|
+
toFrameCamera() {
|
|
90587
|
+
return new FrameOrthographicCamera(constrainViewVector(this.viewVector, boundingSphere.create(this.boundingBox)), this.lookAt, this.up, this.near, this.far, this.aspectRatio, this.fovHeight);
|
|
90588
|
+
}
|
|
90589
|
+
get viewVector() {
|
|
90590
|
+
return Object.assign({}, this.orthographicData.viewVector);
|
|
90591
|
+
}
|
|
90592
|
+
get position() {
|
|
90593
|
+
return vector3.add(this.lookAt, vector3.negate(this.viewVector));
|
|
90594
|
+
}
|
|
90595
|
+
/**
|
|
90596
|
+
* A normalized vector representing the up direction.
|
|
90597
|
+
*/
|
|
90598
|
+
get up() {
|
|
90599
|
+
return Object.assign({}, this.orthographicData.up);
|
|
90600
|
+
}
|
|
90601
|
+
/**
|
|
90602
|
+
* A vector, in world space coordinates, of where the camera is pointed at.
|
|
90603
|
+
*/
|
|
90604
|
+
get lookAt() {
|
|
90605
|
+
return Object.assign({}, this.orthographicData.lookAt);
|
|
90606
|
+
}
|
|
90607
|
+
/**
|
|
90608
|
+
* The camera's field of view.
|
|
90609
|
+
*/
|
|
90610
|
+
get fovHeight() {
|
|
90611
|
+
return this.orthographicData.fovHeight;
|
|
90612
|
+
}
|
|
90613
|
+
/**
|
|
90614
|
+
* The aspect ratio of the camera.
|
|
90615
|
+
*/
|
|
90616
|
+
get aspectRatio() {
|
|
90617
|
+
return this.aspect;
|
|
90618
|
+
}
|
|
90619
|
+
/**
|
|
90620
|
+
* The camera's near clipping plane.
|
|
90621
|
+
*/
|
|
90622
|
+
get near() {
|
|
90623
|
+
const { near } = this.computeClippingPlanes(this.orthographicData);
|
|
90624
|
+
return near;
|
|
90625
|
+
}
|
|
90626
|
+
/**
|
|
90627
|
+
* The camera's far clipping plane.
|
|
90628
|
+
*/
|
|
90629
|
+
get far() {
|
|
90630
|
+
const { far } = this.computeClippingPlanes(this.orthographicData);
|
|
90631
|
+
return far;
|
|
90632
|
+
}
|
|
90633
|
+
updateFlyToOptions(flyToOptions) {
|
|
90634
|
+
return new OrthographicCamera(this.stream, this.aspect, this.orthographicData, this.boundingBox, this.decodeFrame, flyToOptions);
|
|
90635
|
+
}
|
|
89010
90636
|
}
|
|
89011
90637
|
|
|
89012
90638
|
/**
|
|
@@ -89413,12 +91039,25 @@ class Scene {
|
|
|
89413
91039
|
*/
|
|
89414
91040
|
camera() {
|
|
89415
91041
|
const { scene } = this.frame;
|
|
89416
|
-
|
|
89417
|
-
|
|
89418
|
-
|
|
89419
|
-
|
|
89420
|
-
|
|
89421
|
-
|
|
91042
|
+
if (scene.camera.isOrthographic()) {
|
|
91043
|
+
return new OrthographicCamera(this.stream, dimensions.aspectRatio(this.viewport()), {
|
|
91044
|
+
viewVector: scene.camera.viewVector,
|
|
91045
|
+
lookAt: scene.camera.lookAt,
|
|
91046
|
+
up: scene.camera.up,
|
|
91047
|
+
fovHeight: scene.camera.fovHeight,
|
|
91048
|
+
}, this.frame.scene.boundingBox, this.decodeFrame);
|
|
91049
|
+
}
|
|
91050
|
+
else if (scene.camera.isPerspective()) {
|
|
91051
|
+
return new PerspectiveCamera(this.stream, dimensions.aspectRatio(this.viewport()), {
|
|
91052
|
+
position: scene.camera.position,
|
|
91053
|
+
lookAt: scene.camera.lookAt,
|
|
91054
|
+
up: scene.camera.up,
|
|
91055
|
+
fovY: scene.camera.fovY,
|
|
91056
|
+
}, this.frame.scene.boundingBox, this.decodeFrame);
|
|
91057
|
+
}
|
|
91058
|
+
else {
|
|
91059
|
+
throw new InvalidCameraError('Cannot retrieve camera. Scene has an unknown or invalid camera type.');
|
|
91060
|
+
}
|
|
89422
91061
|
}
|
|
89423
91062
|
boundingBox() {
|
|
89424
91063
|
return this.frame.scene.boundingBox;
|
|
@@ -97630,7 +99269,7 @@ let SceneTreeSearch = class extends HTMLElement$1 {
|
|
|
97630
99269
|
static get style() { return sceneTreeSearchCss; }
|
|
97631
99270
|
};
|
|
97632
99271
|
|
|
97633
|
-
const sceneTreeTableCellCss = "button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}:host{display:flex;align-items:center;box-sizing:border-box;--scene-tree-cell-background-hover:var(--blue-200);--scene-tree-cell-background-selected:var(--blue-300);--scene-tree-cell-text-positioning:left;--scene-tree-cell-padding:0.25rem 0}:host([is-hovered]){background:var(--scene-tree-cell-background-hover)}:host([is-selected]){background:var(--scene-tree-cell-background-selected)}.wrapper{display:flex;align-items:center;box-sizing:border-box;width:100%;height:100%;padding:var(--scene-tree-cell-padding)}.content{width:100%;text-align:var(--scene-tree-cell-text-positioning);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.column-spacer{width:var(--scene-tree-table-column-gap)}.expand-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:24px;min-height:24px}.no-shrink{flex-shrink:0}:host([is-leaf]) .expand-btn{visibility:hidden;cursor:default}.visibility-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;
|
|
99272
|
+
const sceneTreeTableCellCss = "button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}:host{display:flex;align-items:center;box-sizing:border-box;--scene-tree-cell-background-hover:var(--blue-200);--scene-tree-cell-background-selected:var(--blue-300);--scene-tree-cell-text-positioning:left;--scene-tree-cell-padding:0.25rem 0}:host([is-hovered]){background:var(--scene-tree-cell-background-hover)}:host([is-selected]){background:var(--scene-tree-cell-background-selected)}.wrapper{display:flex;align-items:center;box-sizing:border-box;width:100%;height:100%;padding:var(--scene-tree-cell-padding)}.content{width:100%;text-align:var(--scene-tree-cell-text-positioning);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.column-spacer{width:var(--scene-tree-table-column-gap)}.expand-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:24px;min-height:24px}.no-shrink{flex-shrink:0}:host([is-leaf]) .expand-btn{visibility:hidden;cursor:default}.visibility-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px}:host(:not([is-hovered]):not([is-partial]):not([is-hidden])) .visibility-btn,:host([is-hidden]) .visibility-btn,:host([is-partial]) .visibility-btn,:host([is-hovered]) .visibility-btn{visibility:inherit}.icon{width:14px;height:14px}.icon-expanded{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M11.88,9.17l-3.5-4a.51.51,0,0,0-.76,0l-3.5,4A.5.5,0,0,0,4.5,10h7a.5.5,0,0,0,.38-.83Z' transform='rotate(180 8 8)' /%3E%3C/svg%3E\")}.icon-collapsed{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M10.83,7.62l-4-3.5A.5.5,0,0,0,6,4.5v7a.5.5,0,0,0,.83.38l4-3.5a.51.51,0,0,0,0-.76Z' /%3E%3C/svg%3E\")}.icon-visible{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M8 5a3 3 0 103 3 3 3 0 00-3-3zm4.65-1.17A8.53 8.53 0 008 2.5a8.53 8.53 0 00-4.65 1.33A6.57 6.57 0 00.51 7.89v.22a6.57 6.57 0 002.84 4.06A8.53 8.53 0 008 13.5a8.53 8.53 0 004.65-1.33 6.57 6.57 0 002.84-4.06v-.22a6.57 6.57 0 00-2.84-4.06zm-.55 7.5A7.52 7.52 0 018 12.5a7.52 7.52 0 01-4.1-1.17A5.49 5.49 0 011.53 8 5.49 5.49 0 013.9 4.67 7.52 7.52 0 018 3.5a7.52 7.52 0 014.1 1.17A5.49 5.49 0 0114.47 8a5.49 5.49 0 01-2.37 3.33z' /%3E%3C/svg%3E\")}.icon-hidden{background-image:url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M13.35 2.65a.48.48 0 00-.7 0l-.78.77a8.71 8.71 0 00-8.52.41A6.57 6.57 0 00.51 7.89v.22a6.58 6.58 0 002.71 4l-.57.58a.49.49 0 00.7.7l10-10a.48.48 0 000-.74zM9.73 5.56a3 3 0 00-4.17 4.17l-1.62 1.62A5.49 5.49 0 011.53 8 5.49 5.49 0 013.9 4.67 7.52 7.52 0 018 3.5a7.67 7.67 0 013.12.67zm3.61-1.2l-.72.72A5.45 5.45 0 0114.47 8a5.49 5.49 0 01-2.37 3.33A7.52 7.52 0 018 12.5a8.15 8.15 0 01-2.41-.38l-.78.78a8.9 8.9 0 003.19.6 8.53 8.53 0 004.65-1.33 6.57 6.57 0 002.84-4.06v-.22a6.56 6.56 0 00-2.15-3.53z' /%3E%3C/svg%3E%0A\")}.icon-partial{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M4.12 11.46A5.62 5.62 0 011.52 8 5.57 5.57 0 013.9 4.67 7.52 7.52 0 018 3.5a7.7 7.7 0 013.33.75l.74-.74A8.67 8.67 0 008 2.5a8.53 8.53 0 00-4.65 1.33A6.57 6.57 0 00.51 7.89v.22a6.54 6.54 0 002.88 4.08z' fill='%23444'/%3E%3Cpath d='M8 5a3 3 0 00-3 3 3 3 0 00.69 1.89l4.2-4.2A3 3 0 008 5zM5.88 5.88zM9.2 12.41a.51.51 0 00-.42.57.5.5 0 00.56.42.5.5 0 00.43-.57.51.51 0 00-.57-.42zM6.77 12.41a.5.5 0 00-.57.42.49.49 0 00.41.57.5.5 0 10.15-1zM14.48 5.61a.5.5 0 00-.7-.12.49.49 0 00-.12.69.5.5 0 00.82-.57zM11.5 11.68a.5.5 0 00-.22.67.51.51 0 00.68.22.5.5 0 00-.46-.89zM15.07 7.77a.52.52 0 00-.62.35.51.51 0 00.35.62.5.5 0 00.61-.35.52.52 0 00-.34-.62zM13.36 10.21a.5.5 0 10.76.64.49.49 0 00-.06-.7.51.51 0 00-.7.06z' fill='%23444'/%3E%3C/svg%3E\")}";
|
|
97634
99273
|
|
|
97635
99274
|
let SceneTreeTableCell = class extends HTMLElement$1 {
|
|
97636
99275
|
constructor() {
|
|
@@ -98745,52 +100384,6 @@ class FlyToPartKeyInteraction {
|
|
|
98745
100384
|
}
|
|
98746
100385
|
}
|
|
98747
100386
|
|
|
98748
|
-
class FlyToPositionKeyInteraction {
|
|
98749
|
-
constructor(stream, configProvider, imageScaleProvider, sceneProvider) {
|
|
98750
|
-
this.stream = stream;
|
|
98751
|
-
this.configProvider = configProvider;
|
|
98752
|
-
this.imageScaleProvider = imageScaleProvider;
|
|
98753
|
-
this.sceneProvider = sceneProvider;
|
|
98754
|
-
}
|
|
98755
|
-
predicate(e) {
|
|
98756
|
-
return e.altKey && e.shiftKey;
|
|
98757
|
-
}
|
|
98758
|
-
async fn(e) {
|
|
98759
|
-
var _a, _b;
|
|
98760
|
-
const scale = this.imageScaleProvider();
|
|
98761
|
-
const hitResult = await this.stream.hitItems({
|
|
98762
|
-
point: point.scale(e.position, (scale === null || scale === void 0 ? void 0 : scale.x) || 1, (scale === null || scale === void 0 ? void 0 : scale.y) || 1),
|
|
98763
|
-
}, true);
|
|
98764
|
-
if (((_a = hitResult.hitItems) === null || _a === void 0 ? void 0 : _a.hits) != null &&
|
|
98765
|
-
hitResult.hitItems.hits.length > 0 &&
|
|
98766
|
-
hitResult.hitItems.hits[0].hitPoint != null) {
|
|
98767
|
-
const camera = this.sceneProvider().camera();
|
|
98768
|
-
const hit = hitResult.hitItems.hits[0];
|
|
98769
|
-
if (hit.hitPoint != null &&
|
|
98770
|
-
hit.hitPoint.x != null &&
|
|
98771
|
-
hit.hitPoint.y != null &&
|
|
98772
|
-
hit.hitPoint.z != null) {
|
|
98773
|
-
await this.stream.flyTo({
|
|
98774
|
-
camera: camera
|
|
98775
|
-
.update({
|
|
98776
|
-
lookAt: vector3.create(hit.hitPoint.x, hit.hitPoint.y, hit.hitPoint.z),
|
|
98777
|
-
})
|
|
98778
|
-
.toFrameCamera(),
|
|
98779
|
-
animation: {
|
|
98780
|
-
duration: toProtoDuration(this.configProvider().animation.durationMs),
|
|
98781
|
-
},
|
|
98782
|
-
});
|
|
98783
|
-
}
|
|
98784
|
-
else {
|
|
98785
|
-
console.debug(`No hit position found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}, hit-id={${(_b = hit.itemId) === null || _b === void 0 ? void 0 : _b.hex}}]`);
|
|
98786
|
-
}
|
|
98787
|
-
}
|
|
98788
|
-
else {
|
|
98789
|
-
console.debug(`No hit results found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}]`);
|
|
98790
|
-
}
|
|
98791
|
-
}
|
|
98792
|
-
}
|
|
98793
|
-
|
|
98794
100387
|
/**
|
|
98795
100388
|
* The `InteractionApi` provides methods that API developers can use to modify
|
|
98796
100389
|
* the internal state of an interaction.
|
|
@@ -98998,27 +100591,6 @@ class InteractionApi {
|
|
|
98998
100591
|
return camera;
|
|
98999
100592
|
});
|
|
99000
100593
|
}
|
|
99001
|
-
/**
|
|
99002
|
-
* Performs a pan operation of the scene's camera, and requests a new image
|
|
99003
|
-
* for the updated scene.
|
|
99004
|
-
*
|
|
99005
|
-
* @param delta A position delta `{x, y}` in the 2D coordinate space of the
|
|
99006
|
-
* viewer.
|
|
99007
|
-
*/
|
|
99008
|
-
async panCameraByDelta(delta) {
|
|
99009
|
-
return this.transformCamera(({ camera, viewport }) => {
|
|
99010
|
-
const vv = camera.viewVector();
|
|
99011
|
-
const u = vector3.normalize(camera.up);
|
|
99012
|
-
const v = vector3.normalize(vv);
|
|
99013
|
-
const d = vector3.magnitude(vv) * Math.tan(camera.fovY);
|
|
99014
|
-
const epsilonX = (delta.x * d) / viewport.width;
|
|
99015
|
-
const epsilonY = (delta.y / viewport.width) * d;
|
|
99016
|
-
const xvec = vector3.cross(u, v);
|
|
99017
|
-
const yvec = vector3.cross(v, xvec);
|
|
99018
|
-
const offset = vector3.add(vector3.scale(epsilonX, xvec), vector3.scale(epsilonY, yvec));
|
|
99019
|
-
return camera.moveBy(offset);
|
|
99020
|
-
});
|
|
99021
|
-
}
|
|
99022
100594
|
/**
|
|
99023
100595
|
* Performs a view all operation for the scene's bounding box, and requests a
|
|
99024
100596
|
* new image for the updated scene.
|
|
@@ -99077,8 +100649,8 @@ class InteractionApi {
|
|
|
99077
100649
|
return updated.update({
|
|
99078
100650
|
// Scale the lookAt point to the same length as the distance to the
|
|
99079
100651
|
// center of the bounding box to maintain zoom and pan behavior.
|
|
99080
|
-
lookAt: vector3.add(vector3.scale(camera.
|
|
99081
|
-
vector3.magnitude(updated.viewVector
|
|
100652
|
+
lookAt: vector3.add(vector3.scale(Math.abs(camera.signedDistanceToBoundingBoxCenter()) /
|
|
100653
|
+
vector3.magnitude(updated.viewVector), updated.viewVector), updated.position),
|
|
99082
100654
|
});
|
|
99083
100655
|
});
|
|
99084
100656
|
}
|
|
@@ -99091,7 +100663,7 @@ class InteractionApi {
|
|
|
99091
100663
|
*/
|
|
99092
100664
|
async zoomCamera(delta) {
|
|
99093
100665
|
return this.transformCamera(({ camera, viewport }) => {
|
|
99094
|
-
const vv = camera.viewVector
|
|
100666
|
+
const vv = camera.viewVector;
|
|
99095
100667
|
const v = vector3.normalize(vv);
|
|
99096
100668
|
const distance = vector3.magnitude(vv);
|
|
99097
100669
|
const epsilon = (3 * distance * delta) / viewport.height;
|
|
@@ -99212,6 +100784,235 @@ class InteractionApi {
|
|
|
99212
100784
|
}
|
|
99213
100785
|
}
|
|
99214
100786
|
|
|
100787
|
+
class InteractionApiOrthographic extends InteractionApi {
|
|
100788
|
+
constructor(stream, cursors, getConfig, getScene, getFrame, getViewport, tapEmitter, doubleTapEmitter, longPressEmitter, interactionStartedEmitter, interactionFinishedEmitter) {
|
|
100789
|
+
super(stream, cursors, getConfig, getScene, getFrame, getViewport, tapEmitter, doubleTapEmitter, longPressEmitter, interactionStartedEmitter, interactionFinishedEmitter);
|
|
100790
|
+
}
|
|
100791
|
+
/**
|
|
100792
|
+
* Performs a pan operation of the scene's camera, and requests a new image
|
|
100793
|
+
* for the updated scene.
|
|
100794
|
+
*
|
|
100795
|
+
* @param delta A position delta `{x, y}` in the 2D coordinate space of the
|
|
100796
|
+
* viewer.
|
|
100797
|
+
*/
|
|
100798
|
+
async panCameraByDelta(delta) {
|
|
100799
|
+
return this.transformCamera(({ camera, viewport }) => {
|
|
100800
|
+
const viewVector = camera.viewVector;
|
|
100801
|
+
const normalizedUpVector = vector3.normalize(camera.up);
|
|
100802
|
+
const normalizedViewVector = vector3.normalize(viewVector);
|
|
100803
|
+
const d = vector3.magnitude(viewVector) * Math.tan(camera.fovHeight);
|
|
100804
|
+
const epsilonX = (delta.x * d) / viewport.width;
|
|
100805
|
+
const epsilonY = (delta.y / viewport.width) * d;
|
|
100806
|
+
const xvec = vector3.cross(normalizedUpVector, normalizedViewVector);
|
|
100807
|
+
const yvec = vector3.cross(normalizedViewVector, xvec);
|
|
100808
|
+
const offset = vector3.add(vector3.scale(epsilonX, xvec), vector3.scale(epsilonY, yvec));
|
|
100809
|
+
return camera.moveBy(offset);
|
|
100810
|
+
});
|
|
100811
|
+
}
|
|
100812
|
+
/**
|
|
100813
|
+
* Moves the camera's position and look at to the given screen coordinate.
|
|
100814
|
+
*
|
|
100815
|
+
* If the screen coordinate intersects with an object, the camera will track
|
|
100816
|
+
* the hit point so the mouse position is always under the mouse.
|
|
100817
|
+
*
|
|
100818
|
+
* If the screen coordinate doesn't intersect with an object, then ???.
|
|
100819
|
+
*
|
|
100820
|
+
* @param screenPt A point in screen coordinates.
|
|
100821
|
+
*/
|
|
100822
|
+
async panCameraToScreenPoint(screenPt) {
|
|
100823
|
+
return this.transformCamera(({ camera, frame, viewport }) => {
|
|
100824
|
+
// Capture the starting state of the pan.
|
|
100825
|
+
if (this.panData == null) {
|
|
100826
|
+
const startingCamera = camera.toFrameCamera();
|
|
100827
|
+
const direction = startingCamera.direction;
|
|
100828
|
+
const ray$1 = viewport.transformPointToOrthographicRay(screenPt, frame.image, startingCamera);
|
|
100829
|
+
const hitPlane = plane.fromNormalAndCoplanarPoint(direction, camera.lookAt);
|
|
100830
|
+
const hitPt = ray.intersectPlane(ray$1, hitPlane);
|
|
100831
|
+
if (hitPt == null) {
|
|
100832
|
+
console.warn('Cannot determine fallback for pan. Ray does not intersect plane.');
|
|
100833
|
+
return camera;
|
|
100834
|
+
}
|
|
100835
|
+
this.panData = { hitPt, hitPlane, startingCamera };
|
|
100836
|
+
}
|
|
100837
|
+
if (this.panData != null) {
|
|
100838
|
+
const { hitPt, hitPlane, startingCamera } = this.panData;
|
|
100839
|
+
// Use a ray that originates at the screen and intersects with the hit
|
|
100840
|
+
// plane to determine the move distance.
|
|
100841
|
+
const ray$1 = viewport.transformPointToOrthographicRay(screenPt, frame.image, startingCamera);
|
|
100842
|
+
const movePt = ray.intersectPlane(ray$1, hitPlane);
|
|
100843
|
+
if (movePt != null) {
|
|
100844
|
+
const delta = vector3.subtract(hitPt, movePt);
|
|
100845
|
+
return camera.update({
|
|
100846
|
+
lookAt: vector3.add(startingCamera.lookAt, delta),
|
|
100847
|
+
});
|
|
100848
|
+
}
|
|
100849
|
+
}
|
|
100850
|
+
return camera;
|
|
100851
|
+
});
|
|
100852
|
+
}
|
|
100853
|
+
async zoomCameraToPoint(point$1, delta) {
|
|
100854
|
+
return this.transformCamera(({ camera, viewport, frame, depthBuffer }) => {
|
|
100855
|
+
if (this.orthographicZoomData == null ||
|
|
100856
|
+
point.distance(point$1, this.orthographicZoomData.startingScreenPt) > 2) {
|
|
100857
|
+
const frameCam = camera.toFrameCamera();
|
|
100858
|
+
const dir = frameCam.direction;
|
|
100859
|
+
const ray$1 = viewport.transformPointToOrthographicRay(point$1, frame.image, frameCam);
|
|
100860
|
+
const fallbackPlane = plane.fromNormalAndCoplanarPoint(dir, frameCam.lookAt);
|
|
100861
|
+
const fallbackPt = ray.intersectPlane(ray$1, fallbackPlane);
|
|
100862
|
+
if (fallbackPt == null) {
|
|
100863
|
+
console.warn('Cannot determine fallback point for zoom. Ray does not intersect plane.');
|
|
100864
|
+
return camera;
|
|
100865
|
+
}
|
|
100866
|
+
const hitPt = depthBuffer != null
|
|
100867
|
+
? this.getWorldPoint(point$1, depthBuffer, fallbackPt)
|
|
100868
|
+
: fallbackPt;
|
|
100869
|
+
const hitPlane = plane.fromNormalAndCoplanarPoint(dir, hitPt);
|
|
100870
|
+
this.orthographicZoomData = {
|
|
100871
|
+
hitPt,
|
|
100872
|
+
hitPlane,
|
|
100873
|
+
startingScreenPt: point$1,
|
|
100874
|
+
};
|
|
100875
|
+
}
|
|
100876
|
+
if (this.orthographicZoomData != null) {
|
|
100877
|
+
const { hitPt, hitPlane } = this.orthographicZoomData;
|
|
100878
|
+
const relativeDelta = 2 * (camera.fovHeight / viewport.height) * delta;
|
|
100879
|
+
const fovHeight = Math.max(1, camera.fovHeight - relativeDelta);
|
|
100880
|
+
const projectedLookAt = plane.projectPoint(hitPlane, camera.lookAt);
|
|
100881
|
+
const diff = vector3.scale((camera.fovHeight - fovHeight) / camera.fovHeight, vector3.subtract(hitPt, projectedLookAt));
|
|
100882
|
+
return camera.update({
|
|
100883
|
+
lookAt: vector3.add(camera.lookAt, diff),
|
|
100884
|
+
fovHeight: Math.max(1, camera.fovHeight - relativeDelta),
|
|
100885
|
+
});
|
|
100886
|
+
}
|
|
100887
|
+
return camera;
|
|
100888
|
+
});
|
|
100889
|
+
}
|
|
100890
|
+
getWorldPoint(point, depthBuffer, fallbackPoint) {
|
|
100891
|
+
const viewport = this.getViewport();
|
|
100892
|
+
const framePt = viewport.transformPointToFrame(point, depthBuffer);
|
|
100893
|
+
const hasDepth = depthBuffer.hitTest(framePt);
|
|
100894
|
+
return hasDepth
|
|
100895
|
+
? viewport.transformPointToOrthographicWorldSpace(point, depthBuffer)
|
|
100896
|
+
: fallbackPoint;
|
|
100897
|
+
}
|
|
100898
|
+
async transformCamera(t) {
|
|
100899
|
+
var _a;
|
|
100900
|
+
if (this.isInteracting()) {
|
|
100901
|
+
const scene = this.getScene();
|
|
100902
|
+
const viewport = this.getViewport();
|
|
100903
|
+
const frame = this.getFrame();
|
|
100904
|
+
const depthBuffer = await (frame === null || frame === void 0 ? void 0 : frame.depthBuffer());
|
|
100905
|
+
this.currentCamera =
|
|
100906
|
+
this.currentCamera != null && viewport != null && frame != null
|
|
100907
|
+
? t({
|
|
100908
|
+
camera: this.currentCamera,
|
|
100909
|
+
viewport,
|
|
100910
|
+
scale: scene.scale(),
|
|
100911
|
+
boundingBox: scene.boundingBox(),
|
|
100912
|
+
frame,
|
|
100913
|
+
depthBuffer,
|
|
100914
|
+
})
|
|
100915
|
+
: undefined;
|
|
100916
|
+
await ((_a = this.currentCamera) === null || _a === void 0 ? void 0 : _a.render());
|
|
100917
|
+
}
|
|
100918
|
+
}
|
|
100919
|
+
}
|
|
100920
|
+
|
|
100921
|
+
class InteractionApiPerspective extends InteractionApi {
|
|
100922
|
+
constructor(stream, cursors, getConfig, getScene, getFrame, getViewport, tapEmitter, doubleTapEmitter, longPressEmitter, interactionStartedEmitter, interactionFinishedEmitter) {
|
|
100923
|
+
super(stream, cursors, getConfig, getScene, getFrame, getViewport, tapEmitter, doubleTapEmitter, longPressEmitter, interactionStartedEmitter, interactionFinishedEmitter);
|
|
100924
|
+
}
|
|
100925
|
+
/**
|
|
100926
|
+
* Performs a pan operation of the scene's camera, and requests a new image
|
|
100927
|
+
* for the updated scene.
|
|
100928
|
+
*
|
|
100929
|
+
* @param delta A position delta `{x, y}` in the 2D coordinate space of the
|
|
100930
|
+
* viewer.
|
|
100931
|
+
*/
|
|
100932
|
+
async panCameraByDelta(delta) {
|
|
100933
|
+
return this.transformCamera(({ camera, viewport }) => {
|
|
100934
|
+
var _a;
|
|
100935
|
+
const vv = camera.viewVector;
|
|
100936
|
+
const u = vector3.normalize(camera.up);
|
|
100937
|
+
const v = vector3.normalize(vv);
|
|
100938
|
+
const d = vector3.magnitude(vv) * Math.tan((_a = camera.fovY) !== null && _a !== void 0 ? _a : 45);
|
|
100939
|
+
const epsilonX = (delta.x * d) / viewport.width;
|
|
100940
|
+
const epsilonY = (delta.y / viewport.width) * d;
|
|
100941
|
+
const xvec = vector3.cross(u, v);
|
|
100942
|
+
const yvec = vector3.cross(v, xvec);
|
|
100943
|
+
const offset = vector3.add(vector3.scale(epsilonX, xvec), vector3.scale(epsilonY, yvec));
|
|
100944
|
+
return camera.moveBy(offset);
|
|
100945
|
+
});
|
|
100946
|
+
}
|
|
100947
|
+
async transformCamera(t) {
|
|
100948
|
+
var _a;
|
|
100949
|
+
if (this.isInteracting()) {
|
|
100950
|
+
const scene = this.getScene();
|
|
100951
|
+
const viewport = this.getViewport();
|
|
100952
|
+
const frame = this.getFrame();
|
|
100953
|
+
const depthBuffer = await (frame === null || frame === void 0 ? void 0 : frame.depthBuffer());
|
|
100954
|
+
this.currentCamera =
|
|
100955
|
+
this.currentCamera != null && viewport != null && frame != null
|
|
100956
|
+
? t({
|
|
100957
|
+
camera: this.currentCamera,
|
|
100958
|
+
viewport,
|
|
100959
|
+
scale: scene.scale(),
|
|
100960
|
+
boundingBox: scene.boundingBox(),
|
|
100961
|
+
frame,
|
|
100962
|
+
depthBuffer,
|
|
100963
|
+
})
|
|
100964
|
+
: undefined;
|
|
100965
|
+
await ((_a = this.currentCamera) === null || _a === void 0 ? void 0 : _a.render());
|
|
100966
|
+
}
|
|
100967
|
+
}
|
|
100968
|
+
}
|
|
100969
|
+
|
|
100970
|
+
class FlyToPositionKeyInteraction {
|
|
100971
|
+
constructor(stream, configProvider, imageScaleProvider, sceneProvider) {
|
|
100972
|
+
this.stream = stream;
|
|
100973
|
+
this.configProvider = configProvider;
|
|
100974
|
+
this.imageScaleProvider = imageScaleProvider;
|
|
100975
|
+
this.sceneProvider = sceneProvider;
|
|
100976
|
+
}
|
|
100977
|
+
predicate(e) {
|
|
100978
|
+
return e.altKey && e.shiftKey;
|
|
100979
|
+
}
|
|
100980
|
+
async fn(e) {
|
|
100981
|
+
var _a, _b;
|
|
100982
|
+
const scale = this.imageScaleProvider();
|
|
100983
|
+
const hitResult = await this.stream.hitItems({
|
|
100984
|
+
point: point.scale(e.position, (scale === null || scale === void 0 ? void 0 : scale.x) || 1, (scale === null || scale === void 0 ? void 0 : scale.y) || 1),
|
|
100985
|
+
}, true);
|
|
100986
|
+
if (((_a = hitResult.hitItems) === null || _a === void 0 ? void 0 : _a.hits) != null &&
|
|
100987
|
+
hitResult.hitItems.hits.length > 0 &&
|
|
100988
|
+
hitResult.hitItems.hits[0].hitPoint != null) {
|
|
100989
|
+
const camera = this.sceneProvider().camera();
|
|
100990
|
+
const hit = hitResult.hitItems.hits[0];
|
|
100991
|
+
if (hit.hitPoint != null &&
|
|
100992
|
+
hit.hitPoint.x != null &&
|
|
100993
|
+
hit.hitPoint.y != null &&
|
|
100994
|
+
hit.hitPoint.z != null) {
|
|
100995
|
+
await this.stream.flyTo({
|
|
100996
|
+
camera: camera
|
|
100997
|
+
.update({
|
|
100998
|
+
lookAt: vector3.create(hit.hitPoint.x, hit.hitPoint.y, hit.hitPoint.z),
|
|
100999
|
+
})
|
|
101000
|
+
.toFrameCamera(),
|
|
101001
|
+
animation: {
|
|
101002
|
+
duration: toProtoDuration(this.configProvider().animation.durationMs),
|
|
101003
|
+
},
|
|
101004
|
+
});
|
|
101005
|
+
}
|
|
101006
|
+
else {
|
|
101007
|
+
console.debug(`No hit position found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}, hit-id={${(_b = hit.itemId) === null || _b === void 0 ? void 0 : _b.hex}}]`);
|
|
101008
|
+
}
|
|
101009
|
+
}
|
|
101010
|
+
else {
|
|
101011
|
+
console.debug(`No hit results found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}]`);
|
|
101012
|
+
}
|
|
101013
|
+
}
|
|
101014
|
+
}
|
|
101015
|
+
|
|
99215
101016
|
const SCROLL_WHEEL_DELTA_PERCENTAGES = [0.2, 0.15, 0.25, 0.25, 0.15];
|
|
99216
101017
|
const DEFAULT_FONT_SIZE = 16;
|
|
99217
101018
|
const DEFAULT_LINE_HEIGHT = 1.2;
|
|
@@ -99693,7 +101494,8 @@ class MultiTouchInteractionHandler {
|
|
|
99693
101494
|
(_b = this.interactionApi) === null || _b === void 0 ? void 0 : _b.zoomCamera(zoom);
|
|
99694
101495
|
(_c = this.interactionApi) === null || _c === void 0 ? void 0 : _c.panCameraByDelta(delta);
|
|
99695
101496
|
// Setting a minimum angle to prevent wobbling
|
|
99696
|
-
|
|
101497
|
+
console.log(Math.abs(angle$1));
|
|
101498
|
+
if (Math.abs(angle$1) > 0.5) {
|
|
99697
101499
|
(_d = this.interactionApi) === null || _d === void 0 ? void 0 : _d.twistCamera(angle$1);
|
|
99698
101500
|
}
|
|
99699
101501
|
}
|
|
@@ -100746,6 +102548,11 @@ let Viewer = class extends HTMLElement$1 {
|
|
|
100746
102548
|
* the viewer. Enabled by default.
|
|
100747
102549
|
*/
|
|
100748
102550
|
this.cameraControls = true;
|
|
102551
|
+
/**
|
|
102552
|
+
* The type of camera model to represent the scene with. Can be either
|
|
102553
|
+
* `perspective` or `orthographic`, and defaults to `perspective`.
|
|
102554
|
+
*/
|
|
102555
|
+
this.cameraType = 'perspective';
|
|
100749
102556
|
/**
|
|
100750
102557
|
* Enables or disables the default keyboard shortcut interactions provided by
|
|
100751
102558
|
* the viewer. Enabled by default, requires `cameraControls` being enabled.
|
|
@@ -101035,6 +102842,11 @@ let Viewer = class extends HTMLElement$1 {
|
|
|
101035
102842
|
(_b = this.baseInteractionHandler) === null || _b === void 0 ? void 0 : _b.setPrimaryInteractionType('rotate');
|
|
101036
102843
|
}
|
|
101037
102844
|
}
|
|
102845
|
+
handleCameraTypeChanged(updatedCameraType, previousCameraType) {
|
|
102846
|
+
if (updatedCameraType !== previousCameraType) {
|
|
102847
|
+
this.updateCameraType();
|
|
102848
|
+
}
|
|
102849
|
+
}
|
|
101038
102850
|
/**
|
|
101039
102851
|
* @ignore
|
|
101040
102852
|
*/
|
|
@@ -101281,7 +103093,9 @@ let Viewer = class extends HTMLElement$1 {
|
|
|
101281
103093
|
this.frame !== frame) {
|
|
101282
103094
|
const canvas = this.canvasElement.getContext('2d');
|
|
101283
103095
|
if (canvas != null) {
|
|
103096
|
+
const previousFrame = this.frame;
|
|
101284
103097
|
this.frame = frame;
|
|
103098
|
+
this.updateInteractionApi(previousFrame);
|
|
101285
103099
|
const data = {
|
|
101286
103100
|
canvas,
|
|
101287
103101
|
canvasDimensions,
|
|
@@ -101317,7 +103131,9 @@ let Viewer = class extends HTMLElement$1 {
|
|
|
101317
103131
|
if (this.stream == null) {
|
|
101318
103132
|
throw new ComponentInitializationError('Cannot create interaction API. Component has not been initialized.');
|
|
101319
103133
|
}
|
|
101320
|
-
return
|
|
103134
|
+
return this.frame == null || this.frame.scene.camera.isPerspective()
|
|
103135
|
+
? new InteractionApiPerspective(this.stream, this.stateMap.cursorManager, () => this.getResolvedConfig().interactions, () => this.createScene(), () => this.frame, () => this.viewport, this.tap, this.doubletap, this.longpress, this.interactionStarted, this.interactionFinished)
|
|
103136
|
+
: new InteractionApiOrthographic(this.stream, this.stateMap.cursorManager, () => this.getResolvedConfig().interactions, () => this.createScene(), () => this.frame, () => this.viewport, this.tap, this.doubletap, this.longpress, this.interactionStarted, this.interactionFinished);
|
|
101321
103137
|
}
|
|
101322
103138
|
handleCursorChanged() {
|
|
101323
103139
|
window.requestAnimationFrame(() => {
|
|
@@ -101377,6 +103193,35 @@ let Viewer = class extends HTMLElement$1 {
|
|
|
101377
103193
|
var _a;
|
|
101378
103194
|
(_a = this.stream) === null || _a === void 0 ? void 0 : _a.update({ streamAttributes: this.getStreamAttributes() });
|
|
101379
103195
|
}
|
|
103196
|
+
updateInteractionApi(previousFrame) {
|
|
103197
|
+
if (previousFrame != null && this.frame != null) {
|
|
103198
|
+
const hasChangedFromPerspective = previousFrame.scene.camera.isPerspective() &&
|
|
103199
|
+
this.frame.scene.camera.isOrthographic();
|
|
103200
|
+
const hasChangedFromOrthographic = previousFrame.scene.camera.isOrthographic() &&
|
|
103201
|
+
this.frame.scene.camera.isPerspective();
|
|
103202
|
+
if (hasChangedFromPerspective || hasChangedFromOrthographic) {
|
|
103203
|
+
this.interactionApi = this.createInteractionApi();
|
|
103204
|
+
this.interactionHandlers.forEach((handler) => this.initializeInteractionHandler(handler));
|
|
103205
|
+
}
|
|
103206
|
+
}
|
|
103207
|
+
}
|
|
103208
|
+
updateCameraType() {
|
|
103209
|
+
var _a, _b;
|
|
103210
|
+
if (this.frame != null) {
|
|
103211
|
+
if (this.cameraType === 'orthographic' &&
|
|
103212
|
+
this.frame.scene.camera.isPerspective()) {
|
|
103213
|
+
(_a = this.stream) === null || _a === void 0 ? void 0 : _a.replaceCamera({
|
|
103214
|
+
camera: toProtobuf(toOrthographic(this.frame.scene.camera, this.frame.scene.boundingBox)),
|
|
103215
|
+
});
|
|
103216
|
+
}
|
|
103217
|
+
else if (this.cameraType === 'perspective' &&
|
|
103218
|
+
this.frame.scene.camera.isOrthographic()) {
|
|
103219
|
+
(_b = this.stream) === null || _b === void 0 ? void 0 : _b.replaceCamera({
|
|
103220
|
+
camera: toProtobuf(toPerspective(this.frame.scene.camera)),
|
|
103221
|
+
});
|
|
103222
|
+
}
|
|
103223
|
+
}
|
|
103224
|
+
}
|
|
101380
103225
|
getDepthBufferStreamAttributesValue() {
|
|
101381
103226
|
var _a;
|
|
101382
103227
|
const depthBuffer = (_a = this.depthBuffers) !== null && _a !== void 0 ? _a : (this.rotateAroundTapPoint ? 'final' : undefined);
|
|
@@ -101417,6 +103262,7 @@ let Viewer = class extends HTMLElement$1 {
|
|
|
101417
103262
|
static get watchers() { return {
|
|
101418
103263
|
"src": ["handleSrcChanged"],
|
|
101419
103264
|
"rotateAroundTapPoint": ["handleRotateAboutTapPointChanged"],
|
|
103265
|
+
"cameraType": ["handleCameraTypeChanged"],
|
|
101420
103266
|
"depthBuffers": ["handleDepthBuffersChanged"],
|
|
101421
103267
|
"experimentalGhostingOpacity": ["handleExperimentalGhostingOpacityChanged"],
|
|
101422
103268
|
"featureLines": ["handleFeatureLinesChanged"],
|
|
@@ -101926,7 +103772,9 @@ function getScreenPosition(pt, projectionViewMatrix, viewport) {
|
|
|
101926
103772
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
101927
103773
|
const Renderer3d = ({ camera, viewport }, children) => {
|
|
101928
103774
|
const pMatrix = matrix4.toObject(camera.projectionMatrix);
|
|
101929
|
-
const fovY =
|
|
103775
|
+
const fovY = camera.isOrthographic()
|
|
103776
|
+
? ((camera.far * 2) / (camera.fovHeight * 2)) * (viewport.height / 2)
|
|
103777
|
+
: pMatrix.m22 * (viewport.height / 2);
|
|
101930
103778
|
const cameraTransform = [
|
|
101931
103779
|
`translateZ(${fovY}px)`,
|
|
101932
103780
|
getCameraCssMatrix(camera.viewMatrix),
|
|
@@ -102106,11 +103954,10 @@ let ViewerDomRenderer = class extends HTMLElement$1 {
|
|
|
102106
103954
|
this.invalidateFrame();
|
|
102107
103955
|
}
|
|
102108
103956
|
async updatePropsFromViewer() {
|
|
102109
|
-
var _a;
|
|
102110
103957
|
const { frame, depthBuffers } = this.viewer || {};
|
|
102111
103958
|
this.depthBuffer =
|
|
102112
103959
|
depthBuffers === 'all' ? await (frame === null || frame === void 0 ? void 0 : frame.depthBuffer()) : undefined;
|
|
102113
|
-
this.camera =
|
|
103960
|
+
this.camera = frame === null || frame === void 0 ? void 0 : frame.scene.camera;
|
|
102114
103961
|
}
|
|
102115
103962
|
get hostEl() { return this; }
|
|
102116
103963
|
static get watchers() { return {
|
|
@@ -103872,10 +105719,11 @@ function getMeasurementBoundingClientRect(el) {
|
|
|
103872
105719
|
}
|
|
103873
105720
|
|
|
103874
105721
|
class PointToPointHitTester {
|
|
103875
|
-
constructor(stencil, depthBuffer, viewport) {
|
|
105722
|
+
constructor(stencil, depthBuffer, viewport, camera) {
|
|
103876
105723
|
this.stencil = stencil;
|
|
103877
105724
|
this.depthBuffer = depthBuffer;
|
|
103878
105725
|
this.viewport = viewport;
|
|
105726
|
+
this.camera = camera;
|
|
103879
105727
|
}
|
|
103880
105728
|
hitTest(pt) {
|
|
103881
105729
|
const dpt = this.viewport.transformPointToFrame(pt, this.depthBuffer);
|
|
@@ -103900,10 +105748,14 @@ class PointToPointHitTester {
|
|
|
103900
105748
|
transformPointToWorld(pt, { ignoreHitTest = false } = {}) {
|
|
103901
105749
|
const buffer = this.pickDepthBuffer(pt);
|
|
103902
105750
|
if (buffer != null) {
|
|
103903
|
-
return this.
|
|
105751
|
+
return this.camera == null || this.camera.isPerspective()
|
|
105752
|
+
? this.viewport.transformPointToWorldSpace(pt, buffer)
|
|
105753
|
+
: this.viewport.transformPointToOrthographicWorldSpace(pt, buffer);
|
|
103904
105754
|
}
|
|
103905
105755
|
else if (ignoreHitTest) {
|
|
103906
|
-
return this.
|
|
105756
|
+
return this.camera == null || this.camera.isPerspective()
|
|
105757
|
+
? this.viewport.transformPointToWorldSpace(pt, this.depthBuffer)
|
|
105758
|
+
: this.viewport.transformPointToOrthographicWorldSpace(pt, this.depthBuffer);
|
|
103907
105759
|
}
|
|
103908
105760
|
}
|
|
103909
105761
|
pickDepthBuffer(pt) {
|
|
@@ -104839,7 +106691,7 @@ let ViewerMeasurementDistance = class extends HTMLElement$1 {
|
|
|
104839
106691
|
getHitTester() {
|
|
104840
106692
|
const { stencil, depthBuffer } = this.stateMap;
|
|
104841
106693
|
if (depthBuffer != null) {
|
|
104842
|
-
return new PointToPointHitTester(stencil, depthBuffer, this.viewport);
|
|
106694
|
+
return new PointToPointHitTester(stencil, depthBuffer, this.viewport, this.internalCamera);
|
|
104843
106695
|
}
|
|
104844
106696
|
}
|
|
104845
106697
|
updateMeasurementPropsFromModel() {
|
|
@@ -106070,7 +107922,7 @@ const VertexSceneTreeTableLayout = /*@__PURE__*/proxyCustomElement(SceneTreeTabl
|
|
|
106070
107922
|
const VertexSceneTreeTableResizeDivider = /*@__PURE__*/proxyCustomElement(SceneTreeTableResizeDivider, [1,"vertex-scene-tree-table-resize-divider",{"dragging":[32]}]);
|
|
106071
107923
|
const VertexSceneTreeToolbar = /*@__PURE__*/proxyCustomElement(SceneTreeToolbar, [1,"vertex-scene-tree-toolbar"]);
|
|
106072
107924
|
const VertexSceneTreeToolbarGroup = /*@__PURE__*/proxyCustomElement(SceneTreeToolbarGroup, [1,"vertex-scene-tree-toolbar-group"]);
|
|
106073
|
-
const VertexViewer = /*@__PURE__*/proxyCustomElement(Viewer, [1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"experimentalGhostingOpacity":[2,"experimental-ghosting-opacity"],"featureLines":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"selectionMaterial":[1,"selection-material"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32]},[[0,"tap","handleTapEvent"]]]);
|
|
107925
|
+
const VertexViewer = /*@__PURE__*/proxyCustomElement(Viewer, [1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"cameraType":[1,"camera-type"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"experimentalGhostingOpacity":[2,"experimental-ghosting-opacity"],"featureLines":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"selectionMaterial":[1,"selection-material"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32]},[[0,"tap","handleTapEvent"]]]);
|
|
106074
107926
|
const VertexViewerButton = /*@__PURE__*/proxyCustomElement(ViewerButton, [1,"vertex-viewer-button"]);
|
|
106075
107927
|
const VertexViewerDefaultToolbar = /*@__PURE__*/proxyCustomElement(ViewerDefaultToolbar, [1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]);
|
|
106076
107928
|
const VertexViewerDomElement = /*@__PURE__*/proxyCustomElement(ViewerDomElement, [1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]);
|
|
@@ -106136,4 +107988,4 @@ const defineCustomElements = (opts) => {
|
|
|
106136
107988
|
}
|
|
106137
107989
|
};
|
|
106138
107990
|
|
|
106139
|
-
export { AngleUnits, AreaUnits, ArrowMarkup, CircleMarkup, colorMaterial as ColorMaterial, CursorManager, DistanceUnits, EntityType, FreeformMarkup, loadableResource as LoadableResource, MeasurementController, MeasurementEntity, MeasurementModel, MeasurementOverlayManager, Frame as ReceivedFrame, FrameImage as ReceivedFrameImage, FrameScene as ReceivedFrameScene, FramePerspectiveCamera as ReceivedPerspectiveCamera, Scene, SynchronizedClock, VertexSceneTree, VertexSceneTreeSearch, VertexSceneTreeTableCell, VertexSceneTreeTableColumn, VertexSceneTreeTableHeader, VertexSceneTreeTableLayout, VertexSceneTreeTableResizeDivider, VertexSceneTreeToolbar, VertexSceneTreeToolbarGroup, VertexViewer, VertexViewerButton, VertexViewerDefaultToolbar, VertexViewerDomElement, VertexViewerDomGroup, VertexViewerDomRenderer, VertexViewerIcon, VertexViewerLayer, VertexViewerMarkup, VertexViewerMarkupArrow, VertexViewerMarkupCircle, VertexViewerMarkupFreeform, VertexViewerMarkupTool, VertexViewerMeasurementDetails, VertexViewerMeasurementDistance, VertexViewerMeasurementLine, VertexViewerMeasurementOverlays, VertexViewerMeasurementPrecise, VertexViewerMeasurementTool, VertexViewerMeasurements, VertexViewerToolbar, VertexViewerToolbarGroup, VertexViewerViewCube, Viewport, __awaiter as _, __generator as a, __spreadArray as b, createCommonjsModule as c, defineCustomElements, makeMinimumDistanceResult, measurementCursor, measurementWithArrowCursor };
|
|
107991
|
+
export { AngleUnits, AreaUnits, ArrowMarkup, CircleMarkup, colorMaterial as ColorMaterial, CursorManager, DistanceUnits, EntityType, FrameCameraBase, FreeformMarkup, loadableResource as LoadableResource, MeasurementController, MeasurementEntity, MeasurementModel, MeasurementOverlayManager, Frame as ReceivedFrame, FrameImage as ReceivedFrameImage, FrameScene as ReceivedFrameScene, FrameOrthographicCamera as ReceivedOrthographicCamera, FramePerspectiveCamera as ReceivedPerspectiveCamera, Scene, SynchronizedClock, VertexSceneTree, VertexSceneTreeSearch, VertexSceneTreeTableCell, VertexSceneTreeTableColumn, VertexSceneTreeTableHeader, VertexSceneTreeTableLayout, VertexSceneTreeTableResizeDivider, VertexSceneTreeToolbar, VertexSceneTreeToolbarGroup, VertexViewer, VertexViewerButton, VertexViewerDefaultToolbar, VertexViewerDomElement, VertexViewerDomGroup, VertexViewerDomRenderer, VertexViewerIcon, VertexViewerLayer, VertexViewerMarkup, VertexViewerMarkupArrow, VertexViewerMarkupCircle, VertexViewerMarkupFreeform, VertexViewerMarkupTool, VertexViewerMeasurementDetails, VertexViewerMeasurementDistance, VertexViewerMeasurementLine, VertexViewerMeasurementOverlays, VertexViewerMeasurementPrecise, VertexViewerMeasurementTool, VertexViewerMeasurements, VertexViewerToolbar, VertexViewerToolbarGroup, VertexViewerViewCube, Viewport, __awaiter as _, __generator as a, __spreadArray as b, createCommonjsModule as c, defineCustomElements, makeMinimumDistanceResult, measurementCursor, measurementWithArrowCursor };
|