@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.
Files changed (187) hide show
  1. package/Build/Workers/{chunk-GPIGURCG.js → chunk-3VFEWOBI.js} +7 -7
  2. package/Build/Workers/{chunk-BTX2NL3P.js → chunk-424RNO3D.js} +18 -18
  3. package/Build/Workers/{chunk-HSVQATK2.js → chunk-4MGMYHOO.js} +6 -6
  4. package/Build/Workers/{chunk-FIBS5S7R.js → chunk-4S7IE3LB.js} +2 -2
  5. package/Build/Workers/{chunk-A7ZBMVFS.js → chunk-52JDLOEM.js} +14 -14
  6. package/Build/Workers/{chunk-ZCCIIBZT.js → chunk-54I6Y66F.js} +6 -6
  7. package/Build/Workers/{chunk-J647NNZW.js → chunk-6YEE6JDR.js} +6 -6
  8. package/Build/Workers/{chunk-HVMG6AG4.js → chunk-7J2HKPRH.js} +9 -9
  9. package/Build/Workers/{chunk-K6NFIRFB.js → chunk-7WM2PX4V.js} +5 -5
  10. package/Build/Workers/{chunk-3LSD7OOA.js → chunk-ACXQXN46.js} +16 -16
  11. package/Build/Workers/{chunk-CZ23Y3RM.js → chunk-AYKR4VBR.js} +2 -2
  12. package/Build/Workers/{chunk-4MTRQFJP.js → chunk-C6J67V5A.js} +1 -1
  13. package/Build/Workers/{chunk-WTQGE7Q6.js → chunk-C6KNZ7T4.js} +17 -17
  14. package/Build/Workers/{chunk-AWFZHD2B.js → chunk-CFQP6LYM.js} +4 -4
  15. package/Build/Workers/{chunk-ST2UWDUU.js → chunk-CXOYE2WM.js} +5 -5
  16. package/Build/Workers/{chunk-H2A4USJR.js → chunk-CZEYZU4N.js} +10 -10
  17. package/Build/Workers/{chunk-DFEI5MAV.js → chunk-DBOEKL43.js} +7 -7
  18. package/Build/Workers/{chunk-A7A433MD.js → chunk-DDWSZVMY.js} +5 -5
  19. package/Build/Workers/{chunk-J7KQEKPK.js → chunk-DOBXCNC3.js} +13 -13
  20. package/Build/Workers/{chunk-URUCCIPS.js → chunk-E7VQ76KE.js} +6 -6
  21. package/Build/Workers/{chunk-ZAPOS52G.js → chunk-EBSIOBXY.js} +8 -8
  22. package/Build/Workers/{chunk-3VDDRF2E.js → chunk-EF2QYXGA.js} +14 -14
  23. package/Build/Workers/{chunk-WN6P5UDH.js → chunk-EPYXRCDB.js} +12 -12
  24. package/Build/Workers/{chunk-EZARA5FJ.js → chunk-F6QDY6HU.js} +13 -13
  25. package/Build/Workers/{chunk-GL7DNVUS.js → chunk-FRQZECAO.js} +5 -5
  26. package/Build/Workers/{chunk-VQKLRBIK.js → chunk-G7PXZRVF.js} +7 -7
  27. package/Build/Workers/{chunk-4QQXGTCE.js → chunk-INUEEEQA.js} +8 -8
  28. package/Build/Workers/{chunk-ITD2IN7N.js → chunk-IRBKFCEJ.js} +2 -2
  29. package/Build/Workers/{chunk-6SDGQI27.js → chunk-IYOUHCZB.js} +1 -1
  30. package/Build/Workers/{chunk-DYT5NR6P.js → chunk-J6BWOHUF.js} +3 -3
  31. package/Build/Workers/{chunk-4GF4MVPY.js → chunk-KFSTQKNM.js} +7 -7
  32. package/Build/Workers/{chunk-4XXHJI6Y.js → chunk-KKOSKAZB.js} +17 -17
  33. package/Build/Workers/{chunk-WC57YYBN.js → chunk-KSSWJIZW.js} +2 -2
  34. package/Build/Workers/{chunk-5T6QQAJW.js → chunk-M3B5JKSM.js} +1 -1
  35. package/Build/Workers/{chunk-QO2CGXMP.js → chunk-MPZHGZU6.js} +6 -6
  36. package/Build/Workers/{chunk-WUBKZFF6.js → chunk-MYP774IS.js} +9 -9
  37. package/Build/Workers/{chunk-WNN5D4W3.js → chunk-O3EA5HS7.js} +10 -10
  38. package/Build/Workers/{chunk-77RL3MBD.js → chunk-P3CK7MCY.js} +25 -4
  39. package/Build/Workers/{chunk-QXNQQYPV.js → chunk-Q3PY526V.js} +8 -8
  40. package/Build/Workers/{chunk-CKQP3DSS.js → chunk-QN67VG36.js} +6 -6
  41. package/Build/Workers/{chunk-ACFFCHHZ.js → chunk-QRWGUWI6.js} +11 -11
  42. package/Build/Workers/{chunk-LH5SF3XV.js → chunk-S4MCOY6I.js} +5 -5
  43. package/Build/Workers/{chunk-FVLVVOBQ.js → chunk-SMQZZOW6.js} +10 -10
  44. package/Build/Workers/{chunk-TA777BGS.js → chunk-TKKIREQ6.js} +1 -1
  45. package/Build/Workers/{chunk-AEAVLYPS.js → chunk-U3ZA64U7.js} +2 -2
  46. package/Build/Workers/{chunk-7LSFAEWF.js → chunk-UA25D5MX.js} +10 -10
  47. package/Build/Workers/{chunk-J3OFS2RD.js → chunk-UOOIQ3KX.js} +12 -12
  48. package/Build/Workers/{chunk-ND3NTTOF.js → chunk-V7VQKN6N.js} +6 -6
  49. package/Build/Workers/{chunk-I3A6DXYZ.js → chunk-VQYETPWC.js} +4 -4
  50. package/Build/Workers/{chunk-35H3UBIO.js → chunk-VWV2IJRB.js} +11 -11
  51. package/Build/Workers/{chunk-QSDY4NS7.js → chunk-XZMBNNDX.js} +9 -9
  52. package/Build/Workers/{chunk-TAI4HLII.js → chunk-Y57HREW5.js} +4 -4
  53. package/Build/Workers/{chunk-3TKLDHV3.js → chunk-Y5BF6AFU.js} +2 -2
  54. package/Build/Workers/{chunk-3XY3MVPG.js → chunk-YLY7NKAB.js} +4 -4
  55. package/Build/Workers/{chunk-BVAIWR7O.js → chunk-ZK3CF7ZD.js} +12 -12
  56. package/Build/Workers/{chunk-DH26SNAB.js → chunk-ZP7JMQV4.js} +1 -1
  57. package/Build/Workers/{chunk-3RFFPH4M.js → chunk-ZZ46LWL6.js} +1 -1
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/Cartesian2.js +1 -1
  112. package/Source/Core/Cartesian3.js +1 -1
  113. package/Source/Core/Cartesian4.js +1 -1
  114. package/Source/Core/ComponentDatatype.js +35 -0
  115. package/Source/Core/Ion.js +1 -1
  116. package/Source/Core/MapProjection.js +1 -0
  117. package/Source/Core/Matrix2.js +1 -1
  118. package/Source/Core/Matrix3.js +1 -1
  119. package/Source/Core/Matrix4.js +1 -1
  120. package/Source/Core/Resource.js +1 -1
  121. package/Source/Core/ScreenSpaceEventHandler.js +51 -41
  122. package/Source/Core/createColorRamp.js +37 -0
  123. package/Source/Core/globalTypes.js +25 -0
  124. package/Source/Renderer/Pass.js +3 -2
  125. package/Source/Renderer/createUniform.js +346 -239
  126. package/Source/Renderer/createUniformArray.js +494 -381
  127. package/Source/Scene/ArcGisMapService.js +1 -1
  128. package/Source/Scene/BufferPoint.js +1 -0
  129. package/Source/Scene/BufferPointCollection.js +14 -1
  130. package/Source/Scene/BufferPolygon.js +3 -2
  131. package/Source/Scene/BufferPolygonCollection.js +10 -0
  132. package/Source/Scene/BufferPolyline.js +1 -0
  133. package/Source/Scene/BufferPolylineCollection.js +2 -0
  134. package/Source/Scene/BufferPrimitiveCollection.js +79 -28
  135. package/Source/Scene/CameraEventAggregator.js +30 -18
  136. package/Source/Scene/Cesium3DTile.js +54 -1
  137. package/Source/Scene/Cesium3DTileContent.js +195 -254
  138. package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
  139. package/Source/Scene/Cesium3DTileset.js +45 -5
  140. package/Source/Scene/Composite3DTileContent.js +254 -292
  141. package/Source/Scene/EdgeDisplayMode.js +50 -0
  142. package/Source/Scene/Empty3DTileContent.js +100 -132
  143. package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
  144. package/Source/Scene/GeoJsonPrimitive.js +874 -0
  145. package/Source/Scene/Geometry3DTileContent.js +151 -185
  146. package/Source/Scene/GltfLoader.js +109 -0
  147. package/Source/Scene/Implicit3DTileContent.js +179 -214
  148. package/Source/Scene/MVTDataProvider.js +147 -0
  149. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +79 -311
  150. package/Source/Scene/Model/Model.js +34 -0
  151. package/Source/Scene/Model/Model3DTileContent.js +424 -458
  152. package/Source/Scene/Model/ModelDrawCommand.js +31 -3
  153. package/Source/Scene/Model/ModelUtility.js +4 -0
  154. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +466 -150
  155. package/Source/Scene/ModelComponents.js +39 -1
  156. package/Source/Scene/Multiple3DTileContent.js +291 -334
  157. package/Source/Scene/Scene.js +26 -0
  158. package/Source/Scene/Tileset3DTileContent.js +113 -146
  159. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
  160. package/Source/Scene/Vector3DTileContent.js +205 -234
  161. package/Source/Scene/VectorGltf3DTileContent.js +85 -36
  162. package/Source/Scene/VoxelPrimitive.js +159 -175
  163. package/Source/Scene/VoxelProvider.js +64 -91
  164. package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
  165. package/Source/Scene/buildVoxelCustomShader.js +199 -0
  166. package/Source/Scene/decodeMVT.js +634 -0
  167. package/Source/Scene/renderBufferPointCollection.js +110 -64
  168. package/Source/Scene/renderBufferPolygonCollection.js +102 -55
  169. package/Source/Scene/renderBufferPolylineCollection.js +365 -166
  170. package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
  171. package/Source/Shaders/BufferPointMaterialFS.js +1 -0
  172. package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
  173. package/Source/Shaders/BufferPointMaterialVS.js +20 -10
  174. package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
  175. package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
  176. package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
  177. package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
  178. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
  179. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
  180. package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
  181. package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
  182. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
  183. package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
  184. package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
  185. package/index.d.ts +253 -35
  186. package/index.js +71 -62
  187. package/package.json +2 -2
@@ -8,6 +8,13 @@ import Pass from "../../Renderer/Pass.js";
8
8
  import ModelAnimationLoop from "../ModelAnimationLoop.js";
9
9
  import Model from "./Model.js";
10
10
 
11
+ /** @import Cesium3DContentGroup from "../Cesium3DContentGroup.js"; */
12
+ /** @import Cesium3DTile from "../Cesium3DTile.js"; */
13
+ /** @import Cesium3DTileContent from "../Cesium3DTileContent.js"; */
14
+ /** @import Cesium3DTileset from "../Cesium3DTileset.js"; */
15
+ /** @import ImplicitMetadataView from "../ImplicitMetadataView.js"; */
16
+ /** @import Resource from "../../Core/Resource.js"; */
17
+
11
18
  /**
12
19
  * Represents the contents of a glTF, glb or
13
20
  * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel|Batched 3D Model}
@@ -17,501 +24,460 @@ import Model from "./Model.js";
17
24
  * </p>
18
25
  * This object is normally not instantiated directly, use {@link Model3DTileContent.fromGltf}, {@link Model3DTileContent.fromB3dm}, {@link Model3DTileContent.fromI3dm}, {@link Model3DTileContent.fromPnts}, or {@link Model3DTileContent.fromGeoJson}.
19
26
  *
20
- * @alias Model3DTileContent
21
- * @constructor
27
+ * @implements Cesium3DTileContent
22
28
  * @private
23
29
  */
24
- function Model3DTileContent(tileset, tile, resource) {
25
- this._tileset = tileset;
26
- this._tile = tile;
27
- this._resource = resource;
28
-
29
- this._model = undefined;
30
- this._metadata = undefined;
31
- this._group = undefined;
32
- this._ready = false;
33
- }
30
+ class Model3DTileContent {
31
+ /**
32
+ *
33
+ * @param {Cesium3DTileset} tileset
34
+ * @param {Cesium3DTile} tile
35
+ * @param {Resource} resource
36
+ */
37
+ constructor(tileset, tile, resource) {
38
+ this._tileset = tileset;
39
+ this._tile = tile;
40
+ this._resource = resource;
41
+
42
+ /** @type {Model} */
43
+ this._model = undefined;
44
+ /** @type {ImplicitMetadataView|undefined} */
45
+ this._metadata = undefined;
46
+ /** @type {Cesium3DContentGroup|undefined} */
47
+ this._group = undefined;
48
+ this._ready = false;
49
+ }
34
50
 
35
- Object.defineProperties(Model3DTileContent.prototype, {
36
- featuresLength: {
37
- get: function () {
38
- const model = this._model;
39
- const featureTables = model.featureTables;
40
- const featureTableId = model.featureTableId;
41
-
42
- if (defined(featureTables) && defined(featureTables[featureTableId])) {
43
- return featureTables[featureTableId].featuresLength;
44
- }
45
-
46
- return 0;
47
- },
48
- },
49
-
50
- pointsLength: {
51
- get: function () {
52
- return this._model.statistics.pointsLength;
53
- },
54
- },
55
-
56
- trianglesLength: {
57
- get: function () {
58
- return this._model.statistics.trianglesLength;
59
- },
60
- },
61
-
62
- geometryByteLength: {
63
- get: function () {
64
- return this._model.statistics.geometryByteLength;
65
- },
66
- },
67
-
68
- texturesByteLength: {
69
- get: function () {
70
- return this._model.statistics.texturesByteLength;
71
- },
72
- },
73
-
74
- batchTableByteLength: {
75
- get: function () {
76
- const statistics = this._model.statistics;
77
- return (
78
- statistics.propertyTablesByteLength + statistics.batchTexturesByteLength
79
- );
80
- },
81
- },
51
+ get featuresLength() {
52
+ const model = this._model;
53
+ const featureTables = model.featureTables;
54
+ const featureTableId = model.featureTableId;
82
55
 
83
- innerContents: {
84
- get: function () {
85
- return undefined;
86
- },
87
- },
56
+ if (defined(featureTables) && defined(featureTables[featureTableId])) {
57
+ return featureTables[featureTableId].featuresLength;
58
+ }
59
+
60
+ return 0;
61
+ }
62
+
63
+ get pointsLength() {
64
+ return this._model.statistics.pointsLength;
65
+ }
66
+
67
+ get trianglesLength() {
68
+ return this._model.statistics.trianglesLength;
69
+ }
70
+
71
+ get geometryByteLength() {
72
+ return this._model.statistics.geometryByteLength;
73
+ }
74
+
75
+ get texturesByteLength() {
76
+ return this._model.statistics.texturesByteLength;
77
+ }
78
+
79
+ get batchTableByteLength() {
80
+ const statistics = this._model.statistics;
81
+ return (
82
+ statistics.propertyTablesByteLength + statistics.batchTexturesByteLength
83
+ );
84
+ }
85
+
86
+ get innerContents() {
87
+ return undefined;
88
+ }
88
89
 
89
90
  /**
90
91
  * Returns true when the tile's content is ready to render; otherwise false
91
92
  *
92
- * @memberof Model3DTileContent.prototype
93
93
  *
94
94
  * @type {boolean}
95
95
  * @readonly
96
96
  * @private
97
97
  */
98
- ready: {
99
- get: function () {
100
- return this._ready;
101
- },
102
- },
103
-
104
- tileset: {
105
- get: function () {
106
- return this._tileset;
107
- },
108
- },
109
-
110
- tile: {
111
- get: function () {
112
- return this._tile;
113
- },
114
- },
115
-
116
- url: {
117
- get: function () {
118
- return this._resource.getUrlComponent(true);
119
- },
120
- },
121
-
122
- batchTable: {
123
- get: function () {
124
- const model = this._model;
125
- const featureTables = model.featureTables;
126
- const featureTableId = model.featureTableId;
127
-
128
- if (defined(featureTables) && defined(featureTables[featureTableId])) {
129
- return featureTables[featureTableId];
130
- }
98
+ get ready() {
99
+ return this._ready;
100
+ }
131
101
 
132
- return undefined;
133
- },
134
- },
135
-
136
- metadata: {
137
- get: function () {
138
- return this._metadata;
139
- },
140
- set: function (value) {
141
- this._metadata = value;
142
- },
143
- },
144
-
145
- group: {
146
- get: function () {
147
- return this._group;
148
- },
149
- set: function (value) {
150
- this._group = value;
151
- },
152
- },
153
- });
102
+ get tileset() {
103
+ return this._tileset;
104
+ }
154
105
 
155
- /**
156
- * Returns an array containing the `texture.id` values for all textures
157
- * that are part of this content.
158
- *
159
- * @returns {string[]} The texture IDs
160
- */
161
- Model3DTileContent.prototype.getTextureIds = function () {
162
- return this._model.statistics.getTextureIds();
163
- };
106
+ get tile() {
107
+ return this._tile;
108
+ }
164
109
 
165
- /**
166
- * Returns the length, in bytes, of the texture data for the texture with
167
- * the given ID that is part of this content, or `undefined` if this
168
- * content does not contain the texture with the given ID.
169
- *
170
- * @param {string} textureId The texture ID
171
- * @returns {number|undefined} The texture byte length
172
- */
173
- Model3DTileContent.prototype.getTextureByteLengthById = function (textureId) {
174
- return this._model.statistics.getTextureByteLengthById(textureId);
175
- };
110
+ get url() {
111
+ return this._resource.getUrlComponent(true);
112
+ }
176
113
 
177
- /**
178
- * Returns the object that was created for the given extension.
179
- *
180
- * The given name may be the name of a glTF extension, like `"EXT_example_extension"`.
181
- * If the specified extension was present in the root of the underlying glTF asset,
182
- * and a loader for the specified extension has processed the extension data, then
183
- * this will return the model representation of the extension.
184
- *
185
- * @param {string} extensionName The name of the extension
186
- * @returns {object|undefined} The object, or `undefined`
187
- *
188
- * @private
189
- */
190
- Model3DTileContent.prototype.getExtension = function (extensionName) {
191
- const model = this._model;
192
- const extension = model.getExtension(extensionName);
193
- return extension;
194
- };
195
-
196
- Model3DTileContent.prototype.getFeature = function (featureId) {
197
- const model = this._model;
198
- const featureTableId = model.featureTableId;
199
-
200
- //>>includeStart('debug', pragmas.debug);
201
- if (!defined(featureTableId)) {
202
- throw new DeveloperError(
203
- "No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined",
204
- );
114
+ get batchTable() {
115
+ const model = this._model;
116
+ const featureTables = model.featureTables;
117
+ const featureTableId = model.featureTableId;
118
+
119
+ if (defined(featureTables) && defined(featureTables[featureTableId])) {
120
+ return featureTables[featureTableId];
121
+ }
122
+
123
+ return undefined;
205
124
  }
206
- //>>includeEnd('debug');
207
125
 
208
- const featureTable = model.featureTables[featureTableId];
126
+ get metadata() {
127
+ return this._metadata;
128
+ }
209
129
 
210
- //>>includeStart('debug', pragmas.debug);
211
- if (!defined(featureTable)) {
212
- throw new DeveloperError(
213
- "No feature table found for the selected feature ID set",
214
- );
130
+ set metadata(value) {
131
+ this._metadata = value;
215
132
  }
216
- //>>includeEnd('debug');
217
133
 
218
- //>>includeStart('debug', pragmas.debug);
219
- const featuresLength = featureTable.featuresLength;
220
- if (!defined(featureId) || featureId < 0 || featureId >= featuresLength) {
221
- throw new DeveloperError(
222
- `featureId is required and must be between 0 and featuresLength - 1 (${
223
- featuresLength - 1
224
- }).`,
225
- );
134
+ get group() {
135
+ return this._group;
136
+ }
137
+
138
+ set group(value) {
139
+ this._group = value;
140
+ }
141
+
142
+ /**
143
+ * Returns an array containing the `texture.id` values for all textures
144
+ * that are part of this content.
145
+ *
146
+ * @returns {string[]} The texture IDs
147
+ */
148
+ getTextureIds() {
149
+ return this._model.statistics.getTextureIds();
150
+ }
151
+
152
+ /**
153
+ * Returns the length, in bytes, of the texture data for the texture with
154
+ * the given ID that is part of this content, or `undefined` if this
155
+ * content does not contain the texture with the given ID.
156
+ *
157
+ * @param {string} textureId The texture ID
158
+ * @returns {number|undefined} The texture byte length
159
+ */
160
+ getTextureByteLengthById(textureId) {
161
+ return this._model.statistics.getTextureByteLengthById(textureId);
162
+ }
163
+
164
+ /**
165
+ * Returns the object that was created for the given extension.
166
+ *
167
+ * The given name may be the name of a glTF extension, like `"EXT_example_extension"`.
168
+ * If the specified extension was present in the root of the underlying glTF asset,
169
+ * and a loader for the specified extension has processed the extension data, then
170
+ * this will return the model representation of the extension.
171
+ *
172
+ * @param {string} extensionName The name of the extension
173
+ * @returns {object|undefined} The object, or `undefined`
174
+ *
175
+ * @private
176
+ */
177
+ getExtension(extensionName) {
178
+ const model = this._model;
179
+ const extension = model.getExtension(extensionName);
180
+ return extension;
181
+ }
182
+
183
+ getFeature(featureId) {
184
+ const model = this._model;
185
+ const featureTableId = model.featureTableId;
186
+
187
+ //>>includeStart('debug', pragmas.debug);
188
+ if (!defined(featureTableId)) {
189
+ throw new DeveloperError(
190
+ "No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined",
191
+ );
192
+ }
193
+ //>>includeEnd('debug');
194
+
195
+ const featureTable = model.featureTables[featureTableId];
196
+
197
+ //>>includeStart('debug', pragmas.debug);
198
+ if (!defined(featureTable)) {
199
+ throw new DeveloperError(
200
+ "No feature table found for the selected feature ID set",
201
+ );
202
+ }
203
+ //>>includeEnd('debug');
204
+
205
+ //>>includeStart('debug', pragmas.debug);
206
+ const featuresLength = featureTable.featuresLength;
207
+ if (!defined(featureId) || featureId < 0 || featureId >= featuresLength) {
208
+ throw new DeveloperError(
209
+ `featureId is required and must be between 0 and featuresLength - 1 (${
210
+ featuresLength - 1
211
+ }).`,
212
+ );
213
+ }
214
+ //>>includeEnd('debug');
215
+ return featureTable.getFeature(featureId);
216
+ }
217
+
218
+ hasProperty(featureId, name) {
219
+ const model = this._model;
220
+ const featureTableId = model.featureTableId;
221
+ if (!defined(featureTableId)) {
222
+ return false;
223
+ }
224
+
225
+ const featureTable = model.featureTables[featureTableId];
226
+ return featureTable.hasProperty(featureId, name);
227
+ }
228
+
229
+ applyDebugSettings(enabled, color) {
230
+ color = enabled ? color : Color.WHITE;
231
+ if (this.featuresLength === 0) {
232
+ this._model.color = color;
233
+ } else if (defined(this.batchTable)) {
234
+ this.batchTable.setAllColor(color);
235
+ }
236
+ }
237
+
238
+ applyStyle(style) {
239
+ // the setter will call model.applyStyle()
240
+ this._model.style = style;
241
+ }
242
+
243
+ update(tileset, frameState) {
244
+ const model = this._model;
245
+ const tile = this._tile;
246
+
247
+ model.colorBlendAmount = tileset.colorBlendAmount;
248
+ model.colorBlendMode = tileset.colorBlendMode;
249
+ model.modelMatrix = tile.computedTransform;
250
+ model.customShader = tileset.customShader;
251
+ model.featureIdLabel = tileset.featureIdLabel;
252
+ model.instanceFeatureIdLabel = tileset.instanceFeatureIdLabel;
253
+ model.lightColor = tileset.lightColor;
254
+ model.imageBasedLighting = tileset.imageBasedLighting;
255
+ model.backFaceCulling = tileset.backFaceCulling;
256
+ model.shadows = tileset.shadows;
257
+ model.showCreditsOnScreen = tileset.showCreditsOnScreen;
258
+ model.splitDirection = tileset.splitDirection;
259
+ model.debugWireframe = tileset.debugWireframe;
260
+ model.edgeDisplayMode = tileset.edgeDisplayMode;
261
+ model.showOutline = tileset.showOutline;
262
+ model.outlineColor = tileset.outlineColor;
263
+ model.pointCloudShading = tileset.pointCloudShading;
264
+
265
+ // Updating clipping planes requires more effort because of ownership checks
266
+ const tilesetClippingPlanes = tileset.clippingPlanes;
267
+ model.referenceMatrix = tileset.clippingPlanesOriginMatrix;
268
+ if (defined(tilesetClippingPlanes) && tile.clippingPlanesDirty) {
269
+ // Dereference the clipping planes from the model if they are irrelevant.
270
+ model._clippingPlanes =
271
+ tilesetClippingPlanes.enabled && tile._isClipped
272
+ ? tilesetClippingPlanes
273
+ : undefined;
274
+ }
275
+
276
+ const tilesetEnvironmentMapManager = tileset.environmentMapManager;
277
+ if (model.environmentMapManager !== tilesetClippingPlanes) {
278
+ model._environmentMapManager = tilesetEnvironmentMapManager;
279
+ }
280
+
281
+ // If the model references a different ClippingPlaneCollection from the tileset,
282
+ // update the model to use the new ClippingPlaneCollection.
283
+ if (
284
+ defined(tilesetClippingPlanes) &&
285
+ defined(model._clippingPlanes) &&
286
+ model._clippingPlanes !== tilesetClippingPlanes
287
+ ) {
288
+ model._clippingPlanes = tilesetClippingPlanes;
289
+ model._clippingPlanesState = 0;
290
+ }
291
+
292
+ // Updating clipping polygons requires more effort because of ownership checks
293
+ const tilesetClippingPolygons = tileset.clippingPolygons;
294
+ if (defined(tilesetClippingPolygons) && tile.clippingPolygonsDirty) {
295
+ // Dereference the clipping polygons from the model if they are irrelevant.
296
+ model._clippingPolygons =
297
+ tilesetClippingPolygons.enabled && tile._isClippedByPolygon
298
+ ? tilesetClippingPolygons
299
+ : undefined;
300
+ }
301
+
302
+ // If the model references a different ClippingPolygonCollection from the tileset,
303
+ // update the model to use the new ClippingPolygonCollection.
304
+ if (
305
+ defined(tilesetClippingPolygons) &&
306
+ defined(model._clippingPolygons) &&
307
+ model._clippingPolygons !== tilesetClippingPolygons
308
+ ) {
309
+ model._clippingPolygons = tilesetClippingPolygons;
310
+ model._clippingPolygonsState = 0;
311
+ }
312
+
313
+ model.update(frameState);
314
+
315
+ if (!this._ready && model.ready) {
316
+ // Animation can only be added once the model is ready
317
+ model.activeAnimations.addAll({
318
+ loop: ModelAnimationLoop.REPEAT,
319
+ });
320
+
321
+ this._ready = true;
322
+ }
226
323
  }
227
- //>>includeEnd('debug');
228
- return featureTable.getFeature(featureId);
229
- };
230
324
 
231
- Model3DTileContent.prototype.hasProperty = function (featureId, name) {
232
- const model = this._model;
233
- const featureTableId = model.featureTableId;
234
- if (!defined(featureTableId)) {
325
+ isDestroyed() {
235
326
  return false;
236
327
  }
237
328
 
238
- const featureTable = model.featureTables[featureTableId];
239
- return featureTable.hasProperty(featureId, name);
240
- };
241
-
242
- Model3DTileContent.prototype.applyDebugSettings = function (enabled, color) {
243
- color = enabled ? color : Color.WHITE;
244
- if (this.featuresLength === 0) {
245
- this._model.color = color;
246
- } else if (defined(this.batchTable)) {
247
- this.batchTable.setAllColor(color);
248
- }
249
- };
250
-
251
- Model3DTileContent.prototype.applyStyle = function (style) {
252
- // the setter will call model.applyStyle()
253
- this._model.style = style;
254
- };
255
-
256
- Model3DTileContent.prototype.update = function (tileset, frameState) {
257
- const model = this._model;
258
- const tile = this._tile;
259
-
260
- model.colorBlendAmount = tileset.colorBlendAmount;
261
- model.colorBlendMode = tileset.colorBlendMode;
262
- model.modelMatrix = tile.computedTransform;
263
- model.customShader = tileset.customShader;
264
- model.featureIdLabel = tileset.featureIdLabel;
265
- model.instanceFeatureIdLabel = tileset.instanceFeatureIdLabel;
266
- model.lightColor = tileset.lightColor;
267
- model.imageBasedLighting = tileset.imageBasedLighting;
268
- model.backFaceCulling = tileset.backFaceCulling;
269
- model.shadows = tileset.shadows;
270
- model.showCreditsOnScreen = tileset.showCreditsOnScreen;
271
- model.splitDirection = tileset.splitDirection;
272
- model.debugWireframe = tileset.debugWireframe;
273
- model.showOutline = tileset.showOutline;
274
- model.outlineColor = tileset.outlineColor;
275
- model.pointCloudShading = tileset.pointCloudShading;
276
-
277
- // Updating clipping planes requires more effort because of ownership checks
278
- const tilesetClippingPlanes = tileset.clippingPlanes;
279
- model.referenceMatrix = tileset.clippingPlanesOriginMatrix;
280
- if (defined(tilesetClippingPlanes) && tile.clippingPlanesDirty) {
281
- // Dereference the clipping planes from the model if they are irrelevant.
282
- model._clippingPlanes =
283
- tilesetClippingPlanes.enabled && tile._isClipped
284
- ? tilesetClippingPlanes
285
- : undefined;
286
- }
287
-
288
- const tilesetEnvironmentMapManager = tileset.environmentMapManager;
289
- if (model.environmentMapManager !== tilesetClippingPlanes) {
290
- model._environmentMapManager = tilesetEnvironmentMapManager;
291
- }
292
-
293
- // If the model references a different ClippingPlaneCollection from the tileset,
294
- // update the model to use the new ClippingPlaneCollection.
295
- if (
296
- defined(tilesetClippingPlanes) &&
297
- defined(model._clippingPlanes) &&
298
- model._clippingPlanes !== tilesetClippingPlanes
299
- ) {
300
- model._clippingPlanes = tilesetClippingPlanes;
301
- model._clippingPlanesState = 0;
302
- }
303
-
304
- // Updating clipping polygons requires more effort because of ownership checks
305
- const tilesetClippingPolygons = tileset.clippingPolygons;
306
- if (defined(tilesetClippingPolygons) && tile.clippingPolygonsDirty) {
307
- // Dereference the clipping polygons from the model if they are irrelevant.
308
- model._clippingPolygons =
309
- tilesetClippingPolygons.enabled && tile._isClippedByPolygon
310
- ? tilesetClippingPolygons
311
- : undefined;
312
- }
313
-
314
- // If the model references a different ClippingPolygonCollection from the tileset,
315
- // update the model to use the new ClippingPolygonCollection.
316
- if (
317
- defined(tilesetClippingPolygons) &&
318
- defined(model._clippingPolygons) &&
319
- model._clippingPolygons !== tilesetClippingPolygons
320
- ) {
321
- model._clippingPolygons = tilesetClippingPolygons;
322
- model._clippingPolygonsState = 0;
323
- }
324
-
325
- model.update(frameState);
326
-
327
- if (!this._ready && model.ready) {
328
- // Animation can only be added once the model is ready
329
- model.activeAnimations.addAll({
330
- loop: ModelAnimationLoop.REPEAT,
331
- });
332
-
333
- this._ready = true;
334
- }
335
- };
336
-
337
- Model3DTileContent.prototype.isDestroyed = function () {
338
- return false;
339
- };
340
-
341
- Model3DTileContent.prototype.destroy = function () {
342
- this._model = this._model && this._model.destroy();
343
- return destroyObject(this);
344
- };
345
-
346
- Model3DTileContent.fromGltf = async function (tileset, tile, resource, gltf) {
347
- const content = new Model3DTileContent(tileset, tile, resource);
348
-
349
- const additionalOptions = {
350
- gltf: gltf,
351
- basePath: resource,
352
- };
329
+ destroy() {
330
+ this._model = this._model && this._model.destroy();
331
+ return destroyObject(this);
332
+ }
353
333
 
354
- const modelOptions = makeModelOptions(
355
- tileset,
356
- tile,
357
- content,
358
- additionalOptions,
359
- );
360
-
361
- const classificationType = tileset.vectorClassificationOnly
362
- ? undefined
363
- : tileset.classificationType;
364
-
365
- modelOptions.classificationType = classificationType;
366
-
367
- const model = await Model.fromGltfAsync(modelOptions);
368
- content._model = model;
369
-
370
- return content;
371
- };
372
-
373
- Model3DTileContent.fromB3dm = async function (
374
- tileset,
375
- tile,
376
- resource,
377
- arrayBuffer,
378
- byteOffset,
379
- ) {
380
- const content = new Model3DTileContent(tileset, tile, resource);
381
-
382
- const additionalOptions = {
383
- arrayBuffer: arrayBuffer,
384
- byteOffset: byteOffset,
385
- resource: resource,
386
- };
334
+ static async fromGltf(tileset, tile, resource, gltf) {
335
+ const content = new Model3DTileContent(tileset, tile, resource);
387
336
 
388
- const modelOptions = makeModelOptions(
389
- tileset,
390
- tile,
391
- content,
392
- additionalOptions,
393
- );
394
-
395
- const classificationType = tileset.vectorClassificationOnly
396
- ? undefined
397
- : tileset.classificationType;
398
-
399
- modelOptions.classificationType = classificationType;
400
-
401
- const model = await Model.fromB3dm(modelOptions);
402
- content._model = model;
403
-
404
- return content;
405
- };
406
-
407
- Model3DTileContent.fromI3dm = async function (
408
- tileset,
409
- tile,
410
- resource,
411
- arrayBuffer,
412
- byteOffset,
413
- ) {
414
- const content = new Model3DTileContent(tileset, tile, resource);
415
-
416
- const additionalOptions = {
417
- arrayBuffer: arrayBuffer,
418
- byteOffset: byteOffset,
419
- resource: resource,
420
- };
337
+ const additionalOptions = {
338
+ gltf: gltf,
339
+ basePath: resource,
340
+ };
421
341
 
422
- const modelOptions = makeModelOptions(
423
- tileset,
424
- tile,
425
- content,
426
- additionalOptions,
427
- );
428
-
429
- const model = await Model.fromI3dm(modelOptions);
430
- content._model = model;
431
-
432
- return content;
433
- };
434
-
435
- Model3DTileContent.fromPnts = async function (
436
- tileset,
437
- tile,
438
- resource,
439
- arrayBuffer,
440
- byteOffset,
441
- ) {
442
- const content = new Model3DTileContent(tileset, tile, resource);
443
-
444
- const additionalOptions = {
445
- arrayBuffer: arrayBuffer,
446
- byteOffset: byteOffset,
447
- resource: resource,
448
- };
342
+ const modelOptions = makeModelOptions(
343
+ tileset,
344
+ tile,
345
+ content,
346
+ additionalOptions,
347
+ );
449
348
 
450
- const modelOptions = makeModelOptions(
451
- tileset,
452
- tile,
453
- content,
454
- additionalOptions,
455
- );
456
- const model = await Model.fromPnts(modelOptions);
457
- content._model = model;
458
-
459
- return content;
460
- };
461
-
462
- Model3DTileContent.fromGeoJson = async function (
463
- tileset,
464
- tile,
465
- resource,
466
- geoJson,
467
- ) {
468
- const content = new Model3DTileContent(tileset, tile, resource);
469
-
470
- const additionalOptions = {
471
- geoJson: geoJson,
472
- resource: resource,
473
- };
349
+ const classificationType = tileset.vectorClassificationOnly
350
+ ? undefined
351
+ : tileset.classificationType;
474
352
 
475
- const modelOptions = makeModelOptions(
476
- tileset,
477
- tile,
478
- content,
479
- additionalOptions,
480
- );
481
- const model = await Model.fromGeoJson(modelOptions);
482
- content._model = model;
353
+ modelOptions.classificationType = classificationType;
483
354
 
484
- return content;
485
- };
355
+ const model = await Model.fromGltfAsync(modelOptions);
356
+ content._model = model;
486
357
 
487
- /**
488
- * Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
489
- *
490
- * @param {Ray} ray The ray to test for intersection.
491
- * @param {FrameState} frameState The frame state.
492
- * @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
493
- * @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
494
- *
495
- * @private
496
- */
497
- Model3DTileContent.prototype.pick = function (ray, frameState, result) {
498
- if (!defined(this._model) || !this._ready) {
499
- return undefined;
358
+ return content;
500
359
  }
501
360
 
502
- const verticalExaggeration = frameState.verticalExaggeration;
503
- const relativeHeight = frameState.verticalExaggerationRelativeHeight;
361
+ static async fromB3dm(tileset, tile, resource, arrayBuffer, byteOffset) {
362
+ const content = new Model3DTileContent(tileset, tile, resource);
363
+
364
+ const additionalOptions = {
365
+ arrayBuffer: arrayBuffer,
366
+ byteOffset: byteOffset,
367
+ resource: resource,
368
+ };
369
+
370
+ const modelOptions = makeModelOptions(
371
+ tileset,
372
+ tile,
373
+ content,
374
+ additionalOptions,
375
+ );
504
376
 
505
- // All tilesets assume a WGS84 ellipsoid
506
- return this._model.pick(
507
- ray,
508
- frameState,
509
- verticalExaggeration,
510
- relativeHeight,
511
- Ellipsoid.WGS84,
512
- result,
513
- );
514
- };
377
+ const classificationType = tileset.vectorClassificationOnly
378
+ ? undefined
379
+ : tileset.classificationType;
380
+
381
+ modelOptions.classificationType = classificationType;
382
+
383
+ const model = await Model.fromB3dm(modelOptions);
384
+ content._model = model;
385
+
386
+ return content;
387
+ }
388
+
389
+ static async fromI3dm(tileset, tile, resource, arrayBuffer, byteOffset) {
390
+ const content = new Model3DTileContent(tileset, tile, resource);
391
+
392
+ const additionalOptions = {
393
+ arrayBuffer: arrayBuffer,
394
+ byteOffset: byteOffset,
395
+ resource: resource,
396
+ };
397
+
398
+ const modelOptions = makeModelOptions(
399
+ tileset,
400
+ tile,
401
+ content,
402
+ additionalOptions,
403
+ );
404
+
405
+ const model = await Model.fromI3dm(modelOptions);
406
+ content._model = model;
407
+
408
+ return content;
409
+ }
410
+
411
+ static async fromPnts(tileset, tile, resource, arrayBuffer, byteOffset) {
412
+ const content = new Model3DTileContent(tileset, tile, resource);
413
+
414
+ const additionalOptions = {
415
+ arrayBuffer: arrayBuffer,
416
+ byteOffset: byteOffset,
417
+ resource: resource,
418
+ };
419
+
420
+ const modelOptions = makeModelOptions(
421
+ tileset,
422
+ tile,
423
+ content,
424
+ additionalOptions,
425
+ );
426
+ const model = await Model.fromPnts(modelOptions);
427
+ content._model = model;
428
+
429
+ return content;
430
+ }
431
+
432
+ static async fromGeoJson(tileset, tile, resource, geoJson) {
433
+ const content = new Model3DTileContent(tileset, tile, resource);
434
+
435
+ const additionalOptions = {
436
+ geoJson: geoJson,
437
+ resource: resource,
438
+ };
439
+
440
+ const modelOptions = makeModelOptions(
441
+ tileset,
442
+ tile,
443
+ content,
444
+ additionalOptions,
445
+ );
446
+ const model = await Model.fromGeoJson(modelOptions);
447
+ content._model = model;
448
+
449
+ return content;
450
+ }
451
+
452
+ /**
453
+ * Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
454
+ *
455
+ * @param {Ray} ray The ray to test for intersection.
456
+ * @param {FrameState} frameState The frame state.
457
+ * @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
458
+ * @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
459
+ *
460
+ * @private
461
+ */
462
+ pick(ray, frameState, result) {
463
+ if (!defined(this._model) || !this._ready) {
464
+ return undefined;
465
+ }
466
+
467
+ const verticalExaggeration = frameState.verticalExaggeration;
468
+ const relativeHeight = frameState.verticalExaggerationRelativeHeight;
469
+
470
+ // All tilesets assume a WGS84 ellipsoid
471
+ return this._model.pick(
472
+ ray,
473
+ frameState,
474
+ verticalExaggeration,
475
+ relativeHeight,
476
+ Ellipsoid.WGS84,
477
+ result,
478
+ );
479
+ }
480
+ }
515
481
 
516
482
  function makeModelOptions(tileset, tile, content, additionalOptions) {
517
483
  const mainOptions = {