@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.
Files changed (193) hide show
  1. package/Build/Workers/{chunk-EAAH543Q.js → chunk-2GL2EUEE.js} +11 -11
  2. package/Build/Workers/{chunk-EUDHHS7K.js → chunk-2WI4HGJU.js} +6 -6
  3. package/Build/Workers/{chunk-LWZHJWYK.js → chunk-36LBFITA.js} +665 -366
  4. package/Build/Workers/{chunk-7U5YNLF3.js → chunk-3B65YFXC.js} +1 -1
  5. package/Build/Workers/{chunk-D63Z7KKL.js → chunk-4LGFX2P5.js} +11 -11
  6. package/Build/Workers/{chunk-D6OKR3BQ.js → chunk-4UNQX2MP.js} +2 -2
  7. package/Build/Workers/{chunk-BO22JHBX.js → chunk-52K3GJKG.js} +3 -3
  8. package/Build/Workers/{chunk-XLIJV3YZ.js → chunk-56OHFSLH.js} +10 -10
  9. package/Build/Workers/{chunk-AWELU5C6.js → chunk-5A7YSAXT.js} +14 -14
  10. package/Build/Workers/{chunk-T5MJDW43.js → chunk-5JP5FG7U.js} +7 -7
  11. package/Build/Workers/{chunk-NVL7JXAQ.js → chunk-5R7SBUTW.js} +10 -10
  12. package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
  13. package/Build/Workers/{chunk-YHPBT4I5.js → chunk-6FVFM2KB.js} +5 -5
  14. package/Build/Workers/{chunk-WHLGBMBC.js → chunk-6SLGTBB2.js} +5 -5
  15. package/Build/Workers/{chunk-VIQIKMTZ.js → chunk-7KRN6JPQ.js} +14 -14
  16. package/Build/Workers/{chunk-TCOUGKXF.js → chunk-AA33B6PU.js} +4 -4
  17. package/Build/Workers/{chunk-S2KVL7OJ.js → chunk-AP6XWET5.js} +8 -8
  18. package/Build/Workers/{chunk-5PJB7ASO.js → chunk-APDKMX7W.js} +6 -6
  19. package/Build/Workers/{chunk-IXL46IYV.js → chunk-ARCFIOKA.js} +12 -12
  20. package/Build/Workers/{chunk-KIJR26N3.js → chunk-BNBD2YZK.js} +16 -16
  21. package/Build/Workers/{chunk-4R6FGUFP.js → chunk-DT5SJBKA.js} +29 -15
  22. package/Build/Workers/{chunk-FUDC3KOT.js → chunk-ESD4IEOU.js} +5 -5
  23. package/Build/Workers/{chunk-K2PLKJJG.js → chunk-FSDVXW7M.js} +5 -5
  24. package/Build/Workers/{chunk-4BBANFU6.js → chunk-G3YT7M7A.js} +1 -1
  25. package/Build/Workers/{chunk-K4PGSAR5.js → chunk-GN5NEUDT.js} +8 -8
  26. package/Build/Workers/{chunk-OOYICVOK.js → chunk-HYLEKKO5.js} +1 -1
  27. package/Build/Workers/{chunk-FDOLXORR.js → chunk-HYTFXWMY.js} +7 -7
  28. package/Build/Workers/{chunk-7SLNBIZS.js → chunk-IFA7VHHP.js} +560 -277
  29. package/Build/Workers/{chunk-N66PIK46.js → chunk-IYVDOB5V.js} +4 -4
  30. package/Build/Workers/{chunk-ZWWN2CQH.js → chunk-JUGY5AZN.js} +4 -4
  31. package/Build/Workers/{chunk-4O2ARYS7.js → chunk-KPYU6YZG.js} +1 -1
  32. package/Build/Workers/{chunk-TY5JXMVO.js → chunk-L7RDJ4V7.js} +1 -1
  33. package/Build/Workers/{chunk-L4OFWHNI.js → chunk-LDQWNMEC.js} +1 -1
  34. package/Build/Workers/{chunk-N6XBJBI7.js → chunk-MQJG522T.js} +6 -6
  35. package/Build/Workers/{chunk-FS42VX2H.js → chunk-MT5M7RLZ.js} +2 -2
  36. package/Build/Workers/{chunk-7ATKQRBM.js → chunk-N4AWE7TZ.js} +10 -10
  37. package/Build/Workers/{chunk-EOSX23OS.js → chunk-NAYRNPEP.js} +4 -4
  38. package/Build/Workers/{chunk-NO3LMU7T.js → chunk-NNHU33JK.js} +7 -7
  39. package/Build/Workers/{chunk-HWGP4GVC.js → chunk-NQCAZU7S.js} +13 -13
  40. package/Build/Workers/{chunk-6GBGEUWR.js → chunk-NUYLNQKV.js} +2 -2
  41. package/Build/Workers/{chunk-E4YDCSQK.js → chunk-OC6X22PG.js} +9 -9
  42. package/Build/Workers/{chunk-ZGGVEGTA.js → chunk-OHBM4YG4.js} +12 -12
  43. package/Build/Workers/{chunk-6WDMPXQ7.js → chunk-OMXN7YF4.js} +12 -12
  44. package/Build/Workers/{chunk-LK7GEFGB.js → chunk-OQ3EAJNW.js} +2 -2
  45. package/Build/Workers/{chunk-M5DVYXJJ.js → chunk-OQBPOKPZ.js} +6 -6
  46. package/Build/Workers/{chunk-WUWPKBOZ.js → chunk-PQVNT5CJ.js} +6 -6
  47. package/Build/Workers/{chunk-W5NV72VR.js → chunk-QA24Q62E.js} +17 -17
  48. package/Build/Workers/{chunk-PJLRXIMS.js → chunk-QQX7S5QT.js} +17 -17
  49. package/Build/Workers/{chunk-D2PEV362.js → chunk-QTOHIXGF.js} +10 -10
  50. package/Build/Workers/{chunk-MASEF4OV.js → chunk-R7M4XNPP.js} +8 -8
  51. package/Build/Workers/{chunk-2MLJ46ZZ.js → chunk-SGKTBHFQ.js} +13 -13
  52. package/Build/Workers/{chunk-EY5HOJFQ.js → chunk-SQTRWKO2.js} +5 -5
  53. package/Build/Workers/{chunk-AFGP5BXS.js → chunk-T43FXHNC.js} +7 -7
  54. package/Build/Workers/{chunk-IHFAFGR2.js → chunk-UEEGWJJP.js} +2 -2
  55. package/Build/Workers/{chunk-TMGLPEZW.js → chunk-WKXDCVBO.js} +4 -4
  56. package/Build/Workers/{chunk-VRAAQ3FS.js → chunk-Y5AJSEEN.js} +2 -2
  57. package/Build/Workers/{chunk-Y5MRBKQN.js → chunk-ZIW5FCIW.js} +18 -18
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/AttributeCompression.js +53 -6
  112. package/Source/Core/Cartesian2.js +689 -684
  113. package/Source/Core/Cartesian3.js +1044 -1043
  114. package/Source/Core/Cartesian4.js +816 -813
  115. package/Source/Core/GoogleMaps.js +23 -2
  116. package/Source/Core/Ion.js +1 -1
  117. package/Source/Core/OpenCageGeocoderService.js +2 -3
  118. package/Source/Core/globalTypes.js +16 -0
  119. package/Source/Renderer/ShaderDestination.js +54 -13
  120. package/Source/Scene/ArcGisMapService.js +1 -1
  121. package/Source/Scene/Billboard.js +7 -4
  122. package/Source/Scene/BillboardCollection.js +64 -25
  123. package/Source/Scene/BufferLoader.js +65 -74
  124. package/Source/Scene/CubeMapPanorama.js +351 -0
  125. package/Source/Scene/DerivedCommand.js +8 -31
  126. package/Source/Scene/DracoLoader.js +79 -78
  127. package/Source/Scene/EquirectangularPanorama.js +264 -0
  128. package/Source/Scene/FrameState.js +7 -0
  129. package/Source/Scene/GaussianSplatPrimitive.js +906 -167
  130. package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
  131. package/Source/Scene/GltfBufferViewLoader.js +109 -118
  132. package/Source/Scene/GltfDracoLoader.js +167 -176
  133. package/Source/Scene/GltfImageLoader.js +91 -101
  134. package/Source/Scene/GltfIndexBufferLoader.js +228 -241
  135. package/Source/Scene/GltfJsonLoader.js +90 -99
  136. package/Source/Scene/GltfLoader.js +313 -324
  137. package/Source/Scene/GltfSpzLoader.js +127 -134
  138. package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
  139. package/Source/Scene/GltfTextureLoader.js +217 -231
  140. package/Source/Scene/GltfVertexBufferLoader.js +267 -276
  141. package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
  142. package/Source/Scene/Label.js +6 -4
  143. package/Source/Scene/LabelCollection.js +59 -1
  144. package/Source/Scene/MetadataClassProperty.js +212 -7
  145. package/Source/Scene/MetadataComponentType.js +162 -127
  146. package/Source/Scene/MetadataSchemaLoader.js +60 -67
  147. package/Source/Scene/MetadataTable.js +14 -0
  148. package/Source/Scene/MetadataTableProperty.js +14 -0
  149. package/Source/Scene/Model/B3dmLoader.js +216 -224
  150. package/Source/Scene/Model/CustomShader.js +6 -1
  151. package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
  152. package/Source/Scene/Model/GeoJsonLoader.js +53 -61
  153. package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
  154. package/Source/Scene/Model/I3dmLoader.js +232 -240
  155. package/Source/Scene/Model/MaterialPipelineStage.js +1 -1
  156. package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
  157. package/Source/Scene/Model/PntsLoader.js +78 -89
  158. package/Source/Scene/Panorama.js +53 -0
  159. package/Source/Scene/PanoramaProvider.js +43 -0
  160. package/Source/Scene/PointPrimitiveCollection.js +14 -22
  161. package/Source/Scene/PropertyTable.js +43 -0
  162. package/Source/Scene/PropertyTexture.js +1 -1
  163. package/Source/Scene/PropertyTextureProperty.js +0 -97
  164. package/Source/Scene/ResourceLoader.js +84 -92
  165. package/Source/Scene/Scene.js +12 -0
  166. package/Source/Scene/SkyBox.js +29 -164
  167. package/Source/Scene/StructuralMetadata.js +18 -3
  168. package/Source/Scene/parseStructuralMetadata.js +244 -0
  169. package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
  170. package/Source/Shaders/BillboardCollectionFS.js +67 -40
  171. package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
  172. package/Source/Shaders/BillboardCollectionVS.js +22 -31
  173. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  174. package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
  175. package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
  176. package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
  177. package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
  178. package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
  179. package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
  180. package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
  181. package/Source/Shaders/Model/MetadataStageFS.js +2 -1
  182. package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
  183. package/Source/Shaders/Model/MetadataStageVS.js +2 -1
  184. package/Source/Shaders/Model/ModelFS.glsl +2 -2
  185. package/Source/Shaders/Model/ModelFS.js +2 -2
  186. package/Source/Shaders/Model/ModelVS.glsl +2 -2
  187. package/Source/Shaders/Model/ModelVS.js +2 -2
  188. package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
  189. package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
  190. package/index.d.ts +564 -189
  191. package/index.js +127 -119
  192. package/package.json +1 -1
  193. 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
- function I3dmLoader(options) {
72
- options = options ?? Frozen.EMPTY_OBJECT;
73
-
74
- const i3dmResource = options.i3dmResource;
75
- const arrayBuffer = options.arrayBuffer;
76
- let baseResource = options.baseResource;
77
- const byteOffset = options.byteOffset ?? 0;
78
- const releaseGltfJson = options.releaseGltfJson ?? false;
79
- const asynchronous = options.asynchronous ?? true;
80
- const incrementallyLoadTextures = options.incrementallyLoadTextures ?? true;
81
- const upAxis = options.upAxis ?? Axis.Y;
82
- const forwardAxis = options.forwardAxis ?? Axis.X;
83
- const loadAttributesAsTypedArray =
84
- options.loadAttributesAsTypedArray ?? false;
85
- const loadIndicesForWireframe = options.loadIndicesForWireframe ?? false;
86
- const loadPrimitiveOutline = options.loadPrimitiveOutline ?? true;
87
- const enablePick = options.enablePick ?? false;
88
-
89
- //>>includeStart('debug', pragmas.debug);
90
- Check.typeOf.object("options.i3dmResource", i3dmResource);
91
- Check.typeOf.object("options.arrayBuffer", arrayBuffer);
92
- //>>includeEnd('debug');
93
-
94
- baseResource = defined(baseResource) ? baseResource : i3dmResource.clone();
95
-
96
- this._i3dmResource = i3dmResource;
97
- this._baseResource = baseResource;
98
- this._arrayBuffer = arrayBuffer;
99
- this._byteOffset = byteOffset;
100
- this._releaseGltfJson = releaseGltfJson;
101
- this._asynchronous = asynchronous;
102
- this._incrementallyLoadTextures = incrementallyLoadTextures;
103
- this._upAxis = upAxis;
104
- this._forwardAxis = forwardAxis;
105
- this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
106
- this._loadIndicesForWireframe = loadIndicesForWireframe;
107
- this._loadPrimitiveOutline = loadPrimitiveOutline;
108
- this._enablePick = enablePick;
109
-
110
- this._state = I3dmLoaderState.NOT_LOADED;
111
- this._promise = undefined;
112
-
113
- this._gltfLoader = undefined;
114
-
115
- // Instanced attributes are initially parsed as typed arrays, but if they
116
- // do not need to be further processed (e.g. turned into transform matrices),
117
- // it is more efficient to turn them into buffers. The I3dmLoader will own the
118
- // resources and store them here.
119
- this._buffers = [];
120
- this._components = undefined;
121
-
122
- this._transform = Matrix4.IDENTITY;
123
- this._batchTable = undefined;
124
- this._featureTable = undefined;
125
- this._instancesLength = 0;
126
- }
127
-
128
- if (defined(Object.create)) {
129
- I3dmLoader.prototype = Object.create(ResourceLoader.prototype);
130
- I3dmLoader.prototype.constructor = I3dmLoader;
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
- get: function () {
145
- return this._gltfLoader?.texturesLoaded;
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
- get: function () {
159
- return undefined;
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
- get: function () {
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
- // Parse the i3dm into its various sections.
191
- const i3dm = I3dmParser.parse(this._arrayBuffer, this._byteOffset);
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
- const featureTableJson = i3dm.featureTableJson;
194
- const featureTableBinary = i3dm.featureTableBinary;
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
- // Generate the feature table.
200
- const featureTable = new Cesium3DTileFeatureTable(
201
- featureTableJson,
202
- featureTableBinary,
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
- // Get the number of instances in the i3dm.
207
- const instancesLength = featureTable.getGlobalProperty("INSTANCES_LENGTH");
208
- featureTable.featuresLength = instancesLength;
209
- if (!defined(instancesLength)) {
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
- // Get the RTC center, if available, and set the loader's transform.
217
- const rtcCenter = featureTable.getGlobalProperty(
218
- "RTC_CENTER",
219
- ComponentDatatype.FLOAT,
220
- 3,
221
- );
222
- if (defined(rtcCenter)) {
223
- this._transform = Matrix4.fromTranslation(Cartesian3.fromArray(rtcCenter));
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
- // Save the batch table section to use for StructuralMetadata generation.
227
- this._batchTable = {
228
- json: batchTableJson,
229
- binary: batchTableBinary,
230
- };
231
-
232
- const loaderOptions = {
233
- upAxis: this._upAxis,
234
- forwardAxis: this._forwardAxis,
235
- releaseGltfJson: this._releaseGltfJson,
236
- incrementallyLoadTextures: this._incrementallyLoadTextures,
237
- loadAttributesAsTypedArray: this._loadAttributesAsTypedArray,
238
- enablePick: this._enablePick,
239
- loadIndicesForWireframe: this._loadIndicesForWireframe,
240
- loadPrimitiveOutline: this._loadPrimitiveOutline,
241
- };
242
-
243
- if (gltfFormat === 0) {
244
- let gltfUrl = getStringFromTypedArray(i3dm.gltf);
245
-
246
- // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.
247
- // This removes all white space and null characters from the end of the string.
248
- gltfUrl = gltfUrl.replace(/[\s\0]+$/, "");
249
- const gltfResource = this._baseResource.getDerivedResource({
250
- url: gltfUrl,
251
- });
252
- loaderOptions.gltfResource = gltfResource;
253
- loaderOptions.baseResource = gltfResource;
254
- } else {
255
- loaderOptions.gltfResource = this._i3dmResource;
256
- loaderOptions.typedArray = i3dm.gltf;
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
- // Create the GltfLoader, update the state and load the glTF.
260
- const gltfLoader = new GltfLoader(loaderOptions);
276
+ process(frameState) {
277
+ //>>includeStart('debug', pragmas.debug);
278
+ Check.typeOf.object("frameState", frameState);
279
+ //>>includeEnd('debug');
261
280
 
262
- this._gltfLoader = gltfLoader;
263
- this._state = I3dmLoaderState.LOADING;
281
+ if (this._state === I3dmLoaderState.READY) {
282
+ return true;
283
+ }
264
284
 
265
- this._promise = gltfLoader
266
- .load()
267
- .then(() => {
268
- if (this.isDestroyed()) {
269
- return;
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
- this._state = I3dmLoaderState.PROCESSING;
273
- return this;
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
- return this._promise;
283
- };
295
+ const components = gltfLoader.components;
284
296
 
285
- function handleError(i3dmLoader, error) {
286
- i3dmLoader.unload();
287
- i3dmLoader._state = I3dmLoaderState.FAILED;
288
- const errorMessage = "Failed to load i3dm";
289
- return i3dmLoader.getError(errorMessage, error);
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
- I3dmLoader.prototype.process = function (frameState) {
293
- //>>includeStart('debug', pragmas.debug);
294
- Check.typeOf.object("frameState", frameState);
295
- //>>includeEnd('debug');
306
+ createInstances(this, components, frameState);
307
+ createStructuralMetadata(this, components);
308
+ this._components = components;
296
309
 
297
- if (this._state === I3dmLoaderState.READY) {
298
- return true;
299
- }
310
+ // Now that we have the parsed components, we can release the array buffer
311
+ this._arrayBuffer = undefined;
300
312
 
301
- const gltfLoader = this._gltfLoader;
302
- let ready = false;
303
- if (this._state === I3dmLoaderState.PROCESSING) {
304
- ready = gltfLoader.process(frameState);
313
+ this._state = I3dmLoaderState.READY;
314
+ return true;
305
315
  }
306
316
 
307
- if (!ready) {
308
- return false;
317
+ isUnloaded() {
318
+ return this._state === I3dmLoaderState.UNLOADED;
309
319
  }
310
320
 
311
- const components = gltfLoader.components;
312
-
313
- // Combine the RTC_CENTER transform from the i3dm and the CESIUM_RTC
314
- // transform from the glTF. In practice CESIUM_RTC is not set for
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
- createInstances(this, components, frameState);
323
- createStructuralMetadata(this, components);
324
- this._components = components;
326
+ unloadBuffers(this);
325
327
 
326
- // Now that we have the parsed components, we can release the array buffer
327
- this._arrayBuffer = undefined;
328
+ this._components = undefined;
329
+ this._arrayBuffer = undefined;
330
+ this._state = I3dmLoaderState.UNLOADED;
331
+ }
332
+ }
328
333
 
329
- this._state = I3dmLoaderState.READY;
330
- return true;
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;
@@ -172,7 +172,7 @@ MaterialPipelineStage.process = function (
172
172
  shaderBuilder.addDefine(
173
173
  "HAS_POINT_DIAMETER",
174
174
  undefined,
175
- ShaderDestination.VERTEX,
175
+ ShaderDestination.BOTH,
176
176
  );
177
177
  shaderBuilder.addUniform(
178
178
  "float",