@cesium/engine 22.2.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 (282) hide show
  1. package/Build/Workers/{chunk-YFEZPDAY.js → chunk-2GL2EUEE.js} +11 -11
  2. package/Build/Workers/{chunk-A3NUMZBG.js → chunk-2WI4HGJU.js} +6 -6
  3. package/Build/Workers/{chunk-3JB2X2PR.js → chunk-36LBFITA.js} +665 -366
  4. package/Build/Workers/{chunk-VSZ5DB2W.js → chunk-3B65YFXC.js} +1 -1
  5. package/Build/Workers/{chunk-PSHZAHFE.js → chunk-4LGFX2P5.js} +11 -11
  6. package/Build/Workers/{chunk-AMWXJ5A7.js → chunk-4UNQX2MP.js} +2 -2
  7. package/Build/Workers/{chunk-LDSQMLRC.js → chunk-52K3GJKG.js} +3 -3
  8. package/Build/Workers/{chunk-MSTAVM2N.js → chunk-56OHFSLH.js} +10 -10
  9. package/Build/Workers/{chunk-IWOSJVFQ.js → chunk-5A7YSAXT.js} +14 -14
  10. package/Build/Workers/{chunk-PMDPP22G.js → chunk-5JP5FG7U.js} +7 -7
  11. package/Build/Workers/{chunk-DIJ7IG5D.js → chunk-5R7SBUTW.js} +10 -10
  12. package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
  13. package/Build/Workers/{chunk-L2FSBEW2.js → chunk-6FVFM2KB.js} +5 -5
  14. package/Build/Workers/{chunk-G6WQA27G.js → chunk-6SLGTBB2.js} +5 -5
  15. package/Build/Workers/{chunk-3HUEBDFC.js → chunk-7KRN6JPQ.js} +14 -14
  16. package/Build/Workers/{chunk-GMHDOQPH.js → chunk-AA33B6PU.js} +4 -4
  17. package/Build/Workers/{chunk-7CDQUIP5.js → chunk-AP6XWET5.js} +8 -8
  18. package/Build/Workers/{chunk-IVN5HSOI.js → chunk-APDKMX7W.js} +6 -6
  19. package/Build/Workers/{chunk-72LZ3FN6.js → chunk-ARCFIOKA.js} +12 -12
  20. package/Build/Workers/{chunk-UBJYWGMV.js → chunk-BNBD2YZK.js} +16 -16
  21. package/Build/Workers/{chunk-VGH2CSC7.js → chunk-DT5SJBKA.js} +29 -15
  22. package/Build/Workers/{chunk-ED4UXMYY.js → chunk-ESD4IEOU.js} +5 -5
  23. package/Build/Workers/{chunk-JFN2DQHY.js → chunk-FSDVXW7M.js} +5 -5
  24. package/Build/Workers/{chunk-JERDRSEI.js → chunk-G3YT7M7A.js} +1 -1
  25. package/Build/Workers/{chunk-NY3CWLIZ.js → chunk-GN5NEUDT.js} +8 -8
  26. package/Build/Workers/{chunk-O3GWUTWM.js → chunk-HYLEKKO5.js} +1 -1
  27. package/Build/Workers/{chunk-64PJ4MTB.js → chunk-HYTFXWMY.js} +7 -7
  28. package/Build/Workers/{chunk-FPRM6PCE.js → chunk-IFA7VHHP.js} +560 -306
  29. package/Build/Workers/{chunk-FM5XPC2E.js → chunk-IYVDOB5V.js} +4 -4
  30. package/Build/Workers/{chunk-P7ISUYLW.js → chunk-JUGY5AZN.js} +4 -4
  31. package/Build/Workers/{chunk-JONWM4IO.js → chunk-KPYU6YZG.js} +1 -1
  32. package/Build/Workers/{chunk-JUOSYFXT.js → chunk-L7RDJ4V7.js} +1 -1
  33. package/Build/Workers/{chunk-MWGB6DLR.js → chunk-LDQWNMEC.js} +1 -1
  34. package/Build/Workers/{chunk-C6FTHSJA.js → chunk-MQJG522T.js} +6 -6
  35. package/Build/Workers/{chunk-WH4HDRGN.js → chunk-MT5M7RLZ.js} +2 -2
  36. package/Build/Workers/{chunk-4ZQN7M7E.js → chunk-N4AWE7TZ.js} +10 -10
  37. package/Build/Workers/{chunk-SDUH3N6G.js → chunk-NAYRNPEP.js} +4 -4
  38. package/Build/Workers/{chunk-7OPRTZBT.js → chunk-NNHU33JK.js} +7 -7
  39. package/Build/Workers/{chunk-CQCEPC6N.js → chunk-NQCAZU7S.js} +13 -13
  40. package/Build/Workers/{chunk-35J4D6PX.js → chunk-NUYLNQKV.js} +2 -2
  41. package/Build/Workers/{chunk-I45CATZK.js → chunk-OC6X22PG.js} +9 -9
  42. package/Build/Workers/{chunk-7MGTX4WP.js → chunk-OHBM4YG4.js} +12 -12
  43. package/Build/Workers/{chunk-DCR62BCO.js → chunk-OMXN7YF4.js} +12 -12
  44. package/Build/Workers/{chunk-XPNY2VY3.js → chunk-OQ3EAJNW.js} +2 -2
  45. package/Build/Workers/{chunk-4I7BCCNU.js → chunk-OQBPOKPZ.js} +6 -6
  46. package/Build/Workers/{chunk-2JNPWPLE.js → chunk-PQVNT5CJ.js} +6 -6
  47. package/Build/Workers/{chunk-K64RQCRK.js → chunk-QA24Q62E.js} +17 -17
  48. package/Build/Workers/{chunk-K6BXEBAF.js → chunk-QQX7S5QT.js} +17 -17
  49. package/Build/Workers/{chunk-2YVTOY5Z.js → chunk-QTOHIXGF.js} +10 -10
  50. package/Build/Workers/{chunk-4MCPC4TE.js → chunk-R7M4XNPP.js} +8 -8
  51. package/Build/Workers/{chunk-C35SJ4QP.js → chunk-SGKTBHFQ.js} +13 -13
  52. package/Build/Workers/{chunk-BKYJBTHW.js → chunk-SQTRWKO2.js} +5 -5
  53. package/Build/Workers/{chunk-I4D5IP46.js → chunk-T43FXHNC.js} +7 -7
  54. package/Build/Workers/{chunk-QO6Z5UJE.js → chunk-UEEGWJJP.js} +2 -2
  55. package/Build/Workers/{chunk-ZUWF63QU.js → chunk-WKXDCVBO.js} +4 -4
  56. package/Build/Workers/{chunk-N5MNKWED.js → chunk-Y5AJSEEN.js} +2 -2
  57. package/Build/Workers/{chunk-V26Y7ZQL.js → chunk-ZIW5FCIW.js} +37 -27
  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 +20 -12
  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/BoxGeometry.js +1 -1
  113. package/Source/Core/Cartesian2.js +689 -684
  114. package/Source/Core/Cartesian3.js +1044 -1043
  115. package/Source/Core/Cartesian4.js +816 -813
  116. package/Source/Core/CornerType.js +1 -1
  117. package/Source/Core/CorridorGeometry.js +1 -1
  118. package/Source/Core/FeatureDetection.js +1 -32
  119. package/Source/Core/Geometry.js +1 -1
  120. package/Source/Core/GoogleMaps.js +23 -2
  121. package/Source/Core/IntersectionTests.js +2 -2
  122. package/Source/Core/Ion.js +1 -1
  123. package/Source/Core/OpenCageGeocoderService.js +2 -3
  124. package/Source/Core/PinBuilder.js +1 -1
  125. package/Source/Core/PolygonGeometry.js +1 -1
  126. package/Source/Core/PolylineGeometry.js +1 -1
  127. package/Source/Core/PolylineVolumeGeometry.js +1 -1
  128. package/Source/Core/RectangleGeometry.js +1 -1
  129. package/Source/Core/ScreenSpaceEventHandler.js +4 -8
  130. package/Source/Core/TerrainMesh.js +11 -8
  131. package/Source/Core/TerrainPicker.js +24 -7
  132. package/Source/Core/VideoSynchronizer.js +1 -1
  133. package/Source/Core/WallGeometry.js +1 -1
  134. package/Source/Core/globalTypes.js +16 -0
  135. package/Source/Core/writeTextToCanvas.js +40 -86
  136. package/Source/DataSources/BillboardGraphics.js +1 -1
  137. package/Source/DataSources/BoxGraphics.js +1 -1
  138. package/Source/DataSources/CallbackPositionProperty.js +1 -1
  139. package/Source/DataSources/CorridorGraphics.js +1 -1
  140. package/Source/DataSources/CzmlDataSource.js +1 -1
  141. package/Source/DataSources/EllipseGraphics.js +1 -1
  142. package/Source/DataSources/EllipsoidGraphics.js +1 -1
  143. package/Source/DataSources/Entity.js +1 -1
  144. package/Source/DataSources/EntityCluster.js +2 -2
  145. package/Source/DataSources/GeoJsonDataSource.js +2 -2
  146. package/Source/DataSources/GpxDataSource.js +1 -1
  147. package/Source/DataSources/KmlDataSource.js +1 -1
  148. package/Source/DataSources/KmlTour.js +1 -1
  149. package/Source/DataSources/LabelGraphics.js +1 -1
  150. package/Source/DataSources/ModelGraphics.js +1 -1
  151. package/Source/DataSources/PlaneGraphics.js +1 -1
  152. package/Source/DataSources/PolygonGraphics.js +1 -1
  153. package/Source/DataSources/PolylineGraphics.js +1 -1
  154. package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
  155. package/Source/DataSources/RectangleGraphics.js +1 -1
  156. package/Source/DataSources/WallGraphics.js +1 -1
  157. package/Source/DataSources/exportKml.js +1 -1
  158. package/Source/Renderer/Context.js +11 -10
  159. package/Source/Renderer/ContextLimits.js +66 -33
  160. package/Source/Renderer/ShaderDestination.js +54 -13
  161. package/Source/Renderer/ShaderSource.js +19 -18
  162. package/Source/Renderer/Texture.js +1 -1
  163. package/Source/Renderer/Texture3D.js +166 -7
  164. package/Source/Renderer/TextureAtlas.js +2 -2
  165. package/Source/Scene/Appearance.js +1 -1
  166. package/Source/Scene/ArcGisMapService.js +1 -1
  167. package/Source/Scene/Billboard.js +8 -5
  168. package/Source/Scene/BillboardCollection.js +65 -26
  169. package/Source/Scene/BillboardTexture.js +4 -1
  170. package/Source/Scene/BufferLoader.js +65 -74
  171. package/Source/Scene/Camera.js +13 -2
  172. package/Source/Scene/ClippingPlaneCollection.js +2 -2
  173. package/Source/Scene/CloudCollection.js +2 -2
  174. package/Source/Scene/CubeMapPanorama.js +351 -0
  175. package/Source/Scene/CumulusCloud.js +1 -1
  176. package/Source/Scene/DerivedCommand.js +8 -31
  177. package/Source/Scene/DracoLoader.js +79 -78
  178. package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
  179. package/Source/Scene/EquirectangularPanorama.js +264 -0
  180. package/Source/Scene/Fog.js +1 -1
  181. package/Source/Scene/FrameState.js +7 -0
  182. package/Source/Scene/GaussianSplatPrimitive.js +907 -168
  183. package/Source/Scene/Globe.js +3 -10
  184. package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
  185. package/Source/Scene/GltfBufferViewLoader.js +109 -118
  186. package/Source/Scene/GltfDracoLoader.js +167 -176
  187. package/Source/Scene/GltfImageLoader.js +91 -101
  188. package/Source/Scene/GltfIndexBufferLoader.js +228 -241
  189. package/Source/Scene/GltfJsonLoader.js +90 -99
  190. package/Source/Scene/GltfLoader.js +323 -324
  191. package/Source/Scene/GltfSpzLoader.js +127 -134
  192. package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
  193. package/Source/Scene/GltfTextureLoader.js +217 -231
  194. package/Source/Scene/GltfVertexBufferLoader.js +267 -276
  195. package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
  196. package/Source/Scene/ImageBasedLighting.js +2 -2
  197. package/Source/Scene/ImageryLayerCollection.js +2 -2
  198. package/Source/Scene/ImageryProvider.js +2 -2
  199. package/Source/Scene/Label.js +7 -5
  200. package/Source/Scene/LabelCollection.js +60 -2
  201. package/Source/Scene/Material.js +1 -1
  202. package/Source/Scene/MaterialAppearance.js +1 -1
  203. package/Source/Scene/Megatexture.js +174 -242
  204. package/Source/Scene/MetadataClassProperty.js +212 -7
  205. package/Source/Scene/MetadataComponentType.js +162 -127
  206. package/Source/Scene/MetadataSchemaLoader.js +60 -67
  207. package/Source/Scene/MetadataTable.js +14 -0
  208. package/Source/Scene/MetadataTableProperty.js +14 -0
  209. package/Source/Scene/Model/B3dmLoader.js +216 -224
  210. package/Source/Scene/Model/CustomShader.js +6 -1
  211. package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
  212. package/Source/Scene/Model/GeoJsonLoader.js +53 -61
  213. package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
  214. package/Source/Scene/Model/I3dmLoader.js +232 -240
  215. package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
  216. package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
  217. package/Source/Scene/Model/Model.js +1 -1
  218. package/Source/Scene/Model/PntsLoader.js +78 -89
  219. package/Source/Scene/ModelComponents.js +10 -0
  220. package/Source/Scene/Panorama.js +53 -0
  221. package/Source/Scene/PanoramaProvider.js +43 -0
  222. package/Source/Scene/ParticleSystem.js +2 -2
  223. package/Source/Scene/PointPrimitive.js +1 -1
  224. package/Source/Scene/PointPrimitiveCollection.js +14 -22
  225. package/Source/Scene/Polyline.js +0 -1
  226. package/Source/Scene/PolylineCollection.js +1 -4
  227. package/Source/Scene/PolylineColorAppearance.js +1 -6
  228. package/Source/Scene/PolylineMaterialAppearance.js +1 -6
  229. package/Source/Scene/PostProcessStageCollection.js +1 -1
  230. package/Source/Scene/PropertyTable.js +43 -0
  231. package/Source/Scene/PropertyTexture.js +1 -1
  232. package/Source/Scene/PropertyTextureProperty.js +0 -97
  233. package/Source/Scene/QuadtreePrimitive.js +6 -3
  234. package/Source/Scene/ResourceLoader.js +84 -92
  235. package/Source/Scene/Scene.js +12 -0
  236. package/Source/Scene/ShadowMap.js +1 -2
  237. package/Source/Scene/SkyBox.js +29 -164
  238. package/Source/Scene/StructuralMetadata.js +18 -3
  239. package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
  240. package/Source/Scene/Vector3DTilePolylines.js +1 -5
  241. package/Source/Scene/VoxelPrimitive.js +16 -33
  242. package/Source/Scene/VoxelRenderResources.js +1 -8
  243. package/Source/Scene/VoxelTraversal.js +16 -61
  244. package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
  245. package/Source/Scene/createElevationBandMaterial.js +1 -1
  246. package/Source/Scene/parseStructuralMetadata.js +244 -0
  247. package/Source/Scene/processVoxelProperties.js +1 -1
  248. package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
  249. package/Source/Shaders/BillboardCollectionFS.js +67 -40
  250. package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
  251. package/Source/Shaders/BillboardCollectionVS.js +22 -31
  252. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  253. package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
  254. package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
  255. package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
  256. package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
  257. package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
  258. package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
  259. package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
  260. package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
  261. package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
  262. package/Source/Shaders/Model/MetadataStageFS.js +2 -1
  263. package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
  264. package/Source/Shaders/Model/MetadataStageVS.js +2 -1
  265. package/Source/Shaders/Model/ModelFS.glsl +9 -1
  266. package/Source/Shaders/Model/ModelFS.js +9 -1
  267. package/Source/Shaders/Model/ModelVS.glsl +4 -2
  268. package/Source/Shaders/Model/ModelVS.js +4 -2
  269. package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
  270. package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
  271. package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
  272. package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
  273. package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
  274. package/Source/Shaders/Voxels/Megatexture.js +15 -83
  275. package/Source/Shaders/Voxels/Octree.glsl +6 -9
  276. package/Source/Shaders/Voxels/Octree.js +6 -9
  277. package/Source/Widget/CesiumWidget.js +1 -1
  278. package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
  279. package/index.d.ts +582 -193
  280. package/index.js +91 -83
  281. package/package.json +2 -1
  282. package/Build/Workers/chunk-ZGWX2R5I.js +0 -1443
@@ -173,120 +173,115 @@ const GltfLoaderState = {
173
173
  * Implements the {@link ResourceLoader} interface.
174
174
  * </p>
175
175
  *
176
- * @alias GltfLoader
177
- * @constructor
178
- * @augments ResourceLoader
179
- *
180
- * @param {object} options Object with the following properties:
181
- * @param {Resource} options.gltfResource The {@link Resource} containing the glTF. This is often the path of the .gltf or .glb file, but may also be the path of the .b3dm, .i3dm, or .cmpt file containing the embedded glb. .cmpt resources should have a URI fragment indicating the index of the inner content to which the glb belongs in order to individually identify the glb in the cache, e.g. http://example.com/tile.cmpt#index=2.
182
- * @param {Resource} [options.baseResource] The {@link Resource} that paths in the glTF JSON are relative to.
183
- * @param {Uint8Array} [options.typedArray] The typed array containing the glTF contents, e.g. from a .b3dm, .i3dm, or .cmpt file.
184
- * @param {object} [options.gltfJson] A parsed glTF JSON file instead of passing it in as a typed array.
185
- * @param {boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
186
- * @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.
187
- * @param {boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the glTF is loaded.
188
- * @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
189
- * @param {Axis} [options.forwardAxis=Axis.Z] The forward-axis of the glTF model.
190
- * @param {boolean} [options.loadAttributesAsTypedArray=false] Load all attributes and indices as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
191
- * @param {boolean} [options.loadAttributesFor2D=false] If <code>true</code>, load the positions buffer and any instanced attribute buffers as typed arrays for accurately projecting models to 2D.
192
- * @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.
193
- * @param {boolean} [options.loadIndicesForWireframe=false] If <code>true</code>, load the index buffer as both a buffer and typed array. The latter is useful for creating wireframe indices in WebGL1.
194
- * @param {boolean} [options.loadPrimitiveOutline=true] If <code>true</code>, 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.
195
- * @param {boolean} [options.loadForClassification=false] If <code>true</code> and if the model has feature IDs, load the feature IDs and indices as typed arrays. This is useful for batching features for classification.
196
- * @param {boolean} [options.renameBatchIdSemantic=false] If <code>true</code>, rename _BATCHID or BATCHID to _FEATURE_ID_0. This is used for .b3dm models
197
176
  * @private
198
177
  */
199
- function GltfLoader(options) {
200
- options = options ?? Frozen.EMPTY_OBJECT;
201
- const {
202
- gltfResource,
203
- typedArray,
204
- releaseGltfJson = false,
205
- asynchronous = true,
206
- incrementallyLoadTextures = true,
207
- upAxis = Axis.Y,
208
- forwardAxis = Axis.Z,
209
- loadAttributesAsTypedArray = false,
210
- loadAttributesFor2D = false,
211
- enablePick = false,
212
- loadIndicesForWireframe = false,
213
- loadPrimitiveOutline = true,
214
- loadForClassification = false,
215
- renameBatchIdSemantic = false,
216
- } = options;
217
-
218
- //>>includeStart('debug', pragmas.debug);
219
- Check.typeOf.object("options.gltfResource", gltfResource);
220
- //>>includeEnd('debug');
221
-
222
- const { baseResource = gltfResource.clone() } = options;
223
-
224
- this._gltfJson = options.gltfJson;
225
- this._gltfResource = gltfResource;
226
- this._baseResource = baseResource;
227
- this._typedArray = typedArray;
228
- this._releaseGltfJson = releaseGltfJson;
229
- this._asynchronous = asynchronous;
230
- this._incrementallyLoadTextures = incrementallyLoadTextures;
231
- this._upAxis = upAxis;
232
- this._forwardAxis = forwardAxis;
233
- this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
234
- this._loadAttributesFor2D = loadAttributesFor2D;
235
- this._enablePick = enablePick;
236
- this._loadIndicesForWireframe = loadIndicesForWireframe;
237
- this._loadPrimitiveOutline = loadPrimitiveOutline;
238
- this._loadForClassification = loadForClassification;
239
- this._renameBatchIdSemantic = renameBatchIdSemantic;
240
-
241
- // When loading EXT_feature_metadata, the feature tables and textures
242
- // are now stored as arrays like the newer EXT_structural_metadata extension.
243
- // This requires sorting the dictionary keys for a consistent ordering.
244
- this._sortedPropertyTableIds = undefined;
245
- this._sortedFeatureTextureIds = undefined;
246
-
247
- this._gltfJsonLoader = undefined;
248
- this._state = GltfLoaderState.NOT_LOADED;
249
- this._textureState = GltfLoaderState.NOT_LOADED;
250
- this._promise = undefined;
251
- this._processError = undefined;
252
- this._textureErrors = [];
253
-
254
- // Information about whether to load primitives as typed arrays or buffers,
255
- // and whether post-processing is needed after loading (e.g. for
256
- // generating outlines)
257
- this._primitiveLoadPlans = [];
258
-
259
- // Loaders that need to be processed before the glTF becomes ready
260
- this._loaderPromises = [];
261
- this._textureLoaders = [];
262
- this._texturesPromises = [];
263
- this._textureCallbacks = [];
264
- this._bufferViewLoaders = [];
265
- this._geometryLoaders = [];
266
- this._geometryCallbacks = [];
267
- this._structuralMetadataLoader = undefined;
268
- this._meshPrimitiveGpmLoader = undefined;
269
- this._loadResourcesPromise = undefined;
270
- this._resourcesLoaded = false;
271
- this._texturesLoaded = false;
272
-
273
- this._supportedImageFormats = undefined;
274
-
275
- // In some cases where geometry post-processing is needed (like generating
276
- // outlines) new attributes are added that may have GPU resources attached.
277
- // The GltfLoader will own the resources and store them here.
278
- this._postProcessBuffers = [];
279
-
280
- // Loaded results
281
- this._components = undefined;
282
- }
283
-
284
- if (defined(Object.create)) {
285
- GltfLoader.prototype = Object.create(ResourceLoader.prototype);
286
- GltfLoader.prototype.constructor = GltfLoader;
287
- }
288
-
289
- Object.defineProperties(GltfLoader.prototype, {
178
+ class GltfLoader extends ResourceLoader {
179
+ /**
180
+ * @param {object} options Object with the following properties:
181
+ * @param {Resource} options.gltfResource The {@link Resource} containing the glTF. This is often the path of the .gltf or .glb file, but may also be the path of the .b3dm, .i3dm, or .cmpt file containing the embedded glb. .cmpt resources should have a URI fragment indicating the index of the inner content to which the glb belongs in order to individually identify the glb in the cache, e.g. http://example.com/tile.cmpt#index=2.
182
+ * @param {Resource} [options.baseResource] The {@link Resource} that paths in the glTF JSON are relative to.
183
+ * @param {Uint8Array} [options.typedArray] The typed array containing the glTF contents, e.g. from a .b3dm, .i3dm, or .cmpt file.
184
+ * @param {object} [options.gltfJson] A parsed glTF JSON file instead of passing it in as a typed array.
185
+ * @param {boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
186
+ * @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.
187
+ * @param {boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the glTF is loaded.
188
+ * @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
189
+ * @param {Axis} [options.forwardAxis=Axis.Z] The forward-axis of the glTF model.
190
+ * @param {boolean} [options.loadAttributesAsTypedArray=false] Load all attributes and indices as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
191
+ * @param {boolean} [options.loadAttributesFor2D=false] If <code>true</code>, load the positions buffer and any instanced attribute buffers as typed arrays for accurately projecting models to 2D.
192
+ * @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.
193
+ * @param {boolean} [options.loadIndicesForWireframe=false] If <code>true</code>, load the index buffer as both a buffer and typed array. The latter is useful for creating wireframe indices in WebGL1.
194
+ * @param {boolean} [options.loadPrimitiveOutline=true] If <code>true</code>, 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.
195
+ * @param {boolean} [options.loadForClassification=false] If <code>true</code> and if the model has feature IDs, load the feature IDs and indices as typed arrays. This is useful for batching features for classification.
196
+ * @param {boolean} [options.renameBatchIdSemantic=false] If <code>true</code>, rename _BATCHID or BATCHID to _FEATURE_ID_0. This is used for .b3dm models
197
+ */
198
+ constructor(options) {
199
+ super();
200
+
201
+ options = options ?? Frozen.EMPTY_OBJECT;
202
+ const {
203
+ gltfResource,
204
+ typedArray,
205
+ releaseGltfJson = false,
206
+ asynchronous = true,
207
+ incrementallyLoadTextures = true,
208
+ upAxis = Axis.Y,
209
+ forwardAxis = Axis.Z,
210
+ loadAttributesAsTypedArray = false,
211
+ loadAttributesFor2D = false,
212
+ enablePick = false,
213
+ loadIndicesForWireframe = false,
214
+ loadPrimitiveOutline = true,
215
+ loadForClassification = false,
216
+ renameBatchIdSemantic = false,
217
+ } = options;
218
+
219
+ //>>includeStart('debug', pragmas.debug);
220
+ Check.typeOf.object("options.gltfResource", gltfResource);
221
+ //>>includeEnd('debug');
222
+
223
+ const { baseResource = gltfResource.clone() } = options;
224
+
225
+ this._gltfJson = options.gltfJson;
226
+ this._gltfResource = gltfResource;
227
+ this._baseResource = baseResource;
228
+ this._typedArray = typedArray;
229
+ this._releaseGltfJson = releaseGltfJson;
230
+ this._asynchronous = asynchronous;
231
+ this._incrementallyLoadTextures = incrementallyLoadTextures;
232
+ this._upAxis = upAxis;
233
+ this._forwardAxis = forwardAxis;
234
+ this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
235
+ this._loadAttributesFor2D = loadAttributesFor2D;
236
+ this._enablePick = enablePick;
237
+ this._loadIndicesForWireframe = loadIndicesForWireframe;
238
+ this._loadPrimitiveOutline = loadPrimitiveOutline;
239
+ this._loadForClassification = loadForClassification;
240
+ this._renameBatchIdSemantic = renameBatchIdSemantic;
241
+
242
+ // When loading EXT_feature_metadata, the feature tables and textures
243
+ // are now stored as arrays like the newer EXT_structural_metadata extension.
244
+ // This requires sorting the dictionary keys for a consistent ordering.
245
+ this._sortedPropertyTableIds = undefined;
246
+ this._sortedFeatureTextureIds = undefined;
247
+
248
+ this._gltfJsonLoader = undefined;
249
+ this._state = GltfLoaderState.NOT_LOADED;
250
+ this._textureState = GltfLoaderState.NOT_LOADED;
251
+ this._promise = undefined;
252
+ this._processError = undefined;
253
+ this._textureErrors = [];
254
+
255
+ // Information about whether to load primitives as typed arrays or buffers,
256
+ // and whether post-processing is needed after loading (e.g. for
257
+ // generating outlines)
258
+ this._primitiveLoadPlans = [];
259
+
260
+ // Loaders that need to be processed before the glTF becomes ready
261
+ this._loaderPromises = [];
262
+ this._textureLoaders = [];
263
+ this._texturesPromises = [];
264
+ this._textureCallbacks = [];
265
+ this._bufferViewLoaders = [];
266
+ this._geometryLoaders = [];
267
+ this._geometryCallbacks = [];
268
+ this._structuralMetadataLoader = undefined;
269
+ this._meshPrimitiveGpmLoader = undefined;
270
+ this._loadResourcesPromise = undefined;
271
+ this._resourcesLoaded = false;
272
+ this._texturesLoaded = false;
273
+
274
+ this._supportedImageFormats = undefined;
275
+
276
+ // In some cases where geometry post-processing is needed (like generating
277
+ // outlines) new attributes are added that may have GPU resources attached.
278
+ // The GltfLoader will own the resources and store them here.
279
+ this._postProcessBuffers = [];
280
+
281
+ // Loaded results
282
+ this._components = undefined;
283
+ }
284
+
290
285
  /**
291
286
  * The cache key of the resource.
292
287
  *
@@ -296,11 +291,10 @@ Object.defineProperties(GltfLoader.prototype, {
296
291
  * @readonly
297
292
  * @private
298
293
  */
299
- cacheKey: {
300
- get: function () {
301
- return undefined;
302
- },
303
- },
294
+ get cacheKey() {
295
+ return undefined;
296
+ }
297
+
304
298
  /**
305
299
  * The loaded components.
306
300
  *
@@ -310,11 +304,10 @@ Object.defineProperties(GltfLoader.prototype, {
310
304
  * @readonly
311
305
  * @private
312
306
  */
313
- components: {
314
- get: function () {
315
- return this._components;
316
- },
317
- },
307
+ get components() {
308
+ return this._components;
309
+ }
310
+
318
311
  /**
319
312
  * The loaded glTF json.
320
313
  *
@@ -324,14 +317,13 @@ Object.defineProperties(GltfLoader.prototype, {
324
317
  * @readonly
325
318
  * @private
326
319
  */
327
- gltfJson: {
328
- get: function () {
329
- if (defined(this._gltfJsonLoader)) {
330
- return this._gltfJsonLoader.gltf;
331
- }
332
- return this._gltfJson;
333
- },
334
- },
320
+ get gltfJson() {
321
+ if (defined(this._gltfJsonLoader)) {
322
+ return this._gltfJsonLoader.gltf;
323
+ }
324
+ return this._gltfJson;
325
+ }
326
+
335
327
  /**
336
328
  * Returns true if textures are loaded separately from the other glTF resources.
337
329
  *
@@ -341,11 +333,10 @@ Object.defineProperties(GltfLoader.prototype, {
341
333
  * @readonly
342
334
  * @private
343
335
  */
344
- incrementallyLoadTextures: {
345
- get: function () {
346
- return this._incrementallyLoadTextures;
347
- },
348
- },
336
+ get incrementallyLoadTextures() {
337
+ return this._incrementallyLoadTextures;
338
+ }
339
+
349
340
  /**
350
341
  * true if textures are loaded, useful when incrementallyLoadTextures is true
351
342
  *
@@ -355,12 +346,193 @@ Object.defineProperties(GltfLoader.prototype, {
355
346
  * @readonly
356
347
  * @private
357
348
  */
358
- texturesLoaded: {
359
- get: function () {
360
- return this._texturesLoaded;
361
- },
362
- },
363
- });
349
+ get texturesLoaded() {
350
+ return this._texturesLoaded;
351
+ }
352
+
353
+ /**
354
+ * Loads the resource.
355
+ * @returns {Promise.<GltfLoader>} A promise which resolves to the loader when the resource loading is completed.
356
+ * @exception {RuntimeError} Unsupported glTF version
357
+ * @exception {RuntimeError} Unsupported glTF Extension
358
+ * @private
359
+ */
360
+ async load() {
361
+ if (defined(this._promise)) {
362
+ return this._promise;
363
+ }
364
+
365
+ this._promise = loadGltfJson(this);
366
+ return this._promise;
367
+ }
368
+
369
+ /**
370
+ * Process loaders other than textures
371
+ * @private
372
+ */
373
+ _process(frameState) {
374
+ if (this._state === GltfLoaderState.READY) {
375
+ return true;
376
+ }
377
+
378
+ if (this._state === GltfLoaderState.PROCESSING) {
379
+ processLoaders(this, frameState);
380
+ }
381
+
382
+ if (
383
+ this._resourcesLoaded &&
384
+ this._state === GltfLoaderState.POST_PROCESSING
385
+ ) {
386
+ postProcessGeometry(this, frameState.context);
387
+ this._state = GltfLoaderState.PROCESSED;
388
+ }
389
+
390
+ if (this._resourcesLoaded && this._state === GltfLoaderState.PROCESSED) {
391
+ // The buffer views can be unloaded once the data is copied.
392
+ unloadBufferViewLoaders(this);
393
+
394
+ // Similarly, if the glTF was loaded from a typed array, release the memory
395
+ this._typedArray = undefined;
396
+
397
+ this._state = GltfLoaderState.READY;
398
+ return true;
399
+ }
400
+
401
+ return false;
402
+ }
403
+
404
+ /**
405
+ * Process textures other than textures
406
+ * @private
407
+ */
408
+ _processTextures(frameState) {
409
+ if (this._textureState === GltfLoaderState.READY) {
410
+ return true;
411
+ }
412
+
413
+ if (this._textureState !== GltfLoaderState.PROCESSING) {
414
+ return false;
415
+ }
416
+
417
+ let ready = true;
418
+ const textureLoaders = this._textureLoaders;
419
+ for (let i = 0; i < textureLoaders.length; ++i) {
420
+ const textureReady = textureLoaders[i].process(frameState);
421
+ if (textureReady && defined(this._textureCallbacks[i])) {
422
+ this._textureCallbacks[i]();
423
+ this._textureCallbacks[i] = undefined;
424
+ }
425
+
426
+ ready = ready && textureReady;
427
+ }
428
+
429
+ if (!ready) {
430
+ return false;
431
+ }
432
+
433
+ this._textureState = GltfLoaderState.READY;
434
+ this._texturesLoaded = true;
435
+ return true;
436
+ }
437
+
438
+ /**
439
+ * Processes the resource until it becomes ready.
440
+ *
441
+ * @param {FrameState} frameState The frame state.
442
+ * @private
443
+ */
444
+ process(frameState) {
445
+ //>>includeStart('debug', pragmas.debug);
446
+ Check.typeOf.object("frameState", frameState);
447
+ //>>includeEnd('debug');
448
+
449
+ if (
450
+ this._state === GltfLoaderState.LOADED &&
451
+ !defined(this._loadResourcesPromise)
452
+ ) {
453
+ this._loadResourcesPromise = loadResources(this, frameState)
454
+ .then(() => {
455
+ this._resourcesLoaded = true;
456
+ })
457
+ .catch((error) => {
458
+ this._processError = error;
459
+ });
460
+ }
461
+
462
+ if (defined(this._processError)) {
463
+ this._state = GltfLoaderState.FAILED;
464
+ const error = this._processError;
465
+ this._processError = undefined;
466
+ handleError(this, error);
467
+ }
468
+
469
+ // Pop the next error of the list in case there are multiple
470
+ const textureError = this._textureErrors.pop();
471
+ if (defined(textureError)) {
472
+ // There shouldn't be the need to completely unload in this case. Just throw the error.
473
+ const error = this.getError("Failed to load glTF texture", textureError);
474
+ error.name = "TextureError";
475
+ throw error;
476
+ }
477
+
478
+ if (this._state === GltfLoaderState.FAILED) {
479
+ return false;
480
+ }
481
+
482
+ let ready = false;
483
+ try {
484
+ ready = this._process(frameState);
485
+ } catch (error) {
486
+ this._state = GltfLoaderState.FAILED;
487
+ handleError(this, error);
488
+ }
489
+
490
+ // Since textures can be loaded independently and are handled through a separate promise, they are processed in their own function
491
+ let texturesReady = false;
492
+ try {
493
+ texturesReady = this._processTextures(frameState);
494
+ } catch (error) {
495
+ this._textureState = GltfLoaderState.FAILED;
496
+ handleError(this, error);
497
+ }
498
+
499
+ if (this._incrementallyLoadTextures) {
500
+ return ready;
501
+ }
502
+
503
+ return ready && texturesReady;
504
+ }
505
+
506
+ /**
507
+ * Returns whether the resource has been unloaded.
508
+ * @private
509
+ */
510
+ isUnloaded() {
511
+ return this._state === GltfLoaderState.UNLOADED;
512
+ }
513
+
514
+ /**
515
+ * Unloads the resource.
516
+ * @private
517
+ */
518
+ unload() {
519
+ if (defined(this._gltfJsonLoader) && !this._gltfJsonLoader.isDestroyed()) {
520
+ ResourceCache.unload(this._gltfJsonLoader);
521
+ }
522
+ this._gltfJsonLoader = undefined;
523
+
524
+ unloadTextures(this);
525
+ unloadBufferViewLoaders(this);
526
+ unloadGeometry(this);
527
+ unloadGeneratedAttributes(this);
528
+ unloadStructuralMetadata(this);
529
+ unloadMeshPrimitiveGpm(this);
530
+
531
+ this._components = undefined;
532
+ this._typedArray = undefined;
533
+ this._state = GltfLoaderState.UNLOADED;
534
+ }
535
+ }
364
536
 
365
537
  /**
366
538
  * Loads the gltf object
@@ -433,22 +605,6 @@ async function loadResources(loader, frameState) {
433
605
  return promise;
434
606
  }
435
607
 
436
- /**
437
- * Loads the resource.
438
- * @returns {Promise.<GltfLoader>} A promise which resolves to the loader when the resource loading is completed.
439
- * @exception {RuntimeError} Unsupported glTF version
440
- * @exception {RuntimeError} Unsupported glTF Extension
441
- * @private
442
- */
443
- GltfLoader.prototype.load = async function () {
444
- if (defined(this._promise)) {
445
- return this._promise;
446
- }
447
-
448
- this._promise = loadGltfJson(this);
449
- return this._promise;
450
- };
451
-
452
608
  function handleError(gltfLoader, error) {
453
609
  gltfLoader.unload();
454
610
  const errorMessage = "Failed to load glTF";
@@ -545,143 +701,6 @@ function gatherPostProcessBuffers(loader, primitiveLoadPlan) {
545
701
  }
546
702
  }
547
703
 
548
- /**
549
- * Process loaders other than textures
550
- * @private
551
- */
552
- GltfLoader.prototype._process = function (frameState) {
553
- if (this._state === GltfLoaderState.READY) {
554
- return true;
555
- }
556
-
557
- if (this._state === GltfLoaderState.PROCESSING) {
558
- processLoaders(this, frameState);
559
- }
560
-
561
- if (
562
- this._resourcesLoaded &&
563
- this._state === GltfLoaderState.POST_PROCESSING
564
- ) {
565
- postProcessGeometry(this, frameState.context);
566
- this._state = GltfLoaderState.PROCESSED;
567
- }
568
-
569
- if (this._resourcesLoaded && this._state === GltfLoaderState.PROCESSED) {
570
- // The buffer views can be unloaded once the data is copied.
571
- unloadBufferViewLoaders(this);
572
-
573
- // Similarly, if the glTF was loaded from a typed array, release the memory
574
- this._typedArray = undefined;
575
-
576
- this._state = GltfLoaderState.READY;
577
- return true;
578
- }
579
-
580
- return false;
581
- };
582
-
583
- /**
584
- * Process textures other than textures
585
- * @private
586
- */
587
- GltfLoader.prototype._processTextures = function (frameState) {
588
- if (this._textureState === GltfLoaderState.READY) {
589
- return true;
590
- }
591
-
592
- if (this._textureState !== GltfLoaderState.PROCESSING) {
593
- return false;
594
- }
595
-
596
- let ready = true;
597
- const textureLoaders = this._textureLoaders;
598
- for (let i = 0; i < textureLoaders.length; ++i) {
599
- const textureReady = textureLoaders[i].process(frameState);
600
- if (textureReady && defined(this._textureCallbacks[i])) {
601
- this._textureCallbacks[i]();
602
- this._textureCallbacks[i] = undefined;
603
- }
604
-
605
- ready = ready && textureReady;
606
- }
607
-
608
- if (!ready) {
609
- return false;
610
- }
611
-
612
- this._textureState = GltfLoaderState.READY;
613
- this._texturesLoaded = true;
614
- return true;
615
- };
616
-
617
- /**
618
- * Processes the resource until it becomes ready.
619
- *
620
- * @param {FrameState} frameState The frame state.
621
- * @private
622
- */
623
- GltfLoader.prototype.process = function (frameState) {
624
- //>>includeStart('debug', pragmas.debug);
625
- Check.typeOf.object("frameState", frameState);
626
- //>>includeEnd('debug');
627
-
628
- if (
629
- this._state === GltfLoaderState.LOADED &&
630
- !defined(this._loadResourcesPromise)
631
- ) {
632
- this._loadResourcesPromise = loadResources(this, frameState)
633
- .then(() => {
634
- this._resourcesLoaded = true;
635
- })
636
- .catch((error) => {
637
- this._processError = error;
638
- });
639
- }
640
-
641
- if (defined(this._processError)) {
642
- this._state = GltfLoaderState.FAILED;
643
- const error = this._processError;
644
- this._processError = undefined;
645
- handleError(this, error);
646
- }
647
-
648
- // Pop the next error of the list in case there are multiple
649
- const textureError = this._textureErrors.pop();
650
- if (defined(textureError)) {
651
- // There shouldn't be the need to completely unload in this case. Just throw the error.
652
- const error = this.getError("Failed to load glTF texture", textureError);
653
- error.name = "TextureError";
654
- throw error;
655
- }
656
-
657
- if (this._state === GltfLoaderState.FAILED) {
658
- return false;
659
- }
660
-
661
- let ready = false;
662
- try {
663
- ready = this._process(frameState);
664
- } catch (error) {
665
- this._state = GltfLoaderState.FAILED;
666
- handleError(this, error);
667
- }
668
-
669
- // Since textures can be loaded independently and are handled through a separate promise, they are processed in their own function
670
- let texturesReady = false;
671
- try {
672
- texturesReady = this._processTextures(frameState);
673
- } catch (error) {
674
- this._textureState = GltfLoaderState.FAILED;
675
- handleError(this, error);
676
- }
677
-
678
- if (this._incrementallyLoadTextures) {
679
- return ready;
680
- }
681
-
682
- return ready && texturesReady;
683
- };
684
-
685
704
  function getVertexBufferLoader(
686
705
  loader,
687
706
  accessorId,
@@ -1811,6 +1830,16 @@ function loadMaterial(loader, gltfMaterial, frameState) {
1811
1830
  material.alphaCutoff = gltfMaterial.alphaCutoff;
1812
1831
  material.doubleSided = gltfMaterial.doubleSided;
1813
1832
 
1833
+ // BENTLEY_materials_point_style extension
1834
+ const pointStyleExtension = extensions.BENTLEY_materials_point_style;
1835
+ if (defined(pointStyleExtension) && defined(pointStyleExtension.diameter)) {
1836
+ const diameter = pointStyleExtension.diameter;
1837
+ // The spec requires a positive integer, but we floor non-integers as a best effort.
1838
+ if (diameter >= 1) {
1839
+ material.pointDiameter = Math.floor(diameter);
1840
+ }
1841
+ }
1842
+
1814
1843
  return material;
1815
1844
  }
1816
1845
 
@@ -2956,34 +2985,4 @@ function unloadMeshPrimitiveGpm(loader) {
2956
2985
  }
2957
2986
  }
2958
2987
 
2959
- /**
2960
- * Returns whether the resource has been unloaded.
2961
- * @private
2962
- */
2963
- GltfLoader.prototype.isUnloaded = function () {
2964
- return this._state === GltfLoaderState.UNLOADED;
2965
- };
2966
-
2967
- /**
2968
- * Unloads the resource.
2969
- * @private
2970
- */
2971
- GltfLoader.prototype.unload = function () {
2972
- if (defined(this._gltfJsonLoader) && !this._gltfJsonLoader.isDestroyed()) {
2973
- ResourceCache.unload(this._gltfJsonLoader);
2974
- }
2975
- this._gltfJsonLoader = undefined;
2976
-
2977
- unloadTextures(this);
2978
- unloadBufferViewLoaders(this);
2979
- unloadGeometry(this);
2980
- unloadGeneratedAttributes(this);
2981
- unloadStructuralMetadata(this);
2982
- unloadMeshPrimitiveGpm(this);
2983
-
2984
- this._components = undefined;
2985
- this._typedArray = undefined;
2986
- this._state = GltfLoaderState.UNLOADED;
2987
- };
2988
-
2989
2988
  export default GltfLoader;