@cesium/engine 18.3.1-ion.1 → 20.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/ThirdParty/Workers/pako_deflate.min.js +3 -3
- package/Build/ThirdParty/Workers/pako_inflate.min.js +3 -3
- package/Build/ThirdParty/Workers/z-worker-pako.js +80 -89
- package/Build/Workers/{chunk-G7F2CKBW.js → chunk-22LUVCO3.js} +2 -2
- package/Build/Workers/{chunk-AIBIEA2N.js → chunk-3BO4XBWM.js} +12 -12
- package/Build/Workers/{chunk-LPLMZKZS.js → chunk-3SQPZVG4.js} +1 -1
- package/Build/Workers/{chunk-KQ7OYXT6.js → chunk-4O5SZ2RE.js} +3 -3
- package/Build/Workers/{chunk-EF747DYS.js → chunk-4UIKSIEZ.js} +9 -9
- package/Build/Workers/{chunk-LDFRBRJO.js → chunk-5FZEM66Y.js} +12 -12
- package/Build/Workers/{chunk-Z7UO3S7L.js → chunk-5G56VVL3.js} +10 -10
- package/Build/Workers/{chunk-KUVAFSVU.js → chunk-5GKRDXYJ.js} +12 -12
- package/Build/Workers/{chunk-GIRJEZHU.js → chunk-5W4EBNO3.js} +14 -14
- package/Build/Workers/{chunk-XMFKOU5X.js → chunk-67RLCIDP.js} +7 -7
- package/Build/Workers/{chunk-ACOAKTBU.js → chunk-74VODBWB.js} +4 -4
- package/Build/Workers/{chunk-QTFE5TBC.js → chunk-7HOD2LGH.js} +10 -10
- package/Build/Workers/{chunk-GOSJZP7N.js → chunk-D25QOWHR.js} +1 -1
- package/Build/Workers/{chunk-5UWLMG6V.js → chunk-D63DK275.js} +7 -7
- package/Build/Workers/{chunk-4JMMKZ4N.js → chunk-EHOOC4HJ.js} +5 -5
- package/Build/Workers/{chunk-PFTYXAVG.js → chunk-ELI5ZYDR.js} +5 -5
- package/Build/Workers/{chunk-RQRKALHB.js → chunk-FGF4ETPY.js} +9 -9
- package/Build/Workers/{chunk-YPMSP4IH.js → chunk-FKWL63D4.js} +5 -5
- package/Build/Workers/{chunk-IC5M3JRR.js → chunk-FLH3ZH2X.js} +4 -4
- package/Build/Workers/{chunk-5DF22LFV.js → chunk-HDOFAYEE.js} +16 -16
- package/Build/Workers/{chunk-37V6UO2J.js → chunk-HHUHFFYN.js} +5 -5
- package/Build/Workers/{chunk-GSLSXQGX.js → chunk-IHUXLSNT.js} +5 -4
- package/Build/Workers/{chunk-K4HUWRWA.js → chunk-IJM2HVTV.js} +1 -1
- package/Build/Workers/{chunk-AKLRSDAY.js → chunk-IPXMWP5Z.js} +6 -6
- package/Build/Workers/{chunk-G6I5XO4E.js → chunk-IWKYS6RV.js} +6 -6
- package/Build/Workers/{chunk-RVQ7LHW3.js → chunk-JMX3P7DE.js} +8 -8
- package/Build/Workers/{chunk-OQNQNBEM.js → chunk-JQSMAZAT.js} +9 -9
- package/Build/Workers/{chunk-GGNZKIG3.js → chunk-JRLT2FQV.js} +8 -8
- package/Build/Workers/{chunk-GK5WVMVN.js → chunk-KRXL3KZL.js} +13 -13
- package/Build/Workers/{chunk-OVXYMPQ7.js → chunk-KWB7PPVO.js} +2 -2
- package/Build/Workers/{chunk-DG4CHTQN.js → chunk-M62PWLGC.js} +16 -16
- package/Build/Workers/{chunk-T3UE5LOS.js → chunk-MSLO3MQF.js} +5 -5
- package/Build/Workers/{chunk-ZGH3R3CO.js → chunk-MZZK44UI.js} +6 -6
- package/Build/Workers/{chunk-3T2QV5NN.js → chunk-NB2NKFJL.js} +6 -6
- package/Build/Workers/{chunk-W2EMENZQ.js → chunk-NJYFQE5B.js} +1 -1
- package/Build/Workers/{chunk-GG2NLIC6.js → chunk-O2O4FYNI.js} +2 -2
- package/Build/Workers/{chunk-6HT3OW6S.js → chunk-PZEPLREA.js} +2 -2
- package/Build/Workers/{chunk-MYMBUYST.js → chunk-S2RSJJQI.js} +4 -4
- package/Build/Workers/{chunk-QBRCP474.js → chunk-S3UYLP3X.js} +8 -8
- package/Build/Workers/{chunk-JVSY3BGV.js → chunk-TH3P77KJ.js} +5 -5
- package/Build/Workers/{chunk-4HDG7AFU.js → chunk-UGSQJYGE.js} +6 -6
- package/Build/Workers/{chunk-SMVRX64E.js → chunk-UUXOFY6G.js} +12 -12
- package/Build/Workers/{chunk-DPG3EG2U.js → chunk-V36BVRDX.js} +11 -11
- package/Build/Workers/{chunk-3HRMP3V7.js → chunk-VJ2DNCFT.js} +4 -4
- package/Build/Workers/{chunk-DH3XQXDD.js → chunk-VQUVJWBK.js} +4 -4
- package/Build/Workers/{chunk-AJANTRVW.js → chunk-VWQWZ7OL.js} +5 -5
- package/Build/Workers/{chunk-XPXBRZXF.js → chunk-VXBNLAG4.js} +7 -7
- package/Build/Workers/{chunk-GXEQK7P4.js → chunk-W3KNMQT2.js} +6 -6
- package/Build/Workers/{chunk-5RUDB5R4.js → chunk-WIGH3CPD.js} +2 -2
- package/Build/Workers/{chunk-GMNXNBM4.js → chunk-XVHLXVN3.js} +1 -1
- package/Build/Workers/{chunk-KSNUH6WJ.js → chunk-YHB3RNF2.js} +4 -4
- package/Build/Workers/{chunk-BTXGNWFF.js → chunk-ZSHDRKLT.js} +4 -4
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +21 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +25 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/transcodeKTX2.js +17 -16
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/LICENSE.md +32 -25
- package/Source/Core/Ellipsoid.js +9 -0
- package/Source/Core/ITwinPlatform.js +8 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +14 -8
- package/Source/Core/ScreenSpaceEventHandler.js +3 -3
- package/Source/Core/addAllToArray.js +40 -0
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +54 -26
- package/Source/Renderer/Context.js +8 -4
- package/Source/Renderer/Renderbuffer.js +4 -2
- package/Source/Renderer/Sampler.js +13 -0
- package/Source/Renderer/ShaderBuilder.js +7 -6
- package/Source/Renderer/SharedContext.js +186 -0
- package/Source/Renderer/Texture.js +4 -5
- package/Source/Renderer/Texture3D.js +17 -7
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BillboardCollection.js +1 -1
- package/Source/Scene/BingMapsImageryProvider.js +1 -1
- package/Source/Scene/Cesium3DTileBatchTable.js +6 -4
- package/Source/Scene/Cesium3DTileContentFactory.js +7 -16
- package/Source/Scene/Cesium3DTileStyle.js +4 -3
- package/Source/Scene/Cesium3DTileset.js +2 -2
- package/Source/Scene/ConditionsExpression.js +3 -2
- package/Source/Scene/GaussianSplat3DTileContent.js +253 -9
- package/Source/Scene/GaussianSplatPrimitive.js +167 -15
- package/Source/Scene/GltfLoader.js +23 -4
- package/Source/Scene/GltfPipeline/ForEach.js +7 -7
- package/Source/Scene/GltfPipeline/addDefaults.js +1 -2
- package/Source/Scene/GltfPipeline/addToArray.js +2 -0
- package/Source/Scene/GltfPipeline/findAccessorMinMax.js +1 -1
- package/Source/Scene/GltfPipeline/getComponentReader.js +16 -16
- package/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js +1 -1
- package/Source/Scene/GltfPipeline/moveTechniquesToExtension.js +3 -3
- package/Source/Scene/GltfPipeline/parseGlb.js +1 -1
- package/Source/Scene/GltfPipeline/readAccessorPacked.js +2 -2
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +5 -6
- package/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +13 -13
- package/Source/Scene/GltfSpzLoader.js +3 -1
- package/Source/Scene/GltfVertexBufferLoader.js +56 -2
- package/Source/Scene/HeightReference.js +1 -1
- package/Source/Scene/ITwinData.js +49 -25
- package/Source/Scene/ImageBasedLighting.js +6 -2
- package/Source/Scene/ImageryLayer.js +10 -10
- package/Source/Scene/MetadataTableProperty.js +2 -1
- package/Source/Scene/Model/ClassificationModelDrawCommand.js +7 -6
- package/Source/Scene/Model/GeoJsonLoader.js +3 -1
- package/Source/Scene/Model/ImageryConfiguration.js +1 -0
- package/Source/Scene/Model/ImageryPipelineStage.js +8 -2
- package/Source/Scene/Model/InstancingPipelineStage.js +3 -8
- package/Source/Scene/Model/MaterialPipelineStage.js +10 -1
- package/Source/Scene/Model/Model.js +3 -0
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +8 -2
- package/Source/Scene/Model/ModelImagery.js +3 -0
- package/Source/Scene/Model/ModelSceneGraph.js +2 -1
- package/Source/Scene/Model/ModelUtility.js +1 -0
- package/Source/Scene/Model/PntsLoader.js +7 -3
- package/Source/Scene/Picking.js +41 -1
- package/Source/Scene/PntsParser.js +6 -3
- package/Source/Scene/Primitive.js +0 -1
- package/Source/Scene/PrimitiveCollection.js +32 -6
- package/Source/Scene/PrimitiveLoadPlan.js +1 -37
- package/Source/Scene/PropertyTable.js +7 -12
- package/Source/Scene/Scene.js +41 -32
- package/Source/Scene/ScreenSpaceCameraController.js +2 -0
- package/Source/Scene/VertexAttributeSemantic.js +4 -2
- package/Source/Scene/WebMapServiceImageryProvider.js +3 -2
- package/Source/Scene/WebMapTileServiceImageryProvider.js +0 -22
- package/Source/Scene/getMeshPrimitives.js +72 -0
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.glsl +2 -1
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +2 -1
- package/Source/Shaders/EllipsoidVS.glsl +4 -4
- package/Source/Shaders/EllipsoidVS.js +4 -4
- package/Source/Shaders/FXAA3_11.glsl +2 -0
- package/Source/Shaders/FXAA3_11.js +2 -0
- package/Source/Shaders/GlobeVS.glsl +2 -1
- package/Source/Shaders/GlobeVS.js +2 -1
- package/Source/Shaders/PrimitiveGaussianSplatFS.glsl +5 -5
- package/Source/Shaders/PrimitiveGaussianSplatFS.js +5 -5
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +102 -5
- package/Source/Shaders/PrimitiveGaussianSplatVS.js +102 -5
- package/Source/Shaders/SkyAtmosphereVS.glsl +2 -1
- package/Source/Shaders/SkyAtmosphereVS.js +2 -1
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/index.d.ts +191 -54
- package/index.js +93 -90
- package/package.json +4 -4
|
@@ -32,6 +32,8 @@ import VertexAttributeSemantic from "./VertexAttributeSemantic.js";
|
|
|
32
32
|
import GltfGpmLoader from "./Model/Extensions/Gpm/GltfGpmLoader.js";
|
|
33
33
|
import GltfMeshPrimitiveGpmLoader from "./Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js";
|
|
34
34
|
import oneTimeWarning from "../Core/oneTimeWarning.js";
|
|
35
|
+
import addAllToArray from "../Core/addAllToArray.js";
|
|
36
|
+
import getMeshPrimitives from "./getMeshPrimitives.js";
|
|
35
37
|
|
|
36
38
|
const {
|
|
37
39
|
Attribute,
|
|
@@ -1981,6 +1983,22 @@ function loadMorphTarget(
|
|
|
1981
1983
|
return morphTarget;
|
|
1982
1984
|
}
|
|
1983
1985
|
|
|
1986
|
+
function fetchSpzExtensionFrom(extensions) {
|
|
1987
|
+
const gaussianSplatting = extensions?.KHR_gaussian_splatting;
|
|
1988
|
+
const gsExtensions = gaussianSplatting?.extensions;
|
|
1989
|
+
const spz = gsExtensions?.KHR_gaussian_splatting_compression_spz_2;
|
|
1990
|
+
if (defined(spz)) {
|
|
1991
|
+
return spz;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
const legacySpz = extensions?.KHR_spz_gaussian_splats_compression;
|
|
1995
|
+
if (defined(legacySpz)) {
|
|
1996
|
+
return legacySpz;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
return undefined;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
1984
2002
|
/**
|
|
1985
2003
|
* Load resources associated with a mesh primitive for a glTF node
|
|
1986
2004
|
* @param {GltfLoader} loader
|
|
@@ -2018,7 +2036,8 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2018
2036
|
);
|
|
2019
2037
|
}
|
|
2020
2038
|
|
|
2021
|
-
|
|
2039
|
+
//support the latest glTF spec and the legacy extension
|
|
2040
|
+
const spzExtension = fetchSpzExtensionFrom(extensions);
|
|
2022
2041
|
if (defined(spzExtension)) {
|
|
2023
2042
|
needsPostProcessing = true;
|
|
2024
2043
|
primitivePlan.needsGaussianSplats = true;
|
|
@@ -2431,7 +2450,7 @@ function loadNode(loader, gltfNode, frameState) {
|
|
|
2431
2450
|
const meshId = gltfNode.mesh;
|
|
2432
2451
|
if (defined(meshId)) {
|
|
2433
2452
|
const mesh = loader.gltfJson.meshes[meshId];
|
|
2434
|
-
const primitives = mesh
|
|
2453
|
+
const primitives = getMeshPrimitives(mesh);
|
|
2435
2454
|
for (let i = 0; i < primitives.length; ++i) {
|
|
2436
2455
|
node.primitives.push(
|
|
2437
2456
|
loadPrimitive(
|
|
@@ -2827,12 +2846,12 @@ function parse(loader, frameState) {
|
|
|
2827
2846
|
|
|
2828
2847
|
// Gather promises and handle any errors
|
|
2829
2848
|
const readyPromises = [];
|
|
2830
|
-
|
|
2849
|
+
addAllToArray(readyPromises, loader._loaderPromises);
|
|
2831
2850
|
|
|
2832
2851
|
// When incrementallyLoadTextures is true, the errors are caught and thrown individually
|
|
2833
2852
|
// since it doesn't affect the overall loader state
|
|
2834
2853
|
if (!loader._incrementallyLoadTextures) {
|
|
2835
|
-
|
|
2854
|
+
addAllToArray(readyPromises, loader._texturesPromises);
|
|
2836
2855
|
}
|
|
2837
2856
|
|
|
2838
2857
|
return Promise.all(readyPromises);
|
|
@@ -80,7 +80,7 @@ ForEach.accessorWithSemantic = function (gltf, semantic, handler) {
|
|
|
80
80
|
return value;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
}
|
|
83
|
+
},
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
if (defined(valueForEach)) {
|
|
@@ -102,7 +102,7 @@ ForEach.accessorWithSemantic = function (gltf, semantic, handler) {
|
|
|
102
102
|
return value;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
}
|
|
105
|
+
},
|
|
106
106
|
);
|
|
107
107
|
});
|
|
108
108
|
});
|
|
@@ -124,7 +124,7 @@ ForEach.accessorContainingVertexAttributeData = function (gltf, handler) {
|
|
|
124
124
|
return value;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
}
|
|
127
|
+
},
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
if (defined(valueForEach)) {
|
|
@@ -143,7 +143,7 @@ ForEach.accessorContainingVertexAttributeData = function (gltf, handler) {
|
|
|
143
143
|
return value;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
}
|
|
146
|
+
},
|
|
147
147
|
);
|
|
148
148
|
});
|
|
149
149
|
});
|
|
@@ -322,7 +322,7 @@ ForEach.program = function (gltf, handler) {
|
|
|
322
322
|
if (usesExtension(gltf, "KHR_techniques_webgl")) {
|
|
323
323
|
return ForEach.object(
|
|
324
324
|
gltf.extensions.KHR_techniques_webgl.programs,
|
|
325
|
-
handler
|
|
325
|
+
handler,
|
|
326
326
|
);
|
|
327
327
|
}
|
|
328
328
|
|
|
@@ -341,7 +341,7 @@ ForEach.shader = function (gltf, handler) {
|
|
|
341
341
|
if (usesExtension(gltf, "KHR_techniques_webgl")) {
|
|
342
342
|
return ForEach.object(
|
|
343
343
|
gltf.extensions.KHR_techniques_webgl.shaders,
|
|
344
|
-
handler
|
|
344
|
+
handler,
|
|
345
345
|
);
|
|
346
346
|
}
|
|
347
347
|
|
|
@@ -410,7 +410,7 @@ ForEach.technique = function (gltf, handler) {
|
|
|
410
410
|
if (usesExtension(gltf, "KHR_techniques_webgl")) {
|
|
411
411
|
return ForEach.object(
|
|
412
412
|
gltf.extensions.KHR_techniques_webgl.techniques,
|
|
413
|
-
handler
|
|
413
|
+
handler,
|
|
414
414
|
);
|
|
415
415
|
}
|
|
416
416
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import addToArray from "./addToArray.js";
|
|
2
2
|
import ForEach from "./ForEach.js";
|
|
3
3
|
import getAccessorByteStride from "./getAccessorByteStride.js";
|
|
4
|
-
import Frozen from "../../Core/Frozen.js";
|
|
5
4
|
import defined from "../../Core/defined.js";
|
|
6
5
|
import WebGLConstants from "../../Core/WebGLConstants.js";
|
|
7
6
|
|
|
@@ -62,7 +61,7 @@ function addDefaults(gltf) {
|
|
|
62
61
|
});
|
|
63
62
|
|
|
64
63
|
ForEach.material(gltf, function (material) {
|
|
65
|
-
const extensions = material.extensions ??
|
|
64
|
+
const extensions = material.extensions ?? {};
|
|
66
65
|
const materialsCommon = extensions.KHR_materials_common;
|
|
67
66
|
if (defined(materialsCommon)) {
|
|
68
67
|
const technique = materialsCommon.technique;
|
|
@@ -16,11 +16,11 @@ function getComponentReader(componentType) {
|
|
|
16
16
|
byteOffset,
|
|
17
17
|
numberOfComponents,
|
|
18
18
|
componentTypeByteLength,
|
|
19
|
-
result
|
|
19
|
+
result,
|
|
20
20
|
) {
|
|
21
21
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
22
22
|
result[i] = dataView.getInt8(
|
|
23
|
-
byteOffset + i * componentTypeByteLength
|
|
23
|
+
byteOffset + i * componentTypeByteLength,
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
@@ -30,11 +30,11 @@ function getComponentReader(componentType) {
|
|
|
30
30
|
byteOffset,
|
|
31
31
|
numberOfComponents,
|
|
32
32
|
componentTypeByteLength,
|
|
33
|
-
result
|
|
33
|
+
result,
|
|
34
34
|
) {
|
|
35
35
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
36
36
|
result[i] = dataView.getUint8(
|
|
37
|
-
byteOffset + i * componentTypeByteLength
|
|
37
|
+
byteOffset + i * componentTypeByteLength,
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
@@ -44,12 +44,12 @@ function getComponentReader(componentType) {
|
|
|
44
44
|
byteOffset,
|
|
45
45
|
numberOfComponents,
|
|
46
46
|
componentTypeByteLength,
|
|
47
|
-
result
|
|
47
|
+
result,
|
|
48
48
|
) {
|
|
49
49
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
50
50
|
result[i] = dataView.getInt16(
|
|
51
51
|
byteOffset + i * componentTypeByteLength,
|
|
52
|
-
true
|
|
52
|
+
true,
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
@@ -59,12 +59,12 @@ function getComponentReader(componentType) {
|
|
|
59
59
|
byteOffset,
|
|
60
60
|
numberOfComponents,
|
|
61
61
|
componentTypeByteLength,
|
|
62
|
-
result
|
|
62
|
+
result,
|
|
63
63
|
) {
|
|
64
64
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
65
65
|
result[i] = dataView.getUint16(
|
|
66
66
|
byteOffset + i * componentTypeByteLength,
|
|
67
|
-
true
|
|
67
|
+
true,
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
@@ -74,12 +74,12 @@ function getComponentReader(componentType) {
|
|
|
74
74
|
byteOffset,
|
|
75
75
|
numberOfComponents,
|
|
76
76
|
componentTypeByteLength,
|
|
77
|
-
result
|
|
77
|
+
result,
|
|
78
78
|
) {
|
|
79
79
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
80
80
|
result[i] = dataView.getInt32(
|
|
81
81
|
byteOffset + i * componentTypeByteLength,
|
|
82
|
-
true
|
|
82
|
+
true,
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
@@ -89,12 +89,12 @@ function getComponentReader(componentType) {
|
|
|
89
89
|
byteOffset,
|
|
90
90
|
numberOfComponents,
|
|
91
91
|
componentTypeByteLength,
|
|
92
|
-
result
|
|
92
|
+
result,
|
|
93
93
|
) {
|
|
94
94
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
95
95
|
result[i] = dataView.getUint32(
|
|
96
96
|
byteOffset + i * componentTypeByteLength,
|
|
97
|
-
true
|
|
97
|
+
true,
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
};
|
|
@@ -104,12 +104,12 @@ function getComponentReader(componentType) {
|
|
|
104
104
|
byteOffset,
|
|
105
105
|
numberOfComponents,
|
|
106
106
|
componentTypeByteLength,
|
|
107
|
-
result
|
|
107
|
+
result,
|
|
108
108
|
) {
|
|
109
109
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
110
110
|
result[i] = dataView.getFloat32(
|
|
111
111
|
byteOffset + i * componentTypeByteLength,
|
|
112
|
-
true
|
|
112
|
+
true,
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
};
|
|
@@ -119,12 +119,12 @@ function getComponentReader(componentType) {
|
|
|
119
119
|
byteOffset,
|
|
120
120
|
numberOfComponents,
|
|
121
121
|
componentTypeByteLength,
|
|
122
|
-
result
|
|
122
|
+
result,
|
|
123
123
|
) {
|
|
124
124
|
for (let i = 0; i < numberOfComponents; ++i) {
|
|
125
125
|
result[i] = dataView.getFloat64(
|
|
126
126
|
byteOffset + i * componentTypeByteLength,
|
|
127
|
-
true
|
|
127
|
+
true,
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
};
|
|
@@ -44,7 +44,7 @@ function moveTechniquesToExtension(gltf) {
|
|
|
44
44
|
technique.attributes[attributeName] = {
|
|
45
45
|
semantic: parameterLegacy.semantic,
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
ForEach.techniqueUniform(
|
|
@@ -64,7 +64,7 @@ function moveTechniquesToExtension(gltf) {
|
|
|
64
64
|
mappedUniforms[techniqueId] = {};
|
|
65
65
|
}
|
|
66
66
|
mappedUniforms[techniqueId][parameterName] = uniformName;
|
|
67
|
-
}
|
|
67
|
+
},
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
if (!defined(seenPrograms[techniqueLegacy.program])) {
|
|
@@ -92,7 +92,7 @@ function moveTechniquesToExtension(gltf) {
|
|
|
92
92
|
// Store the index of the new technique to reference instead.
|
|
93
93
|
updatedTechniqueIndices[techniqueId] = addToArray(
|
|
94
94
|
extension.techniques,
|
|
95
|
-
technique
|
|
95
|
+
technique,
|
|
96
96
|
);
|
|
97
97
|
});
|
|
98
98
|
|
|
@@ -16,7 +16,7 @@ import defined from "../../Core/defined.js";
|
|
|
16
16
|
function readAccessorPacked(gltf, accessor) {
|
|
17
17
|
const byteStride = getAccessorByteStride(gltf, accessor);
|
|
18
18
|
const componentTypeByteLength = ComponentDatatype.getSizeInBytes(
|
|
19
|
-
accessor.componentType
|
|
19
|
+
accessor.componentType,
|
|
20
20
|
);
|
|
21
21
|
const numberOfComponents = numberOfComponentsForType(accessor.type);
|
|
22
22
|
const count = accessor.count;
|
|
@@ -41,7 +41,7 @@ function readAccessorPacked(gltf, accessor) {
|
|
|
41
41
|
byteOffset,
|
|
42
42
|
numberOfComponents,
|
|
43
43
|
componentTypeByteLength,
|
|
44
|
-
components
|
|
44
|
+
components,
|
|
45
45
|
);
|
|
46
46
|
for (let j = 0; j < numberOfComponents; ++j) {
|
|
47
47
|
values[i * numberOfComponents + j] = components[j];
|
|
@@ -87,7 +87,7 @@ Remove.accessor = function (gltf, accessorId) {
|
|
|
87
87
|
if (attributeAccessorId > accessorId) {
|
|
88
88
|
primitive.attributes[semantic]--;
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
},
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
// Update accessor ids for the targets.
|
|
@@ -98,7 +98,7 @@ Remove.accessor = function (gltf, accessorId) {
|
|
|
98
98
|
if (attributeAccessorId > accessorId) {
|
|
99
99
|
target[semantic]--;
|
|
100
100
|
}
|
|
101
|
-
}
|
|
101
|
+
},
|
|
102
102
|
);
|
|
103
103
|
});
|
|
104
104
|
const indices = primitive.indices;
|
|
@@ -548,7 +548,7 @@ getListOfElementsIdsInUse.accessor = function (gltf) {
|
|
|
548
548
|
const attributeAccessorId =
|
|
549
549
|
node.extensions.EXT_mesh_gpu_instancing.attributes[key];
|
|
550
550
|
usedAccessorIds[attributeAccessorId] = true;
|
|
551
|
-
}
|
|
551
|
+
},
|
|
552
552
|
);
|
|
553
553
|
}
|
|
554
554
|
});
|
|
@@ -587,9 +587,8 @@ getListOfElementsIdsInUse.buffer = function (gltf) {
|
|
|
587
587
|
defined(bufferView.extensions) &&
|
|
588
588
|
defined(bufferView.extensions.EXT_meshopt_compression)
|
|
589
589
|
) {
|
|
590
|
-
usedBufferIds[
|
|
591
|
-
|
|
592
|
-
] = true;
|
|
590
|
+
usedBufferIds[bufferView.extensions.EXT_meshopt_compression.buffer] =
|
|
591
|
+
true;
|
|
593
592
|
}
|
|
594
593
|
});
|
|
595
594
|
|
|
@@ -42,7 +42,7 @@ function updateAccessorComponentTypes(gltf) {
|
|
|
42
42
|
function convertType(gltf, accessor, updatedComponentType) {
|
|
43
43
|
const typedArray = ComponentDatatype.createTypedArray(
|
|
44
44
|
updatedComponentType,
|
|
45
|
-
readAccessorPacked(gltf, accessor)
|
|
45
|
+
readAccessorPacked(gltf, accessor),
|
|
46
46
|
);
|
|
47
47
|
const newBuffer = new Uint8Array(typedArray.buffer);
|
|
48
48
|
accessor.bufferView = addBuffer(gltf, newBuffer);
|
|
@@ -13,7 +13,6 @@ import Cartesian3 from "../../Core/Cartesian3.js";
|
|
|
13
13
|
import Cartesian4 from "../../Core/Cartesian4.js";
|
|
14
14
|
import clone from "../../Core/clone.js";
|
|
15
15
|
import ComponentDatatype from "../../Core/ComponentDatatype.js";
|
|
16
|
-
import Frozen from "../../Core/Frozen.js";
|
|
17
16
|
import defined from "../../Core/defined.js";
|
|
18
17
|
import Matrix4 from "../../Core/Matrix4.js";
|
|
19
18
|
import Quaternion from "../../Core/Quaternion.js";
|
|
@@ -40,11 +39,13 @@ const updateFunctions = {
|
|
|
40
39
|
* @private
|
|
41
40
|
*/
|
|
42
41
|
function updateVersion(gltf, options) {
|
|
43
|
-
options = options ??
|
|
42
|
+
options = options ?? {};
|
|
44
43
|
const targetVersion = options.targetVersion;
|
|
45
44
|
let version = gltf.version;
|
|
46
45
|
|
|
47
|
-
gltf.asset = gltf.asset ?? {
|
|
46
|
+
gltf.asset = gltf.asset ?? {
|
|
47
|
+
version: "1.0",
|
|
48
|
+
};
|
|
48
49
|
|
|
49
50
|
gltf.asset.version = gltf.asset.version ?? "1.0";
|
|
50
51
|
version = (version ?? gltf.asset.version).toString();
|
|
@@ -176,7 +177,7 @@ function updateAnimations(gltf) {
|
|
|
176
177
|
componentType,
|
|
177
178
|
source.buffer,
|
|
178
179
|
byteOffset,
|
|
179
|
-
length
|
|
180
|
+
length,
|
|
180
181
|
);
|
|
181
182
|
|
|
182
183
|
for (let j = 0; j < count; j++) {
|
|
@@ -416,7 +417,7 @@ function objectsToArrays(gltf) {
|
|
|
416
417
|
primitive,
|
|
417
418
|
function (accessorId, semantic) {
|
|
418
419
|
primitive.attributes[semantic] = globalMapping.accessors[accessorId];
|
|
419
|
-
}
|
|
420
|
+
},
|
|
420
421
|
);
|
|
421
422
|
if (defined(primitive.material)) {
|
|
422
423
|
primitive.material = globalMapping.materials[primitive.material];
|
|
@@ -636,7 +637,7 @@ function requireAttributeSetIndex(gltf) {
|
|
|
636
637
|
} else if (semantic === "COLOR") {
|
|
637
638
|
primitive.attributes.COLOR_0 = accessorId;
|
|
638
639
|
}
|
|
639
|
-
}
|
|
640
|
+
},
|
|
640
641
|
);
|
|
641
642
|
delete primitive.attributes.TEXCOORD;
|
|
642
643
|
delete primitive.attributes.COLOR;
|
|
@@ -695,7 +696,7 @@ function underscoreApplicationSpecificSemantics(gltf) {
|
|
|
695
696
|
mappedSemantics[semantic] = newSemantic;
|
|
696
697
|
}
|
|
697
698
|
}
|
|
698
|
-
}
|
|
699
|
+
},
|
|
699
700
|
);
|
|
700
701
|
for (const semantic in mappedSemantics) {
|
|
701
702
|
if (Object.prototype.hasOwnProperty.call(mappedSemantics, semantic)) {
|
|
@@ -756,7 +757,7 @@ function requireByteLength(gltf) {
|
|
|
756
757
|
accessor.byteOffset + accessor.count * accessorByteStride;
|
|
757
758
|
bufferView.byteLength = Math.max(
|
|
758
759
|
bufferView.byteLength ?? 0,
|
|
759
|
-
accessorByteEnd
|
|
760
|
+
accessorByteEnd,
|
|
760
761
|
);
|
|
761
762
|
}
|
|
762
763
|
});
|
|
@@ -861,7 +862,7 @@ function isNodeEmpty(node) {
|
|
|
861
862
|
Cartesian3.fromArray(node.scale).equals(new Cartesian3(1.0, 1.0, 1.0))) &&
|
|
862
863
|
(!defined(node.rotation) ||
|
|
863
864
|
Cartesian4.fromArray(node.rotation).equals(
|
|
864
|
-
new Cartesian4(0.0, 0.0, 0.0, 1.0)
|
|
865
|
+
new Cartesian4(0.0, 0.0, 0.0, 1.0),
|
|
865
866
|
)) &&
|
|
866
867
|
(!defined(node.matrix) ||
|
|
867
868
|
Matrix4.fromColumnMajorArray(node.matrix).equals(Matrix4.IDENTITY)) &&
|
|
@@ -1028,7 +1029,7 @@ function srgbToLinear(srgb) {
|
|
|
1028
1029
|
linear[i] = Math.pow(
|
|
1029
1030
|
// eslint-disable-next-line no-loss-of-precision
|
|
1030
1031
|
(c + 0.055) * 0.94786729857819905213270142180095,
|
|
1031
|
-
2.4
|
|
1032
|
+
2.4,
|
|
1032
1033
|
);
|
|
1033
1034
|
}
|
|
1034
1035
|
}
|
|
@@ -1037,7 +1038,7 @@ function srgbToLinear(srgb) {
|
|
|
1037
1038
|
}
|
|
1038
1039
|
|
|
1039
1040
|
function convertTechniquesToPbr(gltf, options) {
|
|
1040
|
-
options = options ??
|
|
1041
|
+
options = options ?? {};
|
|
1041
1042
|
const baseColorTextureNames =
|
|
1042
1043
|
options.baseColorTextureNames ?? defaultBaseColorTextureNames;
|
|
1043
1044
|
const baseColorFactorNames =
|
|
@@ -1083,8 +1084,7 @@ function assignAsEmissive(material, emissive) {
|
|
|
1083
1084
|
function convertMaterialsCommonToPbr(gltf) {
|
|
1084
1085
|
// Future work: convert KHR_materials_common lights to KHR_lights_punctual
|
|
1085
1086
|
ForEach.material(gltf, function (material) {
|
|
1086
|
-
const materialsCommon = (material.extensions ??
|
|
1087
|
-
.KHR_materials_common;
|
|
1087
|
+
const materialsCommon = (material.extensions ?? {}).KHR_materials_common;
|
|
1088
1088
|
if (!defined(materialsCommon)) {
|
|
1089
1089
|
// Nothing to do
|
|
1090
1090
|
return;
|
|
@@ -194,7 +194,9 @@ GltfSpzLoader.prototype.process = function (frameState) {
|
|
|
194
194
|
return false;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
const decodePromise = loadSpz(this._bufferViewTypedArray
|
|
197
|
+
const decodePromise = loadSpz(this._bufferViewTypedArray, {
|
|
198
|
+
unpackOptions: { coordinateSystem: "UNSPECIFIED" },
|
|
199
|
+
});
|
|
198
200
|
|
|
199
201
|
if (!defined(decodePromise)) {
|
|
200
202
|
return false;
|
|
@@ -306,6 +306,26 @@ async function loadFromSpz(vertexBufferLoader) {
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
+
function getShAttributePrefix(attribute) {
|
|
310
|
+
const prefix = attribute.startsWith("KHR_gaussian_splatting:")
|
|
311
|
+
? "KHR_gaussian_splatting:"
|
|
312
|
+
: "_";
|
|
313
|
+
return `${prefix}SH_DEGREE_`;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function extractSHDegreeAndCoef(attribute) {
|
|
317
|
+
const prefix = getShAttributePrefix(attribute);
|
|
318
|
+
const separator = "_COEF_";
|
|
319
|
+
|
|
320
|
+
const lStart = prefix.length;
|
|
321
|
+
const coefIndex = attribute.indexOf(separator, lStart);
|
|
322
|
+
|
|
323
|
+
const l = parseInt(attribute.slice(lStart, coefIndex), 10);
|
|
324
|
+
const n = parseInt(attribute.slice(coefIndex + separator.length), 10);
|
|
325
|
+
|
|
326
|
+
return { l, n };
|
|
327
|
+
}
|
|
328
|
+
|
|
309
329
|
function processSpz(vertexBufferLoader) {
|
|
310
330
|
vertexBufferLoader._state = ResourceLoaderState.PROCESSING;
|
|
311
331
|
const spzLoader = vertexBufferLoader._spzLoader;
|
|
@@ -314,9 +334,16 @@ function processSpz(vertexBufferLoader) {
|
|
|
314
334
|
|
|
315
335
|
if (vertexBufferLoader._attributeSemantic === "POSITION") {
|
|
316
336
|
vertexBufferLoader._typedArray = gcloudData.positions;
|
|
317
|
-
} else if (
|
|
337
|
+
} else if (
|
|
338
|
+
vertexBufferLoader._attributeSemantic === "KHR_gaussian_splatting:SCALE" ||
|
|
339
|
+
vertexBufferLoader._attributeSemantic === "_SCALE"
|
|
340
|
+
) {
|
|
318
341
|
vertexBufferLoader._typedArray = gcloudData.scales;
|
|
319
|
-
} else if (
|
|
342
|
+
} else if (
|
|
343
|
+
vertexBufferLoader._attributeSemantic ===
|
|
344
|
+
"KHR_gaussian_splatting:ROTATION" ||
|
|
345
|
+
vertexBufferLoader._attributeSemantic === "_ROTATION"
|
|
346
|
+
) {
|
|
320
347
|
vertexBufferLoader._typedArray = gcloudData.rotations;
|
|
321
348
|
} else if (vertexBufferLoader._attributeSemantic === "COLOR_0") {
|
|
322
349
|
const colors = gcloudData.colors;
|
|
@@ -344,6 +371,33 @@ function processSpz(vertexBufferLoader) {
|
|
|
344
371
|
255.0,
|
|
345
372
|
);
|
|
346
373
|
}
|
|
374
|
+
} else if (vertexBufferLoader._attributeSemantic.includes("SH_DEGREE_")) {
|
|
375
|
+
const { l, n } = extractSHDegreeAndCoef(
|
|
376
|
+
vertexBufferLoader._attributeSemantic,
|
|
377
|
+
);
|
|
378
|
+
const sphericalHarmonicDegree = gcloudData.shDegree;
|
|
379
|
+
let stride = 0;
|
|
380
|
+
const base = [0, 9, 24];
|
|
381
|
+
switch (sphericalHarmonicDegree) {
|
|
382
|
+
case 1:
|
|
383
|
+
stride = 9;
|
|
384
|
+
break;
|
|
385
|
+
case 2:
|
|
386
|
+
stride = 24;
|
|
387
|
+
break;
|
|
388
|
+
case 3:
|
|
389
|
+
stride = 45;
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
const count = gcloudData.numPoints;
|
|
393
|
+
const sh = gcloudData.sh;
|
|
394
|
+
vertexBufferLoader._typedArray = new Float32Array(count * 3);
|
|
395
|
+
for (let i = 0; i < count; i++) {
|
|
396
|
+
const idx = i * stride + base[l - 1] + n * 3;
|
|
397
|
+
vertexBufferLoader._typedArray[i * 3] = sh[idx];
|
|
398
|
+
vertexBufferLoader._typedArray[i * 3 + 1] = sh[idx + 1];
|
|
399
|
+
vertexBufferLoader._typedArray[i * 3 + 2] = sh[idx + 2];
|
|
400
|
+
}
|
|
347
401
|
}
|
|
348
402
|
}
|
|
349
403
|
|
|
@@ -12,7 +12,7 @@ const HeightReference = {
|
|
|
12
12
|
NONE: 0,
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* The position is clamped to the terrain and 3D Tiles.
|
|
15
|
+
* The position is clamped to the terrain and 3D Tiles. When clamping to 3D Tilesets such as photorealistic 3D Tiles, ensure the tileset has {@link Cesium3DTileset#enableCollision} set to <code>true</code>. Otherwise, the entity may not be correctly clamped to the tileset surface.
|
|
16
16
|
* @type {number}
|
|
17
17
|
* @constant
|
|
18
18
|
*/
|