@hztxi/cesium-engine 25.0.6 → 25.0.7

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 (136) hide show
  1. package/Build/Workers/chunk-2GJAWJJT.js +1344 -0
  2. package/Build/Workers/chunk-2J2VS5RI.js +288 -0
  3. package/Build/Workers/chunk-375SHKGW.js +44 -0
  4. package/Build/Workers/chunk-5FYUSABU.js +945 -0
  5. package/Build/Workers/chunk-5WU37CUJ.js +630 -0
  6. package/Build/Workers/chunk-6EBDN5WS.js +97 -0
  7. package/Build/Workers/chunk-75HIWCEV.js +301 -0
  8. package/Build/Workers/chunk-7AMVPXZY.js +1992 -0
  9. package/Build/Workers/chunk-7BMDD6SM.js +124 -0
  10. package/Build/Workers/chunk-7OME2OKM.js +171 -0
  11. package/Build/Workers/chunk-A2BROW3D.js +352 -0
  12. package/Build/Workers/chunk-B4XOVZGA.js +476 -0
  13. package/Build/Workers/chunk-CDLPLYLV.js +1287 -0
  14. package/Build/Workers/chunk-CEKCKPFN.js +368 -0
  15. package/Build/Workers/chunk-CHMDKP5L.js +2342 -0
  16. package/Build/Workers/chunk-CWGB3D4Z.js +257 -0
  17. package/Build/Workers/chunk-DQEUGBGA.js +2719 -0
  18. package/Build/Workers/chunk-DUBE5G2H.js +497 -0
  19. package/Build/Workers/chunk-E4PBNWWK.js +58 -0
  20. package/Build/Workers/chunk-E5MWOMVC.js +57 -0
  21. package/Build/Workers/chunk-EE3XBOQI.js +1483 -0
  22. package/Build/Workers/chunk-EHA2ZDPZ.js +415 -0
  23. package/Build/Workers/chunk-EKEKPAJF.js +454 -0
  24. package/Build/Workers/chunk-EOHKUXPX.js +198 -0
  25. package/Build/Workers/chunk-ERENMHG2.js +754 -0
  26. package/Build/Workers/chunk-ESQGFRLZ.js +163 -0
  27. package/Build/Workers/chunk-FV4OWDV4.js +9230 -0
  28. package/Build/Workers/chunk-FYRNNQSL.js +280 -0
  29. package/Build/Workers/chunk-JMF4ATAS.js +3794 -0
  30. package/Build/Workers/chunk-KEJKMITY.js +82 -0
  31. package/Build/Workers/chunk-KW2QZDUS.js +147 -0
  32. package/Build/Workers/chunk-L6B5XPBL.js +73 -0
  33. package/Build/Workers/chunk-LGJXN2VP.js +352 -0
  34. package/Build/Workers/chunk-LY2UG3HV.js +38 -0
  35. package/Build/Workers/chunk-NCPJBP24.js +140 -0
  36. package/Build/Workers/chunk-NFY5V6MR.js +102 -0
  37. package/Build/Workers/chunk-OYPSUED3.js +1067 -0
  38. package/Build/Workers/chunk-QIOOTLWN.js +56 -0
  39. package/Build/Workers/chunk-QUPRALOD.js +101 -0
  40. package/Build/Workers/chunk-RBEVHHXK.js +3201 -0
  41. package/Build/Workers/chunk-RHO5HV52.js +305 -0
  42. package/Build/Workers/chunk-SVCZUP5R.js +837 -0
  43. package/Build/Workers/chunk-TBHW5UME.js +973 -0
  44. package/Build/Workers/chunk-TPOX6IOR.js +1054 -0
  45. package/Build/Workers/chunk-ULNBTI6R.js +138 -0
  46. package/Build/Workers/chunk-UMUS2AQQ.js +398 -0
  47. package/Build/Workers/chunk-UZ7GTP2L.js +162 -0
  48. package/Build/Workers/chunk-W3C7OHXF.js +387 -0
  49. package/Build/Workers/chunk-WB5GWYDP.js +455 -0
  50. package/Build/Workers/chunk-WN6MAL25.js +682 -0
  51. package/Build/Workers/chunk-WTR7KMQA.js +693 -0
  52. package/Build/Workers/chunk-WTTFMU3P.js +241 -0
  53. package/Build/Workers/chunk-WULONJZC.js +1800 -0
  54. package/Build/Workers/chunk-WZPMAVTV.js +511 -0
  55. package/Build/Workers/chunk-Y7KVUJEB.js +219 -0
  56. package/Build/Workers/chunk-Z6JV4DZG.js +1046 -0
  57. package/Build/Workers/chunk-ZTK5EBUI.js +76 -0
  58. package/Build/Workers/chunk-ZZPDORJK.js +56 -0
  59. package/Build/Workers/combineGeometry.js +24 -24
  60. package/Build/Workers/createBoxGeometry.js +18 -18
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  62. package/Build/Workers/createCircleGeometry.js +26 -26
  63. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  66. package/Build/Workers/createCorridorGeometry.js +29 -29
  67. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  68. package/Build/Workers/createCylinderGeometry.js +20 -20
  69. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  70. package/Build/Workers/createEllipseGeometry.js +26 -26
  71. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  74. package/Build/Workers/createFrustumGeometry.js +18 -18
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  76. package/Build/Workers/createGeometry.js +24 -24
  77. package/Build/Workers/createGroundPolylineGeometry.js +95 -31
  78. package/Build/Workers/createPlaneGeometry.js +16 -16
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  80. package/Build/Workers/createPolygonGeometry.js +32 -32
  81. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  82. package/Build/Workers/createPolylineGeometry.js +25 -25
  83. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  85. package/Build/Workers/createRectangleGeometry.js +27 -27
  86. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  87. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  88. package/Build/Workers/createSphereGeometry.js +19 -19
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  92. package/Build/Workers/createVectorTileGeometries.js +24 -24
  93. package/Build/Workers/createVectorTilePoints.js +13 -13
  94. package/Build/Workers/createVectorTilePolygons.js +22 -22
  95. package/Build/Workers/createVectorTilePolylines.js +14 -14
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +26 -26
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
  98. package/Build/Workers/createVerticesFromHeightmap.js +23 -23
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
  100. package/Build/Workers/createWallGeometry.js +24 -24
  101. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +10 -10
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
  112. package/Source/Core/GroundPolylineGeometry.js +99 -4
  113. package/Source/Core/PolylinePipeline.js +9 -2
  114. package/Source/DataSources/PolylineGeometryUpdater.js +125 -7
  115. package/Source/Scene/Camera.js +56 -3
  116. package/Source/Scene/CameraFlightPath.js +14 -0
  117. package/Source/Scene/ColumbusWorlds.js +190 -0
  118. package/Source/Scene/FrameState.js +10 -0
  119. package/Source/Scene/Globe.js +89 -22
  120. package/Source/Scene/GlobeDepth.js +216 -5
  121. package/Source/Scene/GlobeSurfaceTileProvider.js +897 -678
  122. package/Source/Scene/GroundPolylinePrimitive.js +2 -1
  123. package/Source/Scene/Polyline.js +32 -5
  124. package/Source/Scene/PolylineCollection.js +37 -0
  125. package/Source/Scene/Primitive.js +12 -13
  126. package/Source/Scene/PrimitivePipeline.js +158 -28
  127. package/Source/Scene/Scene.js +428 -5
  128. package/Source/Scene/SceneTransforms.js +17 -0
  129. package/Source/Scene/ScreenSpaceCameraController.js +12 -3
  130. package/Source/Shaders/PolylineShadowVolumeFS.glsl +14 -0
  131. package/Source/Shaders/PolylineShadowVolumeFS.js +14 -0
  132. package/Source/Shaders/RestoreDepth.glsl +8 -0
  133. package/Source/Shaders/RestoreDepth.js +10 -0
  134. package/index.d.ts +535 -1393
  135. package/index.js +138 -136
  136. package/package.json +1 -1
@@ -8,7 +8,9 @@ import PixelDatatype from "../Renderer/PixelDatatype.js";
8
8
  import RenderState from "../Renderer/RenderState.js";
9
9
  import PassThrough from "../Shaders/PostProcessStages/PassThrough.js";
10
10
  import PassThroughDepth from "../Shaders/PostProcessStages/PassThroughDepth.js";
11
+ import RestoreDepth from "../Shaders/RestoreDepth.js";
11
12
  import BlendingState from "./BlendingState.js";
13
+ import DepthFunction from "./DepthFunction.js";
12
14
  import StencilConstants from "./StencilConstants.js";
13
15
  import StencilFunction from "./StencilFunction.js";
14
16
  import StencilOperation from "./StencilOperation.js";
@@ -33,6 +35,12 @@ function GlobeDepth() {
33
35
  supportsDepthTexture: true,
34
36
  });
35
37
  this._copyDepthFramebuffer = new FramebufferManager();
38
+ // Extra globe depth copies for frustum 1..n. Each frustum packs depth
39
+ // against its own near/far, so a single shared copy cannot be decoded
40
+ // correctly by the other frustums (e.g. a Columbus world copy pass).
41
+ this._copyDepthFramebuffers = [];
42
+ this._copyDepthCommands = [];
43
+ this._restoreDepthCommands = [];
36
44
  this._tempCopyDepthFramebuffer = new FramebufferManager();
37
45
  this._updateDepthFramebuffer = new FramebufferManager({
38
46
  createColorAttachments: false,
@@ -50,6 +58,7 @@ function GlobeDepth() {
50
58
  this._rs = undefined;
51
59
  this._rsBlend = undefined;
52
60
  this._rsUpdate = undefined;
61
+ this._rsRestoreDepth = undefined;
53
62
 
54
63
  this._useScissorTest = false;
55
64
  this._scissorRectangle = undefined;
@@ -149,6 +158,29 @@ function updateCopyCommands(globeDepth, context, width, height, passState) {
149
158
  mask: StencilConstants.CESIUM_3D_TILE_MASK,
150
159
  },
151
160
  });
161
+
162
+ // Writes a depth copy back into the depth buffer. Color writes are off and
163
+ // the quad's fragment depth comes from the sampled texture. The depth test
164
+ // must stay enabled (ALWAYS): a disabled depth test discards the write, so
165
+ // the quad would only paint color and never restore the buffer.
166
+ globeDepth._rsRestoreDepth = RenderState.fromCache({
167
+ viewport: viewport,
168
+ scissorTest: {
169
+ enabled: globeDepth._useScissorTest,
170
+ rectangle: globeDepth._scissorRectangle,
171
+ },
172
+ colorMask: {
173
+ red: false,
174
+ green: false,
175
+ blue: false,
176
+ alpha: false,
177
+ },
178
+ depthTest: {
179
+ enabled: true,
180
+ func: DepthFunction.ALWAYS,
181
+ },
182
+ depthMask: true,
183
+ });
152
184
  }
153
185
 
154
186
  if (!defined(globeDepth._copyDepthCommand)) {
@@ -272,6 +304,12 @@ GlobeDepth.prototype.update = function (
272
304
  );
273
305
  }
274
306
  this._copyDepthFramebuffer.update(context, width, height);
307
+ for (let i = 0; i < this._copyDepthFramebuffers.length; i++) {
308
+ const framebuffer = this._copyDepthFramebuffers[i];
309
+ if (defined(framebuffer)) {
310
+ framebuffer.update(context, width, height);
311
+ }
312
+ }
275
313
  updateCopyCommands(this, context, width, height, passState);
276
314
  context.uniformState.globeDepthTexture = undefined;
277
315
 
@@ -292,13 +330,165 @@ GlobeDepth.prototype.prepareColorTextures = function (context, blitStencil) {
292
330
  }
293
331
  };
294
332
 
295
- GlobeDepth.prototype.executeCopyDepth = function (context, passState) {
296
- if (defined(this._copyDepthCommand)) {
333
+ /**
334
+ * Returns the copy depth framebuffer for a frustum, creating it on demand.
335
+ *
336
+ * @param {Context} context The context used for rendering.
337
+ * @param {number} frustumIndex The index of the frustum.
338
+ * @returns {FramebufferManager|undefined} The framebuffer manager, or
339
+ * <code>undefined</code> for frustum 0 (the shared copy).
340
+ *
341
+ * @private
342
+ */
343
+ GlobeDepth.prototype._getFrustumCopyDepthFramebuffer = function (
344
+ context,
345
+ frustumIndex,
346
+ ) {
347
+ if (frustumIndex === 0) {
348
+ return this._copyDepthFramebuffer;
349
+ }
350
+ let framebuffer = this._copyDepthFramebuffers[frustumIndex];
351
+ if (!defined(framebuffer)) {
352
+ framebuffer = this._copyDepthFramebuffers[frustumIndex] =
353
+ new FramebufferManager();
354
+ const mainColorTexture = this._copyDepthFramebuffer.getColorTexture();
355
+ if (defined(mainColorTexture)) {
356
+ framebuffer.update(
357
+ context,
358
+ mainColorTexture.width,
359
+ mainColorTexture.height,
360
+ );
361
+ }
362
+ }
363
+ return framebuffer;
364
+ };
365
+
366
+ /**
367
+ * Returns the copy depth command for a frustum, creating it on demand.
368
+ *
369
+ * @param {Context} context The context used for rendering.
370
+ * @param {number} frustumIndex The index of the frustum.
371
+ * @returns {ViewportQuadCommand|undefined} The command, or <code>undefined</code>.
372
+ *
373
+ * @private
374
+ */
375
+ GlobeDepth.prototype._getFrustumCopyDepthCommand = function (
376
+ context,
377
+ frustumIndex,
378
+ ) {
379
+ if (frustumIndex === 0) {
380
+ return this._copyDepthCommand;
381
+ }
382
+ let command = this._copyDepthCommands[frustumIndex];
383
+ if (!defined(command)) {
384
+ const globeDepth = this;
385
+ command = this._copyDepthCommands[frustumIndex] =
386
+ context.createViewportQuadCommand(PassThroughDepth, {
387
+ uniformMap: {
388
+ u_depthTexture: function () {
389
+ return globeDepth.colorFramebufferManager.getDepthStencilTexture();
390
+ },
391
+ },
392
+ owner: globeDepth,
393
+ });
394
+ }
395
+ command.renderState = this._rs;
396
+ command.framebuffer = this._getFrustumCopyDepthFramebuffer(
397
+ context,
398
+ frustumIndex,
399
+ ).framebuffer;
400
+ return command;
401
+ };
402
+
403
+ /**
404
+ * Copy the current globe depth into the copy depth texture of a frustum and
405
+ * make it the active <code>czm_globeDepthTexture</code>.
406
+ *
407
+ * @param {Context} context The context used for rendering.
408
+ * @param {PassState} passState Render state for subsequent rendering passes.
409
+ * @param {number} [frustumIndex=0] The index of the frustum being rendered.
410
+ *
411
+ * @private
412
+ */
413
+ GlobeDepth.prototype.executeCopyDepth = function (
414
+ context,
415
+ passState,
416
+ frustumIndex,
417
+ ) {
418
+ const index = defined(frustumIndex) ? frustumIndex : 0;
419
+ const framebuffer = this._getFrustumCopyDepthFramebuffer(context, index);
420
+ const command = this._getFrustumCopyDepthCommand(context, index);
421
+ if (defined(command)) {
297
422
  this.prepareColorTextures(context);
298
- this._copyDepthCommand.execute(context, passState);
299
- context.uniformState.globeDepthTexture =
300
- this._copyDepthFramebuffer.getColorTexture();
423
+ command.execute(context, passState);
424
+ context.uniformState.globeDepthTexture = framebuffer.getColorTexture();
425
+ }
426
+ };
427
+
428
+ /**
429
+ * Make an already copied globe depth texture the active
430
+ * <code>czm_globeDepthTexture</code>. Used by the Columbus world copy pass,
431
+ * which re-executes the classification commands of a primary frustum and must
432
+ * therefore read the depth copy produced for that same frustum.
433
+ *
434
+ * @param {Context} context The context used for rendering.
435
+ * @param {number} [frustumIndex=0] The index of the frustum.
436
+ *
437
+ * @private
438
+ */
439
+ GlobeDepth.prototype.useCopyDepth = function (context, frustumIndex) {
440
+ const index = defined(frustumIndex) ? frustumIndex : 0;
441
+ let framebuffer = index > 0 ? this._copyDepthFramebuffers[index] : undefined;
442
+ if (!defined(framebuffer) || !defined(framebuffer.framebuffer)) {
443
+ // The requested frustum never produced a copy (e.g. the primary pass was
444
+ // skipped this frame); keep the shared copy so the uniform stays defined.
445
+ framebuffer = this._copyDepthFramebuffer;
446
+ }
447
+ context.uniformState.globeDepthTexture = framebuffer.getColorTexture();
448
+ };
449
+
450
+ /**
451
+ * Writes an already copied globe depth back into the depth buffer, so terrain
452
+ * classification can be re-executed after the primary pass finished. Ground
453
+ * classification needs the terrain depth in the buffer (its stencil pass depth
454
+ * tests the shadow volume against it), but the scene clears the globe depth
455
+ * after the primary classification pass whenever
456
+ * {@link Globe#depthTestAgainstTerrain} is off - the walkthrough used by the
457
+ * Columbus world copy pass then classifies against an empty buffer and draws
458
+ * nothing.
459
+ *
460
+ * @param {Context} context The context used for rendering.
461
+ * @param {PassState} passState The render pass state, whose framebuffer must be the one that receives the depth.
462
+ * @param {number} [frustumIndex=0] The index of the frustum whose copy should be restored.
463
+ *
464
+ * @private
465
+ */
466
+ GlobeDepth.prototype.executeRestoreDepth = function (
467
+ context,
468
+ passState,
469
+ frustumIndex,
470
+ ) {
471
+ const index = defined(frustumIndex) ? frustumIndex : 0;
472
+ const framebuffer = this._getFrustumCopyDepthFramebuffer(context, index);
473
+ const renderState = this._rsRestoreDepth;
474
+ if (!defined(framebuffer.getColorTexture()) || !defined(renderState)) {
475
+ return;
476
+ }
477
+
478
+ let command = this._restoreDepthCommands[index];
479
+ if (!defined(command)) {
480
+ command = this._restoreDepthCommands[index] =
481
+ context.createViewportQuadCommand(RestoreDepth, {
482
+ uniformMap: {
483
+ u_depthTexture: function () {
484
+ return framebuffer.getColorTexture();
485
+ },
486
+ },
487
+ owner: this,
488
+ });
301
489
  }
490
+ command.renderState = renderState;
491
+ command.execute(context, passState);
302
492
  };
303
493
 
304
494
  /**
@@ -379,6 +569,27 @@ GlobeDepth.prototype.destroy = function () {
379
569
  this._pickColorFramebuffer.destroy();
380
570
  this._outputFramebuffer.destroy();
381
571
  this._copyDepthFramebuffer.destroy();
572
+ for (let i = 0; i < this._copyDepthFramebuffers.length; i++) {
573
+ const framebuffer = this._copyDepthFramebuffers[i];
574
+ if (defined(framebuffer)) {
575
+ framebuffer.destroy();
576
+ }
577
+ }
578
+ this._copyDepthFramebuffers.length = 0;
579
+ for (let i = 0; i < this._copyDepthCommands.length; i++) {
580
+ const command = this._copyDepthCommands[i];
581
+ if (defined(command) && defined(command.shaderProgram)) {
582
+ command.shaderProgram = command.shaderProgram.destroy();
583
+ }
584
+ }
585
+ this._copyDepthCommands.length = 0;
586
+ for (let i = 0; i < this._restoreDepthCommands.length; i++) {
587
+ const command = this._restoreDepthCommands[i];
588
+ if (defined(command) && defined(command.shaderProgram)) {
589
+ command.shaderProgram = command.shaderProgram.destroy();
590
+ }
591
+ }
592
+ this._restoreDepthCommands.length = 0;
382
593
  this._tempCopyDepthFramebuffer.destroy();
383
594
  this._updateDepthFramebuffer.destroy();
384
595