@cesium/engine 13.1.0 → 15.0.0
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/Build/Workers/{chunk-APCS5YJI.js → chunk-25TOENEE.js} +7 -7
- package/Build/Workers/{chunk-FNCXBBCF.js → chunk-2AVIUB5H.js} +2 -2
- package/Build/Workers/{chunk-OZTFRHA2.js → chunk-3JZGPJMZ.js} +6 -6
- package/Build/Workers/{chunk-5JY4LYO3.js → chunk-3LHBH4TC.js} +7 -7
- package/Build/Workers/{chunk-MGABCOOH.js → chunk-3LZF23RY.js} +6 -6
- package/Build/Workers/{chunk-AXYZUG4N.js → chunk-5S2B46UQ.js} +1 -1
- package/Build/Workers/{chunk-2SRHVCFD.js → chunk-67ONR44K.js} +6 -6
- package/Build/Workers/{chunk-PBJQFLKS.js → chunk-6EDBC234.js} +11 -11
- package/Build/Workers/{chunk-GSLKQJM2.js → chunk-6EV4VOET.js} +10 -10
- package/Build/Workers/{chunk-OGRXNUR2.js → chunk-7ITUZTFH.js} +1 -1
- package/Build/Workers/{chunk-IP7F2MVW.js → chunk-ARVZCY6X.js} +7 -7
- package/Build/Workers/{chunk-EYZFEJX3.js → chunk-B2UQN3DH.js} +6 -6
- package/Build/Workers/{chunk-WE4KF4AM.js → chunk-B2Y4ZS6X.js} +9 -9
- package/Build/Workers/{chunk-DWIKWWEE.js → chunk-BD2TPFGC.js} +5 -5
- package/Build/Workers/{chunk-5ICYLS6B.js → chunk-CHX2K5AC.js} +10 -10
- package/Build/Workers/{chunk-NQDKNE7V.js → chunk-CJGVEABL.js} +13 -13
- package/Build/Workers/{chunk-B34JXFHF.js → chunk-DYJHEP3B.js} +5 -5
- package/Build/Workers/{chunk-J7BMSSY7.js → chunk-E3H7AVMK.js} +13 -13
- package/Build/Workers/{chunk-TOHDFUJM.js → chunk-EZNAJPP5.js} +4 -4
- package/Build/Workers/{chunk-K62EHZFT.js → chunk-F7ZI463G.js} +15 -15
- package/Build/Workers/{chunk-EJ5DT5BP.js → chunk-FMZ5CX6V.js} +1 -1
- package/Build/Workers/{chunk-OARMSJUU.js → chunk-FRAWHNSR.js} +2 -2
- package/Build/Workers/{chunk-S3UM4OKP.js → chunk-GGV2XJHE.js} +7 -7
- package/Build/Workers/{chunk-SAKQO5NX.js → chunk-GK4QU6QI.js} +2 -2
- package/Build/Workers/{chunk-LFUFGHL3.js → chunk-HYPB7FAV.js} +10 -10
- package/Build/Workers/{chunk-3SCCWLZS.js → chunk-I4HO2ED2.js} +9 -9
- package/Build/Workers/{chunk-K6SQV4IS.js → chunk-IGINOLDX.js} +6 -6
- package/Build/Workers/{chunk-IXNXKVOB.js → chunk-ISQSYLZY.js} +4 -4
- package/Build/Workers/{chunk-PM76TX2X.js → chunk-JZAMRL5I.js} +6 -6
- package/Build/Workers/{chunk-CBE4HRBH.js → chunk-K5G2WELR.js} +7 -7
- package/Build/Workers/{chunk-EHGQQA7C.js → chunk-L5SO4Y5V.js} +1 -1
- package/Build/Workers/{chunk-M2AA2ARJ.js → chunk-LCMJQVIF.js} +11 -11
- package/Build/Workers/{chunk-HI73PIPQ.js → chunk-MWJW37I7.js} +2 -2
- package/Build/Workers/{chunk-WAJNX74N.js → chunk-NAGMYRDW.js} +27 -20
- package/Build/Workers/{chunk-WUIDEXAN.js → chunk-OYO6TKMU.js} +7 -7
- package/Build/Workers/{chunk-YVGU235V.js → chunk-PUTA3AE2.js} +4 -4
- package/Build/Workers/{chunk-ZWSWJYJP.js → chunk-Q5BHMNKU.js} +13 -13
- package/Build/Workers/{chunk-LQT2ZK7D.js → chunk-QTEX3Y4V.js} +17 -17
- package/Build/Workers/{chunk-UBAHTE4Q.js → chunk-QZKN2RXM.js} +1 -1
- package/Build/Workers/{chunk-T34EOLFR.js → chunk-RO2Z3LCR.js} +14 -14
- package/Build/Workers/{chunk-PTFIVVLX.js → chunk-RRN6LRDX.js} +12 -12
- package/Build/Workers/{chunk-B6IJY6AN.js → chunk-SLIA3GQP.js} +7 -7
- package/Build/Workers/{chunk-GIOZHX7U.js → chunk-TFCOEX3W.js} +2 -2
- package/Build/Workers/{chunk-KRVALCCI.js → chunk-TU6ZXHVU.js} +5 -5
- package/Build/Workers/{chunk-54I6VSRP.js → chunk-VJ2PDF64.js} +6 -6
- package/Build/Workers/{chunk-BMFWWTD7.js → chunk-VMVPONIV.js} +5 -5
- package/Build/Workers/{chunk-CNPP6TQ2.js → chunk-WPXU45PH.js} +4 -4
- package/Build/Workers/{chunk-2ONAV62A.js → chunk-XDHM4G3P.js} +7 -7
- package/Build/Workers/{chunk-KO232FLP.js → chunk-XED3RXKO.js} +2 -2
- package/Build/Workers/{chunk-5I3LPAS7.js → chunk-YNYCGTQH.js} +5 -5
- package/Build/Workers/{chunk-THDHWSEJ.js → chunk-Z4SI54EB.js} +4 -4
- package/Build/Workers/{chunk-R2KGFZBA.js → chunk-ZVDLC3T4.js} +13 -13
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +20 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +15 -14
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +50 -43
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/Color.js +3 -3
- package/Source/Core/Credit.js +3 -3
- package/Source/Core/DistanceDisplayCondition.js +3 -3
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OrientedBoundingBox.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +26 -4
- package/Source/Core/Spherical.js +3 -3
- package/Source/Core/TexturePacker.js +166 -0
- package/Source/Core/writeTextToCanvas.js +0 -1
- package/Source/DataSources/BillboardVisualizer.js +3 -3
- package/Source/DataSources/BoundingSphereState.js +3 -3
- package/Source/DataSources/DataSourceClock.js +1 -1
- package/Source/DataSources/DataSourceDisplay.js +5 -2
- package/Source/DataSources/EntityCluster.js +44 -19
- package/Source/Renderer/AutomaticUniforms.js +2 -2
- package/Source/Renderer/Context.js +0 -4
- package/Source/Renderer/Texture.js +6 -5
- package/Source/Renderer/TextureAtlas.js +802 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +87 -142
- package/Source/Scene/BillboardCollection.js +132 -202
- package/Source/Scene/BillboardLoadState.js +44 -0
- package/Source/Scene/BillboardTexture.js +348 -0
- package/Source/Scene/Camera.js +2 -2
- package/Source/Scene/Cesium3DTile.js +56 -28
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +403 -132
- package/Source/Scene/Cesium3DTilesetStatistics.js +0 -1
- package/Source/Scene/ClippingPolygon.js +2 -2
- package/Source/Scene/Expression.js +1 -0
- package/Source/Scene/GltfDracoLoader.js +45 -0
- package/Source/Scene/GltfIndexBufferLoader.js +5 -0
- package/Source/Scene/GltfLoader.js +22 -9
- package/Source/Scene/GltfVertexBufferLoader.js +13 -0
- package/Source/Scene/ITwinData.js +47 -1
- package/Source/Scene/ImageryLayer.js +1 -1
- package/Source/Scene/ImplicitSubtree.js +2 -0
- package/Source/Scene/KeyframeNode.js +16 -2
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/LabelCollection.js +212 -193
- package/Source/Scene/Megatexture.js +145 -81
- package/Source/Scene/Model/CustomShader.js +0 -2
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/Model/ModelUtility.js +5 -1
- package/Source/Scene/Multiple3DTileContent.js +21 -8
- package/Source/Scene/PointPrimitive.js +1 -1
- package/Source/Scene/ResourceCache.js +17 -1
- package/Source/Scene/Scene.js +39 -15
- package/Source/Scene/ScreenSpaceCameraController.js +0 -8
- package/Source/Scene/SpatialNode.js +4 -11
- package/Source/Scene/Vector3DTilePoints.js +2 -5
- package/Source/Scene/VoxelBoxShape.js +12 -5
- package/Source/Scene/VoxelCell.js +6 -5
- package/Source/Scene/VoxelContent.js +171 -107
- package/Source/Scene/VoxelCylinderShape.js +65 -58
- package/Source/Scene/VoxelEllipsoidShape.js +15 -5
- package/Source/Scene/VoxelMetadataOrder.js +12 -0
- package/Source/Scene/VoxelPrimitive.js +245 -53
- package/Source/Scene/VoxelProvider.js +44 -29
- package/Source/Scene/VoxelRenderResources.js +30 -7
- package/Source/Scene/VoxelShape.js +10 -3
- package/Source/Scene/VoxelTraversal.js +326 -166
- package/Source/Scene/WebMapTileServiceImageryProvider.js +2 -2
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +5 -8
- package/Source/Scene/processVoxelProperties.js +3 -0
- package/Source/Shaders/GlobeFS.glsl +10 -1
- package/Source/Shaders/GlobeFS.js +10 -1
- package/Source/Shaders/PolylineCommon.glsl +1 -1
- package/Source/Shaders/PolylineCommon.js +1 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +4 -16
- package/Source/Shaders/Voxels/Megatexture.js +4 -16
- package/Source/Shaders/Voxels/Octree.glsl +44 -7
- package/Source/Shaders/Voxels/Octree.js +44 -7
- package/Source/Shaders/Voxels/VoxelFS.glsl +9 -15
- package/Source/Shaders/Voxels/VoxelFS.js +9 -15
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +15 -15
- package/Source/Shaders/Voxels/convertUvToCylinder.js +15 -15
- package/Source/Widget/CesiumWidget.js +16 -10
- package/Source/Workers/decodeDraco.js +4 -4
- package/index.d.ts +321 -110
- package/index.js +209 -205
- package/package.json +2 -2
- package/Source/Scene/TextureAtlas.js +0 -558
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import Check from "../Core/Check.js";
|
|
2
|
+
import ComponentDatatype from "../Core/ComponentDatatype.js";
|
|
2
3
|
import defaultValue from "../Core/defaultValue.js";
|
|
3
4
|
import defined from "../Core/defined.js";
|
|
4
5
|
import DracoLoader from "./DracoLoader.js";
|
|
5
6
|
import ResourceLoader from "./ResourceLoader.js";
|
|
6
7
|
import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
8
|
+
import VertexAttributeSemantic from "./VertexAttributeSemantic.js";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Load a draco buffer from a glTF.
|
|
@@ -18,6 +20,7 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
|
18
20
|
* @param {object} options Object with the following properties:
|
|
19
21
|
* @param {ResourceCache} options.resourceCache The {@link ResourceCache} (to avoid circular dependencies).
|
|
20
22
|
* @param {object} options.gltf The glTF JSON.
|
|
23
|
+
* @param {object} options.primitive The primitive containing the Draco extension.
|
|
21
24
|
* @param {object} options.draco The Draco extension object.
|
|
22
25
|
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
23
26
|
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
@@ -29,6 +32,7 @@ function GltfDracoLoader(options) {
|
|
|
29
32
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
30
33
|
const resourceCache = options.resourceCache;
|
|
31
34
|
const gltf = options.gltf;
|
|
35
|
+
const primitive = options.primitive;
|
|
32
36
|
const draco = options.draco;
|
|
33
37
|
const gltfResource = options.gltfResource;
|
|
34
38
|
const baseResource = options.baseResource;
|
|
@@ -37,6 +41,7 @@ function GltfDracoLoader(options) {
|
|
|
37
41
|
//>>includeStart('debug', pragmas.debug);
|
|
38
42
|
Check.typeOf.func("options.resourceCache", resourceCache);
|
|
39
43
|
Check.typeOf.object("options.gltf", gltf);
|
|
44
|
+
Check.typeOf.object("options.primitive", primitive);
|
|
40
45
|
Check.typeOf.object("options.draco", draco);
|
|
41
46
|
Check.typeOf.object("options.gltfResource", gltfResource);
|
|
42
47
|
Check.typeOf.object("options.baseResource", baseResource);
|
|
@@ -46,6 +51,7 @@ function GltfDracoLoader(options) {
|
|
|
46
51
|
this._gltfResource = gltfResource;
|
|
47
52
|
this._baseResource = baseResource;
|
|
48
53
|
this._gltf = gltf;
|
|
54
|
+
this._primitive = primitive;
|
|
49
55
|
this._draco = draco;
|
|
50
56
|
this._cacheKey = cacheKey;
|
|
51
57
|
this._bufferViewLoader = undefined;
|
|
@@ -169,6 +175,24 @@ async function processDecode(loader, decodePromise) {
|
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
177
|
|
|
178
|
+
const SemanticToDracoAttributeType = {};
|
|
179
|
+
SemanticToDracoAttributeType[VertexAttributeSemantic.POSITION] = "POSITION";
|
|
180
|
+
SemanticToDracoAttributeType[VertexAttributeSemantic.NORMAL] = "NORMAL";
|
|
181
|
+
SemanticToDracoAttributeType[VertexAttributeSemantic.COLOR] = "COLOR";
|
|
182
|
+
SemanticToDracoAttributeType[VertexAttributeSemantic.TEXCOORD] = "TEX_COORD";
|
|
183
|
+
|
|
184
|
+
function getDracoAttributeType(attribute) {
|
|
185
|
+
for (const semantic in SemanticToDracoAttributeType) {
|
|
186
|
+
if (SemanticToDracoAttributeType.hasOwnProperty(semantic)) {
|
|
187
|
+
if (attribute.startsWith(semantic)) {
|
|
188
|
+
return SemanticToDracoAttributeType[semantic];
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
|
|
172
196
|
/**
|
|
173
197
|
* Processes the resource until it becomes ready.
|
|
174
198
|
*
|
|
@@ -203,12 +227,31 @@ GltfDracoLoader.prototype.process = function (frameState) {
|
|
|
203
227
|
}
|
|
204
228
|
|
|
205
229
|
const draco = this._draco;
|
|
230
|
+
const primitive = this._primitive;
|
|
206
231
|
const gltf = this._gltf;
|
|
207
232
|
const bufferViews = gltf.bufferViews;
|
|
208
233
|
const bufferViewId = draco.bufferView;
|
|
209
234
|
const bufferView = bufferViews[bufferViewId];
|
|
210
235
|
const compressedAttributes = draco.attributes;
|
|
211
236
|
|
|
237
|
+
// Skip de-quantization transform if present for floating point attributes.
|
|
238
|
+
// They will stay quantized in memory and be dequantized in the shader.
|
|
239
|
+
const attributesToSkipTransform = [];
|
|
240
|
+
|
|
241
|
+
for (const attribute in primitive.attributes) {
|
|
242
|
+
if (primitive.attributes.hasOwnProperty(attribute)) {
|
|
243
|
+
const dracoAttributeType = getDracoAttributeType(attribute);
|
|
244
|
+
if (defined(dracoAttributeType)) {
|
|
245
|
+
const accessor = gltf.accessors[primitive.attributes[attribute]];
|
|
246
|
+
if (accessor.componentType === ComponentDatatype.FLOAT) {
|
|
247
|
+
if (!attributesToSkipTransform.includes(dracoAttributeType)) {
|
|
248
|
+
attributesToSkipTransform.push(dracoAttributeType);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
212
255
|
const decodeOptions = {
|
|
213
256
|
// Need to make a copy of the typed array otherwise the underlying
|
|
214
257
|
// ArrayBuffer may be accessed on both the worker and the main thread. This
|
|
@@ -218,6 +261,7 @@ GltfDracoLoader.prototype.process = function (frameState) {
|
|
|
218
261
|
bufferView: bufferView,
|
|
219
262
|
compressedAttributes: compressedAttributes,
|
|
220
263
|
dequantizeInShader: true,
|
|
264
|
+
attributesToSkipTransform: attributesToSkipTransform,
|
|
221
265
|
};
|
|
222
266
|
|
|
223
267
|
const decodePromise = DracoLoader.decodeBufferView(decodeOptions);
|
|
@@ -243,6 +287,7 @@ GltfDracoLoader.prototype.unload = function () {
|
|
|
243
287
|
this._bufferViewTypedArray = undefined;
|
|
244
288
|
this._decodedData = undefined;
|
|
245
289
|
this._gltf = undefined;
|
|
290
|
+
this._primitive = undefined;
|
|
246
291
|
};
|
|
247
292
|
|
|
248
293
|
export default GltfDracoLoader;
|
|
@@ -27,6 +27,7 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
|
27
27
|
* @param {number} options.accessorId The accessor ID corresponding to the index buffer.
|
|
28
28
|
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
29
29
|
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
30
|
+
* @param {object} [options.primitive] The primitive containing the Draco extension.
|
|
30
31
|
* @param {object} [options.draco] The Draco extension object.
|
|
31
32
|
* @param {string} [options.cacheKey] The cache key of the resource.
|
|
32
33
|
* @param {boolean} [options.asynchronous=true] Determines if WebGL resource creation will be spread out over several frames or block until all WebGL resources are created.
|
|
@@ -41,6 +42,7 @@ function GltfIndexBufferLoader(options) {
|
|
|
41
42
|
const accessorId = options.accessorId;
|
|
42
43
|
const gltfResource = options.gltfResource;
|
|
43
44
|
const baseResource = options.baseResource;
|
|
45
|
+
const primitive = options.primitive;
|
|
44
46
|
const draco = options.draco;
|
|
45
47
|
const cacheKey = options.cacheKey;
|
|
46
48
|
const asynchronous = defaultValue(options.asynchronous, true);
|
|
@@ -68,6 +70,7 @@ function GltfIndexBufferLoader(options) {
|
|
|
68
70
|
this._gltf = gltf;
|
|
69
71
|
this._accessorId = accessorId;
|
|
70
72
|
this._indexDatatype = indexDatatype;
|
|
73
|
+
this._primitive = primitive;
|
|
71
74
|
this._draco = draco;
|
|
72
75
|
this._cacheKey = cacheKey;
|
|
73
76
|
this._asynchronous = asynchronous;
|
|
@@ -174,6 +177,7 @@ async function loadFromDraco(indexBufferLoader) {
|
|
|
174
177
|
try {
|
|
175
178
|
const dracoLoader = resourceCache.getDracoLoader({
|
|
176
179
|
gltf: indexBufferLoader._gltf,
|
|
180
|
+
primitive: indexBufferLoader._primitive,
|
|
177
181
|
draco: indexBufferLoader._draco,
|
|
178
182
|
gltfResource: indexBufferLoader._gltfResource,
|
|
179
183
|
baseResource: indexBufferLoader._baseResource,
|
|
@@ -411,6 +415,7 @@ GltfIndexBufferLoader.prototype.unload = function () {
|
|
|
411
415
|
this._typedArray = undefined;
|
|
412
416
|
this._buffer = undefined;
|
|
413
417
|
this._gltf = undefined;
|
|
418
|
+
this._primitive = undefined;
|
|
414
419
|
};
|
|
415
420
|
|
|
416
421
|
export default GltfIndexBufferLoader;
|
|
@@ -685,6 +685,7 @@ function getVertexBufferLoader(
|
|
|
685
685
|
loader,
|
|
686
686
|
accessorId,
|
|
687
687
|
semantic,
|
|
688
|
+
primitive,
|
|
688
689
|
draco,
|
|
689
690
|
loadBuffer,
|
|
690
691
|
loadTypedArray,
|
|
@@ -700,6 +701,7 @@ function getVertexBufferLoader(
|
|
|
700
701
|
baseResource: loader._baseResource,
|
|
701
702
|
frameState: frameState,
|
|
702
703
|
bufferViewId: bufferViewId,
|
|
704
|
+
primitive: primitive,
|
|
703
705
|
draco: draco,
|
|
704
706
|
attributeSemantic: semantic,
|
|
705
707
|
accessorId: accessorId,
|
|
@@ -714,6 +716,7 @@ function getVertexBufferLoader(
|
|
|
714
716
|
function getIndexBufferLoader(
|
|
715
717
|
loader,
|
|
716
718
|
accessorId,
|
|
719
|
+
primitive,
|
|
717
720
|
draco,
|
|
718
721
|
loadBuffer,
|
|
719
722
|
loadTypedArray,
|
|
@@ -725,6 +728,7 @@ function getIndexBufferLoader(
|
|
|
725
728
|
gltfResource: loader._gltfResource,
|
|
726
729
|
baseResource: loader._baseResource,
|
|
727
730
|
frameState: frameState,
|
|
731
|
+
primitive: primitive,
|
|
728
732
|
draco: draco,
|
|
729
733
|
asynchronous: loader._asynchronous,
|
|
730
734
|
loadBuffer: loadBuffer,
|
|
@@ -1154,6 +1158,7 @@ function loadAttribute(
|
|
|
1154
1158
|
loader,
|
|
1155
1159
|
accessorId,
|
|
1156
1160
|
semanticInfo,
|
|
1161
|
+
primitive,
|
|
1157
1162
|
draco,
|
|
1158
1163
|
loadBuffer,
|
|
1159
1164
|
loadTypedArray,
|
|
@@ -1188,6 +1193,7 @@ function loadAttribute(
|
|
|
1188
1193
|
loader,
|
|
1189
1194
|
accessorId,
|
|
1190
1195
|
gltfSemantic,
|
|
1196
|
+
primitive,
|
|
1191
1197
|
draco,
|
|
1192
1198
|
loadBuffer,
|
|
1193
1199
|
loadTypedArray,
|
|
@@ -1232,6 +1238,7 @@ function loadVertexAttribute(
|
|
|
1232
1238
|
loader,
|
|
1233
1239
|
accessorId,
|
|
1234
1240
|
semanticInfo,
|
|
1241
|
+
primitive,
|
|
1235
1242
|
draco,
|
|
1236
1243
|
hasInstances,
|
|
1237
1244
|
needsPostProcessing,
|
|
@@ -1278,6 +1285,7 @@ function loadVertexAttribute(
|
|
|
1278
1285
|
loader,
|
|
1279
1286
|
accessorId,
|
|
1280
1287
|
semanticInfo,
|
|
1288
|
+
primitive,
|
|
1281
1289
|
draco,
|
|
1282
1290
|
loadBuffer,
|
|
1283
1291
|
loadTypedArray,
|
|
@@ -1345,12 +1353,13 @@ function loadInstancedAttribute(
|
|
|
1345
1353
|
|
|
1346
1354
|
const loadTypedArray = loadAsTypedArrayOnly || loadTranslationAsTypedArray;
|
|
1347
1355
|
|
|
1348
|
-
// Don't pass in draco object since instanced attributes can't be draco compressed
|
|
1356
|
+
// Don't pass in primitive or draco object since instanced attributes can't be draco compressed
|
|
1349
1357
|
return loadAttribute(
|
|
1350
1358
|
loader,
|
|
1351
1359
|
accessorId,
|
|
1352
1360
|
semanticInfo,
|
|
1353
1361
|
undefined,
|
|
1362
|
+
undefined,
|
|
1354
1363
|
loadBuffer,
|
|
1355
1364
|
loadTypedArray,
|
|
1356
1365
|
frameState,
|
|
@@ -1360,6 +1369,7 @@ function loadInstancedAttribute(
|
|
|
1360
1369
|
function loadIndices(
|
|
1361
1370
|
loader,
|
|
1362
1371
|
accessorId,
|
|
1372
|
+
primitive,
|
|
1363
1373
|
draco,
|
|
1364
1374
|
hasFeatureIds,
|
|
1365
1375
|
needsPostProcessing,
|
|
@@ -1403,6 +1413,7 @@ function loadIndices(
|
|
|
1403
1413
|
const indexBufferLoader = getIndexBufferLoader(
|
|
1404
1414
|
loader,
|
|
1405
1415
|
accessorId,
|
|
1416
|
+
primitive,
|
|
1406
1417
|
draco,
|
|
1407
1418
|
loadBuffer,
|
|
1408
1419
|
loadTypedArray,
|
|
@@ -1865,7 +1876,8 @@ function loadMorphTarget(
|
|
|
1865
1876
|
) {
|
|
1866
1877
|
const morphTarget = new MorphTarget();
|
|
1867
1878
|
|
|
1868
|
-
// Don't pass in draco object since morph targets can't be draco compressed
|
|
1879
|
+
// Don't pass in primitive or draco object since morph targets can't be draco compressed
|
|
1880
|
+
const primitive = undefined;
|
|
1869
1881
|
const draco = undefined;
|
|
1870
1882
|
const hasInstances = false;
|
|
1871
1883
|
|
|
@@ -1885,6 +1897,7 @@ function loadMorphTarget(
|
|
|
1885
1897
|
loader,
|
|
1886
1898
|
accessorId,
|
|
1887
1899
|
semanticInfo,
|
|
1900
|
+
primitive,
|
|
1888
1901
|
draco,
|
|
1889
1902
|
hasInstances,
|
|
1890
1903
|
needsPostProcessing,
|
|
@@ -1970,6 +1983,7 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
1970
1983
|
loader,
|
|
1971
1984
|
accessorId,
|
|
1972
1985
|
semanticInfo,
|
|
1986
|
+
gltfPrimitive,
|
|
1973
1987
|
draco,
|
|
1974
1988
|
hasInstances,
|
|
1975
1989
|
needsPostProcessing,
|
|
@@ -2002,6 +2016,7 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2002
2016
|
const indicesPlan = loadIndices(
|
|
2003
2017
|
loader,
|
|
2004
2018
|
indices,
|
|
2019
|
+
gltfPrimitive,
|
|
2005
2020
|
draco,
|
|
2006
2021
|
hasFeatureIds,
|
|
2007
2022
|
needsPostProcessing,
|
|
@@ -2176,16 +2191,14 @@ function loadPrimitiveMetadata(primitive, structuralMetadataExtension) {
|
|
|
2176
2191
|
if (!defined(structuralMetadataExtension)) {
|
|
2177
2192
|
return;
|
|
2178
2193
|
}
|
|
2194
|
+
const { propertyTextures, propertyAttributes } = structuralMetadataExtension;
|
|
2179
2195
|
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
primitive.propertyTextureIds = structuralMetadataExtension.propertyTextures;
|
|
2196
|
+
if (defined(propertyTextures)) {
|
|
2197
|
+
primitive.propertyTextureIds = propertyTextures;
|
|
2183
2198
|
}
|
|
2184
2199
|
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
primitive.propertyAttributeIds =
|
|
2188
|
-
structuralMetadataExtension.propertyAttributes;
|
|
2200
|
+
if (defined(propertyAttributes)) {
|
|
2201
|
+
primitive.propertyAttributeIds = propertyAttributes;
|
|
2189
2202
|
}
|
|
2190
2203
|
}
|
|
2191
2204
|
|
|
@@ -26,6 +26,7 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
|
26
26
|
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
27
27
|
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
28
28
|
* @param {number} [options.bufferViewId] The bufferView ID corresponding to the vertex buffer.
|
|
29
|
+
* @param {object} [options.primitive] The primitive containing the Draco extension.
|
|
29
30
|
* @param {object} [options.draco] The Draco extension object.
|
|
30
31
|
* @param {string} [options.attributeSemantic] The attribute semantic, e.g. POSITION or NORMAL.
|
|
31
32
|
* @param {number} [options.accessorId] The accessor id.
|
|
@@ -47,6 +48,7 @@ function GltfVertexBufferLoader(options) {
|
|
|
47
48
|
const gltfResource = options.gltfResource;
|
|
48
49
|
const baseResource = options.baseResource;
|
|
49
50
|
const bufferViewId = options.bufferViewId;
|
|
51
|
+
const primitive = options.primitive;
|
|
50
52
|
const draco = options.draco;
|
|
51
53
|
const attributeSemantic = options.attributeSemantic;
|
|
52
54
|
const accessorId = options.accessorId;
|
|
@@ -67,6 +69,7 @@ function GltfVertexBufferLoader(options) {
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
const hasBufferViewId = defined(bufferViewId);
|
|
72
|
+
const hasPrimitive = defined(primitive);
|
|
70
73
|
const hasDraco = hasDracoCompression(draco, attributeSemantic);
|
|
71
74
|
const hasAttributeSemantic = defined(attributeSemantic);
|
|
72
75
|
const hasAccessorId = defined(accessorId);
|
|
@@ -89,7 +92,14 @@ function GltfVertexBufferLoader(options) {
|
|
|
89
92
|
);
|
|
90
93
|
}
|
|
91
94
|
|
|
95
|
+
if (hasDraco && !hasPrimitive) {
|
|
96
|
+
throw new DeveloperError(
|
|
97
|
+
"When options.draco is defined options.primitive must also be defined.",
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
92
101
|
if (hasDraco) {
|
|
102
|
+
Check.typeOf.object("options.primitive", primitive);
|
|
93
103
|
Check.typeOf.object("options.draco", draco);
|
|
94
104
|
Check.typeOf.string("options.attributeSemantic", attributeSemantic);
|
|
95
105
|
Check.typeOf.number("options.accessorId", accessorId);
|
|
@@ -101,6 +111,7 @@ function GltfVertexBufferLoader(options) {
|
|
|
101
111
|
this._baseResource = baseResource;
|
|
102
112
|
this._gltf = gltf;
|
|
103
113
|
this._bufferViewId = bufferViewId;
|
|
114
|
+
this._primitive = primitive;
|
|
104
115
|
this._draco = draco;
|
|
105
116
|
this._attributeSemantic = attributeSemantic;
|
|
106
117
|
this._accessorId = accessorId;
|
|
@@ -265,6 +276,7 @@ async function loadFromDraco(vertexBufferLoader) {
|
|
|
265
276
|
try {
|
|
266
277
|
const dracoLoader = resourceCache.getDracoLoader({
|
|
267
278
|
gltf: vertexBufferLoader._gltf,
|
|
279
|
+
primitive: vertexBufferLoader._primitive,
|
|
268
280
|
draco: vertexBufferLoader._draco,
|
|
269
281
|
gltfResource: vertexBufferLoader._gltfResource,
|
|
270
282
|
baseResource: vertexBufferLoader._baseResource,
|
|
@@ -467,6 +479,7 @@ GltfVertexBufferLoader.prototype.unload = function () {
|
|
|
467
479
|
this._typedArray = undefined;
|
|
468
480
|
this._buffer = undefined;
|
|
469
481
|
this._gltf = undefined;
|
|
482
|
+
this._primitive = undefined;
|
|
470
483
|
};
|
|
471
484
|
|
|
472
485
|
export default GltfVertexBufferLoader;
|
|
@@ -6,6 +6,7 @@ import RuntimeError from "../Core/RuntimeError.js";
|
|
|
6
6
|
import Check from "../Core/Check.js";
|
|
7
7
|
import KmlDataSource from "../DataSources/KmlDataSource.js";
|
|
8
8
|
import GeoJsonDataSource from "../DataSources/GeoJsonDataSource.js";
|
|
9
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Methods for loading iTwin platform data into CesiumJS
|
|
@@ -154,7 +155,7 @@ ITwinData.createTilesetForRealityDataId = async function (
|
|
|
154
155
|
*
|
|
155
156
|
* @throws {RuntimeError} if the type of reality data is not supported by this function
|
|
156
157
|
*/
|
|
157
|
-
ITwinData.createDataSourceForRealityDataId = async function
|
|
158
|
+
ITwinData.createDataSourceForRealityDataId = async function (
|
|
158
159
|
iTwinId,
|
|
159
160
|
realityDataId,
|
|
160
161
|
type,
|
|
@@ -205,4 +206,49 @@ ITwinData.createDataSourceForRealityDataId = async function loadRealityData(
|
|
|
205
206
|
return KmlDataSource.load(tilesetAccessUrl);
|
|
206
207
|
};
|
|
207
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Load data from the Geospatial Features API as GeoJSON.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} iTwinId The id of the iTwin to load data from
|
|
213
|
+
* @param {string} collectionId The id of the data collection to load
|
|
214
|
+
* @param {number} [limit=10000] number of items per page, must be between 1 and 10,000 inclusive
|
|
215
|
+
* @returns {Promise<GeoJsonDataSource>}
|
|
216
|
+
*/
|
|
217
|
+
ITwinData.loadGeospatialFeatures = async function (
|
|
218
|
+
iTwinId,
|
|
219
|
+
collectionId,
|
|
220
|
+
limit,
|
|
221
|
+
) {
|
|
222
|
+
//>>includeStart('debug', pragmas.debug);
|
|
223
|
+
Check.typeOf.string("iTwinId", iTwinId);
|
|
224
|
+
Check.typeOf.string("collectionId", collectionId);
|
|
225
|
+
if (defined(limit)) {
|
|
226
|
+
Check.typeOf.number("limit", limit);
|
|
227
|
+
Check.typeOf.number.lessThanOrEquals("limit", limit, 10000);
|
|
228
|
+
Check.typeOf.number.greaterThanOrEquals("limit", limit, 1);
|
|
229
|
+
}
|
|
230
|
+
if (!defined(ITwinPlatform.defaultAccessToken)) {
|
|
231
|
+
throw new DeveloperError("Must set ITwinPlatform.defaultAccessToken first");
|
|
232
|
+
}
|
|
233
|
+
//>>includeEnd('debug')
|
|
234
|
+
|
|
235
|
+
const pageLimit = limit ?? 10000;
|
|
236
|
+
|
|
237
|
+
const tilesetUrl = `${ITwinPlatform.apiEndpoint}geospatial-features/itwins/${iTwinId}/ogc/collections/${collectionId}/items`;
|
|
238
|
+
|
|
239
|
+
const resource = new Resource({
|
|
240
|
+
url: tilesetUrl,
|
|
241
|
+
headers: {
|
|
242
|
+
Authorization: `Bearer ${ITwinPlatform.defaultAccessToken}`,
|
|
243
|
+
Accept: "application/vnd.bentley.itwin-platform.v1+json",
|
|
244
|
+
},
|
|
245
|
+
queryParameters: {
|
|
246
|
+
limit: pageLimit,
|
|
247
|
+
client: "CesiumJS",
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
return GeoJsonDataSource.load(resource);
|
|
252
|
+
};
|
|
253
|
+
|
|
208
254
|
export default ITwinData;
|
|
@@ -511,7 +511,7 @@ ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004;
|
|
|
511
511
|
* Create a new imagery layer from an asynchronous imagery provider. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
|
|
512
512
|
*
|
|
513
513
|
* @param {Promise<ImageryProvider>} imageryProviderPromise A promise which resolves to a imagery provider
|
|
514
|
-
* @param {ImageryLayer.ConstructorOptions} options An object describing initialization options
|
|
514
|
+
* @param {ImageryLayer.ConstructorOptions} [options] An object describing initialization options
|
|
515
515
|
* @returns {ImageryLayer} The created imagery layer.
|
|
516
516
|
*
|
|
517
517
|
* @example
|
|
@@ -183,6 +183,7 @@ ImplicitSubtree.prototype.tileIsAvailableAtIndex = function (index) {
|
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* Check if a specific tile is available at an implicit tile coordinate
|
|
186
|
+
* NOTE: only used for voxels.
|
|
186
187
|
*
|
|
187
188
|
* @param {ImplicitTileCoordinates} implicitCoordinates The global coordinates of a tile
|
|
188
189
|
* @returns {boolean} The value of the i-th bit
|
|
@@ -249,6 +250,7 @@ ImplicitSubtree.prototype.childSubtreeIsAvailableAtIndex = function (index) {
|
|
|
249
250
|
|
|
250
251
|
/**
|
|
251
252
|
* Check if a specific child subtree is available at an implicit tile coordinate
|
|
253
|
+
* NOTE: only used for voxels.
|
|
252
254
|
*
|
|
253
255
|
* @param {ImplicitTileCoordinates} implicitCoordinates The global coordinates of a child subtree
|
|
254
256
|
* @returns {boolean} The value of the i-th bit
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const LoadState = Object.freeze({
|
|
2
2
|
UNLOADED: 0, // Has no data and is in dormant state
|
|
3
3
|
RECEIVING: 1, // Is waiting on data from the provider
|
|
4
|
-
|
|
4
|
+
PROCESSING: 2, // Data received. Contents are being processed for rendering. Depending on the content, it might make its own requests for external data.
|
|
5
5
|
LOADED: 3, // Processed data from provider
|
|
6
6
|
FAILED: 4, // Failed to receive data from the provider
|
|
7
7
|
UNAVAILABLE: 5, // No data available for this tile
|
|
@@ -20,12 +20,26 @@ function KeyframeNode(spatialNode, keyframe) {
|
|
|
20
20
|
this.spatialNode = spatialNode;
|
|
21
21
|
this.keyframe = keyframe;
|
|
22
22
|
this.state = LoadState.UNLOADED;
|
|
23
|
-
this.
|
|
23
|
+
this.content = undefined;
|
|
24
24
|
this.megatextureIndex = -1;
|
|
25
25
|
this.priority = -Number.MAX_VALUE;
|
|
26
26
|
this.highPriorityFrameNumber = -1;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Frees the resources used by this object.
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
KeyframeNode.prototype.unload = function () {
|
|
34
|
+
this.content = this.content && this.content.destroy();
|
|
35
|
+
|
|
36
|
+
this.spatialNode = undefined;
|
|
37
|
+
this.state = LoadState.UNLOADED;
|
|
38
|
+
this.megatextureIndex = -1;
|
|
39
|
+
this.priority = -Number.MAX_VALUE;
|
|
40
|
+
this.highPriorityFrameNumber = -1;
|
|
41
|
+
};
|
|
42
|
+
|
|
29
43
|
/**
|
|
30
44
|
* @param {KeyframeNode} a
|
|
31
45
|
* @param {KeyframeNode} b
|
package/Source/Scene/Label.js
CHANGED
|
@@ -1364,7 +1364,7 @@ Label.filterUnsupportedCharacters = function (text) {
|
|
|
1364
1364
|
* Determines if this label equals another label. Labels are equal if all their properties
|
|
1365
1365
|
* are equal. Labels in different collections can be equal.
|
|
1366
1366
|
*
|
|
1367
|
-
* @param {Label} other The label to compare for equality.
|
|
1367
|
+
* @param {Label} [other] The label to compare for equality.
|
|
1368
1368
|
* @returns {boolean} <code>true</code> if the labels are equal; otherwise, <code>false</code>.
|
|
1369
1369
|
*/
|
|
1370
1370
|
Label.prototype.equals = function (other) {
|