@cesium/engine 25.0.0 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-GPIGURCG.js → chunk-3VFEWOBI.js} +7 -7
- package/Build/Workers/{chunk-BTX2NL3P.js → chunk-424RNO3D.js} +18 -18
- package/Build/Workers/{chunk-HSVQATK2.js → chunk-4MGMYHOO.js} +6 -6
- package/Build/Workers/{chunk-FIBS5S7R.js → chunk-4S7IE3LB.js} +2 -2
- package/Build/Workers/{chunk-A7ZBMVFS.js → chunk-52JDLOEM.js} +14 -14
- package/Build/Workers/{chunk-ZCCIIBZT.js → chunk-54I6Y66F.js} +6 -6
- package/Build/Workers/{chunk-J647NNZW.js → chunk-6YEE6JDR.js} +6 -6
- package/Build/Workers/{chunk-HVMG6AG4.js → chunk-7J2HKPRH.js} +9 -9
- package/Build/Workers/{chunk-K6NFIRFB.js → chunk-7WM2PX4V.js} +5 -5
- package/Build/Workers/{chunk-3LSD7OOA.js → chunk-ACXQXN46.js} +16 -16
- package/Build/Workers/{chunk-CZ23Y3RM.js → chunk-AYKR4VBR.js} +2 -2
- package/Build/Workers/{chunk-4MTRQFJP.js → chunk-C6J67V5A.js} +1 -1
- package/Build/Workers/{chunk-WTQGE7Q6.js → chunk-C6KNZ7T4.js} +17 -17
- package/Build/Workers/{chunk-AWFZHD2B.js → chunk-CFQP6LYM.js} +4 -4
- package/Build/Workers/{chunk-ST2UWDUU.js → chunk-CXOYE2WM.js} +5 -5
- package/Build/Workers/{chunk-H2A4USJR.js → chunk-CZEYZU4N.js} +10 -10
- package/Build/Workers/{chunk-DFEI5MAV.js → chunk-DBOEKL43.js} +7 -7
- package/Build/Workers/{chunk-A7A433MD.js → chunk-DDWSZVMY.js} +5 -5
- package/Build/Workers/{chunk-J7KQEKPK.js → chunk-DOBXCNC3.js} +13 -13
- package/Build/Workers/{chunk-URUCCIPS.js → chunk-E7VQ76KE.js} +6 -6
- package/Build/Workers/{chunk-ZAPOS52G.js → chunk-EBSIOBXY.js} +8 -8
- package/Build/Workers/{chunk-3VDDRF2E.js → chunk-EF2QYXGA.js} +14 -14
- package/Build/Workers/{chunk-WN6P5UDH.js → chunk-EPYXRCDB.js} +12 -12
- package/Build/Workers/{chunk-EZARA5FJ.js → chunk-F6QDY6HU.js} +13 -13
- package/Build/Workers/{chunk-GL7DNVUS.js → chunk-FRQZECAO.js} +5 -5
- package/Build/Workers/{chunk-VQKLRBIK.js → chunk-G7PXZRVF.js} +7 -7
- package/Build/Workers/{chunk-4QQXGTCE.js → chunk-INUEEEQA.js} +8 -8
- package/Build/Workers/{chunk-ITD2IN7N.js → chunk-IRBKFCEJ.js} +2 -2
- package/Build/Workers/{chunk-6SDGQI27.js → chunk-IYOUHCZB.js} +1 -1
- package/Build/Workers/{chunk-DYT5NR6P.js → chunk-J6BWOHUF.js} +3 -3
- package/Build/Workers/{chunk-4GF4MVPY.js → chunk-KFSTQKNM.js} +7 -7
- package/Build/Workers/{chunk-4XXHJI6Y.js → chunk-KKOSKAZB.js} +17 -17
- package/Build/Workers/{chunk-WC57YYBN.js → chunk-KSSWJIZW.js} +2 -2
- package/Build/Workers/{chunk-5T6QQAJW.js → chunk-M3B5JKSM.js} +1 -1
- package/Build/Workers/{chunk-QO2CGXMP.js → chunk-MPZHGZU6.js} +6 -6
- package/Build/Workers/{chunk-WUBKZFF6.js → chunk-MYP774IS.js} +9 -9
- package/Build/Workers/{chunk-WNN5D4W3.js → chunk-O3EA5HS7.js} +10 -10
- package/Build/Workers/{chunk-77RL3MBD.js → chunk-P3CK7MCY.js} +25 -4
- package/Build/Workers/{chunk-QXNQQYPV.js → chunk-Q3PY526V.js} +8 -8
- package/Build/Workers/{chunk-CKQP3DSS.js → chunk-QN67VG36.js} +6 -6
- package/Build/Workers/{chunk-ACFFCHHZ.js → chunk-QRWGUWI6.js} +11 -11
- package/Build/Workers/{chunk-LH5SF3XV.js → chunk-S4MCOY6I.js} +5 -5
- package/Build/Workers/{chunk-FVLVVOBQ.js → chunk-SMQZZOW6.js} +10 -10
- package/Build/Workers/{chunk-TA777BGS.js → chunk-TKKIREQ6.js} +1 -1
- package/Build/Workers/{chunk-AEAVLYPS.js → chunk-U3ZA64U7.js} +2 -2
- package/Build/Workers/{chunk-7LSFAEWF.js → chunk-UA25D5MX.js} +10 -10
- package/Build/Workers/{chunk-J3OFS2RD.js → chunk-UOOIQ3KX.js} +12 -12
- package/Build/Workers/{chunk-ND3NTTOF.js → chunk-V7VQKN6N.js} +6 -6
- package/Build/Workers/{chunk-I3A6DXYZ.js → chunk-VQYETPWC.js} +4 -4
- package/Build/Workers/{chunk-35H3UBIO.js → chunk-VWV2IJRB.js} +11 -11
- package/Build/Workers/{chunk-QSDY4NS7.js → chunk-XZMBNNDX.js} +9 -9
- package/Build/Workers/{chunk-TAI4HLII.js → chunk-Y57HREW5.js} +4 -4
- package/Build/Workers/{chunk-3TKLDHV3.js → chunk-Y5BF6AFU.js} +2 -2
- package/Build/Workers/{chunk-3XY3MVPG.js → chunk-YLY7NKAB.js} +4 -4
- package/Build/Workers/{chunk-BVAIWR7O.js → chunk-ZK3CF7ZD.js} +12 -12
- package/Build/Workers/{chunk-DH26SNAB.js → chunk-ZP7JMQV4.js} +1 -1
- package/Build/Workers/{chunk-3RFFPH4M.js → chunk-ZZ46LWL6.js} +1 -1
- 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 +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- 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/Cartesian2.js +1 -1
- package/Source/Core/Cartesian3.js +1 -1
- package/Source/Core/Cartesian4.js +1 -1
- package/Source/Core/ComponentDatatype.js +35 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/MapProjection.js +1 -0
- package/Source/Core/Matrix2.js +1 -1
- package/Source/Core/Matrix3.js +1 -1
- package/Source/Core/Matrix4.js +1 -1
- package/Source/Core/Resource.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +51 -41
- package/Source/Core/createColorRamp.js +37 -0
- package/Source/Core/globalTypes.js +25 -0
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Renderer/createUniform.js +346 -239
- package/Source/Renderer/createUniformArray.js +494 -381
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BufferPoint.js +1 -0
- package/Source/Scene/BufferPointCollection.js +14 -1
- package/Source/Scene/BufferPolygon.js +3 -2
- package/Source/Scene/BufferPolygonCollection.js +10 -0
- package/Source/Scene/BufferPolyline.js +1 -0
- package/Source/Scene/BufferPolylineCollection.js +2 -0
- package/Source/Scene/BufferPrimitiveCollection.js +79 -28
- package/Source/Scene/CameraEventAggregator.js +30 -18
- package/Source/Scene/Cesium3DTile.js +54 -1
- package/Source/Scene/Cesium3DTileContent.js +195 -254
- package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
- package/Source/Scene/Cesium3DTileset.js +45 -5
- package/Source/Scene/Composite3DTileContent.js +254 -292
- package/Source/Scene/EdgeDisplayMode.js +50 -0
- package/Source/Scene/Empty3DTileContent.js +100 -132
- package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
- package/Source/Scene/GeoJsonPrimitive.js +874 -0
- package/Source/Scene/Geometry3DTileContent.js +151 -185
- package/Source/Scene/GltfLoader.js +109 -0
- package/Source/Scene/Implicit3DTileContent.js +179 -214
- package/Source/Scene/MVTDataProvider.js +147 -0
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +79 -311
- package/Source/Scene/Model/Model.js +34 -0
- package/Source/Scene/Model/Model3DTileContent.js +424 -458
- package/Source/Scene/Model/ModelDrawCommand.js +31 -3
- package/Source/Scene/Model/ModelUtility.js +4 -0
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +466 -150
- package/Source/Scene/ModelComponents.js +39 -1
- package/Source/Scene/Multiple3DTileContent.js +291 -334
- package/Source/Scene/Scene.js +26 -0
- package/Source/Scene/Tileset3DTileContent.js +113 -146
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
- package/Source/Scene/Vector3DTileContent.js +205 -234
- package/Source/Scene/VectorGltf3DTileContent.js +85 -36
- package/Source/Scene/VoxelPrimitive.js +159 -175
- package/Source/Scene/VoxelProvider.js +64 -91
- package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
- package/Source/Scene/buildVoxelCustomShader.js +199 -0
- package/Source/Scene/decodeMVT.js +634 -0
- package/Source/Scene/renderBufferPointCollection.js +110 -64
- package/Source/Scene/renderBufferPolygonCollection.js +102 -55
- package/Source/Scene/renderBufferPolylineCollection.js +365 -166
- package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
- package/Source/Shaders/BufferPointMaterialFS.js +1 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
- package/Source/Shaders/BufferPointMaterialVS.js +20 -10
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
- package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
- package/index.d.ts +253 -35
- package/index.js +71 -62
- package/package.json +2 -2
|
@@ -9,321 +9,292 @@ import ModelUtility from "./Model/ModelUtility.js";
|
|
|
9
9
|
import VertexAttributeSemantic from "./VertexAttributeSemantic.js";
|
|
10
10
|
import deprecationWarning from "../Core/deprecationWarning.js";
|
|
11
11
|
|
|
12
|
+
/** @import Cesium3DTileContent from "./Cesium3DTileContent.js"; */
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* Represents the contents of a glTF or glb using the {@link https://github.com/CesiumGS/glTF/tree/draft-splat-spz/extensions/2.0/Khronos/KHR_gaussian_splatting | KHR_gaussian_splatting} and {@link https://github.com/CesiumGS/glTF/tree/draft-splat-spz/extensions/2.0/Khronos/KHR_gaussian_splatting_compression_spz_2 | KHR_gaussian_splatting_compression_spz_2} extensions.
|
|
14
16
|
* <p>
|
|
15
17
|
* Implements the {@link Cesium3DTileContent} interface.
|
|
16
18
|
* </p>
|
|
17
19
|
*
|
|
18
|
-
* @
|
|
19
|
-
* @constructor
|
|
20
|
+
* @implements Cesium3DTileContent
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this._tileset.gaussianSplatPrimitive
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
class GaussianSplat3DTileContent {
|
|
23
|
+
constructor(loader, tileset, tile, resource) {
|
|
24
|
+
this._tileset = tileset;
|
|
25
|
+
this._tile = tile;
|
|
26
|
+
this._resource = resource;
|
|
27
|
+
this._loader = loader;
|
|
28
|
+
|
|
29
|
+
if (!defined(this._tileset.gaussianSplatPrimitive)) {
|
|
30
|
+
this._tileset.gaussianSplatPrimitive = new GaussianSplatPrimitive({
|
|
31
|
+
tileset: this._tileset,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Local copy of the position attribute buffer transformed into root tile space.
|
|
37
|
+
* The original glTF attribute data is kept untouched so rebuilds can re-apply
|
|
38
|
+
* transforms from the source coordinates.
|
|
39
|
+
* @type {undefined|Float32Array}
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
this._positions = undefined;
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Local copy of the rotation attribute buffer transformed into root tile space.
|
|
46
|
+
* @type {undefined|Float32Array}
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
this._rotations = undefined;
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Local copy of the scale attribute buffer transformed into root tile space.
|
|
53
|
+
* @type {undefined|Float32Array}
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
this._scales = undefined;
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
/**
|
|
59
|
+
* glTF primitive data that contains the Gaussian splat data needed for rendering.
|
|
60
|
+
* @type {undefined|Primitive}
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
this.gltfPrimitive = undefined;
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Transform matrix to turn model coordinates into world coordinates.
|
|
67
|
+
* @type {undefined|Matrix4}
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
this.worldTransform = undefined;
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Gets or sets if any feature's property changed. Used to
|
|
74
|
+
* optimized applying a style when a feature's property changed.
|
|
75
|
+
* <p>
|
|
76
|
+
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
|
|
77
|
+
* not part of the public Cesium API.
|
|
78
|
+
* </p>
|
|
79
|
+
*
|
|
80
|
+
* @type {boolean}
|
|
81
|
+
*
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
this.featurePropertiesDirty = false;
|
|
85
|
+
|
|
86
|
+
this._metadata = undefined;
|
|
87
|
+
this._group = undefined;
|
|
88
|
+
this._ready = false;
|
|
89
|
+
/**
|
|
90
|
+
* Indicates whether or not the local coordinates of the tile have been transformed
|
|
91
|
+
* @type {boolean}
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
this._transformed = false;
|
|
83
95
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
this._transformed = false;
|
|
96
|
+
/**
|
|
97
|
+
* The degree of the spherical harmonics used for the Gaussian splats.
|
|
98
|
+
* @type {number}
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
this._sphericalHarmonicsDegree = 0;
|
|
93
102
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The number of spherical harmonic coefficients used for the Gaussian splats.
|
|
105
|
+
* @type {number}
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
this._sphericalHarmonicsCoefficientCount = 0;
|
|
100
109
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Spherical Harmonic data that has been packed for use in a texture or shader.
|
|
112
|
+
* @type {undefined|Uint32Array}
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
this._packedSphericalHarmonicsData = undefined;
|
|
107
116
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Cached local-space-to-root transform used for the last splat bake.
|
|
119
|
+
* When unchanged, the transformed buffers can be reused directly.
|
|
120
|
+
* @type {undefined|Matrix4}
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
this._lastSplatTransform = undefined;
|
|
124
|
+
}
|
|
114
125
|
|
|
115
126
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* @
|
|
119
|
-
* @
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
tileset.isGltfExtensionRequired("KHR_spz_gaussian_splats_compression")
|
|
144
|
-
) {
|
|
145
|
-
deprecationWarning(
|
|
146
|
-
"KHR_spz_gaussian_splats_compression",
|
|
147
|
-
"Support for the original KHR_spz_gaussian_splats_compression extension has been removed in favor " +
|
|
148
|
-
"of the up to date KHR_gaussian_splatting and KHR_gaussian_splatting_compression_spz_2 extensions" +
|
|
149
|
-
"\n\nPlease retile your tileset with the KHR_gaussian_splatting and " +
|
|
150
|
-
"KHR_gaussian_splatting_compression_spz_2 extensions.",
|
|
151
|
-
);
|
|
127
|
+
* Performs checks to ensure that the provided tileset has the Gaussian Splatting extensions.
|
|
128
|
+
*
|
|
129
|
+
* @param {Cesium3DTileset} tileset The tileset to check for the extensions.
|
|
130
|
+
* @returns {boolean} Returns <code>true</code> if the necessary extensions are included in the tileset.
|
|
131
|
+
* @static
|
|
132
|
+
*/
|
|
133
|
+
static tilesetRequiresGaussianSplattingExt(tileset) {
|
|
134
|
+
let hasGaussianSplatExtension = false;
|
|
135
|
+
if (tileset.isGltfExtensionRequired instanceof Function) {
|
|
136
|
+
hasGaussianSplatExtension =
|
|
137
|
+
tileset.isGltfExtensionRequired("KHR_gaussian_splatting") &&
|
|
138
|
+
tileset.isGltfExtensionRequired(
|
|
139
|
+
"KHR_gaussian_splatting_compression_spz_2",
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
if (
|
|
143
|
+
tileset.isGltfExtensionRequired("KHR_spz_gaussian_splats_compression")
|
|
144
|
+
) {
|
|
145
|
+
deprecationWarning(
|
|
146
|
+
"KHR_spz_gaussian_splats_compression",
|
|
147
|
+
"Support for the original KHR_spz_gaussian_splats_compression extension has been removed in favor " +
|
|
148
|
+
"of the up to date KHR_gaussian_splatting and KHR_gaussian_splatting_compression_spz_2 extensions" +
|
|
149
|
+
"\n\nPlease retile your tileset with the KHR_gaussian_splatting and " +
|
|
150
|
+
"KHR_gaussian_splatting_compression_spz_2 extensions.",
|
|
151
|
+
);
|
|
152
|
+
}
|
|
152
153
|
}
|
|
153
|
-
}
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
}
|
|
155
|
+
return hasGaussianSplatExtension;
|
|
156
|
+
}
|
|
157
157
|
|
|
158
|
-
Object.defineProperties(GaussianSplat3DTileContent.prototype, {
|
|
159
158
|
/**
|
|
160
159
|
* Gets the number of features in the tile. Currently this is always zero.
|
|
161
160
|
*
|
|
162
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
163
161
|
*
|
|
164
162
|
* @type {number}
|
|
165
163
|
* @readonly
|
|
166
164
|
*/
|
|
167
|
-
featuresLength
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
},
|
|
171
|
-
},
|
|
165
|
+
get featuresLength() {
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
172
168
|
|
|
173
169
|
/**
|
|
174
170
|
* Equal to the number of Gaussian splats in the tile. Each splat is represented by a median point and a set of attributes, so we can
|
|
175
171
|
* treat this as the number of points in the tile.
|
|
176
172
|
*
|
|
177
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
178
173
|
*
|
|
179
174
|
* @type {number}
|
|
180
175
|
* @readonly
|
|
181
176
|
*/
|
|
182
|
-
pointsLength
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
},
|
|
177
|
+
get pointsLength() {
|
|
178
|
+
return this.gltfPrimitive.attributes[0].count;
|
|
179
|
+
}
|
|
180
|
+
|
|
187
181
|
/**
|
|
188
182
|
* Gets the number of triangles in the tile. Currently this is always zero because Gaussian splats are not represented as triangles in the tile content.
|
|
189
183
|
* <p>
|
|
190
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
191
184
|
*
|
|
192
185
|
* @type {number}
|
|
193
186
|
* @readonly
|
|
194
187
|
*/
|
|
195
|
-
trianglesLength
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
188
|
+
get trianglesLength() {
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
200
192
|
/**
|
|
201
193
|
* The number of bytes used by the geometry attributes of this content.
|
|
202
194
|
* <p>
|
|
203
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
204
195
|
* @type {number}
|
|
205
196
|
* @readonly
|
|
206
197
|
*/
|
|
207
|
-
geometryByteLength
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
},
|
|
198
|
+
get geometryByteLength() {
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
212
202
|
/**
|
|
213
203
|
* The number of bytes used by the textures of this content.
|
|
214
204
|
* <p>
|
|
215
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
216
205
|
* @type {number}
|
|
217
206
|
* @readonly
|
|
218
207
|
*/
|
|
219
|
-
texturesByteLength
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
},
|
|
208
|
+
get texturesByteLength() {
|
|
209
|
+
const primitive = this._tileset?.gaussianSplatPrimitive;
|
|
210
|
+
if (!defined(primitive)) {
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
213
|
+
const texture = primitive.gaussianSplatTexture;
|
|
214
|
+
const selectedTileLength = primitive.selectedTileLength;
|
|
215
|
+
if (!defined(texture) || selectedTileLength === 0) {
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
return texture.sizeInBytes / selectedTileLength;
|
|
219
|
+
}
|
|
220
|
+
|
|
233
221
|
/**
|
|
234
222
|
* Gets the amount of memory used by the batch table textures and any binary
|
|
235
223
|
* metadata properties not accounted for in geometryByteLength or
|
|
236
224
|
* texturesByteLength
|
|
237
225
|
* <p>
|
|
238
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
239
226
|
*
|
|
240
227
|
* @type {number}
|
|
241
228
|
* @readonly
|
|
242
229
|
*/
|
|
243
|
-
batchTableByteLength
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
},
|
|
230
|
+
get batchTableByteLength() {
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
248
234
|
/**
|
|
249
235
|
* Gets the array of {@link Cesium3DTileContent} objects for contents that contain other contents, such as composite tiles. The inner contents may in turn have inner contents, such as a composite tile that contains a composite tile.
|
|
250
236
|
*
|
|
251
237
|
* @see {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Composite|Composite specification}
|
|
252
238
|
*
|
|
253
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
254
239
|
*
|
|
255
240
|
* @type {Array}
|
|
256
241
|
* @readonly
|
|
257
242
|
*/
|
|
258
|
-
innerContents
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
},
|
|
243
|
+
get innerContents() {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
263
246
|
|
|
264
247
|
/**
|
|
265
248
|
* Returns true when the tile's content is ready to render; otherwise false
|
|
266
249
|
*
|
|
267
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
268
250
|
*
|
|
269
251
|
* @type {boolean}
|
|
270
252
|
* @readonly
|
|
271
253
|
*/
|
|
272
|
-
ready
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
},
|
|
254
|
+
get ready() {
|
|
255
|
+
return this._ready;
|
|
256
|
+
}
|
|
277
257
|
|
|
278
258
|
/**
|
|
279
259
|
* Returns true when the tile's content is transformed to world coordinates; otherwise false
|
|
280
260
|
* <p>
|
|
281
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
282
261
|
* @type {boolean}
|
|
283
262
|
* @readonly
|
|
284
263
|
*/
|
|
285
|
-
transformed
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
},
|
|
289
|
-
},
|
|
264
|
+
get transformed() {
|
|
265
|
+
return this._transformed;
|
|
266
|
+
}
|
|
290
267
|
|
|
291
268
|
/**
|
|
292
269
|
* The tileset that this content belongs to.
|
|
293
270
|
* <p>
|
|
294
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
295
271
|
* @type {Cesium3DTileset}
|
|
296
272
|
* @readonly
|
|
297
273
|
*/
|
|
298
|
-
tileset
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
},
|
|
274
|
+
get tileset() {
|
|
275
|
+
return this._tileset;
|
|
276
|
+
}
|
|
277
|
+
|
|
303
278
|
/**
|
|
304
279
|
* The tile that this content belongs to.
|
|
305
280
|
* <p>
|
|
306
|
-
* @memberof GaussianSplat3DTileContent.prototype
|
|
307
281
|
* @type {Cesium3DTile}
|
|
308
282
|
* @readonly
|
|
309
283
|
*/
|
|
310
|
-
tile
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
},
|
|
284
|
+
get tile() {
|
|
285
|
+
return this._tile;
|
|
286
|
+
}
|
|
287
|
+
|
|
315
288
|
/**
|
|
316
289
|
* The resource that this content was loaded from.
|
|
317
290
|
* <p>
|
|
318
|
-
* @
|
|
319
|
-
* @type {Resource}
|
|
291
|
+
* @type {string}
|
|
320
292
|
* @readonly
|
|
321
293
|
*/
|
|
322
|
-
url
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
},
|
|
294
|
+
get url() {
|
|
295
|
+
return this._resource.getUrlComponent(true);
|
|
296
|
+
}
|
|
297
|
+
|
|
327
298
|
/**
|
|
328
299
|
* Gets the batch table for this content.
|
|
329
300
|
* <p>
|
|
@@ -336,11 +307,10 @@ Object.defineProperties(GaussianSplat3DTileContent.prototype, {
|
|
|
336
307
|
*
|
|
337
308
|
* @private
|
|
338
309
|
*/
|
|
339
|
-
batchTable
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
},
|
|
310
|
+
get batchTable() {
|
|
311
|
+
return undefined;
|
|
312
|
+
}
|
|
313
|
+
|
|
344
314
|
/**
|
|
345
315
|
* Gets the metadata for this content, whether it is available explicitly or via
|
|
346
316
|
* implicit tiling. If there is no metadata, this property should be undefined.
|
|
@@ -354,14 +324,14 @@ Object.defineProperties(GaussianSplat3DTileContent.prototype, {
|
|
|
354
324
|
* @private
|
|
355
325
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
356
326
|
*/
|
|
357
|
-
metadata
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
327
|
+
get metadata() {
|
|
328
|
+
return this._metadata;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
set metadata(value) {
|
|
332
|
+
this._metadata = value;
|
|
333
|
+
}
|
|
334
|
+
|
|
365
335
|
/**
|
|
366
336
|
* Gets the group for this content if the content has metadata (3D Tiles 1.1) or
|
|
367
337
|
* if it uses the <code>3DTILES_metadata</code> extension. If neither are present,
|
|
@@ -376,46 +346,40 @@ Object.defineProperties(GaussianSplat3DTileContent.prototype, {
|
|
|
376
346
|
* @private
|
|
377
347
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
378
348
|
*/
|
|
379
|
-
group
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
},
|
|
349
|
+
get group() {
|
|
350
|
+
return this._group;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
set group(value) {
|
|
354
|
+
this._group = value;
|
|
355
|
+
}
|
|
387
356
|
|
|
388
357
|
/**
|
|
389
358
|
* Get the transformed positions of this tile's Gaussian splats.
|
|
390
359
|
* @type {undefined|Float32Array}
|
|
391
360
|
* @private
|
|
392
361
|
*/
|
|
393
|
-
positions
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
},
|
|
362
|
+
get positions() {
|
|
363
|
+
return this._positions;
|
|
364
|
+
}
|
|
365
|
+
|
|
398
366
|
/**
|
|
399
367
|
* Get the transformed rotations of this tile's Gaussian splats.
|
|
400
368
|
* @type {undefined|Float32Array}
|
|
401
369
|
* @private
|
|
402
370
|
*/
|
|
403
|
-
rotations
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
},
|
|
407
|
-
},
|
|
371
|
+
get rotations() {
|
|
372
|
+
return this._rotations;
|
|
373
|
+
}
|
|
408
374
|
|
|
409
375
|
/**
|
|
410
376
|
* Get the transformed scales of this tile's Gaussian splats.
|
|
411
377
|
* @type {undefined|Float32Array}
|
|
412
378
|
* @private
|
|
413
379
|
*/
|
|
414
|
-
scales
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
},
|
|
418
|
-
},
|
|
380
|
+
get scales() {
|
|
381
|
+
return this._scales;
|
|
382
|
+
}
|
|
419
383
|
|
|
420
384
|
/**
|
|
421
385
|
* The number of spherical harmonic coefficients used for the Gaussian splats.
|
|
@@ -423,22 +387,19 @@ Object.defineProperties(GaussianSplat3DTileContent.prototype, {
|
|
|
423
387
|
* @private
|
|
424
388
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
425
389
|
*/
|
|
426
|
-
sphericalHarmonicsCoefficientCount
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
},
|
|
390
|
+
get sphericalHarmonicsCoefficientCount() {
|
|
391
|
+
return this._sphericalHarmonicsCoefficientCount;
|
|
392
|
+
}
|
|
393
|
+
|
|
431
394
|
/**
|
|
432
395
|
* The degree of the spherical harmonics used for the Gaussian splats.
|
|
433
396
|
* @type {number}
|
|
434
397
|
* @private
|
|
435
398
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
436
399
|
*/
|
|
437
|
-
sphericalHarmonicsDegree
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
},
|
|
441
|
-
},
|
|
400
|
+
get sphericalHarmonicsDegree() {
|
|
401
|
+
return this._sphericalHarmonicsDegree;
|
|
402
|
+
}
|
|
442
403
|
|
|
443
404
|
/**
|
|
444
405
|
* The packed spherical harmonic data for the Gaussian splats for use a shader or texture.
|
|
@@ -446,12 +407,228 @@ Object.defineProperties(GaussianSplat3DTileContent.prototype, {
|
|
|
446
407
|
* @private
|
|
447
408
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
448
409
|
*/
|
|
449
|
-
packedSphericalHarmonicsData
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
410
|
+
get packedSphericalHarmonicsData() {
|
|
411
|
+
return this._packedSphericalHarmonicsData;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Creates a new instance of {@link GaussianSplat3DTileContent} from a glTF or glb resource.
|
|
416
|
+
*
|
|
417
|
+
* @param {Cesium3DTileset} tileset - The tileset that this content belongs to.
|
|
418
|
+
* @param {Cesium3DTile} tile - The tile that this content belongs to.
|
|
419
|
+
* @param {Resource|string} resource - The resource or URL of the glTF or glb file.
|
|
420
|
+
* @param {object|Uint8Array} gltf - The glTF JSON object or a Uint8Array containing the glb binary data.
|
|
421
|
+
* @returns {GaussianSplat3DTileContent} A new GaussianSplat3DTileContent instance.
|
|
422
|
+
* @throws {RuntimeError} If the glTF or glb fails to load.
|
|
423
|
+
* @private
|
|
424
|
+
*/
|
|
425
|
+
static async fromGltf(tileset, tile, resource, gltf) {
|
|
426
|
+
const basePath = resource;
|
|
427
|
+
const baseResource = Resource.createIfNeeded(basePath);
|
|
428
|
+
|
|
429
|
+
const loaderOptions = {
|
|
430
|
+
releaseGltfJson: false,
|
|
431
|
+
upAxis: Axis.Y,
|
|
432
|
+
forwardAxis: Axis.Z,
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
if (defined(gltf.asset)) {
|
|
436
|
+
loaderOptions.gltfJson = gltf;
|
|
437
|
+
loaderOptions.baseResource = baseResource;
|
|
438
|
+
loaderOptions.gltfResource = baseResource;
|
|
439
|
+
} else if (gltf instanceof Uint8Array) {
|
|
440
|
+
loaderOptions.typedArray = gltf;
|
|
441
|
+
loaderOptions.baseResource = baseResource;
|
|
442
|
+
loaderOptions.gltfResource = baseResource;
|
|
443
|
+
} else {
|
|
444
|
+
loaderOptions.gltfResource = Resource.createIfNeeded(gltf);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const loader = new GltfLoader(loaderOptions);
|
|
448
|
+
|
|
449
|
+
try {
|
|
450
|
+
await loader.load();
|
|
451
|
+
} catch (error) {
|
|
452
|
+
loader.destroy();
|
|
453
|
+
throw new RuntimeError(`Failed to load glTF: ${error.message}`);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return new GaussianSplat3DTileContent(loader, tileset, tile, resource);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Updates the content of the tile and prepares it for rendering.
|
|
461
|
+
* @param {Cesium3DTileset}Data attribution
|
|
462
|
+
* @param {FrameState} frameState - The current frame state.
|
|
463
|
+
* @private
|
|
464
|
+
*/
|
|
465
|
+
update(primitive, frameState) {
|
|
466
|
+
const loader = this._loader;
|
|
467
|
+
|
|
468
|
+
if (this._ready) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
frameState.afterRender.push(() => true);
|
|
473
|
+
|
|
474
|
+
if (!defined(loader)) {
|
|
475
|
+
this._ready = true;
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (this._resourcesLoaded) {
|
|
480
|
+
this.gltfPrimitive = loader.components.scene.nodes[0].primitives[0];
|
|
481
|
+
this.worldTransform = loader.components.scene.nodes[0].matrix;
|
|
482
|
+
this._ready = true;
|
|
483
|
+
|
|
484
|
+
// SPZ decode produces Float32Array attributes for these semantics, so
|
|
485
|
+
// typedArray.slice() preserves the expected runtime type for current data.
|
|
486
|
+
// If future splat encodings use quantized integer attributes here, revisit
|
|
487
|
+
// this assumption before relying on the copied array type.
|
|
488
|
+
this._positions = ModelUtility.getAttributeBySemantic(
|
|
489
|
+
this.gltfPrimitive,
|
|
490
|
+
VertexAttributeSemantic.POSITION,
|
|
491
|
+
).typedArray.slice();
|
|
492
|
+
|
|
493
|
+
this._rotations = ModelUtility.getAttributeBySemantic(
|
|
494
|
+
this.gltfPrimitive,
|
|
495
|
+
VertexAttributeSemantic.ROTATION,
|
|
496
|
+
).typedArray.slice();
|
|
497
|
+
|
|
498
|
+
this._scales = ModelUtility.getAttributeBySemantic(
|
|
499
|
+
this.gltfPrimitive,
|
|
500
|
+
VertexAttributeSemantic.SCALE,
|
|
501
|
+
).typedArray.slice();
|
|
502
|
+
|
|
503
|
+
const { l, n } = degreeAndCoefFromAttributes(
|
|
504
|
+
this.gltfPrimitive.attributes,
|
|
505
|
+
);
|
|
506
|
+
this._sphericalHarmonicsDegree = l;
|
|
507
|
+
this._sphericalHarmonicsCoefficientCount = n;
|
|
508
|
+
|
|
509
|
+
this._packedSphericalHarmonicsData = packSphericalHarmonicsData(this);
|
|
510
|
+
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
this._resourcesLoaded = loader.process(frameState);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Returns whether the feature has this property.
|
|
519
|
+
*
|
|
520
|
+
* @param {number} batchId The batchId for the feature.
|
|
521
|
+
* @param {string} name The case-sensitive name of the property.
|
|
522
|
+
* @returns {boolean} <code>true</code> if the feature has this property; otherwise, <code>false</code>.
|
|
523
|
+
*/
|
|
524
|
+
hasProperty(batchId, name) {
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Returns the {@link Cesium3DTileFeature} object for the feature with the
|
|
530
|
+
* given <code>batchId</code>. This object is used to get and modify the
|
|
531
|
+
* feature's properties.
|
|
532
|
+
* <p>
|
|
533
|
+
* Features in a tile are ordered by <code>batchId</code>, an index used to retrieve their metadata from the batch table.
|
|
534
|
+
* </p>
|
|
535
|
+
*
|
|
536
|
+
* @see {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/BatchTable}.
|
|
537
|
+
*
|
|
538
|
+
* @param {number} batchId The batchId for the feature.
|
|
539
|
+
* @returns {Cesium3DTileFeature} The corresponding {@link Cesium3DTileFeature} object.
|
|
540
|
+
*
|
|
541
|
+
* @exception {DeveloperError} batchId must be between zero and {@link Cesium3DTileContent#featuresLength} - 1.
|
|
542
|
+
*/
|
|
543
|
+
getFeature(batchId) {
|
|
544
|
+
return undefined;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Called when {@link Cesium3DTileset#debugColorizeTiles} changes.
|
|
549
|
+
* <p>
|
|
550
|
+
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
|
|
551
|
+
* not part of the public Cesium API.
|
|
552
|
+
* </p>
|
|
553
|
+
*
|
|
554
|
+
* @param {boolean} enabled Whether to enable or disable debug settings.
|
|
555
|
+
* @returns {Cesium3DTileFeature} The corresponding {@link Cesium3DTileFeature} object.
|
|
556
|
+
|
|
557
|
+
* @private
|
|
558
|
+
*/
|
|
559
|
+
applyDebugSettings(enabled, color) {}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Apply a style to the content
|
|
563
|
+
* <p>
|
|
564
|
+
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
|
|
565
|
+
* not part of the public Cesium API.
|
|
566
|
+
* </p>
|
|
567
|
+
*
|
|
568
|
+
* @param {Cesium3DTileStyle} style The style.
|
|
569
|
+
*
|
|
570
|
+
* @private
|
|
571
|
+
*/
|
|
572
|
+
applyStyle(style) {}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
|
|
576
|
+
*
|
|
577
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
578
|
+
* @param {FrameState} frameState The frame state.
|
|
579
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
580
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
581
|
+
*
|
|
582
|
+
* @private
|
|
583
|
+
*/
|
|
584
|
+
pick(ray, frameState, result) {
|
|
585
|
+
return undefined;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
590
|
+
* <br /><br />
|
|
591
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
592
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
593
|
+
* <p>
|
|
594
|
+
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
|
|
595
|
+
* not part of the public Cesium API.
|
|
596
|
+
* </p>
|
|
597
|
+
*
|
|
598
|
+
* @returns {boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
599
|
+
*
|
|
600
|
+
* @see Cesium3DTileContent#destroy
|
|
601
|
+
*
|
|
602
|
+
* @private
|
|
603
|
+
*/
|
|
604
|
+
isDestroyed() {
|
|
605
|
+
return this.isDestroyed;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Frees the resources used by this object.
|
|
610
|
+
* @private
|
|
611
|
+
*/
|
|
612
|
+
destroy() {
|
|
613
|
+
this.splatPrimitive = undefined;
|
|
614
|
+
|
|
615
|
+
this._tile = undefined;
|
|
616
|
+
this._tileset = undefined;
|
|
617
|
+
this._resource = undefined;
|
|
618
|
+
this._ready = false;
|
|
619
|
+
this._group = undefined;
|
|
620
|
+
this._metadata = undefined;
|
|
621
|
+
this._resourcesLoaded = false;
|
|
622
|
+
this._lastSplatTransform = undefined;
|
|
623
|
+
|
|
624
|
+
if (defined(this._loader)) {
|
|
625
|
+
this._loader.destroy();
|
|
626
|
+
this._loader = undefined;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return destroyObject(this);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
455
632
|
|
|
456
633
|
function getShAttributePrefix(attribute) {
|
|
457
634
|
const prefix = attribute.startsWith("KHR_gaussian_splatting:")
|
|
@@ -598,223 +775,4 @@ function packSphericalHarmonicsData(tileContent) {
|
|
|
598
775
|
return packedData;
|
|
599
776
|
}
|
|
600
777
|
|
|
601
|
-
/**
|
|
602
|
-
* Creates a new instance of {@link GaussianSplat3DTileContent} from a glTF or glb resource.
|
|
603
|
-
*
|
|
604
|
-
* @param {Cesium3DTileset} tileset - The tileset that this content belongs to.
|
|
605
|
-
* @param {Cesium3DTile} tile - The tile that this content belongs to.
|
|
606
|
-
* @param {Resource|string} resource - The resource or URL of the glTF or glb file.
|
|
607
|
-
* @param {object|Uint8Array} gltf - The glTF JSON object or a Uint8Array containing the glb binary data.
|
|
608
|
-
* @returns {GaussianSplat3DTileContent} A new GaussianSplat3DTileContent instance.
|
|
609
|
-
* @throws {RuntimeError} If the glTF or glb fails to load.
|
|
610
|
-
* @private
|
|
611
|
-
*/
|
|
612
|
-
GaussianSplat3DTileContent.fromGltf = async function (
|
|
613
|
-
tileset,
|
|
614
|
-
tile,
|
|
615
|
-
resource,
|
|
616
|
-
gltf,
|
|
617
|
-
) {
|
|
618
|
-
const basePath = resource;
|
|
619
|
-
const baseResource = Resource.createIfNeeded(basePath);
|
|
620
|
-
|
|
621
|
-
const loaderOptions = {
|
|
622
|
-
releaseGltfJson: false,
|
|
623
|
-
upAxis: Axis.Y,
|
|
624
|
-
forwardAxis: Axis.Z,
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
if (defined(gltf.asset)) {
|
|
628
|
-
loaderOptions.gltfJson = gltf;
|
|
629
|
-
loaderOptions.baseResource = baseResource;
|
|
630
|
-
loaderOptions.gltfResource = baseResource;
|
|
631
|
-
} else if (gltf instanceof Uint8Array) {
|
|
632
|
-
loaderOptions.typedArray = gltf;
|
|
633
|
-
loaderOptions.baseResource = baseResource;
|
|
634
|
-
loaderOptions.gltfResource = baseResource;
|
|
635
|
-
} else {
|
|
636
|
-
loaderOptions.gltfResource = Resource.createIfNeeded(gltf);
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
const loader = new GltfLoader(loaderOptions);
|
|
640
|
-
|
|
641
|
-
try {
|
|
642
|
-
await loader.load();
|
|
643
|
-
} catch (error) {
|
|
644
|
-
loader.destroy();
|
|
645
|
-
throw new RuntimeError(`Failed to load glTF: ${error.message}`);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
return new GaussianSplat3DTileContent(loader, tileset, tile, resource);
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* Updates the content of the tile and prepares it for rendering.
|
|
653
|
-
* @param {Cesium3DTileset}Data attribution
|
|
654
|
-
* @param {FrameState} frameState - The current frame state.
|
|
655
|
-
* @private
|
|
656
|
-
*/
|
|
657
|
-
GaussianSplat3DTileContent.prototype.update = function (primitive, frameState) {
|
|
658
|
-
const loader = this._loader;
|
|
659
|
-
|
|
660
|
-
if (this._ready) {
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
frameState.afterRender.push(() => true);
|
|
665
|
-
|
|
666
|
-
if (!defined(loader)) {
|
|
667
|
-
this._ready = true;
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
if (this._resourcesLoaded) {
|
|
672
|
-
this.gltfPrimitive = loader.components.scene.nodes[0].primitives[0];
|
|
673
|
-
this.worldTransform = loader.components.scene.nodes[0].matrix;
|
|
674
|
-
this._ready = true;
|
|
675
|
-
|
|
676
|
-
// SPZ decode produces Float32Array attributes for these semantics, so
|
|
677
|
-
// typedArray.slice() preserves the expected runtime type for current data.
|
|
678
|
-
// If future splat encodings use quantized integer attributes here, revisit
|
|
679
|
-
// this assumption before relying on the copied array type.
|
|
680
|
-
this._positions = ModelUtility.getAttributeBySemantic(
|
|
681
|
-
this.gltfPrimitive,
|
|
682
|
-
VertexAttributeSemantic.POSITION,
|
|
683
|
-
).typedArray.slice();
|
|
684
|
-
|
|
685
|
-
this._rotations = ModelUtility.getAttributeBySemantic(
|
|
686
|
-
this.gltfPrimitive,
|
|
687
|
-
VertexAttributeSemantic.ROTATION,
|
|
688
|
-
).typedArray.slice();
|
|
689
|
-
|
|
690
|
-
this._scales = ModelUtility.getAttributeBySemantic(
|
|
691
|
-
this.gltfPrimitive,
|
|
692
|
-
VertexAttributeSemantic.SCALE,
|
|
693
|
-
).typedArray.slice();
|
|
694
|
-
|
|
695
|
-
const { l, n } = degreeAndCoefFromAttributes(this.gltfPrimitive.attributes);
|
|
696
|
-
this._sphericalHarmonicsDegree = l;
|
|
697
|
-
this._sphericalHarmonicsCoefficientCount = n;
|
|
698
|
-
|
|
699
|
-
this._packedSphericalHarmonicsData = packSphericalHarmonicsData(this);
|
|
700
|
-
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
this._resourcesLoaded = loader.process(frameState);
|
|
705
|
-
};
|
|
706
|
-
/**
|
|
707
|
-
* Returns whether the feature has this property.
|
|
708
|
-
*
|
|
709
|
-
* @param {number} batchId The batchId for the feature.
|
|
710
|
-
* @param {string} name The case-sensitive name of the property.
|
|
711
|
-
* @returns {boolean} <code>true</code> if the feature has this property; otherwise, <code>false</code>.
|
|
712
|
-
*/
|
|
713
|
-
GaussianSplat3DTileContent.prototype.hasProperty = function (batchId, name) {
|
|
714
|
-
return false;
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* Returns the {@link Cesium3DTileFeature} object for the feature with the
|
|
719
|
-
* given <code>batchId</code>. This object is used to get and modify the
|
|
720
|
-
* feature's properties.
|
|
721
|
-
* <p>
|
|
722
|
-
* Features in a tile are ordered by <code>batchId</code>, an index used to retrieve their metadata from the batch table.
|
|
723
|
-
* </p>
|
|
724
|
-
*
|
|
725
|
-
* @see {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/BatchTable}.
|
|
726
|
-
*
|
|
727
|
-
* @param {number} batchId The batchId for the feature.
|
|
728
|
-
* @returns {Cesium3DTileFeature} The corresponding {@link Cesium3DTileFeature} object.
|
|
729
|
-
*
|
|
730
|
-
* @exception {DeveloperError} batchId must be between zero and {@link Cesium3DTileContent#featuresLength} - 1.
|
|
731
|
-
*/
|
|
732
|
-
GaussianSplat3DTileContent.prototype.getFeature = function (batchId) {
|
|
733
|
-
return undefined;
|
|
734
|
-
};
|
|
735
|
-
/**
|
|
736
|
-
* Called when {@link Cesium3DTileset#debugColorizeTiles} changes.
|
|
737
|
-
* <p>
|
|
738
|
-
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
|
|
739
|
-
* not part of the public Cesium API.
|
|
740
|
-
* </p>
|
|
741
|
-
*
|
|
742
|
-
* @param {boolean} enabled Whether to enable or disable debug settings.
|
|
743
|
-
* @returns {Cesium3DTileFeature} The corresponding {@link Cesium3DTileFeature} object.
|
|
744
|
-
|
|
745
|
-
* @private
|
|
746
|
-
*/
|
|
747
|
-
GaussianSplat3DTileContent.prototype.applyDebugSettings = function (
|
|
748
|
-
enabled,
|
|
749
|
-
color,
|
|
750
|
-
) {};
|
|
751
|
-
/**
|
|
752
|
-
* Apply a style to the content
|
|
753
|
-
* <p>
|
|
754
|
-
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
|
|
755
|
-
* not part of the public Cesium API.
|
|
756
|
-
* </p>
|
|
757
|
-
*
|
|
758
|
-
* @param {Cesium3DTileStyle} style The style.
|
|
759
|
-
*
|
|
760
|
-
* @private
|
|
761
|
-
*/
|
|
762
|
-
GaussianSplat3DTileContent.prototype.applyStyle = function (style) {};
|
|
763
|
-
/**
|
|
764
|
-
* Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
|
|
765
|
-
*
|
|
766
|
-
* @param {Ray} ray The ray to test for intersection.
|
|
767
|
-
* @param {FrameState} frameState The frame state.
|
|
768
|
-
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
769
|
-
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
770
|
-
*
|
|
771
|
-
* @private
|
|
772
|
-
*/
|
|
773
|
-
GaussianSplat3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
774
|
-
return undefined;
|
|
775
|
-
};
|
|
776
|
-
/**
|
|
777
|
-
* Returns true if this object was destroyed; otherwise, false.
|
|
778
|
-
* <br /><br />
|
|
779
|
-
* If this object was destroyed, it should not be used; calling any function other than
|
|
780
|
-
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
781
|
-
* <p>
|
|
782
|
-
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
|
|
783
|
-
* not part of the public Cesium API.
|
|
784
|
-
* </p>
|
|
785
|
-
*
|
|
786
|
-
* @returns {boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
787
|
-
*
|
|
788
|
-
* @see Cesium3DTileContent#destroy
|
|
789
|
-
*
|
|
790
|
-
* @private
|
|
791
|
-
*/
|
|
792
|
-
GaussianSplat3DTileContent.prototype.isDestroyed = function () {
|
|
793
|
-
return this.isDestroyed;
|
|
794
|
-
};
|
|
795
|
-
|
|
796
|
-
/**
|
|
797
|
-
* Frees the resources used by this object.
|
|
798
|
-
* @private
|
|
799
|
-
*/
|
|
800
|
-
GaussianSplat3DTileContent.prototype.destroy = function () {
|
|
801
|
-
this.splatPrimitive = undefined;
|
|
802
|
-
|
|
803
|
-
this._tile = undefined;
|
|
804
|
-
this._tileset = undefined;
|
|
805
|
-
this._resource = undefined;
|
|
806
|
-
this._ready = false;
|
|
807
|
-
this._group = undefined;
|
|
808
|
-
this._metadata = undefined;
|
|
809
|
-
this._resourcesLoaded = false;
|
|
810
|
-
this._lastSplatTransform = undefined;
|
|
811
|
-
|
|
812
|
-
if (defined(this._loader)) {
|
|
813
|
-
this._loader.destroy();
|
|
814
|
-
this._loader = undefined;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
return destroyObject(this);
|
|
818
|
-
};
|
|
819
|
-
|
|
820
778
|
export default GaussianSplat3DTileContent;
|