@loaders.gl/tiles 3.1.0-alpha.4 → 4.0.0-alpha.1
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/{esm/bundle.js → bundle.js} +0 -0
- package/dist/bundle.js.map +1 -0
- package/dist/{esm/constants.js → constants.js} +0 -0
- package/dist/constants.js.map +1 -0
- package/dist/{esm/index.js → index.js} +0 -0
- package/dist/index.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/3d-tiles-options.js +0 -0
- package/dist/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/bounding-volume.js +0 -0
- package/dist/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/frame-state.js +0 -0
- package/dist/tileset/helpers/frame-state.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/i3s-lod.js +0 -0
- package/dist/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/tiles-3d-lod.js +0 -0
- package/dist/tileset/helpers/tiles-3d-lod.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/transform-utils.js +4 -1
- package/dist/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/zoom.js +0 -0
- package/dist/tileset/helpers/zoom.js.map +1 -0
- package/dist/{esm/tileset → tileset}/tile-3d.js +1 -1
- package/dist/tileset/tile-3d.js.map +1 -0
- package/dist/{esm/tileset → tileset}/tileset-3d.js +5 -5
- package/dist/tileset/tileset-3d.js.map +1 -0
- package/dist/{esm/tileset → tileset}/tileset-cache.js +0 -0
- package/dist/tileset/tileset-cache.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/i3s-tile-manager.js +0 -0
- package/dist/tileset/traversers/i3s-tile-manager.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/i3s-tileset-traverser.js +2 -2
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/tileset-3d-traverser.js +0 -0
- package/dist/tileset/traversers/tileset-3d-traverser.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/tileset-traverser.js +0 -0
- package/dist/tileset/traversers/tileset-traverser.js.map +1 -0
- package/dist/{esm/utils → utils}/doubly-linked-list-node.js +0 -0
- package/dist/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/{esm/utils → utils}/doubly-linked-list.js +0 -0
- package/dist/{es5/utils → utils}/doubly-linked-list.js.map +1 -1
- package/dist/{esm/utils → utils}/managed-array.js +0 -0
- package/dist/utils/managed-array.js.map +1 -0
- package/package.json +10 -8
- package/src/tileset/helpers/transform-utils.ts +3 -1
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/constants.js +0 -44
- package/dist/es5/constants.js.map +0 -1
- package/dist/es5/index.js +0 -96
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js +0 -13
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/es5/tileset/helpers/bounding-volume.js +0 -114
- package/dist/es5/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/es5/tileset/helpers/frame-state.js +0 -65
- package/dist/es5/tileset/helpers/frame-state.js.map +0 -1
- package/dist/es5/tileset/helpers/i3s-lod.js +0 -133
- package/dist/es5/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +0 -119
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/transform-utils.js +0 -62
- package/dist/es5/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/es5/tileset/helpers/zoom.js +0 -43
- package/dist/es5/tileset/helpers/zoom.js.map +0 -1
- package/dist/es5/tileset/tile-3d.js +0 -603
- package/dist/es5/tileset/tile-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-3d.js +0 -838
- package/dist/es5/tileset/tileset-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-cache.js +0 -101
- package/dist/es5/tileset/tileset-cache.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +0 -69
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +0 -185
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js +0 -94
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js +0 -377
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list-node.js +0 -20
- package/dist/es5/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list.js +0 -102
- package/dist/es5/utils/managed-array.js +0 -143
- package/dist/es5/utils/managed-array.js.map +0 -1
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/esm/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/esm/tileset/helpers/frame-state.js.map +0 -1
- package/dist/esm/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/esm/tileset/helpers/zoom.js.map +0 -1
- package/dist/esm/tileset/tile-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-cache.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list.js.map +0 -1
- package/dist/esm/utils/managed-array.js.map +0 -1
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.calculateDynamicScreenSpaceError = calculateDynamicScreenSpaceError;
|
|
7
|
-
exports.fog = fog;
|
|
8
|
-
exports.getDynamicScreenSpaceError = getDynamicScreenSpaceError;
|
|
9
|
-
exports.getTiles3DScreenSpaceError = getTiles3DScreenSpaceError;
|
|
10
|
-
|
|
11
|
-
var _core = require("@math.gl/core");
|
|
12
|
-
|
|
13
|
-
var scratchPositionNormal = new _core.Vector3();
|
|
14
|
-
var scratchCartographic = new _core.Vector3();
|
|
15
|
-
var scratchMatrix = new _core.Matrix4();
|
|
16
|
-
var scratchCenter = new _core.Vector3();
|
|
17
|
-
var scratchPosition = new _core.Vector3();
|
|
18
|
-
var scratchDirection = new _core.Vector3();
|
|
19
|
-
|
|
20
|
-
function calculateDynamicScreenSpaceError(root, _ref) {
|
|
21
|
-
var camera = _ref.camera,
|
|
22
|
-
mapProjection = _ref.mapProjection;
|
|
23
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
24
|
-
var _options$dynamicScree = options.dynamicScreenSpaceErrorHeightFalloff,
|
|
25
|
-
dynamicScreenSpaceErrorHeightFalloff = _options$dynamicScree === void 0 ? 0.25 : _options$dynamicScree,
|
|
26
|
-
_options$dynamicScree2 = options.dynamicScreenSpaceErrorDensity,
|
|
27
|
-
dynamicScreenSpaceErrorDensity = _options$dynamicScree2 === void 0 ? 0.00278 : _options$dynamicScree2;
|
|
28
|
-
var up;
|
|
29
|
-
var direction;
|
|
30
|
-
var height;
|
|
31
|
-
var minimumHeight;
|
|
32
|
-
var maximumHeight;
|
|
33
|
-
var tileBoundingVolume = root.contentBoundingVolume;
|
|
34
|
-
|
|
35
|
-
if (tileBoundingVolume instanceof TileBoundingRegion) {
|
|
36
|
-
up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);
|
|
37
|
-
direction = camera.directionWC;
|
|
38
|
-
height = camera.positionCartographic.height;
|
|
39
|
-
minimumHeight = tileBoundingVolume.minimumHeight;
|
|
40
|
-
maximumHeight = tileBoundingVolume.maximumHeight;
|
|
41
|
-
} else {
|
|
42
|
-
var transformLocal = _core.Matrix4.inverseTransformation(root.computedTransform, scratchMatrix);
|
|
43
|
-
|
|
44
|
-
var ellipsoid = mapProjection.ellipsoid;
|
|
45
|
-
var boundingVolume = tileBoundingVolume.boundingVolume;
|
|
46
|
-
|
|
47
|
-
var centerLocal = _core.Matrix4.multiplyByPoint(transformLocal, boundingVolume.center, scratchCenter);
|
|
48
|
-
|
|
49
|
-
if (Cartesian3.magnitude(centerLocal) > ellipsoid.minimumRadius) {
|
|
50
|
-
var centerCartographic = Cartographic.fromCartesian(centerLocal, ellipsoid, scratchCartographic);
|
|
51
|
-
up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);
|
|
52
|
-
direction = camera.directionWC;
|
|
53
|
-
height = camera.positionCartographic.height;
|
|
54
|
-
minimumHeight = 0.0;
|
|
55
|
-
maximumHeight = centerCartographic.height * 2.0;
|
|
56
|
-
} else {
|
|
57
|
-
var positionLocal = _core.Matrix4.multiplyByPoint(transformLocal, camera.positionWC, scratchPosition);
|
|
58
|
-
|
|
59
|
-
up = Cartesian3.UNIT_Z;
|
|
60
|
-
direction = _core.Matrix4.multiplyByPointAsVector(transformLocal, camera.directionWC, scratchDirection);
|
|
61
|
-
direction = Cartesian3.normalize(direction, direction);
|
|
62
|
-
height = positionLocal.z;
|
|
63
|
-
|
|
64
|
-
if (tileBoundingVolume instanceof TileOrientedBoundingBox) {
|
|
65
|
-
var boxHeight = root._header.boundingVolume.box[11];
|
|
66
|
-
minimumHeight = centerLocal.z - boxHeight;
|
|
67
|
-
maximumHeight = centerLocal.z + boxHeight;
|
|
68
|
-
} else if (tileBoundingVolume instanceof TileBoundingSphere) {
|
|
69
|
-
var radius = boundingVolume.radius;
|
|
70
|
-
minimumHeight = centerLocal.z - radius;
|
|
71
|
-
maximumHeight = centerLocal.z + radius;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
var heightFalloff = dynamicScreenSpaceErrorHeightFalloff;
|
|
77
|
-
var heightClose = minimumHeight + (maximumHeight - minimumHeight) * heightFalloff;
|
|
78
|
-
var heightFar = maximumHeight;
|
|
79
|
-
var t = (0, _core.clamp)((height - heightClose) / (heightFar - heightClose), 0.0, 1.0);
|
|
80
|
-
var dot = Math.abs(Cartesian3.dot(direction, up));
|
|
81
|
-
var horizonFactor = 1.0 - dot;
|
|
82
|
-
horizonFactor = horizonFactor * (1.0 - t);
|
|
83
|
-
return dynamicScreenSpaceErrorDensity * horizonFactor;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function fog(distanceToCamera, density) {
|
|
87
|
-
var scalar = distanceToCamera * density;
|
|
88
|
-
return 1.0 - Math.exp(-(scalar * scalar));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function getDynamicScreenSpaceError(tileset, distanceToCamera) {
|
|
92
|
-
if (tileset.dynamicScreenSpaceError && tileset.dynamicScreenSpaceErrorComputedDensity) {
|
|
93
|
-
var density = tileset.dynamicScreenSpaceErrorComputedDensity;
|
|
94
|
-
var factor = tileset.dynamicScreenSpaceErrorFactor;
|
|
95
|
-
var dynamicError = fog(distanceToCamera, density) * factor;
|
|
96
|
-
return dynamicError;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {
|
|
103
|
-
var tileset = tile.tileset;
|
|
104
|
-
var parentLodMetricValue = tile.parent && tile.parent.lodMetricValue || tile.lodMetricValue;
|
|
105
|
-
var lodMetricValue = useParentLodMetric ? parentLodMetricValue : tile.lodMetricValue;
|
|
106
|
-
|
|
107
|
-
if (lodMetricValue === 0.0) {
|
|
108
|
-
return 0.0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var distance = Math.max(tile._distanceToCamera, 1e-7);
|
|
112
|
-
var height = frameState.height,
|
|
113
|
-
sseDenominator = frameState.sseDenominator;
|
|
114
|
-
var viewDistanceScale = tileset.options.viewDistanceScale;
|
|
115
|
-
var error = lodMetricValue * height * (viewDistanceScale || 1.0) / (distance * sseDenominator);
|
|
116
|
-
error -= getDynamicScreenSpaceError(tileset, distance);
|
|
117
|
-
return error;
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=tiles-3d-lod.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tileset/helpers/tiles-3d-lod.ts"],"names":["scratchPositionNormal","Vector3","scratchCartographic","scratchMatrix","Matrix4","scratchCenter","scratchPosition","scratchDirection","calculateDynamicScreenSpaceError","root","camera","mapProjection","options","dynamicScreenSpaceErrorHeightFalloff","dynamicScreenSpaceErrorDensity","up","direction","height","minimumHeight","maximumHeight","tileBoundingVolume","contentBoundingVolume","TileBoundingRegion","Cartesian3","normalize","positionWC","directionWC","positionCartographic","transformLocal","inverseTransformation","computedTransform","ellipsoid","boundingVolume","centerLocal","multiplyByPoint","center","magnitude","minimumRadius","centerCartographic","Cartographic","fromCartesian","positionLocal","UNIT_Z","multiplyByPointAsVector","z","TileOrientedBoundingBox","boxHeight","_header","box","TileBoundingSphere","radius","heightFalloff","heightClose","heightFar","t","dot","Math","abs","horizonFactor","fog","distanceToCamera","density","scalar","exp","getDynamicScreenSpaceError","tileset","dynamicScreenSpaceError","dynamicScreenSpaceErrorComputedDensity","factor","dynamicScreenSpaceErrorFactor","dynamicError","getTiles3DScreenSpaceError","tile","frameState","useParentLodMetric","parentLodMetricValue","parent","lodMetricValue","distance","max","_distanceToCamera","sseDenominator","viewDistanceScale","error"],"mappings":"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","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - Dynamic screen space error provides an optimization when looking at\n// tilesets from above\n\n/* eslint-disable */\n// @ts-nocheck\nimport {Matrix4, Vector3, clamp} from '@math.gl/core';\n\nconst scratchPositionNormal = new Vector3();\nconst scratchCartographic = new Vector3();\nconst scratchMatrix = new Matrix4();\nconst scratchCenter = new Vector3();\nconst scratchPosition = new Vector3();\nconst scratchDirection = new Vector3();\n\n// eslint-disable-next-line max-statements, complexity\nexport function calculateDynamicScreenSpaceError(root, {camera, mapProjection}, options = {}) {\n const {dynamicScreenSpaceErrorHeightFalloff = 0.25, dynamicScreenSpaceErrorDensity = 0.00278} =\n options;\n\n let up;\n let direction;\n let height;\n let minimumHeight;\n let maximumHeight;\n\n const tileBoundingVolume = root.contentBoundingVolume;\n\n if (tileBoundingVolume instanceof TileBoundingRegion) {\n up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);\n direction = camera.directionWC;\n height = camera.positionCartographic.height;\n minimumHeight = tileBoundingVolume.minimumHeight;\n maximumHeight = tileBoundingVolume.maximumHeight;\n } else {\n // Transform camera position and direction into the local coordinate system of the tileset\n const transformLocal = Matrix4.inverseTransformation(root.computedTransform, scratchMatrix);\n const ellipsoid = mapProjection.ellipsoid;\n const boundingVolume = tileBoundingVolume.boundingVolume;\n const centerLocal = Matrix4.multiplyByPoint(\n transformLocal,\n boundingVolume.center,\n scratchCenter\n );\n if (Cartesian3.magnitude(centerLocal) > ellipsoid.minimumRadius) {\n // The tileset is defined in WGS84. Approximate the minimum and maximum height.\n const centerCartographic = Cartographic.fromCartesian(\n centerLocal,\n ellipsoid,\n scratchCartographic\n );\n up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);\n direction = camera.directionWC;\n height = camera.positionCartographic.height;\n minimumHeight = 0.0;\n maximumHeight = centerCartographic.height * 2.0;\n } else {\n // The tileset is defined in local coordinates (z-up)\n const positionLocal = Matrix4.multiplyByPoint(\n transformLocal,\n camera.positionWC,\n scratchPosition\n );\n up = Cartesian3.UNIT_Z;\n direction = Matrix4.multiplyByPointAsVector(\n transformLocal,\n camera.directionWC,\n scratchDirection\n );\n direction = Cartesian3.normalize(direction, direction);\n height = positionLocal.z;\n if (tileBoundingVolume instanceof TileOrientedBoundingBox) {\n // Assuming z-up, the last component stores the half-height of the box\n const boxHeight = root._header.boundingVolume.box[11];\n minimumHeight = centerLocal.z - boxHeight;\n maximumHeight = centerLocal.z + boxHeight;\n } else if (tileBoundingVolume instanceof TileBoundingSphere) {\n const radius = boundingVolume.radius;\n minimumHeight = centerLocal.z - radius;\n maximumHeight = centerLocal.z + radius;\n }\n }\n }\n\n // The range where the density starts to lessen. Start at the quarter height of the tileset.\n const heightFalloff = dynamicScreenSpaceErrorHeightFalloff;\n const heightClose = minimumHeight + (maximumHeight - minimumHeight) * heightFalloff;\n const heightFar = maximumHeight;\n\n const t = clamp((height - heightClose) / (heightFar - heightClose), 0.0, 1.0);\n\n // Increase density as the camera tilts towards the horizon\n const dot = Math.abs(Cartesian3.dot(direction, up));\n\n let horizonFactor = 1.0 - dot;\n\n // Weaken the horizon factor as the camera height increases, implying the camera is further away from the tileset.\n // The goal is to increase density for the \"street view\", not when viewing the tileset from a distance.\n horizonFactor = horizonFactor * (1.0 - t);\n\n return dynamicScreenSpaceErrorDensity * horizonFactor;\n}\n\nexport function fog(distanceToCamera, density) {\n const scalar = distanceToCamera * density;\n return 1.0 - Math.exp(-(scalar * scalar));\n}\n\nexport function getDynamicScreenSpaceError(tileset, distanceToCamera) {\n if (tileset.dynamicScreenSpaceError && tileset.dynamicScreenSpaceErrorComputedDensity) {\n const density = tileset.dynamicScreenSpaceErrorComputedDensity;\n const factor = tileset.dynamicScreenSpaceErrorFactor;\n // TODO: Refined screen space error that minimizes tiles in non-first-person\n const dynamicError = fog(distanceToCamera, density) * factor;\n return dynamicError;\n }\n\n return 0;\n}\n\nexport function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {\n const tileset = tile.tileset;\n const parentLodMetricValue = (tile.parent && tile.parent.lodMetricValue) || tile.lodMetricValue;\n const lodMetricValue = useParentLodMetric ? parentLodMetricValue : tile.lodMetricValue;\n\n // Leaf tiles do not have any error so save the computation\n if (lodMetricValue === 0.0) {\n return 0.0;\n }\n\n // TODO: Orthographic Frustum needs special treatment?\n // this._getOrthograhicScreenSpaceError();\n\n // Avoid divide by zero when viewer is inside the tile\n const distance = Math.max(tile._distanceToCamera, 1e-7);\n const {height, sseDenominator} = frameState;\n const {viewDistanceScale} = tileset.options;\n let error = (lodMetricValue * height * (viewDistanceScale || 1.0)) / (distance * sseDenominator);\n\n error -= getDynamicScreenSpaceError(tileset, distance);\n\n return error;\n}\n"],"file":"tiles-3d-lod.js"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.calculateTransformProps = calculateTransformProps;
|
|
7
|
-
|
|
8
|
-
var _geospatial = require("@math.gl/geospatial");
|
|
9
|
-
|
|
10
|
-
var _core = require("@math.gl/core");
|
|
11
|
-
|
|
12
|
-
var _loaderUtils = require("@loaders.gl/loader-utils");
|
|
13
|
-
|
|
14
|
-
function calculateTransformProps(tileHeader, tile) {
|
|
15
|
-
(0, _loaderUtils.assert)(tileHeader);
|
|
16
|
-
(0, _loaderUtils.assert)(tile);
|
|
17
|
-
var rtcCenter = tile.rtcCenter,
|
|
18
|
-
gltfUpAxis = tile.gltfUpAxis;
|
|
19
|
-
var computedTransform = tileHeader.computedTransform,
|
|
20
|
-
center = tileHeader.boundingVolume.center;
|
|
21
|
-
var modelMatrix = new _core.Matrix4(computedTransform);
|
|
22
|
-
|
|
23
|
-
if (rtcCenter) {
|
|
24
|
-
modelMatrix.translate(rtcCenter);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
switch (gltfUpAxis) {
|
|
28
|
-
case 'Z':
|
|
29
|
-
break;
|
|
30
|
-
|
|
31
|
-
case 'Y':
|
|
32
|
-
var rotationY = new _core.Matrix4().rotateX(Math.PI / 2);
|
|
33
|
-
modelMatrix = modelMatrix.multiplyRight(rotationY);
|
|
34
|
-
break;
|
|
35
|
-
|
|
36
|
-
case 'X':
|
|
37
|
-
var rotationX = new _core.Matrix4().rotateY(-Math.PI / 2);
|
|
38
|
-
modelMatrix = modelMatrix.multiplyRight(rotationX);
|
|
39
|
-
break;
|
|
40
|
-
|
|
41
|
-
default:
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (tile.isQuantized) {
|
|
46
|
-
modelMatrix.translate(tile.quantizedVolumeOffset).scale(tile.quantizedVolumeScale);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
var cartesianOrigin = new _core.Vector3(center);
|
|
50
|
-
tile.cartesianModelMatrix = modelMatrix;
|
|
51
|
-
tile.cartesianOrigin = cartesianOrigin;
|
|
52
|
-
|
|
53
|
-
var cartographicOrigin = _geospatial.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new _core.Vector3());
|
|
54
|
-
|
|
55
|
-
var fromFixedFrameMatrix = _geospatial.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);
|
|
56
|
-
|
|
57
|
-
var toFixedFrameMatrix = fromFixedFrameMatrix.invert();
|
|
58
|
-
tile.cartographicModelMatrix = toFixedFrameMatrix.multiplyRight(modelMatrix);
|
|
59
|
-
tile.cartographicOrigin = cartographicOrigin;
|
|
60
|
-
tile.modelMatrix = tile.cartographicModelMatrix;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=transform-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tileset/helpers/transform-utils.ts"],"names":["calculateTransformProps","tileHeader","tile","rtcCenter","gltfUpAxis","computedTransform","center","boundingVolume","modelMatrix","Matrix4","translate","rotationY","rotateX","Math","PI","multiplyRight","rotationX","rotateY","isQuantized","quantizedVolumeOffset","scale","quantizedVolumeScale","cartesianOrigin","Vector3","cartesianModelMatrix","cartographicOrigin","Ellipsoid","WGS84","cartesianToCartographic","fromFixedFrameMatrix","eastNorthUpToFixedFrame","toFixedFrameMatrix","invert","cartographicModelMatrix"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEO,SAASA,uBAAT,CAAiCC,UAAjC,EAA6CC,IAA7C,EAAmD;AACxD,2BAAOD,UAAP;AACA,2BAAOC,IAAP;AAEA,MAAOC,SAAP,GAAgCD,IAAhC,CAAOC,SAAP;AAAA,MAAkBC,UAAlB,GAAgCF,IAAhC,CAAkBE,UAAlB;AACA,MACEC,iBADF,GAGIJ,UAHJ,CACEI,iBADF;AAAA,MAEmBC,MAFnB,GAGIL,UAHJ,CAEEM,cAFF,CAEmBD,MAFnB;AAKA,MAAIE,WAAW,GAAG,IAAIC,aAAJ,CAAYJ,iBAAZ,CAAlB;;AAGA,MAAIF,SAAJ,EAAe;AACbK,IAAAA,WAAW,CAACE,SAAZ,CAAsBP,SAAtB;AACD;;AAID,UAAQC,UAAR;AACE,SAAK,GAAL;AACE;;AACF,SAAK,GAAL;AACE,UAAMO,SAAS,GAAG,IAAIF,aAAJ,GAAcG,OAAd,CAAsBC,IAAI,CAACC,EAAL,GAAU,CAAhC,CAAlB;AACAN,MAAAA,WAAW,GAAGA,WAAW,CAACO,aAAZ,CAA0BJ,SAA1B,CAAd;AACA;;AACF,SAAK,GAAL;AACE,UAAMK,SAAS,GAAG,IAAIP,aAAJ,GAAcQ,OAAd,CAAsB,CAACJ,IAAI,CAACC,EAAN,GAAW,CAAjC,CAAlB;AACAN,MAAAA,WAAW,GAAGA,WAAW,CAACO,aAAZ,CAA0BC,SAA1B,CAAd;AACA;;AACF;AACE;AAZJ;;AAgBA,MAAId,IAAI,CAACgB,WAAT,EAAsB;AACpBV,IAAAA,WAAW,CAACE,SAAZ,CAAsBR,IAAI,CAACiB,qBAA3B,EAAkDC,KAAlD,CAAwDlB,IAAI,CAACmB,oBAA7D;AACD;;AAGD,MAAMC,eAAe,GAAG,IAAIC,aAAJ,CAAYjB,MAAZ,CAAxB;AAEAJ,EAAAA,IAAI,CAACsB,oBAAL,GAA4BhB,WAA5B;AACAN,EAAAA,IAAI,CAACoB,eAAL,GAAuBA,eAAvB;;AAGA,MAAMG,kBAAkB,GAAGC,sBAAUC,KAAV,CAAgBC,uBAAhB,CACzBN,eADyB,EAEzB,IAAIC,aAAJ,EAFyB,CAA3B;;AAIA,MAAMM,oBAAoB,GAAGH,sBAAUC,KAAV,CAAgBG,uBAAhB,CAAwCR,eAAxC,CAA7B;;AACA,MAAMS,kBAAkB,GAAGF,oBAAoB,CAACG,MAArB,EAA3B;AAEA9B,EAAAA,IAAI,CAAC+B,uBAAL,GAA+BF,kBAAkB,CAAChB,aAAnB,CAAiCP,WAAjC,CAA/B;AACAN,EAAAA,IAAI,CAACuB,kBAAL,GAA0BA,kBAA1B;AAGAvB,EAAAA,IAAI,CAACM,WAAL,GAAmBN,IAAI,CAAC+B,uBAAxB;AACD","sourcesContent":["import {Ellipsoid} from '@math.gl/geospatial';\nimport {Matrix4, Vector3} from '@math.gl/core';\nimport {assert} from '@loaders.gl/loader-utils';\n\nexport function calculateTransformProps(tileHeader, tile) {\n assert(tileHeader);\n assert(tile);\n\n const {rtcCenter, gltfUpAxis} = tile;\n const {\n computedTransform,\n boundingVolume: {center}\n } = tileHeader;\n\n let modelMatrix = new Matrix4(computedTransform);\n\n // Translate if appropriate\n if (rtcCenter) {\n modelMatrix.translate(rtcCenter);\n }\n\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n switch (gltfUpAxis) {\n case 'Z':\n break;\n case 'Y':\n const rotationY = new Matrix4().rotateX(Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationY);\n break;\n case 'X':\n const rotationX = new Matrix4().rotateY(-Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationX);\n break;\n default:\n break;\n }\n\n // Scale/offset positions if normalized integers\n if (tile.isQuantized) {\n modelMatrix.translate(tile.quantizedVolumeOffset).scale(tile.quantizedVolumeScale);\n }\n\n // Option 1: Cartesian matrix and origin\n const cartesianOrigin = new Vector3(center);\n\n tile.cartesianModelMatrix = modelMatrix;\n tile.cartesianOrigin = cartesianOrigin;\n\n // Option 2: Cartographic matrix and origin\n const cartographicOrigin = Ellipsoid.WGS84.cartesianToCartographic(\n cartesianOrigin,\n new Vector3()\n );\n const fromFixedFrameMatrix = Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);\n const toFixedFrameMatrix = fromFixedFrameMatrix.invert();\n\n tile.cartographicModelMatrix = toFixedFrameMatrix.multiplyRight(modelMatrix);\n tile.cartographicOrigin = cartographicOrigin;\n\n // Deprecated, drop\n tile.modelMatrix = tile.cartographicModelMatrix;\n}\n"],"file":"transform-utils.js"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getZoomFromBoundingVolume = getZoomFromBoundingVolume;
|
|
7
|
-
|
|
8
|
-
var _core = require("@math.gl/core");
|
|
9
|
-
|
|
10
|
-
var WGS84_RADIUS_X = 6378137.0;
|
|
11
|
-
var WGS84_RADIUS_Y = 6378137.0;
|
|
12
|
-
var WGS84_RADIUS_Z = 6356752.3142451793;
|
|
13
|
-
var scratchVector = new _core.Vector3();
|
|
14
|
-
|
|
15
|
-
function getZoomFromBoundingVolume(boundingVolume) {
|
|
16
|
-
var halfAxes = boundingVolume.halfAxes,
|
|
17
|
-
radius = boundingVolume.radius,
|
|
18
|
-
width = boundingVolume.width,
|
|
19
|
-
height = boundingVolume.height;
|
|
20
|
-
|
|
21
|
-
if (halfAxes) {
|
|
22
|
-
var obbSize = getObbSize(halfAxes);
|
|
23
|
-
return Math.log2(WGS84_RADIUS_Z / obbSize);
|
|
24
|
-
} else if (radius) {
|
|
25
|
-
return Math.log2(WGS84_RADIUS_Z / radius);
|
|
26
|
-
} else if (height && width) {
|
|
27
|
-
var zoomX = Math.log2(WGS84_RADIUS_X / width);
|
|
28
|
-
var zoomY = Math.log2(WGS84_RADIUS_Y / height);
|
|
29
|
-
return (zoomX + zoomY) / 2;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return 1;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getObbSize(halfAxes) {
|
|
36
|
-
halfAxes.getColumn(0, scratchVector);
|
|
37
|
-
var axeY = halfAxes.getColumn(1);
|
|
38
|
-
var axeZ = halfAxes.getColumn(2);
|
|
39
|
-
var farthestVertex = scratchVector.add(axeY).add(axeZ);
|
|
40
|
-
var size = farthestVertex.len();
|
|
41
|
-
return size;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=zoom.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tileset/helpers/zoom.ts"],"names":["WGS84_RADIUS_X","WGS84_RADIUS_Y","WGS84_RADIUS_Z","scratchVector","Vector3","getZoomFromBoundingVolume","boundingVolume","halfAxes","radius","width","height","obbSize","getObbSize","Math","log2","zoomX","zoomY","getColumn","axeY","axeZ","farthestVertex","add","size","len"],"mappings":";;;;;;;AAAA;;AAEA,IAAMA,cAAc,GAAG,SAAvB;AACA,IAAMC,cAAc,GAAG,SAAvB;AACA,IAAMC,cAAc,GAAG,kBAAvB;AAEA,IAAMC,aAAa,GAAG,IAAIC,aAAJ,EAAtB;;AAOO,SAASC,yBAAT,CAAmCC,cAAnC,EAAmD;AACxD,MAAOC,QAAP,GAA0CD,cAA1C,CAAOC,QAAP;AAAA,MAAiBC,MAAjB,GAA0CF,cAA1C,CAAiBE,MAAjB;AAAA,MAAyBC,KAAzB,GAA0CH,cAA1C,CAAyBG,KAAzB;AAAA,MAAgCC,MAAhC,GAA0CJ,cAA1C,CAAgCI,MAAhC;;AAEA,MAAIH,QAAJ,EAAc;AAEZ,QAAMI,OAAO,GAAGC,UAAU,CAACL,QAAD,CAA1B;AAEA,WAAOM,IAAI,CAACC,IAAL,CAAUZ,cAAc,GAAGS,OAA3B,CAAP;AACD,GALD,MAKO,IAAIH,MAAJ,EAAY;AAEjB,WAAOK,IAAI,CAACC,IAAL,CAAUZ,cAAc,GAAGM,MAA3B,CAAP;AACD,GAHM,MAGA,IAAIE,MAAM,IAAID,KAAd,EAAqB;AAE1B,QAAMM,KAAK,GAAGF,IAAI,CAACC,IAAL,CAAUd,cAAc,GAAGS,KAA3B,CAAd;AACA,QAAMO,KAAK,GAAGH,IAAI,CAACC,IAAL,CAAUb,cAAc,GAAGS,MAA3B,CAAd;AAEA,WAAO,CAACK,KAAK,GAAGC,KAAT,IAAkB,CAAzB;AACD;;AAED,SAAO,CAAP;AACD;;AAED,SAASJ,UAAT,CAAoBL,QAApB,EAA8B;AAC5BA,EAAAA,QAAQ,CAACU,SAAT,CAAmB,CAAnB,EAAsBd,aAAtB;AACA,MAAMe,IAAI,GAAGX,QAAQ,CAACU,SAAT,CAAmB,CAAnB,CAAb;AACA,MAAME,IAAI,GAAGZ,QAAQ,CAACU,SAAT,CAAmB,CAAnB,CAAb;AACA,MAAMG,cAAc,GAAGjB,aAAa,CAACkB,GAAd,CAAkBH,IAAlB,EAAwBG,GAAxB,CAA4BF,IAA5B,CAAvB;AACA,MAAMG,IAAI,GAAGF,cAAc,CAACG,GAAf,EAAb;AACA,SAAOD,IAAP;AACD","sourcesContent":["import {Vector3} from '@math.gl/core';\n\nconst WGS84_RADIUS_X = 6378137.0;\nconst WGS84_RADIUS_Y = 6378137.0;\nconst WGS84_RADIUS_Z = 6356752.3142451793;\n\nconst scratchVector = new Vector3();\n\n/**\n * Calculate appropriate zoom value for a particular boundingVolume\n * @param {BoundingSphere, OrientedBoundingBox} boundingVolume - the instance of bounding volume\n * @returns {number} - zoom value\n */\nexport function getZoomFromBoundingVolume(boundingVolume) {\n const {halfAxes, radius, width, height} = boundingVolume;\n\n if (halfAxes) {\n // OrientedBoundingBox\n const obbSize = getObbSize(halfAxes);\n // Use WGS84_RADIUS_Z to allign with BoundingSphere algorithm\n return Math.log2(WGS84_RADIUS_Z / obbSize);\n } else if (radius) {\n // BoundingSphere\n return Math.log2(WGS84_RADIUS_Z / radius);\n } else if (height && width) {\n // BoundingRectangle\n const zoomX = Math.log2(WGS84_RADIUS_X / width);\n const zoomY = Math.log2(WGS84_RADIUS_Y / height);\n\n return (zoomX + zoomY) / 2;\n }\n\n return 1;\n}\n\nfunction getObbSize(halfAxes) {\n halfAxes.getColumn(0, scratchVector);\n const axeY = halfAxes.getColumn(1);\n const axeZ = halfAxes.getColumn(2);\n const farthestVertex = scratchVector.add(axeY).add(axeZ);\n const size = farthestVertex.len();\n return size;\n}\n"],"file":"zoom.js"}
|