@cesium/engine 22.3.0 → 23.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-EAAH543Q.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-EUDHHS7K.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-LWZHJWYK.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-7U5YNLF3.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-D63Z7KKL.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-D6OKR3BQ.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-BO22JHBX.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-XLIJV3YZ.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-AWELU5C6.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-T5MJDW43.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-NVL7JXAQ.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-YHPBT4I5.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-WHLGBMBC.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-VIQIKMTZ.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-TCOUGKXF.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-S2KVL7OJ.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-5PJB7ASO.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-IXL46IYV.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-KIJR26N3.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-4R6FGUFP.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-FUDC3KOT.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-K2PLKJJG.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-4BBANFU6.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-K4PGSAR5.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-OOYICVOK.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-FDOLXORR.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-7SLNBIZS.js → chunk-IFA7VHHP.js} +560 -277
- package/Build/Workers/{chunk-N66PIK46.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-ZWWN2CQH.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-4O2ARYS7.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-TY5JXMVO.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-L4OFWHNI.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-N6XBJBI7.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-FS42VX2H.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-7ATKQRBM.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-EOSX23OS.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-NO3LMU7T.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-HWGP4GVC.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-6GBGEUWR.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-E4YDCSQK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-ZGGVEGTA.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-6WDMPXQ7.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-LK7GEFGB.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-M5DVYXJJ.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-WUWPKBOZ.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-W5NV72VR.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-PJLRXIMS.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-D2PEV362.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-MASEF4OV.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-2MLJ46ZZ.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-EY5HOJFQ.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-AFGP5BXS.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-IHFAFGR2.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-TMGLPEZW.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-VRAAQ3FS.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-Y5MRBKQN.js → chunk-ZIW5FCIW.js} +18 -18
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -4
- package/Source/Scene/BillboardCollection.js +64 -25
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +906 -167
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +313 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/Label.js +6 -4
- package/Source/Scene/LabelCollection.js +59 -1
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +1 -1
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +2 -2
- package/Source/Shaders/Model/ModelFS.js +2 -2
- package/Source/Shaders/Model/ModelVS.glsl +2 -2
- package/Source/Shaders/Model/ModelVS.js +2 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/index.d.ts +564 -189
- package/index.js +127 -119
- package/package.json +1 -1
- package/Build/Workers/chunk-LYBNPUEI.js +0 -1443
|
@@ -48,89 +48,84 @@ const Instances = ModelComponents.Instances;
|
|
|
48
48
|
* Implements the {@link ResourceLoader} interface.
|
|
49
49
|
* </p>
|
|
50
50
|
*
|
|
51
|
-
* @alias I3dmLoader
|
|
52
|
-
* @constructor
|
|
53
|
-
* @augments ResourceLoader
|
|
54
51
|
* @private
|
|
55
|
-
*
|
|
56
|
-
* @param {object} options Object with the following properties:
|
|
57
|
-
* @param {Resource} options.i3dmResource The {@link Resource} containing the i3dm.
|
|
58
|
-
* @param {ArrayBuffer} options.arrayBuffer The array buffer of the i3dm contents.
|
|
59
|
-
* @param {number} [options.byteOffset=0] The byte offset to the beginning of the i3dm contents in the array buffer.
|
|
60
|
-
* @param {Resource} [options.baseResource] The {@link Resource} that paths in the glTF JSON are relative to.
|
|
61
|
-
* @param {boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
|
|
62
|
-
* @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.
|
|
63
|
-
* @param {boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the glTF is loaded.
|
|
64
|
-
* @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
|
|
65
|
-
* @param {Axis} [options.forwardAxis=Axis.X] The forward-axis of the glTF model.
|
|
66
|
-
* @param {boolean} [options.loadAttributesAsTypedArray=false] Load all attributes as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
|
|
67
|
-
* @param {boolean} [options.enablePick=false] If <code>true</code>, load the positions buffer, any instanced attribute buffers, and index buffer as typed arrays for CPU-enabled picking in WebGL1.
|
|
68
|
-
* @param {boolean} [options.loadIndicesForWireframe=false] Load the index buffer as a typed array so wireframe indices can be created for WebGL1.
|
|
69
|
-
* @param {boolean} [options.loadPrimitiveOutline=true] If true, load outlines from the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. This can be set false to avoid post-processing geometry at load time.
|
|
70
52
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
53
|
+
class I3dmLoader extends ResourceLoader {
|
|
54
|
+
/**
|
|
55
|
+
* @param {object} options Object with the following properties:
|
|
56
|
+
* @param {Resource} options.i3dmResource The {@link Resource} containing the i3dm.
|
|
57
|
+
* @param {ArrayBuffer} options.arrayBuffer The array buffer of the i3dm contents.
|
|
58
|
+
* @param {number} [options.byteOffset=0] The byte offset to the beginning of the i3dm contents in the array buffer.
|
|
59
|
+
* @param {Resource} [options.baseResource] The {@link Resource} that paths in the glTF JSON are relative to.
|
|
60
|
+
* @param {boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
|
|
61
|
+
* @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.
|
|
62
|
+
* @param {boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the glTF is loaded.
|
|
63
|
+
* @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
|
|
64
|
+
* @param {Axis} [options.forwardAxis=Axis.X] The forward-axis of the glTF model.
|
|
65
|
+
* @param {boolean} [options.loadAttributesAsTypedArray=false] Load all attributes as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
|
|
66
|
+
* @param {boolean} [options.enablePick=false] If <code>true</code>, load the positions buffer, any instanced attribute buffers, and index buffer as typed arrays for CPU-enabled picking in WebGL1.
|
|
67
|
+
* @param {boolean} [options.loadIndicesForWireframe=false] Load the index buffer as a typed array so wireframe indices can be created for WebGL1.
|
|
68
|
+
* @param {boolean} [options.loadPrimitiveOutline=true] If true, load outlines from the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. This can be set false to avoid post-processing geometry at load time.
|
|
69
|
+
*/
|
|
70
|
+
constructor(options) {
|
|
71
|
+
super();
|
|
72
|
+
|
|
73
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
74
|
+
|
|
75
|
+
const i3dmResource = options.i3dmResource;
|
|
76
|
+
const arrayBuffer = options.arrayBuffer;
|
|
77
|
+
let baseResource = options.baseResource;
|
|
78
|
+
const byteOffset = options.byteOffset ?? 0;
|
|
79
|
+
const releaseGltfJson = options.releaseGltfJson ?? false;
|
|
80
|
+
const asynchronous = options.asynchronous ?? true;
|
|
81
|
+
const incrementallyLoadTextures = options.incrementallyLoadTextures ?? true;
|
|
82
|
+
const upAxis = options.upAxis ?? Axis.Y;
|
|
83
|
+
const forwardAxis = options.forwardAxis ?? Axis.X;
|
|
84
|
+
const loadAttributesAsTypedArray =
|
|
85
|
+
options.loadAttributesAsTypedArray ?? false;
|
|
86
|
+
const loadIndicesForWireframe = options.loadIndicesForWireframe ?? false;
|
|
87
|
+
const loadPrimitiveOutline = options.loadPrimitiveOutline ?? true;
|
|
88
|
+
const enablePick = options.enablePick ?? false;
|
|
89
|
+
|
|
90
|
+
//>>includeStart('debug', pragmas.debug);
|
|
91
|
+
Check.typeOf.object("options.i3dmResource", i3dmResource);
|
|
92
|
+
Check.typeOf.object("options.arrayBuffer", arrayBuffer);
|
|
93
|
+
//>>includeEnd('debug');
|
|
94
|
+
|
|
95
|
+
baseResource = defined(baseResource) ? baseResource : i3dmResource.clone();
|
|
96
|
+
|
|
97
|
+
this._i3dmResource = i3dmResource;
|
|
98
|
+
this._baseResource = baseResource;
|
|
99
|
+
this._arrayBuffer = arrayBuffer;
|
|
100
|
+
this._byteOffset = byteOffset;
|
|
101
|
+
this._releaseGltfJson = releaseGltfJson;
|
|
102
|
+
this._asynchronous = asynchronous;
|
|
103
|
+
this._incrementallyLoadTextures = incrementallyLoadTextures;
|
|
104
|
+
this._upAxis = upAxis;
|
|
105
|
+
this._forwardAxis = forwardAxis;
|
|
106
|
+
this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
|
|
107
|
+
this._loadIndicesForWireframe = loadIndicesForWireframe;
|
|
108
|
+
this._loadPrimitiveOutline = loadPrimitiveOutline;
|
|
109
|
+
this._enablePick = enablePick;
|
|
110
|
+
|
|
111
|
+
this._state = I3dmLoaderState.NOT_LOADED;
|
|
112
|
+
this._promise = undefined;
|
|
113
|
+
|
|
114
|
+
this._gltfLoader = undefined;
|
|
115
|
+
|
|
116
|
+
// Instanced attributes are initially parsed as typed arrays, but if they
|
|
117
|
+
// do not need to be further processed (e.g. turned into transform matrices),
|
|
118
|
+
// it is more efficient to turn them into buffers. The I3dmLoader will own the
|
|
119
|
+
// resources and store them here.
|
|
120
|
+
this._buffers = [];
|
|
121
|
+
this._components = undefined;
|
|
122
|
+
|
|
123
|
+
this._transform = Matrix4.IDENTITY;
|
|
124
|
+
this._batchTable = undefined;
|
|
125
|
+
this._featureTable = undefined;
|
|
126
|
+
this._instancesLength = 0;
|
|
127
|
+
}
|
|
132
128
|
|
|
133
|
-
Object.defineProperties(I3dmLoader.prototype, {
|
|
134
129
|
/**
|
|
135
130
|
* true if textures are loaded, useful when incrementallyLoadTextures is true
|
|
136
131
|
*
|
|
@@ -140,11 +135,10 @@ Object.defineProperties(I3dmLoader.prototype, {
|
|
|
140
135
|
* @readonly
|
|
141
136
|
* @private
|
|
142
137
|
*/
|
|
143
|
-
texturesLoaded
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
},
|
|
138
|
+
get texturesLoaded() {
|
|
139
|
+
return this._gltfLoader?.texturesLoaded;
|
|
140
|
+
}
|
|
141
|
+
|
|
148
142
|
/**
|
|
149
143
|
* The cache key of the resource
|
|
150
144
|
*
|
|
@@ -154,11 +148,9 @@ Object.defineProperties(I3dmLoader.prototype, {
|
|
|
154
148
|
* @readonly
|
|
155
149
|
* @private
|
|
156
150
|
*/
|
|
157
|
-
cacheKey
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
},
|
|
151
|
+
get cacheKey() {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
162
154
|
|
|
163
155
|
/**
|
|
164
156
|
* The loaded components.
|
|
@@ -170,165 +162,181 @@ Object.defineProperties(I3dmLoader.prototype, {
|
|
|
170
162
|
* @readonly
|
|
171
163
|
* @private
|
|
172
164
|
*/
|
|
173
|
-
components
|
|
174
|
-
|
|
175
|
-
return this._components;
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Loads the resource.
|
|
182
|
-
* @returns {Promise<I3dmLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
183
|
-
* @private
|
|
184
|
-
*/
|
|
185
|
-
I3dmLoader.prototype.load = function () {
|
|
186
|
-
if (defined(this._promise)) {
|
|
187
|
-
return this._promise;
|
|
165
|
+
get components() {
|
|
166
|
+
return this._components;
|
|
188
167
|
}
|
|
189
168
|
|
|
190
|
-
|
|
191
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Loads the resource.
|
|
171
|
+
* @returns {Promise<I3dmLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
load() {
|
|
175
|
+
if (defined(this._promise)) {
|
|
176
|
+
return this._promise;
|
|
177
|
+
}
|
|
192
178
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const batchTableJson = i3dm.batchTableJson;
|
|
196
|
-
const batchTableBinary = i3dm.batchTableBinary;
|
|
197
|
-
const gltfFormat = i3dm.gltfFormat;
|
|
179
|
+
// Parse the i3dm into its various sections.
|
|
180
|
+
const i3dm = I3dmParser.parse(this._arrayBuffer, this._byteOffset);
|
|
198
181
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this._featureTable = featureTable;
|
|
182
|
+
const featureTableJson = i3dm.featureTableJson;
|
|
183
|
+
const featureTableBinary = i3dm.featureTableBinary;
|
|
184
|
+
const batchTableJson = i3dm.batchTableJson;
|
|
185
|
+
const batchTableBinary = i3dm.batchTableBinary;
|
|
186
|
+
const gltfFormat = i3dm.gltfFormat;
|
|
205
187
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
throw new RuntimeError(
|
|
211
|
-
"Feature table global property: INSTANCES_LENGTH must be defined",
|
|
188
|
+
// Generate the feature table.
|
|
189
|
+
const featureTable = new Cesium3DTileFeatureTable(
|
|
190
|
+
featureTableJson,
|
|
191
|
+
featureTableBinary,
|
|
212
192
|
);
|
|
213
|
-
|
|
214
|
-
this._instancesLength = instancesLength;
|
|
193
|
+
this._featureTable = featureTable;
|
|
215
194
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
195
|
+
// Get the number of instances in the i3dm.
|
|
196
|
+
const instancesLength = featureTable.getGlobalProperty("INSTANCES_LENGTH");
|
|
197
|
+
featureTable.featuresLength = instancesLength;
|
|
198
|
+
if (!defined(instancesLength)) {
|
|
199
|
+
throw new RuntimeError(
|
|
200
|
+
"Feature table global property: INSTANCES_LENGTH must be defined",
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
this._instancesLength = instancesLength;
|
|
225
204
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
205
|
+
// Get the RTC center, if available, and set the loader's transform.
|
|
206
|
+
const rtcCenter = featureTable.getGlobalProperty(
|
|
207
|
+
"RTC_CENTER",
|
|
208
|
+
ComponentDatatype.FLOAT,
|
|
209
|
+
3,
|
|
210
|
+
);
|
|
211
|
+
if (defined(rtcCenter)) {
|
|
212
|
+
this._transform = Matrix4.fromTranslation(
|
|
213
|
+
Cartesian3.fromArray(rtcCenter),
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Save the batch table section to use for StructuralMetadata generation.
|
|
218
|
+
this._batchTable = {
|
|
219
|
+
json: batchTableJson,
|
|
220
|
+
binary: batchTableBinary,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const loaderOptions = {
|
|
224
|
+
upAxis: this._upAxis,
|
|
225
|
+
forwardAxis: this._forwardAxis,
|
|
226
|
+
releaseGltfJson: this._releaseGltfJson,
|
|
227
|
+
incrementallyLoadTextures: this._incrementallyLoadTextures,
|
|
228
|
+
loadAttributesAsTypedArray: this._loadAttributesAsTypedArray,
|
|
229
|
+
enablePick: this._enablePick,
|
|
230
|
+
loadIndicesForWireframe: this._loadIndicesForWireframe,
|
|
231
|
+
loadPrimitiveOutline: this._loadPrimitiveOutline,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
if (gltfFormat === 0) {
|
|
235
|
+
let gltfUrl = getStringFromTypedArray(i3dm.gltf);
|
|
236
|
+
|
|
237
|
+
// We need to remove padding from the end of the model URL in case this tile was part of a composite tile.
|
|
238
|
+
// This removes all white space and null characters from the end of the string.
|
|
239
|
+
gltfUrl = gltfUrl.replace(/[\s\0]+$/, "");
|
|
240
|
+
const gltfResource = this._baseResource.getDerivedResource({
|
|
241
|
+
url: gltfUrl,
|
|
242
|
+
});
|
|
243
|
+
loaderOptions.gltfResource = gltfResource;
|
|
244
|
+
loaderOptions.baseResource = gltfResource;
|
|
245
|
+
} else {
|
|
246
|
+
loaderOptions.gltfResource = this._i3dmResource;
|
|
247
|
+
loaderOptions.typedArray = i3dm.gltf;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Create the GltfLoader, update the state and load the glTF.
|
|
251
|
+
const gltfLoader = new GltfLoader(loaderOptions);
|
|
252
|
+
|
|
253
|
+
this._gltfLoader = gltfLoader;
|
|
254
|
+
this._state = I3dmLoaderState.LOADING;
|
|
255
|
+
|
|
256
|
+
this._promise = gltfLoader
|
|
257
|
+
.load()
|
|
258
|
+
.then(() => {
|
|
259
|
+
if (this.isDestroyed()) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
this._state = I3dmLoaderState.PROCESSING;
|
|
264
|
+
return this;
|
|
265
|
+
})
|
|
266
|
+
.catch((error) => {
|
|
267
|
+
if (this.isDestroyed()) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
throw handleError(this, error);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
return this._promise;
|
|
257
274
|
}
|
|
258
275
|
|
|
259
|
-
|
|
260
|
-
|
|
276
|
+
process(frameState) {
|
|
277
|
+
//>>includeStart('debug', pragmas.debug);
|
|
278
|
+
Check.typeOf.object("frameState", frameState);
|
|
279
|
+
//>>includeEnd('debug');
|
|
261
280
|
|
|
262
|
-
|
|
263
|
-
|
|
281
|
+
if (this._state === I3dmLoaderState.READY) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
264
284
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
285
|
+
const gltfLoader = this._gltfLoader;
|
|
286
|
+
let ready = false;
|
|
287
|
+
if (this._state === I3dmLoaderState.PROCESSING) {
|
|
288
|
+
ready = gltfLoader.process(frameState);
|
|
289
|
+
}
|
|
271
290
|
|
|
272
|
-
|
|
273
|
-
return
|
|
274
|
-
}
|
|
275
|
-
.catch((error) => {
|
|
276
|
-
if (this.isDestroyed()) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
throw handleError(this, error);
|
|
280
|
-
});
|
|
291
|
+
if (!ready) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
281
294
|
|
|
282
|
-
|
|
283
|
-
};
|
|
295
|
+
const components = gltfLoader.components;
|
|
284
296
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
297
|
+
// Combine the RTC_CENTER transform from the i3dm and the CESIUM_RTC
|
|
298
|
+
// transform from the glTF. In practice CESIUM_RTC is not set for
|
|
299
|
+
// instanced models but multiply the transforms just in case.
|
|
300
|
+
components.transform = Matrix4.multiplyTransformation(
|
|
301
|
+
this._transform,
|
|
302
|
+
components.transform,
|
|
303
|
+
components.transform,
|
|
304
|
+
);
|
|
291
305
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
//>>includeEnd('debug');
|
|
306
|
+
createInstances(this, components, frameState);
|
|
307
|
+
createStructuralMetadata(this, components);
|
|
308
|
+
this._components = components;
|
|
296
309
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
310
|
+
// Now that we have the parsed components, we can release the array buffer
|
|
311
|
+
this._arrayBuffer = undefined;
|
|
300
312
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
if (this._state === I3dmLoaderState.PROCESSING) {
|
|
304
|
-
ready = gltfLoader.process(frameState);
|
|
313
|
+
this._state = I3dmLoaderState.READY;
|
|
314
|
+
return true;
|
|
305
315
|
}
|
|
306
316
|
|
|
307
|
-
|
|
308
|
-
return
|
|
317
|
+
isUnloaded() {
|
|
318
|
+
return this._state === I3dmLoaderState.UNLOADED;
|
|
309
319
|
}
|
|
310
320
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
// instanced models but multiply the transforms just in case.
|
|
316
|
-
components.transform = Matrix4.multiplyTransformation(
|
|
317
|
-
this._transform,
|
|
318
|
-
components.transform,
|
|
319
|
-
components.transform,
|
|
320
|
-
);
|
|
321
|
+
unload() {
|
|
322
|
+
if (defined(this._gltfLoader) && !this._gltfLoader.isDestroyed()) {
|
|
323
|
+
this._gltfLoader.unload();
|
|
324
|
+
}
|
|
321
325
|
|
|
322
|
-
|
|
323
|
-
createStructuralMetadata(this, components);
|
|
324
|
-
this._components = components;
|
|
326
|
+
unloadBuffers(this);
|
|
325
327
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
+
this._components = undefined;
|
|
329
|
+
this._arrayBuffer = undefined;
|
|
330
|
+
this._state = I3dmLoaderState.UNLOADED;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
328
333
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
334
|
+
function handleError(i3dmLoader, error) {
|
|
335
|
+
i3dmLoader.unload();
|
|
336
|
+
i3dmLoader._state = I3dmLoaderState.FAILED;
|
|
337
|
+
const errorMessage = "Failed to load i3dm";
|
|
338
|
+
return i3dmLoader.getError(errorMessage, error);
|
|
339
|
+
}
|
|
332
340
|
|
|
333
341
|
function createStructuralMetadata(loader, components) {
|
|
334
342
|
const batchTable = loader._batchTable;
|
|
@@ -864,20 +872,4 @@ function unloadBuffers(loader) {
|
|
|
864
872
|
buffers.length = 0;
|
|
865
873
|
}
|
|
866
874
|
|
|
867
|
-
I3dmLoader.prototype.isUnloaded = function () {
|
|
868
|
-
return this._state === I3dmLoaderState.UNLOADED;
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
I3dmLoader.prototype.unload = function () {
|
|
872
|
-
if (defined(this._gltfLoader) && !this._gltfLoader.isDestroyed()) {
|
|
873
|
-
this._gltfLoader.unload();
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
unloadBuffers(this);
|
|
877
|
-
|
|
878
|
-
this._components = undefined;
|
|
879
|
-
this._arrayBuffer = undefined;
|
|
880
|
-
this._state = I3dmLoaderState.UNLOADED;
|
|
881
|
-
};
|
|
882
|
-
|
|
883
875
|
export default I3dmLoader;
|