@cesium/engine 23.0.0 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-QTOHIXGF.js → chunk-2N4KDHS3.js} +10 -10
- package/Build/Workers/{chunk-SQTRWKO2.js → chunk-44EMEGKW.js} +5 -5
- package/Build/Workers/{chunk-OHBM4YG4.js → chunk-4TIG36AW.js} +12 -12
- package/Build/Workers/{chunk-BNBD2YZK.js → chunk-5A2SW66E.js} +16 -16
- package/Build/Workers/{chunk-52K3GJKG.js → chunk-5GXYJQ2K.js} +3 -3
- package/Build/Workers/{chunk-NQCAZU7S.js → chunk-63SIWPLS.js} +13 -13
- package/Build/Workers/{chunk-UEEGWJJP.js → chunk-6MPGQEHA.js} +2 -2
- package/Build/Workers/{chunk-PQVNT5CJ.js → chunk-6RMS4S72.js} +6 -6
- package/Build/Workers/{chunk-HYTFXWMY.js → chunk-6WLHJFD3.js} +7 -7
- package/Build/Workers/{chunk-DT5SJBKA.js → chunk-72VYSVEW.js} +9 -9
- package/Build/Workers/{chunk-JUGY5AZN.js → chunk-7MDYBRYJ.js} +4 -4
- package/Build/Workers/{chunk-6SLGTBB2.js → chunk-7O5XJTVE.js} +5 -5
- package/Build/Workers/{chunk-4UNQX2MP.js → chunk-7QRFIKWQ.js} +2 -2
- package/Build/Workers/{chunk-GN5NEUDT.js → chunk-7TYLCBGK.js} +8 -8
- package/Build/Workers/{chunk-SGKTBHFQ.js → chunk-7X322WP2.js} +13 -13
- package/Build/Workers/{chunk-T43FXHNC.js → chunk-A47HVBC5.js} +7 -7
- package/Build/Workers/{chunk-FSDVXW7M.js → chunk-AF3MU2RL.js} +5 -5
- package/Build/Workers/{chunk-3B65YFXC.js → chunk-AJLTU6PF.js} +1 -1
- package/Build/Workers/{chunk-OQ3EAJNW.js → chunk-AMIHNSST.js} +2 -2
- package/Build/Workers/{chunk-N4AWE7TZ.js → chunk-B6SCUUFP.js} +10 -10
- package/Build/Workers/{chunk-OMXN7YF4.js → chunk-BJD6QGXZ.js} +12 -12
- package/Build/Workers/{chunk-APDKMX7W.js → chunk-C6P4IG5P.js} +6 -6
- package/Build/Workers/{chunk-QA24Q62E.js → chunk-D4EJ2NXG.js} +17 -17
- package/Build/Workers/{chunk-HYLEKKO5.js → chunk-DHKPFLSJ.js} +1 -1
- package/Build/Workers/{chunk-MQJG522T.js → chunk-DVB56LG7.js} +6 -6
- package/Build/Workers/{chunk-Y5AJSEEN.js → chunk-EDXL4W76.js} +2 -2
- package/Build/Workers/{chunk-QQX7S5QT.js → chunk-EV3VGO6Y.js} +17 -17
- package/Build/Workers/{chunk-IFA7VHHP.js → chunk-GOQBUCXH.js} +10 -10
- package/Build/Workers/{chunk-5A7YSAXT.js → chunk-GQUNK2XC.js} +14 -14
- package/Build/Workers/{chunk-36LBFITA.js → chunk-HKUES6UG.js} +12 -12
- package/Build/Workers/{chunk-OC6X22PG.js → chunk-HRHRYFHS.js} +9 -9
- package/Build/Workers/{chunk-L7RDJ4V7.js → chunk-HXJMS2ZI.js} +1 -1
- package/Build/Workers/{chunk-NAYRNPEP.js → chunk-ILMFADZA.js} +4 -4
- package/Build/Workers/{chunk-AA33B6PU.js → chunk-ISY4EZCA.js} +4 -4
- package/Build/Workers/{chunk-7KRN6JPQ.js → chunk-J6AW5YHS.js} +14 -14
- package/Build/Workers/{chunk-OQBPOKPZ.js → chunk-JCI63T3K.js} +6 -6
- package/Build/Workers/{chunk-2WI4HGJU.js → chunk-KLPGTXS3.js} +6 -6
- package/Build/Workers/{chunk-5R7SBUTW.js → chunk-LIB2H534.js} +10 -10
- package/Build/Workers/{chunk-IYVDOB5V.js → chunk-LXMCPFFS.js} +4 -4
- package/Build/Workers/{chunk-NUYLNQKV.js → chunk-MKM27KGV.js} +2 -2
- package/Build/Workers/{chunk-R7M4XNPP.js → chunk-N65BAKSH.js} +8 -8
- package/Build/Workers/{chunk-4LGFX2P5.js → chunk-NKT5K3K3.js} +11 -11
- package/Build/Workers/{chunk-NNHU33JK.js → chunk-NPF7SSHZ.js} +7 -7
- package/Build/Workers/{chunk-LDQWNMEC.js → chunk-PVV64VFW.js} +1 -1
- package/Build/Workers/{chunk-WKXDCVBO.js → chunk-Q3C6VQH6.js} +4 -4
- package/Build/Workers/{chunk-ARCFIOKA.js → chunk-RQNJD3O4.js} +12 -12
- package/Build/Workers/{chunk-G3YT7M7A.js → chunk-UIGVOKKI.js} +1 -1
- package/Build/Workers/{chunk-ZIW5FCIW.js → chunk-UQU4RXLT.js} +27 -19
- package/Build/Workers/{chunk-MT5M7RLZ.js → chunk-VLDEUTOP.js} +2 -2
- package/Build/Workers/{chunk-5JP5FG7U.js → chunk-VMVOUQ5J.js} +7 -7
- package/Build/Workers/{chunk-2GL2EUEE.js → chunk-XJRBB253.js} +11 -11
- package/Build/Workers/{chunk-ESD4IEOU.js → chunk-XY6HMDGI.js} +5 -5
- package/Build/Workers/{chunk-56OHFSLH.js → chunk-Y7HNNPNK.js} +10 -10
- package/Build/Workers/{chunk-6FVFM2KB.js → chunk-YAOZMOFL.js} +5 -5
- package/Build/Workers/{chunk-AP6XWET5.js → chunk-YJZGW74L.js} +8 -8
- package/Build/Workers/{chunk-KPYU6YZG.js → chunk-YQFTYQMZ.js} +1 -1
- package/Build/Workers/{chunk-5VKZVPO5.js → chunk-ZBZRTRJB.js} +10 -10
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +25 -25
- package/Build/Workers/createWallOutlineGeometry.js +24 -24
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +12 -12
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/BoundingSphere.js +1 -1
- package/Source/Core/Cartesian2.js +7 -5
- package/Source/Core/Cartesian3.js +8 -6
- package/Source/Core/Cartesian4.js +8 -6
- package/Source/Core/Color.js +5 -3
- package/Source/Core/DeveloperError.js +2 -1
- package/Source/Core/ITwinPlatform.js +1 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/S2Cell.js +2 -2
- package/Source/Core/TerrainMesh.js +10 -1
- package/Source/Core/TerrainPicker.js +1 -0
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/assert.js +27 -0
- package/Source/Core/globalTypes.js +4 -0
- package/Source/DataSources/CzmlDataSource.js +9 -0
- package/Source/DataSources/PathGraphics.js +13 -0
- package/Source/DataSources/PathVisualizer.js +330 -18
- package/Source/DataSources/StaticGeometryColorBatch.js +7 -2
- package/Source/DataSources/StaticGeometryPerMaterialBatch.js +7 -2
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +3 -1
- package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +3 -1
- package/Source/Renderer/Context.js +1 -1
- package/Source/Renderer/RenderState.js +2 -2
- package/Source/Renderer/VertexArray.js +80 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BillboardCollection.js +65 -364
- package/Source/Scene/BufferPoint.js +148 -0
- package/Source/Scene/BufferPointCollection.js +135 -0
- package/Source/Scene/BufferPointMaterial.js +95 -0
- package/Source/Scene/BufferPolygon.js +516 -0
- package/Source/Scene/BufferPolygonCollection.js +368 -0
- package/Source/Scene/BufferPolygonMaterial.js +41 -0
- package/Source/Scene/BufferPolyline.js +185 -0
- package/Source/Scene/BufferPolylineCollection.js +136 -0
- package/Source/Scene/BufferPolylineMaterial.js +93 -0
- package/Source/Scene/BufferPrimitive.js +347 -0
- package/Source/Scene/BufferPrimitiveCollection.js +702 -0
- package/Source/Scene/BufferPrimitiveMaterial.js +140 -0
- package/Source/Scene/Cesium3DTileContent.js +5 -1
- package/Source/Scene/Cesium3DTileContentFactory.js +9 -0
- package/Source/Scene/Cesium3DTileStyle.js +22 -0
- package/Source/Scene/Cesium3DTileset.js +1 -0
- package/Source/Scene/ClippingPolygonCollection.js +270 -101
- package/Source/Scene/CubeMapPanorama.js +4 -4
- package/Source/Scene/GaussianSplat3DTileContent.js +40 -46
- package/Source/Scene/GaussianSplatPrimitive.js +413 -70
- package/Source/Scene/GetFeatureInfoFormat.js +3 -3
- package/Source/Scene/GltfLoader.js +227 -34
- package/Source/Scene/GltfSpzLoader.js +109 -0
- package/Source/Scene/ITwinData.js +1 -0
- package/Source/Scene/Label.js +32 -0
- package/Source/Scene/LabelCollection.js +14 -13
- package/Source/Scene/Material.js +2 -0
- package/Source/Scene/Megatexture.js +1 -0
- package/Source/Scene/MetadataClassProperty.js +24 -10
- package/Source/Scene/MetadataComponentType.js +115 -23
- package/Source/Scene/Model/CustomShaderPipelineStage.js +3 -1
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +761 -263
- package/Source/Scene/Model/MaterialPipelineStage.js +147 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +3 -3
- package/Source/Scene/Model/ModelDrawCommand.js +6 -0
- package/Source/Scene/Model/ModelReader.js +1 -1
- package/Source/Scene/Model/ModelUtility.js +3 -1
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +330 -0
- package/Source/Scene/ModelComponents.js +1632 -1542
- package/Source/Scene/PickedMetadataInfo.js +1 -0
- package/Source/Scene/ScreenSpaceCameraController.js +13 -0
- package/Source/Scene/SkyBox.js +17 -8
- package/Source/Scene/TileBoundingRegion.js +1 -1
- package/Source/Scene/TileBoundingS2Cell.js +1 -1
- package/Source/Scene/TileBoundingSphere.js +1 -1
- package/Source/Scene/TweenCollection.js +7 -0
- package/Source/Scene/VectorGltf3DTileContent.js +382 -0
- package/Source/Scene/VertexAttributeSemantic.js +14 -0
- package/Source/Scene/WebMapServiceImageryProvider.js +2 -2
- package/Source/Scene/WebMapTileServiceImageryProvider.js +366 -131
- package/Source/Scene/parseStructuralMetadata.js +97 -37
- package/Source/Scene/renderBufferPointCollection.js +334 -0
- package/Source/Scene/renderBufferPolygonCollection.js +386 -0
- package/Source/Scene/renderBufferPolylineCollection.js +529 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +2 -77
- package/Source/Shaders/BillboardCollectionFS.js +2 -77
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -60
- package/Source/Shaders/BillboardCollectionVS.js +2 -60
- package/Source/Shaders/BufferPointMaterialFS.glsl +27 -0
- package/Source/Shaders/BufferPointMaterialFS.js +29 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +48 -0
- package/Source/Shaders/BufferPointMaterialVS.js +50 -0
- package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +30 -0
- package/Source/Shaders/BufferPolygonMaterialVS.js +32 -0
- package/Source/Shaders/BufferPolylineMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolylineMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +49 -0
- package/Source/Shaders/BufferPolylineMaterialVS.js +51 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +34 -48
- package/Source/Shaders/Model/EdgeVisibilityStageFS.js +34 -49
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +98 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +100 -0
- package/Source/Shaders/Model/ModelFS.glsl +15 -0
- package/Source/Shaders/Model/ModelFS.js +15 -0
- package/Source/Shaders/Model/ModelVS.glsl +8 -0
- package/Source/Shaders/Model/ModelVS.js +8 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +64 -33
- package/Source/Shaders/PolygonSignedDistanceFS.js +64 -33
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +9 -2
- package/Source/Shaders/PrimitiveGaussianSplatVS.js +9 -2
- package/Source/Shaders/Voxels/VoxelFS.glsl +1 -1
- package/Source/Shaders/Voxels/VoxelFS.js +1 -1
- package/Source/Workers/decodeDraco.js +3 -0
- package/Source/Workers/decodeI3S.js +5 -2
- package/index.d.ts +1007 -111
- package/index.js +368 -343
- package/package.json +2 -2
|
@@ -5,17 +5,17 @@ import RuntimeError from "../Core/RuntimeError.js";
|
|
|
5
5
|
import ImageryLayerFeatureInfo from "./ImageryLayerFeatureInfo.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Describes the format in which to request GetFeatureInfo from a Web Map Service (WMS) server.
|
|
8
|
+
* Describes the format in which to request GetFeatureInfo from a Web Map Service (WMS) or Web Map Tile Service (WMTS) server.
|
|
9
9
|
*
|
|
10
10
|
* @alias GetFeatureInfoFormat
|
|
11
11
|
* @constructor
|
|
12
12
|
*
|
|
13
13
|
* @param {string} type The type of response to expect from a GetFeatureInfo request. Valid
|
|
14
14
|
* values are 'json', 'xml', 'html', or 'text'.
|
|
15
|
-
* @param {string} [format] The info format to request from the
|
|
15
|
+
* @param {string} [format] The info format to request from the server. This is usually a
|
|
16
16
|
* MIME type such as 'application/json' or text/xml'. If this parameter is not specified, the provider will request 'json'
|
|
17
17
|
* using 'application/json', 'xml' using 'text/xml', 'html' using 'text/html', and 'text' using 'text/plain'.
|
|
18
|
-
* @param {Function} [callback] A function to invoke with the GetFeatureInfo response from the
|
|
18
|
+
* @param {Function} [callback] A function to invoke with the GetFeatureInfo response from the server
|
|
19
19
|
* in order to produce an array of picked {@link ImageryLayerFeatureInfo} instances. If this parameter is not specified,
|
|
20
20
|
* a default function for the type of response is used.
|
|
21
21
|
*/
|
|
@@ -61,7 +61,9 @@ const {
|
|
|
61
61
|
Specular,
|
|
62
62
|
Anisotropy,
|
|
63
63
|
Clearcoat,
|
|
64
|
+
LineStyle,
|
|
64
65
|
Material,
|
|
66
|
+
Vector,
|
|
65
67
|
} = ModelComponents;
|
|
66
68
|
|
|
67
69
|
/**
|
|
@@ -1756,6 +1758,34 @@ function loadClearcoat(loader, clearcoatInfo, frameState) {
|
|
|
1756
1758
|
return clearcoat;
|
|
1757
1759
|
}
|
|
1758
1760
|
|
|
1761
|
+
function loadLineStyle(lineStyleInfo) {
|
|
1762
|
+
if (!defined(lineStyleInfo)) {
|
|
1763
|
+
return undefined;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
const lineStyle = new LineStyle();
|
|
1767
|
+
|
|
1768
|
+
if (defined(lineStyleInfo.width)) {
|
|
1769
|
+
const width = lineStyleInfo.width;
|
|
1770
|
+
if (width > 0 && Math.floor(width) === width) {
|
|
1771
|
+
lineStyle.width = width;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
if (defined(lineStyleInfo.pattern)) {
|
|
1776
|
+
const pattern = lineStyleInfo.pattern;
|
|
1777
|
+
if (pattern >= 0 && pattern <= 65535 && Math.floor(pattern) === pattern) {
|
|
1778
|
+
lineStyle.pattern = pattern;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
if (!defined(lineStyle.width) && !defined(lineStyle.pattern)) {
|
|
1783
|
+
return undefined;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return lineStyle;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1759
1789
|
/**
|
|
1760
1790
|
* Load textures and parse factors and flags for a glTF material
|
|
1761
1791
|
*
|
|
@@ -1840,6 +1870,8 @@ function loadMaterial(loader, gltfMaterial, frameState) {
|
|
|
1840
1870
|
}
|
|
1841
1871
|
}
|
|
1842
1872
|
|
|
1873
|
+
material.lineStyle = loadLineStyle(extensions.BENTLEY_materials_line_style);
|
|
1874
|
+
|
|
1843
1875
|
return material;
|
|
1844
1876
|
}
|
|
1845
1877
|
|
|
@@ -2031,6 +2063,132 @@ function fetchSpzExtensionFrom(extensions) {
|
|
|
2031
2063
|
return undefined;
|
|
2032
2064
|
}
|
|
2033
2065
|
|
|
2066
|
+
function getEdgeVisibilityMaterialColor(loader, materialIndex) {
|
|
2067
|
+
if (!defined(materialIndex)) {
|
|
2068
|
+
return undefined;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
const materials = loader.gltfJson.materials;
|
|
2072
|
+
if (
|
|
2073
|
+
!defined(materials) ||
|
|
2074
|
+
materialIndex < 0 ||
|
|
2075
|
+
materialIndex >= materials.length
|
|
2076
|
+
) {
|
|
2077
|
+
return undefined;
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
const material = materials[materialIndex];
|
|
2081
|
+
if (!defined(material)) {
|
|
2082
|
+
return undefined;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
const metallicRoughness =
|
|
2086
|
+
material.pbrMetallicRoughness ?? Frozen.EMPTY_OBJECT;
|
|
2087
|
+
const color = fromArray(Cartesian4, metallicRoughness.baseColorFactor);
|
|
2088
|
+
|
|
2089
|
+
if (defined(color)) {
|
|
2090
|
+
return color;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
return new Cartesian4(1.0, 1.0, 1.0, 1.0);
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
function getLineStringPrimitiveRestartValue(componentType) {
|
|
2097
|
+
switch (componentType) {
|
|
2098
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
2099
|
+
return 255;
|
|
2100
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
2101
|
+
return 65535;
|
|
2102
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
2103
|
+
return 4294967295;
|
|
2104
|
+
default:
|
|
2105
|
+
throw new RuntimeError(
|
|
2106
|
+
"EXT_mesh_primitive_edge_visibility line strings indices must use unsigned scalar component types.",
|
|
2107
|
+
);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
function loadEdgeVisibilityLineStrings(
|
|
2112
|
+
loader,
|
|
2113
|
+
lineStringDefinitions,
|
|
2114
|
+
defaultMaterialIndex,
|
|
2115
|
+
) {
|
|
2116
|
+
if (!defined(lineStringDefinitions) || lineStringDefinitions.length === 0) {
|
|
2117
|
+
return undefined;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
const result = new Array(lineStringDefinitions.length);
|
|
2121
|
+
for (let i = 0; i < lineStringDefinitions.length; i++) {
|
|
2122
|
+
const definition = lineStringDefinitions[i] ?? Frozen.EMPTY_OBJECT;
|
|
2123
|
+
const accessorId = definition.indices;
|
|
2124
|
+
const accessor = loader.gltfJson.accessors[accessorId];
|
|
2125
|
+
|
|
2126
|
+
if (!defined(accessor)) {
|
|
2127
|
+
throw new RuntimeError("Edge visibility line string accessor not found!");
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
const indices = loadAccessor(loader, accessor);
|
|
2131
|
+
const restartIndex = getLineStringPrimitiveRestartValue(
|
|
2132
|
+
accessor.componentType,
|
|
2133
|
+
);
|
|
2134
|
+
const materialIndex = defined(definition.material)
|
|
2135
|
+
? definition.material
|
|
2136
|
+
: defaultMaterialIndex;
|
|
2137
|
+
|
|
2138
|
+
result[i] = {
|
|
2139
|
+
indices: indices,
|
|
2140
|
+
restartIndex: restartIndex,
|
|
2141
|
+
componentType: accessor.componentType,
|
|
2142
|
+
materialColor: getEdgeVisibilityMaterialColor(loader, materialIndex),
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
return result;
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
function loadEdgeVisibility(loader, edgeVisibilityExtension) {
|
|
2150
|
+
if (!defined(edgeVisibilityExtension)) {
|
|
2151
|
+
return undefined;
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
const edgeVisibility = {};
|
|
2155
|
+
|
|
2156
|
+
const visibilityAccessorId = edgeVisibilityExtension.visibility;
|
|
2157
|
+
if (defined(visibilityAccessorId)) {
|
|
2158
|
+
const visibilityAccessor = loader.gltfJson.accessors[visibilityAccessorId];
|
|
2159
|
+
if (!defined(visibilityAccessor)) {
|
|
2160
|
+
throw new RuntimeError("Edge visibility accessor not found!");
|
|
2161
|
+
}
|
|
2162
|
+
edgeVisibility.visibility = loadAccessor(loader, visibilityAccessor);
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
edgeVisibility.materialColor = getEdgeVisibilityMaterialColor(
|
|
2166
|
+
loader,
|
|
2167
|
+
edgeVisibilityExtension.material,
|
|
2168
|
+
);
|
|
2169
|
+
|
|
2170
|
+
if (defined(edgeVisibilityExtension.silhouetteNormals)) {
|
|
2171
|
+
const silhouetteNormalsAccessor =
|
|
2172
|
+
loader.gltfJson.accessors[edgeVisibilityExtension.silhouetteNormals];
|
|
2173
|
+
if (defined(silhouetteNormalsAccessor)) {
|
|
2174
|
+
edgeVisibility.silhouetteNormals = loadAccessor(
|
|
2175
|
+
loader,
|
|
2176
|
+
silhouetteNormalsAccessor,
|
|
2177
|
+
);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
if (defined(edgeVisibilityExtension.lineStrings)) {
|
|
2182
|
+
edgeVisibility.lineStrings = loadEdgeVisibilityLineStrings(
|
|
2183
|
+
loader,
|
|
2184
|
+
edgeVisibilityExtension.lineStrings,
|
|
2185
|
+
edgeVisibilityExtension.material,
|
|
2186
|
+
);
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
return edgeVisibility;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2034
2192
|
/**
|
|
2035
2193
|
* Load resources associated with a mesh primitive for a glTF node
|
|
2036
2194
|
* @param {GltfLoader} loader
|
|
@@ -2055,6 +2213,10 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2055
2213
|
}
|
|
2056
2214
|
|
|
2057
2215
|
const extensions = gltfPrimitive.extensions ?? Frozen.EMPTY_OBJECT;
|
|
2216
|
+
const meshVectorExtension = extensions.CESIUM_mesh_vector;
|
|
2217
|
+
if (defined(meshVectorExtension)) {
|
|
2218
|
+
primitive.vector = loadMeshVectorExtension(loader, meshVectorExtension);
|
|
2219
|
+
}
|
|
2058
2220
|
|
|
2059
2221
|
let needsPostProcessing = false;
|
|
2060
2222
|
const outlineExtension = extensions.CESIUM_primitive_outline;
|
|
@@ -2068,40 +2230,10 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2068
2230
|
);
|
|
2069
2231
|
}
|
|
2070
2232
|
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
const visibilityAccessor =
|
|
2076
|
-
loader.gltfJson.accessors[edgeVisibilityExtension.visibility];
|
|
2077
|
-
if (!defined(visibilityAccessor)) {
|
|
2078
|
-
throw new RuntimeError("Edge visibility accessor not found!");
|
|
2079
|
-
}
|
|
2080
|
-
const visibilityValues = loadAccessor(loader, visibilityAccessor);
|
|
2081
|
-
primitive.edgeVisibility = {
|
|
2082
|
-
visibility: visibilityValues,
|
|
2083
|
-
material: edgeVisibilityExtension.material,
|
|
2084
|
-
};
|
|
2085
|
-
|
|
2086
|
-
// Load silhouette normals
|
|
2087
|
-
if (defined(edgeVisibilityExtension.silhouetteNormals)) {
|
|
2088
|
-
const silhouetteNormalsAccessor =
|
|
2089
|
-
loader.gltfJson.accessors[edgeVisibilityExtension.silhouetteNormals];
|
|
2090
|
-
if (defined(silhouetteNormalsAccessor)) {
|
|
2091
|
-
const silhouetteNormalsValues = loadAccessor(
|
|
2092
|
-
loader,
|
|
2093
|
-
silhouetteNormalsAccessor,
|
|
2094
|
-
);
|
|
2095
|
-
primitive.edgeVisibility.silhouetteNormals = silhouetteNormalsValues;
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
|
-
// Load line strings
|
|
2100
|
-
if (defined(edgeVisibilityExtension.lineStrings)) {
|
|
2101
|
-
primitivePlan.edgeVisibility.lineStrings =
|
|
2102
|
-
edgeVisibilityExtension.lineStrings;
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2233
|
+
primitive.edgeVisibility = loadEdgeVisibility(
|
|
2234
|
+
loader,
|
|
2235
|
+
extensions.EXT_mesh_primitive_edge_visibility,
|
|
2236
|
+
);
|
|
2105
2237
|
|
|
2106
2238
|
//support the latest glTF spec and the legacy extension
|
|
2107
2239
|
const spzExtension = fetchSpzExtensionFrom(extensions);
|
|
@@ -2195,6 +2327,7 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2195
2327
|
const meshFeatures = extensions.EXT_mesh_features;
|
|
2196
2328
|
const featureMetadataLegacy = extensions.EXT_feature_metadata;
|
|
2197
2329
|
const hasFeatureMetadataLegacy = defined(featureMetadataLegacy);
|
|
2330
|
+
const gpmLocal = extensions.NGA_gpm_local;
|
|
2198
2331
|
|
|
2199
2332
|
// Load feature Ids
|
|
2200
2333
|
if (defined(meshFeatures)) {
|
|
@@ -2215,6 +2348,10 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2215
2348
|
loadPrimitiveMetadataLegacy(loader, primitive, featureMetadataLegacy);
|
|
2216
2349
|
}
|
|
2217
2350
|
|
|
2351
|
+
if (defined(gpmLocal)) {
|
|
2352
|
+
loadGpmExtension(primitive, gpmLocal);
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2218
2355
|
const primitiveType = gltfPrimitive.mode;
|
|
2219
2356
|
if (loadForClassification && primitiveType !== PrimitiveType.TRIANGLES) {
|
|
2220
2357
|
throw new RuntimeError(
|
|
@@ -2233,6 +2370,50 @@ function loadPrimitiveOutline(loader, outlineExtension) {
|
|
|
2233
2370
|
return loadAccessor(loader, accessor, useQuaternion);
|
|
2234
2371
|
}
|
|
2235
2372
|
|
|
2373
|
+
/**
|
|
2374
|
+
* Load CESIUM_mesh_vector.
|
|
2375
|
+
* @param {GltfLoader} loader
|
|
2376
|
+
* @param {*} meshVectorExtension
|
|
2377
|
+
* @returns {ModelComponents.Vector}
|
|
2378
|
+
* @ignore
|
|
2379
|
+
*/
|
|
2380
|
+
function loadMeshVectorExtension(loader, meshVectorExtension) {
|
|
2381
|
+
if (!defined(meshVectorExtension)) {
|
|
2382
|
+
return undefined;
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
const result = new Vector();
|
|
2386
|
+
result.vector = meshVectorExtension.vector;
|
|
2387
|
+
result.count = meshVectorExtension.count;
|
|
2388
|
+
|
|
2389
|
+
const accessors = loader.gltfJson.accessors;
|
|
2390
|
+
function loadVectorAccessor(accessorId, name) {
|
|
2391
|
+
if (!defined(accessorId)) {
|
|
2392
|
+
return undefined;
|
|
2393
|
+
}
|
|
2394
|
+
return loadAccessor(loader, accessors[accessorId]);
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
result.polygonAttributeOffsets = loadVectorAccessor(
|
|
2398
|
+
meshVectorExtension.polygonAttributeOffsets,
|
|
2399
|
+
"polygonAttributeOffsets",
|
|
2400
|
+
);
|
|
2401
|
+
result.polygonHoleCounts = loadVectorAccessor(
|
|
2402
|
+
meshVectorExtension.polygonHoleCounts,
|
|
2403
|
+
"polygonHoleCounts",
|
|
2404
|
+
);
|
|
2405
|
+
result.polygonHoleOffsets = loadVectorAccessor(
|
|
2406
|
+
meshVectorExtension.polygonHoleOffsets,
|
|
2407
|
+
"polygonHoleOffsets",
|
|
2408
|
+
);
|
|
2409
|
+
result.polygonIndicesOffsets = loadVectorAccessor(
|
|
2410
|
+
meshVectorExtension.polygonIndicesOffsets,
|
|
2411
|
+
"polygonIndicesOffsets",
|
|
2412
|
+
);
|
|
2413
|
+
|
|
2414
|
+
return result;
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2236
2417
|
// For EXT_mesh_features
|
|
2237
2418
|
function loadPrimitiveFeatures(
|
|
2238
2419
|
loader,
|
|
@@ -2375,6 +2556,13 @@ function loadPrimitiveMetadataLegacy(loader, primitive, metadataExtension) {
|
|
|
2375
2556
|
}
|
|
2376
2557
|
}
|
|
2377
2558
|
|
|
2559
|
+
function loadGpmExtension(primitive, gpmLocal) {
|
|
2560
|
+
const ppeTextures = gpmLocal.ppeTextures ?? [];
|
|
2561
|
+
for (let i = 0; i < ppeTextures.length; i++) {
|
|
2562
|
+
primitive.propertyTextureIds.push(i);
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2378
2566
|
function loadInstances(loader, nodeExtensions, frameState) {
|
|
2379
2567
|
const instancingExtension = nodeExtensions.EXT_mesh_gpu_instancing;
|
|
2380
2568
|
|
|
@@ -2500,6 +2688,7 @@ function loadNode(loader, gltfNode, frameState) {
|
|
|
2500
2688
|
const nodeExtensions = gltfNode.extensions ?? Frozen.EMPTY_OBJECT;
|
|
2501
2689
|
const instancingExtension = nodeExtensions.EXT_mesh_gpu_instancing;
|
|
2502
2690
|
const articulationsExtension = nodeExtensions.AGI_articulations;
|
|
2691
|
+
const meshVectorExtension = nodeExtensions.CESIUM_mesh_vector;
|
|
2503
2692
|
|
|
2504
2693
|
if (defined(instancingExtension)) {
|
|
2505
2694
|
if (loader._loadForClassification) {
|
|
@@ -2514,6 +2703,10 @@ function loadNode(loader, gltfNode, frameState) {
|
|
|
2514
2703
|
node.articulationName = articulationsExtension.articulationName;
|
|
2515
2704
|
}
|
|
2516
2705
|
|
|
2706
|
+
if (defined(meshVectorExtension)) {
|
|
2707
|
+
node.meshVector = meshVectorExtension;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2517
2710
|
const meshId = gltfNode.mesh;
|
|
2518
2711
|
if (defined(meshId)) {
|
|
2519
2712
|
const mesh = loader.gltfJson.meshes[meshId];
|
|
@@ -1,10 +1,88 @@
|
|
|
1
1
|
import Check from "../Core/Check.js";
|
|
2
2
|
import Frozen from "../Core/Frozen.js";
|
|
3
3
|
import defined from "../Core/defined.js";
|
|
4
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
4
5
|
import ResourceLoader from "./ResourceLoader.js";
|
|
5
6
|
import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
6
7
|
import { loadSpz } from "@spz-loader/core";
|
|
7
8
|
|
|
9
|
+
// Cumulative number of SH coefficient floats per splat per channel for each
|
|
10
|
+
// degree. Degree 0 has no extra SH data (base color is stored separately in
|
|
11
|
+
// the "colors" attribute). Degrees 1-3 follow the standard SH basis count:
|
|
12
|
+
// l=1 adds 3 bands × 3 channels = 9; l=2 adds 5 × 3 = 15 (total 24);
|
|
13
|
+
// l=3 adds 7 × 3 = 21 (total 45).
|
|
14
|
+
const SH_FLOATS_PER_SPLAT_BY_DEGREE = [0, 9, 24, 45];
|
|
15
|
+
|
|
16
|
+
// Non-SH attribute floats per splat: position(3) + scale(3) + rotation(4)
|
|
17
|
+
// + opacity(1) + color(3) = 14.
|
|
18
|
+
const BASE_FLOATS_PER_SPLAT = 14;
|
|
19
|
+
|
|
20
|
+
// The spz-loader WASM module is compiled with a signed 32-bit address space,
|
|
21
|
+
// giving a hard ceiling of 2 GB. An additional factor of ~2× is required
|
|
22
|
+
// because spz-loader copies every decoded C++ vector into a JavaScript
|
|
23
|
+
// TypedArray. 1.6 GB is used as a conservative pre-flight threshold.
|
|
24
|
+
const WASM_MEMORY_LIMIT_BYTES = 1.6 * 1024 * 1024 * 1024;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Derives the point count and maximum spherical harmonics degree for an SPZ
|
|
28
|
+
* primitive from the glTF JSON, without touching the compressed binary data.
|
|
29
|
+
* <p>
|
|
30
|
+
* The SPZ payload is gzip-compressed and therefore cannot be inspected
|
|
31
|
+
* directly. Instead, <code>numPoints</code> is read from the POSITION
|
|
32
|
+
* accessor's <code>count</code> field and <code>shDegree</code> is inferred
|
|
33
|
+
* from the highest-numbered <code>SH_DEGREE_n</code> attribute present in
|
|
34
|
+
* the primitive. Returns <code>undefined</code> if the required information
|
|
35
|
+
* is unavailable.
|
|
36
|
+
* </p>
|
|
37
|
+
* @param {object} gltf The glTF JSON object.
|
|
38
|
+
* @param {object} primitive The glTF primitive object.
|
|
39
|
+
* @returns {{ numPoints: number, shDegree: number }|undefined}
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
function getSpzInfoFromGltf(gltf, primitive) {
|
|
43
|
+
const attributes = primitive?.attributes;
|
|
44
|
+
if (!defined(attributes)) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const positionAccessorId = attributes["POSITION"];
|
|
49
|
+
if (!defined(positionAccessorId)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const accessor = gltf?.accessors?.[positionAccessorId];
|
|
53
|
+
if (!defined(accessor) || accessor.count <= 0) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let shDegree = 0;
|
|
58
|
+
for (const semantic in attributes) {
|
|
59
|
+
if (Object.prototype.hasOwnProperty.call(attributes, semantic)) {
|
|
60
|
+
const match = /SH_DEGREE_(\d+)_COEF_/.exec(semantic);
|
|
61
|
+
if (match) {
|
|
62
|
+
shDegree = Math.max(shDegree, parseInt(match[1], 10));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return { numPoints: accessor.count, shDegree };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Estimates the peak memory consumption (in bytes) of decoding an SPZ file
|
|
72
|
+
* with the given parameters. The estimate accounts for both the WASM heap
|
|
73
|
+
* allocations and the JavaScript TypedArray copies produced by spz-loader.
|
|
74
|
+
* @param {number} numPoints Number of Gaussian splats.
|
|
75
|
+
* @param {number} shDegree Spherical harmonics degree (0–3).
|
|
76
|
+
* @returns {number} Estimated byte count.
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
function estimateSpzMemoryBytes(numPoints, shDegree) {
|
|
80
|
+
const floatsPerPoint =
|
|
81
|
+
BASE_FLOATS_PER_SPLAT + (SH_FLOATS_PER_SPLAT_BY_DEGREE[shDegree] ?? 0);
|
|
82
|
+
// ×2 accounts for WASM heap + JS TypedArray mirror.
|
|
83
|
+
return numPoints * floatsPerPoint * Float32Array.BYTES_PER_ELEMENT * 2;
|
|
84
|
+
}
|
|
85
|
+
|
|
8
86
|
/**
|
|
9
87
|
* Load a SPZ buffer from a glTF.
|
|
10
88
|
* <p>
|
|
@@ -128,6 +206,36 @@ class GltfSpzLoader extends ResourceLoader {
|
|
|
128
206
|
return false;
|
|
129
207
|
}
|
|
130
208
|
|
|
209
|
+
// Reject oversized SPZ payloads before invoking the WASM decoder.
|
|
210
|
+
// The spz-loader WASM module has a hard 2 GB memory ceiling; exceeding
|
|
211
|
+
// it causes an unrecoverable Aborted() call with no useful diagnostic.
|
|
212
|
+
// See: https://github.com/CesiumGS/cesium/issues/13283
|
|
213
|
+
//
|
|
214
|
+
// The SPZ binary is gzip-compressed, so its header cannot be read
|
|
215
|
+
// directly. Point count and SH degree are therefore derived from the
|
|
216
|
+
// glTF JSON, which is available at this stage.
|
|
217
|
+
const spzInfo = getSpzInfoFromGltf(this._gltf, this._primitive);
|
|
218
|
+
if (defined(spzInfo)) {
|
|
219
|
+
const estimatedBytes = estimateSpzMemoryBytes(
|
|
220
|
+
spzInfo.numPoints,
|
|
221
|
+
spzInfo.shDegree,
|
|
222
|
+
);
|
|
223
|
+
if (estimatedBytes > WASM_MEMORY_LIMIT_BYTES) {
|
|
224
|
+
const estimatedMB = Math.round(estimatedBytes / (1024 * 1024));
|
|
225
|
+
handleError(
|
|
226
|
+
this,
|
|
227
|
+
new RuntimeError(
|
|
228
|
+
`SPZ data too large to decode: ${spzInfo.numPoints.toLocaleString()} splats ` +
|
|
229
|
+
`with spherical harmonics degree ${spzInfo.shDegree} would require ` +
|
|
230
|
+
`approximately ${estimatedMB} MB, which exceeds the WASM memory limit. ` +
|
|
231
|
+
`Consider using a lower spherical harmonics degree or splitting the ` +
|
|
232
|
+
`dataset into smaller tiles.`,
|
|
233
|
+
),
|
|
234
|
+
);
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
131
239
|
const decodePromise = loadSpz(this._bufferViewTypedArray, {
|
|
132
240
|
unpackOptions: { coordinateSystem: "UNSPECIFIED" },
|
|
133
241
|
});
|
|
@@ -214,4 +322,5 @@ async function processDecode(loader, decodePromise) {
|
|
|
214
322
|
}
|
|
215
323
|
}
|
|
216
324
|
|
|
325
|
+
export { estimateSpzMemoryBytes, getSpzInfoFromGltf };
|
|
217
326
|
export default GltfSpzLoader;
|
|
@@ -138,6 +138,7 @@ ITwinData.createTilesetForRealityDataId = async function ({
|
|
|
138
138
|
ITwinPlatform.RealityDataType.PNTS,
|
|
139
139
|
ITwinPlatform.RealityDataType.RealityMesh3DTiles,
|
|
140
140
|
ITwinPlatform.RealityDataType.Terrain3DTiles,
|
|
141
|
+
ITwinPlatform.RealityDataType.GaussianSplat3DTiles,
|
|
141
142
|
];
|
|
142
143
|
|
|
143
144
|
if (!supportedRealityDataTypes.includes(type)) {
|
package/Source/Scene/Label.js
CHANGED
|
@@ -1186,6 +1186,38 @@ Object.defineProperties(Label.prototype, {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
},
|
|
1188
1188
|
},
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* When <code>true</code>, this label is ready to render, i.e., the glyphs have been mapped and the WebGL resources are created. This property is exposed for testing purposes.
|
|
1192
|
+
* @memberof Label.prototype
|
|
1193
|
+
* @type {boolean}
|
|
1194
|
+
* @readonly
|
|
1195
|
+
* @private
|
|
1196
|
+
*/
|
|
1197
|
+
ready: {
|
|
1198
|
+
get: function () {
|
|
1199
|
+
if (this._rebindAllGlyphs || this._repositionAllGlyphs) {
|
|
1200
|
+
return false;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
if (
|
|
1204
|
+
defined(this._backgroundBillboard) &&
|
|
1205
|
+
!this._backgroundBillboard.ready
|
|
1206
|
+
) {
|
|
1207
|
+
return false;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
const glyphs = this._glyphs;
|
|
1211
|
+
for (let i = 0, len = glyphs.length; i < len; i++) {
|
|
1212
|
+
const glyph = glyphs[i];
|
|
1213
|
+
if (defined(glyph.billboard) && !glyph.billboard.ready) {
|
|
1214
|
+
return false;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
return true;
|
|
1219
|
+
},
|
|
1220
|
+
},
|
|
1189
1221
|
});
|
|
1190
1222
|
|
|
1191
1223
|
Label.prototype._updateClamping = function () {
|
|
@@ -85,6 +85,8 @@ function getWhitePixelBillboard(billboardCollection, labelCollection) {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
billboard.setImageTexture(billboardTexture);
|
|
88
|
+
billboard._positionFromParent = true;
|
|
89
|
+
billboard._labelTranslate = new Cartesian2();
|
|
88
90
|
|
|
89
91
|
return billboard;
|
|
90
92
|
}
|
|
@@ -288,6 +290,9 @@ function rebindAllGlyphs(labelCollection, label) {
|
|
|
288
290
|
billboard.horizontalOrigin = HorizontalOrigin.LEFT;
|
|
289
291
|
billboard.verticalOrigin = label._verticalOrigin;
|
|
290
292
|
billboard.heightReference = label._heightReference;
|
|
293
|
+
if (defined(label._clampedPosition)) {
|
|
294
|
+
billboard._clampedPosition = label._clampedPosition;
|
|
295
|
+
}
|
|
291
296
|
billboard.scale = label.totalScale;
|
|
292
297
|
billboard.pickPrimitive = label;
|
|
293
298
|
billboard.id = label._id;
|
|
@@ -342,6 +347,9 @@ function updateBackgroundBillboard(
|
|
|
342
347
|
backgroundBillboard.horizontalOrigin = HorizontalOrigin.LEFT;
|
|
343
348
|
backgroundBillboard.verticalOrigin = label._verticalOrigin;
|
|
344
349
|
backgroundBillboard.heightReference = label._heightReference;
|
|
350
|
+
if (defined(label._clampedPosition)) {
|
|
351
|
+
backgroundBillboard._clampedPosition = label._clampedPosition;
|
|
352
|
+
}
|
|
345
353
|
backgroundBillboard.scale = label.totalScale;
|
|
346
354
|
backgroundBillboard.pickPrimitive = label;
|
|
347
355
|
backgroundBillboard.id = label._id;
|
|
@@ -493,6 +501,12 @@ function repositionAllGlyphs(label) {
|
|
|
493
501
|
glyph.billboard._labelDimensions.x = totalLineWidth;
|
|
494
502
|
glyph.billboard._labelDimensions.y = totalLineHeight;
|
|
495
503
|
glyph.billboard._labelHorizontalOrigin = horizontalOrigin;
|
|
504
|
+
if (isHeightReferenceClamp(label.heightReference)) {
|
|
505
|
+
glyph.billboard._labelTranslate = Cartesian2.clone(
|
|
506
|
+
glyphPixelOffset,
|
|
507
|
+
glyph.billboard._labelTranslate,
|
|
508
|
+
);
|
|
509
|
+
}
|
|
496
510
|
}
|
|
497
511
|
|
|
498
512
|
//Compute the next x offset taking into account the kerning performed
|
|
@@ -536,19 +550,6 @@ function repositionAllGlyphs(label) {
|
|
|
536
550
|
backgroundBillboard._labelTranslate,
|
|
537
551
|
);
|
|
538
552
|
}
|
|
539
|
-
|
|
540
|
-
if (isHeightReferenceClamp(label.heightReference)) {
|
|
541
|
-
for (let glyphIndex = 0; glyphIndex < glyphLength; ++glyphIndex) {
|
|
542
|
-
const glyph = glyphs[glyphIndex];
|
|
543
|
-
const billboard = glyph.billboard;
|
|
544
|
-
if (defined(billboard)) {
|
|
545
|
-
billboard._labelTranslate = Cartesian2.clone(
|
|
546
|
-
glyphPixelOffset,
|
|
547
|
-
billboard._labelTranslate,
|
|
548
|
-
);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
553
|
}
|
|
553
554
|
|
|
554
555
|
function destroyLabel(labelCollection, label) {
|
package/Source/Scene/Material.js
CHANGED
|
@@ -354,6 +354,7 @@ function Material(options) {
|
|
|
354
354
|
|
|
355
355
|
/**
|
|
356
356
|
* The {@link TextureMinificationFilter} to apply to this material's textures.
|
|
357
|
+
* @memberof Material.prototype
|
|
357
358
|
* @type {TextureMinificationFilter}
|
|
358
359
|
* @default TextureMinificationFilter.LINEAR
|
|
359
360
|
*/
|
|
@@ -368,6 +369,7 @@ function Material(options) {
|
|
|
368
369
|
|
|
369
370
|
/**
|
|
370
371
|
* The {@link TextureMagnificationFilter} to apply to this material's textures.
|
|
372
|
+
* @memberof Material.prototype
|
|
371
373
|
* @type {TextureMagnificationFilter}
|
|
372
374
|
* @default TextureMagnificationFilter.LINEAR
|
|
373
375
|
*/
|
|
@@ -1191,21 +1191,36 @@ MetadataClassProperty.valueTransformInPlace = function (
|
|
|
1191
1191
|
};
|
|
1192
1192
|
|
|
1193
1193
|
/**
|
|
1194
|
-
* Determines the byte size of a single property element.
|
|
1194
|
+
* Determines the byte size of a single property element, stored on the CPU.
|
|
1195
1195
|
* For example, if the metadata type is VEC3 and the component type is FLOAT32, this would return 12 bytes.
|
|
1196
1196
|
*
|
|
1197
1197
|
* @returns {number} The byte size of a single property element.
|
|
1198
1198
|
*
|
|
1199
1199
|
* @private
|
|
1200
1200
|
*/
|
|
1201
|
-
MetadataClassProperty.prototype.
|
|
1202
|
-
|
|
1203
|
-
|
|
1201
|
+
MetadataClassProperty.prototype.cpuBytesPerElement = function () {
|
|
1202
|
+
return bytesPerElement(this, this.valueType);
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* Determines the byte size of a single property element, stored on the GPU.
|
|
1207
|
+
* This differs from the CPU byte size if the element type is a 64-bit type that can be
|
|
1208
|
+
* downcast to a 32-bit type for texture packing (only relevant for textures created from property tables).
|
|
1209
|
+
*
|
|
1210
|
+
* @returns {number} The byte size of a single property element on the GPU.
|
|
1211
|
+
*/
|
|
1212
|
+
MetadataClassProperty.prototype.gpuBytesPerElement = function () {
|
|
1213
|
+
const packedType = MetadataComponentType.gpuComponentType(this.valueType);
|
|
1214
|
+
return bytesPerElement(this, packedType);
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
function bytesPerElement(classProperty, valueType) {
|
|
1218
|
+
const type = classProperty.type;
|
|
1204
1219
|
const componentCount = MetadataType.getComponentCount(type);
|
|
1205
|
-
const arrayLength =
|
|
1220
|
+
const arrayLength = classProperty.isArray ? classProperty.arrayLength : 1;
|
|
1206
1221
|
const bytesPerComponent = MetadataComponentType.getSizeInBytes(valueType);
|
|
1207
1222
|
return componentCount * arrayLength * bytesPerComponent;
|
|
1208
|
-
}
|
|
1223
|
+
}
|
|
1209
1224
|
|
|
1210
1225
|
/**
|
|
1211
1226
|
* Determines whether this property can be stored in a texture, given the property's datatype and the number of
|
|
@@ -1240,9 +1255,8 @@ MetadataClassProperty.prototype.isGpuCompatible = function (channelsLength) {
|
|
|
1240
1255
|
}
|
|
1241
1256
|
|
|
1242
1257
|
// For all other properties, make sure the components fit in the sampled channels.
|
|
1243
|
-
// (
|
|
1244
|
-
|
|
1245
|
-
if (elementSizeInBytes > channelsLength) {
|
|
1258
|
+
// (64-bit types can be downcast to 32-bit types for texture packing. In the future, support for full 64-bit types may be added)
|
|
1259
|
+
if (this.gpuBytesPerElement() > channelsLength) {
|
|
1246
1260
|
return false;
|
|
1247
1261
|
}
|
|
1248
1262
|
|
|
@@ -1317,7 +1331,7 @@ MetadataClassProperty.prototype.unpackTextureInShader = function (
|
|
|
1317
1331
|
shaderLines,
|
|
1318
1332
|
) {
|
|
1319
1333
|
const glslType = this.getGlslType();
|
|
1320
|
-
const valueType = this.valueType;
|
|
1334
|
+
const valueType = MetadataComponentType.gpuComponentType(this.valueType);
|
|
1321
1335
|
const numChannels = channelsString.length;
|
|
1322
1336
|
const type = this.type;
|
|
1323
1337
|
|