@cesium/engine 24.0.0 → 26.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 (362) hide show
  1. package/Build/Workers/{chunk-6WLHJFD3.js → chunk-3VFEWOBI.js} +59 -32
  2. package/Build/Workers/{chunk-UQU4RXLT.js → chunk-424RNO3D.js} +50 -45
  3. package/Build/Workers/chunk-4MGMYHOO.js +147 -0
  4. package/Build/Workers/{chunk-AMIHNSST.js → chunk-4S7IE3LB.js} +2 -2
  5. package/Build/Workers/{chunk-J6AW5YHS.js → chunk-52JDLOEM.js} +14 -14
  6. package/Build/Workers/{chunk-6RMS4S72.js → chunk-54I6Y66F.js} +6 -6
  7. package/Build/Workers/{chunk-C6P4IG5P.js → chunk-6YEE6JDR.js} +6 -6
  8. package/Build/Workers/{chunk-72VYSVEW.js → chunk-7J2HKPRH.js} +11 -10
  9. package/Build/Workers/{chunk-7O5XJTVE.js → chunk-7WM2PX4V.js} +5 -5
  10. package/Build/Workers/{chunk-5A2SW66E.js → chunk-ACXQXN46.js} +16 -16
  11. package/Build/Workers/{chunk-VLDEUTOP.js → chunk-AYKR4VBR.js} +2 -2
  12. package/Build/Workers/{chunk-YQFTYQMZ.js → chunk-C6J67V5A.js} +3 -2
  13. package/Build/Workers/{chunk-D4EJ2NXG.js → chunk-C6KNZ7T4.js} +17 -17
  14. package/Build/Workers/{chunk-7MDYBRYJ.js → chunk-CFQP6LYM.js} +4 -4
  15. package/Build/Workers/{chunk-YAOZMOFL.js → chunk-CXOYE2WM.js} +5 -5
  16. package/Build/Workers/{chunk-B6SCUUFP.js → chunk-CZEYZU4N.js} +10 -10
  17. package/Build/Workers/{chunk-NPF7SSHZ.js → chunk-DBOEKL43.js} +7 -7
  18. package/Build/Workers/{chunk-44EMEGKW.js → chunk-DDWSZVMY.js} +5 -5
  19. package/Build/Workers/{chunk-7X322WP2.js → chunk-DOBXCNC3.js} +13 -13
  20. package/Build/Workers/{chunk-JCI63T3K.js → chunk-E7VQ76KE.js} +6 -6
  21. package/Build/Workers/{chunk-7TYLCBGK.js → chunk-EBSIOBXY.js} +12 -10
  22. package/Build/Workers/{chunk-GQUNK2XC.js → chunk-EF2QYXGA.js} +14 -14
  23. package/Build/Workers/{chunk-BJD6QGXZ.js → chunk-EPYXRCDB.js} +12 -12
  24. package/Build/Workers/{chunk-63SIWPLS.js → chunk-F6QDY6HU.js} +13 -13
  25. package/Build/Workers/{chunk-XY6HMDGI.js → chunk-FRQZECAO.js} +5 -5
  26. package/Build/Workers/{chunk-VMVOUQ5J.js → chunk-G7PXZRVF.js} +7 -7
  27. package/Build/Workers/{chunk-N65BAKSH.js → chunk-INUEEEQA.js} +8 -8
  28. package/Build/Workers/{chunk-7QRFIKWQ.js → chunk-IRBKFCEJ.js} +2 -2
  29. package/Build/Workers/{chunk-UIGVOKKI.js → chunk-IYOUHCZB.js} +3 -2
  30. package/Build/Workers/{chunk-5GXYJQ2K.js → chunk-J6BWOHUF.js} +3 -3
  31. package/Build/Workers/{chunk-A47HVBC5.js → chunk-KFSTQKNM.js} +7 -7
  32. package/Build/Workers/{chunk-EV3VGO6Y.js → chunk-KKOSKAZB.js} +17 -17
  33. package/Build/Workers/{chunk-6MPGQEHA.js → chunk-KSSWJIZW.js} +2 -2
  34. package/Build/Workers/{chunk-DHKPFLSJ.js → chunk-M3B5JKSM.js} +3 -2
  35. package/Build/Workers/chunk-MPZHGZU6.js +2342 -0
  36. package/Build/Workers/{chunk-YJZGW74L.js → chunk-MYP774IS.js} +2213 -1349
  37. package/Build/Workers/{chunk-LIB2H534.js → chunk-O3EA5HS7.js} +12 -11
  38. package/Build/Workers/{chunk-ILMFADZA.js → chunk-P3CK7MCY.js} +27 -5
  39. package/Build/Workers/chunk-Q3PY526V.js +3201 -0
  40. package/Build/Workers/chunk-QN67VG36.js +973 -0
  41. package/Build/Workers/{chunk-XJRBB253.js → chunk-QRWGUWI6.js} +11 -11
  42. package/Build/Workers/{chunk-AF3MU2RL.js → chunk-S4MCOY6I.js} +7 -6
  43. package/Build/Workers/{chunk-Y7HNNPNK.js → chunk-SMQZZOW6.js} +10 -10
  44. package/Build/Workers/{chunk-PVV64VFW.js → chunk-TKKIREQ6.js} +3 -2
  45. package/Build/Workers/{chunk-MKM27KGV.js → chunk-U3ZA64U7.js} +2 -2
  46. package/Build/Workers/{chunk-2N4KDHS3.js → chunk-UA25D5MX.js} +12 -11
  47. package/Build/Workers/{chunk-RQNJD3O4.js → chunk-UOOIQ3KX.js} +12 -12
  48. package/Build/Workers/{chunk-GOQBUCXH.js → chunk-V7VQKN6N.js} +709 -431
  49. package/Build/Workers/{chunk-LXMCPFFS.js → chunk-VQYETPWC.js} +4 -4
  50. package/Build/Workers/{chunk-NKT5K3K3.js → chunk-VWV2IJRB.js} +13 -12
  51. package/Build/Workers/chunk-XZMBNNDX.js +1287 -0
  52. package/Build/Workers/{chunk-ISY4EZCA.js → chunk-Y57HREW5.js} +4 -4
  53. package/Build/Workers/{chunk-EDXL4W76.js → chunk-Y5BF6AFU.js} +2 -2
  54. package/Build/Workers/{chunk-Q3C6VQH6.js → chunk-YLY7NKAB.js} +4 -4
  55. package/Build/Workers/{chunk-4TIG36AW.js → chunk-ZK3CF7ZD.js} +12 -12
  56. package/Build/Workers/{chunk-AJLTU6PF.js → chunk-ZP7JMQV4.js} +4 -1
  57. package/Build/Workers/{chunk-HXJMS2ZI.js → chunk-ZZ46LWL6.js} +1 -1
  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 +175 -118
  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 +24 -23
  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 +12 -9
  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/ArcType.js +6 -1
  112. package/Source/Core/ArticulationStageType.js +5 -1
  113. package/Source/Core/AssociativeArray.js +100 -94
  114. package/Source/Core/BoundingSphere.js +1296 -1300
  115. package/Source/Core/Cartesian2.js +1 -1
  116. package/Source/Core/Cartesian3.js +2 -3
  117. package/Source/Core/Cartesian4.js +1 -1
  118. package/Source/Core/Cartographic.js +257 -249
  119. package/Source/Core/ClockRange.js +6 -1
  120. package/Source/Core/ClockStep.js +6 -1
  121. package/Source/Core/Color.js +844 -835
  122. package/Source/Core/ComponentDatatype.js +39 -1
  123. package/Source/Core/CornerType.js +6 -1
  124. package/Source/Core/Credit.js +121 -124
  125. package/Source/Core/Ellipsoid.js +637 -660
  126. package/Source/Core/ExtrapolationType.js +6 -1
  127. package/Source/Core/GeocodeType.js +6 -1
  128. package/Source/Core/GeographicProjection.js +74 -74
  129. package/Source/Core/GeographicTilingScheme.js +179 -198
  130. package/Source/Core/GeometryOffsetAttribute.js +7 -1
  131. package/Source/Core/GeometryType.js +7 -1
  132. package/Source/Core/HeightmapEncoding.js +6 -1
  133. package/Source/Core/Iau2006XysData.js +24 -13
  134. package/Source/Core/IndexDatatype.js +3 -1
  135. package/Source/Core/InterpolationType.js +5 -1
  136. package/Source/Core/Intersect.js +6 -1
  137. package/Source/Core/Ion.js +1 -1
  138. package/Source/Core/IonGeocodeProviderType.js +5 -1
  139. package/Source/Core/JulianDate.js +850 -848
  140. package/Source/Core/KeyboardEventModifier.js +6 -1
  141. package/Source/Core/MapProjection.js +40 -44
  142. package/Source/Core/Matrix2.js +906 -893
  143. package/Source/Core/Matrix3.js +1643 -1575
  144. package/Source/Core/Matrix4.js +2903 -2872
  145. package/Source/Core/PixelFormat.js +3 -1
  146. package/Source/Core/PrimitiveType.js +11 -1
  147. package/Source/Core/Ray.js +62 -60
  148. package/Source/Core/Rectangle.js +913 -904
  149. package/Source/Core/ReferenceFrame.js +6 -1
  150. package/Source/Core/RequestScheduler.js +8 -3
  151. package/Source/Core/RequestState.js +6 -1
  152. package/Source/Core/RequestType.js +6 -1
  153. package/Source/Core/Resource.js +1 -1
  154. package/Source/Core/ScreenSpaceEventHandler.js +51 -41
  155. package/Source/Core/ScreenSpaceEventType.js +6 -1
  156. package/Source/Core/TerrainQuantization.js +6 -1
  157. package/Source/Core/TilingScheme.js +100 -98
  158. package/Source/Core/TimeConstants.js +6 -1
  159. package/Source/Core/TimeStandard.js +6 -1
  160. package/Source/Core/TrackingReferenceFrame.js +6 -1
  161. package/Source/Core/Visibility.js +6 -1
  162. package/Source/Core/VulkanConstants.js +6 -1
  163. package/Source/Core/WebGLConstants.js +6 -1
  164. package/Source/Core/WebMercatorProjection.js +108 -109
  165. package/Source/Core/WebMercatorTilingScheme.js +246 -242
  166. package/Source/Core/WindingOrder.js +3 -1
  167. package/Source/Core/createColorRamp.js +37 -0
  168. package/Source/Core/globalTypes.js +25 -0
  169. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +1 -0
  170. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +1 -0
  171. package/Source/DataSources/StripeOrientation.js +6 -1
  172. package/Source/Renderer/BufferUsage.js +20 -9
  173. package/Source/Renderer/Context.js +2 -29
  174. package/Source/Renderer/DrawCommand.js +435 -403
  175. package/Source/Renderer/MipmapHint.js +5 -1
  176. package/Source/Renderer/Pass.js +10 -3
  177. package/Source/Renderer/PickId.js +44 -0
  178. package/Source/Renderer/PixelDatatype.js +3 -1
  179. package/Source/Renderer/RenderbufferFormat.js +5 -1
  180. package/Source/Renderer/ShaderDestination.js +4 -1
  181. package/Source/Renderer/TextureMagnificationFilter.js +3 -1
  182. package/Source/Renderer/TextureMinificationFilter.js +3 -1
  183. package/Source/Renderer/TextureWrap.js +5 -1
  184. package/Source/Renderer/createUniform.js +346 -239
  185. package/Source/Renderer/createUniformArray.js +494 -381
  186. package/Source/Scene/AlphaMode.js +5 -1
  187. package/Source/Scene/ArcGisBaseMapType.js +6 -1
  188. package/Source/Scene/ArcGisMapService.js +1 -1
  189. package/Source/Scene/AttributeType.js +3 -1
  190. package/Source/Scene/Axis.js +3 -1
  191. package/Source/Scene/BingMapsStyle.js +6 -1
  192. package/Source/Scene/BlendEquation.js +6 -1
  193. package/Source/Scene/BlendFunction.js +6 -1
  194. package/Source/Scene/BlendOption.js +6 -1
  195. package/Source/Scene/BlendingState.js +6 -1
  196. package/Source/Scene/BufferLoader.js +0 -2
  197. package/Source/Scene/BufferPoint.js +1 -0
  198. package/Source/Scene/BufferPointCollection.js +17 -1
  199. package/Source/Scene/BufferPolygon.js +3 -2
  200. package/Source/Scene/BufferPolygonCollection.js +13 -1
  201. package/Source/Scene/BufferPolyline.js +1 -0
  202. package/Source/Scene/BufferPolylineCollection.js +5 -1
  203. package/Source/Scene/BufferPrimitiveCollection.js +210 -43
  204. package/Source/Scene/CameraEventAggregator.js +30 -18
  205. package/Source/Scene/CameraEventType.js +6 -1
  206. package/Source/Scene/Cesium3DTile.js +54 -1
  207. package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
  208. package/Source/Scene/Cesium3DTileContent.js +195 -254
  209. package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
  210. package/Source/Scene/Cesium3DTileContentState.js +6 -1
  211. package/Source/Scene/Cesium3DTileContentType.js +3 -1
  212. package/Source/Scene/Cesium3DTileFeature.js +289 -306
  213. package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
  214. package/Source/Scene/Cesium3DTilePass.js +5 -1
  215. package/Source/Scene/Cesium3DTilePointFeature.js +433 -511
  216. package/Source/Scene/Cesium3DTileRefine.js +6 -1
  217. package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
  218. package/Source/Scene/Cesium3DTileset.js +46 -6
  219. package/Source/Scene/ClassificationType.js +3 -1
  220. package/Source/Scene/CloudType.js +3 -1
  221. package/Source/Scene/ColorBlendMode.js +4 -1
  222. package/Source/Scene/Composite3DTileContent.js +254 -292
  223. package/Source/Scene/CullFace.js +6 -1
  224. package/Source/Scene/DepthFunction.js +6 -1
  225. package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
  226. package/Source/Scene/EdgeDisplayMode.js +50 -0
  227. package/Source/Scene/Empty3DTileContent.js +100 -132
  228. package/Source/Scene/EquirectangularPanorama.js +1 -0
  229. package/Source/Scene/ExpressionNodeType.js +6 -1
  230. package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
  231. package/Source/Scene/GeoJsonPrimitive.js +874 -0
  232. package/Source/Scene/Geometry3DTileContent.js +151 -185
  233. package/Source/Scene/GltfBufferViewLoader.js +0 -2
  234. package/Source/Scene/GltfDracoLoader.js +0 -2
  235. package/Source/Scene/GltfImageLoader.js +0 -3
  236. package/Source/Scene/GltfIndexBufferLoader.js +0 -4
  237. package/Source/Scene/GltfJsonLoader.js +0 -2
  238. package/Source/Scene/GltfLoader.js +109 -5
  239. package/Source/Scene/GltfLoaderUtil.js +14 -0
  240. package/Source/Scene/GltfSpzLoader.js +0 -2
  241. package/Source/Scene/GltfStructuralMetadataLoader.js +0 -2
  242. package/Source/Scene/GltfTextureLoader.js +0 -2
  243. package/Source/Scene/GltfVertexBufferLoader.js +0 -4
  244. package/Source/Scene/HeightReference.js +5 -1
  245. package/Source/Scene/HorizontalOrigin.js +6 -1
  246. package/Source/Scene/ImageryProvider.js +1 -1
  247. package/Source/Scene/ImageryState.js +6 -1
  248. package/Source/Scene/Implicit3DTileContent.js +179 -214
  249. package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
  250. package/Source/Scene/InstanceAttributeSemantic.js +3 -1
  251. package/Source/Scene/IonWorldImageryStyle.js +6 -1
  252. package/Source/Scene/JobType.js +6 -1
  253. package/Source/Scene/LabelStyle.js +6 -1
  254. package/Source/Scene/MVTDataProvider.js +147 -0
  255. package/Source/Scene/MapMode2D.js +6 -1
  256. package/Source/Scene/MetadataComponentType.js +3 -1
  257. package/Source/Scene/MetadataSchemaLoader.js +0 -2
  258. package/Source/Scene/MetadataSemantic.js +6 -2
  259. package/Source/Scene/MetadataType.js +3 -1
  260. package/Source/Scene/Model/B3dmLoader.js +0 -3
  261. package/Source/Scene/Model/CustomShaderMode.js +3 -1
  262. package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
  263. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +78 -337
  264. package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
  265. package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
  266. package/Source/Scene/Model/GeoJsonLoader.js +0 -2
  267. package/Source/Scene/Model/I3dmLoader.js +0 -3
  268. package/Source/Scene/Model/InstancingPipelineStage.js +1 -1
  269. package/Source/Scene/Model/LightingModel.js +5 -1
  270. package/Source/Scene/Model/MaterialPipelineStage.js +184 -3
  271. package/Source/Scene/Model/Model.js +34 -0
  272. package/Source/Scene/Model/Model3DTileContent.js +424 -458
  273. package/Source/Scene/Model/ModelDrawCommand.js +31 -3
  274. package/Source/Scene/Model/ModelReader.js +474 -3
  275. package/Source/Scene/Model/ModelRuntimePrimitive.js +2 -1
  276. package/Source/Scene/Model/ModelType.js +3 -1
  277. package/Source/Scene/Model/ModelUtility.js +4 -0
  278. package/Source/Scene/Model/PntsLoader.js +4 -3
  279. package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
  280. package/Source/Scene/Model/UniformType.js +5 -1
  281. package/Source/Scene/Model/VaryingType.js +5 -1
  282. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +500 -139
  283. package/Source/Scene/Model/pickModel.js +94 -299
  284. package/Source/Scene/ModelAnimationLoop.js +6 -1
  285. package/Source/Scene/ModelAnimationState.js +6 -1
  286. package/Source/Scene/ModelComponents.js +47 -2
  287. package/Source/Scene/Multiple3DTileContent.js +291 -334
  288. package/Source/Scene/PrimitiveState.js +7 -1
  289. package/Source/Scene/QuadtreeOccluders.js +20 -15
  290. package/Source/Scene/QuadtreeTile.js +547 -541
  291. package/Source/Scene/QuadtreeTileLoadState.js +6 -1
  292. package/Source/Scene/QuadtreeTileProvider.js +159 -175
  293. package/Source/Scene/ResourceLoader.js +0 -1
  294. package/Source/Scene/ResourceLoaderState.js +7 -1
  295. package/Source/Scene/Scene.js +26 -0
  296. package/Source/Scene/SceneMode.js +4 -1
  297. package/Source/Scene/ShadowMode.js +3 -1
  298. package/Source/Scene/SkyBox.js +1 -1
  299. package/Source/Scene/SplitDirection.js +6 -1
  300. package/Source/Scene/StencilFunction.js +6 -1
  301. package/Source/Scene/StencilOperation.js +6 -1
  302. package/Source/Scene/TerrainState.js +7 -1
  303. package/Source/Scene/TileState.js +7 -1
  304. package/Source/Scene/Tileset3DTileContent.js +113 -146
  305. package/Source/Scene/Tonemapper.js +5 -1
  306. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
  307. package/Source/Scene/Vector3DTileContent.js +205 -234
  308. package/Source/Scene/VectorGltf3DTileContent.js +131 -61
  309. package/Source/Scene/VertexAttributeSemantic.js +3 -1
  310. package/Source/Scene/VerticalOrigin.js +6 -1
  311. package/Source/Scene/VoxelBoxShape.js +12 -6
  312. package/Source/Scene/VoxelContent.js +2 -0
  313. package/Source/Scene/VoxelCylinderShape.js +39 -38
  314. package/Source/Scene/VoxelEllipsoidShape.js +46 -96
  315. package/Source/Scene/VoxelMetadataOrder.js +6 -1
  316. package/Source/Scene/VoxelPrimitive.js +159 -175
  317. package/Source/Scene/VoxelProvider.js +64 -90
  318. package/Source/Scene/VoxelShapeType.js +3 -1
  319. package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
  320. package/Source/Scene/buildVoxelCustomShader.js +199 -0
  321. package/Source/Scene/decodeMVT.js +634 -0
  322. package/Source/Scene/renderBufferPointCollection.js +124 -127
  323. package/Source/Scene/renderBufferPolygonCollection.js +122 -122
  324. package/Source/Scene/renderBufferPolylineCollection.js +386 -238
  325. package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
  326. package/Source/Shaders/BufferPointMaterialFS.js +1 -0
  327. package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
  328. package/Source/Shaders/BufferPointMaterialVS.js +20 -10
  329. package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
  330. package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
  331. package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
  332. package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
  333. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
  334. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
  335. package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
  336. package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
  337. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  338. package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
  339. package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
  340. package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
  341. package/Source/Shaders/Model/ConstantLodStageFS.js +62 -0
  342. package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
  343. package/Source/Shaders/Model/ConstantLodStageVS.js +13 -0
  344. package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
  345. package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
  346. package/Source/Shaders/Model/MaterialStageFS.glsl +46 -20
  347. package/Source/Shaders/Model/MaterialStageFS.js +46 -20
  348. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +0 -1
  349. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +0 -1
  350. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +7 -9
  351. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +7 -9
  352. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +7 -17
  353. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +7 -17
  354. package/Source/Widget/CesiumWidget.js +11 -4
  355. package/index.d.ts +595 -343
  356. package/index.js +392 -378
  357. package/package.json +3 -3
  358. package/Build/Workers/chunk-DVB56LG7.js +0 -114
  359. package/Build/Workers/chunk-HKUES6UG.js +0 -2357
  360. package/Build/Workers/chunk-HRHRYFHS.js +0 -940
  361. package/Build/Workers/chunk-KLPGTXS3.js +0 -642
  362. package/Build/Workers/chunk-ZBZRTRJB.js +0 -1829
@@ -1,2357 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.140.0
5
- *
6
- * Copyright 2011-2022 Cesium Contributors
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- *
20
- * Columbus View (Pat. Pend.)
21
- *
22
- * Portions licensed separately.
23
- * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
- */
25
-
26
- import {
27
- RuntimeError_default
28
- } from "./chunk-EDXL4W76.js";
29
- import {
30
- Cartesian3_default,
31
- Frozen_default,
32
- Matrix3_default
33
- } from "./chunk-ZBZRTRJB.js";
34
- import {
35
- Math_default
36
- } from "./chunk-5GXYJQ2K.js";
37
- import {
38
- Check_default,
39
- DeveloperError_default
40
- } from "./chunk-VLDEUTOP.js";
41
- import {
42
- defined_default
43
- } from "./chunk-AJLTU6PF.js";
44
-
45
- // packages/engine/Source/Core/Cartesian4.js
46
- var Cartesian4 = class _Cartesian4 {
47
- /**
48
- * @param {number} [x=0.0] The X component.
49
- * @param {number} [y=0.0] The Y component.
50
- * @param {number} [z=0.0] The Z component.
51
- * @param {number} [w=0.0] The W component.
52
- */
53
- constructor(x, y, z, w) {
54
- this.x = x ?? 0;
55
- this.y = y ?? 0;
56
- this.z = z ?? 0;
57
- this.w = w ?? 0;
58
- }
59
- /**
60
- * Creates a Cartesian4 instance from x, y, z and w coordinates.
61
- *
62
- * @param {number} x The x coordinate.
63
- * @param {number} y The y coordinate.
64
- * @param {number} z The z coordinate.
65
- * @param {number} w The w coordinate.
66
- * @param {Cartesian4} [result] The object onto which to store the result.
67
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
68
- */
69
- static fromElements(x, y, z, w, result) {
70
- if (!defined_default(result)) {
71
- return new _Cartesian4(x, y, z, w);
72
- }
73
- result.x = x;
74
- result.y = y;
75
- result.z = z;
76
- result.w = w;
77
- return result;
78
- }
79
- /**
80
- * Creates a Cartesian4 instance from a {@link Color}. <code>red</code>, <code>green</code>, <code>blue</code>,
81
- * and <code>alpha</code> map to <code>x</code>, <code>y</code>, <code>z</code>, and <code>w</code>, respectively.
82
- *
83
- * @param {Color} color The source color.
84
- * @param {Cartesian4} [result] The object onto which to store the result.
85
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
86
- */
87
- static fromColor(color, result) {
88
- Check_default.typeOf.object("color", color);
89
- if (!defined_default(result)) {
90
- return new _Cartesian4(color.red, color.green, color.blue, color.alpha);
91
- }
92
- result.x = color.red;
93
- result.y = color.green;
94
- result.z = color.blue;
95
- result.w = color.alpha;
96
- return result;
97
- }
98
- /**
99
- * Duplicates a Cartesian4 instance.
100
- *
101
- * @param {Cartesian4} cartesian The Cartesian to duplicate.
102
- * @param {Cartesian4} [result] The object onto which to store the result.
103
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)
104
- */
105
- static clone(cartesian, result) {
106
- if (!defined_default(cartesian)) {
107
- return void 0;
108
- }
109
- if (!defined_default(result)) {
110
- return new _Cartesian4(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
111
- }
112
- result.x = cartesian.x;
113
- result.y = cartesian.y;
114
- result.z = cartesian.z;
115
- result.w = cartesian.w;
116
- return result;
117
- }
118
- /**
119
- * Stores the provided instance into the provided array.
120
- *
121
- * @param {Cartesian4} value The value to pack.
122
- * @param {number[]} array The array to pack into.
123
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
124
- *
125
- * @returns {number[]} The array that was packed into
126
- */
127
- static pack(value, array, startingIndex) {
128
- Check_default.typeOf.object("value", value);
129
- Check_default.defined("array", array);
130
- startingIndex = startingIndex ?? 0;
131
- array[startingIndex++] = value.x;
132
- array[startingIndex++] = value.y;
133
- array[startingIndex++] = value.z;
134
- array[startingIndex] = value.w;
135
- return array;
136
- }
137
- /**
138
- * Retrieves an instance from a packed array.
139
- *
140
- * @param {number[]} array The packed array.
141
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
142
- * @param {Cartesian4} [result] The object into which to store the result.
143
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
144
- */
145
- static unpack(array, startingIndex, result) {
146
- Check_default.defined("array", array);
147
- startingIndex = startingIndex ?? 0;
148
- if (!defined_default(result)) {
149
- result = new _Cartesian4();
150
- }
151
- result.x = array[startingIndex++];
152
- result.y = array[startingIndex++];
153
- result.z = array[startingIndex++];
154
- result.w = array[startingIndex];
155
- return result;
156
- }
157
- /**
158
- * Flattens an array of Cartesian4s into an array of components.
159
- *
160
- * @param {Cartesian4[]} array The array of cartesians to pack.
161
- * @param {number[]} [result] The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
162
- * @returns {number[]} The packed array.
163
- */
164
- static packArray(array, result) {
165
- Check_default.defined("array", array);
166
- const length = array.length;
167
- const resultLength = length * 4;
168
- if (!defined_default(result)) {
169
- result = new Array(resultLength);
170
- } else if (!Array.isArray(result) && result.length !== resultLength) {
171
- throw new DeveloperError_default(
172
- "If result is a typed array, it must have exactly array.length * 4 elements"
173
- );
174
- } else if (result.length !== resultLength) {
175
- result.length = resultLength;
176
- }
177
- for (let i = 0; i < length; ++i) {
178
- _Cartesian4.pack(array[i], result, i * 4);
179
- }
180
- return result;
181
- }
182
- /**
183
- * Unpacks an array of cartesian components into an array of Cartesian4s.
184
- *
185
- * @param {number[]} array The array of components to unpack.
186
- * @param {Cartesian4[]} [result] The array onto which to store the result.
187
- * @returns {Cartesian4[]} The unpacked array.
188
- */
189
- static unpackArray(array, result) {
190
- Check_default.defined("array", array);
191
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
192
- if (array.length % 4 !== 0) {
193
- throw new DeveloperError_default("array length must be a multiple of 4.");
194
- }
195
- const length = array.length;
196
- if (!defined_default(result)) {
197
- result = new Array(length / 4);
198
- } else {
199
- result.length = length / 4;
200
- }
201
- for (let i = 0; i < length; i += 4) {
202
- const index = i / 4;
203
- result[index] = _Cartesian4.unpack(array, i, result[index]);
204
- }
205
- return result;
206
- }
207
- /**
208
- * Computes the value of the maximum component for the supplied Cartesian.
209
- *
210
- * @param {Cartesian4} cartesian The cartesian to use.
211
- * @returns {number} The value of the maximum component.
212
- */
213
- static maximumComponent(cartesian) {
214
- Check_default.typeOf.object("cartesian", cartesian);
215
- return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
216
- }
217
- /**
218
- * Computes the value of the minimum component for the supplied Cartesian.
219
- *
220
- * @param {Cartesian4} cartesian The cartesian to use.
221
- * @returns {number} The value of the minimum component.
222
- */
223
- static minimumComponent(cartesian) {
224
- Check_default.typeOf.object("cartesian", cartesian);
225
- return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
226
- }
227
- /**
228
- * Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
229
- *
230
- * @param {Cartesian4} first A cartesian to compare.
231
- * @param {Cartesian4} second A cartesian to compare.
232
- * @param {Cartesian4} result The object into which to store the result.
233
- * @returns {Cartesian4} A cartesian with the minimum components.
234
- */
235
- static minimumByComponent(first, second, result) {
236
- Check_default.typeOf.object("first", first);
237
- Check_default.typeOf.object("second", second);
238
- Check_default.typeOf.object("result", result);
239
- result.x = Math.min(first.x, second.x);
240
- result.y = Math.min(first.y, second.y);
241
- result.z = Math.min(first.z, second.z);
242
- result.w = Math.min(first.w, second.w);
243
- return result;
244
- }
245
- /**
246
- * Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
247
- *
248
- * @param {Cartesian4} first A cartesian to compare.
249
- * @param {Cartesian4} second A cartesian to compare.
250
- * @param {Cartesian4} result The object into which to store the result.
251
- * @returns {Cartesian4} A cartesian with the maximum components.
252
- */
253
- static maximumByComponent(first, second, result) {
254
- Check_default.typeOf.object("first", first);
255
- Check_default.typeOf.object("second", second);
256
- Check_default.typeOf.object("result", result);
257
- result.x = Math.max(first.x, second.x);
258
- result.y = Math.max(first.y, second.y);
259
- result.z = Math.max(first.z, second.z);
260
- result.w = Math.max(first.w, second.w);
261
- return result;
262
- }
263
- /**
264
- * Constrain a value to lie between two values.
265
- *
266
- * @param {Cartesian4} value The value to clamp.
267
- * @param {Cartesian4} min The minimum bound.
268
- * @param {Cartesian4} max The maximum bound.
269
- * @param {Cartesian4} result The object into which to store the result.
270
- * @returns {Cartesian4} The clamped value such that min <= result <= max.
271
- */
272
- static clamp(value, min, max, result) {
273
- Check_default.typeOf.object("value", value);
274
- Check_default.typeOf.object("min", min);
275
- Check_default.typeOf.object("max", max);
276
- Check_default.typeOf.object("result", result);
277
- const x = Math_default.clamp(value.x, min.x, max.x);
278
- const y = Math_default.clamp(value.y, min.y, max.y);
279
- const z = Math_default.clamp(value.z, min.z, max.z);
280
- const w = Math_default.clamp(value.w, min.w, max.w);
281
- result.x = x;
282
- result.y = y;
283
- result.z = z;
284
- result.w = w;
285
- return result;
286
- }
287
- /**
288
- * Computes the provided Cartesian's squared magnitude.
289
- *
290
- * @param {Cartesian4} cartesian The Cartesian instance whose squared magnitude is to be computed.
291
- * @returns {number} The squared magnitude.
292
- */
293
- static magnitudeSquared(cartesian) {
294
- Check_default.typeOf.object("cartesian", cartesian);
295
- return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w;
296
- }
297
- /**
298
- * Computes the Cartesian's magnitude (length).
299
- *
300
- * @param {Cartesian4} cartesian The Cartesian instance whose magnitude is to be computed.
301
- * @returns {number} The magnitude.
302
- */
303
- static magnitude(cartesian) {
304
- return Math.sqrt(_Cartesian4.magnitudeSquared(cartesian));
305
- }
306
- /**
307
- * Computes the 4-space distance between two points.
308
- *
309
- * @param {Cartesian4} left The first point to compute the distance from.
310
- * @param {Cartesian4} right The second point to compute the distance to.
311
- * @returns {number} The distance between two points.
312
- *
313
- * @example
314
- * // Returns 1.0
315
- * const d = Cesium.Cartesian4.distance(
316
- * new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
317
- * new Cesium.Cartesian4(2.0, 0.0, 0.0, 0.0));
318
- */
319
- static distance(left, right) {
320
- Check_default.typeOf.object("left", left);
321
- Check_default.typeOf.object("right", right);
322
- _Cartesian4.subtract(left, right, distanceScratch);
323
- return _Cartesian4.magnitude(distanceScratch);
324
- }
325
- /**
326
- * Computes the squared distance between two points. Comparing squared distances
327
- * using this function is more efficient than comparing distances using {@link Cartesian4#distance}.
328
- *
329
- * @param {Cartesian4} left The first point to compute the distance from.
330
- * @param {Cartesian4} right The second point to compute the distance to.
331
- * @returns {number} The distance between two points.
332
- *
333
- * @example
334
- * // Returns 4.0, not 2.0
335
- * const d = Cesium.Cartesian4.distance(
336
- * new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
337
- * new Cesium.Cartesian4(3.0, 0.0, 0.0, 0.0));
338
- */
339
- static distanceSquared(left, right) {
340
- Check_default.typeOf.object("left", left);
341
- Check_default.typeOf.object("right", right);
342
- _Cartesian4.subtract(left, right, distanceScratch);
343
- return _Cartesian4.magnitudeSquared(distanceScratch);
344
- }
345
- /**
346
- * Computes the normalized form of the supplied Cartesian.
347
- *
348
- * @param {Cartesian4} cartesian The Cartesian to be normalized.
349
- * @param {Cartesian4} result The object onto which to store the result.
350
- * @returns {Cartesian4} The modified result parameter.
351
- */
352
- static normalize(cartesian, result) {
353
- Check_default.typeOf.object("cartesian", cartesian);
354
- Check_default.typeOf.object("result", result);
355
- const magnitude = _Cartesian4.magnitude(cartesian);
356
- result.x = cartesian.x / magnitude;
357
- result.y = cartesian.y / magnitude;
358
- result.z = cartesian.z / magnitude;
359
- result.w = cartesian.w / magnitude;
360
- if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z) || isNaN(result.w)) {
361
- throw new DeveloperError_default("normalized result is not a number");
362
- }
363
- return result;
364
- }
365
- /**
366
- * Computes the dot (scalar) product of two Cartesians.
367
- *
368
- * @param {Cartesian4} left The first Cartesian.
369
- * @param {Cartesian4} right The second Cartesian.
370
- * @returns {number} The dot product.
371
- */
372
- static dot(left, right) {
373
- Check_default.typeOf.object("left", left);
374
- Check_default.typeOf.object("right", right);
375
- return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
376
- }
377
- /**
378
- * Computes the componentwise product of two Cartesians.
379
- *
380
- * @param {Cartesian4} left The first Cartesian.
381
- * @param {Cartesian4} right The second Cartesian.
382
- * @param {Cartesian4} result The object onto which to store the result.
383
- * @returns {Cartesian4} The modified result parameter.
384
- */
385
- static multiplyComponents(left, right, result) {
386
- Check_default.typeOf.object("left", left);
387
- Check_default.typeOf.object("right", right);
388
- Check_default.typeOf.object("result", result);
389
- result.x = left.x * right.x;
390
- result.y = left.y * right.y;
391
- result.z = left.z * right.z;
392
- result.w = left.w * right.w;
393
- return result;
394
- }
395
- /**
396
- * Computes the componentwise quotient of two Cartesians.
397
- *
398
- * @param {Cartesian4} left The first Cartesian.
399
- * @param {Cartesian4} right The second Cartesian.
400
- * @param {Cartesian4} result The object onto which to store the result.
401
- * @returns {Cartesian4} The modified result parameter.
402
- */
403
- static divideComponents(left, right, result) {
404
- Check_default.typeOf.object("left", left);
405
- Check_default.typeOf.object("right", right);
406
- Check_default.typeOf.object("result", result);
407
- result.x = left.x / right.x;
408
- result.y = left.y / right.y;
409
- result.z = left.z / right.z;
410
- result.w = left.w / right.w;
411
- return result;
412
- }
413
- /**
414
- * Computes the componentwise sum of two Cartesians.
415
- *
416
- * @param {Cartesian4} left The first Cartesian.
417
- * @param {Cartesian4} right The second Cartesian.
418
- * @param {Cartesian4} result The object onto which to store the result.
419
- * @returns {Cartesian4} The modified result parameter.
420
- */
421
- static add(left, right, result) {
422
- Check_default.typeOf.object("left", left);
423
- Check_default.typeOf.object("right", right);
424
- Check_default.typeOf.object("result", result);
425
- result.x = left.x + right.x;
426
- result.y = left.y + right.y;
427
- result.z = left.z + right.z;
428
- result.w = left.w + right.w;
429
- return result;
430
- }
431
- /**
432
- * Computes the componentwise difference of two Cartesians.
433
- *
434
- * @param {Cartesian4} left The first Cartesian.
435
- * @param {Cartesian4} right The second Cartesian.
436
- * @param {Cartesian4} result The object onto which to store the result.
437
- * @returns {Cartesian4} The modified result parameter.
438
- */
439
- static subtract(left, right, result) {
440
- Check_default.typeOf.object("left", left);
441
- Check_default.typeOf.object("right", right);
442
- Check_default.typeOf.object("result", result);
443
- result.x = left.x - right.x;
444
- result.y = left.y - right.y;
445
- result.z = left.z - right.z;
446
- result.w = left.w - right.w;
447
- return result;
448
- }
449
- /**
450
- * Multiplies the provided Cartesian componentwise by the provided scalar.
451
- *
452
- * @param {Cartesian4} cartesian The Cartesian to be scaled.
453
- * @param {number} scalar The scalar to multiply with.
454
- * @param {Cartesian4} result The object onto which to store the result.
455
- * @returns {Cartesian4} The modified result parameter.
456
- */
457
- static multiplyByScalar(cartesian, scalar, result) {
458
- Check_default.typeOf.object("cartesian", cartesian);
459
- Check_default.typeOf.number("scalar", scalar);
460
- Check_default.typeOf.object("result", result);
461
- result.x = cartesian.x * scalar;
462
- result.y = cartesian.y * scalar;
463
- result.z = cartesian.z * scalar;
464
- result.w = cartesian.w * scalar;
465
- return result;
466
- }
467
- /**
468
- * Divides the provided Cartesian componentwise by the provided scalar.
469
- *
470
- * @param {Cartesian4} cartesian The Cartesian to be divided.
471
- * @param {number} scalar The scalar to divide by.
472
- * @param {Cartesian4} result The object onto which to store the result.
473
- * @returns {Cartesian4} The modified result parameter.
474
- */
475
- static divideByScalar(cartesian, scalar, result) {
476
- Check_default.typeOf.object("cartesian", cartesian);
477
- Check_default.typeOf.number("scalar", scalar);
478
- Check_default.typeOf.object("result", result);
479
- result.x = cartesian.x / scalar;
480
- result.y = cartesian.y / scalar;
481
- result.z = cartesian.z / scalar;
482
- result.w = cartesian.w / scalar;
483
- return result;
484
- }
485
- /**
486
- * Negates the provided Cartesian.
487
- *
488
- * @param {Cartesian4} cartesian The Cartesian to be negated.
489
- * @param {Cartesian4} result The object onto which to store the result.
490
- * @returns {Cartesian4} The modified result parameter.
491
- */
492
- static negate(cartesian, result) {
493
- Check_default.typeOf.object("cartesian", cartesian);
494
- Check_default.typeOf.object("result", result);
495
- result.x = -cartesian.x;
496
- result.y = -cartesian.y;
497
- result.z = -cartesian.z;
498
- result.w = -cartesian.w;
499
- return result;
500
- }
501
- /**
502
- * Computes the absolute value of the provided Cartesian.
503
- *
504
- * @param {Cartesian4} cartesian The Cartesian whose absolute value is to be computed.
505
- * @param {Cartesian4} result The object onto which to store the result.
506
- * @returns {Cartesian4} The modified result parameter.
507
- */
508
- static abs(cartesian, result) {
509
- Check_default.typeOf.object("cartesian", cartesian);
510
- Check_default.typeOf.object("result", result);
511
- result.x = Math.abs(cartesian.x);
512
- result.y = Math.abs(cartesian.y);
513
- result.z = Math.abs(cartesian.z);
514
- result.w = Math.abs(cartesian.w);
515
- return result;
516
- }
517
- /**
518
- * Computes the linear interpolation or extrapolation at t using the provided cartesians.
519
- *
520
- * @param {Cartesian4} start The value corresponding to t at 0.0.
521
- * @param {Cartesian4}end The value corresponding to t at 1.0.
522
- * @param {number} t The point along t at which to interpolate.
523
- * @param {Cartesian4} result The object onto which to store the result.
524
- * @returns {Cartesian4} The modified result parameter.
525
- */
526
- static lerp(start, end, t, result) {
527
- Check_default.typeOf.object("start", start);
528
- Check_default.typeOf.object("end", end);
529
- Check_default.typeOf.number("t", t);
530
- Check_default.typeOf.object("result", result);
531
- _Cartesian4.multiplyByScalar(end, t, lerpScratch);
532
- result = _Cartesian4.multiplyByScalar(start, 1 - t, result);
533
- return _Cartesian4.add(lerpScratch, result, result);
534
- }
535
- /**
536
- * Returns the axis that is most orthogonal to the provided Cartesian.
537
- *
538
- * @param {Cartesian4} cartesian The Cartesian on which to find the most orthogonal axis.
539
- * @param {Cartesian4} result The object onto which to store the result.
540
- * @returns {Cartesian4} The most orthogonal axis.
541
- */
542
- static mostOrthogonalAxis(cartesian, result) {
543
- Check_default.typeOf.object("cartesian", cartesian);
544
- Check_default.typeOf.object("result", result);
545
- const f = _Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch);
546
- _Cartesian4.abs(f, f);
547
- if (f.x <= f.y) {
548
- if (f.x <= f.z) {
549
- if (f.x <= f.w) {
550
- result = _Cartesian4.clone(_Cartesian4.UNIT_X, result);
551
- } else {
552
- result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
553
- }
554
- } else if (f.z <= f.w) {
555
- result = _Cartesian4.clone(_Cartesian4.UNIT_Z, result);
556
- } else {
557
- result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
558
- }
559
- } else if (f.y <= f.z) {
560
- if (f.y <= f.w) {
561
- result = _Cartesian4.clone(_Cartesian4.UNIT_Y, result);
562
- } else {
563
- result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
564
- }
565
- } else if (f.z <= f.w) {
566
- result = _Cartesian4.clone(_Cartesian4.UNIT_Z, result);
567
- } else {
568
- result = _Cartesian4.clone(_Cartesian4.UNIT_W, result);
569
- }
570
- return result;
571
- }
572
- /**
573
- * Compares the provided Cartesians componentwise and returns
574
- * <code>true</code> if they are equal, <code>false</code> otherwise.
575
- *
576
- * @param {Cartesian4} [left] The first Cartesian.
577
- * @param {Cartesian4} [right] The second Cartesian.
578
- * @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
579
- */
580
- static equals(left, right) {
581
- return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z && left.w === right.w;
582
- }
583
- /**
584
- * @param {Cartesian4} cartesian
585
- * @param {number[]} array
586
- * @param {number} offset
587
- * @private
588
- */
589
- static equalsArray(cartesian, array, offset) {
590
- return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2] && cartesian.w === array[offset + 3];
591
- }
592
- /**
593
- * Compares the provided Cartesians componentwise and returns
594
- * <code>true</code> if they pass an absolute or relative tolerance test,
595
- * <code>false</code> otherwise.
596
- *
597
- * @param {Cartesian4} [left] The first Cartesian.
598
- * @param {Cartesian4} [right] The second Cartesian.
599
- * @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
600
- * @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
601
- * @returns {boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
602
- */
603
- static equalsEpsilon(left, right, relativeEpsilon, absoluteEpsilon) {
604
- return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
605
- left.x,
606
- right.x,
607
- relativeEpsilon,
608
- absoluteEpsilon
609
- ) && Math_default.equalsEpsilon(
610
- left.y,
611
- right.y,
612
- relativeEpsilon,
613
- absoluteEpsilon
614
- ) && Math_default.equalsEpsilon(
615
- left.z,
616
- right.z,
617
- relativeEpsilon,
618
- absoluteEpsilon
619
- ) && Math_default.equalsEpsilon(
620
- left.w,
621
- right.w,
622
- relativeEpsilon,
623
- absoluteEpsilon
624
- );
625
- }
626
- /**
627
- * Duplicates this Cartesian4 instance.
628
- *
629
- * @param {Cartesian4} [result] The object onto which to store the result.
630
- * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
631
- */
632
- clone(result) {
633
- return _Cartesian4.clone(this, result);
634
- }
635
- /**
636
- * Compares this Cartesian against the provided Cartesian componentwise and returns
637
- * <code>true</code> if they are equal, <code>false</code> otherwise.
638
- *
639
- * @param {Cartesian4} [right] The right hand side Cartesian.
640
- * @returns {boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
641
- */
642
- equals(right) {
643
- return _Cartesian4.equals(this, right);
644
- }
645
- /**
646
- * Compares this Cartesian against the provided Cartesian componentwise and returns
647
- * <code>true</code> if they pass an absolute or relative tolerance test,
648
- * <code>false</code> otherwise.
649
- *
650
- * @param {Cartesian4} [right] The right hand side Cartesian.
651
- * @param {number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing.
652
- * @param {number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing.
653
- * @returns {boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
654
- */
655
- equalsEpsilon(right, relativeEpsilon, absoluteEpsilon) {
656
- return _Cartesian4.equalsEpsilon(
657
- this,
658
- right,
659
- relativeEpsilon,
660
- absoluteEpsilon
661
- );
662
- }
663
- /**
664
- * Creates a string representing this Cartesian in the format '(x, y, z, w)'.
665
- *
666
- * @returns {string} A string representing the provided Cartesian in the format '(x, y, z, w)'.
667
- */
668
- toString() {
669
- return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
670
- }
671
- /**
672
- * Packs an arbitrary floating point value to 4 values representable using uint8.
673
- *
674
- * @param {number} value A floating point number.
675
- * @param {Cartesian4} [result] The Cartesian4 that will contain the packed float.
676
- * @returns {Cartesian4} A Cartesian4 representing the float packed to values in x, y, z, and w.
677
- */
678
- static packFloat(value, result) {
679
- Check_default.typeOf.number("value", value);
680
- if (!defined_default(result)) {
681
- result = new _Cartesian4();
682
- }
683
- scratchF32Array[0] = value;
684
- if (littleEndian) {
685
- result.x = scratchU8Array[0];
686
- result.y = scratchU8Array[1];
687
- result.z = scratchU8Array[2];
688
- result.w = scratchU8Array[3];
689
- } else {
690
- result.x = scratchU8Array[3];
691
- result.y = scratchU8Array[2];
692
- result.z = scratchU8Array[1];
693
- result.w = scratchU8Array[0];
694
- }
695
- return result;
696
- }
697
- /**
698
- * Unpacks a float packed using Cartesian4.packFloat.
699
- *
700
- * @param {Cartesian4} packedFloat A Cartesian4 containing a float packed to 4 values representable using uint8.
701
- * @returns {number} The unpacked float.
702
- * @private
703
- */
704
- static unpackFloat(packedFloat) {
705
- Check_default.typeOf.object("packedFloat", packedFloat);
706
- if (littleEndian) {
707
- scratchU8Array[0] = packedFloat.x;
708
- scratchU8Array[1] = packedFloat.y;
709
- scratchU8Array[2] = packedFloat.z;
710
- scratchU8Array[3] = packedFloat.w;
711
- } else {
712
- scratchU8Array[0] = packedFloat.w;
713
- scratchU8Array[1] = packedFloat.z;
714
- scratchU8Array[2] = packedFloat.y;
715
- scratchU8Array[3] = packedFloat.x;
716
- }
717
- return scratchF32Array[0];
718
- }
719
- };
720
- Cartesian4.packedLength = 4;
721
- Cartesian4.fromArray = Cartesian4.unpack;
722
- var distanceScratch = new Cartesian4();
723
- var lerpScratch = new Cartesian4();
724
- var mostOrthogonalAxisScratch = new Cartesian4();
725
- Cartesian4.ZERO = Object.freeze(new Cartesian4(0, 0, 0, 0));
726
- Cartesian4.ONE = Object.freeze(new Cartesian4(1, 1, 1, 1));
727
- Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1, 0, 0, 0));
728
- Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0, 1, 0, 0));
729
- Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0, 0, 1, 0));
730
- Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0, 0, 0, 1));
731
- var scratchF32Array = new Float32Array(1);
732
- var scratchU8Array = new Uint8Array(scratchF32Array.buffer);
733
- var testU32 = new Uint32Array([287454020]);
734
- var testU8 = new Uint8Array(testU32.buffer);
735
- var littleEndian = testU8[0] === 68;
736
- var Cartesian4_default = Cartesian4;
737
-
738
- // packages/engine/Source/Core/Matrix4.js
739
- function Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3) {
740
- this[0] = column0Row0 ?? 0;
741
- this[1] = column0Row1 ?? 0;
742
- this[2] = column0Row2 ?? 0;
743
- this[3] = column0Row3 ?? 0;
744
- this[4] = column1Row0 ?? 0;
745
- this[5] = column1Row1 ?? 0;
746
- this[6] = column1Row2 ?? 0;
747
- this[7] = column1Row3 ?? 0;
748
- this[8] = column2Row0 ?? 0;
749
- this[9] = column2Row1 ?? 0;
750
- this[10] = column2Row2 ?? 0;
751
- this[11] = column2Row3 ?? 0;
752
- this[12] = column3Row0 ?? 0;
753
- this[13] = column3Row1 ?? 0;
754
- this[14] = column3Row2 ?? 0;
755
- this[15] = column3Row3 ?? 0;
756
- }
757
- Matrix4.packedLength = 16;
758
- Matrix4.pack = function(value, array, startingIndex) {
759
- Check_default.typeOf.object("value", value);
760
- Check_default.defined("array", array);
761
- startingIndex = startingIndex ?? 0;
762
- array[startingIndex++] = value[0];
763
- array[startingIndex++] = value[1];
764
- array[startingIndex++] = value[2];
765
- array[startingIndex++] = value[3];
766
- array[startingIndex++] = value[4];
767
- array[startingIndex++] = value[5];
768
- array[startingIndex++] = value[6];
769
- array[startingIndex++] = value[7];
770
- array[startingIndex++] = value[8];
771
- array[startingIndex++] = value[9];
772
- array[startingIndex++] = value[10];
773
- array[startingIndex++] = value[11];
774
- array[startingIndex++] = value[12];
775
- array[startingIndex++] = value[13];
776
- array[startingIndex++] = value[14];
777
- array[startingIndex] = value[15];
778
- return array;
779
- };
780
- Matrix4.unpack = function(array, startingIndex, result) {
781
- Check_default.defined("array", array);
782
- startingIndex = startingIndex ?? 0;
783
- if (!defined_default(result)) {
784
- result = new Matrix4();
785
- }
786
- result[0] = array[startingIndex++];
787
- result[1] = array[startingIndex++];
788
- result[2] = array[startingIndex++];
789
- result[3] = array[startingIndex++];
790
- result[4] = array[startingIndex++];
791
- result[5] = array[startingIndex++];
792
- result[6] = array[startingIndex++];
793
- result[7] = array[startingIndex++];
794
- result[8] = array[startingIndex++];
795
- result[9] = array[startingIndex++];
796
- result[10] = array[startingIndex++];
797
- result[11] = array[startingIndex++];
798
- result[12] = array[startingIndex++];
799
- result[13] = array[startingIndex++];
800
- result[14] = array[startingIndex++];
801
- result[15] = array[startingIndex];
802
- return result;
803
- };
804
- Matrix4.packArray = function(array, result) {
805
- Check_default.defined("array", array);
806
- const length = array.length;
807
- const resultLength = length * 16;
808
- if (!defined_default(result)) {
809
- result = new Array(resultLength);
810
- } else if (!Array.isArray(result) && result.length !== resultLength) {
811
- throw new DeveloperError_default(
812
- "If result is a typed array, it must have exactly array.length * 16 elements"
813
- );
814
- } else if (result.length !== resultLength) {
815
- result.length = resultLength;
816
- }
817
- for (let i = 0; i < length; ++i) {
818
- Matrix4.pack(array[i], result, i * 16);
819
- }
820
- return result;
821
- };
822
- Matrix4.unpackArray = function(array, result) {
823
- Check_default.defined("array", array);
824
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 16);
825
- if (array.length % 16 !== 0) {
826
- throw new DeveloperError_default("array length must be a multiple of 16.");
827
- }
828
- const length = array.length;
829
- if (!defined_default(result)) {
830
- result = new Array(length / 16);
831
- } else {
832
- result.length = length / 16;
833
- }
834
- for (let i = 0; i < length; i += 16) {
835
- const index = i / 16;
836
- result[index] = Matrix4.unpack(array, i, result[index]);
837
- }
838
- return result;
839
- };
840
- Matrix4.clone = function(matrix, result) {
841
- if (!defined_default(matrix)) {
842
- return void 0;
843
- }
844
- if (!defined_default(result)) {
845
- return new Matrix4(
846
- matrix[0],
847
- matrix[4],
848
- matrix[8],
849
- matrix[12],
850
- matrix[1],
851
- matrix[5],
852
- matrix[9],
853
- matrix[13],
854
- matrix[2],
855
- matrix[6],
856
- matrix[10],
857
- matrix[14],
858
- matrix[3],
859
- matrix[7],
860
- matrix[11],
861
- matrix[15]
862
- );
863
- }
864
- result[0] = matrix[0];
865
- result[1] = matrix[1];
866
- result[2] = matrix[2];
867
- result[3] = matrix[3];
868
- result[4] = matrix[4];
869
- result[5] = matrix[5];
870
- result[6] = matrix[6];
871
- result[7] = matrix[7];
872
- result[8] = matrix[8];
873
- result[9] = matrix[9];
874
- result[10] = matrix[10];
875
- result[11] = matrix[11];
876
- result[12] = matrix[12];
877
- result[13] = matrix[13];
878
- result[14] = matrix[14];
879
- result[15] = matrix[15];
880
- return result;
881
- };
882
- Matrix4.fromArray = Matrix4.unpack;
883
- Matrix4.fromColumnMajorArray = function(values, result) {
884
- Check_default.defined("values", values);
885
- return Matrix4.clone(values, result);
886
- };
887
- Matrix4.fromRowMajorArray = function(values, result) {
888
- Check_default.defined("values", values);
889
- if (!defined_default(result)) {
890
- return new Matrix4(
891
- values[0],
892
- values[1],
893
- values[2],
894
- values[3],
895
- values[4],
896
- values[5],
897
- values[6],
898
- values[7],
899
- values[8],
900
- values[9],
901
- values[10],
902
- values[11],
903
- values[12],
904
- values[13],
905
- values[14],
906
- values[15]
907
- );
908
- }
909
- result[0] = values[0];
910
- result[1] = values[4];
911
- result[2] = values[8];
912
- result[3] = values[12];
913
- result[4] = values[1];
914
- result[5] = values[5];
915
- result[6] = values[9];
916
- result[7] = values[13];
917
- result[8] = values[2];
918
- result[9] = values[6];
919
- result[10] = values[10];
920
- result[11] = values[14];
921
- result[12] = values[3];
922
- result[13] = values[7];
923
- result[14] = values[11];
924
- result[15] = values[15];
925
- return result;
926
- };
927
- Matrix4.fromRotationTranslation = function(rotation, translation, result) {
928
- Check_default.typeOf.object("rotation", rotation);
929
- translation = translation ?? Cartesian3_default.ZERO;
930
- if (!defined_default(result)) {
931
- return new Matrix4(
932
- rotation[0],
933
- rotation[3],
934
- rotation[6],
935
- translation.x,
936
- rotation[1],
937
- rotation[4],
938
- rotation[7],
939
- translation.y,
940
- rotation[2],
941
- rotation[5],
942
- rotation[8],
943
- translation.z,
944
- 0,
945
- 0,
946
- 0,
947
- 1
948
- );
949
- }
950
- result[0] = rotation[0];
951
- result[1] = rotation[1];
952
- result[2] = rotation[2];
953
- result[3] = 0;
954
- result[4] = rotation[3];
955
- result[5] = rotation[4];
956
- result[6] = rotation[5];
957
- result[7] = 0;
958
- result[8] = rotation[6];
959
- result[9] = rotation[7];
960
- result[10] = rotation[8];
961
- result[11] = 0;
962
- result[12] = translation.x;
963
- result[13] = translation.y;
964
- result[14] = translation.z;
965
- result[15] = 1;
966
- return result;
967
- };
968
- Matrix4.fromTranslationQuaternionRotationScale = function(translation, rotation, scale, result) {
969
- Check_default.typeOf.object("translation", translation);
970
- Check_default.typeOf.object("rotation", rotation);
971
- Check_default.typeOf.object("scale", scale);
972
- if (!defined_default(result)) {
973
- result = new Matrix4();
974
- }
975
- const scaleX = scale.x;
976
- const scaleY = scale.y;
977
- const scaleZ = scale.z;
978
- const x2 = rotation.x * rotation.x;
979
- const xy = rotation.x * rotation.y;
980
- const xz = rotation.x * rotation.z;
981
- const xw = rotation.x * rotation.w;
982
- const y2 = rotation.y * rotation.y;
983
- const yz = rotation.y * rotation.z;
984
- const yw = rotation.y * rotation.w;
985
- const z2 = rotation.z * rotation.z;
986
- const zw = rotation.z * rotation.w;
987
- const w2 = rotation.w * rotation.w;
988
- const m00 = x2 - y2 - z2 + w2;
989
- const m01 = 2 * (xy - zw);
990
- const m02 = 2 * (xz + yw);
991
- const m10 = 2 * (xy + zw);
992
- const m11 = -x2 + y2 - z2 + w2;
993
- const m12 = 2 * (yz - xw);
994
- const m20 = 2 * (xz - yw);
995
- const m21 = 2 * (yz + xw);
996
- const m22 = -x2 - y2 + z2 + w2;
997
- result[0] = m00 * scaleX;
998
- result[1] = m10 * scaleX;
999
- result[2] = m20 * scaleX;
1000
- result[3] = 0;
1001
- result[4] = m01 * scaleY;
1002
- result[5] = m11 * scaleY;
1003
- result[6] = m21 * scaleY;
1004
- result[7] = 0;
1005
- result[8] = m02 * scaleZ;
1006
- result[9] = m12 * scaleZ;
1007
- result[10] = m22 * scaleZ;
1008
- result[11] = 0;
1009
- result[12] = translation.x;
1010
- result[13] = translation.y;
1011
- result[14] = translation.z;
1012
- result[15] = 1;
1013
- return result;
1014
- };
1015
- Matrix4.fromTranslationRotationScale = function(translationRotationScale, result) {
1016
- Check_default.typeOf.object("translationRotationScale", translationRotationScale);
1017
- return Matrix4.fromTranslationQuaternionRotationScale(
1018
- translationRotationScale.translation,
1019
- translationRotationScale.rotation,
1020
- translationRotationScale.scale,
1021
- result
1022
- );
1023
- };
1024
- Matrix4.fromTranslation = function(translation, result) {
1025
- Check_default.typeOf.object("translation", translation);
1026
- return Matrix4.fromRotationTranslation(Matrix3_default.IDENTITY, translation, result);
1027
- };
1028
- Matrix4.fromScale = function(scale, result) {
1029
- Check_default.typeOf.object("scale", scale);
1030
- if (!defined_default(result)) {
1031
- return new Matrix4(
1032
- scale.x,
1033
- 0,
1034
- 0,
1035
- 0,
1036
- 0,
1037
- scale.y,
1038
- 0,
1039
- 0,
1040
- 0,
1041
- 0,
1042
- scale.z,
1043
- 0,
1044
- 0,
1045
- 0,
1046
- 0,
1047
- 1
1048
- );
1049
- }
1050
- result[0] = scale.x;
1051
- result[1] = 0;
1052
- result[2] = 0;
1053
- result[3] = 0;
1054
- result[4] = 0;
1055
- result[5] = scale.y;
1056
- result[6] = 0;
1057
- result[7] = 0;
1058
- result[8] = 0;
1059
- result[9] = 0;
1060
- result[10] = scale.z;
1061
- result[11] = 0;
1062
- result[12] = 0;
1063
- result[13] = 0;
1064
- result[14] = 0;
1065
- result[15] = 1;
1066
- return result;
1067
- };
1068
- Matrix4.fromUniformScale = function(scale, result) {
1069
- Check_default.typeOf.number("scale", scale);
1070
- if (!defined_default(result)) {
1071
- return new Matrix4(
1072
- scale,
1073
- 0,
1074
- 0,
1075
- 0,
1076
- 0,
1077
- scale,
1078
- 0,
1079
- 0,
1080
- 0,
1081
- 0,
1082
- scale,
1083
- 0,
1084
- 0,
1085
- 0,
1086
- 0,
1087
- 1
1088
- );
1089
- }
1090
- result[0] = scale;
1091
- result[1] = 0;
1092
- result[2] = 0;
1093
- result[3] = 0;
1094
- result[4] = 0;
1095
- result[5] = scale;
1096
- result[6] = 0;
1097
- result[7] = 0;
1098
- result[8] = 0;
1099
- result[9] = 0;
1100
- result[10] = scale;
1101
- result[11] = 0;
1102
- result[12] = 0;
1103
- result[13] = 0;
1104
- result[14] = 0;
1105
- result[15] = 1;
1106
- return result;
1107
- };
1108
- Matrix4.fromRotation = function(rotation, result) {
1109
- Check_default.typeOf.object("rotation", rotation);
1110
- if (!defined_default(result)) {
1111
- result = new Matrix4();
1112
- }
1113
- result[0] = rotation[0];
1114
- result[1] = rotation[1];
1115
- result[2] = rotation[2];
1116
- result[3] = 0;
1117
- result[4] = rotation[3];
1118
- result[5] = rotation[4];
1119
- result[6] = rotation[5];
1120
- result[7] = 0;
1121
- result[8] = rotation[6];
1122
- result[9] = rotation[7];
1123
- result[10] = rotation[8];
1124
- result[11] = 0;
1125
- result[12] = 0;
1126
- result[13] = 0;
1127
- result[14] = 0;
1128
- result[15] = 1;
1129
- return result;
1130
- };
1131
- var fromCameraF = new Cartesian3_default();
1132
- var fromCameraR = new Cartesian3_default();
1133
- var fromCameraU = new Cartesian3_default();
1134
- Matrix4.fromCamera = function(camera, result) {
1135
- Check_default.typeOf.object("camera", camera);
1136
- const position = camera.position;
1137
- const direction = camera.direction;
1138
- const up = camera.up;
1139
- Check_default.typeOf.object("camera.position", position);
1140
- Check_default.typeOf.object("camera.direction", direction);
1141
- Check_default.typeOf.object("camera.up", up);
1142
- Cartesian3_default.normalize(direction, fromCameraF);
1143
- Cartesian3_default.normalize(
1144
- Cartesian3_default.cross(fromCameraF, up, fromCameraR),
1145
- fromCameraR
1146
- );
1147
- Cartesian3_default.normalize(
1148
- Cartesian3_default.cross(fromCameraR, fromCameraF, fromCameraU),
1149
- fromCameraU
1150
- );
1151
- const sX = fromCameraR.x;
1152
- const sY = fromCameraR.y;
1153
- const sZ = fromCameraR.z;
1154
- const fX = fromCameraF.x;
1155
- const fY = fromCameraF.y;
1156
- const fZ = fromCameraF.z;
1157
- const uX = fromCameraU.x;
1158
- const uY = fromCameraU.y;
1159
- const uZ = fromCameraU.z;
1160
- const positionX = position.x;
1161
- const positionY = position.y;
1162
- const positionZ = position.z;
1163
- const t0 = sX * -positionX + sY * -positionY + sZ * -positionZ;
1164
- const t1 = uX * -positionX + uY * -positionY + uZ * -positionZ;
1165
- const t2 = fX * positionX + fY * positionY + fZ * positionZ;
1166
- if (!defined_default(result)) {
1167
- return new Matrix4(
1168
- sX,
1169
- sY,
1170
- sZ,
1171
- t0,
1172
- uX,
1173
- uY,
1174
- uZ,
1175
- t1,
1176
- -fX,
1177
- -fY,
1178
- -fZ,
1179
- t2,
1180
- 0,
1181
- 0,
1182
- 0,
1183
- 1
1184
- );
1185
- }
1186
- result[0] = sX;
1187
- result[1] = uX;
1188
- result[2] = -fX;
1189
- result[3] = 0;
1190
- result[4] = sY;
1191
- result[5] = uY;
1192
- result[6] = -fY;
1193
- result[7] = 0;
1194
- result[8] = sZ;
1195
- result[9] = uZ;
1196
- result[10] = -fZ;
1197
- result[11] = 0;
1198
- result[12] = t0;
1199
- result[13] = t1;
1200
- result[14] = t2;
1201
- result[15] = 1;
1202
- return result;
1203
- };
1204
- Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) {
1205
- Check_default.typeOf.number.greaterThan("fovY", fovY, 0);
1206
- Check_default.typeOf.number.lessThan("fovY", fovY, Math.PI);
1207
- Check_default.typeOf.number.greaterThan("near", near, 0);
1208
- Check_default.typeOf.number.greaterThan("far", far, 0);
1209
- Check_default.typeOf.object("result", result);
1210
- const bottom = Math.tan(fovY * 0.5);
1211
- const column1Row1 = 1 / bottom;
1212
- const column0Row0 = column1Row1 / aspectRatio;
1213
- const column2Row2 = (far + near) / (near - far);
1214
- const column3Row2 = 2 * far * near / (near - far);
1215
- result[0] = column0Row0;
1216
- result[1] = 0;
1217
- result[2] = 0;
1218
- result[3] = 0;
1219
- result[4] = 0;
1220
- result[5] = column1Row1;
1221
- result[6] = 0;
1222
- result[7] = 0;
1223
- result[8] = 0;
1224
- result[9] = 0;
1225
- result[10] = column2Row2;
1226
- result[11] = -1;
1227
- result[12] = 0;
1228
- result[13] = 0;
1229
- result[14] = column3Row2;
1230
- result[15] = 0;
1231
- return result;
1232
- };
1233
- Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) {
1234
- Check_default.typeOf.number("left", left);
1235
- Check_default.typeOf.number("right", right);
1236
- Check_default.typeOf.number("bottom", bottom);
1237
- Check_default.typeOf.number("top", top);
1238
- Check_default.typeOf.number("near", near);
1239
- Check_default.typeOf.number("far", far);
1240
- Check_default.typeOf.object("result", result);
1241
- let a = 1 / (right - left);
1242
- let b = 1 / (top - bottom);
1243
- let c = 1 / (far - near);
1244
- const tx = -(right + left) * a;
1245
- const ty = -(top + bottom) * b;
1246
- const tz = -(far + near) * c;
1247
- a *= 2;
1248
- b *= 2;
1249
- c *= -2;
1250
- result[0] = a;
1251
- result[1] = 0;
1252
- result[2] = 0;
1253
- result[3] = 0;
1254
- result[4] = 0;
1255
- result[5] = b;
1256
- result[6] = 0;
1257
- result[7] = 0;
1258
- result[8] = 0;
1259
- result[9] = 0;
1260
- result[10] = c;
1261
- result[11] = 0;
1262
- result[12] = tx;
1263
- result[13] = ty;
1264
- result[14] = tz;
1265
- result[15] = 1;
1266
- return result;
1267
- };
1268
- Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) {
1269
- Check_default.typeOf.number("left", left);
1270
- Check_default.typeOf.number("right", right);
1271
- Check_default.typeOf.number("bottom", bottom);
1272
- Check_default.typeOf.number("top", top);
1273
- Check_default.typeOf.number("near", near);
1274
- Check_default.typeOf.number("far", far);
1275
- Check_default.typeOf.object("result", result);
1276
- const column0Row0 = 2 * near / (right - left);
1277
- const column1Row1 = 2 * near / (top - bottom);
1278
- const column2Row0 = (right + left) / (right - left);
1279
- const column2Row1 = (top + bottom) / (top - bottom);
1280
- const column2Row2 = -(far + near) / (far - near);
1281
- const column2Row3 = -1;
1282
- const column3Row2 = -2 * far * near / (far - near);
1283
- result[0] = column0Row0;
1284
- result[1] = 0;
1285
- result[2] = 0;
1286
- result[3] = 0;
1287
- result[4] = 0;
1288
- result[5] = column1Row1;
1289
- result[6] = 0;
1290
- result[7] = 0;
1291
- result[8] = column2Row0;
1292
- result[9] = column2Row1;
1293
- result[10] = column2Row2;
1294
- result[11] = column2Row3;
1295
- result[12] = 0;
1296
- result[13] = 0;
1297
- result[14] = column3Row2;
1298
- result[15] = 0;
1299
- return result;
1300
- };
1301
- Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) {
1302
- Check_default.typeOf.number("left", left);
1303
- Check_default.typeOf.number("right", right);
1304
- Check_default.typeOf.number("bottom", bottom);
1305
- Check_default.typeOf.number("top", top);
1306
- Check_default.typeOf.number("near", near);
1307
- Check_default.typeOf.object("result", result);
1308
- const column0Row0 = 2 * near / (right - left);
1309
- const column1Row1 = 2 * near / (top - bottom);
1310
- const column2Row0 = (right + left) / (right - left);
1311
- const column2Row1 = (top + bottom) / (top - bottom);
1312
- const column2Row2 = -1;
1313
- const column2Row3 = -1;
1314
- const column3Row2 = -2 * near;
1315
- result[0] = column0Row0;
1316
- result[1] = 0;
1317
- result[2] = 0;
1318
- result[3] = 0;
1319
- result[4] = 0;
1320
- result[5] = column1Row1;
1321
- result[6] = 0;
1322
- result[7] = 0;
1323
- result[8] = column2Row0;
1324
- result[9] = column2Row1;
1325
- result[10] = column2Row2;
1326
- result[11] = column2Row3;
1327
- result[12] = 0;
1328
- result[13] = 0;
1329
- result[14] = column3Row2;
1330
- result[15] = 0;
1331
- return result;
1332
- };
1333
- Matrix4.computeViewportTransformation = function(viewport, nearDepthRange, farDepthRange, result) {
1334
- if (!defined_default(result)) {
1335
- result = new Matrix4();
1336
- }
1337
- viewport = viewport ?? Frozen_default.EMPTY_OBJECT;
1338
- const x = viewport.x ?? 0;
1339
- const y = viewport.y ?? 0;
1340
- const width = viewport.width ?? 0;
1341
- const height = viewport.height ?? 0;
1342
- nearDepthRange = nearDepthRange ?? 0;
1343
- farDepthRange = farDepthRange ?? 1;
1344
- const halfWidth = width * 0.5;
1345
- const halfHeight = height * 0.5;
1346
- const halfDepth = (farDepthRange - nearDepthRange) * 0.5;
1347
- const column0Row0 = halfWidth;
1348
- const column1Row1 = halfHeight;
1349
- const column2Row2 = halfDepth;
1350
- const column3Row0 = x + halfWidth;
1351
- const column3Row1 = y + halfHeight;
1352
- const column3Row2 = nearDepthRange + halfDepth;
1353
- const column3Row3 = 1;
1354
- result[0] = column0Row0;
1355
- result[1] = 0;
1356
- result[2] = 0;
1357
- result[3] = 0;
1358
- result[4] = 0;
1359
- result[5] = column1Row1;
1360
- result[6] = 0;
1361
- result[7] = 0;
1362
- result[8] = 0;
1363
- result[9] = 0;
1364
- result[10] = column2Row2;
1365
- result[11] = 0;
1366
- result[12] = column3Row0;
1367
- result[13] = column3Row1;
1368
- result[14] = column3Row2;
1369
- result[15] = column3Row3;
1370
- return result;
1371
- };
1372
- Matrix4.computeView = function(position, direction, up, right, result) {
1373
- Check_default.typeOf.object("position", position);
1374
- Check_default.typeOf.object("direction", direction);
1375
- Check_default.typeOf.object("up", up);
1376
- Check_default.typeOf.object("right", right);
1377
- Check_default.typeOf.object("result", result);
1378
- result[0] = right.x;
1379
- result[1] = up.x;
1380
- result[2] = -direction.x;
1381
- result[3] = 0;
1382
- result[4] = right.y;
1383
- result[5] = up.y;
1384
- result[6] = -direction.y;
1385
- result[7] = 0;
1386
- result[8] = right.z;
1387
- result[9] = up.z;
1388
- result[10] = -direction.z;
1389
- result[11] = 0;
1390
- result[12] = -Cartesian3_default.dot(right, position);
1391
- result[13] = -Cartesian3_default.dot(up, position);
1392
- result[14] = Cartesian3_default.dot(direction, position);
1393
- result[15] = 1;
1394
- return result;
1395
- };
1396
- Matrix4.toArray = function(matrix, result) {
1397
- Check_default.typeOf.object("matrix", matrix);
1398
- if (!defined_default(result)) {
1399
- return [
1400
- matrix[0],
1401
- matrix[1],
1402
- matrix[2],
1403
- matrix[3],
1404
- matrix[4],
1405
- matrix[5],
1406
- matrix[6],
1407
- matrix[7],
1408
- matrix[8],
1409
- matrix[9],
1410
- matrix[10],
1411
- matrix[11],
1412
- matrix[12],
1413
- matrix[13],
1414
- matrix[14],
1415
- matrix[15]
1416
- ];
1417
- }
1418
- result[0] = matrix[0];
1419
- result[1] = matrix[1];
1420
- result[2] = matrix[2];
1421
- result[3] = matrix[3];
1422
- result[4] = matrix[4];
1423
- result[5] = matrix[5];
1424
- result[6] = matrix[6];
1425
- result[7] = matrix[7];
1426
- result[8] = matrix[8];
1427
- result[9] = matrix[9];
1428
- result[10] = matrix[10];
1429
- result[11] = matrix[11];
1430
- result[12] = matrix[12];
1431
- result[13] = matrix[13];
1432
- result[14] = matrix[14];
1433
- result[15] = matrix[15];
1434
- return result;
1435
- };
1436
- Matrix4.getElementIndex = function(column, row) {
1437
- Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
1438
- Check_default.typeOf.number.lessThanOrEquals("row", row, 3);
1439
- Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
1440
- Check_default.typeOf.number.lessThanOrEquals("column", column, 3);
1441
- return column * 4 + row;
1442
- };
1443
- Matrix4.getColumn = function(matrix, index, result) {
1444
- Check_default.typeOf.object("matrix", matrix);
1445
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1446
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1447
- Check_default.typeOf.object("result", result);
1448
- const startIndex = index * 4;
1449
- const x = matrix[startIndex];
1450
- const y = matrix[startIndex + 1];
1451
- const z = matrix[startIndex + 2];
1452
- const w = matrix[startIndex + 3];
1453
- result.x = x;
1454
- result.y = y;
1455
- result.z = z;
1456
- result.w = w;
1457
- return result;
1458
- };
1459
- Matrix4.setColumn = function(matrix, index, cartesian, result) {
1460
- Check_default.typeOf.object("matrix", matrix);
1461
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1462
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1463
- Check_default.typeOf.object("cartesian", cartesian);
1464
- Check_default.typeOf.object("result", result);
1465
- result = Matrix4.clone(matrix, result);
1466
- const startIndex = index * 4;
1467
- result[startIndex] = cartesian.x;
1468
- result[startIndex + 1] = cartesian.y;
1469
- result[startIndex + 2] = cartesian.z;
1470
- result[startIndex + 3] = cartesian.w;
1471
- return result;
1472
- };
1473
- Matrix4.getRow = function(matrix, index, result) {
1474
- Check_default.typeOf.object("matrix", matrix);
1475
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1476
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1477
- Check_default.typeOf.object("result", result);
1478
- const x = matrix[index];
1479
- const y = matrix[index + 4];
1480
- const z = matrix[index + 8];
1481
- const w = matrix[index + 12];
1482
- result.x = x;
1483
- result.y = y;
1484
- result.z = z;
1485
- result.w = w;
1486
- return result;
1487
- };
1488
- Matrix4.setRow = function(matrix, index, cartesian, result) {
1489
- Check_default.typeOf.object("matrix", matrix);
1490
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1491
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1492
- Check_default.typeOf.object("cartesian", cartesian);
1493
- Check_default.typeOf.object("result", result);
1494
- result = Matrix4.clone(matrix, result);
1495
- result[index] = cartesian.x;
1496
- result[index + 4] = cartesian.y;
1497
- result[index + 8] = cartesian.z;
1498
- result[index + 12] = cartesian.w;
1499
- return result;
1500
- };
1501
- Matrix4.setTranslation = function(matrix, translation, result) {
1502
- Check_default.typeOf.object("matrix", matrix);
1503
- Check_default.typeOf.object("translation", translation);
1504
- Check_default.typeOf.object("result", result);
1505
- result[0] = matrix[0];
1506
- result[1] = matrix[1];
1507
- result[2] = matrix[2];
1508
- result[3] = matrix[3];
1509
- result[4] = matrix[4];
1510
- result[5] = matrix[5];
1511
- result[6] = matrix[6];
1512
- result[7] = matrix[7];
1513
- result[8] = matrix[8];
1514
- result[9] = matrix[9];
1515
- result[10] = matrix[10];
1516
- result[11] = matrix[11];
1517
- result[12] = translation.x;
1518
- result[13] = translation.y;
1519
- result[14] = translation.z;
1520
- result[15] = matrix[15];
1521
- return result;
1522
- };
1523
- var scaleScratch1 = new Cartesian3_default();
1524
- Matrix4.setScale = function(matrix, scale, result) {
1525
- Check_default.typeOf.object("matrix", matrix);
1526
- Check_default.typeOf.object("scale", scale);
1527
- Check_default.typeOf.object("result", result);
1528
- const existingScale = Matrix4.getScale(matrix, scaleScratch1);
1529
- const scaleRatioX = scale.x / existingScale.x;
1530
- const scaleRatioY = scale.y / existingScale.y;
1531
- const scaleRatioZ = scale.z / existingScale.z;
1532
- result[0] = matrix[0] * scaleRatioX;
1533
- result[1] = matrix[1] * scaleRatioX;
1534
- result[2] = matrix[2] * scaleRatioX;
1535
- result[3] = matrix[3];
1536
- result[4] = matrix[4] * scaleRatioY;
1537
- result[5] = matrix[5] * scaleRatioY;
1538
- result[6] = matrix[6] * scaleRatioY;
1539
- result[7] = matrix[7];
1540
- result[8] = matrix[8] * scaleRatioZ;
1541
- result[9] = matrix[9] * scaleRatioZ;
1542
- result[10] = matrix[10] * scaleRatioZ;
1543
- result[11] = matrix[11];
1544
- result[12] = matrix[12];
1545
- result[13] = matrix[13];
1546
- result[14] = matrix[14];
1547
- result[15] = matrix[15];
1548
- return result;
1549
- };
1550
- var scaleScratch2 = new Cartesian3_default();
1551
- Matrix4.setUniformScale = function(matrix, scale, result) {
1552
- Check_default.typeOf.object("matrix", matrix);
1553
- Check_default.typeOf.number("scale", scale);
1554
- Check_default.typeOf.object("result", result);
1555
- const existingScale = Matrix4.getScale(matrix, scaleScratch2);
1556
- const scaleRatioX = scale / existingScale.x;
1557
- const scaleRatioY = scale / existingScale.y;
1558
- const scaleRatioZ = scale / existingScale.z;
1559
- result[0] = matrix[0] * scaleRatioX;
1560
- result[1] = matrix[1] * scaleRatioX;
1561
- result[2] = matrix[2] * scaleRatioX;
1562
- result[3] = matrix[3];
1563
- result[4] = matrix[4] * scaleRatioY;
1564
- result[5] = matrix[5] * scaleRatioY;
1565
- result[6] = matrix[6] * scaleRatioY;
1566
- result[7] = matrix[7];
1567
- result[8] = matrix[8] * scaleRatioZ;
1568
- result[9] = matrix[9] * scaleRatioZ;
1569
- result[10] = matrix[10] * scaleRatioZ;
1570
- result[11] = matrix[11];
1571
- result[12] = matrix[12];
1572
- result[13] = matrix[13];
1573
- result[14] = matrix[14];
1574
- result[15] = matrix[15];
1575
- return result;
1576
- };
1577
- var scratchColumn = new Cartesian3_default();
1578
- Matrix4.getScale = function(matrix, result) {
1579
- Check_default.typeOf.object("matrix", matrix);
1580
- Check_default.typeOf.object("result", result);
1581
- result.x = Cartesian3_default.magnitude(
1582
- Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
1583
- );
1584
- result.y = Cartesian3_default.magnitude(
1585
- Cartesian3_default.fromElements(matrix[4], matrix[5], matrix[6], scratchColumn)
1586
- );
1587
- result.z = Cartesian3_default.magnitude(
1588
- Cartesian3_default.fromElements(matrix[8], matrix[9], matrix[10], scratchColumn)
1589
- );
1590
- return result;
1591
- };
1592
- var scaleScratch3 = new Cartesian3_default();
1593
- Matrix4.getMaximumScale = function(matrix) {
1594
- Matrix4.getScale(matrix, scaleScratch3);
1595
- return Cartesian3_default.maximumComponent(scaleScratch3);
1596
- };
1597
- var scaleScratch4 = new Cartesian3_default();
1598
- Matrix4.setRotation = function(matrix, rotation, result) {
1599
- Check_default.typeOf.object("matrix", matrix);
1600
- Check_default.typeOf.object("result", result);
1601
- const scale = Matrix4.getScale(matrix, scaleScratch4);
1602
- result[0] = rotation[0] * scale.x;
1603
- result[1] = rotation[1] * scale.x;
1604
- result[2] = rotation[2] * scale.x;
1605
- result[3] = matrix[3];
1606
- result[4] = rotation[3] * scale.y;
1607
- result[5] = rotation[4] * scale.y;
1608
- result[6] = rotation[5] * scale.y;
1609
- result[7] = matrix[7];
1610
- result[8] = rotation[6] * scale.z;
1611
- result[9] = rotation[7] * scale.z;
1612
- result[10] = rotation[8] * scale.z;
1613
- result[11] = matrix[11];
1614
- result[12] = matrix[12];
1615
- result[13] = matrix[13];
1616
- result[14] = matrix[14];
1617
- result[15] = matrix[15];
1618
- return result;
1619
- };
1620
- var scaleScratch5 = new Cartesian3_default();
1621
- Matrix4.getRotation = function(matrix, result) {
1622
- Check_default.typeOf.object("matrix", matrix);
1623
- Check_default.typeOf.object("result", result);
1624
- const scale = Matrix4.getScale(matrix, scaleScratch5);
1625
- result[0] = matrix[0] / scale.x;
1626
- result[1] = matrix[1] / scale.x;
1627
- result[2] = matrix[2] / scale.x;
1628
- result[3] = matrix[4] / scale.y;
1629
- result[4] = matrix[5] / scale.y;
1630
- result[5] = matrix[6] / scale.y;
1631
- result[6] = matrix[8] / scale.z;
1632
- result[7] = matrix[9] / scale.z;
1633
- result[8] = matrix[10] / scale.z;
1634
- return result;
1635
- };
1636
- Matrix4.multiply = function(left, right, result) {
1637
- Check_default.typeOf.object("left", left);
1638
- Check_default.typeOf.object("right", right);
1639
- Check_default.typeOf.object("result", result);
1640
- const left0 = left[0];
1641
- const left1 = left[1];
1642
- const left2 = left[2];
1643
- const left3 = left[3];
1644
- const left4 = left[4];
1645
- const left5 = left[5];
1646
- const left6 = left[6];
1647
- const left7 = left[7];
1648
- const left8 = left[8];
1649
- const left9 = left[9];
1650
- const left10 = left[10];
1651
- const left11 = left[11];
1652
- const left12 = left[12];
1653
- const left13 = left[13];
1654
- const left14 = left[14];
1655
- const left15 = left[15];
1656
- const right0 = right[0];
1657
- const right1 = right[1];
1658
- const right2 = right[2];
1659
- const right3 = right[3];
1660
- const right4 = right[4];
1661
- const right5 = right[5];
1662
- const right6 = right[6];
1663
- const right7 = right[7];
1664
- const right8 = right[8];
1665
- const right9 = right[9];
1666
- const right10 = right[10];
1667
- const right11 = right[11];
1668
- const right12 = right[12];
1669
- const right13 = right[13];
1670
- const right14 = right[14];
1671
- const right15 = right[15];
1672
- const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2 + left12 * right3;
1673
- const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2 + left13 * right3;
1674
- const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2 + left14 * right3;
1675
- const column0Row3 = left3 * right0 + left7 * right1 + left11 * right2 + left15 * right3;
1676
- const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6 + left12 * right7;
1677
- const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6 + left13 * right7;
1678
- const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6 + left14 * right7;
1679
- const column1Row3 = left3 * right4 + left7 * right5 + left11 * right6 + left15 * right7;
1680
- const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10 + left12 * right11;
1681
- const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10 + left13 * right11;
1682
- const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10 + left14 * right11;
1683
- const column2Row3 = left3 * right8 + left7 * right9 + left11 * right10 + left15 * right11;
1684
- const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12 * right15;
1685
- const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13 * right15;
1686
- const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14 * right15;
1687
- const column3Row3 = left3 * right12 + left7 * right13 + left11 * right14 + left15 * right15;
1688
- result[0] = column0Row0;
1689
- result[1] = column0Row1;
1690
- result[2] = column0Row2;
1691
- result[3] = column0Row3;
1692
- result[4] = column1Row0;
1693
- result[5] = column1Row1;
1694
- result[6] = column1Row2;
1695
- result[7] = column1Row3;
1696
- result[8] = column2Row0;
1697
- result[9] = column2Row1;
1698
- result[10] = column2Row2;
1699
- result[11] = column2Row3;
1700
- result[12] = column3Row0;
1701
- result[13] = column3Row1;
1702
- result[14] = column3Row2;
1703
- result[15] = column3Row3;
1704
- return result;
1705
- };
1706
- Matrix4.add = function(left, right, result) {
1707
- Check_default.typeOf.object("left", left);
1708
- Check_default.typeOf.object("right", right);
1709
- Check_default.typeOf.object("result", result);
1710
- result[0] = left[0] + right[0];
1711
- result[1] = left[1] + right[1];
1712
- result[2] = left[2] + right[2];
1713
- result[3] = left[3] + right[3];
1714
- result[4] = left[4] + right[4];
1715
- result[5] = left[5] + right[5];
1716
- result[6] = left[6] + right[6];
1717
- result[7] = left[7] + right[7];
1718
- result[8] = left[8] + right[8];
1719
- result[9] = left[9] + right[9];
1720
- result[10] = left[10] + right[10];
1721
- result[11] = left[11] + right[11];
1722
- result[12] = left[12] + right[12];
1723
- result[13] = left[13] + right[13];
1724
- result[14] = left[14] + right[14];
1725
- result[15] = left[15] + right[15];
1726
- return result;
1727
- };
1728
- Matrix4.subtract = function(left, right, result) {
1729
- Check_default.typeOf.object("left", left);
1730
- Check_default.typeOf.object("right", right);
1731
- Check_default.typeOf.object("result", result);
1732
- result[0] = left[0] - right[0];
1733
- result[1] = left[1] - right[1];
1734
- result[2] = left[2] - right[2];
1735
- result[3] = left[3] - right[3];
1736
- result[4] = left[4] - right[4];
1737
- result[5] = left[5] - right[5];
1738
- result[6] = left[6] - right[6];
1739
- result[7] = left[7] - right[7];
1740
- result[8] = left[8] - right[8];
1741
- result[9] = left[9] - right[9];
1742
- result[10] = left[10] - right[10];
1743
- result[11] = left[11] - right[11];
1744
- result[12] = left[12] - right[12];
1745
- result[13] = left[13] - right[13];
1746
- result[14] = left[14] - right[14];
1747
- result[15] = left[15] - right[15];
1748
- return result;
1749
- };
1750
- Matrix4.multiplyTransformation = function(left, right, result) {
1751
- Check_default.typeOf.object("left", left);
1752
- Check_default.typeOf.object("right", right);
1753
- Check_default.typeOf.object("result", result);
1754
- const left0 = left[0];
1755
- const left1 = left[1];
1756
- const left2 = left[2];
1757
- const left4 = left[4];
1758
- const left5 = left[5];
1759
- const left6 = left[6];
1760
- const left8 = left[8];
1761
- const left9 = left[9];
1762
- const left10 = left[10];
1763
- const left12 = left[12];
1764
- const left13 = left[13];
1765
- const left14 = left[14];
1766
- const right0 = right[0];
1767
- const right1 = right[1];
1768
- const right2 = right[2];
1769
- const right4 = right[4];
1770
- const right5 = right[5];
1771
- const right6 = right[6];
1772
- const right8 = right[8];
1773
- const right9 = right[9];
1774
- const right10 = right[10];
1775
- const right12 = right[12];
1776
- const right13 = right[13];
1777
- const right14 = right[14];
1778
- const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
1779
- const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
1780
- const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
1781
- const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
1782
- const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
1783
- const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
1784
- const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
1785
- const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
1786
- const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
1787
- const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12;
1788
- const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13;
1789
- const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14;
1790
- result[0] = column0Row0;
1791
- result[1] = column0Row1;
1792
- result[2] = column0Row2;
1793
- result[3] = 0;
1794
- result[4] = column1Row0;
1795
- result[5] = column1Row1;
1796
- result[6] = column1Row2;
1797
- result[7] = 0;
1798
- result[8] = column2Row0;
1799
- result[9] = column2Row1;
1800
- result[10] = column2Row2;
1801
- result[11] = 0;
1802
- result[12] = column3Row0;
1803
- result[13] = column3Row1;
1804
- result[14] = column3Row2;
1805
- result[15] = 1;
1806
- return result;
1807
- };
1808
- Matrix4.multiplyByMatrix3 = function(matrix, rotation, result) {
1809
- Check_default.typeOf.object("matrix", matrix);
1810
- Check_default.typeOf.object("rotation", rotation);
1811
- Check_default.typeOf.object("result", result);
1812
- const left0 = matrix[0];
1813
- const left1 = matrix[1];
1814
- const left2 = matrix[2];
1815
- const left4 = matrix[4];
1816
- const left5 = matrix[5];
1817
- const left6 = matrix[6];
1818
- const left8 = matrix[8];
1819
- const left9 = matrix[9];
1820
- const left10 = matrix[10];
1821
- const right0 = rotation[0];
1822
- const right1 = rotation[1];
1823
- const right2 = rotation[2];
1824
- const right4 = rotation[3];
1825
- const right5 = rotation[4];
1826
- const right6 = rotation[5];
1827
- const right8 = rotation[6];
1828
- const right9 = rotation[7];
1829
- const right10 = rotation[8];
1830
- const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
1831
- const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
1832
- const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
1833
- const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
1834
- const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
1835
- const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
1836
- const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
1837
- const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
1838
- const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
1839
- result[0] = column0Row0;
1840
- result[1] = column0Row1;
1841
- result[2] = column0Row2;
1842
- result[3] = 0;
1843
- result[4] = column1Row0;
1844
- result[5] = column1Row1;
1845
- result[6] = column1Row2;
1846
- result[7] = 0;
1847
- result[8] = column2Row0;
1848
- result[9] = column2Row1;
1849
- result[10] = column2Row2;
1850
- result[11] = 0;
1851
- result[12] = matrix[12];
1852
- result[13] = matrix[13];
1853
- result[14] = matrix[14];
1854
- result[15] = matrix[15];
1855
- return result;
1856
- };
1857
- Matrix4.multiplyByTranslation = function(matrix, translation, result) {
1858
- Check_default.typeOf.object("matrix", matrix);
1859
- Check_default.typeOf.object("translation", translation);
1860
- Check_default.typeOf.object("result", result);
1861
- const x = translation.x;
1862
- const y = translation.y;
1863
- const z = translation.z;
1864
- const tx = x * matrix[0] + y * matrix[4] + z * matrix[8] + matrix[12];
1865
- const ty = x * matrix[1] + y * matrix[5] + z * matrix[9] + matrix[13];
1866
- const tz = x * matrix[2] + y * matrix[6] + z * matrix[10] + matrix[14];
1867
- result[0] = matrix[0];
1868
- result[1] = matrix[1];
1869
- result[2] = matrix[2];
1870
- result[3] = matrix[3];
1871
- result[4] = matrix[4];
1872
- result[5] = matrix[5];
1873
- result[6] = matrix[6];
1874
- result[7] = matrix[7];
1875
- result[8] = matrix[8];
1876
- result[9] = matrix[9];
1877
- result[10] = matrix[10];
1878
- result[11] = matrix[11];
1879
- result[12] = tx;
1880
- result[13] = ty;
1881
- result[14] = tz;
1882
- result[15] = matrix[15];
1883
- return result;
1884
- };
1885
- Matrix4.multiplyByScale = function(matrix, scale, result) {
1886
- Check_default.typeOf.object("matrix", matrix);
1887
- Check_default.typeOf.object("scale", scale);
1888
- Check_default.typeOf.object("result", result);
1889
- const scaleX = scale.x;
1890
- const scaleY = scale.y;
1891
- const scaleZ = scale.z;
1892
- if (scaleX === 1 && scaleY === 1 && scaleZ === 1) {
1893
- return Matrix4.clone(matrix, result);
1894
- }
1895
- result[0] = scaleX * matrix[0];
1896
- result[1] = scaleX * matrix[1];
1897
- result[2] = scaleX * matrix[2];
1898
- result[3] = matrix[3];
1899
- result[4] = scaleY * matrix[4];
1900
- result[5] = scaleY * matrix[5];
1901
- result[6] = scaleY * matrix[6];
1902
- result[7] = matrix[7];
1903
- result[8] = scaleZ * matrix[8];
1904
- result[9] = scaleZ * matrix[9];
1905
- result[10] = scaleZ * matrix[10];
1906
- result[11] = matrix[11];
1907
- result[12] = matrix[12];
1908
- result[13] = matrix[13];
1909
- result[14] = matrix[14];
1910
- result[15] = matrix[15];
1911
- return result;
1912
- };
1913
- Matrix4.multiplyByUniformScale = function(matrix, scale, result) {
1914
- Check_default.typeOf.object("matrix", matrix);
1915
- Check_default.typeOf.number("scale", scale);
1916
- Check_default.typeOf.object("result", result);
1917
- result[0] = matrix[0] * scale;
1918
- result[1] = matrix[1] * scale;
1919
- result[2] = matrix[2] * scale;
1920
- result[3] = matrix[3];
1921
- result[4] = matrix[4] * scale;
1922
- result[5] = matrix[5] * scale;
1923
- result[6] = matrix[6] * scale;
1924
- result[7] = matrix[7];
1925
- result[8] = matrix[8] * scale;
1926
- result[9] = matrix[9] * scale;
1927
- result[10] = matrix[10] * scale;
1928
- result[11] = matrix[11];
1929
- result[12] = matrix[12];
1930
- result[13] = matrix[13];
1931
- result[14] = matrix[14];
1932
- result[15] = matrix[15];
1933
- return result;
1934
- };
1935
- Matrix4.multiplyByVector = function(matrix, cartesian, result) {
1936
- Check_default.typeOf.object("matrix", matrix);
1937
- Check_default.typeOf.object("cartesian", cartesian);
1938
- Check_default.typeOf.object("result", result);
1939
- const vX = cartesian.x;
1940
- const vY = cartesian.y;
1941
- const vZ = cartesian.z;
1942
- const vW = cartesian.w;
1943
- const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12] * vW;
1944
- const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13] * vW;
1945
- const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14] * vW;
1946
- const w = matrix[3] * vX + matrix[7] * vY + matrix[11] * vZ + matrix[15] * vW;
1947
- result.x = x;
1948
- result.y = y;
1949
- result.z = z;
1950
- result.w = w;
1951
- return result;
1952
- };
1953
- Matrix4.multiplyByPointAsVector = function(matrix, cartesian, result) {
1954
- Check_default.typeOf.object("matrix", matrix);
1955
- Check_default.typeOf.object("cartesian", cartesian);
1956
- Check_default.typeOf.object("result", result);
1957
- const vX = cartesian.x;
1958
- const vY = cartesian.y;
1959
- const vZ = cartesian.z;
1960
- const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ;
1961
- const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ;
1962
- const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ;
1963
- result.x = x;
1964
- result.y = y;
1965
- result.z = z;
1966
- return result;
1967
- };
1968
- Matrix4.multiplyByPoint = function(matrix, cartesian, result) {
1969
- Check_default.typeOf.object("matrix", matrix);
1970
- Check_default.typeOf.object("cartesian", cartesian);
1971
- Check_default.typeOf.object("result", result);
1972
- const vX = cartesian.x;
1973
- const vY = cartesian.y;
1974
- const vZ = cartesian.z;
1975
- const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12];
1976
- const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13];
1977
- const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14];
1978
- result.x = x;
1979
- result.y = y;
1980
- result.z = z;
1981
- return result;
1982
- };
1983
- Matrix4.multiplyByScalar = function(matrix, scalar, result) {
1984
- Check_default.typeOf.object("matrix", matrix);
1985
- Check_default.typeOf.number("scalar", scalar);
1986
- Check_default.typeOf.object("result", result);
1987
- result[0] = matrix[0] * scalar;
1988
- result[1] = matrix[1] * scalar;
1989
- result[2] = matrix[2] * scalar;
1990
- result[3] = matrix[3] * scalar;
1991
- result[4] = matrix[4] * scalar;
1992
- result[5] = matrix[5] * scalar;
1993
- result[6] = matrix[6] * scalar;
1994
- result[7] = matrix[7] * scalar;
1995
- result[8] = matrix[8] * scalar;
1996
- result[9] = matrix[9] * scalar;
1997
- result[10] = matrix[10] * scalar;
1998
- result[11] = matrix[11] * scalar;
1999
- result[12] = matrix[12] * scalar;
2000
- result[13] = matrix[13] * scalar;
2001
- result[14] = matrix[14] * scalar;
2002
- result[15] = matrix[15] * scalar;
2003
- return result;
2004
- };
2005
- Matrix4.negate = function(matrix, result) {
2006
- Check_default.typeOf.object("matrix", matrix);
2007
- Check_default.typeOf.object("result", result);
2008
- result[0] = -matrix[0];
2009
- result[1] = -matrix[1];
2010
- result[2] = -matrix[2];
2011
- result[3] = -matrix[3];
2012
- result[4] = -matrix[4];
2013
- result[5] = -matrix[5];
2014
- result[6] = -matrix[6];
2015
- result[7] = -matrix[7];
2016
- result[8] = -matrix[8];
2017
- result[9] = -matrix[9];
2018
- result[10] = -matrix[10];
2019
- result[11] = -matrix[11];
2020
- result[12] = -matrix[12];
2021
- result[13] = -matrix[13];
2022
- result[14] = -matrix[14];
2023
- result[15] = -matrix[15];
2024
- return result;
2025
- };
2026
- Matrix4.transpose = function(matrix, result) {
2027
- Check_default.typeOf.object("matrix", matrix);
2028
- Check_default.typeOf.object("result", result);
2029
- const matrix1 = matrix[1];
2030
- const matrix2 = matrix[2];
2031
- const matrix3 = matrix[3];
2032
- const matrix6 = matrix[6];
2033
- const matrix7 = matrix[7];
2034
- const matrix11 = matrix[11];
2035
- result[0] = matrix[0];
2036
- result[1] = matrix[4];
2037
- result[2] = matrix[8];
2038
- result[3] = matrix[12];
2039
- result[4] = matrix1;
2040
- result[5] = matrix[5];
2041
- result[6] = matrix[9];
2042
- result[7] = matrix[13];
2043
- result[8] = matrix2;
2044
- result[9] = matrix6;
2045
- result[10] = matrix[10];
2046
- result[11] = matrix[14];
2047
- result[12] = matrix3;
2048
- result[13] = matrix7;
2049
- result[14] = matrix11;
2050
- result[15] = matrix[15];
2051
- return result;
2052
- };
2053
- Matrix4.abs = function(matrix, result) {
2054
- Check_default.typeOf.object("matrix", matrix);
2055
- Check_default.typeOf.object("result", result);
2056
- result[0] = Math.abs(matrix[0]);
2057
- result[1] = Math.abs(matrix[1]);
2058
- result[2] = Math.abs(matrix[2]);
2059
- result[3] = Math.abs(matrix[3]);
2060
- result[4] = Math.abs(matrix[4]);
2061
- result[5] = Math.abs(matrix[5]);
2062
- result[6] = Math.abs(matrix[6]);
2063
- result[7] = Math.abs(matrix[7]);
2064
- result[8] = Math.abs(matrix[8]);
2065
- result[9] = Math.abs(matrix[9]);
2066
- result[10] = Math.abs(matrix[10]);
2067
- result[11] = Math.abs(matrix[11]);
2068
- result[12] = Math.abs(matrix[12]);
2069
- result[13] = Math.abs(matrix[13]);
2070
- result[14] = Math.abs(matrix[14]);
2071
- result[15] = Math.abs(matrix[15]);
2072
- return result;
2073
- };
2074
- Matrix4.equals = function(left, right) {
2075
- return left === right || defined_default(left) && defined_default(right) && // Translation
2076
- left[12] === right[12] && left[13] === right[13] && left[14] === right[14] && // Rotation/scale
2077
- left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[4] === right[4] && left[5] === right[5] && left[6] === right[6] && left[8] === right[8] && left[9] === right[9] && left[10] === right[10] && // Bottom row
2078
- left[3] === right[3] && left[7] === right[7] && left[11] === right[11] && left[15] === right[15];
2079
- };
2080
- Matrix4.equalsEpsilon = function(left, right, epsilon) {
2081
- epsilon = epsilon ?? 0;
2082
- return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon && Math.abs(left[4] - right[4]) <= epsilon && Math.abs(left[5] - right[5]) <= epsilon && Math.abs(left[6] - right[6]) <= epsilon && Math.abs(left[7] - right[7]) <= epsilon && Math.abs(left[8] - right[8]) <= epsilon && Math.abs(left[9] - right[9]) <= epsilon && Math.abs(left[10] - right[10]) <= epsilon && Math.abs(left[11] - right[11]) <= epsilon && Math.abs(left[12] - right[12]) <= epsilon && Math.abs(left[13] - right[13]) <= epsilon && Math.abs(left[14] - right[14]) <= epsilon && Math.abs(left[15] - right[15]) <= epsilon;
2083
- };
2084
- Matrix4.getTranslation = function(matrix, result) {
2085
- Check_default.typeOf.object("matrix", matrix);
2086
- Check_default.typeOf.object("result", result);
2087
- result.x = matrix[12];
2088
- result.y = matrix[13];
2089
- result.z = matrix[14];
2090
- return result;
2091
- };
2092
- Matrix4.getMatrix3 = function(matrix, result) {
2093
- Check_default.typeOf.object("matrix", matrix);
2094
- Check_default.typeOf.object("result", result);
2095
- result[0] = matrix[0];
2096
- result[1] = matrix[1];
2097
- result[2] = matrix[2];
2098
- result[3] = matrix[4];
2099
- result[4] = matrix[5];
2100
- result[5] = matrix[6];
2101
- result[6] = matrix[8];
2102
- result[7] = matrix[9];
2103
- result[8] = matrix[10];
2104
- return result;
2105
- };
2106
- var scratchInverseRotation = new Matrix3_default();
2107
- var scratchMatrix3Zero = new Matrix3_default();
2108
- var scratchBottomRow = new Cartesian4_default();
2109
- var scratchExpectedBottomRow = new Cartesian4_default(0, 0, 0, 1);
2110
- Matrix4.inverse = function(matrix, result) {
2111
- Check_default.typeOf.object("matrix", matrix);
2112
- Check_default.typeOf.object("result", result);
2113
- const src0 = matrix[0];
2114
- const src1 = matrix[4];
2115
- const src2 = matrix[8];
2116
- const src3 = matrix[12];
2117
- const src4 = matrix[1];
2118
- const src5 = matrix[5];
2119
- const src6 = matrix[9];
2120
- const src7 = matrix[13];
2121
- const src8 = matrix[2];
2122
- const src9 = matrix[6];
2123
- const src10 = matrix[10];
2124
- const src11 = matrix[14];
2125
- const src12 = matrix[3];
2126
- const src13 = matrix[7];
2127
- const src14 = matrix[11];
2128
- const src15 = matrix[15];
2129
- let tmp0 = src10 * src15;
2130
- let tmp1 = src11 * src14;
2131
- let tmp2 = src9 * src15;
2132
- let tmp3 = src11 * src13;
2133
- let tmp4 = src9 * src14;
2134
- let tmp5 = src10 * src13;
2135
- let tmp6 = src8 * src15;
2136
- let tmp7 = src11 * src12;
2137
- let tmp8 = src8 * src14;
2138
- let tmp9 = src10 * src12;
2139
- let tmp10 = src8 * src13;
2140
- let tmp11 = src9 * src12;
2141
- const dst0 = tmp0 * src5 + tmp3 * src6 + tmp4 * src7 - (tmp1 * src5 + tmp2 * src6 + tmp5 * src7);
2142
- const dst1 = tmp1 * src4 + tmp6 * src6 + tmp9 * src7 - (tmp0 * src4 + tmp7 * src6 + tmp8 * src7);
2143
- const dst2 = tmp2 * src4 + tmp7 * src5 + tmp10 * src7 - (tmp3 * src4 + tmp6 * src5 + tmp11 * src7);
2144
- const dst3 = tmp5 * src4 + tmp8 * src5 + tmp11 * src6 - (tmp4 * src4 + tmp9 * src5 + tmp10 * src6);
2145
- const dst4 = tmp1 * src1 + tmp2 * src2 + tmp5 * src3 - (tmp0 * src1 + tmp3 * src2 + tmp4 * src3);
2146
- const dst5 = tmp0 * src0 + tmp7 * src2 + tmp8 * src3 - (tmp1 * src0 + tmp6 * src2 + tmp9 * src3);
2147
- const dst6 = tmp3 * src0 + tmp6 * src1 + tmp11 * src3 - (tmp2 * src0 + tmp7 * src1 + tmp10 * src3);
2148
- const dst7 = tmp4 * src0 + tmp9 * src1 + tmp10 * src2 - (tmp5 * src0 + tmp8 * src1 + tmp11 * src2);
2149
- tmp0 = src2 * src7;
2150
- tmp1 = src3 * src6;
2151
- tmp2 = src1 * src7;
2152
- tmp3 = src3 * src5;
2153
- tmp4 = src1 * src6;
2154
- tmp5 = src2 * src5;
2155
- tmp6 = src0 * src7;
2156
- tmp7 = src3 * src4;
2157
- tmp8 = src0 * src6;
2158
- tmp9 = src2 * src4;
2159
- tmp10 = src0 * src5;
2160
- tmp11 = src1 * src4;
2161
- const dst8 = tmp0 * src13 + tmp3 * src14 + tmp4 * src15 - (tmp1 * src13 + tmp2 * src14 + tmp5 * src15);
2162
- const dst9 = tmp1 * src12 + tmp6 * src14 + tmp9 * src15 - (tmp0 * src12 + tmp7 * src14 + tmp8 * src15);
2163
- const dst10 = tmp2 * src12 + tmp7 * src13 + tmp10 * src15 - (tmp3 * src12 + tmp6 * src13 + tmp11 * src15);
2164
- const dst11 = tmp5 * src12 + tmp8 * src13 + tmp11 * src14 - (tmp4 * src12 + tmp9 * src13 + tmp10 * src14);
2165
- const dst12 = tmp2 * src10 + tmp5 * src11 + tmp1 * src9 - (tmp4 * src11 + tmp0 * src9 + tmp3 * src10);
2166
- const dst13 = tmp8 * src11 + tmp0 * src8 + tmp7 * src10 - (tmp6 * src10 + tmp9 * src11 + tmp1 * src8);
2167
- const dst14 = tmp6 * src9 + tmp11 * src11 + tmp3 * src8 - (tmp10 * src11 + tmp2 * src8 + tmp7 * src9);
2168
- const dst15 = tmp10 * src10 + tmp4 * src8 + tmp9 * src9 - (tmp8 * src9 + tmp11 * src10 + tmp5 * src8);
2169
- let det = src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
2170
- if (Math.abs(det) < Math_default.EPSILON21) {
2171
- if (Matrix3_default.equalsEpsilon(
2172
- Matrix4.getMatrix3(matrix, scratchInverseRotation),
2173
- scratchMatrix3Zero,
2174
- Math_default.EPSILON7
2175
- ) && Cartesian4_default.equals(
2176
- Matrix4.getRow(matrix, 3, scratchBottomRow),
2177
- scratchExpectedBottomRow
2178
- )) {
2179
- result[0] = 0;
2180
- result[1] = 0;
2181
- result[2] = 0;
2182
- result[3] = 0;
2183
- result[4] = 0;
2184
- result[5] = 0;
2185
- result[6] = 0;
2186
- result[7] = 0;
2187
- result[8] = 0;
2188
- result[9] = 0;
2189
- result[10] = 0;
2190
- result[11] = 0;
2191
- result[12] = -matrix[12];
2192
- result[13] = -matrix[13];
2193
- result[14] = -matrix[14];
2194
- result[15] = 1;
2195
- return result;
2196
- }
2197
- throw new RuntimeError_default(
2198
- "matrix is not invertible because its determinate is zero."
2199
- );
2200
- }
2201
- det = 1 / det;
2202
- result[0] = dst0 * det;
2203
- result[1] = dst1 * det;
2204
- result[2] = dst2 * det;
2205
- result[3] = dst3 * det;
2206
- result[4] = dst4 * det;
2207
- result[5] = dst5 * det;
2208
- result[6] = dst6 * det;
2209
- result[7] = dst7 * det;
2210
- result[8] = dst8 * det;
2211
- result[9] = dst9 * det;
2212
- result[10] = dst10 * det;
2213
- result[11] = dst11 * det;
2214
- result[12] = dst12 * det;
2215
- result[13] = dst13 * det;
2216
- result[14] = dst14 * det;
2217
- result[15] = dst15 * det;
2218
- return result;
2219
- };
2220
- Matrix4.inverseTransformation = function(matrix, result) {
2221
- Check_default.typeOf.object("matrix", matrix);
2222
- Check_default.typeOf.object("result", result);
2223
- const matrix0 = matrix[0];
2224
- const matrix1 = matrix[1];
2225
- const matrix2 = matrix[2];
2226
- const matrix4 = matrix[4];
2227
- const matrix5 = matrix[5];
2228
- const matrix6 = matrix[6];
2229
- const matrix8 = matrix[8];
2230
- const matrix9 = matrix[9];
2231
- const matrix10 = matrix[10];
2232
- const vX = matrix[12];
2233
- const vY = matrix[13];
2234
- const vZ = matrix[14];
2235
- const x = -matrix0 * vX - matrix1 * vY - matrix2 * vZ;
2236
- const y = -matrix4 * vX - matrix5 * vY - matrix6 * vZ;
2237
- const z = -matrix8 * vX - matrix9 * vY - matrix10 * vZ;
2238
- result[0] = matrix0;
2239
- result[1] = matrix4;
2240
- result[2] = matrix8;
2241
- result[3] = 0;
2242
- result[4] = matrix1;
2243
- result[5] = matrix5;
2244
- result[6] = matrix9;
2245
- result[7] = 0;
2246
- result[8] = matrix2;
2247
- result[9] = matrix6;
2248
- result[10] = matrix10;
2249
- result[11] = 0;
2250
- result[12] = x;
2251
- result[13] = y;
2252
- result[14] = z;
2253
- result[15] = 1;
2254
- return result;
2255
- };
2256
- var scratchTransposeMatrix = new Matrix4();
2257
- Matrix4.inverseTranspose = function(matrix, result) {
2258
- Check_default.typeOf.object("matrix", matrix);
2259
- Check_default.typeOf.object("result", result);
2260
- return Matrix4.inverse(
2261
- Matrix4.transpose(matrix, scratchTransposeMatrix),
2262
- result
2263
- );
2264
- };
2265
- Matrix4.IDENTITY = Object.freeze(
2266
- new Matrix4(
2267
- 1,
2268
- 0,
2269
- 0,
2270
- 0,
2271
- 0,
2272
- 1,
2273
- 0,
2274
- 0,
2275
- 0,
2276
- 0,
2277
- 1,
2278
- 0,
2279
- 0,
2280
- 0,
2281
- 0,
2282
- 1
2283
- )
2284
- );
2285
- Matrix4.ZERO = Object.freeze(
2286
- new Matrix4(
2287
- 0,
2288
- 0,
2289
- 0,
2290
- 0,
2291
- 0,
2292
- 0,
2293
- 0,
2294
- 0,
2295
- 0,
2296
- 0,
2297
- 0,
2298
- 0,
2299
- 0,
2300
- 0,
2301
- 0,
2302
- 0
2303
- )
2304
- );
2305
- Matrix4.COLUMN0ROW0 = 0;
2306
- Matrix4.COLUMN0ROW1 = 1;
2307
- Matrix4.COLUMN0ROW2 = 2;
2308
- Matrix4.COLUMN0ROW3 = 3;
2309
- Matrix4.COLUMN1ROW0 = 4;
2310
- Matrix4.COLUMN1ROW1 = 5;
2311
- Matrix4.COLUMN1ROW2 = 6;
2312
- Matrix4.COLUMN1ROW3 = 7;
2313
- Matrix4.COLUMN2ROW0 = 8;
2314
- Matrix4.COLUMN2ROW1 = 9;
2315
- Matrix4.COLUMN2ROW2 = 10;
2316
- Matrix4.COLUMN2ROW3 = 11;
2317
- Matrix4.COLUMN3ROW0 = 12;
2318
- Matrix4.COLUMN3ROW1 = 13;
2319
- Matrix4.COLUMN3ROW2 = 14;
2320
- Matrix4.COLUMN3ROW3 = 15;
2321
- Object.defineProperties(Matrix4.prototype, {
2322
- /**
2323
- * Gets the number of items in the collection.
2324
- * @memberof Matrix4.prototype
2325
- *
2326
- * @type {number}
2327
- */
2328
- length: {
2329
- get: function() {
2330
- return Matrix4.packedLength;
2331
- }
2332
- }
2333
- });
2334
- Matrix4.prototype.clone = function(result) {
2335
- return Matrix4.clone(this, result);
2336
- };
2337
- Matrix4.prototype.equals = function(right) {
2338
- return Matrix4.equals(this, right);
2339
- };
2340
- Matrix4.equalsArray = function(matrix, array, offset) {
2341
- return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3] && matrix[4] === array[offset + 4] && matrix[5] === array[offset + 5] && matrix[6] === array[offset + 6] && matrix[7] === array[offset + 7] && matrix[8] === array[offset + 8] && matrix[9] === array[offset + 9] && matrix[10] === array[offset + 10] && matrix[11] === array[offset + 11] && matrix[12] === array[offset + 12] && matrix[13] === array[offset + 13] && matrix[14] === array[offset + 14] && matrix[15] === array[offset + 15];
2342
- };
2343
- Matrix4.prototype.equalsEpsilon = function(right, epsilon) {
2344
- return Matrix4.equalsEpsilon(this, right, epsilon);
2345
- };
2346
- Matrix4.prototype.toString = function() {
2347
- return `(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
2348
- (${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
2349
- (${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
2350
- (${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`;
2351
- };
2352
- var Matrix4_default = Matrix4;
2353
-
2354
- export {
2355
- Cartesian4_default,
2356
- Matrix4_default
2357
- };