@loaders.gl/tiles-3d 5.0.0-beta.10 → 5.0.0-beta.11
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/3d-tiles/3d-tiles-archive-loader.js +1 -1
- package/dist/3d-tiles/dist.dev.js +169 -581
- package/dist/3d-tiles/dist.min.js +16 -16
- package/dist/3d-tiles/index.cjs +115 -390
- package/dist/3d-tiles/index.cjs.map +3 -3
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -2
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js +3 -4
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts +4 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts.map +1 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js +36 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js.map +1 -0
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js +3 -4
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts +9 -5
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js +15 -12
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +0 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js +2 -4
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -2
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js +7 -7
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -2
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js +1 -2
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +13 -13
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js +22 -23
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
- package/dist/3d-tiles/lib/utils/version.js +1 -1
- package/dist/3d-tiles/types.d.ts +7 -3
- package/dist/3d-tiles/types.d.ts.map +1 -1
- package/dist/3d-tiles-archive-writer.cjs +1 -1
- package/dist/copc/copc-loader.d.ts.map +1 -1
- package/dist/copc/copc-loader.js +10 -7
- package/dist/copc/copc-loader.js.map +1 -1
- package/dist/copc/copc-writer.d.ts +5 -4
- package/dist/copc/copc-writer.d.ts.map +1 -1
- package/dist/copc/copc-writer.js +1 -1
- package/dist/copc/copc-writer.js.map +1 -1
- package/dist/copc/index.cjs +809 -124
- package/dist/copc/index.cjs.map +3 -3
- package/dist/dist.dev.js +45 -77
- package/dist/dist.min.js +10 -10
- package/dist/i3s/arcgis-webscene-loader.js +1 -1
- package/dist/i3s/dist.dev.js +11915 -12119
- package/dist/i3s/dist.min.js +25 -25
- package/dist/i3s/i3s-attribute-loader.js +1 -1
- package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s/i3s-content-loader.js +1 -1
- package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
- package/dist/i3s/i3s-loader.js +1 -1
- package/dist/i3s/i3s-mesh-attributes.d.ts +2 -2
- package/dist/i3s/i3s-mesh-attributes.d.ts.map +1 -1
- package/dist/i3s/i3s-mesh-attributes.js +6 -11
- package/dist/i3s/i3s-mesh-attributes.js.map +1 -1
- package/dist/i3s/i3s-mesh-writer.js +2 -3
- package/dist/i3s/i3s-mesh-writer.js.map +1 -1
- package/dist/i3s/i3s-node-page-loader.js +1 -1
- package/dist/i3s/i3s-slpk-loader.js +1 -1
- package/dist/i3s/i3s-slpk-writer.js +1 -1
- package/dist/i3s/index.cjs +314 -442
- package/dist/i3s/index.cjs.map +3 -3
- package/dist/i3s/lib/parsers/constants.d.ts +0 -3
- package/dist/i3s/lib/parsers/constants.d.ts.map +1 -1
- package/dist/i3s/lib/parsers/constants.js +0 -8
- package/dist/i3s/lib/parsers/constants.js.map +1 -1
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.js +1 -2
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/i3s/types.d.ts +0 -1
- package/dist/i3s/types.d.ts.map +1 -1
- package/dist/i3s-content-worker-node.js +11 -11
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +485 -879
- package/dist/i3s-lepcc-worker-node.js +2 -2
- package/dist/i3s-lepcc-worker.js +2 -2
- package/dist/i3s-mesh-writer.cjs +87 -206
- package/dist/i3s-mesh-writer.cjs.map +3 -3
- package/dist/i3s-slpk-writer.cjs +1 -1
- package/dist/index.cjs +44 -41
- package/dist/index.cjs.map +1 -1
- package/dist/point-cloud-tile-loader-types.js +1 -1
- package/dist/point-cloud-tile-loader.cjs +17 -28
- package/dist/point-cloud-tile-loader.cjs.map +1 -1
- package/dist/point-cloud-tile-source.cjs +16 -27
- package/dist/point-cloud-tile-source.cjs.map +1 -1
- package/dist/point-cloud-tile-source.js +2 -2
- package/dist/point-cloud-tile-source.js.map +1 -1
- package/dist/potree/dist.dev.js +985 -139
- package/dist/potree/dist.min.js +28 -28
- package/dist/potree/index.cjs +813 -140
- package/dist/potree/index.cjs.map +3 -3
- package/dist/potree/lib/potree-node-source.d.ts.map +1 -1
- package/dist/potree/lib/potree-node-source.js +2 -14
- package/dist/potree/lib/potree-node-source.js.map +1 -1
- package/dist/potree/parsers/parse-potree-bin.js +3 -3
- package/dist/potree/parsers/parse-potree-bin.js.map +1 -1
- package/dist/potree/potree-bin-loader.js +1 -1
- package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree/potree-loader-types.js +1 -1
- package/dist/potree/potree-writer.d.ts +3 -3
- package/dist/potree/potree-writer.d.ts.map +1 -1
- package/dist/potree/potree-writer.js +2 -2
- package/dist/potree/potree-writer.js.map +1 -1
- package/dist/potree/potree2-source.d.ts +1 -1
- package/dist/potree/potree2-source.d.ts.map +1 -1
- package/dist/potree/potree2-source.js +6 -3
- package/dist/potree/potree2-source.js.map +1 -1
- package/dist/potree-loader.cjs +817 -153
- package/dist/potree-loader.cjs.map +3 -3
- package/dist/tileset-3d/helpers/frame-state.d.ts +2 -1
- package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/frame-state.js +41 -15
- package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.ts +3 -4
- package/src/3d-tiles/lib/classes/helpers/tile-component-types.ts +39 -0
- package/src/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.ts +3 -4
- package/src/3d-tiles/lib/classes/tile-3d-feature-table.ts +38 -14
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.ts +2 -5
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.ts +10 -10
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.ts +0 -2
- package/src/3d-tiles/lib/parsers/parse-3d-tile-batched-model.ts +1 -2
- package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +19 -19
- package/src/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.ts +22 -23
- package/src/3d-tiles/types.ts +4 -3
- package/src/copc/copc-loader.ts +8 -8
- package/src/copc/copc-writer.ts +6 -5
- package/src/i3s/i3s-mesh-attributes.ts +9 -17
- package/src/i3s/i3s-mesh-writer.ts +4 -3
- package/src/i3s/lib/parsers/constants.ts +0 -9
- package/src/i3s/lib/parsers/parse-i3s-tile-content.ts +1 -2
- package/src/i3s/types.ts +0 -1
- package/src/point-cloud-tile-source.ts +2 -2
- package/src/potree/lib/potree-node-source.ts +2 -15
- package/src/potree/parsers/parse-potree-bin.ts +3 -3
- package/src/potree/potree-writer.ts +6 -11
- package/src/potree/potree2-source.ts +6 -3
- package/src/tileset-3d/helpers/frame-state.ts +43 -15
- package/src/types.ts +15 -0
|
@@ -83,7 +83,8 @@ export declare function updateCameraMotionState(previousState: CameraMotionState
|
|
|
83
83
|
/**
|
|
84
84
|
* Limit `tiles` array length with `maximumTilesSelected` number.
|
|
85
85
|
* The criteria for this filtering is distance of a tile center
|
|
86
|
-
* to the `frameState.viewport`'s longitude and latitude
|
|
86
|
+
* to the `frameState.viewport`'s longitude and latitude, or to its unprojected center
|
|
87
|
+
* when the viewport has no longitude and latitude
|
|
87
88
|
* @param tiles - tiles array to filter
|
|
88
89
|
* @param frameState - frameState to calculate distances
|
|
89
90
|
* @param maximumTilesSelected - maximal amount of tiles in the output array
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-state.d.ts","sourceRoot":"","sources":["../../../src/tileset-3d/helpers/frame-state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,6BAA0B;AAC9C,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,aAAa,EAAE,KAAK,EAAC,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAC,kBAAkB,EAAW,uBAAoB;AAEzD,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE;QACN,iDAAiD;QACjD,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,kEAAkE;QAClE,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,qEAAqE;QACrE,EAAE,EAAE,MAAM,EAAE,CAAC;QACb,iFAAiF;QACjF,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/C,qDAAqD;QACrD,mBAAmB,EAAE,MAAM,CAAC;QAC5B,uEAAuE;QACvE,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,eAAe,EAAE,kBAAkB,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,aAAa,CAAC;IAC7B,8EAA8E;IAC9E,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,cAAc,EAAE,MAAM,CAAC;IACvB,gGAAgG;IAChG,8BAA8B,EAAE,MAAM,CAAC;CACxC,CAAC;AAEF,4FAA4F;AAC5F,MAAM,MAAM,oBAAoB,GAAG;IACjC,uEAAuE;IACvE,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;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,oBAAoB,EAAE,MAAM,GAC3B,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAyBtB"}
|
|
@@ -67,19 +67,7 @@ export function getFrameState(viewport, frameNumber, options = {}) {
|
|
|
67
67
|
// @ts-ignore
|
|
68
68
|
enuToFixedTransform.transformAsVector(new Vector3(cameraUp).scale(metersPerUnit))).normalize();
|
|
69
69
|
commonSpacePlanesToWGS84(viewport);
|
|
70
|
-
const
|
|
71
|
-
const { longitude, latitude, width, bearing, zoom, position } = viewport;
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
const topDownViewport = new ViewportClass({
|
|
74
|
-
longitude,
|
|
75
|
-
latitude,
|
|
76
|
-
height,
|
|
77
|
-
width,
|
|
78
|
-
bearing,
|
|
79
|
-
zoom,
|
|
80
|
-
position,
|
|
81
|
-
pitch: 0
|
|
82
|
-
});
|
|
70
|
+
const topDownViewport = getTopDownViewport(viewport);
|
|
83
71
|
const verticalFieldOfView = Number.isFinite(viewport.fovy) && Number(viewport.fovy) > 0 && Number(viewport.fovy) < 180
|
|
84
72
|
? (Number(viewport.fovy) * Math.PI) / 180
|
|
85
73
|
: Math.PI / 3;
|
|
@@ -143,7 +131,8 @@ export function updateCameraMotionState(previousState, position, direction, curr
|
|
|
143
131
|
/**
|
|
144
132
|
* Limit `tiles` array length with `maximumTilesSelected` number.
|
|
145
133
|
* The criteria for this filtering is distance of a tile center
|
|
146
|
-
* to the `frameState.viewport`'s longitude and latitude
|
|
134
|
+
* to the `frameState.viewport`'s longitude and latitude, or to its unprojected center
|
|
135
|
+
* when the viewport has no longitude and latitude
|
|
147
136
|
* @param tiles - tiles array to filter
|
|
148
137
|
* @param frameState - frameState to calculate distances
|
|
149
138
|
* @param maximumTilesSelected - maximal amount of tiles in the output array
|
|
@@ -155,7 +144,7 @@ export function limitSelectedTiles(tiles, frameState, maximumTilesSelected) {
|
|
|
155
144
|
}
|
|
156
145
|
// Accumulate distances in couples array: [tileIndex: number, distanceToViewport: number]
|
|
157
146
|
const tuples = [];
|
|
158
|
-
const
|
|
147
|
+
const [viewportLongitude, viewportLatitude] = getViewportLongitudeLatitude(frameState.viewport);
|
|
159
148
|
for (const [index, tile] of tiles.entries()) {
|
|
160
149
|
const [longitude, latitude] = tile.header.mbs;
|
|
161
150
|
const deltaLon = Math.abs(viewportLongitude - longitude);
|
|
@@ -174,6 +163,43 @@ export function limitSelectedTiles(tiles, frameState, maximumTilesSelected) {
|
|
|
174
163
|
}
|
|
175
164
|
return [selectedTiles, unselectedTiles];
|
|
176
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Returns the zero-pitch viewport used to calculate the projected radius of a tile.
|
|
168
|
+
* @param viewport - Viewport of the current traversal.
|
|
169
|
+
* @returns The viewport's own top-down viewport, or a new instance of its class with zero pitch.
|
|
170
|
+
*/
|
|
171
|
+
function getTopDownViewport(viewport) {
|
|
172
|
+
if (viewport.getTopDownViewport) {
|
|
173
|
+
return viewport.getTopDownViewport();
|
|
174
|
+
}
|
|
175
|
+
const ViewportClass = viewport.constructor;
|
|
176
|
+
const { longitude, latitude, height, width, bearing, zoom, position } = viewport;
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
return new ViewportClass({
|
|
179
|
+
longitude,
|
|
180
|
+
latitude,
|
|
181
|
+
height,
|
|
182
|
+
width,
|
|
183
|
+
bearing,
|
|
184
|
+
zoom,
|
|
185
|
+
position,
|
|
186
|
+
pitch: 0
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Returns the longitude and latitude of the viewport's camera target.
|
|
191
|
+
* @param viewport - Viewport of the current traversal.
|
|
192
|
+
* @returns `[longitude, latitude]` in degrees, from the viewport fields when both are finite, or
|
|
193
|
+
* else from the unprojected viewport center.
|
|
194
|
+
*/
|
|
195
|
+
function getViewportLongitudeLatitude(viewport) {
|
|
196
|
+
const { longitude, latitude } = viewport;
|
|
197
|
+
if (Number.isFinite(longitude) && Number.isFinite(latitude)) {
|
|
198
|
+
return [longitude, latitude];
|
|
199
|
+
}
|
|
200
|
+
const [centerLongitude, centerLatitude] = viewport.unprojectPosition(viewport.center);
|
|
201
|
+
return [centerLongitude, centerLatitude];
|
|
202
|
+
}
|
|
177
203
|
function commonSpacePlanesToWGS84(viewport) {
|
|
178
204
|
// Extract frustum planes based on current view.
|
|
179
205
|
const frustumPlanes = viewport.getFrustumPlanes();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-state.js","sourceRoot":"","sources":["../../../src/tileset-3d/helpers/frame-state.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,aAAa,EAAE,KAAK,EAAC,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAuD5D,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AACpC,MAAM,eAAe,GAAG,IAAI,OAAO,EAAE,CAAC;AACtC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AACtC,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;IACtC,IAAI,KAAK,EAAE;IACX,IAAI,KAAK,EAAE;IACX,IAAI,KAAK,EAAE;IACX,IAAI,KAAK,EAAE;IACX,IAAI,KAAK,EAAE;IACX,IAAI,KAAK,EAAE;CACZ,CAAC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA4B,EAC5B,WAAmB,EACnB,UAAgC,EAAE;IAElC,kFAAkF;IAClF,kFAAkF;IAClF,MAAM,EAAC,QAAQ,EAAE,MAAM,EAAC,GAAG,QAAQ,CAAC;IACpC,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAuC,CAAC;IACzE,MAAM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;AACb,CAAC;AAED,SAAS,gBAAgB,CACvB,QAAkB,EAClB,KAAyB,EACzB,MAAe,IAAI,OAAO,EAAE;IAE5B,MAAM,eAAe,GAAG,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC1D,OAAO,SAAS,CAAC,KAAK,CAAC,uBAAuB,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -41,8 +41,23 @@ export type GeospatialViewport = Viewport & {
|
|
|
41
41
|
cameraUp: [number, number, number];
|
|
42
42
|
/** Camera target offset in meters from longitude/latitude, including elevation. */
|
|
43
43
|
position?: number[];
|
|
44
|
+
/**
|
|
45
|
+
* Camera target longitude in degrees. Viewports in a projected CRS can leave it undefined;
|
|
46
|
+
* traversal then unprojects `center`.
|
|
47
|
+
*/
|
|
44
48
|
longitude: number;
|
|
49
|
+
/**
|
|
50
|
+
* Camera target latitude in degrees. Viewports in a projected CRS can leave it undefined;
|
|
51
|
+
* traversal then unprojects `center`.
|
|
52
|
+
*/
|
|
45
53
|
latitude: number;
|
|
46
54
|
bearing: number;
|
|
55
|
+
/**
|
|
56
|
+
* Returns a viewport with the same camera target, zoom, bearing, size and projection as this
|
|
57
|
+
* viewport, but with zero pitch. Traversal uses it to measure the projected size of I3S tiles.
|
|
58
|
+
* Viewports that cannot be rebuilt from `longitude`, `latitude` and `zoom`, such as a viewport in
|
|
59
|
+
* a projected CRS, must supply it. Without it, traversal calls the viewport constructor.
|
|
60
|
+
*/
|
|
61
|
+
getTopDownViewport?: () => GeospatialViewport;
|
|
47
62
|
};
|
|
48
63
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAC,KA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EAAE,MAAM,CAAC,CAAC;IAC1C,mGAAmG;IACnG,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,kBAAkB,CAAC;CAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tiles-3d",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.11",
|
|
4
4
|
"description": "3D tileset runtime and loaders for 3D Tiles, I3S, COPC, and Potree",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -196,27 +196,27 @@
|
|
|
196
196
|
"build-worker-i3s-lepcc-node": "node ../../scripts/build-codec-worker.mjs src/i3s/workers/i3s-lepcc-worker-node.ts --outfile=dist/i3s-lepcc-worker-node.js --platform=node --target=node16 --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
197
197
|
},
|
|
198
198
|
"dependencies": {
|
|
199
|
-
"@loaders.gl/archives": "5.0.0-beta.
|
|
200
|
-
"@loaders.gl/compression": "5.0.0-beta.
|
|
201
|
-
"@loaders.gl/images": "5.0.0-beta.
|
|
202
|
-
"@loaders.gl/pointclouds": "5.0.0-beta.
|
|
203
|
-
"@loaders.gl/scene": "5.0.0-beta.
|
|
204
|
-
"@math.gl/core": "5.0.0-beta.
|
|
205
|
-
"@math.gl/dggs": "5.0.0-beta.
|
|
206
|
-
"@math.gl/earth": "5.0.0-beta.
|
|
207
|
-
"@math.gl/geometry": "5.0.0-beta.
|
|
208
|
-
"@math.gl/geospatial": "5.0.0-beta.
|
|
199
|
+
"@loaders.gl/archives": "5.0.0-beta.11",
|
|
200
|
+
"@loaders.gl/compression": "5.0.0-beta.11",
|
|
201
|
+
"@loaders.gl/images": "5.0.0-beta.11",
|
|
202
|
+
"@loaders.gl/pointclouds": "5.0.0-beta.11",
|
|
203
|
+
"@loaders.gl/scene": "5.0.0-beta.11",
|
|
204
|
+
"@math.gl/core": "5.0.0-beta.11",
|
|
205
|
+
"@math.gl/dggs": "5.0.0-beta.11",
|
|
206
|
+
"@math.gl/earth": "5.0.0-beta.11",
|
|
207
|
+
"@math.gl/geometry": "5.0.0-beta.11",
|
|
208
|
+
"@math.gl/geospatial": "5.0.0-beta.11",
|
|
209
209
|
"probe.gl": "^5.0.0",
|
|
210
210
|
"zod": "^4.1.12"
|
|
211
211
|
},
|
|
212
212
|
"devDependencies": {
|
|
213
213
|
"@deck.gl/core": "10.0.0-alpha.1",
|
|
214
|
-
"@math.gl/dggs": "5.0.0-beta.
|
|
214
|
+
"@math.gl/dggs": "5.0.0-beta.11",
|
|
215
215
|
"copc": "0.0.8"
|
|
216
216
|
},
|
|
217
217
|
"peerDependencies": {
|
|
218
218
|
"@loaders.gl/core": "~5.0.0-alpha.0",
|
|
219
219
|
"apache-arrow": ">= 17.0.0"
|
|
220
220
|
},
|
|
221
|
-
"gitHead": "
|
|
221
|
+
"gitHead": "d23c857c2a9c0a028e63d58bf9e1a94a1b27a0fd"
|
|
222
222
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {getTileComponentArrayType} from './tile-component-types';
|
|
6
6
|
import {assert} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
|
|
8
8
|
const COMPONENTS_PER_ATTRIBUTE = {
|
|
@@ -101,17 +101,16 @@ const PACKER = {
|
|
|
101
101
|
export function createTypedArrayFromAccessor(tile3DAccessor, buffer, byteOffset, length) {
|
|
102
102
|
const {componentType} = tile3DAccessor;
|
|
103
103
|
assert(tile3DAccessor.componentType);
|
|
104
|
-
const
|
|
104
|
+
const ArrayType = getTileComponentArrayType(componentType);
|
|
105
105
|
const size = COMPONENTS_PER_ATTRIBUTE[tile3DAccessor.type];
|
|
106
106
|
const unpacker = UNPACKER[tile3DAccessor.type];
|
|
107
107
|
const packer = PACKER[tile3DAccessor.type];
|
|
108
108
|
|
|
109
109
|
byteOffset += tile3DAccessor.byteOffset;
|
|
110
|
-
const values =
|
|
110
|
+
const values = new ArrayType(buffer, byteOffset, size * length);
|
|
111
111
|
|
|
112
112
|
return {
|
|
113
113
|
values,
|
|
114
|
-
type,
|
|
115
114
|
size,
|
|
116
115
|
unpacker,
|
|
117
116
|
packer
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {TypedArrayConstructor} from '@math.gl/core';
|
|
6
|
+
|
|
7
|
+
/** Component names and legacy numeric identifiers accepted in 3D Tiles binary tables. */
|
|
8
|
+
const TILE_COMPONENT_ARRAYS: Readonly<Record<string, TypedArrayConstructor>> = {
|
|
9
|
+
BYTE: Int8Array,
|
|
10
|
+
UNSIGNED_BYTE: Uint8Array,
|
|
11
|
+
SHORT: Int16Array,
|
|
12
|
+
UNSIGNED_SHORT: Uint16Array,
|
|
13
|
+
INT: Int32Array,
|
|
14
|
+
UNSIGNED_INT: Uint32Array,
|
|
15
|
+
FLOAT: Float32Array,
|
|
16
|
+
DOUBLE: Float64Array,
|
|
17
|
+
UNSIGNED_SHORT_4_4_4_4: Uint16Array,
|
|
18
|
+
UNSIGNED_SHORT_5_5_5_1: Uint16Array,
|
|
19
|
+
UNSIGNED_SHORT_5_6_5: Uint16Array,
|
|
20
|
+
5120: Int8Array,
|
|
21
|
+
5121: Uint8Array,
|
|
22
|
+
5122: Int16Array,
|
|
23
|
+
5123: Uint16Array,
|
|
24
|
+
5124: Int32Array,
|
|
25
|
+
5125: Uint32Array,
|
|
26
|
+
5126: Float32Array,
|
|
27
|
+
5130: Float64Array,
|
|
28
|
+
32819: Uint16Array,
|
|
29
|
+
32820: Uint16Array,
|
|
30
|
+
33635: Uint16Array
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** Returns the array constructor for a component identifier read from a binary table. */
|
|
34
|
+
export function getTileComponentArrayType(componentType: string | number): TypedArrayConstructor {
|
|
35
|
+
if (!Object.hasOwn(TILE_COMPONENT_ARRAYS, componentType)) {
|
|
36
|
+
throw new Error(`Unsupported 3D Tiles component type: ${componentType}`);
|
|
37
|
+
}
|
|
38
|
+
return TILE_COMPONENT_ARRAYS[componentType];
|
|
39
|
+
}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
/* eslint-disable */
|
|
10
10
|
// @ts-nocheck
|
|
11
11
|
import {log as loaderLog} from '@loaders.gl/core/loader-utils';
|
|
12
|
-
import {GL} from '@math.gl/geometry';
|
|
13
12
|
import {createTypedArrayFromAccessor} from './helpers/tile-3d-accessor-utils';
|
|
14
13
|
|
|
15
14
|
const defined = x => x !== undefined;
|
|
@@ -79,7 +78,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
|
|
|
79
78
|
let parentIdsLength = instancesLength;
|
|
80
79
|
|
|
81
80
|
if (defined(classIds.byteOffset)) {
|
|
82
|
-
classIds.componentType ??=
|
|
81
|
+
classIds.componentType ??= 'UNSIGNED_SHORT';
|
|
83
82
|
classIds.type = 'SCALAR';
|
|
84
83
|
classIds = createTypedArrayFromAccessor(
|
|
85
84
|
classIds,
|
|
@@ -92,7 +91,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
|
|
|
92
91
|
let parentIndexes;
|
|
93
92
|
if (defined(parentCounts)) {
|
|
94
93
|
if (defined(parentCounts.byteOffset)) {
|
|
95
|
-
parentCounts.componentType ??=
|
|
94
|
+
parentCounts.componentType ??= 'UNSIGNED_SHORT';
|
|
96
95
|
parentCounts.type = 'SCALAR';
|
|
97
96
|
parentCounts = createTypedArrayFromAccessor(
|
|
98
97
|
parentCounts,
|
|
@@ -110,7 +109,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
|
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
if (defined(parentIds) && defined(parentIds.byteOffset)) {
|
|
113
|
-
parentIds.componentType ??=
|
|
112
|
+
parentIds.componentType ??= 'UNSIGNED_SHORT';
|
|
114
113
|
parentIds.type = 'SCALAR';
|
|
115
114
|
parentIds = createTypedArrayFromAccessor(
|
|
116
115
|
parentIds,
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
// This file is derived from the Cesium code base under Apache 2 license
|
|
6
6
|
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import type {TypedArrayConstructor} from '@math.gl/core';
|
|
9
|
+
import {getTileComponentArrayType} from './helpers/tile-component-types';
|
|
9
10
|
|
|
10
11
|
// Reference:
|
|
11
12
|
// https://github.com/AnalyticalGraphicsInc/cesium/blob/1de96d087f0b17575eb1a3f736407b348c765d59/Source/Scene/Cesium3DTileFeatureTable.js
|
|
@@ -28,7 +29,12 @@ export default class Tile3DFeatureTable {
|
|
|
28
29
|
return Boolean(this.json[propertyName]);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
/** Reads a global property, using the component type for binary storage. */
|
|
33
|
+
getGlobalProperty(
|
|
34
|
+
propertyName,
|
|
35
|
+
componentType: TypedArrayConstructor | number = Uint32Array,
|
|
36
|
+
componentLength = 1
|
|
37
|
+
) {
|
|
32
38
|
const jsonValue = this.json[propertyName];
|
|
33
39
|
|
|
34
40
|
if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {
|
|
@@ -44,12 +50,13 @@ export default class Tile3DFeatureTable {
|
|
|
44
50
|
return jsonValue;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
|
-
|
|
53
|
+
/** Reads a property for all features as a typed array. */
|
|
54
|
+
getPropertyArray(propertyName, componentType: TypedArrayConstructor | number, componentLength) {
|
|
48
55
|
const jsonValue = this.json[propertyName];
|
|
49
56
|
|
|
50
57
|
if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {
|
|
51
58
|
if ('componentType' in jsonValue) {
|
|
52
|
-
componentType =
|
|
59
|
+
componentType = getTileComponentArrayType(jsonValue.componentType);
|
|
53
60
|
}
|
|
54
61
|
return this._getTypedArrayFromBinary(
|
|
55
62
|
propertyName,
|
|
@@ -63,7 +70,14 @@ export default class Tile3DFeatureTable {
|
|
|
63
70
|
return this._getTypedArrayFromArray(propertyName, componentType, jsonValue);
|
|
64
71
|
}
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
/** Reads a single feature property, writing vector components to result. */
|
|
74
|
+
getProperty(
|
|
75
|
+
propertyName,
|
|
76
|
+
componentType: TypedArrayConstructor | number,
|
|
77
|
+
componentLength,
|
|
78
|
+
featureId,
|
|
79
|
+
result
|
|
80
|
+
) {
|
|
67
81
|
const jsonValue = this.json[propertyName];
|
|
68
82
|
if (!jsonValue) {
|
|
69
83
|
return jsonValue;
|
|
@@ -84,12 +98,21 @@ export default class Tile3DFeatureTable {
|
|
|
84
98
|
|
|
85
99
|
// HELPERS
|
|
86
100
|
|
|
87
|
-
_getTypedArrayFromBinary(
|
|
101
|
+
_getTypedArrayFromBinary(
|
|
102
|
+
propertyName,
|
|
103
|
+
componentType: TypedArrayConstructor | number,
|
|
104
|
+
componentLength,
|
|
105
|
+
count,
|
|
106
|
+
byteOffset
|
|
107
|
+
) {
|
|
88
108
|
const cachedTypedArrays = this._cachedTypedArrays;
|
|
89
109
|
let typedArray = cachedTypedArrays[propertyName];
|
|
90
110
|
if (!typedArray) {
|
|
91
|
-
|
|
92
|
-
componentType
|
|
111
|
+
const ArrayType =
|
|
112
|
+
typeof componentType === 'number'
|
|
113
|
+
? getTileComponentArrayType(componentType)
|
|
114
|
+
: componentType;
|
|
115
|
+
typedArray = new ArrayType(
|
|
93
116
|
this.buffer.buffer,
|
|
94
117
|
this.buffer.byteOffset + byteOffset,
|
|
95
118
|
count * componentLength
|
|
@@ -99,19 +122,20 @@ export default class Tile3DFeatureTable {
|
|
|
99
122
|
return typedArray;
|
|
100
123
|
}
|
|
101
124
|
|
|
102
|
-
_getTypedArrayFromArray(propertyName, componentType, array) {
|
|
125
|
+
_getTypedArrayFromArray(propertyName, componentType: TypedArrayConstructor | number, array) {
|
|
103
126
|
const cachedTypedArrays = this._cachedTypedArrays;
|
|
104
127
|
let typedArray = cachedTypedArrays[propertyName];
|
|
105
128
|
if (!typedArray) {
|
|
129
|
+
const ArrayType =
|
|
130
|
+
typeof componentType === 'number'
|
|
131
|
+
? getTileComponentArrayType(componentType)
|
|
132
|
+
: componentType;
|
|
106
133
|
if (ArrayBuffer.isView(array)) {
|
|
107
134
|
const byteOffset = array.byteOffset;
|
|
108
135
|
const byteLength = array.byteLength;
|
|
109
|
-
const elementCount = byteLength /
|
|
110
|
-
typedArray =
|
|
111
|
-
} else if (array instanceof ArrayBuffer) {
|
|
112
|
-
typedArray = GLType.createTypedArray(componentType, array);
|
|
136
|
+
const elementCount = byteLength / ArrayType.BYTES_PER_ELEMENT;
|
|
137
|
+
typedArray = new ArrayType(array.buffer as ArrayBuffer, byteOffset, elementCount);
|
|
113
138
|
} else {
|
|
114
|
-
const ArrayType = GLType.getArrayType(componentType);
|
|
115
139
|
typedArray = new ArrayType(array);
|
|
116
140
|
}
|
|
117
141
|
cachedTypedArrays[propertyName] = typedArray;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Tile3DBatchTable} from '@loaders.gl/tiles-3d/3d-tiles';
|
|
6
|
-
import {decodeRGB565
|
|
6
|
+
import {decodeRGB565} from '@math.gl/geometry';
|
|
7
7
|
import {convertColorArrayToFloat16} from '@loaders.gl/core/schema';
|
|
8
8
|
import {Tiles3DTileContent} from '../../../types';
|
|
9
9
|
|
|
@@ -14,7 +14,6 @@ export function normalize3DTileColorAttribute(
|
|
|
14
14
|
batchTable?: Tile3DBatchTable,
|
|
15
15
|
colorFormat: 'uint8norm' | 'float16' | 'float32' = 'uint8norm'
|
|
16
16
|
): {
|
|
17
|
-
type: number;
|
|
18
17
|
value: Uint8ClampedArray | Float16Array | Uint16Array | Float32Array;
|
|
19
18
|
size: number;
|
|
20
19
|
normalized: boolean;
|
|
@@ -73,7 +72,6 @@ function makeColorAttribute(
|
|
|
73
72
|
) {
|
|
74
73
|
if (colorFormat === 'float16') {
|
|
75
74
|
return {
|
|
76
|
-
type: 5131,
|
|
77
75
|
value: convertColorArrayToFloat16(colors, 255),
|
|
78
76
|
size,
|
|
79
77
|
normalized: false,
|
|
@@ -82,12 +80,11 @@ function makeColorAttribute(
|
|
|
82
80
|
}
|
|
83
81
|
if (colorFormat === 'float32') {
|
|
84
82
|
return {
|
|
85
|
-
type: GL.FLOAT,
|
|
86
83
|
value: Float32Array.from(colors, color => color / 255),
|
|
87
84
|
size,
|
|
88
85
|
normalized: false
|
|
89
86
|
};
|
|
90
87
|
}
|
|
91
|
-
return {
|
|
88
|
+
return {value: colors, size, normalized: true};
|
|
92
89
|
}
|
|
93
90
|
/* eslint-enable complexity*/
|
|
@@ -3,37 +3,37 @@
|
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Vector3} from '@math.gl/core';
|
|
6
|
-
import {
|
|
6
|
+
import {octDecode} from '@math.gl/geometry';
|
|
7
7
|
import {Tiles3DTileContent} from '../../../types';
|
|
8
8
|
|
|
9
9
|
const scratchNormal = new Vector3();
|
|
10
10
|
|
|
11
11
|
export function normalize3DTileNormalAttribute(
|
|
12
12
|
tile: Tiles3DTileContent,
|
|
13
|
-
normals: Float32Array | null
|
|
14
|
-
): {
|
|
13
|
+
normals: Float32Array | Uint8Array | null
|
|
14
|
+
): {size: number; value: Float32Array} | null {
|
|
15
15
|
if (!normals) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (tile.isOctEncoded16P) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/** Each octahedral component pair decodes to one XYZ normal. */
|
|
21
|
+
const pointCount = normals.length / 2;
|
|
22
|
+
const decodedArray = new Float32Array(pointCount * 3);
|
|
23
|
+
for (let i = 0; i < pointCount; i++) {
|
|
22
24
|
octDecode(normals[i * 2], normals[i * 2 + 1], scratchNormal);
|
|
23
25
|
// @ts-ignore
|
|
24
26
|
scratchNormal.toArray(decodedArray, i * 3);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
return {
|
|
28
|
-
|
|
29
|
-
size: 2,
|
|
30
|
+
size: 3,
|
|
30
31
|
value: decodedArray
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
value: normals
|
|
36
|
+
size: 3,
|
|
37
|
+
value: normals as Float32Array
|
|
38
38
|
};
|
|
39
39
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Vector3} from '@math.gl/core';
|
|
6
|
-
import {GL} from '@math.gl/geometry';
|
|
7
6
|
|
|
8
7
|
// Prepare attribute for positions
|
|
9
8
|
export function normalize3DTilePositionAttribute(tile, positions, options) {
|
|
@@ -23,7 +22,6 @@ export function normalize3DTilePositionAttribute(tile, positions, options) {
|
|
|
23
22
|
// Default: Use normalized shorts directly, no copying/processing.
|
|
24
23
|
// NOTE: The "missing" offset/scaling operations are automatically added to modelMatrix if `tile.isQuantized === true`
|
|
25
24
|
return {
|
|
26
|
-
type: GL.UNSIGNED_SHORT,
|
|
27
25
|
value: positions,
|
|
28
26
|
size: 3,
|
|
29
27
|
normalized: true
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// This file is derived from the Cesium code base under Apache 2 license
|
|
6
6
|
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
7
7
|
|
|
8
|
-
import {GL} from '@math.gl/geometry';
|
|
9
8
|
import Tile3DFeatureTable from '../classes/tile-3d-feature-table';
|
|
10
9
|
// import Tile3DBatchTable from '../classes/tile-3d-batch-table';
|
|
11
10
|
|
|
@@ -50,7 +49,7 @@ function parseBatchedModel(
|
|
|
50
49
|
byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);
|
|
51
50
|
|
|
52
51
|
const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);
|
|
53
|
-
tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER',
|
|
52
|
+
tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', Float32Array, 3);
|
|
54
53
|
|
|
55
54
|
return byteOffset;
|
|
56
55
|
}
|