@cesium/engine 21.0.1 → 22.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/zip-web-worker.js +10 -7
- package/Build/Workers/chunk-23T2IPHV.js +55 -0
- package/Build/Workers/{chunk-TGJQMEL4.js → chunk-2AM4E2WD.js} +2 -2
- package/Build/Workers/{chunk-4CORGH7N.js → chunk-2MWF4IES.js} +16 -14
- package/Build/Workers/{chunk-3RKX3UFI.js → chunk-2RCIRXNI.js} +1 -1
- package/Build/Workers/{chunk-LV3G32QE.js → chunk-3YTMGEXW.js} +5 -1424
- package/Build/Workers/{chunk-PJAA7QSC.js → chunk-4BHWJWS3.js} +6 -6
- package/Build/Workers/{chunk-FE565QHX.js → chunk-5JKH4AMT.js} +2 -2
- package/Build/Workers/{chunk-KZ7GDSAJ.js → chunk-6HKAPCSO.js} +1 -1
- package/Build/Workers/{chunk-VVALNLSH.js → chunk-A53R2F2L.js} +4 -4
- package/Build/Workers/{chunk-KVB73ECP.js → chunk-A6YFUGJO.js} +7 -7
- package/Build/Workers/{chunk-QNOIRRJK.js → chunk-AJYWXC6I.js} +4 -4
- package/Build/Workers/{chunk-UKA7OISV.js → chunk-AOIO5VUS.js} +282 -2284
- package/Build/Workers/{chunk-OBS5EMZ6.js → chunk-B7JRBTT6.js} +10 -10
- package/Build/Workers/{chunk-5YXA47QD.js → chunk-CHNDJRYA.js} +20 -18
- package/Build/Workers/{chunk-X3ZV3XNO.js → chunk-CJOV55CW.js} +20 -18
- package/Build/Workers/{chunk-W6I3LNPF.js → chunk-COGPE5Z2.js} +10 -8
- package/Build/Workers/{chunk-2QPH5QDK.js → chunk-CW7W27IZ.js} +14 -10
- package/Build/Workers/{chunk-MXOGBWMP.js → chunk-DICY26ID.js} +20 -16
- package/Build/Workers/{chunk-W6KMV4F5.js → chunk-DMEFNTUV.js} +69 -7
- package/Build/Workers/{chunk-T7HU6E7G.js → chunk-DQSJEOZY.js} +1 -1
- package/Build/Workers/{chunk-ASVODZNK.js → chunk-GDU4RZSZ.js} +16 -36
- package/Build/Workers/{chunk-MQPDOWGH.js → chunk-GKWOUMYA.js} +1 -1
- package/Build/Workers/{chunk-A2SP2EJZ.js → chunk-GTY4K4IA.js} +9 -7
- package/Build/Workers/{chunk-KEPPNSBL.js → chunk-H6Q7E4BQ.js} +8 -6
- package/Build/Workers/{chunk-JG3C3LPY.js → chunk-HHGOFZVQ.js} +7 -5
- package/Build/Workers/chunk-HXKUEOOD.js +352 -0
- package/Build/Workers/{chunk-UFSYRVC5.js → chunk-I4REFVXB.js} +4 -4
- package/Build/Workers/{chunk-LU7DLY2L.js → chunk-IL5F6WEE.js} +3 -3
- package/Build/Workers/{chunk-RVRN4KDB.js → chunk-JKXPC5HD.js} +2 -2
- package/Build/Workers/{chunk-CBPNIEGH.js → chunk-KKGD7HAW.js} +13 -11
- package/Build/Workers/{chunk-DTKSVIH5.js → chunk-KROSQJUA.js} +2 -2
- package/Build/Workers/{chunk-42EJCSIV.js → chunk-L4JLDVCM.js} +5 -5
- package/Build/Workers/{chunk-LPKJSIMD.js → chunk-LIYMRHGR.js} +15 -13
- package/Build/Workers/{chunk-J2XQVKVH.js → chunk-MKMZHRB3.js} +74 -35
- package/Build/Workers/{chunk-CSDYSXBI.js → chunk-MO25ZQ2I.js} +14 -12
- package/Build/Workers/{chunk-3YNW5K6O.js → chunk-O6RZEKHZ.js} +12 -12
- package/Build/Workers/{chunk-RR3NCT4R.js → chunk-OOCGX2OD.js} +4 -4
- package/Build/Workers/{chunk-XG54SG4O.js → chunk-OXFU5HNU.js} +13 -5
- package/Build/Workers/{chunk-P2UKEFCK.js → chunk-P5CGIJUY.js} +2 -2
- package/Build/Workers/{chunk-DBHL2UVG.js → chunk-QEANVUGT.js} +2 -2
- package/Build/Workers/{chunk-2SI7DEW5.js → chunk-QFBCIX7J.js} +8 -6
- package/Build/Workers/{chunk-DDXI6UYW.js → chunk-QUAH3XOT.js} +4 -4
- package/Build/Workers/{chunk-PZUZCAX3.js → chunk-RXZDTDIY.js} +13 -9
- package/Build/Workers/{chunk-YZ3RCE45.js → chunk-SPA2KPH3.js} +14 -12
- package/Build/Workers/chunk-TDSVSW5A.js +1460 -0
- package/Build/Workers/{chunk-G3CKZ34K.js → chunk-UG2DPFOL.js} +8 -6
- package/Build/Workers/{chunk-IKUOV6DO.js → chunk-URGEDZBS.js} +7 -7
- package/Build/Workers/{chunk-U2GR5FDL.js → chunk-V35NQOJC.js} +21 -11
- package/Build/Workers/chunk-W4XUEDU5.js +2058 -0
- package/Build/Workers/chunk-WB4TSSBQ.js +3514 -0
- package/Build/Workers/{chunk-EBDZDBJN.js → chunk-WTLYD4FE.js} +19 -15
- package/Build/Workers/{chunk-WQZL6CA2.js → chunk-Y4ALZ4SS.js} +9 -7
- package/Build/Workers/{chunk-DAJKOQW6.js → chunk-YF2NVO5B.js} +19 -13
- package/Build/Workers/{chunk-XJVRYJVZ.js → chunk-YSYSXSHF.js} +1 -1
- package/Build/Workers/{chunk-YNOVMSUX.js → chunk-YX562XOB.js} +15 -11
- package/Build/Workers/{chunk-J3KPR6DJ.js → chunk-YZWA5B4R.js} +15 -13
- package/Build/Workers/{chunk-NYYQZ3LH.js → chunk-Z6DFT4D3.js} +15 -11
- package/Build/Workers/combineGeometry.js +24 -21
- package/Build/Workers/createBoxGeometry.js +18 -15
- package/Build/Workers/createBoxOutlineGeometry.js +16 -13
- package/Build/Workers/createCircleGeometry.js +28 -24
- package/Build/Workers/createCircleOutlineGeometry.js +21 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +35 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -29
- package/Build/Workers/createCorridorGeometry.js +32 -28
- package/Build/Workers/createCorridorOutlineGeometry.js +30 -26
- package/Build/Workers/createCylinderGeometry.js +20 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +20 -16
- package/Build/Workers/createEllipseGeometry.js +28 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +21 -17
- package/Build/Workers/createEllipsoidGeometry.js +19 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -15
- package/Build/Workers/createFrustumGeometry.js +18 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -15
- package/Build/Workers/createGeometry.js +28 -22
- package/Build/Workers/createGroundPolylineGeometry.js +25 -21
- package/Build/Workers/createPlaneGeometry.js +16 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -12
- package/Build/Workers/createPolygonGeometry.js +35 -31
- package/Build/Workers/createPolygonOutlineGeometry.js +32 -28
- package/Build/Workers/createPolylineGeometry.js +27 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +33 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +29 -25
- package/Build/Workers/createRectangleGeometry.js +30 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +23 -19
- package/Build/Workers/createSimplePolylineGeometry.js +25 -21
- package/Build/Workers/createSphereGeometry.js +19 -16
- package/Build/Workers/createSphereOutlineGeometry.js +18 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +16 -13
- package/Build/Workers/createVectorTileGeometries.js +24 -21
- package/Build/Workers/createVectorTilePoints.js +15 -12
- package/Build/Workers/createVectorTilePolygons.js +24 -20
- package/Build/Workers/createVectorTilePolylines.js +16 -13
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +91 -0
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +28 -23
- package/Build/Workers/createVerticesFromHeightmap.js +28 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +26 -279
- package/Build/Workers/createWallGeometry.js +26 -22
- package/Build/Workers/createWallOutlineGeometry.js +25 -21
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +13 -11
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +121 -0
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +24 -20
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +95 -0
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +2 -2
- package/Source/Core/AxisAlignedBoundingBox.js +36 -0
- package/Source/Core/Cesium3DTilesTerrainData.js +932 -0
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +1868 -0
- package/Source/Core/Cesium3DTilesTerrainProvider.js +1052 -0
- package/Source/Core/CesiumTerrainProvider.js +2 -2
- package/Source/Core/Color.js +23 -6
- package/Source/Core/EllipsoidalOccluder.js +2 -2
- package/Source/Core/FeatureDetection.js +0 -2
- package/Source/Core/GoogleEarthEnterpriseMetadata.js +1 -1
- package/Source/Core/GoogleEarthEnterpriseTerrainData.js +2 -1
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
- package/Source/Core/HeightmapTerrainData.js +12 -22
- package/Source/Core/HilbertOrder.js +0 -6
- package/Source/Core/ITwinPlatform.js +6 -6
- package/Source/Core/IntersectionTests.js +80 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +35 -27
- package/Source/Core/PixelFormat.js +2 -2
- package/Source/Core/QuantizedMeshTerrainData.js +24 -57
- package/Source/Core/Resource.js +15 -11
- package/Source/Core/S2Cell.js +6 -18
- package/Source/Core/TaskProcessor.js +1 -1
- package/Source/Core/TerrainData.js +2 -1
- package/Source/Core/TerrainEncoding.js +215 -38
- package/Source/Core/TerrainMesh.js +215 -8
- package/Source/Core/TerrainPicker.js +607 -0
- package/Source/Core/TerrainProvider.js +151 -0
- package/Source/Core/TexturePacker.js +27 -12
- package/Source/Core/Transforms.js +28 -19
- package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
- package/Source/Core/binarySearch.js +1 -1
- package/Source/Core/createWorldBathymetryAsync.js +2 -2
- package/Source/Core/createWorldTerrainAsync.js +3 -3
- package/Source/Core/loadImageFromTypedArray.js +9 -3
- package/Source/Core/mergeSort.js +1 -1
- package/Source/DataSources/BillboardGraphics.js +1 -1
- package/Source/DataSources/BillboardVisualizer.js +7 -4
- package/Source/DataSources/PropertyArray.js +2 -2
- package/Source/Renderer/AutomaticUniforms.js +61 -0
- package/Source/Renderer/Buffer.js +32 -0
- package/Source/Renderer/BufferUsage.js +3 -1
- package/Source/Renderer/Context.js +98 -14
- package/Source/Renderer/Pass.js +10 -9
- package/Source/Renderer/Sync.js +104 -0
- package/Source/Renderer/TextureAtlas.js +67 -27
- package/Source/Renderer/UniformState.js +12 -0
- package/Source/Renderer/VertexArray.js +1 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +1 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +99 -13
- package/Source/Scene/BatchTable.js +2 -2
- package/Source/Scene/Billboard.js +75 -28
- package/Source/Scene/BillboardCollection.js +24 -15
- package/Source/Scene/BillboardTexture.js +56 -7
- package/Source/Scene/BingMapsImageryProvider.js +1 -1
- package/Source/Scene/BoundingVolumeSemantics.js +54 -62
- package/Source/Scene/Cesium3DTile.js +3 -3
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +1 -1
- package/Source/Scene/Cesium3DTileset.js +1 -1
- package/Source/Scene/EdgeFramebuffer.js +245 -0
- package/Source/Scene/FrameState.js +12 -0
- package/Source/Scene/GaussianSplat3DTileContent.js +12 -16
- package/Source/Scene/GaussianSplatPrimitive.js +12 -8
- package/Source/Scene/GaussianSplatSorter.js +2 -2
- package/Source/Scene/Globe.js +4 -2
- package/Source/Scene/GlobeSurfaceTile.js +28 -70
- package/Source/Scene/GlobeSurfaceTileProvider.js +11 -0
- package/Source/Scene/GltfBufferViewLoader.js +18 -0
- package/Source/Scene/GltfLoader.js +46 -8
- package/Source/Scene/Google2DImageryProvider.js +48 -41
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SDecoder.js +3 -3
- package/Source/Scene/ITwinData.js +4 -4
- package/Source/Scene/ImageryLayer.js +1 -1
- package/Source/Scene/Implicit3DTileContent.js +18 -7
- package/Source/Scene/ImplicitSubtree.js +3 -3
- package/Source/Scene/ImplicitTileset.js +2 -2
- package/Source/Scene/IonImageryProvider.js +15 -84
- package/Source/Scene/IonImageryProviderFactory.js +194 -0
- package/Source/Scene/LabelCollection.js +54 -36
- package/Source/Scene/MetadataComponentType.js +5 -5
- package/Source/Scene/MetadataTableProperty.js +3 -9
- package/Source/Scene/Model/EdgeDetectionPipelineStage.js +42 -0
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +800 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +7 -7
- package/Source/Scene/Model/ModelDrawCommand.js +69 -0
- package/Source/Scene/Model/ModelImagery.js +4 -0
- package/Source/Scene/Model/ModelRuntimeNode.js +2 -2
- package/Source/Scene/Model/ModelRuntimePrimitive.js +13 -2
- package/Source/Scene/Model/ModelSceneGraph.js +15 -3
- package/Source/Scene/Model/ModelUtility.js +0 -1
- package/Source/Scene/Model/NodeRenderResources.js +1 -1
- package/Source/Scene/Model/PrimitiveRenderResources.js +1 -1
- package/Source/Scene/OIT.js +11 -1
- package/Source/Scene/PickFramebuffer.js +134 -50
- package/Source/Scene/Picking.js +195 -89
- package/Source/Scene/QuadtreePrimitive.js +34 -26
- package/Source/Scene/QuadtreeTile.js +66 -46
- package/Source/Scene/ResourceLoaderState.js +1 -1
- package/Source/Scene/Scene.js +160 -16
- package/Source/Scene/ScreenSpaceCameraController.js +1 -1
- package/Source/Scene/SensorVolumePortionToDisplay.js +6 -6
- package/Source/Scene/SingleTileImageryProvider.js +3 -3
- package/Source/Scene/Terrain.js +5 -5
- package/Source/Scene/TerrainFillMesh.js +1 -0
- package/Source/Scene/TileMapServiceImageryProvider.js +2 -2
- package/Source/Scene/UrlTemplateImageryProvider.js +1 -1
- package/Source/Scene/View.js +3 -0
- package/Source/Scene/VoxelPrimitive.js +196 -189
- package/Source/Scene/VoxelShape.js +2 -0
- package/Source/Scene/createWorldImageryAsync.js +1 -1
- package/Source/Shaders/BillboardCollectionFS.glsl +115 -62
- package/Source/Shaders/BillboardCollectionFS.js +115 -63
- package/Source/Shaders/BillboardCollectionVS.glsl +44 -37
- package/Source/Shaders/BillboardCollectionVS.js +45 -38
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.glsl +10 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.js +12 -0
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/GlobeVS.glsl +1 -1
- package/Source/Shaders/GlobeVS.js +1 -1
- package/Source/Shaders/Model/EdgeDetectionStageFS.glsl +58 -0
- package/Source/Shaders/Model/EdgeDetectionStageFS.js +60 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +83 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.js +85 -0
- package/Source/Shaders/Model/ModelFS.glsl +5 -0
- package/Source/Shaders/Model/ModelFS.js +5 -0
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +0 -1
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +0 -1
- package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +7 -15
- package/Source/Shaders/ShadowVolumeAppearanceFS.js +7 -15
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Workers/createVerticesFromCesium3DTilesTerrain.js +46 -0
- package/Source/Workers/incrementallyBuildTerrainPicker.js +108 -0
- package/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +55 -0
- package/index.d.ts +488 -31
- package/index.js +202 -190
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.
|
|
4
|
+
* Version 1.136.0
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
|
7
7
|
*
|
|
@@ -23,31 +23,37 @@
|
|
|
23
23
|
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
import {
|
|
27
|
+
Cartesian4_default,
|
|
28
|
+
Matrix4_default
|
|
29
|
+
} from "./chunk-W4XUEDU5.js";
|
|
30
|
+
import {
|
|
31
|
+
RuntimeError_default
|
|
32
|
+
} from "./chunk-5JKH4AMT.js";
|
|
26
33
|
import {
|
|
27
34
|
Cartesian2_default,
|
|
28
|
-
Cartesian3_default,
|
|
29
35
|
Cartographic_default,
|
|
30
36
|
Ellipsoid_default,
|
|
31
|
-
FeatureDetection_default
|
|
37
|
+
FeatureDetection_default
|
|
38
|
+
} from "./chunk-TDSVSW5A.js";
|
|
39
|
+
import {
|
|
40
|
+
Cartesian3_default,
|
|
32
41
|
Frozen_default,
|
|
33
42
|
Matrix3_default
|
|
34
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-3YTMGEXW.js";
|
|
35
44
|
import {
|
|
36
45
|
Math_default
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import {
|
|
39
|
-
RuntimeError_default
|
|
40
|
-
} from "./chunk-FE565QHX.js";
|
|
46
|
+
} from "./chunk-IL5F6WEE.js";
|
|
41
47
|
import {
|
|
42
48
|
Check_default,
|
|
43
49
|
DeveloperError_default
|
|
44
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-QEANVUGT.js";
|
|
45
51
|
import {
|
|
46
52
|
__commonJS,
|
|
47
53
|
__require,
|
|
48
54
|
__toESM,
|
|
49
55
|
defined_default
|
|
50
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-2RCIRXNI.js";
|
|
51
57
|
|
|
52
58
|
// node_modules/urijs/src/punycode.js
|
|
53
59
|
var require_punycode = __commonJS({
|
|
@@ -2294,2234 +2300,224 @@ var require_URI = __commonJS({
|
|
|
2294
2300
|
this.query(URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace));
|
|
2295
2301
|
}
|
|
2296
2302
|
this.build(!build);
|
|
2297
|
-
}
|
|
2298
|
-
return this;
|
|
2299
|
-
};
|
|
2300
|
-
p.normalizeFragment = function(build) {
|
|
2301
|
-
if (!this._parts.fragment) {
|
|
2302
|
-
this._parts.fragment = null;
|
|
2303
|
-
this.build(!build);
|
|
2304
|
-
}
|
|
2305
|
-
return this;
|
|
2306
|
-
};
|
|
2307
|
-
p.normalizeSearch = p.normalizeQuery;
|
|
2308
|
-
p.normalizeHash = p.normalizeFragment;
|
|
2309
|
-
p.iso8859 = function() {
|
|
2310
|
-
var e = URI.encode;
|
|
2311
|
-
var d = URI.decode;
|
|
2312
|
-
URI.encode = escape;
|
|
2313
|
-
URI.decode = decodeURIComponent;
|
|
2314
|
-
try {
|
|
2315
|
-
this.normalize();
|
|
2316
|
-
} finally {
|
|
2317
|
-
URI.encode = e;
|
|
2318
|
-
URI.decode = d;
|
|
2319
|
-
}
|
|
2320
|
-
return this;
|
|
2321
|
-
};
|
|
2322
|
-
p.unicode = function() {
|
|
2323
|
-
var e = URI.encode;
|
|
2324
|
-
var d = URI.decode;
|
|
2325
|
-
URI.encode = strictEncodeURIComponent;
|
|
2326
|
-
URI.decode = unescape;
|
|
2327
|
-
try {
|
|
2328
|
-
this.normalize();
|
|
2329
|
-
} finally {
|
|
2330
|
-
URI.encode = e;
|
|
2331
|
-
URI.decode = d;
|
|
2332
|
-
}
|
|
2333
|
-
return this;
|
|
2334
|
-
};
|
|
2335
|
-
p.readable = function() {
|
|
2336
|
-
var uri = this.clone();
|
|
2337
|
-
uri.username("").password("").normalize();
|
|
2338
|
-
var t = "";
|
|
2339
|
-
if (uri._parts.protocol) {
|
|
2340
|
-
t += uri._parts.protocol + "://";
|
|
2341
|
-
}
|
|
2342
|
-
if (uri._parts.hostname) {
|
|
2343
|
-
if (uri.is("punycode") && punycode) {
|
|
2344
|
-
t += punycode.toUnicode(uri._parts.hostname);
|
|
2345
|
-
if (uri._parts.port) {
|
|
2346
|
-
t += ":" + uri._parts.port;
|
|
2347
|
-
}
|
|
2348
|
-
} else {
|
|
2349
|
-
t += uri.host();
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
if (uri._parts.hostname && uri._parts.path && uri._parts.path.charAt(0) !== "/") {
|
|
2353
|
-
t += "/";
|
|
2354
|
-
}
|
|
2355
|
-
t += uri.path(true);
|
|
2356
|
-
if (uri._parts.query) {
|
|
2357
|
-
var q2 = "";
|
|
2358
|
-
for (var i = 0, qp = uri._parts.query.split("&"), l = qp.length; i < l; i++) {
|
|
2359
|
-
var kv = (qp[i] || "").split("=");
|
|
2360
|
-
q2 += "&" + URI.decodeQuery(kv[0], this._parts.escapeQuerySpace).replace(/&/g, "%26");
|
|
2361
|
-
if (kv[1] !== void 0) {
|
|
2362
|
-
q2 += "=" + URI.decodeQuery(kv[1], this._parts.escapeQuerySpace).replace(/&/g, "%26");
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
t += "?" + q2.substring(1);
|
|
2366
|
-
}
|
|
2367
|
-
t += URI.decodeQuery(uri.hash(), true);
|
|
2368
|
-
return t;
|
|
2369
|
-
};
|
|
2370
|
-
p.absoluteTo = function(base) {
|
|
2371
|
-
var resolved = this.clone();
|
|
2372
|
-
var properties = ["protocol", "username", "password", "hostname", "port"];
|
|
2373
|
-
var basedir, i, p2;
|
|
2374
|
-
if (this._parts.urn) {
|
|
2375
|
-
throw new Error("URNs do not have any generally defined hierarchical components");
|
|
2376
|
-
}
|
|
2377
|
-
if (!(base instanceof URI)) {
|
|
2378
|
-
base = new URI(base);
|
|
2379
|
-
}
|
|
2380
|
-
if (resolved._parts.protocol) {
|
|
2381
|
-
return resolved;
|
|
2382
|
-
} else {
|
|
2383
|
-
resolved._parts.protocol = base._parts.protocol;
|
|
2384
|
-
}
|
|
2385
|
-
if (this._parts.hostname) {
|
|
2386
|
-
return resolved;
|
|
2387
|
-
}
|
|
2388
|
-
for (i = 0; p2 = properties[i]; i++) {
|
|
2389
|
-
resolved._parts[p2] = base._parts[p2];
|
|
2390
|
-
}
|
|
2391
|
-
if (!resolved._parts.path) {
|
|
2392
|
-
resolved._parts.path = base._parts.path;
|
|
2393
|
-
if (!resolved._parts.query) {
|
|
2394
|
-
resolved._parts.query = base._parts.query;
|
|
2395
|
-
}
|
|
2396
|
-
} else {
|
|
2397
|
-
if (resolved._parts.path.substring(-2) === "..") {
|
|
2398
|
-
resolved._parts.path += "/";
|
|
2399
|
-
}
|
|
2400
|
-
if (resolved.path().charAt(0) !== "/") {
|
|
2401
|
-
basedir = base.directory();
|
|
2402
|
-
basedir = basedir ? basedir : base.path().indexOf("/") === 0 ? "/" : "";
|
|
2403
|
-
resolved._parts.path = (basedir ? basedir + "/" : "") + resolved._parts.path;
|
|
2404
|
-
resolved.normalizePath();
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
resolved.build();
|
|
2408
|
-
return resolved;
|
|
2409
|
-
};
|
|
2410
|
-
p.relativeTo = function(base) {
|
|
2411
|
-
var relative = this.clone().normalize();
|
|
2412
|
-
var relativeParts, baseParts, common, relativePath, basePath;
|
|
2413
|
-
if (relative._parts.urn) {
|
|
2414
|
-
throw new Error("URNs do not have any generally defined hierarchical components");
|
|
2415
|
-
}
|
|
2416
|
-
base = new URI(base).normalize();
|
|
2417
|
-
relativeParts = relative._parts;
|
|
2418
|
-
baseParts = base._parts;
|
|
2419
|
-
relativePath = relative.path();
|
|
2420
|
-
basePath = base.path();
|
|
2421
|
-
if (relativePath.charAt(0) !== "/") {
|
|
2422
|
-
throw new Error("URI is already relative");
|
|
2423
|
-
}
|
|
2424
|
-
if (basePath.charAt(0) !== "/") {
|
|
2425
|
-
throw new Error("Cannot calculate a URI relative to another relative URI");
|
|
2426
|
-
}
|
|
2427
|
-
if (relativeParts.protocol === baseParts.protocol) {
|
|
2428
|
-
relativeParts.protocol = null;
|
|
2429
|
-
}
|
|
2430
|
-
if (relativeParts.username !== baseParts.username || relativeParts.password !== baseParts.password) {
|
|
2431
|
-
return relative.build();
|
|
2432
|
-
}
|
|
2433
|
-
if (relativeParts.protocol !== null || relativeParts.username !== null || relativeParts.password !== null) {
|
|
2434
|
-
return relative.build();
|
|
2435
|
-
}
|
|
2436
|
-
if (relativeParts.hostname === baseParts.hostname && relativeParts.port === baseParts.port) {
|
|
2437
|
-
relativeParts.hostname = null;
|
|
2438
|
-
relativeParts.port = null;
|
|
2439
|
-
} else {
|
|
2440
|
-
return relative.build();
|
|
2441
|
-
}
|
|
2442
|
-
if (relativePath === basePath) {
|
|
2443
|
-
relativeParts.path = "";
|
|
2444
|
-
return relative.build();
|
|
2445
|
-
}
|
|
2446
|
-
common = URI.commonPath(relativePath, basePath);
|
|
2447
|
-
if (!common) {
|
|
2448
|
-
return relative.build();
|
|
2449
|
-
}
|
|
2450
|
-
var parents = baseParts.path.substring(common.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../");
|
|
2451
|
-
relativeParts.path = parents + relativeParts.path.substring(common.length) || "./";
|
|
2452
|
-
return relative.build();
|
|
2453
|
-
};
|
|
2454
|
-
p.equals = function(uri) {
|
|
2455
|
-
var one = this.clone();
|
|
2456
|
-
var two = new URI(uri);
|
|
2457
|
-
var one_map = {};
|
|
2458
|
-
var two_map = {};
|
|
2459
|
-
var checked = {};
|
|
2460
|
-
var one_query, two_query, key;
|
|
2461
|
-
one.normalize();
|
|
2462
|
-
two.normalize();
|
|
2463
|
-
if (one.toString() === two.toString()) {
|
|
2464
|
-
return true;
|
|
2465
|
-
}
|
|
2466
|
-
one_query = one.query();
|
|
2467
|
-
two_query = two.query();
|
|
2468
|
-
one.query("");
|
|
2469
|
-
two.query("");
|
|
2470
|
-
if (one.toString() !== two.toString()) {
|
|
2471
|
-
return false;
|
|
2472
|
-
}
|
|
2473
|
-
if (one_query.length !== two_query.length) {
|
|
2474
|
-
return false;
|
|
2475
|
-
}
|
|
2476
|
-
one_map = URI.parseQuery(one_query, this._parts.escapeQuerySpace);
|
|
2477
|
-
two_map = URI.parseQuery(two_query, this._parts.escapeQuerySpace);
|
|
2478
|
-
for (key in one_map) {
|
|
2479
|
-
if (hasOwn.call(one_map, key)) {
|
|
2480
|
-
if (!isArray(one_map[key])) {
|
|
2481
|
-
if (one_map[key] !== two_map[key]) {
|
|
2482
|
-
return false;
|
|
2483
|
-
}
|
|
2484
|
-
} else if (!arraysEqual(one_map[key], two_map[key])) {
|
|
2485
|
-
return false;
|
|
2486
|
-
}
|
|
2487
|
-
checked[key] = true;
|
|
2488
|
-
}
|
|
2489
|
-
}
|
|
2490
|
-
for (key in two_map) {
|
|
2491
|
-
if (hasOwn.call(two_map, key)) {
|
|
2492
|
-
if (!checked[key]) {
|
|
2493
|
-
return false;
|
|
2494
|
-
}
|
|
2495
|
-
}
|
|
2496
|
-
}
|
|
2497
|
-
return true;
|
|
2498
|
-
};
|
|
2499
|
-
p.preventInvalidHostname = function(v2) {
|
|
2500
|
-
this._parts.preventInvalidHostname = !!v2;
|
|
2501
|
-
return this;
|
|
2502
|
-
};
|
|
2503
|
-
p.duplicateQueryParameters = function(v2) {
|
|
2504
|
-
this._parts.duplicateQueryParameters = !!v2;
|
|
2505
|
-
return this;
|
|
2506
|
-
};
|
|
2507
|
-
p.escapeQuerySpace = function(v2) {
|
|
2508
|
-
this._parts.escapeQuerySpace = !!v2;
|
|
2509
|
-
return this;
|
|
2510
|
-
};
|
|
2511
|
-
return URI;
|
|
2512
|
-
});
|
|
2513
|
-
}
|
|
2514
|
-
});
|
|
2515
|
-
|
|
2516
|
-
// packages/engine/Source/Core/Cartesian4.js
|
|
2517
|
-
function Cartesian4(x, y, z, w) {
|
|
2518
|
-
this.x = x ?? 0;
|
|
2519
|
-
this.y = y ?? 0;
|
|
2520
|
-
this.z = z ?? 0;
|
|
2521
|
-
this.w = w ?? 0;
|
|
2522
|
-
}
|
|
2523
|
-
Cartesian4.fromElements = function(x, y, z, w, result) {
|
|
2524
|
-
if (!defined_default(result)) {
|
|
2525
|
-
return new Cartesian4(x, y, z, w);
|
|
2526
|
-
}
|
|
2527
|
-
result.x = x;
|
|
2528
|
-
result.y = y;
|
|
2529
|
-
result.z = z;
|
|
2530
|
-
result.w = w;
|
|
2531
|
-
return result;
|
|
2532
|
-
};
|
|
2533
|
-
Cartesian4.fromColor = function(color, result) {
|
|
2534
|
-
Check_default.typeOf.object("color", color);
|
|
2535
|
-
if (!defined_default(result)) {
|
|
2536
|
-
return new Cartesian4(color.red, color.green, color.blue, color.alpha);
|
|
2537
|
-
}
|
|
2538
|
-
result.x = color.red;
|
|
2539
|
-
result.y = color.green;
|
|
2540
|
-
result.z = color.blue;
|
|
2541
|
-
result.w = color.alpha;
|
|
2542
|
-
return result;
|
|
2543
|
-
};
|
|
2544
|
-
Cartesian4.clone = function(cartesian, result) {
|
|
2545
|
-
if (!defined_default(cartesian)) {
|
|
2546
|
-
return void 0;
|
|
2547
|
-
}
|
|
2548
|
-
if (!defined_default(result)) {
|
|
2549
|
-
return new Cartesian4(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
|
2550
|
-
}
|
|
2551
|
-
result.x = cartesian.x;
|
|
2552
|
-
result.y = cartesian.y;
|
|
2553
|
-
result.z = cartesian.z;
|
|
2554
|
-
result.w = cartesian.w;
|
|
2555
|
-
return result;
|
|
2556
|
-
};
|
|
2557
|
-
Cartesian4.packedLength = 4;
|
|
2558
|
-
Cartesian4.pack = function(value, array, startingIndex) {
|
|
2559
|
-
Check_default.typeOf.object("value", value);
|
|
2560
|
-
Check_default.defined("array", array);
|
|
2561
|
-
startingIndex = startingIndex ?? 0;
|
|
2562
|
-
array[startingIndex++] = value.x;
|
|
2563
|
-
array[startingIndex++] = value.y;
|
|
2564
|
-
array[startingIndex++] = value.z;
|
|
2565
|
-
array[startingIndex] = value.w;
|
|
2566
|
-
return array;
|
|
2567
|
-
};
|
|
2568
|
-
Cartesian4.unpack = function(array, startingIndex, result) {
|
|
2569
|
-
Check_default.defined("array", array);
|
|
2570
|
-
startingIndex = startingIndex ?? 0;
|
|
2571
|
-
if (!defined_default(result)) {
|
|
2572
|
-
result = new Cartesian4();
|
|
2573
|
-
}
|
|
2574
|
-
result.x = array[startingIndex++];
|
|
2575
|
-
result.y = array[startingIndex++];
|
|
2576
|
-
result.z = array[startingIndex++];
|
|
2577
|
-
result.w = array[startingIndex];
|
|
2578
|
-
return result;
|
|
2579
|
-
};
|
|
2580
|
-
Cartesian4.packArray = function(array, result) {
|
|
2581
|
-
Check_default.defined("array", array);
|
|
2582
|
-
const length = array.length;
|
|
2583
|
-
const resultLength = length * 4;
|
|
2584
|
-
if (!defined_default(result)) {
|
|
2585
|
-
result = new Array(resultLength);
|
|
2586
|
-
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
2587
|
-
throw new DeveloperError_default(
|
|
2588
|
-
"If result is a typed array, it must have exactly array.length * 4 elements"
|
|
2589
|
-
);
|
|
2590
|
-
} else if (result.length !== resultLength) {
|
|
2591
|
-
result.length = resultLength;
|
|
2592
|
-
}
|
|
2593
|
-
for (let i = 0; i < length; ++i) {
|
|
2594
|
-
Cartesian4.pack(array[i], result, i * 4);
|
|
2595
|
-
}
|
|
2596
|
-
return result;
|
|
2597
|
-
};
|
|
2598
|
-
Cartesian4.unpackArray = function(array, result) {
|
|
2599
|
-
Check_default.defined("array", array);
|
|
2600
|
-
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
|
|
2601
|
-
if (array.length % 4 !== 0) {
|
|
2602
|
-
throw new DeveloperError_default("array length must be a multiple of 4.");
|
|
2603
|
-
}
|
|
2604
|
-
const length = array.length;
|
|
2605
|
-
if (!defined_default(result)) {
|
|
2606
|
-
result = new Array(length / 4);
|
|
2607
|
-
} else {
|
|
2608
|
-
result.length = length / 4;
|
|
2609
|
-
}
|
|
2610
|
-
for (let i = 0; i < length; i += 4) {
|
|
2611
|
-
const index = i / 4;
|
|
2612
|
-
result[index] = Cartesian4.unpack(array, i, result[index]);
|
|
2613
|
-
}
|
|
2614
|
-
return result;
|
|
2615
|
-
};
|
|
2616
|
-
Cartesian4.fromArray = Cartesian4.unpack;
|
|
2617
|
-
Cartesian4.maximumComponent = function(cartesian) {
|
|
2618
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2619
|
-
return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
|
2620
|
-
};
|
|
2621
|
-
Cartesian4.minimumComponent = function(cartesian) {
|
|
2622
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2623
|
-
return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
|
|
2624
|
-
};
|
|
2625
|
-
Cartesian4.minimumByComponent = function(first, second, result) {
|
|
2626
|
-
Check_default.typeOf.object("first", first);
|
|
2627
|
-
Check_default.typeOf.object("second", second);
|
|
2628
|
-
Check_default.typeOf.object("result", result);
|
|
2629
|
-
result.x = Math.min(first.x, second.x);
|
|
2630
|
-
result.y = Math.min(first.y, second.y);
|
|
2631
|
-
result.z = Math.min(first.z, second.z);
|
|
2632
|
-
result.w = Math.min(first.w, second.w);
|
|
2633
|
-
return result;
|
|
2634
|
-
};
|
|
2635
|
-
Cartesian4.maximumByComponent = function(first, second, result) {
|
|
2636
|
-
Check_default.typeOf.object("first", first);
|
|
2637
|
-
Check_default.typeOf.object("second", second);
|
|
2638
|
-
Check_default.typeOf.object("result", result);
|
|
2639
|
-
result.x = Math.max(first.x, second.x);
|
|
2640
|
-
result.y = Math.max(first.y, second.y);
|
|
2641
|
-
result.z = Math.max(first.z, second.z);
|
|
2642
|
-
result.w = Math.max(first.w, second.w);
|
|
2643
|
-
return result;
|
|
2644
|
-
};
|
|
2645
|
-
Cartesian4.clamp = function(value, min, max, result) {
|
|
2646
|
-
Check_default.typeOf.object("value", value);
|
|
2647
|
-
Check_default.typeOf.object("min", min);
|
|
2648
|
-
Check_default.typeOf.object("max", max);
|
|
2649
|
-
Check_default.typeOf.object("result", result);
|
|
2650
|
-
const x = Math_default.clamp(value.x, min.x, max.x);
|
|
2651
|
-
const y = Math_default.clamp(value.y, min.y, max.y);
|
|
2652
|
-
const z = Math_default.clamp(value.z, min.z, max.z);
|
|
2653
|
-
const w = Math_default.clamp(value.w, min.w, max.w);
|
|
2654
|
-
result.x = x;
|
|
2655
|
-
result.y = y;
|
|
2656
|
-
result.z = z;
|
|
2657
|
-
result.w = w;
|
|
2658
|
-
return result;
|
|
2659
|
-
};
|
|
2660
|
-
Cartesian4.magnitudeSquared = function(cartesian) {
|
|
2661
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2662
|
-
return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w;
|
|
2663
|
-
};
|
|
2664
|
-
Cartesian4.magnitude = function(cartesian) {
|
|
2665
|
-
return Math.sqrt(Cartesian4.magnitudeSquared(cartesian));
|
|
2666
|
-
};
|
|
2667
|
-
var distanceScratch = new Cartesian4();
|
|
2668
|
-
Cartesian4.distance = function(left, right) {
|
|
2669
|
-
Check_default.typeOf.object("left", left);
|
|
2670
|
-
Check_default.typeOf.object("right", right);
|
|
2671
|
-
Cartesian4.subtract(left, right, distanceScratch);
|
|
2672
|
-
return Cartesian4.magnitude(distanceScratch);
|
|
2673
|
-
};
|
|
2674
|
-
Cartesian4.distanceSquared = function(left, right) {
|
|
2675
|
-
Check_default.typeOf.object("left", left);
|
|
2676
|
-
Check_default.typeOf.object("right", right);
|
|
2677
|
-
Cartesian4.subtract(left, right, distanceScratch);
|
|
2678
|
-
return Cartesian4.magnitudeSquared(distanceScratch);
|
|
2679
|
-
};
|
|
2680
|
-
Cartesian4.normalize = function(cartesian, result) {
|
|
2681
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2682
|
-
Check_default.typeOf.object("result", result);
|
|
2683
|
-
const magnitude = Cartesian4.magnitude(cartesian);
|
|
2684
|
-
result.x = cartesian.x / magnitude;
|
|
2685
|
-
result.y = cartesian.y / magnitude;
|
|
2686
|
-
result.z = cartesian.z / magnitude;
|
|
2687
|
-
result.w = cartesian.w / magnitude;
|
|
2688
|
-
if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z) || isNaN(result.w)) {
|
|
2689
|
-
throw new DeveloperError_default("normalized result is not a number");
|
|
2690
|
-
}
|
|
2691
|
-
return result;
|
|
2692
|
-
};
|
|
2693
|
-
Cartesian4.dot = function(left, right) {
|
|
2694
|
-
Check_default.typeOf.object("left", left);
|
|
2695
|
-
Check_default.typeOf.object("right", right);
|
|
2696
|
-
return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
|
|
2697
|
-
};
|
|
2698
|
-
Cartesian4.multiplyComponents = function(left, right, result) {
|
|
2699
|
-
Check_default.typeOf.object("left", left);
|
|
2700
|
-
Check_default.typeOf.object("right", right);
|
|
2701
|
-
Check_default.typeOf.object("result", result);
|
|
2702
|
-
result.x = left.x * right.x;
|
|
2703
|
-
result.y = left.y * right.y;
|
|
2704
|
-
result.z = left.z * right.z;
|
|
2705
|
-
result.w = left.w * right.w;
|
|
2706
|
-
return result;
|
|
2707
|
-
};
|
|
2708
|
-
Cartesian4.divideComponents = function(left, right, result) {
|
|
2709
|
-
Check_default.typeOf.object("left", left);
|
|
2710
|
-
Check_default.typeOf.object("right", right);
|
|
2711
|
-
Check_default.typeOf.object("result", result);
|
|
2712
|
-
result.x = left.x / right.x;
|
|
2713
|
-
result.y = left.y / right.y;
|
|
2714
|
-
result.z = left.z / right.z;
|
|
2715
|
-
result.w = left.w / right.w;
|
|
2716
|
-
return result;
|
|
2717
|
-
};
|
|
2718
|
-
Cartesian4.add = function(left, right, result) {
|
|
2719
|
-
Check_default.typeOf.object("left", left);
|
|
2720
|
-
Check_default.typeOf.object("right", right);
|
|
2721
|
-
Check_default.typeOf.object("result", result);
|
|
2722
|
-
result.x = left.x + right.x;
|
|
2723
|
-
result.y = left.y + right.y;
|
|
2724
|
-
result.z = left.z + right.z;
|
|
2725
|
-
result.w = left.w + right.w;
|
|
2726
|
-
return result;
|
|
2727
|
-
};
|
|
2728
|
-
Cartesian4.subtract = function(left, right, result) {
|
|
2729
|
-
Check_default.typeOf.object("left", left);
|
|
2730
|
-
Check_default.typeOf.object("right", right);
|
|
2731
|
-
Check_default.typeOf.object("result", result);
|
|
2732
|
-
result.x = left.x - right.x;
|
|
2733
|
-
result.y = left.y - right.y;
|
|
2734
|
-
result.z = left.z - right.z;
|
|
2735
|
-
result.w = left.w - right.w;
|
|
2736
|
-
return result;
|
|
2737
|
-
};
|
|
2738
|
-
Cartesian4.multiplyByScalar = function(cartesian, scalar, result) {
|
|
2739
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2740
|
-
Check_default.typeOf.number("scalar", scalar);
|
|
2741
|
-
Check_default.typeOf.object("result", result);
|
|
2742
|
-
result.x = cartesian.x * scalar;
|
|
2743
|
-
result.y = cartesian.y * scalar;
|
|
2744
|
-
result.z = cartesian.z * scalar;
|
|
2745
|
-
result.w = cartesian.w * scalar;
|
|
2746
|
-
return result;
|
|
2747
|
-
};
|
|
2748
|
-
Cartesian4.divideByScalar = function(cartesian, scalar, result) {
|
|
2749
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2750
|
-
Check_default.typeOf.number("scalar", scalar);
|
|
2751
|
-
Check_default.typeOf.object("result", result);
|
|
2752
|
-
result.x = cartesian.x / scalar;
|
|
2753
|
-
result.y = cartesian.y / scalar;
|
|
2754
|
-
result.z = cartesian.z / scalar;
|
|
2755
|
-
result.w = cartesian.w / scalar;
|
|
2756
|
-
return result;
|
|
2757
|
-
};
|
|
2758
|
-
Cartesian4.negate = function(cartesian, result) {
|
|
2759
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2760
|
-
Check_default.typeOf.object("result", result);
|
|
2761
|
-
result.x = -cartesian.x;
|
|
2762
|
-
result.y = -cartesian.y;
|
|
2763
|
-
result.z = -cartesian.z;
|
|
2764
|
-
result.w = -cartesian.w;
|
|
2765
|
-
return result;
|
|
2766
|
-
};
|
|
2767
|
-
Cartesian4.abs = function(cartesian, result) {
|
|
2768
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2769
|
-
Check_default.typeOf.object("result", result);
|
|
2770
|
-
result.x = Math.abs(cartesian.x);
|
|
2771
|
-
result.y = Math.abs(cartesian.y);
|
|
2772
|
-
result.z = Math.abs(cartesian.z);
|
|
2773
|
-
result.w = Math.abs(cartesian.w);
|
|
2774
|
-
return result;
|
|
2775
|
-
};
|
|
2776
|
-
var lerpScratch = new Cartesian4();
|
|
2777
|
-
Cartesian4.lerp = function(start, end, t, result) {
|
|
2778
|
-
Check_default.typeOf.object("start", start);
|
|
2779
|
-
Check_default.typeOf.object("end", end);
|
|
2780
|
-
Check_default.typeOf.number("t", t);
|
|
2781
|
-
Check_default.typeOf.object("result", result);
|
|
2782
|
-
Cartesian4.multiplyByScalar(end, t, lerpScratch);
|
|
2783
|
-
result = Cartesian4.multiplyByScalar(start, 1 - t, result);
|
|
2784
|
-
return Cartesian4.add(lerpScratch, result, result);
|
|
2785
|
-
};
|
|
2786
|
-
var mostOrthogonalAxisScratch = new Cartesian4();
|
|
2787
|
-
Cartesian4.mostOrthogonalAxis = function(cartesian, result) {
|
|
2788
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
2789
|
-
Check_default.typeOf.object("result", result);
|
|
2790
|
-
const f = Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch);
|
|
2791
|
-
Cartesian4.abs(f, f);
|
|
2792
|
-
if (f.x <= f.y) {
|
|
2793
|
-
if (f.x <= f.z) {
|
|
2794
|
-
if (f.x <= f.w) {
|
|
2795
|
-
result = Cartesian4.clone(Cartesian4.UNIT_X, result);
|
|
2796
|
-
} else {
|
|
2797
|
-
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
|
2798
|
-
}
|
|
2799
|
-
} else if (f.z <= f.w) {
|
|
2800
|
-
result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
|
|
2801
|
-
} else {
|
|
2802
|
-
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
|
2803
|
-
}
|
|
2804
|
-
} else if (f.y <= f.z) {
|
|
2805
|
-
if (f.y <= f.w) {
|
|
2806
|
-
result = Cartesian4.clone(Cartesian4.UNIT_Y, result);
|
|
2807
|
-
} else {
|
|
2808
|
-
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
|
2809
|
-
}
|
|
2810
|
-
} else if (f.z <= f.w) {
|
|
2811
|
-
result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
|
|
2812
|
-
} else {
|
|
2813
|
-
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
|
|
2814
|
-
}
|
|
2815
|
-
return result;
|
|
2816
|
-
};
|
|
2817
|
-
Cartesian4.equals = function(left, right) {
|
|
2818
|
-
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;
|
|
2819
|
-
};
|
|
2820
|
-
Cartesian4.equalsArray = function(cartesian, array, offset) {
|
|
2821
|
-
return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2] && cartesian.w === array[offset + 3];
|
|
2822
|
-
};
|
|
2823
|
-
Cartesian4.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
|
|
2824
|
-
return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
|
|
2825
|
-
left.x,
|
|
2826
|
-
right.x,
|
|
2827
|
-
relativeEpsilon,
|
|
2828
|
-
absoluteEpsilon
|
|
2829
|
-
) && Math_default.equalsEpsilon(
|
|
2830
|
-
left.y,
|
|
2831
|
-
right.y,
|
|
2832
|
-
relativeEpsilon,
|
|
2833
|
-
absoluteEpsilon
|
|
2834
|
-
) && Math_default.equalsEpsilon(
|
|
2835
|
-
left.z,
|
|
2836
|
-
right.z,
|
|
2837
|
-
relativeEpsilon,
|
|
2838
|
-
absoluteEpsilon
|
|
2839
|
-
) && Math_default.equalsEpsilon(
|
|
2840
|
-
left.w,
|
|
2841
|
-
right.w,
|
|
2842
|
-
relativeEpsilon,
|
|
2843
|
-
absoluteEpsilon
|
|
2844
|
-
);
|
|
2845
|
-
};
|
|
2846
|
-
Cartesian4.ZERO = Object.freeze(new Cartesian4(0, 0, 0, 0));
|
|
2847
|
-
Cartesian4.ONE = Object.freeze(new Cartesian4(1, 1, 1, 1));
|
|
2848
|
-
Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1, 0, 0, 0));
|
|
2849
|
-
Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0, 1, 0, 0));
|
|
2850
|
-
Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0, 0, 1, 0));
|
|
2851
|
-
Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0, 0, 0, 1));
|
|
2852
|
-
Cartesian4.prototype.clone = function(result) {
|
|
2853
|
-
return Cartesian4.clone(this, result);
|
|
2854
|
-
};
|
|
2855
|
-
Cartesian4.prototype.equals = function(right) {
|
|
2856
|
-
return Cartesian4.equals(this, right);
|
|
2857
|
-
};
|
|
2858
|
-
Cartesian4.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
|
|
2859
|
-
return Cartesian4.equalsEpsilon(
|
|
2860
|
-
this,
|
|
2861
|
-
right,
|
|
2862
|
-
relativeEpsilon,
|
|
2863
|
-
absoluteEpsilon
|
|
2864
|
-
);
|
|
2865
|
-
};
|
|
2866
|
-
Cartesian4.prototype.toString = function() {
|
|
2867
|
-
return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
|
|
2868
|
-
};
|
|
2869
|
-
var scratchF32Array = new Float32Array(1);
|
|
2870
|
-
var scratchU8Array = new Uint8Array(scratchF32Array.buffer);
|
|
2871
|
-
var testU32 = new Uint32Array([287454020]);
|
|
2872
|
-
var testU8 = new Uint8Array(testU32.buffer);
|
|
2873
|
-
var littleEndian = testU8[0] === 68;
|
|
2874
|
-
Cartesian4.packFloat = function(value, result) {
|
|
2875
|
-
Check_default.typeOf.number("value", value);
|
|
2876
|
-
if (!defined_default(result)) {
|
|
2877
|
-
result = new Cartesian4();
|
|
2878
|
-
}
|
|
2879
|
-
scratchF32Array[0] = value;
|
|
2880
|
-
if (littleEndian) {
|
|
2881
|
-
result.x = scratchU8Array[0];
|
|
2882
|
-
result.y = scratchU8Array[1];
|
|
2883
|
-
result.z = scratchU8Array[2];
|
|
2884
|
-
result.w = scratchU8Array[3];
|
|
2885
|
-
} else {
|
|
2886
|
-
result.x = scratchU8Array[3];
|
|
2887
|
-
result.y = scratchU8Array[2];
|
|
2888
|
-
result.z = scratchU8Array[1];
|
|
2889
|
-
result.w = scratchU8Array[0];
|
|
2890
|
-
}
|
|
2891
|
-
return result;
|
|
2892
|
-
};
|
|
2893
|
-
Cartesian4.unpackFloat = function(packedFloat) {
|
|
2894
|
-
Check_default.typeOf.object("packedFloat", packedFloat);
|
|
2895
|
-
if (littleEndian) {
|
|
2896
|
-
scratchU8Array[0] = packedFloat.x;
|
|
2897
|
-
scratchU8Array[1] = packedFloat.y;
|
|
2898
|
-
scratchU8Array[2] = packedFloat.z;
|
|
2899
|
-
scratchU8Array[3] = packedFloat.w;
|
|
2900
|
-
} else {
|
|
2901
|
-
scratchU8Array[0] = packedFloat.w;
|
|
2902
|
-
scratchU8Array[1] = packedFloat.z;
|
|
2903
|
-
scratchU8Array[2] = packedFloat.y;
|
|
2904
|
-
scratchU8Array[3] = packedFloat.x;
|
|
2905
|
-
}
|
|
2906
|
-
return scratchF32Array[0];
|
|
2907
|
-
};
|
|
2908
|
-
var Cartesian4_default = Cartesian4;
|
|
2909
|
-
|
|
2910
|
-
// packages/engine/Source/Core/Matrix4.js
|
|
2911
|
-
function Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3) {
|
|
2912
|
-
this[0] = column0Row0 ?? 0;
|
|
2913
|
-
this[1] = column0Row1 ?? 0;
|
|
2914
|
-
this[2] = column0Row2 ?? 0;
|
|
2915
|
-
this[3] = column0Row3 ?? 0;
|
|
2916
|
-
this[4] = column1Row0 ?? 0;
|
|
2917
|
-
this[5] = column1Row1 ?? 0;
|
|
2918
|
-
this[6] = column1Row2 ?? 0;
|
|
2919
|
-
this[7] = column1Row3 ?? 0;
|
|
2920
|
-
this[8] = column2Row0 ?? 0;
|
|
2921
|
-
this[9] = column2Row1 ?? 0;
|
|
2922
|
-
this[10] = column2Row2 ?? 0;
|
|
2923
|
-
this[11] = column2Row3 ?? 0;
|
|
2924
|
-
this[12] = column3Row0 ?? 0;
|
|
2925
|
-
this[13] = column3Row1 ?? 0;
|
|
2926
|
-
this[14] = column3Row2 ?? 0;
|
|
2927
|
-
this[15] = column3Row3 ?? 0;
|
|
2928
|
-
}
|
|
2929
|
-
Matrix4.packedLength = 16;
|
|
2930
|
-
Matrix4.pack = function(value, array, startingIndex) {
|
|
2931
|
-
Check_default.typeOf.object("value", value);
|
|
2932
|
-
Check_default.defined("array", array);
|
|
2933
|
-
startingIndex = startingIndex ?? 0;
|
|
2934
|
-
array[startingIndex++] = value[0];
|
|
2935
|
-
array[startingIndex++] = value[1];
|
|
2936
|
-
array[startingIndex++] = value[2];
|
|
2937
|
-
array[startingIndex++] = value[3];
|
|
2938
|
-
array[startingIndex++] = value[4];
|
|
2939
|
-
array[startingIndex++] = value[5];
|
|
2940
|
-
array[startingIndex++] = value[6];
|
|
2941
|
-
array[startingIndex++] = value[7];
|
|
2942
|
-
array[startingIndex++] = value[8];
|
|
2943
|
-
array[startingIndex++] = value[9];
|
|
2944
|
-
array[startingIndex++] = value[10];
|
|
2945
|
-
array[startingIndex++] = value[11];
|
|
2946
|
-
array[startingIndex++] = value[12];
|
|
2947
|
-
array[startingIndex++] = value[13];
|
|
2948
|
-
array[startingIndex++] = value[14];
|
|
2949
|
-
array[startingIndex] = value[15];
|
|
2950
|
-
return array;
|
|
2951
|
-
};
|
|
2952
|
-
Matrix4.unpack = function(array, startingIndex, result) {
|
|
2953
|
-
Check_default.defined("array", array);
|
|
2954
|
-
startingIndex = startingIndex ?? 0;
|
|
2955
|
-
if (!defined_default(result)) {
|
|
2956
|
-
result = new Matrix4();
|
|
2957
|
-
}
|
|
2958
|
-
result[0] = array[startingIndex++];
|
|
2959
|
-
result[1] = array[startingIndex++];
|
|
2960
|
-
result[2] = array[startingIndex++];
|
|
2961
|
-
result[3] = array[startingIndex++];
|
|
2962
|
-
result[4] = array[startingIndex++];
|
|
2963
|
-
result[5] = array[startingIndex++];
|
|
2964
|
-
result[6] = array[startingIndex++];
|
|
2965
|
-
result[7] = array[startingIndex++];
|
|
2966
|
-
result[8] = array[startingIndex++];
|
|
2967
|
-
result[9] = array[startingIndex++];
|
|
2968
|
-
result[10] = array[startingIndex++];
|
|
2969
|
-
result[11] = array[startingIndex++];
|
|
2970
|
-
result[12] = array[startingIndex++];
|
|
2971
|
-
result[13] = array[startingIndex++];
|
|
2972
|
-
result[14] = array[startingIndex++];
|
|
2973
|
-
result[15] = array[startingIndex];
|
|
2974
|
-
return result;
|
|
2975
|
-
};
|
|
2976
|
-
Matrix4.packArray = function(array, result) {
|
|
2977
|
-
Check_default.defined("array", array);
|
|
2978
|
-
const length = array.length;
|
|
2979
|
-
const resultLength = length * 16;
|
|
2980
|
-
if (!defined_default(result)) {
|
|
2981
|
-
result = new Array(resultLength);
|
|
2982
|
-
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
2983
|
-
throw new DeveloperError_default(
|
|
2984
|
-
"If result is a typed array, it must have exactly array.length * 16 elements"
|
|
2985
|
-
);
|
|
2986
|
-
} else if (result.length !== resultLength) {
|
|
2987
|
-
result.length = resultLength;
|
|
2988
|
-
}
|
|
2989
|
-
for (let i = 0; i < length; ++i) {
|
|
2990
|
-
Matrix4.pack(array[i], result, i * 16);
|
|
2991
|
-
}
|
|
2992
|
-
return result;
|
|
2993
|
-
};
|
|
2994
|
-
Matrix4.unpackArray = function(array, result) {
|
|
2995
|
-
Check_default.defined("array", array);
|
|
2996
|
-
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 16);
|
|
2997
|
-
if (array.length % 16 !== 0) {
|
|
2998
|
-
throw new DeveloperError_default("array length must be a multiple of 16.");
|
|
2999
|
-
}
|
|
3000
|
-
const length = array.length;
|
|
3001
|
-
if (!defined_default(result)) {
|
|
3002
|
-
result = new Array(length / 16);
|
|
3003
|
-
} else {
|
|
3004
|
-
result.length = length / 16;
|
|
3005
|
-
}
|
|
3006
|
-
for (let i = 0; i < length; i += 16) {
|
|
3007
|
-
const index = i / 16;
|
|
3008
|
-
result[index] = Matrix4.unpack(array, i, result[index]);
|
|
3009
|
-
}
|
|
3010
|
-
return result;
|
|
3011
|
-
};
|
|
3012
|
-
Matrix4.clone = function(matrix, result) {
|
|
3013
|
-
if (!defined_default(matrix)) {
|
|
3014
|
-
return void 0;
|
|
3015
|
-
}
|
|
3016
|
-
if (!defined_default(result)) {
|
|
3017
|
-
return new Matrix4(
|
|
3018
|
-
matrix[0],
|
|
3019
|
-
matrix[4],
|
|
3020
|
-
matrix[8],
|
|
3021
|
-
matrix[12],
|
|
3022
|
-
matrix[1],
|
|
3023
|
-
matrix[5],
|
|
3024
|
-
matrix[9],
|
|
3025
|
-
matrix[13],
|
|
3026
|
-
matrix[2],
|
|
3027
|
-
matrix[6],
|
|
3028
|
-
matrix[10],
|
|
3029
|
-
matrix[14],
|
|
3030
|
-
matrix[3],
|
|
3031
|
-
matrix[7],
|
|
3032
|
-
matrix[11],
|
|
3033
|
-
matrix[15]
|
|
3034
|
-
);
|
|
3035
|
-
}
|
|
3036
|
-
result[0] = matrix[0];
|
|
3037
|
-
result[1] = matrix[1];
|
|
3038
|
-
result[2] = matrix[2];
|
|
3039
|
-
result[3] = matrix[3];
|
|
3040
|
-
result[4] = matrix[4];
|
|
3041
|
-
result[5] = matrix[5];
|
|
3042
|
-
result[6] = matrix[6];
|
|
3043
|
-
result[7] = matrix[7];
|
|
3044
|
-
result[8] = matrix[8];
|
|
3045
|
-
result[9] = matrix[9];
|
|
3046
|
-
result[10] = matrix[10];
|
|
3047
|
-
result[11] = matrix[11];
|
|
3048
|
-
result[12] = matrix[12];
|
|
3049
|
-
result[13] = matrix[13];
|
|
3050
|
-
result[14] = matrix[14];
|
|
3051
|
-
result[15] = matrix[15];
|
|
3052
|
-
return result;
|
|
3053
|
-
};
|
|
3054
|
-
Matrix4.fromArray = Matrix4.unpack;
|
|
3055
|
-
Matrix4.fromColumnMajorArray = function(values, result) {
|
|
3056
|
-
Check_default.defined("values", values);
|
|
3057
|
-
return Matrix4.clone(values, result);
|
|
3058
|
-
};
|
|
3059
|
-
Matrix4.fromRowMajorArray = function(values, result) {
|
|
3060
|
-
Check_default.defined("values", values);
|
|
3061
|
-
if (!defined_default(result)) {
|
|
3062
|
-
return new Matrix4(
|
|
3063
|
-
values[0],
|
|
3064
|
-
values[1],
|
|
3065
|
-
values[2],
|
|
3066
|
-
values[3],
|
|
3067
|
-
values[4],
|
|
3068
|
-
values[5],
|
|
3069
|
-
values[6],
|
|
3070
|
-
values[7],
|
|
3071
|
-
values[8],
|
|
3072
|
-
values[9],
|
|
3073
|
-
values[10],
|
|
3074
|
-
values[11],
|
|
3075
|
-
values[12],
|
|
3076
|
-
values[13],
|
|
3077
|
-
values[14],
|
|
3078
|
-
values[15]
|
|
3079
|
-
);
|
|
3080
|
-
}
|
|
3081
|
-
result[0] = values[0];
|
|
3082
|
-
result[1] = values[4];
|
|
3083
|
-
result[2] = values[8];
|
|
3084
|
-
result[3] = values[12];
|
|
3085
|
-
result[4] = values[1];
|
|
3086
|
-
result[5] = values[5];
|
|
3087
|
-
result[6] = values[9];
|
|
3088
|
-
result[7] = values[13];
|
|
3089
|
-
result[8] = values[2];
|
|
3090
|
-
result[9] = values[6];
|
|
3091
|
-
result[10] = values[10];
|
|
3092
|
-
result[11] = values[14];
|
|
3093
|
-
result[12] = values[3];
|
|
3094
|
-
result[13] = values[7];
|
|
3095
|
-
result[14] = values[11];
|
|
3096
|
-
result[15] = values[15];
|
|
3097
|
-
return result;
|
|
3098
|
-
};
|
|
3099
|
-
Matrix4.fromRotationTranslation = function(rotation, translation, result) {
|
|
3100
|
-
Check_default.typeOf.object("rotation", rotation);
|
|
3101
|
-
translation = translation ?? Cartesian3_default.ZERO;
|
|
3102
|
-
if (!defined_default(result)) {
|
|
3103
|
-
return new Matrix4(
|
|
3104
|
-
rotation[0],
|
|
3105
|
-
rotation[3],
|
|
3106
|
-
rotation[6],
|
|
3107
|
-
translation.x,
|
|
3108
|
-
rotation[1],
|
|
3109
|
-
rotation[4],
|
|
3110
|
-
rotation[7],
|
|
3111
|
-
translation.y,
|
|
3112
|
-
rotation[2],
|
|
3113
|
-
rotation[5],
|
|
3114
|
-
rotation[8],
|
|
3115
|
-
translation.z,
|
|
3116
|
-
0,
|
|
3117
|
-
0,
|
|
3118
|
-
0,
|
|
3119
|
-
1
|
|
3120
|
-
);
|
|
3121
|
-
}
|
|
3122
|
-
result[0] = rotation[0];
|
|
3123
|
-
result[1] = rotation[1];
|
|
3124
|
-
result[2] = rotation[2];
|
|
3125
|
-
result[3] = 0;
|
|
3126
|
-
result[4] = rotation[3];
|
|
3127
|
-
result[5] = rotation[4];
|
|
3128
|
-
result[6] = rotation[5];
|
|
3129
|
-
result[7] = 0;
|
|
3130
|
-
result[8] = rotation[6];
|
|
3131
|
-
result[9] = rotation[7];
|
|
3132
|
-
result[10] = rotation[8];
|
|
3133
|
-
result[11] = 0;
|
|
3134
|
-
result[12] = translation.x;
|
|
3135
|
-
result[13] = translation.y;
|
|
3136
|
-
result[14] = translation.z;
|
|
3137
|
-
result[15] = 1;
|
|
3138
|
-
return result;
|
|
3139
|
-
};
|
|
3140
|
-
Matrix4.fromTranslationQuaternionRotationScale = function(translation, rotation, scale, result) {
|
|
3141
|
-
Check_default.typeOf.object("translation", translation);
|
|
3142
|
-
Check_default.typeOf.object("rotation", rotation);
|
|
3143
|
-
Check_default.typeOf.object("scale", scale);
|
|
3144
|
-
if (!defined_default(result)) {
|
|
3145
|
-
result = new Matrix4();
|
|
3146
|
-
}
|
|
3147
|
-
const scaleX = scale.x;
|
|
3148
|
-
const scaleY = scale.y;
|
|
3149
|
-
const scaleZ = scale.z;
|
|
3150
|
-
const x2 = rotation.x * rotation.x;
|
|
3151
|
-
const xy = rotation.x * rotation.y;
|
|
3152
|
-
const xz = rotation.x * rotation.z;
|
|
3153
|
-
const xw = rotation.x * rotation.w;
|
|
3154
|
-
const y2 = rotation.y * rotation.y;
|
|
3155
|
-
const yz = rotation.y * rotation.z;
|
|
3156
|
-
const yw = rotation.y * rotation.w;
|
|
3157
|
-
const z2 = rotation.z * rotation.z;
|
|
3158
|
-
const zw = rotation.z * rotation.w;
|
|
3159
|
-
const w2 = rotation.w * rotation.w;
|
|
3160
|
-
const m00 = x2 - y2 - z2 + w2;
|
|
3161
|
-
const m01 = 2 * (xy - zw);
|
|
3162
|
-
const m02 = 2 * (xz + yw);
|
|
3163
|
-
const m10 = 2 * (xy + zw);
|
|
3164
|
-
const m11 = -x2 + y2 - z2 + w2;
|
|
3165
|
-
const m12 = 2 * (yz - xw);
|
|
3166
|
-
const m20 = 2 * (xz - yw);
|
|
3167
|
-
const m21 = 2 * (yz + xw);
|
|
3168
|
-
const m22 = -x2 - y2 + z2 + w2;
|
|
3169
|
-
result[0] = m00 * scaleX;
|
|
3170
|
-
result[1] = m10 * scaleX;
|
|
3171
|
-
result[2] = m20 * scaleX;
|
|
3172
|
-
result[3] = 0;
|
|
3173
|
-
result[4] = m01 * scaleY;
|
|
3174
|
-
result[5] = m11 * scaleY;
|
|
3175
|
-
result[6] = m21 * scaleY;
|
|
3176
|
-
result[7] = 0;
|
|
3177
|
-
result[8] = m02 * scaleZ;
|
|
3178
|
-
result[9] = m12 * scaleZ;
|
|
3179
|
-
result[10] = m22 * scaleZ;
|
|
3180
|
-
result[11] = 0;
|
|
3181
|
-
result[12] = translation.x;
|
|
3182
|
-
result[13] = translation.y;
|
|
3183
|
-
result[14] = translation.z;
|
|
3184
|
-
result[15] = 1;
|
|
3185
|
-
return result;
|
|
3186
|
-
};
|
|
3187
|
-
Matrix4.fromTranslationRotationScale = function(translationRotationScale, result) {
|
|
3188
|
-
Check_default.typeOf.object("translationRotationScale", translationRotationScale);
|
|
3189
|
-
return Matrix4.fromTranslationQuaternionRotationScale(
|
|
3190
|
-
translationRotationScale.translation,
|
|
3191
|
-
translationRotationScale.rotation,
|
|
3192
|
-
translationRotationScale.scale,
|
|
3193
|
-
result
|
|
3194
|
-
);
|
|
3195
|
-
};
|
|
3196
|
-
Matrix4.fromTranslation = function(translation, result) {
|
|
3197
|
-
Check_default.typeOf.object("translation", translation);
|
|
3198
|
-
return Matrix4.fromRotationTranslation(Matrix3_default.IDENTITY, translation, result);
|
|
3199
|
-
};
|
|
3200
|
-
Matrix4.fromScale = function(scale, result) {
|
|
3201
|
-
Check_default.typeOf.object("scale", scale);
|
|
3202
|
-
if (!defined_default(result)) {
|
|
3203
|
-
return new Matrix4(
|
|
3204
|
-
scale.x,
|
|
3205
|
-
0,
|
|
3206
|
-
0,
|
|
3207
|
-
0,
|
|
3208
|
-
0,
|
|
3209
|
-
scale.y,
|
|
3210
|
-
0,
|
|
3211
|
-
0,
|
|
3212
|
-
0,
|
|
3213
|
-
0,
|
|
3214
|
-
scale.z,
|
|
3215
|
-
0,
|
|
3216
|
-
0,
|
|
3217
|
-
0,
|
|
3218
|
-
0,
|
|
3219
|
-
1
|
|
3220
|
-
);
|
|
3221
|
-
}
|
|
3222
|
-
result[0] = scale.x;
|
|
3223
|
-
result[1] = 0;
|
|
3224
|
-
result[2] = 0;
|
|
3225
|
-
result[3] = 0;
|
|
3226
|
-
result[4] = 0;
|
|
3227
|
-
result[5] = scale.y;
|
|
3228
|
-
result[6] = 0;
|
|
3229
|
-
result[7] = 0;
|
|
3230
|
-
result[8] = 0;
|
|
3231
|
-
result[9] = 0;
|
|
3232
|
-
result[10] = scale.z;
|
|
3233
|
-
result[11] = 0;
|
|
3234
|
-
result[12] = 0;
|
|
3235
|
-
result[13] = 0;
|
|
3236
|
-
result[14] = 0;
|
|
3237
|
-
result[15] = 1;
|
|
3238
|
-
return result;
|
|
3239
|
-
};
|
|
3240
|
-
Matrix4.fromUniformScale = function(scale, result) {
|
|
3241
|
-
Check_default.typeOf.number("scale", scale);
|
|
3242
|
-
if (!defined_default(result)) {
|
|
3243
|
-
return new Matrix4(
|
|
3244
|
-
scale,
|
|
3245
|
-
0,
|
|
3246
|
-
0,
|
|
3247
|
-
0,
|
|
3248
|
-
0,
|
|
3249
|
-
scale,
|
|
3250
|
-
0,
|
|
3251
|
-
0,
|
|
3252
|
-
0,
|
|
3253
|
-
0,
|
|
3254
|
-
scale,
|
|
3255
|
-
0,
|
|
3256
|
-
0,
|
|
3257
|
-
0,
|
|
3258
|
-
0,
|
|
3259
|
-
1
|
|
3260
|
-
);
|
|
3261
|
-
}
|
|
3262
|
-
result[0] = scale;
|
|
3263
|
-
result[1] = 0;
|
|
3264
|
-
result[2] = 0;
|
|
3265
|
-
result[3] = 0;
|
|
3266
|
-
result[4] = 0;
|
|
3267
|
-
result[5] = scale;
|
|
3268
|
-
result[6] = 0;
|
|
3269
|
-
result[7] = 0;
|
|
3270
|
-
result[8] = 0;
|
|
3271
|
-
result[9] = 0;
|
|
3272
|
-
result[10] = scale;
|
|
3273
|
-
result[11] = 0;
|
|
3274
|
-
result[12] = 0;
|
|
3275
|
-
result[13] = 0;
|
|
3276
|
-
result[14] = 0;
|
|
3277
|
-
result[15] = 1;
|
|
3278
|
-
return result;
|
|
3279
|
-
};
|
|
3280
|
-
Matrix4.fromRotation = function(rotation, result) {
|
|
3281
|
-
Check_default.typeOf.object("rotation", rotation);
|
|
3282
|
-
if (!defined_default(result)) {
|
|
3283
|
-
result = new Matrix4();
|
|
3284
|
-
}
|
|
3285
|
-
result[0] = rotation[0];
|
|
3286
|
-
result[1] = rotation[1];
|
|
3287
|
-
result[2] = rotation[2];
|
|
3288
|
-
result[3] = 0;
|
|
3289
|
-
result[4] = rotation[3];
|
|
3290
|
-
result[5] = rotation[4];
|
|
3291
|
-
result[6] = rotation[5];
|
|
3292
|
-
result[7] = 0;
|
|
3293
|
-
result[8] = rotation[6];
|
|
3294
|
-
result[9] = rotation[7];
|
|
3295
|
-
result[10] = rotation[8];
|
|
3296
|
-
result[11] = 0;
|
|
3297
|
-
result[12] = 0;
|
|
3298
|
-
result[13] = 0;
|
|
3299
|
-
result[14] = 0;
|
|
3300
|
-
result[15] = 1;
|
|
3301
|
-
return result;
|
|
3302
|
-
};
|
|
3303
|
-
var fromCameraF = new Cartesian3_default();
|
|
3304
|
-
var fromCameraR = new Cartesian3_default();
|
|
3305
|
-
var fromCameraU = new Cartesian3_default();
|
|
3306
|
-
Matrix4.fromCamera = function(camera, result) {
|
|
3307
|
-
Check_default.typeOf.object("camera", camera);
|
|
3308
|
-
const position = camera.position;
|
|
3309
|
-
const direction = camera.direction;
|
|
3310
|
-
const up = camera.up;
|
|
3311
|
-
Check_default.typeOf.object("camera.position", position);
|
|
3312
|
-
Check_default.typeOf.object("camera.direction", direction);
|
|
3313
|
-
Check_default.typeOf.object("camera.up", up);
|
|
3314
|
-
Cartesian3_default.normalize(direction, fromCameraF);
|
|
3315
|
-
Cartesian3_default.normalize(
|
|
3316
|
-
Cartesian3_default.cross(fromCameraF, up, fromCameraR),
|
|
3317
|
-
fromCameraR
|
|
3318
|
-
);
|
|
3319
|
-
Cartesian3_default.normalize(
|
|
3320
|
-
Cartesian3_default.cross(fromCameraR, fromCameraF, fromCameraU),
|
|
3321
|
-
fromCameraU
|
|
3322
|
-
);
|
|
3323
|
-
const sX = fromCameraR.x;
|
|
3324
|
-
const sY = fromCameraR.y;
|
|
3325
|
-
const sZ = fromCameraR.z;
|
|
3326
|
-
const fX = fromCameraF.x;
|
|
3327
|
-
const fY = fromCameraF.y;
|
|
3328
|
-
const fZ = fromCameraF.z;
|
|
3329
|
-
const uX = fromCameraU.x;
|
|
3330
|
-
const uY = fromCameraU.y;
|
|
3331
|
-
const uZ = fromCameraU.z;
|
|
3332
|
-
const positionX = position.x;
|
|
3333
|
-
const positionY = position.y;
|
|
3334
|
-
const positionZ = position.z;
|
|
3335
|
-
const t0 = sX * -positionX + sY * -positionY + sZ * -positionZ;
|
|
3336
|
-
const t1 = uX * -positionX + uY * -positionY + uZ * -positionZ;
|
|
3337
|
-
const t2 = fX * positionX + fY * positionY + fZ * positionZ;
|
|
3338
|
-
if (!defined_default(result)) {
|
|
3339
|
-
return new Matrix4(
|
|
3340
|
-
sX,
|
|
3341
|
-
sY,
|
|
3342
|
-
sZ,
|
|
3343
|
-
t0,
|
|
3344
|
-
uX,
|
|
3345
|
-
uY,
|
|
3346
|
-
uZ,
|
|
3347
|
-
t1,
|
|
3348
|
-
-fX,
|
|
3349
|
-
-fY,
|
|
3350
|
-
-fZ,
|
|
3351
|
-
t2,
|
|
3352
|
-
0,
|
|
3353
|
-
0,
|
|
3354
|
-
0,
|
|
3355
|
-
1
|
|
3356
|
-
);
|
|
3357
|
-
}
|
|
3358
|
-
result[0] = sX;
|
|
3359
|
-
result[1] = uX;
|
|
3360
|
-
result[2] = -fX;
|
|
3361
|
-
result[3] = 0;
|
|
3362
|
-
result[4] = sY;
|
|
3363
|
-
result[5] = uY;
|
|
3364
|
-
result[6] = -fY;
|
|
3365
|
-
result[7] = 0;
|
|
3366
|
-
result[8] = sZ;
|
|
3367
|
-
result[9] = uZ;
|
|
3368
|
-
result[10] = -fZ;
|
|
3369
|
-
result[11] = 0;
|
|
3370
|
-
result[12] = t0;
|
|
3371
|
-
result[13] = t1;
|
|
3372
|
-
result[14] = t2;
|
|
3373
|
-
result[15] = 1;
|
|
3374
|
-
return result;
|
|
3375
|
-
};
|
|
3376
|
-
Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) {
|
|
3377
|
-
Check_default.typeOf.number.greaterThan("fovY", fovY, 0);
|
|
3378
|
-
Check_default.typeOf.number.lessThan("fovY", fovY, Math.PI);
|
|
3379
|
-
Check_default.typeOf.number.greaterThan("near", near, 0);
|
|
3380
|
-
Check_default.typeOf.number.greaterThan("far", far, 0);
|
|
3381
|
-
Check_default.typeOf.object("result", result);
|
|
3382
|
-
const bottom = Math.tan(fovY * 0.5);
|
|
3383
|
-
const column1Row1 = 1 / bottom;
|
|
3384
|
-
const column0Row0 = column1Row1 / aspectRatio;
|
|
3385
|
-
const column2Row2 = (far + near) / (near - far);
|
|
3386
|
-
const column3Row2 = 2 * far * near / (near - far);
|
|
3387
|
-
result[0] = column0Row0;
|
|
3388
|
-
result[1] = 0;
|
|
3389
|
-
result[2] = 0;
|
|
3390
|
-
result[3] = 0;
|
|
3391
|
-
result[4] = 0;
|
|
3392
|
-
result[5] = column1Row1;
|
|
3393
|
-
result[6] = 0;
|
|
3394
|
-
result[7] = 0;
|
|
3395
|
-
result[8] = 0;
|
|
3396
|
-
result[9] = 0;
|
|
3397
|
-
result[10] = column2Row2;
|
|
3398
|
-
result[11] = -1;
|
|
3399
|
-
result[12] = 0;
|
|
3400
|
-
result[13] = 0;
|
|
3401
|
-
result[14] = column3Row2;
|
|
3402
|
-
result[15] = 0;
|
|
3403
|
-
return result;
|
|
3404
|
-
};
|
|
3405
|
-
Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) {
|
|
3406
|
-
Check_default.typeOf.number("left", left);
|
|
3407
|
-
Check_default.typeOf.number("right", right);
|
|
3408
|
-
Check_default.typeOf.number("bottom", bottom);
|
|
3409
|
-
Check_default.typeOf.number("top", top);
|
|
3410
|
-
Check_default.typeOf.number("near", near);
|
|
3411
|
-
Check_default.typeOf.number("far", far);
|
|
3412
|
-
Check_default.typeOf.object("result", result);
|
|
3413
|
-
let a3 = 1 / (right - left);
|
|
3414
|
-
let b = 1 / (top - bottom);
|
|
3415
|
-
let c = 1 / (far - near);
|
|
3416
|
-
const tx = -(right + left) * a3;
|
|
3417
|
-
const ty = -(top + bottom) * b;
|
|
3418
|
-
const tz = -(far + near) * c;
|
|
3419
|
-
a3 *= 2;
|
|
3420
|
-
b *= 2;
|
|
3421
|
-
c *= -2;
|
|
3422
|
-
result[0] = a3;
|
|
3423
|
-
result[1] = 0;
|
|
3424
|
-
result[2] = 0;
|
|
3425
|
-
result[3] = 0;
|
|
3426
|
-
result[4] = 0;
|
|
3427
|
-
result[5] = b;
|
|
3428
|
-
result[6] = 0;
|
|
3429
|
-
result[7] = 0;
|
|
3430
|
-
result[8] = 0;
|
|
3431
|
-
result[9] = 0;
|
|
3432
|
-
result[10] = c;
|
|
3433
|
-
result[11] = 0;
|
|
3434
|
-
result[12] = tx;
|
|
3435
|
-
result[13] = ty;
|
|
3436
|
-
result[14] = tz;
|
|
3437
|
-
result[15] = 1;
|
|
3438
|
-
return result;
|
|
3439
|
-
};
|
|
3440
|
-
Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) {
|
|
3441
|
-
Check_default.typeOf.number("left", left);
|
|
3442
|
-
Check_default.typeOf.number("right", right);
|
|
3443
|
-
Check_default.typeOf.number("bottom", bottom);
|
|
3444
|
-
Check_default.typeOf.number("top", top);
|
|
3445
|
-
Check_default.typeOf.number("near", near);
|
|
3446
|
-
Check_default.typeOf.number("far", far);
|
|
3447
|
-
Check_default.typeOf.object("result", result);
|
|
3448
|
-
const column0Row0 = 2 * near / (right - left);
|
|
3449
|
-
const column1Row1 = 2 * near / (top - bottom);
|
|
3450
|
-
const column2Row0 = (right + left) / (right - left);
|
|
3451
|
-
const column2Row1 = (top + bottom) / (top - bottom);
|
|
3452
|
-
const column2Row2 = -(far + near) / (far - near);
|
|
3453
|
-
const column2Row3 = -1;
|
|
3454
|
-
const column3Row2 = -2 * far * near / (far - near);
|
|
3455
|
-
result[0] = column0Row0;
|
|
3456
|
-
result[1] = 0;
|
|
3457
|
-
result[2] = 0;
|
|
3458
|
-
result[3] = 0;
|
|
3459
|
-
result[4] = 0;
|
|
3460
|
-
result[5] = column1Row1;
|
|
3461
|
-
result[6] = 0;
|
|
3462
|
-
result[7] = 0;
|
|
3463
|
-
result[8] = column2Row0;
|
|
3464
|
-
result[9] = column2Row1;
|
|
3465
|
-
result[10] = column2Row2;
|
|
3466
|
-
result[11] = column2Row3;
|
|
3467
|
-
result[12] = 0;
|
|
3468
|
-
result[13] = 0;
|
|
3469
|
-
result[14] = column3Row2;
|
|
3470
|
-
result[15] = 0;
|
|
3471
|
-
return result;
|
|
3472
|
-
};
|
|
3473
|
-
Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) {
|
|
3474
|
-
Check_default.typeOf.number("left", left);
|
|
3475
|
-
Check_default.typeOf.number("right", right);
|
|
3476
|
-
Check_default.typeOf.number("bottom", bottom);
|
|
3477
|
-
Check_default.typeOf.number("top", top);
|
|
3478
|
-
Check_default.typeOf.number("near", near);
|
|
3479
|
-
Check_default.typeOf.object("result", result);
|
|
3480
|
-
const column0Row0 = 2 * near / (right - left);
|
|
3481
|
-
const column1Row1 = 2 * near / (top - bottom);
|
|
3482
|
-
const column2Row0 = (right + left) / (right - left);
|
|
3483
|
-
const column2Row1 = (top + bottom) / (top - bottom);
|
|
3484
|
-
const column2Row2 = -1;
|
|
3485
|
-
const column2Row3 = -1;
|
|
3486
|
-
const column3Row2 = -2 * near;
|
|
3487
|
-
result[0] = column0Row0;
|
|
3488
|
-
result[1] = 0;
|
|
3489
|
-
result[2] = 0;
|
|
3490
|
-
result[3] = 0;
|
|
3491
|
-
result[4] = 0;
|
|
3492
|
-
result[5] = column1Row1;
|
|
3493
|
-
result[6] = 0;
|
|
3494
|
-
result[7] = 0;
|
|
3495
|
-
result[8] = column2Row0;
|
|
3496
|
-
result[9] = column2Row1;
|
|
3497
|
-
result[10] = column2Row2;
|
|
3498
|
-
result[11] = column2Row3;
|
|
3499
|
-
result[12] = 0;
|
|
3500
|
-
result[13] = 0;
|
|
3501
|
-
result[14] = column3Row2;
|
|
3502
|
-
result[15] = 0;
|
|
3503
|
-
return result;
|
|
3504
|
-
};
|
|
3505
|
-
Matrix4.computeViewportTransformation = function(viewport, nearDepthRange, farDepthRange, result) {
|
|
3506
|
-
if (!defined_default(result)) {
|
|
3507
|
-
result = new Matrix4();
|
|
3508
|
-
}
|
|
3509
|
-
viewport = viewport ?? Frozen_default.EMPTY_OBJECT;
|
|
3510
|
-
const x = viewport.x ?? 0;
|
|
3511
|
-
const y = viewport.y ?? 0;
|
|
3512
|
-
const width = viewport.width ?? 0;
|
|
3513
|
-
const height = viewport.height ?? 0;
|
|
3514
|
-
nearDepthRange = nearDepthRange ?? 0;
|
|
3515
|
-
farDepthRange = farDepthRange ?? 1;
|
|
3516
|
-
const halfWidth = width * 0.5;
|
|
3517
|
-
const halfHeight = height * 0.5;
|
|
3518
|
-
const halfDepth = (farDepthRange - nearDepthRange) * 0.5;
|
|
3519
|
-
const column0Row0 = halfWidth;
|
|
3520
|
-
const column1Row1 = halfHeight;
|
|
3521
|
-
const column2Row2 = halfDepth;
|
|
3522
|
-
const column3Row0 = x + halfWidth;
|
|
3523
|
-
const column3Row1 = y + halfHeight;
|
|
3524
|
-
const column3Row2 = nearDepthRange + halfDepth;
|
|
3525
|
-
const column3Row3 = 1;
|
|
3526
|
-
result[0] = column0Row0;
|
|
3527
|
-
result[1] = 0;
|
|
3528
|
-
result[2] = 0;
|
|
3529
|
-
result[3] = 0;
|
|
3530
|
-
result[4] = 0;
|
|
3531
|
-
result[5] = column1Row1;
|
|
3532
|
-
result[6] = 0;
|
|
3533
|
-
result[7] = 0;
|
|
3534
|
-
result[8] = 0;
|
|
3535
|
-
result[9] = 0;
|
|
3536
|
-
result[10] = column2Row2;
|
|
3537
|
-
result[11] = 0;
|
|
3538
|
-
result[12] = column3Row0;
|
|
3539
|
-
result[13] = column3Row1;
|
|
3540
|
-
result[14] = column3Row2;
|
|
3541
|
-
result[15] = column3Row3;
|
|
3542
|
-
return result;
|
|
3543
|
-
};
|
|
3544
|
-
Matrix4.computeView = function(position, direction, up, right, result) {
|
|
3545
|
-
Check_default.typeOf.object("position", position);
|
|
3546
|
-
Check_default.typeOf.object("direction", direction);
|
|
3547
|
-
Check_default.typeOf.object("up", up);
|
|
3548
|
-
Check_default.typeOf.object("right", right);
|
|
3549
|
-
Check_default.typeOf.object("result", result);
|
|
3550
|
-
result[0] = right.x;
|
|
3551
|
-
result[1] = up.x;
|
|
3552
|
-
result[2] = -direction.x;
|
|
3553
|
-
result[3] = 0;
|
|
3554
|
-
result[4] = right.y;
|
|
3555
|
-
result[5] = up.y;
|
|
3556
|
-
result[6] = -direction.y;
|
|
3557
|
-
result[7] = 0;
|
|
3558
|
-
result[8] = right.z;
|
|
3559
|
-
result[9] = up.z;
|
|
3560
|
-
result[10] = -direction.z;
|
|
3561
|
-
result[11] = 0;
|
|
3562
|
-
result[12] = -Cartesian3_default.dot(right, position);
|
|
3563
|
-
result[13] = -Cartesian3_default.dot(up, position);
|
|
3564
|
-
result[14] = Cartesian3_default.dot(direction, position);
|
|
3565
|
-
result[15] = 1;
|
|
3566
|
-
return result;
|
|
3567
|
-
};
|
|
3568
|
-
Matrix4.toArray = function(matrix, result) {
|
|
3569
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3570
|
-
if (!defined_default(result)) {
|
|
3571
|
-
return [
|
|
3572
|
-
matrix[0],
|
|
3573
|
-
matrix[1],
|
|
3574
|
-
matrix[2],
|
|
3575
|
-
matrix[3],
|
|
3576
|
-
matrix[4],
|
|
3577
|
-
matrix[5],
|
|
3578
|
-
matrix[6],
|
|
3579
|
-
matrix[7],
|
|
3580
|
-
matrix[8],
|
|
3581
|
-
matrix[9],
|
|
3582
|
-
matrix[10],
|
|
3583
|
-
matrix[11],
|
|
3584
|
-
matrix[12],
|
|
3585
|
-
matrix[13],
|
|
3586
|
-
matrix[14],
|
|
3587
|
-
matrix[15]
|
|
3588
|
-
];
|
|
3589
|
-
}
|
|
3590
|
-
result[0] = matrix[0];
|
|
3591
|
-
result[1] = matrix[1];
|
|
3592
|
-
result[2] = matrix[2];
|
|
3593
|
-
result[3] = matrix[3];
|
|
3594
|
-
result[4] = matrix[4];
|
|
3595
|
-
result[5] = matrix[5];
|
|
3596
|
-
result[6] = matrix[6];
|
|
3597
|
-
result[7] = matrix[7];
|
|
3598
|
-
result[8] = matrix[8];
|
|
3599
|
-
result[9] = matrix[9];
|
|
3600
|
-
result[10] = matrix[10];
|
|
3601
|
-
result[11] = matrix[11];
|
|
3602
|
-
result[12] = matrix[12];
|
|
3603
|
-
result[13] = matrix[13];
|
|
3604
|
-
result[14] = matrix[14];
|
|
3605
|
-
result[15] = matrix[15];
|
|
3606
|
-
return result;
|
|
3607
|
-
};
|
|
3608
|
-
Matrix4.getElementIndex = function(column, row) {
|
|
3609
|
-
Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
|
|
3610
|
-
Check_default.typeOf.number.lessThanOrEquals("row", row, 3);
|
|
3611
|
-
Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
|
|
3612
|
-
Check_default.typeOf.number.lessThanOrEquals("column", column, 3);
|
|
3613
|
-
return column * 4 + row;
|
|
3614
|
-
};
|
|
3615
|
-
Matrix4.getColumn = function(matrix, index, result) {
|
|
3616
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3617
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
3618
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
|
3619
|
-
Check_default.typeOf.object("result", result);
|
|
3620
|
-
const startIndex = index * 4;
|
|
3621
|
-
const x = matrix[startIndex];
|
|
3622
|
-
const y = matrix[startIndex + 1];
|
|
3623
|
-
const z = matrix[startIndex + 2];
|
|
3624
|
-
const w = matrix[startIndex + 3];
|
|
3625
|
-
result.x = x;
|
|
3626
|
-
result.y = y;
|
|
3627
|
-
result.z = z;
|
|
3628
|
-
result.w = w;
|
|
3629
|
-
return result;
|
|
3630
|
-
};
|
|
3631
|
-
Matrix4.setColumn = function(matrix, index, cartesian, result) {
|
|
3632
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3633
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
3634
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
|
3635
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
3636
|
-
Check_default.typeOf.object("result", result);
|
|
3637
|
-
result = Matrix4.clone(matrix, result);
|
|
3638
|
-
const startIndex = index * 4;
|
|
3639
|
-
result[startIndex] = cartesian.x;
|
|
3640
|
-
result[startIndex + 1] = cartesian.y;
|
|
3641
|
-
result[startIndex + 2] = cartesian.z;
|
|
3642
|
-
result[startIndex + 3] = cartesian.w;
|
|
3643
|
-
return result;
|
|
3644
|
-
};
|
|
3645
|
-
Matrix4.getRow = function(matrix, index, result) {
|
|
3646
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3647
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
3648
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
|
3649
|
-
Check_default.typeOf.object("result", result);
|
|
3650
|
-
const x = matrix[index];
|
|
3651
|
-
const y = matrix[index + 4];
|
|
3652
|
-
const z = matrix[index + 8];
|
|
3653
|
-
const w = matrix[index + 12];
|
|
3654
|
-
result.x = x;
|
|
3655
|
-
result.y = y;
|
|
3656
|
-
result.z = z;
|
|
3657
|
-
result.w = w;
|
|
3658
|
-
return result;
|
|
3659
|
-
};
|
|
3660
|
-
Matrix4.setRow = function(matrix, index, cartesian, result) {
|
|
3661
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3662
|
-
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
|
|
3663
|
-
Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
|
|
3664
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
3665
|
-
Check_default.typeOf.object("result", result);
|
|
3666
|
-
result = Matrix4.clone(matrix, result);
|
|
3667
|
-
result[index] = cartesian.x;
|
|
3668
|
-
result[index + 4] = cartesian.y;
|
|
3669
|
-
result[index + 8] = cartesian.z;
|
|
3670
|
-
result[index + 12] = cartesian.w;
|
|
3671
|
-
return result;
|
|
3672
|
-
};
|
|
3673
|
-
Matrix4.setTranslation = function(matrix, translation, result) {
|
|
3674
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3675
|
-
Check_default.typeOf.object("translation", translation);
|
|
3676
|
-
Check_default.typeOf.object("result", result);
|
|
3677
|
-
result[0] = matrix[0];
|
|
3678
|
-
result[1] = matrix[1];
|
|
3679
|
-
result[2] = matrix[2];
|
|
3680
|
-
result[3] = matrix[3];
|
|
3681
|
-
result[4] = matrix[4];
|
|
3682
|
-
result[5] = matrix[5];
|
|
3683
|
-
result[6] = matrix[6];
|
|
3684
|
-
result[7] = matrix[7];
|
|
3685
|
-
result[8] = matrix[8];
|
|
3686
|
-
result[9] = matrix[9];
|
|
3687
|
-
result[10] = matrix[10];
|
|
3688
|
-
result[11] = matrix[11];
|
|
3689
|
-
result[12] = translation.x;
|
|
3690
|
-
result[13] = translation.y;
|
|
3691
|
-
result[14] = translation.z;
|
|
3692
|
-
result[15] = matrix[15];
|
|
3693
|
-
return result;
|
|
3694
|
-
};
|
|
3695
|
-
var scaleScratch1 = new Cartesian3_default();
|
|
3696
|
-
Matrix4.setScale = function(matrix, scale, result) {
|
|
3697
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3698
|
-
Check_default.typeOf.object("scale", scale);
|
|
3699
|
-
Check_default.typeOf.object("result", result);
|
|
3700
|
-
const existingScale = Matrix4.getScale(matrix, scaleScratch1);
|
|
3701
|
-
const scaleRatioX = scale.x / existingScale.x;
|
|
3702
|
-
const scaleRatioY = scale.y / existingScale.y;
|
|
3703
|
-
const scaleRatioZ = scale.z / existingScale.z;
|
|
3704
|
-
result[0] = matrix[0] * scaleRatioX;
|
|
3705
|
-
result[1] = matrix[1] * scaleRatioX;
|
|
3706
|
-
result[2] = matrix[2] * scaleRatioX;
|
|
3707
|
-
result[3] = matrix[3];
|
|
3708
|
-
result[4] = matrix[4] * scaleRatioY;
|
|
3709
|
-
result[5] = matrix[5] * scaleRatioY;
|
|
3710
|
-
result[6] = matrix[6] * scaleRatioY;
|
|
3711
|
-
result[7] = matrix[7];
|
|
3712
|
-
result[8] = matrix[8] * scaleRatioZ;
|
|
3713
|
-
result[9] = matrix[9] * scaleRatioZ;
|
|
3714
|
-
result[10] = matrix[10] * scaleRatioZ;
|
|
3715
|
-
result[11] = matrix[11];
|
|
3716
|
-
result[12] = matrix[12];
|
|
3717
|
-
result[13] = matrix[13];
|
|
3718
|
-
result[14] = matrix[14];
|
|
3719
|
-
result[15] = matrix[15];
|
|
3720
|
-
return result;
|
|
3721
|
-
};
|
|
3722
|
-
var scaleScratch2 = new Cartesian3_default();
|
|
3723
|
-
Matrix4.setUniformScale = function(matrix, scale, result) {
|
|
3724
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3725
|
-
Check_default.typeOf.number("scale", scale);
|
|
3726
|
-
Check_default.typeOf.object("result", result);
|
|
3727
|
-
const existingScale = Matrix4.getScale(matrix, scaleScratch2);
|
|
3728
|
-
const scaleRatioX = scale / existingScale.x;
|
|
3729
|
-
const scaleRatioY = scale / existingScale.y;
|
|
3730
|
-
const scaleRatioZ = scale / existingScale.z;
|
|
3731
|
-
result[0] = matrix[0] * scaleRatioX;
|
|
3732
|
-
result[1] = matrix[1] * scaleRatioX;
|
|
3733
|
-
result[2] = matrix[2] * scaleRatioX;
|
|
3734
|
-
result[3] = matrix[3];
|
|
3735
|
-
result[4] = matrix[4] * scaleRatioY;
|
|
3736
|
-
result[5] = matrix[5] * scaleRatioY;
|
|
3737
|
-
result[6] = matrix[6] * scaleRatioY;
|
|
3738
|
-
result[7] = matrix[7];
|
|
3739
|
-
result[8] = matrix[8] * scaleRatioZ;
|
|
3740
|
-
result[9] = matrix[9] * scaleRatioZ;
|
|
3741
|
-
result[10] = matrix[10] * scaleRatioZ;
|
|
3742
|
-
result[11] = matrix[11];
|
|
3743
|
-
result[12] = matrix[12];
|
|
3744
|
-
result[13] = matrix[13];
|
|
3745
|
-
result[14] = matrix[14];
|
|
3746
|
-
result[15] = matrix[15];
|
|
3747
|
-
return result;
|
|
3748
|
-
};
|
|
3749
|
-
var scratchColumn = new Cartesian3_default();
|
|
3750
|
-
Matrix4.getScale = function(matrix, result) {
|
|
3751
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3752
|
-
Check_default.typeOf.object("result", result);
|
|
3753
|
-
result.x = Cartesian3_default.magnitude(
|
|
3754
|
-
Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
|
|
3755
|
-
);
|
|
3756
|
-
result.y = Cartesian3_default.magnitude(
|
|
3757
|
-
Cartesian3_default.fromElements(matrix[4], matrix[5], matrix[6], scratchColumn)
|
|
3758
|
-
);
|
|
3759
|
-
result.z = Cartesian3_default.magnitude(
|
|
3760
|
-
Cartesian3_default.fromElements(matrix[8], matrix[9], matrix[10], scratchColumn)
|
|
3761
|
-
);
|
|
3762
|
-
return result;
|
|
3763
|
-
};
|
|
3764
|
-
var scaleScratch3 = new Cartesian3_default();
|
|
3765
|
-
Matrix4.getMaximumScale = function(matrix) {
|
|
3766
|
-
Matrix4.getScale(matrix, scaleScratch3);
|
|
3767
|
-
return Cartesian3_default.maximumComponent(scaleScratch3);
|
|
3768
|
-
};
|
|
3769
|
-
var scaleScratch4 = new Cartesian3_default();
|
|
3770
|
-
Matrix4.setRotation = function(matrix, rotation, result) {
|
|
3771
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3772
|
-
Check_default.typeOf.object("result", result);
|
|
3773
|
-
const scale = Matrix4.getScale(matrix, scaleScratch4);
|
|
3774
|
-
result[0] = rotation[0] * scale.x;
|
|
3775
|
-
result[1] = rotation[1] * scale.x;
|
|
3776
|
-
result[2] = rotation[2] * scale.x;
|
|
3777
|
-
result[3] = matrix[3];
|
|
3778
|
-
result[4] = rotation[3] * scale.y;
|
|
3779
|
-
result[5] = rotation[4] * scale.y;
|
|
3780
|
-
result[6] = rotation[5] * scale.y;
|
|
3781
|
-
result[7] = matrix[7];
|
|
3782
|
-
result[8] = rotation[6] * scale.z;
|
|
3783
|
-
result[9] = rotation[7] * scale.z;
|
|
3784
|
-
result[10] = rotation[8] * scale.z;
|
|
3785
|
-
result[11] = matrix[11];
|
|
3786
|
-
result[12] = matrix[12];
|
|
3787
|
-
result[13] = matrix[13];
|
|
3788
|
-
result[14] = matrix[14];
|
|
3789
|
-
result[15] = matrix[15];
|
|
3790
|
-
return result;
|
|
3791
|
-
};
|
|
3792
|
-
var scaleScratch5 = new Cartesian3_default();
|
|
3793
|
-
Matrix4.getRotation = function(matrix, result) {
|
|
3794
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3795
|
-
Check_default.typeOf.object("result", result);
|
|
3796
|
-
const scale = Matrix4.getScale(matrix, scaleScratch5);
|
|
3797
|
-
result[0] = matrix[0] / scale.x;
|
|
3798
|
-
result[1] = matrix[1] / scale.x;
|
|
3799
|
-
result[2] = matrix[2] / scale.x;
|
|
3800
|
-
result[3] = matrix[4] / scale.y;
|
|
3801
|
-
result[4] = matrix[5] / scale.y;
|
|
3802
|
-
result[5] = matrix[6] / scale.y;
|
|
3803
|
-
result[6] = matrix[8] / scale.z;
|
|
3804
|
-
result[7] = matrix[9] / scale.z;
|
|
3805
|
-
result[8] = matrix[10] / scale.z;
|
|
3806
|
-
return result;
|
|
3807
|
-
};
|
|
3808
|
-
Matrix4.multiply = function(left, right, result) {
|
|
3809
|
-
Check_default.typeOf.object("left", left);
|
|
3810
|
-
Check_default.typeOf.object("right", right);
|
|
3811
|
-
Check_default.typeOf.object("result", result);
|
|
3812
|
-
const left0 = left[0];
|
|
3813
|
-
const left1 = left[1];
|
|
3814
|
-
const left2 = left[2];
|
|
3815
|
-
const left3 = left[3];
|
|
3816
|
-
const left4 = left[4];
|
|
3817
|
-
const left5 = left[5];
|
|
3818
|
-
const left6 = left[6];
|
|
3819
|
-
const left7 = left[7];
|
|
3820
|
-
const left8 = left[8];
|
|
3821
|
-
const left9 = left[9];
|
|
3822
|
-
const left10 = left[10];
|
|
3823
|
-
const left11 = left[11];
|
|
3824
|
-
const left12 = left[12];
|
|
3825
|
-
const left13 = left[13];
|
|
3826
|
-
const left14 = left[14];
|
|
3827
|
-
const left15 = left[15];
|
|
3828
|
-
const right0 = right[0];
|
|
3829
|
-
const right1 = right[1];
|
|
3830
|
-
const right2 = right[2];
|
|
3831
|
-
const right3 = right[3];
|
|
3832
|
-
const right4 = right[4];
|
|
3833
|
-
const right5 = right[5];
|
|
3834
|
-
const right6 = right[6];
|
|
3835
|
-
const right7 = right[7];
|
|
3836
|
-
const right8 = right[8];
|
|
3837
|
-
const right9 = right[9];
|
|
3838
|
-
const right10 = right[10];
|
|
3839
|
-
const right11 = right[11];
|
|
3840
|
-
const right12 = right[12];
|
|
3841
|
-
const right13 = right[13];
|
|
3842
|
-
const right14 = right[14];
|
|
3843
|
-
const right15 = right[15];
|
|
3844
|
-
const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2 + left12 * right3;
|
|
3845
|
-
const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2 + left13 * right3;
|
|
3846
|
-
const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2 + left14 * right3;
|
|
3847
|
-
const column0Row3 = left3 * right0 + left7 * right1 + left11 * right2 + left15 * right3;
|
|
3848
|
-
const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6 + left12 * right7;
|
|
3849
|
-
const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6 + left13 * right7;
|
|
3850
|
-
const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6 + left14 * right7;
|
|
3851
|
-
const column1Row3 = left3 * right4 + left7 * right5 + left11 * right6 + left15 * right7;
|
|
3852
|
-
const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10 + left12 * right11;
|
|
3853
|
-
const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10 + left13 * right11;
|
|
3854
|
-
const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10 + left14 * right11;
|
|
3855
|
-
const column2Row3 = left3 * right8 + left7 * right9 + left11 * right10 + left15 * right11;
|
|
3856
|
-
const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12 * right15;
|
|
3857
|
-
const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13 * right15;
|
|
3858
|
-
const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14 * right15;
|
|
3859
|
-
const column3Row3 = left3 * right12 + left7 * right13 + left11 * right14 + left15 * right15;
|
|
3860
|
-
result[0] = column0Row0;
|
|
3861
|
-
result[1] = column0Row1;
|
|
3862
|
-
result[2] = column0Row2;
|
|
3863
|
-
result[3] = column0Row3;
|
|
3864
|
-
result[4] = column1Row0;
|
|
3865
|
-
result[5] = column1Row1;
|
|
3866
|
-
result[6] = column1Row2;
|
|
3867
|
-
result[7] = column1Row3;
|
|
3868
|
-
result[8] = column2Row0;
|
|
3869
|
-
result[9] = column2Row1;
|
|
3870
|
-
result[10] = column2Row2;
|
|
3871
|
-
result[11] = column2Row3;
|
|
3872
|
-
result[12] = column3Row0;
|
|
3873
|
-
result[13] = column3Row1;
|
|
3874
|
-
result[14] = column3Row2;
|
|
3875
|
-
result[15] = column3Row3;
|
|
3876
|
-
return result;
|
|
3877
|
-
};
|
|
3878
|
-
Matrix4.add = function(left, right, result) {
|
|
3879
|
-
Check_default.typeOf.object("left", left);
|
|
3880
|
-
Check_default.typeOf.object("right", right);
|
|
3881
|
-
Check_default.typeOf.object("result", result);
|
|
3882
|
-
result[0] = left[0] + right[0];
|
|
3883
|
-
result[1] = left[1] + right[1];
|
|
3884
|
-
result[2] = left[2] + right[2];
|
|
3885
|
-
result[3] = left[3] + right[3];
|
|
3886
|
-
result[4] = left[4] + right[4];
|
|
3887
|
-
result[5] = left[5] + right[5];
|
|
3888
|
-
result[6] = left[6] + right[6];
|
|
3889
|
-
result[7] = left[7] + right[7];
|
|
3890
|
-
result[8] = left[8] + right[8];
|
|
3891
|
-
result[9] = left[9] + right[9];
|
|
3892
|
-
result[10] = left[10] + right[10];
|
|
3893
|
-
result[11] = left[11] + right[11];
|
|
3894
|
-
result[12] = left[12] + right[12];
|
|
3895
|
-
result[13] = left[13] + right[13];
|
|
3896
|
-
result[14] = left[14] + right[14];
|
|
3897
|
-
result[15] = left[15] + right[15];
|
|
3898
|
-
return result;
|
|
3899
|
-
};
|
|
3900
|
-
Matrix4.subtract = function(left, right, result) {
|
|
3901
|
-
Check_default.typeOf.object("left", left);
|
|
3902
|
-
Check_default.typeOf.object("right", right);
|
|
3903
|
-
Check_default.typeOf.object("result", result);
|
|
3904
|
-
result[0] = left[0] - right[0];
|
|
3905
|
-
result[1] = left[1] - right[1];
|
|
3906
|
-
result[2] = left[2] - right[2];
|
|
3907
|
-
result[3] = left[3] - right[3];
|
|
3908
|
-
result[4] = left[4] - right[4];
|
|
3909
|
-
result[5] = left[5] - right[5];
|
|
3910
|
-
result[6] = left[6] - right[6];
|
|
3911
|
-
result[7] = left[7] - right[7];
|
|
3912
|
-
result[8] = left[8] - right[8];
|
|
3913
|
-
result[9] = left[9] - right[9];
|
|
3914
|
-
result[10] = left[10] - right[10];
|
|
3915
|
-
result[11] = left[11] - right[11];
|
|
3916
|
-
result[12] = left[12] - right[12];
|
|
3917
|
-
result[13] = left[13] - right[13];
|
|
3918
|
-
result[14] = left[14] - right[14];
|
|
3919
|
-
result[15] = left[15] - right[15];
|
|
3920
|
-
return result;
|
|
3921
|
-
};
|
|
3922
|
-
Matrix4.multiplyTransformation = function(left, right, result) {
|
|
3923
|
-
Check_default.typeOf.object("left", left);
|
|
3924
|
-
Check_default.typeOf.object("right", right);
|
|
3925
|
-
Check_default.typeOf.object("result", result);
|
|
3926
|
-
const left0 = left[0];
|
|
3927
|
-
const left1 = left[1];
|
|
3928
|
-
const left2 = left[2];
|
|
3929
|
-
const left4 = left[4];
|
|
3930
|
-
const left5 = left[5];
|
|
3931
|
-
const left6 = left[6];
|
|
3932
|
-
const left8 = left[8];
|
|
3933
|
-
const left9 = left[9];
|
|
3934
|
-
const left10 = left[10];
|
|
3935
|
-
const left12 = left[12];
|
|
3936
|
-
const left13 = left[13];
|
|
3937
|
-
const left14 = left[14];
|
|
3938
|
-
const right0 = right[0];
|
|
3939
|
-
const right1 = right[1];
|
|
3940
|
-
const right2 = right[2];
|
|
3941
|
-
const right4 = right[4];
|
|
3942
|
-
const right5 = right[5];
|
|
3943
|
-
const right6 = right[6];
|
|
3944
|
-
const right8 = right[8];
|
|
3945
|
-
const right9 = right[9];
|
|
3946
|
-
const right10 = right[10];
|
|
3947
|
-
const right12 = right[12];
|
|
3948
|
-
const right13 = right[13];
|
|
3949
|
-
const right14 = right[14];
|
|
3950
|
-
const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
|
|
3951
|
-
const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
|
|
3952
|
-
const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
|
|
3953
|
-
const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
|
|
3954
|
-
const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
|
|
3955
|
-
const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
|
|
3956
|
-
const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
|
|
3957
|
-
const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
|
|
3958
|
-
const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
|
|
3959
|
-
const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12;
|
|
3960
|
-
const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13;
|
|
3961
|
-
const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14;
|
|
3962
|
-
result[0] = column0Row0;
|
|
3963
|
-
result[1] = column0Row1;
|
|
3964
|
-
result[2] = column0Row2;
|
|
3965
|
-
result[3] = 0;
|
|
3966
|
-
result[4] = column1Row0;
|
|
3967
|
-
result[5] = column1Row1;
|
|
3968
|
-
result[6] = column1Row2;
|
|
3969
|
-
result[7] = 0;
|
|
3970
|
-
result[8] = column2Row0;
|
|
3971
|
-
result[9] = column2Row1;
|
|
3972
|
-
result[10] = column2Row2;
|
|
3973
|
-
result[11] = 0;
|
|
3974
|
-
result[12] = column3Row0;
|
|
3975
|
-
result[13] = column3Row1;
|
|
3976
|
-
result[14] = column3Row2;
|
|
3977
|
-
result[15] = 1;
|
|
3978
|
-
return result;
|
|
3979
|
-
};
|
|
3980
|
-
Matrix4.multiplyByMatrix3 = function(matrix, rotation, result) {
|
|
3981
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
3982
|
-
Check_default.typeOf.object("rotation", rotation);
|
|
3983
|
-
Check_default.typeOf.object("result", result);
|
|
3984
|
-
const left0 = matrix[0];
|
|
3985
|
-
const left1 = matrix[1];
|
|
3986
|
-
const left2 = matrix[2];
|
|
3987
|
-
const left4 = matrix[4];
|
|
3988
|
-
const left5 = matrix[5];
|
|
3989
|
-
const left6 = matrix[6];
|
|
3990
|
-
const left8 = matrix[8];
|
|
3991
|
-
const left9 = matrix[9];
|
|
3992
|
-
const left10 = matrix[10];
|
|
3993
|
-
const right0 = rotation[0];
|
|
3994
|
-
const right1 = rotation[1];
|
|
3995
|
-
const right2 = rotation[2];
|
|
3996
|
-
const right4 = rotation[3];
|
|
3997
|
-
const right5 = rotation[4];
|
|
3998
|
-
const right6 = rotation[5];
|
|
3999
|
-
const right8 = rotation[6];
|
|
4000
|
-
const right9 = rotation[7];
|
|
4001
|
-
const right10 = rotation[8];
|
|
4002
|
-
const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
|
|
4003
|
-
const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
|
|
4004
|
-
const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
|
|
4005
|
-
const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
|
|
4006
|
-
const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
|
|
4007
|
-
const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
|
|
4008
|
-
const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
|
|
4009
|
-
const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
|
|
4010
|
-
const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
|
|
4011
|
-
result[0] = column0Row0;
|
|
4012
|
-
result[1] = column0Row1;
|
|
4013
|
-
result[2] = column0Row2;
|
|
4014
|
-
result[3] = 0;
|
|
4015
|
-
result[4] = column1Row0;
|
|
4016
|
-
result[5] = column1Row1;
|
|
4017
|
-
result[6] = column1Row2;
|
|
4018
|
-
result[7] = 0;
|
|
4019
|
-
result[8] = column2Row0;
|
|
4020
|
-
result[9] = column2Row1;
|
|
4021
|
-
result[10] = column2Row2;
|
|
4022
|
-
result[11] = 0;
|
|
4023
|
-
result[12] = matrix[12];
|
|
4024
|
-
result[13] = matrix[13];
|
|
4025
|
-
result[14] = matrix[14];
|
|
4026
|
-
result[15] = matrix[15];
|
|
4027
|
-
return result;
|
|
4028
|
-
};
|
|
4029
|
-
Matrix4.multiplyByTranslation = function(matrix, translation, result) {
|
|
4030
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4031
|
-
Check_default.typeOf.object("translation", translation);
|
|
4032
|
-
Check_default.typeOf.object("result", result);
|
|
4033
|
-
const x = translation.x;
|
|
4034
|
-
const y = translation.y;
|
|
4035
|
-
const z = translation.z;
|
|
4036
|
-
const tx = x * matrix[0] + y * matrix[4] + z * matrix[8] + matrix[12];
|
|
4037
|
-
const ty = x * matrix[1] + y * matrix[5] + z * matrix[9] + matrix[13];
|
|
4038
|
-
const tz = x * matrix[2] + y * matrix[6] + z * matrix[10] + matrix[14];
|
|
4039
|
-
result[0] = matrix[0];
|
|
4040
|
-
result[1] = matrix[1];
|
|
4041
|
-
result[2] = matrix[2];
|
|
4042
|
-
result[3] = matrix[3];
|
|
4043
|
-
result[4] = matrix[4];
|
|
4044
|
-
result[5] = matrix[5];
|
|
4045
|
-
result[6] = matrix[6];
|
|
4046
|
-
result[7] = matrix[7];
|
|
4047
|
-
result[8] = matrix[8];
|
|
4048
|
-
result[9] = matrix[9];
|
|
4049
|
-
result[10] = matrix[10];
|
|
4050
|
-
result[11] = matrix[11];
|
|
4051
|
-
result[12] = tx;
|
|
4052
|
-
result[13] = ty;
|
|
4053
|
-
result[14] = tz;
|
|
4054
|
-
result[15] = matrix[15];
|
|
4055
|
-
return result;
|
|
4056
|
-
};
|
|
4057
|
-
Matrix4.multiplyByScale = function(matrix, scale, result) {
|
|
4058
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4059
|
-
Check_default.typeOf.object("scale", scale);
|
|
4060
|
-
Check_default.typeOf.object("result", result);
|
|
4061
|
-
const scaleX = scale.x;
|
|
4062
|
-
const scaleY = scale.y;
|
|
4063
|
-
const scaleZ = scale.z;
|
|
4064
|
-
if (scaleX === 1 && scaleY === 1 && scaleZ === 1) {
|
|
4065
|
-
return Matrix4.clone(matrix, result);
|
|
4066
|
-
}
|
|
4067
|
-
result[0] = scaleX * matrix[0];
|
|
4068
|
-
result[1] = scaleX * matrix[1];
|
|
4069
|
-
result[2] = scaleX * matrix[2];
|
|
4070
|
-
result[3] = matrix[3];
|
|
4071
|
-
result[4] = scaleY * matrix[4];
|
|
4072
|
-
result[5] = scaleY * matrix[5];
|
|
4073
|
-
result[6] = scaleY * matrix[6];
|
|
4074
|
-
result[7] = matrix[7];
|
|
4075
|
-
result[8] = scaleZ * matrix[8];
|
|
4076
|
-
result[9] = scaleZ * matrix[9];
|
|
4077
|
-
result[10] = scaleZ * matrix[10];
|
|
4078
|
-
result[11] = matrix[11];
|
|
4079
|
-
result[12] = matrix[12];
|
|
4080
|
-
result[13] = matrix[13];
|
|
4081
|
-
result[14] = matrix[14];
|
|
4082
|
-
result[15] = matrix[15];
|
|
4083
|
-
return result;
|
|
4084
|
-
};
|
|
4085
|
-
Matrix4.multiplyByUniformScale = function(matrix, scale, result) {
|
|
4086
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4087
|
-
Check_default.typeOf.number("scale", scale);
|
|
4088
|
-
Check_default.typeOf.object("result", result);
|
|
4089
|
-
result[0] = matrix[0] * scale;
|
|
4090
|
-
result[1] = matrix[1] * scale;
|
|
4091
|
-
result[2] = matrix[2] * scale;
|
|
4092
|
-
result[3] = matrix[3];
|
|
4093
|
-
result[4] = matrix[4] * scale;
|
|
4094
|
-
result[5] = matrix[5] * scale;
|
|
4095
|
-
result[6] = matrix[6] * scale;
|
|
4096
|
-
result[7] = matrix[7];
|
|
4097
|
-
result[8] = matrix[8] * scale;
|
|
4098
|
-
result[9] = matrix[9] * scale;
|
|
4099
|
-
result[10] = matrix[10] * scale;
|
|
4100
|
-
result[11] = matrix[11];
|
|
4101
|
-
result[12] = matrix[12];
|
|
4102
|
-
result[13] = matrix[13];
|
|
4103
|
-
result[14] = matrix[14];
|
|
4104
|
-
result[15] = matrix[15];
|
|
4105
|
-
return result;
|
|
4106
|
-
};
|
|
4107
|
-
Matrix4.multiplyByVector = function(matrix, cartesian, result) {
|
|
4108
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4109
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
4110
|
-
Check_default.typeOf.object("result", result);
|
|
4111
|
-
const vX = cartesian.x;
|
|
4112
|
-
const vY = cartesian.y;
|
|
4113
|
-
const vZ = cartesian.z;
|
|
4114
|
-
const vW = cartesian.w;
|
|
4115
|
-
const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12] * vW;
|
|
4116
|
-
const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13] * vW;
|
|
4117
|
-
const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14] * vW;
|
|
4118
|
-
const w = matrix[3] * vX + matrix[7] * vY + matrix[11] * vZ + matrix[15] * vW;
|
|
4119
|
-
result.x = x;
|
|
4120
|
-
result.y = y;
|
|
4121
|
-
result.z = z;
|
|
4122
|
-
result.w = w;
|
|
4123
|
-
return result;
|
|
4124
|
-
};
|
|
4125
|
-
Matrix4.multiplyByPointAsVector = function(matrix, cartesian, result) {
|
|
4126
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4127
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
4128
|
-
Check_default.typeOf.object("result", result);
|
|
4129
|
-
const vX = cartesian.x;
|
|
4130
|
-
const vY = cartesian.y;
|
|
4131
|
-
const vZ = cartesian.z;
|
|
4132
|
-
const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ;
|
|
4133
|
-
const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ;
|
|
4134
|
-
const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ;
|
|
4135
|
-
result.x = x;
|
|
4136
|
-
result.y = y;
|
|
4137
|
-
result.z = z;
|
|
4138
|
-
return result;
|
|
4139
|
-
};
|
|
4140
|
-
Matrix4.multiplyByPoint = function(matrix, cartesian, result) {
|
|
4141
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4142
|
-
Check_default.typeOf.object("cartesian", cartesian);
|
|
4143
|
-
Check_default.typeOf.object("result", result);
|
|
4144
|
-
const vX = cartesian.x;
|
|
4145
|
-
const vY = cartesian.y;
|
|
4146
|
-
const vZ = cartesian.z;
|
|
4147
|
-
const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12];
|
|
4148
|
-
const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13];
|
|
4149
|
-
const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14];
|
|
4150
|
-
result.x = x;
|
|
4151
|
-
result.y = y;
|
|
4152
|
-
result.z = z;
|
|
4153
|
-
return result;
|
|
4154
|
-
};
|
|
4155
|
-
Matrix4.multiplyByScalar = function(matrix, scalar, result) {
|
|
4156
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4157
|
-
Check_default.typeOf.number("scalar", scalar);
|
|
4158
|
-
Check_default.typeOf.object("result", result);
|
|
4159
|
-
result[0] = matrix[0] * scalar;
|
|
4160
|
-
result[1] = matrix[1] * scalar;
|
|
4161
|
-
result[2] = matrix[2] * scalar;
|
|
4162
|
-
result[3] = matrix[3] * scalar;
|
|
4163
|
-
result[4] = matrix[4] * scalar;
|
|
4164
|
-
result[5] = matrix[5] * scalar;
|
|
4165
|
-
result[6] = matrix[6] * scalar;
|
|
4166
|
-
result[7] = matrix[7] * scalar;
|
|
4167
|
-
result[8] = matrix[8] * scalar;
|
|
4168
|
-
result[9] = matrix[9] * scalar;
|
|
4169
|
-
result[10] = matrix[10] * scalar;
|
|
4170
|
-
result[11] = matrix[11] * scalar;
|
|
4171
|
-
result[12] = matrix[12] * scalar;
|
|
4172
|
-
result[13] = matrix[13] * scalar;
|
|
4173
|
-
result[14] = matrix[14] * scalar;
|
|
4174
|
-
result[15] = matrix[15] * scalar;
|
|
4175
|
-
return result;
|
|
4176
|
-
};
|
|
4177
|
-
Matrix4.negate = function(matrix, result) {
|
|
4178
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4179
|
-
Check_default.typeOf.object("result", result);
|
|
4180
|
-
result[0] = -matrix[0];
|
|
4181
|
-
result[1] = -matrix[1];
|
|
4182
|
-
result[2] = -matrix[2];
|
|
4183
|
-
result[3] = -matrix[3];
|
|
4184
|
-
result[4] = -matrix[4];
|
|
4185
|
-
result[5] = -matrix[5];
|
|
4186
|
-
result[6] = -matrix[6];
|
|
4187
|
-
result[7] = -matrix[7];
|
|
4188
|
-
result[8] = -matrix[8];
|
|
4189
|
-
result[9] = -matrix[9];
|
|
4190
|
-
result[10] = -matrix[10];
|
|
4191
|
-
result[11] = -matrix[11];
|
|
4192
|
-
result[12] = -matrix[12];
|
|
4193
|
-
result[13] = -matrix[13];
|
|
4194
|
-
result[14] = -matrix[14];
|
|
4195
|
-
result[15] = -matrix[15];
|
|
4196
|
-
return result;
|
|
4197
|
-
};
|
|
4198
|
-
Matrix4.transpose = function(matrix, result) {
|
|
4199
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4200
|
-
Check_default.typeOf.object("result", result);
|
|
4201
|
-
const matrix1 = matrix[1];
|
|
4202
|
-
const matrix2 = matrix[2];
|
|
4203
|
-
const matrix3 = matrix[3];
|
|
4204
|
-
const matrix6 = matrix[6];
|
|
4205
|
-
const matrix7 = matrix[7];
|
|
4206
|
-
const matrix11 = matrix[11];
|
|
4207
|
-
result[0] = matrix[0];
|
|
4208
|
-
result[1] = matrix[4];
|
|
4209
|
-
result[2] = matrix[8];
|
|
4210
|
-
result[3] = matrix[12];
|
|
4211
|
-
result[4] = matrix1;
|
|
4212
|
-
result[5] = matrix[5];
|
|
4213
|
-
result[6] = matrix[9];
|
|
4214
|
-
result[7] = matrix[13];
|
|
4215
|
-
result[8] = matrix2;
|
|
4216
|
-
result[9] = matrix6;
|
|
4217
|
-
result[10] = matrix[10];
|
|
4218
|
-
result[11] = matrix[14];
|
|
4219
|
-
result[12] = matrix3;
|
|
4220
|
-
result[13] = matrix7;
|
|
4221
|
-
result[14] = matrix11;
|
|
4222
|
-
result[15] = matrix[15];
|
|
4223
|
-
return result;
|
|
4224
|
-
};
|
|
4225
|
-
Matrix4.abs = function(matrix, result) {
|
|
4226
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4227
|
-
Check_default.typeOf.object("result", result);
|
|
4228
|
-
result[0] = Math.abs(matrix[0]);
|
|
4229
|
-
result[1] = Math.abs(matrix[1]);
|
|
4230
|
-
result[2] = Math.abs(matrix[2]);
|
|
4231
|
-
result[3] = Math.abs(matrix[3]);
|
|
4232
|
-
result[4] = Math.abs(matrix[4]);
|
|
4233
|
-
result[5] = Math.abs(matrix[5]);
|
|
4234
|
-
result[6] = Math.abs(matrix[6]);
|
|
4235
|
-
result[7] = Math.abs(matrix[7]);
|
|
4236
|
-
result[8] = Math.abs(matrix[8]);
|
|
4237
|
-
result[9] = Math.abs(matrix[9]);
|
|
4238
|
-
result[10] = Math.abs(matrix[10]);
|
|
4239
|
-
result[11] = Math.abs(matrix[11]);
|
|
4240
|
-
result[12] = Math.abs(matrix[12]);
|
|
4241
|
-
result[13] = Math.abs(matrix[13]);
|
|
4242
|
-
result[14] = Math.abs(matrix[14]);
|
|
4243
|
-
result[15] = Math.abs(matrix[15]);
|
|
4244
|
-
return result;
|
|
4245
|
-
};
|
|
4246
|
-
Matrix4.equals = function(left, right) {
|
|
4247
|
-
return left === right || defined_default(left) && defined_default(right) && // Translation
|
|
4248
|
-
left[12] === right[12] && left[13] === right[13] && left[14] === right[14] && // Rotation/scale
|
|
4249
|
-
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
|
|
4250
|
-
left[3] === right[3] && left[7] === right[7] && left[11] === right[11] && left[15] === right[15];
|
|
4251
|
-
};
|
|
4252
|
-
Matrix4.equalsEpsilon = function(left, right, epsilon) {
|
|
4253
|
-
epsilon = epsilon ?? 0;
|
|
4254
|
-
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;
|
|
4255
|
-
};
|
|
4256
|
-
Matrix4.getTranslation = function(matrix, result) {
|
|
4257
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4258
|
-
Check_default.typeOf.object("result", result);
|
|
4259
|
-
result.x = matrix[12];
|
|
4260
|
-
result.y = matrix[13];
|
|
4261
|
-
result.z = matrix[14];
|
|
4262
|
-
return result;
|
|
4263
|
-
};
|
|
4264
|
-
Matrix4.getMatrix3 = function(matrix, result) {
|
|
4265
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4266
|
-
Check_default.typeOf.object("result", result);
|
|
4267
|
-
result[0] = matrix[0];
|
|
4268
|
-
result[1] = matrix[1];
|
|
4269
|
-
result[2] = matrix[2];
|
|
4270
|
-
result[3] = matrix[4];
|
|
4271
|
-
result[4] = matrix[5];
|
|
4272
|
-
result[5] = matrix[6];
|
|
4273
|
-
result[6] = matrix[8];
|
|
4274
|
-
result[7] = matrix[9];
|
|
4275
|
-
result[8] = matrix[10];
|
|
4276
|
-
return result;
|
|
4277
|
-
};
|
|
4278
|
-
var scratchInverseRotation = new Matrix3_default();
|
|
4279
|
-
var scratchMatrix3Zero = new Matrix3_default();
|
|
4280
|
-
var scratchBottomRow = new Cartesian4_default();
|
|
4281
|
-
var scratchExpectedBottomRow = new Cartesian4_default(0, 0, 0, 1);
|
|
4282
|
-
Matrix4.inverse = function(matrix, result) {
|
|
4283
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4284
|
-
Check_default.typeOf.object("result", result);
|
|
4285
|
-
const src0 = matrix[0];
|
|
4286
|
-
const src1 = matrix[4];
|
|
4287
|
-
const src2 = matrix[8];
|
|
4288
|
-
const src3 = matrix[12];
|
|
4289
|
-
const src4 = matrix[1];
|
|
4290
|
-
const src5 = matrix[5];
|
|
4291
|
-
const src6 = matrix[9];
|
|
4292
|
-
const src7 = matrix[13];
|
|
4293
|
-
const src8 = matrix[2];
|
|
4294
|
-
const src9 = matrix[6];
|
|
4295
|
-
const src10 = matrix[10];
|
|
4296
|
-
const src11 = matrix[14];
|
|
4297
|
-
const src12 = matrix[3];
|
|
4298
|
-
const src13 = matrix[7];
|
|
4299
|
-
const src14 = matrix[11];
|
|
4300
|
-
const src15 = matrix[15];
|
|
4301
|
-
let tmp0 = src10 * src15;
|
|
4302
|
-
let tmp1 = src11 * src14;
|
|
4303
|
-
let tmp2 = src9 * src15;
|
|
4304
|
-
let tmp3 = src11 * src13;
|
|
4305
|
-
let tmp4 = src9 * src14;
|
|
4306
|
-
let tmp5 = src10 * src13;
|
|
4307
|
-
let tmp6 = src8 * src15;
|
|
4308
|
-
let tmp7 = src11 * src12;
|
|
4309
|
-
let tmp8 = src8 * src14;
|
|
4310
|
-
let tmp9 = src10 * src12;
|
|
4311
|
-
let tmp10 = src8 * src13;
|
|
4312
|
-
let tmp11 = src9 * src12;
|
|
4313
|
-
const dst0 = tmp0 * src5 + tmp3 * src6 + tmp4 * src7 - (tmp1 * src5 + tmp2 * src6 + tmp5 * src7);
|
|
4314
|
-
const dst1 = tmp1 * src4 + tmp6 * src6 + tmp9 * src7 - (tmp0 * src4 + tmp7 * src6 + tmp8 * src7);
|
|
4315
|
-
const dst2 = tmp2 * src4 + tmp7 * src5 + tmp10 * src7 - (tmp3 * src4 + tmp6 * src5 + tmp11 * src7);
|
|
4316
|
-
const dst3 = tmp5 * src4 + tmp8 * src5 + tmp11 * src6 - (tmp4 * src4 + tmp9 * src5 + tmp10 * src6);
|
|
4317
|
-
const dst4 = tmp1 * src1 + tmp2 * src2 + tmp5 * src3 - (tmp0 * src1 + tmp3 * src2 + tmp4 * src3);
|
|
4318
|
-
const dst5 = tmp0 * src0 + tmp7 * src2 + tmp8 * src3 - (tmp1 * src0 + tmp6 * src2 + tmp9 * src3);
|
|
4319
|
-
const dst6 = tmp3 * src0 + tmp6 * src1 + tmp11 * src3 - (tmp2 * src0 + tmp7 * src1 + tmp10 * src3);
|
|
4320
|
-
const dst7 = tmp4 * src0 + tmp9 * src1 + tmp10 * src2 - (tmp5 * src0 + tmp8 * src1 + tmp11 * src2);
|
|
4321
|
-
tmp0 = src2 * src7;
|
|
4322
|
-
tmp1 = src3 * src6;
|
|
4323
|
-
tmp2 = src1 * src7;
|
|
4324
|
-
tmp3 = src3 * src5;
|
|
4325
|
-
tmp4 = src1 * src6;
|
|
4326
|
-
tmp5 = src2 * src5;
|
|
4327
|
-
tmp6 = src0 * src7;
|
|
4328
|
-
tmp7 = src3 * src4;
|
|
4329
|
-
tmp8 = src0 * src6;
|
|
4330
|
-
tmp9 = src2 * src4;
|
|
4331
|
-
tmp10 = src0 * src5;
|
|
4332
|
-
tmp11 = src1 * src4;
|
|
4333
|
-
const dst8 = tmp0 * src13 + tmp3 * src14 + tmp4 * src15 - (tmp1 * src13 + tmp2 * src14 + tmp5 * src15);
|
|
4334
|
-
const dst9 = tmp1 * src12 + tmp6 * src14 + tmp9 * src15 - (tmp0 * src12 + tmp7 * src14 + tmp8 * src15);
|
|
4335
|
-
const dst10 = tmp2 * src12 + tmp7 * src13 + tmp10 * src15 - (tmp3 * src12 + tmp6 * src13 + tmp11 * src15);
|
|
4336
|
-
const dst11 = tmp5 * src12 + tmp8 * src13 + tmp11 * src14 - (tmp4 * src12 + tmp9 * src13 + tmp10 * src14);
|
|
4337
|
-
const dst12 = tmp2 * src10 + tmp5 * src11 + tmp1 * src9 - (tmp4 * src11 + tmp0 * src9 + tmp3 * src10);
|
|
4338
|
-
const dst13 = tmp8 * src11 + tmp0 * src8 + tmp7 * src10 - (tmp6 * src10 + tmp9 * src11 + tmp1 * src8);
|
|
4339
|
-
const dst14 = tmp6 * src9 + tmp11 * src11 + tmp3 * src8 - (tmp10 * src11 + tmp2 * src8 + tmp7 * src9);
|
|
4340
|
-
const dst15 = tmp10 * src10 + tmp4 * src8 + tmp9 * src9 - (tmp8 * src9 + tmp11 * src10 + tmp5 * src8);
|
|
4341
|
-
let det = src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
|
|
4342
|
-
if (Math.abs(det) < Math_default.EPSILON21) {
|
|
4343
|
-
if (Matrix3_default.equalsEpsilon(
|
|
4344
|
-
Matrix4.getMatrix3(matrix, scratchInverseRotation),
|
|
4345
|
-
scratchMatrix3Zero,
|
|
4346
|
-
Math_default.EPSILON7
|
|
4347
|
-
) && Cartesian4_default.equals(
|
|
4348
|
-
Matrix4.getRow(matrix, 3, scratchBottomRow),
|
|
4349
|
-
scratchExpectedBottomRow
|
|
4350
|
-
)) {
|
|
4351
|
-
result[0] = 0;
|
|
4352
|
-
result[1] = 0;
|
|
4353
|
-
result[2] = 0;
|
|
4354
|
-
result[3] = 0;
|
|
4355
|
-
result[4] = 0;
|
|
4356
|
-
result[5] = 0;
|
|
4357
|
-
result[6] = 0;
|
|
4358
|
-
result[7] = 0;
|
|
4359
|
-
result[8] = 0;
|
|
4360
|
-
result[9] = 0;
|
|
4361
|
-
result[10] = 0;
|
|
4362
|
-
result[11] = 0;
|
|
4363
|
-
result[12] = -matrix[12];
|
|
4364
|
-
result[13] = -matrix[13];
|
|
4365
|
-
result[14] = -matrix[14];
|
|
4366
|
-
result[15] = 1;
|
|
4367
|
-
return result;
|
|
4368
|
-
}
|
|
4369
|
-
throw new RuntimeError_default(
|
|
4370
|
-
"matrix is not invertible because its determinate is zero."
|
|
4371
|
-
);
|
|
4372
|
-
}
|
|
4373
|
-
det = 1 / det;
|
|
4374
|
-
result[0] = dst0 * det;
|
|
4375
|
-
result[1] = dst1 * det;
|
|
4376
|
-
result[2] = dst2 * det;
|
|
4377
|
-
result[3] = dst3 * det;
|
|
4378
|
-
result[4] = dst4 * det;
|
|
4379
|
-
result[5] = dst5 * det;
|
|
4380
|
-
result[6] = dst6 * det;
|
|
4381
|
-
result[7] = dst7 * det;
|
|
4382
|
-
result[8] = dst8 * det;
|
|
4383
|
-
result[9] = dst9 * det;
|
|
4384
|
-
result[10] = dst10 * det;
|
|
4385
|
-
result[11] = dst11 * det;
|
|
4386
|
-
result[12] = dst12 * det;
|
|
4387
|
-
result[13] = dst13 * det;
|
|
4388
|
-
result[14] = dst14 * det;
|
|
4389
|
-
result[15] = dst15 * det;
|
|
4390
|
-
return result;
|
|
4391
|
-
};
|
|
4392
|
-
Matrix4.inverseTransformation = function(matrix, result) {
|
|
4393
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4394
|
-
Check_default.typeOf.object("result", result);
|
|
4395
|
-
const matrix0 = matrix[0];
|
|
4396
|
-
const matrix1 = matrix[1];
|
|
4397
|
-
const matrix2 = matrix[2];
|
|
4398
|
-
const matrix4 = matrix[4];
|
|
4399
|
-
const matrix5 = matrix[5];
|
|
4400
|
-
const matrix6 = matrix[6];
|
|
4401
|
-
const matrix8 = matrix[8];
|
|
4402
|
-
const matrix9 = matrix[9];
|
|
4403
|
-
const matrix10 = matrix[10];
|
|
4404
|
-
const vX = matrix[12];
|
|
4405
|
-
const vY = matrix[13];
|
|
4406
|
-
const vZ = matrix[14];
|
|
4407
|
-
const x = -matrix0 * vX - matrix1 * vY - matrix2 * vZ;
|
|
4408
|
-
const y = -matrix4 * vX - matrix5 * vY - matrix6 * vZ;
|
|
4409
|
-
const z = -matrix8 * vX - matrix9 * vY - matrix10 * vZ;
|
|
4410
|
-
result[0] = matrix0;
|
|
4411
|
-
result[1] = matrix4;
|
|
4412
|
-
result[2] = matrix8;
|
|
4413
|
-
result[3] = 0;
|
|
4414
|
-
result[4] = matrix1;
|
|
4415
|
-
result[5] = matrix5;
|
|
4416
|
-
result[6] = matrix9;
|
|
4417
|
-
result[7] = 0;
|
|
4418
|
-
result[8] = matrix2;
|
|
4419
|
-
result[9] = matrix6;
|
|
4420
|
-
result[10] = matrix10;
|
|
4421
|
-
result[11] = 0;
|
|
4422
|
-
result[12] = x;
|
|
4423
|
-
result[13] = y;
|
|
4424
|
-
result[14] = z;
|
|
4425
|
-
result[15] = 1;
|
|
4426
|
-
return result;
|
|
4427
|
-
};
|
|
4428
|
-
var scratchTransposeMatrix = new Matrix4();
|
|
4429
|
-
Matrix4.inverseTranspose = function(matrix, result) {
|
|
4430
|
-
Check_default.typeOf.object("matrix", matrix);
|
|
4431
|
-
Check_default.typeOf.object("result", result);
|
|
4432
|
-
return Matrix4.inverse(
|
|
4433
|
-
Matrix4.transpose(matrix, scratchTransposeMatrix),
|
|
4434
|
-
result
|
|
4435
|
-
);
|
|
4436
|
-
};
|
|
4437
|
-
Matrix4.IDENTITY = Object.freeze(
|
|
4438
|
-
new Matrix4(
|
|
4439
|
-
1,
|
|
4440
|
-
0,
|
|
4441
|
-
0,
|
|
4442
|
-
0,
|
|
4443
|
-
0,
|
|
4444
|
-
1,
|
|
4445
|
-
0,
|
|
4446
|
-
0,
|
|
4447
|
-
0,
|
|
4448
|
-
0,
|
|
4449
|
-
1,
|
|
4450
|
-
0,
|
|
4451
|
-
0,
|
|
4452
|
-
0,
|
|
4453
|
-
0,
|
|
4454
|
-
1
|
|
4455
|
-
)
|
|
4456
|
-
);
|
|
4457
|
-
Matrix4.ZERO = Object.freeze(
|
|
4458
|
-
new Matrix4(
|
|
4459
|
-
0,
|
|
4460
|
-
0,
|
|
4461
|
-
0,
|
|
4462
|
-
0,
|
|
4463
|
-
0,
|
|
4464
|
-
0,
|
|
4465
|
-
0,
|
|
4466
|
-
0,
|
|
4467
|
-
0,
|
|
4468
|
-
0,
|
|
4469
|
-
0,
|
|
4470
|
-
0,
|
|
4471
|
-
0,
|
|
4472
|
-
0,
|
|
4473
|
-
0,
|
|
4474
|
-
0
|
|
4475
|
-
)
|
|
4476
|
-
);
|
|
4477
|
-
Matrix4.COLUMN0ROW0 = 0;
|
|
4478
|
-
Matrix4.COLUMN0ROW1 = 1;
|
|
4479
|
-
Matrix4.COLUMN0ROW2 = 2;
|
|
4480
|
-
Matrix4.COLUMN0ROW3 = 3;
|
|
4481
|
-
Matrix4.COLUMN1ROW0 = 4;
|
|
4482
|
-
Matrix4.COLUMN1ROW1 = 5;
|
|
4483
|
-
Matrix4.COLUMN1ROW2 = 6;
|
|
4484
|
-
Matrix4.COLUMN1ROW3 = 7;
|
|
4485
|
-
Matrix4.COLUMN2ROW0 = 8;
|
|
4486
|
-
Matrix4.COLUMN2ROW1 = 9;
|
|
4487
|
-
Matrix4.COLUMN2ROW2 = 10;
|
|
4488
|
-
Matrix4.COLUMN2ROW3 = 11;
|
|
4489
|
-
Matrix4.COLUMN3ROW0 = 12;
|
|
4490
|
-
Matrix4.COLUMN3ROW1 = 13;
|
|
4491
|
-
Matrix4.COLUMN3ROW2 = 14;
|
|
4492
|
-
Matrix4.COLUMN3ROW3 = 15;
|
|
4493
|
-
Object.defineProperties(Matrix4.prototype, {
|
|
4494
|
-
/**
|
|
4495
|
-
* Gets the number of items in the collection.
|
|
4496
|
-
* @memberof Matrix4.prototype
|
|
4497
|
-
*
|
|
4498
|
-
* @type {number}
|
|
4499
|
-
*/
|
|
4500
|
-
length: {
|
|
4501
|
-
get: function() {
|
|
4502
|
-
return Matrix4.packedLength;
|
|
4503
|
-
}
|
|
2303
|
+
}
|
|
2304
|
+
return this;
|
|
2305
|
+
};
|
|
2306
|
+
p.normalizeFragment = function(build) {
|
|
2307
|
+
if (!this._parts.fragment) {
|
|
2308
|
+
this._parts.fragment = null;
|
|
2309
|
+
this.build(!build);
|
|
2310
|
+
}
|
|
2311
|
+
return this;
|
|
2312
|
+
};
|
|
2313
|
+
p.normalizeSearch = p.normalizeQuery;
|
|
2314
|
+
p.normalizeHash = p.normalizeFragment;
|
|
2315
|
+
p.iso8859 = function() {
|
|
2316
|
+
var e = URI.encode;
|
|
2317
|
+
var d = URI.decode;
|
|
2318
|
+
URI.encode = escape;
|
|
2319
|
+
URI.decode = decodeURIComponent;
|
|
2320
|
+
try {
|
|
2321
|
+
this.normalize();
|
|
2322
|
+
} finally {
|
|
2323
|
+
URI.encode = e;
|
|
2324
|
+
URI.decode = d;
|
|
2325
|
+
}
|
|
2326
|
+
return this;
|
|
2327
|
+
};
|
|
2328
|
+
p.unicode = function() {
|
|
2329
|
+
var e = URI.encode;
|
|
2330
|
+
var d = URI.decode;
|
|
2331
|
+
URI.encode = strictEncodeURIComponent;
|
|
2332
|
+
URI.decode = unescape;
|
|
2333
|
+
try {
|
|
2334
|
+
this.normalize();
|
|
2335
|
+
} finally {
|
|
2336
|
+
URI.encode = e;
|
|
2337
|
+
URI.decode = d;
|
|
2338
|
+
}
|
|
2339
|
+
return this;
|
|
2340
|
+
};
|
|
2341
|
+
p.readable = function() {
|
|
2342
|
+
var uri = this.clone();
|
|
2343
|
+
uri.username("").password("").normalize();
|
|
2344
|
+
var t = "";
|
|
2345
|
+
if (uri._parts.protocol) {
|
|
2346
|
+
t += uri._parts.protocol + "://";
|
|
2347
|
+
}
|
|
2348
|
+
if (uri._parts.hostname) {
|
|
2349
|
+
if (uri.is("punycode") && punycode) {
|
|
2350
|
+
t += punycode.toUnicode(uri._parts.hostname);
|
|
2351
|
+
if (uri._parts.port) {
|
|
2352
|
+
t += ":" + uri._parts.port;
|
|
2353
|
+
}
|
|
2354
|
+
} else {
|
|
2355
|
+
t += uri.host();
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
if (uri._parts.hostname && uri._parts.path && uri._parts.path.charAt(0) !== "/") {
|
|
2359
|
+
t += "/";
|
|
2360
|
+
}
|
|
2361
|
+
t += uri.path(true);
|
|
2362
|
+
if (uri._parts.query) {
|
|
2363
|
+
var q2 = "";
|
|
2364
|
+
for (var i = 0, qp = uri._parts.query.split("&"), l = qp.length; i < l; i++) {
|
|
2365
|
+
var kv = (qp[i] || "").split("=");
|
|
2366
|
+
q2 += "&" + URI.decodeQuery(kv[0], this._parts.escapeQuerySpace).replace(/&/g, "%26");
|
|
2367
|
+
if (kv[1] !== void 0) {
|
|
2368
|
+
q2 += "=" + URI.decodeQuery(kv[1], this._parts.escapeQuerySpace).replace(/&/g, "%26");
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
t += "?" + q2.substring(1);
|
|
2372
|
+
}
|
|
2373
|
+
t += URI.decodeQuery(uri.hash(), true);
|
|
2374
|
+
return t;
|
|
2375
|
+
};
|
|
2376
|
+
p.absoluteTo = function(base) {
|
|
2377
|
+
var resolved = this.clone();
|
|
2378
|
+
var properties = ["protocol", "username", "password", "hostname", "port"];
|
|
2379
|
+
var basedir, i, p2;
|
|
2380
|
+
if (this._parts.urn) {
|
|
2381
|
+
throw new Error("URNs do not have any generally defined hierarchical components");
|
|
2382
|
+
}
|
|
2383
|
+
if (!(base instanceof URI)) {
|
|
2384
|
+
base = new URI(base);
|
|
2385
|
+
}
|
|
2386
|
+
if (resolved._parts.protocol) {
|
|
2387
|
+
return resolved;
|
|
2388
|
+
} else {
|
|
2389
|
+
resolved._parts.protocol = base._parts.protocol;
|
|
2390
|
+
}
|
|
2391
|
+
if (this._parts.hostname) {
|
|
2392
|
+
return resolved;
|
|
2393
|
+
}
|
|
2394
|
+
for (i = 0; p2 = properties[i]; i++) {
|
|
2395
|
+
resolved._parts[p2] = base._parts[p2];
|
|
2396
|
+
}
|
|
2397
|
+
if (!resolved._parts.path) {
|
|
2398
|
+
resolved._parts.path = base._parts.path;
|
|
2399
|
+
if (!resolved._parts.query) {
|
|
2400
|
+
resolved._parts.query = base._parts.query;
|
|
2401
|
+
}
|
|
2402
|
+
} else {
|
|
2403
|
+
if (resolved._parts.path.substring(-2) === "..") {
|
|
2404
|
+
resolved._parts.path += "/";
|
|
2405
|
+
}
|
|
2406
|
+
if (resolved.path().charAt(0) !== "/") {
|
|
2407
|
+
basedir = base.directory();
|
|
2408
|
+
basedir = basedir ? basedir : base.path().indexOf("/") === 0 ? "/" : "";
|
|
2409
|
+
resolved._parts.path = (basedir ? basedir + "/" : "") + resolved._parts.path;
|
|
2410
|
+
resolved.normalizePath();
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
resolved.build();
|
|
2414
|
+
return resolved;
|
|
2415
|
+
};
|
|
2416
|
+
p.relativeTo = function(base) {
|
|
2417
|
+
var relative = this.clone().normalize();
|
|
2418
|
+
var relativeParts, baseParts, common, relativePath, basePath;
|
|
2419
|
+
if (relative._parts.urn) {
|
|
2420
|
+
throw new Error("URNs do not have any generally defined hierarchical components");
|
|
2421
|
+
}
|
|
2422
|
+
base = new URI(base).normalize();
|
|
2423
|
+
relativeParts = relative._parts;
|
|
2424
|
+
baseParts = base._parts;
|
|
2425
|
+
relativePath = relative.path();
|
|
2426
|
+
basePath = base.path();
|
|
2427
|
+
if (relativePath.charAt(0) !== "/") {
|
|
2428
|
+
throw new Error("URI is already relative");
|
|
2429
|
+
}
|
|
2430
|
+
if (basePath.charAt(0) !== "/") {
|
|
2431
|
+
throw new Error("Cannot calculate a URI relative to another relative URI");
|
|
2432
|
+
}
|
|
2433
|
+
if (relativeParts.protocol === baseParts.protocol) {
|
|
2434
|
+
relativeParts.protocol = null;
|
|
2435
|
+
}
|
|
2436
|
+
if (relativeParts.username !== baseParts.username || relativeParts.password !== baseParts.password) {
|
|
2437
|
+
return relative.build();
|
|
2438
|
+
}
|
|
2439
|
+
if (relativeParts.protocol !== null || relativeParts.username !== null || relativeParts.password !== null) {
|
|
2440
|
+
return relative.build();
|
|
2441
|
+
}
|
|
2442
|
+
if (relativeParts.hostname === baseParts.hostname && relativeParts.port === baseParts.port) {
|
|
2443
|
+
relativeParts.hostname = null;
|
|
2444
|
+
relativeParts.port = null;
|
|
2445
|
+
} else {
|
|
2446
|
+
return relative.build();
|
|
2447
|
+
}
|
|
2448
|
+
if (relativePath === basePath) {
|
|
2449
|
+
relativeParts.path = "";
|
|
2450
|
+
return relative.build();
|
|
2451
|
+
}
|
|
2452
|
+
common = URI.commonPath(relativePath, basePath);
|
|
2453
|
+
if (!common) {
|
|
2454
|
+
return relative.build();
|
|
2455
|
+
}
|
|
2456
|
+
var parents = baseParts.path.substring(common.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../");
|
|
2457
|
+
relativeParts.path = parents + relativeParts.path.substring(common.length) || "./";
|
|
2458
|
+
return relative.build();
|
|
2459
|
+
};
|
|
2460
|
+
p.equals = function(uri) {
|
|
2461
|
+
var one = this.clone();
|
|
2462
|
+
var two = new URI(uri);
|
|
2463
|
+
var one_map = {};
|
|
2464
|
+
var two_map = {};
|
|
2465
|
+
var checked = {};
|
|
2466
|
+
var one_query, two_query, key;
|
|
2467
|
+
one.normalize();
|
|
2468
|
+
two.normalize();
|
|
2469
|
+
if (one.toString() === two.toString()) {
|
|
2470
|
+
return true;
|
|
2471
|
+
}
|
|
2472
|
+
one_query = one.query();
|
|
2473
|
+
two_query = two.query();
|
|
2474
|
+
one.query("");
|
|
2475
|
+
two.query("");
|
|
2476
|
+
if (one.toString() !== two.toString()) {
|
|
2477
|
+
return false;
|
|
2478
|
+
}
|
|
2479
|
+
if (one_query.length !== two_query.length) {
|
|
2480
|
+
return false;
|
|
2481
|
+
}
|
|
2482
|
+
one_map = URI.parseQuery(one_query, this._parts.escapeQuerySpace);
|
|
2483
|
+
two_map = URI.parseQuery(two_query, this._parts.escapeQuerySpace);
|
|
2484
|
+
for (key in one_map) {
|
|
2485
|
+
if (hasOwn.call(one_map, key)) {
|
|
2486
|
+
if (!isArray(one_map[key])) {
|
|
2487
|
+
if (one_map[key] !== two_map[key]) {
|
|
2488
|
+
return false;
|
|
2489
|
+
}
|
|
2490
|
+
} else if (!arraysEqual(one_map[key], two_map[key])) {
|
|
2491
|
+
return false;
|
|
2492
|
+
}
|
|
2493
|
+
checked[key] = true;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
for (key in two_map) {
|
|
2497
|
+
if (hasOwn.call(two_map, key)) {
|
|
2498
|
+
if (!checked[key]) {
|
|
2499
|
+
return false;
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
return true;
|
|
2504
|
+
};
|
|
2505
|
+
p.preventInvalidHostname = function(v2) {
|
|
2506
|
+
this._parts.preventInvalidHostname = !!v2;
|
|
2507
|
+
return this;
|
|
2508
|
+
};
|
|
2509
|
+
p.duplicateQueryParameters = function(v2) {
|
|
2510
|
+
this._parts.duplicateQueryParameters = !!v2;
|
|
2511
|
+
return this;
|
|
2512
|
+
};
|
|
2513
|
+
p.escapeQuerySpace = function(v2) {
|
|
2514
|
+
this._parts.escapeQuerySpace = !!v2;
|
|
2515
|
+
return this;
|
|
2516
|
+
};
|
|
2517
|
+
return URI;
|
|
2518
|
+
});
|
|
4504
2519
|
}
|
|
4505
2520
|
});
|
|
4506
|
-
Matrix4.prototype.clone = function(result) {
|
|
4507
|
-
return Matrix4.clone(this, result);
|
|
4508
|
-
};
|
|
4509
|
-
Matrix4.prototype.equals = function(right) {
|
|
4510
|
-
return Matrix4.equals(this, right);
|
|
4511
|
-
};
|
|
4512
|
-
Matrix4.equalsArray = function(matrix, array, offset) {
|
|
4513
|
-
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];
|
|
4514
|
-
};
|
|
4515
|
-
Matrix4.prototype.equalsEpsilon = function(right, epsilon) {
|
|
4516
|
-
return Matrix4.equalsEpsilon(this, right, epsilon);
|
|
4517
|
-
};
|
|
4518
|
-
Matrix4.prototype.toString = function() {
|
|
4519
|
-
return `(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
|
|
4520
|
-
(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
|
|
4521
|
-
(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
|
|
4522
|
-
(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`;
|
|
4523
|
-
};
|
|
4524
|
-
var Matrix4_default = Matrix4;
|
|
4525
2521
|
|
|
4526
2522
|
// packages/engine/Source/Core/combine.js
|
|
4527
2523
|
function combine(object1, object2, deep) {
|
|
@@ -6951,7 +4947,7 @@ Resource.prototype.fetchImage = function(options) {
|
|
|
6951
4947
|
const skipColorSpaceConversion = options.skipColorSpaceConversion ?? false;
|
|
6952
4948
|
checkAndResetRequest(this.request);
|
|
6953
4949
|
if (!xhrBlobSupported || this.isDataUri || this.isBlobUri || !this.hasHeaders && !preferBlob) {
|
|
6954
|
-
return
|
|
4950
|
+
return this._fetchImage({
|
|
6955
4951
|
resource: this,
|
|
6956
4952
|
flipY,
|
|
6957
4953
|
skipColorSpaceConversion,
|
|
@@ -6986,8 +4982,7 @@ Resource.prototype.fetchImage = function(options) {
|
|
|
6986
4982
|
generatedBlobResource = new Resource({
|
|
6987
4983
|
url: blobUrl
|
|
6988
4984
|
});
|
|
6989
|
-
return
|
|
6990
|
-
resource: generatedBlobResource,
|
|
4985
|
+
return generatedBlobResource._fetchImage({
|
|
6991
4986
|
flipY,
|
|
6992
4987
|
skipColorSpaceConversion,
|
|
6993
4988
|
preferImageBitmap: false
|
|
@@ -7010,8 +5005,8 @@ Resource.prototype.fetchImage = function(options) {
|
|
|
7010
5005
|
return Promise.reject(error);
|
|
7011
5006
|
});
|
|
7012
5007
|
};
|
|
7013
|
-
function
|
|
7014
|
-
const resource =
|
|
5008
|
+
Resource.prototype._fetchImage = function(options) {
|
|
5009
|
+
const resource = this;
|
|
7015
5010
|
const flipY = options.flipY;
|
|
7016
5011
|
const skipColorSpaceConversion = options.skipColorSpaceConversion;
|
|
7017
5012
|
const preferImageBitmap = options.preferImageBitmap;
|
|
@@ -7045,8 +5040,7 @@ function fetchImage(options) {
|
|
|
7045
5040
|
if (retry) {
|
|
7046
5041
|
request.state = RequestState_default.UNISSUED;
|
|
7047
5042
|
request.deferred = void 0;
|
|
7048
|
-
return
|
|
7049
|
-
resource,
|
|
5043
|
+
return resource._fetchImage({
|
|
7050
5044
|
flipY,
|
|
7051
5045
|
skipColorSpaceConversion,
|
|
7052
5046
|
preferImageBitmap
|
|
@@ -7055,7 +5049,7 @@ function fetchImage(options) {
|
|
|
7055
5049
|
return Promise.reject(e);
|
|
7056
5050
|
});
|
|
7057
5051
|
});
|
|
7058
|
-
}
|
|
5052
|
+
};
|
|
7059
5053
|
Resource.fetchImage = function(options) {
|
|
7060
5054
|
const resource = new Resource(options);
|
|
7061
5055
|
return resource.fetchImage({
|
|
@@ -7381,7 +5375,7 @@ Resource._Implementations.loadImageElement = function(url, crossOrigin, deferred
|
|
|
7381
5375
|
}
|
|
7382
5376
|
image.src = url;
|
|
7383
5377
|
};
|
|
7384
|
-
Resource._Implementations.createImage = function(request, crossOrigin, deferred, flipY, skipColorSpaceConversion, preferImageBitmap) {
|
|
5378
|
+
Resource._Implementations.createImage = function(request, crossOrigin, deferred, flipY, skipColorSpaceConversion, preferImageBitmap, headers) {
|
|
7385
5379
|
const url = request.url;
|
|
7386
5380
|
Resource.supportsImageBitmapOptions().then(function(supportsImageBitmap) {
|
|
7387
5381
|
if (!(supportsImageBitmap && preferImageBitmap)) {
|
|
@@ -7396,7 +5390,7 @@ Resource._Implementations.createImage = function(request, crossOrigin, deferred,
|
|
|
7396
5390
|
responseType,
|
|
7397
5391
|
method,
|
|
7398
5392
|
void 0,
|
|
7399
|
-
|
|
5393
|
+
headers,
|
|
7400
5394
|
xhrDeferred,
|
|
7401
5395
|
void 0,
|
|
7402
5396
|
void 0,
|
|
@@ -8550,15 +6544,15 @@ Quaternion.computeAngle = function(quaternion) {
|
|
|
8550
6544
|
}
|
|
8551
6545
|
return 2 * Math.acos(quaternion.w);
|
|
8552
6546
|
};
|
|
8553
|
-
var
|
|
6547
|
+
var lerpScratch = new Quaternion();
|
|
8554
6548
|
Quaternion.lerp = function(start, end, t, result) {
|
|
8555
6549
|
Check_default.typeOf.object("start", start);
|
|
8556
6550
|
Check_default.typeOf.object("end", end);
|
|
8557
6551
|
Check_default.typeOf.number("t", t);
|
|
8558
6552
|
Check_default.typeOf.object("result", result);
|
|
8559
|
-
|
|
6553
|
+
lerpScratch = Quaternion.multiplyByScalar(end, t, lerpScratch);
|
|
8560
6554
|
result = Quaternion.multiplyByScalar(start, 1 - t, result);
|
|
8561
|
-
return Quaternion.add(
|
|
6555
|
+
return Quaternion.add(lerpScratch, result, result);
|
|
8562
6556
|
};
|
|
8563
6557
|
var slerpEndNegated = new Quaternion();
|
|
8564
6558
|
var slerpScaledP = new Quaternion();
|
|
@@ -9276,23 +7270,25 @@ Transforms.rotationMatrixFromPositionVelocity = function(position, velocity, ell
|
|
|
9276
7270
|
result[8] = up.z;
|
|
9277
7271
|
return result;
|
|
9278
7272
|
};
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
7273
|
+
Transforms.SWIZZLE_3D_TO_2D_MATRIX = Object.freeze(
|
|
7274
|
+
new Matrix4_default(
|
|
7275
|
+
0,
|
|
7276
|
+
0,
|
|
7277
|
+
1,
|
|
7278
|
+
0,
|
|
7279
|
+
1,
|
|
7280
|
+
0,
|
|
7281
|
+
0,
|
|
7282
|
+
0,
|
|
7283
|
+
0,
|
|
7284
|
+
1,
|
|
7285
|
+
0,
|
|
7286
|
+
0,
|
|
7287
|
+
0,
|
|
7288
|
+
0,
|
|
7289
|
+
0,
|
|
7290
|
+
1
|
|
7291
|
+
)
|
|
9296
7292
|
);
|
|
9297
7293
|
var scratchCartographic = new Cartographic_default();
|
|
9298
7294
|
var scratchCartesian3Projection = new Cartesian3_default();
|
|
@@ -9342,7 +7338,7 @@ Transforms.basisTo2D = function(projection, matrix, result) {
|
|
|
9342
7338
|
const toENU = Matrix4_default.inverseTransformation(fromENU, scratchToENU);
|
|
9343
7339
|
const rotation = Matrix4_default.getMatrix3(matrix, scratchRotation);
|
|
9344
7340
|
const local = Matrix4_default.multiplyByMatrix3(toENU, rotation, result);
|
|
9345
|
-
Matrix4_default.multiply(
|
|
7341
|
+
Matrix4_default.multiply(Transforms.SWIZZLE_3D_TO_2D_MATRIX, local, result);
|
|
9346
7342
|
Matrix4_default.setTranslation(result, projectedPosition, result);
|
|
9347
7343
|
return result;
|
|
9348
7344
|
};
|
|
@@ -9381,7 +7377,7 @@ Transforms.ellipsoidTo2DModelMatrix = function(projection, center, result) {
|
|
|
9381
7377
|
projectedPosition,
|
|
9382
7378
|
scratchFromENU
|
|
9383
7379
|
);
|
|
9384
|
-
Matrix4_default.multiply(
|
|
7380
|
+
Matrix4_default.multiply(Transforms.SWIZZLE_3D_TO_2D_MATRIX, toENU, result);
|
|
9385
7381
|
Matrix4_default.multiply(translation, result, result);
|
|
9386
7382
|
return result;
|
|
9387
7383
|
};
|
|
@@ -10139,12 +8135,12 @@ Matrix2.setRow = function(matrix, index, cartesian, result) {
|
|
|
10139
8135
|
result[index + 2] = cartesian.y;
|
|
10140
8136
|
return result;
|
|
10141
8137
|
};
|
|
10142
|
-
var
|
|
8138
|
+
var scaleScratch1 = new Cartesian2_default();
|
|
10143
8139
|
Matrix2.setScale = function(matrix, scale, result) {
|
|
10144
8140
|
Check_default.typeOf.object("matrix", matrix);
|
|
10145
8141
|
Check_default.typeOf.object("scale", scale);
|
|
10146
8142
|
Check_default.typeOf.object("result", result);
|
|
10147
|
-
const existingScale = Matrix2.getScale(matrix,
|
|
8143
|
+
const existingScale = Matrix2.getScale(matrix, scaleScratch1);
|
|
10148
8144
|
const scaleRatioX = scale.x / existingScale.x;
|
|
10149
8145
|
const scaleRatioY = scale.y / existingScale.y;
|
|
10150
8146
|
result[0] = matrix[0] * scaleRatioX;
|
|
@@ -10153,12 +8149,12 @@ Matrix2.setScale = function(matrix, scale, result) {
|
|
|
10153
8149
|
result[3] = matrix[3] * scaleRatioY;
|
|
10154
8150
|
return result;
|
|
10155
8151
|
};
|
|
10156
|
-
var
|
|
8152
|
+
var scaleScratch2 = new Cartesian2_default();
|
|
10157
8153
|
Matrix2.setUniformScale = function(matrix, scale, result) {
|
|
10158
8154
|
Check_default.typeOf.object("matrix", matrix);
|
|
10159
8155
|
Check_default.typeOf.number("scale", scale);
|
|
10160
8156
|
Check_default.typeOf.object("result", result);
|
|
10161
|
-
const existingScale = Matrix2.getScale(matrix,
|
|
8157
|
+
const existingScale = Matrix2.getScale(matrix, scaleScratch2);
|
|
10162
8158
|
const scaleRatioX = scale / existingScale.x;
|
|
10163
8159
|
const scaleRatioY = scale / existingScale.y;
|
|
10164
8160
|
result[0] = matrix[0] * scaleRatioX;
|
|
@@ -10167,39 +8163,39 @@ Matrix2.setUniformScale = function(matrix, scale, result) {
|
|
|
10167
8163
|
result[3] = matrix[3] * scaleRatioY;
|
|
10168
8164
|
return result;
|
|
10169
8165
|
};
|
|
10170
|
-
var
|
|
8166
|
+
var scratchColumn = new Cartesian2_default();
|
|
10171
8167
|
Matrix2.getScale = function(matrix, result) {
|
|
10172
8168
|
Check_default.typeOf.object("matrix", matrix);
|
|
10173
8169
|
Check_default.typeOf.object("result", result);
|
|
10174
8170
|
result.x = Cartesian2_default.magnitude(
|
|
10175
|
-
Cartesian2_default.fromElements(matrix[0], matrix[1],
|
|
8171
|
+
Cartesian2_default.fromElements(matrix[0], matrix[1], scratchColumn)
|
|
10176
8172
|
);
|
|
10177
8173
|
result.y = Cartesian2_default.magnitude(
|
|
10178
|
-
Cartesian2_default.fromElements(matrix[2], matrix[3],
|
|
8174
|
+
Cartesian2_default.fromElements(matrix[2], matrix[3], scratchColumn)
|
|
10179
8175
|
);
|
|
10180
8176
|
return result;
|
|
10181
8177
|
};
|
|
10182
|
-
var
|
|
8178
|
+
var scaleScratch3 = new Cartesian2_default();
|
|
10183
8179
|
Matrix2.getMaximumScale = function(matrix) {
|
|
10184
|
-
Matrix2.getScale(matrix,
|
|
10185
|
-
return Cartesian2_default.maximumComponent(
|
|
8180
|
+
Matrix2.getScale(matrix, scaleScratch3);
|
|
8181
|
+
return Cartesian2_default.maximumComponent(scaleScratch3);
|
|
10186
8182
|
};
|
|
10187
|
-
var
|
|
8183
|
+
var scaleScratch4 = new Cartesian2_default();
|
|
10188
8184
|
Matrix2.setRotation = function(matrix, rotation, result) {
|
|
10189
8185
|
Check_default.typeOf.object("matrix", matrix);
|
|
10190
8186
|
Check_default.typeOf.object("result", result);
|
|
10191
|
-
const scale = Matrix2.getScale(matrix,
|
|
8187
|
+
const scale = Matrix2.getScale(matrix, scaleScratch4);
|
|
10192
8188
|
result[0] = rotation[0] * scale.x;
|
|
10193
8189
|
result[1] = rotation[1] * scale.x;
|
|
10194
8190
|
result[2] = rotation[2] * scale.y;
|
|
10195
8191
|
result[3] = rotation[3] * scale.y;
|
|
10196
8192
|
return result;
|
|
10197
8193
|
};
|
|
10198
|
-
var
|
|
8194
|
+
var scaleScratch5 = new Cartesian2_default();
|
|
10199
8195
|
Matrix2.getRotation = function(matrix, result) {
|
|
10200
8196
|
Check_default.typeOf.object("matrix", matrix);
|
|
10201
8197
|
Check_default.typeOf.object("result", result);
|
|
10202
|
-
const scale = Matrix2.getScale(matrix,
|
|
8198
|
+
const scale = Matrix2.getScale(matrix, scaleScratch5);
|
|
10203
8199
|
result[0] = matrix[0] / scale.x;
|
|
10204
8200
|
result[1] = matrix[1] / scale.x;
|
|
10205
8201
|
result[2] = matrix[2] / scale.y;
|
|
@@ -10356,9 +8352,11 @@ Matrix2.prototype.toString = function() {
|
|
|
10356
8352
|
var Matrix2_default = Matrix2;
|
|
10357
8353
|
|
|
10358
8354
|
export {
|
|
10359
|
-
|
|
10360
|
-
|
|
8355
|
+
binarySearch_default,
|
|
8356
|
+
require_URI,
|
|
10361
8357
|
combine_default,
|
|
8358
|
+
isCrossOriginUrl_default,
|
|
8359
|
+
Event_default,
|
|
10362
8360
|
Resource_default,
|
|
10363
8361
|
buildModuleUrl_default,
|
|
10364
8362
|
Quaternion_default,
|