@cesium/engine 25.0.0 → 26.1.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 (225) hide show
  1. package/Build/Workers/{chunk-3VDDRF2E.js → chunk-2EFYUSUY.js} +14 -14
  2. package/Build/Workers/{chunk-4GF4MVPY.js → chunk-5LSOO2KD.js} +7 -7
  3. package/Build/Workers/{chunk-I3A6DXYZ.js → chunk-6HK6IXK2.js} +4 -4
  4. package/Build/Workers/{chunk-CZ23Y3RM.js → chunk-6YR6JBMY.js} +2 -2
  5. package/Build/Workers/{chunk-J7KQEKPK.js → chunk-76FDC45O.js} +13 -13
  6. package/Build/Workers/{chunk-ZCCIIBZT.js → chunk-7D2HZKH7.js} +6 -6
  7. package/Build/Workers/{chunk-HSVQATK2.js → chunk-7KVKHY7O.js} +6 -6
  8. package/Build/Workers/{chunk-ITD2IN7N.js → chunk-A3O6EDBK.js} +2 -2
  9. package/Build/Workers/{chunk-ND3NTTOF.js → chunk-A6X24AZI.js} +6 -6
  10. package/Build/Workers/{chunk-DH26SNAB.js → chunk-AHWAZRBV.js} +6 -2
  11. package/Build/Workers/{chunk-3XY3MVPG.js → chunk-B4CQSLZJ.js} +4 -4
  12. package/Build/Workers/{chunk-DYT5NR6P.js → chunk-C7JQVRLM.js} +3 -3
  13. package/Build/Workers/{chunk-WC57YYBN.js → chunk-CDJDJ5LK.js} +2 -2
  14. package/Build/Workers/{chunk-VQKLRBIK.js → chunk-CEEZE3YZ.js} +7 -7
  15. package/Build/Workers/{chunk-4QQXGTCE.js → chunk-CLCTQVVL.js} +8 -8
  16. package/Build/Workers/{chunk-WNN5D4W3.js → chunk-DBD5WWG2.js} +10 -10
  17. package/Build/Workers/{chunk-URUCCIPS.js → chunk-DIGUUD6G.js} +6 -6
  18. package/Build/Workers/{chunk-BTX2NL3P.js → chunk-E7NZJOK7.js} +196 -22
  19. package/Build/Workers/{chunk-3LSD7OOA.js → chunk-EHTS2YPT.js} +16 -16
  20. package/Build/Workers/{chunk-35H3UBIO.js → chunk-ENNFMWDW.js} +11 -11
  21. package/Build/Workers/{chunk-GL7DNVUS.js → chunk-FCP2QY4G.js} +5 -5
  22. package/Build/Workers/{chunk-3RFFPH4M.js → chunk-FDK4K5IA.js} +1 -1
  23. package/Build/Workers/{chunk-WTQGE7Q6.js → chunk-FGQFQHN5.js} +17 -17
  24. package/Build/Workers/{chunk-WUBKZFF6.js → chunk-GSWMAFTE.js} +9 -9
  25. package/Build/Workers/{chunk-3TKLDHV3.js → chunk-GXWQZBAI.js} +2 -2
  26. package/Build/Workers/{chunk-A7A433MD.js → chunk-HHV3MCGV.js} +5 -5
  27. package/Build/Workers/{chunk-A7ZBMVFS.js → chunk-HS6AD4P2.js} +14 -14
  28. package/Build/Workers/{chunk-QXNQQYPV.js → chunk-IGAZBTFZ.js} +8 -8
  29. package/Build/Workers/{chunk-ZAPOS52G.js → chunk-ILME5BXA.js} +8 -8
  30. package/Build/Workers/{chunk-4MTRQFJP.js → chunk-JKXV6PG5.js} +1 -1
  31. package/Build/Workers/{chunk-FVLVVOBQ.js → chunk-JW6OZT4R.js} +10 -10
  32. package/Build/Workers/{chunk-EZARA5FJ.js → chunk-KGXSYGBG.js} +13 -13
  33. package/Build/Workers/{chunk-J3OFS2RD.js → chunk-LD64RPYV.js} +12 -12
  34. package/Build/Workers/{chunk-AWFZHD2B.js → chunk-LGNDTZVX.js} +4 -4
  35. package/Build/Workers/{chunk-AEAVLYPS.js → chunk-LNSQVXFH.js} +2 -2
  36. package/Build/Workers/{chunk-TA777BGS.js → chunk-N7CCOFLX.js} +1 -1
  37. package/Build/Workers/{chunk-7LSFAEWF.js → chunk-NIWITKQK.js} +10 -10
  38. package/Build/Workers/{chunk-4XXHJI6Y.js → chunk-OBEU25PI.js} +17 -17
  39. package/Build/Workers/{chunk-5T6QQAJW.js → chunk-QVLAFFJY.js} +1 -1
  40. package/Build/Workers/{chunk-J647NNZW.js → chunk-R4FPNAZ2.js} +6 -6
  41. package/Build/Workers/{chunk-HVMG6AG4.js → chunk-RG4F5R57.js} +9 -9
  42. package/Build/Workers/{chunk-ST2UWDUU.js → chunk-SF6K72D7.js} +5 -5
  43. package/Build/Workers/{chunk-H2A4USJR.js → chunk-SGRGNDOD.js} +10 -10
  44. package/Build/Workers/{chunk-DFEI5MAV.js → chunk-SM2CDCYF.js} +7 -7
  45. package/Build/Workers/{chunk-TAI4HLII.js → chunk-SS5ABQGY.js} +4 -4
  46. package/Build/Workers/{chunk-ACFFCHHZ.js → chunk-T5QBPLE3.js} +11 -11
  47. package/Build/Workers/{chunk-BVAIWR7O.js → chunk-TVZD72WJ.js} +12 -12
  48. package/Build/Workers/{chunk-6SDGQI27.js → chunk-UEY73NRN.js} +1 -1
  49. package/Build/Workers/{chunk-K6NFIRFB.js → chunk-UVO6COT2.js} +5 -5
  50. package/Build/Workers/{chunk-77RL3MBD.js → chunk-VAL7DYNR.js} +25 -4
  51. package/Build/Workers/{chunk-WN6P5UDH.js → chunk-WBSY7HDY.js} +12 -12
  52. package/Build/Workers/{chunk-FIBS5S7R.js → chunk-XDWCTQCZ.js} +2 -2
  53. package/Build/Workers/{chunk-CKQP3DSS.js → chunk-XLXSDIP5.js} +6 -6
  54. package/Build/Workers/{chunk-LH5SF3XV.js → chunk-XQ3SKCMM.js} +5 -5
  55. package/Build/Workers/{chunk-QSDY4NS7.js → chunk-YKU2Q3A2.js} +9 -9
  56. package/Build/Workers/{chunk-GPIGURCG.js → chunk-ZMBHFYOX.js} +7 -7
  57. package/Build/Workers/{chunk-QO2CGXMP.js → chunk-ZSGUV73H.js} +6 -6
  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 +987 -2320
  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/BoundingRectangle.js +6 -8
  112. package/Source/Core/Cartesian2.js +1 -1
  113. package/Source/Core/Cartesian3.js +1 -1
  114. package/Source/Core/Cartesian4.js +1 -1
  115. package/Source/Core/Color.js +1 -0
  116. package/Source/Core/ComponentDatatype.js +35 -0
  117. package/Source/Core/InterpolationAlgorithm.js +57 -50
  118. package/Source/Core/Ion.js +1 -1
  119. package/Source/Core/MapProjection.js +1 -0
  120. package/Source/Core/Matrix2.js +1 -1
  121. package/Source/Core/Matrix3.js +1 -1
  122. package/Source/Core/Matrix4.js +1 -1
  123. package/Source/Core/Resource.js +1 -1
  124. package/Source/Core/ScreenSpaceEventHandler.js +51 -41
  125. package/Source/Core/TerrainMesh.js +3 -3
  126. package/Source/Core/TerrainPicker.js +1 -0
  127. package/Source/Core/createColorRamp.js +37 -0
  128. package/Source/Core/globalTypes.js +25 -0
  129. package/Source/Core/writeTextToCanvas.js +1 -0
  130. package/Source/DataSources/CzmlDataSource.js +12 -0
  131. package/Source/DataSources/KmlDataSource.js +528 -555
  132. package/Source/DataSources/PathGraphics.js +8 -1
  133. package/Source/DataSources/PathMode.js +27 -0
  134. package/Source/DataSources/PathVisualizer.js +298 -1
  135. package/Source/Renderer/Pass.js +3 -2
  136. package/Source/Renderer/Texture.js +1 -1
  137. package/Source/Renderer/VertexArray.js +1 -0
  138. package/Source/Renderer/createUniform.js +346 -239
  139. package/Source/Renderer/createUniformArray.js +494 -381
  140. package/Source/Scene/ArcGisMapService.js +1 -1
  141. package/Source/Scene/BillboardTexture.js +5 -3
  142. package/Source/Scene/BufferPoint.js +1 -0
  143. package/Source/Scene/BufferPointCollection.js +14 -1
  144. package/Source/Scene/BufferPolygon.js +3 -2
  145. package/Source/Scene/BufferPolygonCollection.js +10 -0
  146. package/Source/Scene/BufferPolyline.js +1 -0
  147. package/Source/Scene/BufferPolylineCollection.js +2 -0
  148. package/Source/Scene/BufferPrimitiveCollection.js +79 -28
  149. package/Source/Scene/CameraEventAggregator.js +30 -18
  150. package/Source/Scene/Cesium3DTile.js +54 -1
  151. package/Source/Scene/Cesium3DTileContent.js +195 -254
  152. package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
  153. package/Source/Scene/Cesium3DTileOptimizations.js +4 -6
  154. package/Source/Scene/Cesium3DTileset.js +45 -5
  155. package/Source/Scene/ClippingPlaneCollection.js +2 -2
  156. package/Source/Scene/ClippingPolygon.js +2 -0
  157. package/Source/Scene/ClippingPolygonCollection.js +2 -2
  158. package/Source/Scene/Composite3DTileContent.js +254 -292
  159. package/Source/Scene/DerivedCommand.js +4 -0
  160. package/Source/Scene/EdgeDisplayMode.js +50 -0
  161. package/Source/Scene/Empty3DTileContent.js +100 -132
  162. package/Source/Scene/Expression.js +6 -8
  163. package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
  164. package/Source/Scene/GeoJsonPrimitive.js +874 -0
  165. package/Source/Scene/Geometry3DTileContent.js +151 -185
  166. package/Source/Scene/GlobeSurfaceShaderSet.js +501 -409
  167. package/Source/Scene/GlobeSurfaceTile.js +540 -401
  168. package/Source/Scene/GlobeSurfaceTileProvider.js +1259 -1146
  169. package/Source/Scene/GltfBufferViewLoader.js +3 -3
  170. package/Source/Scene/GltfLoader.js +110 -0
  171. package/Source/Scene/GltfLoaderUtil.js +20 -4
  172. package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +10 -0
  173. package/Source/Scene/GltfPipeline/removeUnusedElements.js +21 -11
  174. package/Source/Scene/ImageryLayer.js +2 -2
  175. package/Source/Scene/ImageryLayerCollection.js +2 -2
  176. package/Source/Scene/Implicit3DTileContent.js +179 -214
  177. package/Source/Scene/MVTDataProvider.js +147 -0
  178. package/Source/Scene/Material.js +1 -0
  179. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +79 -311
  180. package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +4 -0
  181. package/Source/Scene/Model/Model.js +37 -0
  182. package/Source/Scene/Model/Model3DTileContent.js +424 -458
  183. package/Source/Scene/Model/ModelDrawCommand.js +31 -3
  184. package/Source/Scene/Model/ModelUtility.js +5 -0
  185. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +466 -150
  186. package/Source/Scene/ModelComponents.js +39 -1
  187. package/Source/Scene/Multiple3DTileContent.js +291 -334
  188. package/Source/Scene/Picking.js +5 -0
  189. package/Source/Scene/PntsParser.js +1 -0
  190. package/Source/Scene/QuadtreePrimitive.js +3 -2
  191. package/Source/Scene/ResourceCacheKey.js +5 -5
  192. package/Source/Scene/Scene.js +27 -0
  193. package/Source/Scene/Tileset3DTileContent.js +113 -146
  194. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
  195. package/Source/Scene/Vector3DTileContent.js +205 -234
  196. package/Source/Scene/VectorGltf3DTileContent.js +85 -36
  197. package/Source/Scene/VoxelPrimitive.js +159 -175
  198. package/Source/Scene/VoxelProvider.js +64 -91
  199. package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
  200. package/Source/Scene/buildVoxelCustomShader.js +199 -0
  201. package/Source/Scene/decodeMVT.js +634 -0
  202. package/Source/Scene/findMeshoptExtension.js +23 -0
  203. package/Source/Scene/renderBufferPointCollection.js +113 -62
  204. package/Source/Scene/renderBufferPolygonCollection.js +98 -55
  205. package/Source/Scene/renderBufferPolylineCollection.js +270 -143
  206. package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
  207. package/Source/Shaders/BufferPointMaterialFS.js +1 -0
  208. package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
  209. package/Source/Shaders/BufferPointMaterialVS.js +20 -10
  210. package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
  211. package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
  212. package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
  213. package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
  214. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
  215. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
  216. package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
  217. package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
  218. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
  219. package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
  220. package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
  221. package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
  222. package/Source/Workers/incrementallyBuildTerrainPicker.js +2 -0
  223. package/index.d.ts +311 -288
  224. package/index.js +103 -92
  225. package/package.json +4 -4
@@ -20,6 +20,7 @@ import BufferPointMaterialFS from "../Shaders/BufferPointMaterialFS.js";
20
20
  import EncodedCartesian3 from "../Core/EncodedCartesian3.js";
21
21
  import AttributeCompression from "../Core/AttributeCompression.js";
22
22
  import BufferPointMaterial from "./BufferPointMaterial.js";
23
+ import BlendOption from "./BlendOption.js";
23
24
 
24
25
  /** @import FrameState from "./FrameState.js"; */
25
26
  /** @import BufferPointCollection from "./BufferPointCollection.js"; */
@@ -27,26 +28,39 @@ import BufferPointMaterial from "./BufferPointMaterial.js";
27
28
 
28
29
  /**
29
30
  * TODO(PR#13211): Need 'keyof' syntax to avoid duplicating attribute names.
30
- * @typedef {'positionHigh' | 'positionLow' | 'pickColor' | 'showSizeAndColor' | 'outlineWidthAndOutlineColor'} BufferPointAttribute
31
+ * @typedef {'positionHigh' | 'positionLow' | 'pickColor' | 'showSizeColorAlpha' | 'outlineWidthColorAlpha'} BufferPointAttribute
31
32
  * @ignore
32
33
  */
33
34
 
34
35
  /**
36
+ * Attribute locations when using 64-bit position precision.
35
37
  * @type {Record<BufferPointAttribute, number>}
36
38
  * @ignore
37
39
  */
38
- const BufferPointAttributeLocations = {
40
+ const BufferPointAttributeLocationsFloat64 = {
39
41
  positionHigh: 0,
40
42
  positionLow: 1,
41
43
  pickColor: 2,
42
- showSizeAndColor: 3,
43
- outlineWidthAndOutlineColor: 4,
44
+ showSizeColorAlpha: 3,
45
+ outlineWidthColorAlpha: 4,
46
+ };
47
+
48
+ /**
49
+ * Attribute locations when using <= 32-bit position precision.
50
+ * @type {Record<string, number>}
51
+ * @ignore
52
+ */
53
+ const BufferPointAttributeLocations = {
54
+ position: 0,
55
+ pickColor: 1,
56
+ showSizeColorAlpha: 2,
57
+ outlineWidthColorAlpha: 3,
44
58
  };
45
59
 
46
60
  /**
47
61
  * @typedef {object} BufferPointRenderContext
48
62
  * @property {VertexArray} [vertexArray]
49
- * @property {Record<BufferPointAttribute, TypedArray>} [attributeArrays]
63
+ * @property {Record<string, TypedArray>} [attributeArrays]
50
64
  * @property {RenderState} [renderState]
51
65
  * @property {ShaderProgram} [shaderProgram]
52
66
  * @property {DrawCommand} [command]
@@ -71,16 +85,24 @@ const encodedCartesian = new EncodedCartesian3();
71
85
  function renderBufferPointCollection(collection, frameState, renderContext) {
72
86
  const context = frameState.context;
73
87
  renderContext = renderContext || { destroy: destroyRenderContext };
88
+ const useFloat64 = collection._positionDatatype === ComponentDatatype.DOUBLE;
89
+ const attributeLocations = useFloat64
90
+ ? BufferPointAttributeLocationsFloat64
91
+ : BufferPointAttributeLocations;
74
92
 
75
93
  if (!defined(renderContext.attributeArrays)) {
76
94
  const featureCountMax = collection.primitiveCountMax;
77
95
 
78
96
  renderContext.attributeArrays = {
79
- positionHigh: new Float32Array(featureCountMax * 3),
80
- positionLow: new Float32Array(featureCountMax * 3),
97
+ ...(useFloat64
98
+ ? {
99
+ positionHigh: new Float32Array(featureCountMax * 3),
100
+ positionLow: new Float32Array(featureCountMax * 3),
101
+ }
102
+ : { position: collection._positionView }),
81
103
  pickColor: new Uint8Array(featureCountMax * 4),
82
- showSizeAndColor: new Float32Array(featureCountMax * 3),
83
- outlineWidthAndOutlineColor: new Float32Array(featureCountMax * 2),
104
+ showSizeColorAlpha: new Float32Array(featureCountMax * 4),
105
+ outlineWidthColorAlpha: new Float32Array(featureCountMax * 3),
84
106
  };
85
107
  }
86
108
 
@@ -90,9 +112,8 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
90
112
  const positionHighArray = attributeArrays.positionHigh;
91
113
  const positionLowArray = attributeArrays.positionLow;
92
114
  const pickColorArray = attributeArrays.pickColor;
93
- const showSizeAndColorArray = attributeArrays.showSizeAndColor;
94
- const outlineWidthAndOutlineColorArray =
95
- attributeArrays.outlineWidthAndOutlineColor;
115
+ const showSizeColorAlphaArray = attributeArrays.showSizeColorAlpha;
116
+ const outlineWidthColorAlphaArray = attributeArrays.outlineWidthColorAlpha;
96
117
 
97
118
  const { _dirtyOffset, _dirtyCount } = collection;
98
119
 
@@ -103,33 +124,40 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
103
124
  continue;
104
125
  }
105
126
 
106
- point.getPosition(cartesian);
107
- EncodedCartesian3.fromCartesian(cartesian, encodedCartesian);
127
+ if (useFloat64) {
128
+ point.getPosition(cartesian);
129
+ EncodedCartesian3.fromCartesian(cartesian, encodedCartesian);
130
+ // @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
131
+ Cartesian3.pack(encodedCartesian.high, positionHighArray, i * 3);
132
+ // @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
133
+ Cartesian3.pack(encodedCartesian.low, positionLowArray, i * 3);
134
+ }
135
+
108
136
  point.getMaterial(material);
109
137
  Color.fromRgba(point._pickId, pickColor);
110
138
 
111
- positionHighArray[i * 3] = encodedCartesian.high.x;
112
- positionHighArray[i * 3 + 1] = encodedCartesian.high.y;
113
- positionHighArray[i * 3 + 2] = encodedCartesian.high.z;
114
-
115
- positionLowArray[i * 3] = encodedCartesian.low.x;
116
- positionLowArray[i * 3 + 1] = encodedCartesian.low.y;
117
- positionLowArray[i * 3 + 2] = encodedCartesian.low.z;
118
-
119
139
  pickColorArray[i * 4] = Color.floatToByte(pickColor.red);
120
140
  pickColorArray[i * 4 + 1] = Color.floatToByte(pickColor.green);
121
141
  pickColorArray[i * 4 + 2] = Color.floatToByte(pickColor.blue);
122
142
  pickColorArray[i * 4 + 3] = Color.floatToByte(pickColor.alpha);
123
143
 
124
- showSizeAndColorArray[i * 3] = point.show ? 1 : 0;
125
- showSizeAndColorArray[i * 3 + 1] = material.size;
126
- showSizeAndColorArray[i * 3 + 2] = AttributeCompression.encodeRGB8(
144
+ showSizeColorAlphaArray[i * 4] = point.show ? 1 : 0;
145
+ showSizeColorAlphaArray[i * 4 + 1] = material.size;
146
+ showSizeColorAlphaArray[i * 4 + 2] = AttributeCompression.encodeRGB8(
127
147
  material.color,
128
148
  );
149
+ showSizeColorAlphaArray[i * 4 + 3] = material.color.alpha;
129
150
 
130
- outlineWidthAndOutlineColorArray[i * 2] = material.outlineWidth;
131
- outlineWidthAndOutlineColorArray[i * 2 + 1] =
132
- AttributeCompression.encodeRGB8(material.outlineColor);
151
+ outlineWidthColorAlphaArray[i * 3] = material.outlineWidth;
152
+ outlineWidthColorAlphaArray[i * 3 + 1] = AttributeCompression.encodeRGB8(
153
+ // When outlineWidth=0, overwrite outlineColor to prevent subpixel bleeding.
154
+ material.outlineWidth > 0 ? material.outlineColor : material.color,
155
+ );
156
+ outlineWidthColorAlphaArray[i * 3 + 2] =
157
+ // When outlineWidth=0, overwrite outlineAlpha to prevent subpixel bleeding.
158
+ material.outlineWidth > 0
159
+ ? material.outlineColor.alpha
160
+ : material.color.alpha;
133
161
 
134
162
  point._dirty = false;
135
163
  }
@@ -141,28 +169,44 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
141
169
  renderContext.vertexArray = new VertexArray({
142
170
  context,
143
171
  attributes: [
172
+ ...(!useFloat64
173
+ ? [
174
+ {
175
+ index: BufferPointAttributeLocations.position,
176
+ componentDatatype: collection._positionDatatype,
177
+ componentsPerAttribute: 3,
178
+ normalize: collection._positionNormalized,
179
+ vertexBuffer: Buffer.createVertexBuffer({
180
+ typedArray: collection._positionView,
181
+ context,
182
+ usage: BufferUsage.STATIC_DRAW,
183
+ }),
184
+ },
185
+ ]
186
+ : [
187
+ {
188
+ index: BufferPointAttributeLocationsFloat64.positionHigh,
189
+ componentDatatype: ComponentDatatype.FLOAT,
190
+ componentsPerAttribute: 3,
191
+ vertexBuffer: Buffer.createVertexBuffer({
192
+ typedArray: attributeArrays.positionHigh,
193
+ context,
194
+ usage: BufferUsage.STATIC_DRAW,
195
+ }),
196
+ },
197
+ {
198
+ index: BufferPointAttributeLocationsFloat64.positionLow,
199
+ componentDatatype: ComponentDatatype.FLOAT,
200
+ componentsPerAttribute: 3,
201
+ vertexBuffer: Buffer.createVertexBuffer({
202
+ typedArray: attributeArrays.positionLow,
203
+ context,
204
+ usage: BufferUsage.STATIC_DRAW,
205
+ }),
206
+ },
207
+ ]),
144
208
  {
145
- index: BufferPointAttributeLocations.positionHigh,
146
- componentDatatype: ComponentDatatype.FLOAT,
147
- componentsPerAttribute: 3,
148
- vertexBuffer: Buffer.createVertexBuffer({
149
- typedArray: attributeArrays.positionHigh,
150
- context,
151
- usage: BufferUsage.STATIC_DRAW,
152
- }),
153
- },
154
- {
155
- index: BufferPointAttributeLocations.positionLow,
156
- componentDatatype: ComponentDatatype.FLOAT,
157
- componentsPerAttribute: 3,
158
- vertexBuffer: Buffer.createVertexBuffer({
159
- typedArray: attributeArrays.positionLow,
160
- context,
161
- usage: BufferUsage.STATIC_DRAW,
162
- }),
163
- },
164
- {
165
- index: BufferPointAttributeLocations.pickColor,
209
+ index: attributeLocations.pickColor,
166
210
  componentDatatype: ComponentDatatype.UNSIGNED_BYTE,
167
211
  componentsPerAttribute: 4,
168
212
  vertexBuffer: Buffer.createVertexBuffer({
@@ -172,21 +216,21 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
172
216
  }),
173
217
  },
174
218
  {
175
- index: BufferPointAttributeLocations.showSizeAndColor,
219
+ index: attributeLocations.showSizeColorAlpha,
176
220
  componentDatatype: ComponentDatatype.FLOAT,
177
- componentsPerAttribute: 3,
221
+ componentsPerAttribute: 4,
178
222
  vertexBuffer: Buffer.createVertexBuffer({
179
- typedArray: attributeArrays.showSizeAndColor,
223
+ typedArray: attributeArrays.showSizeColorAlpha,
180
224
  context,
181
225
  usage: BufferUsage.STATIC_DRAW,
182
226
  }),
183
227
  },
184
228
  {
185
- index: BufferPointAttributeLocations.outlineWidthAndOutlineColor,
229
+ index: attributeLocations.outlineWidthColorAlpha,
186
230
  componentDatatype: ComponentDatatype.FLOAT,
187
- componentsPerAttribute: 2,
231
+ componentsPerAttribute: 3,
188
232
  vertexBuffer: Buffer.createVertexBuffer({
189
- typedArray: attributeArrays.outlineWidthAndOutlineColor,
233
+ typedArray: attributeArrays.outlineWidthColorAlpha,
190
234
  context,
191
235
  usage: BufferUsage.STATIC_DRAW,
192
236
  }),
@@ -194,11 +238,11 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
194
238
  ],
195
239
  });
196
240
  } else if (collection._dirtyCount > 0) {
197
- for (const key in BufferPointAttributeLocations) {
198
- if (Object.hasOwn(BufferPointAttributeLocations, key)) {
241
+ for (const key in attributeLocations) {
242
+ if (Object.hasOwn(attributeLocations, key)) {
199
243
  const attribute = /** @type {BufferPointAttribute} */ (key);
200
244
  renderContext.vertexArray.copyAttributeFromRange(
201
- BufferPointAttributeLocations[attribute],
245
+ attributeLocations[attribute],
202
246
  renderContext.attributeArrays[attribute],
203
247
  collection._dirtyOffset,
204
248
  collection._dirtyCount,
@@ -209,7 +253,10 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
209
253
 
210
254
  if (!defined(renderContext.renderState)) {
211
255
  renderContext.renderState = RenderState.fromCache({
212
- blending: BlendingState.ALPHA_BLEND,
256
+ blending:
257
+ collection._blendOption === BlendOption.OPAQUE
258
+ ? BlendingState.DISABLED
259
+ : BlendingState.ALPHA_BLEND,
213
260
  depthTest: { enabled: true },
214
261
  });
215
262
  }
@@ -219,11 +266,12 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
219
266
  context,
220
267
  vertexShaderSource: new ShaderSource({
221
268
  sources: [BufferPointMaterialVS],
269
+ defines: useFloat64 ? ["USE_FLOAT64"] : [],
222
270
  }),
223
271
  fragmentShaderSource: new ShaderSource({
224
272
  sources: [BufferPointMaterialFS],
225
273
  }),
226
- attributeLocations: BufferPointAttributeLocations,
274
+ attributeLocations,
227
275
  });
228
276
  }
229
277
 
@@ -233,12 +281,15 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
233
281
  renderState: renderContext.renderState,
234
282
  shaderProgram: renderContext.shaderProgram,
235
283
  primitiveType: PrimitiveType.POINTS,
236
- pass: Pass.OPAQUE,
284
+ pass:
285
+ collection._blendOption === BlendOption.OPAQUE
286
+ ? Pass.OPAQUE
287
+ : Pass.TRANSLUCENT,
237
288
  pickId: collection._allowPicking ? "v_pickColor" : undefined,
238
289
  owner: collection,
239
290
  count: collection.primitiveCount,
240
291
  modelMatrix: collection.modelMatrix, // shared reference
241
- boundingVolume: collection.boundingVolumeWC, // shared reference
292
+ boundingVolume: collection.boundingVolume, // shared reference
242
293
  debugShowBoundingVolume: collection.debugShowBoundingVolume,
243
294
  });
244
295
  }
@@ -21,6 +21,7 @@ import EncodedCartesian3 from "../Core/EncodedCartesian3.js";
21
21
  import AttributeCompression from "../Core/AttributeCompression.js";
22
22
  import IndexDatatype from "../Core/IndexDatatype.js";
23
23
  import BufferPolygonMaterial from "./BufferPolygonMaterial.js";
24
+ import BlendOption from "./BlendOption.js";
24
25
 
25
26
  /** @import {TypedArray} from "../Core/globalTypes.js"; */
26
27
  /** @import FrameState from "./FrameState.js"; */
@@ -28,25 +29,37 @@ import BufferPolygonMaterial from "./BufferPolygonMaterial.js";
28
29
 
29
30
  /**
30
31
  * TODO(PR#13211): Need 'keyof' syntax to avoid duplicating attribute names.
31
- * @typedef {'positionHigh' | 'positionLow' | 'pickColor' | 'showAndColor'} BufferPolygonAttribute
32
+ * @typedef {'positionHigh' | 'positionLow' | 'pickColor' | 'showColorAlpha'} BufferPolygonAttribute
32
33
  * @ignore
33
34
  */
34
35
 
35
36
  /**
37
+ * Attribute locations when using 64-bit position precision.
36
38
  * @type {Record<BufferPolygonAttribute, number>}
37
39
  * @ignore
38
40
  */
39
- const BufferPolygonAttributeLocations = {
41
+ const BufferPolygonAttributeLocationsFloat64 = {
40
42
  positionHigh: 0,
41
43
  positionLow: 1,
42
44
  pickColor: 2,
43
- showAndColor: 3,
45
+ showColorAlpha: 3,
46
+ };
47
+
48
+ /**
49
+ * Attribute locations when using <= 32-bit position precision.
50
+ * @type {Record<string, number>}
51
+ * @ignore
52
+ */
53
+ const BufferPolygonAttributeLocations = {
54
+ position: 0,
55
+ pickColor: 1,
56
+ showColorAlpha: 2,
44
57
  };
45
58
 
46
59
  /**
47
60
  * @typedef {object} BufferPolygonRenderContext
48
61
  * @property {VertexArray} [vertexArray]
49
- * @property {Record<BufferPolygonAttribute, TypedArray>} [attributeArrays]
62
+ * @property {Record<string, TypedArray>} [attributeArrays]
50
63
  * @property {TypedArray} [indexArray]
51
64
  * @property {RenderState} [renderState]
52
65
  * @property {ShaderProgram} [shaderProgram]
@@ -60,7 +73,7 @@ const polygon = new BufferPolygon();
60
73
  const material = new BufferPolygonMaterial();
61
74
  const pickColor = new Color();
62
75
  const cartesian = new Cartesian3();
63
- const encodedCartesian = new EncodedCartesian3();
76
+ const encodedC = new EncodedCartesian3();
64
77
 
65
78
  /**
66
79
  * @param {BufferPolygonCollection} collection
@@ -72,6 +85,10 @@ const encodedCartesian = new EncodedCartesian3();
72
85
  function renderBufferPolygonCollection(collection, frameState, renderContext) {
73
86
  const context = frameState.context;
74
87
  renderContext = renderContext || { destroy: destroyRenderContext };
88
+ const useFloat64 = collection._positionDatatype === ComponentDatatype.DOUBLE;
89
+ const attributeLocations = useFloat64
90
+ ? BufferPolygonAttributeLocationsFloat64
91
+ : BufferPolygonAttributeLocations;
75
92
 
76
93
  if (
77
94
  !defined(renderContext.attributeArrays) ||
@@ -86,10 +103,14 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
86
103
  );
87
104
 
88
105
  renderContext.attributeArrays = {
89
- positionHigh: new Float32Array(vertexCountMax * 3),
90
- positionLow: new Float32Array(vertexCountMax * 3),
106
+ ...(!useFloat64
107
+ ? { position: collection._positionView }
108
+ : {
109
+ positionHigh: new Float32Array(vertexCountMax * 3),
110
+ positionLow: new Float32Array(vertexCountMax * 3),
111
+ }),
91
112
  pickColor: new Uint8Array(vertexCountMax * 4),
92
- showAndColor: new Float32Array(vertexCountMax * 2),
113
+ showColorAlpha: new Float32Array(vertexCountMax * 3),
93
114
  };
94
115
  }
95
116
 
@@ -97,11 +118,11 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
97
118
  const { attributeArrays } = renderContext;
98
119
  const { _dirtyOffset, _dirtyCount } = collection;
99
120
 
100
- const indexArray = renderContext.indexArray;
101
121
  const positionHighArray = attributeArrays.positionHigh;
102
122
  const positionLowArray = attributeArrays.positionLow;
123
+ const indexArray = renderContext.indexArray;
103
124
  const pickColorArray = attributeArrays.pickColor;
104
- const showAndColorArray = attributeArrays.showAndColor;
125
+ const showColorAlphaArray = attributeArrays.showColorAlpha;
105
126
 
106
127
  for (let i = _dirtyOffset, il = _dirtyOffset + _dirtyCount; i < il; i++) {
107
128
  collection.get(i, polygon);
@@ -125,32 +146,31 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
125
146
  }
126
147
 
127
148
  const show = polygon.show;
128
- const cartesianArray = polygon.getPositions();
149
+ const cartesianArray = !useFloat64 ? null : polygon.getPositions();
129
150
  polygon.getMaterial(material);
130
151
  const encodedColor = AttributeCompression.encodeRGB8(material.color);
131
152
  Color.fromRgba(polygon._pickId, pickColor);
132
153
 
133
154
  // Update vertex arrays.
134
155
  for (let j = 0, jl = polygon.vertexCount; j < jl; j++) {
135
- // @ts-expect-error TODO(tsd-jsdoc): See https://github.com/CesiumGS/cesium/pull/13302.
136
- Cartesian3.fromArray(cartesianArray, j * 3, cartesian);
137
- EncodedCartesian3.fromCartesian(cartesian, encodedCartesian);
138
-
139
- positionHighArray[vOffset * 3] = encodedCartesian.high.x;
140
- positionHighArray[vOffset * 3 + 1] = encodedCartesian.high.y;
141
- positionHighArray[vOffset * 3 + 2] = encodedCartesian.high.z;
142
-
143
- positionLowArray[vOffset * 3] = encodedCartesian.low.x;
144
- positionLowArray[vOffset * 3 + 1] = encodedCartesian.low.y;
145
- positionLowArray[vOffset * 3 + 2] = encodedCartesian.low.z;
156
+ if (useFloat64) {
157
+ // @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
158
+ Cartesian3.fromArray(cartesianArray, j * 3, cartesian);
159
+ EncodedCartesian3.fromCartesian(cartesian, encodedC);
160
+ // @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
161
+ Cartesian3.pack(encodedC.high, positionHighArray, vOffset * 3);
162
+ // @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
163
+ Cartesian3.pack(encodedC.low, positionLowArray, vOffset * 3);
164
+ }
146
165
 
147
166
  pickColorArray[vOffset * 4] = Color.floatToByte(pickColor.red);
148
167
  pickColorArray[vOffset * 4 + 1] = Color.floatToByte(pickColor.green);
149
168
  pickColorArray[vOffset * 4 + 2] = Color.floatToByte(pickColor.blue);
150
169
  pickColorArray[vOffset * 4 + 3] = Color.floatToByte(pickColor.alpha);
151
170
 
152
- showAndColorArray[vOffset * 2] = show ? 1 : 0;
153
- showAndColorArray[vOffset * 2 + 1] = encodedColor;
171
+ showColorAlphaArray[vOffset * 3] = show ? 1 : 0;
172
+ showColorAlphaArray[vOffset * 3 + 1] = encodedColor;
173
+ showColorAlphaArray[vOffset * 3 + 2] = material.color.alpha;
154
174
 
155
175
  vOffset++;
156
176
  }
@@ -174,28 +194,44 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
174
194
  }),
175
195
 
176
196
  attributes: [
197
+ ...(!useFloat64
198
+ ? [
199
+ {
200
+ index: BufferPolygonAttributeLocations.position,
201
+ componentDatatype: collection._positionDatatype,
202
+ componentsPerAttribute: 3,
203
+ normalize: collection._positionNormalized,
204
+ vertexBuffer: Buffer.createVertexBuffer({
205
+ typedArray: attributeArrays.position,
206
+ context,
207
+ usage: BufferUsage.STATIC_DRAW,
208
+ }),
209
+ },
210
+ ]
211
+ : [
212
+ {
213
+ index: BufferPolygonAttributeLocationsFloat64.positionHigh,
214
+ componentDatatype: ComponentDatatype.FLOAT,
215
+ componentsPerAttribute: 3,
216
+ vertexBuffer: Buffer.createVertexBuffer({
217
+ typedArray: attributeArrays.positionHigh,
218
+ context,
219
+ usage: BufferUsage.STATIC_DRAW,
220
+ }),
221
+ },
222
+ {
223
+ index: BufferPolygonAttributeLocationsFloat64.positionLow,
224
+ componentDatatype: ComponentDatatype.FLOAT,
225
+ componentsPerAttribute: 3,
226
+ vertexBuffer: Buffer.createVertexBuffer({
227
+ typedArray: attributeArrays.positionLow,
228
+ context,
229
+ usage: BufferUsage.STATIC_DRAW,
230
+ }),
231
+ },
232
+ ]),
177
233
  {
178
- index: BufferPolygonAttributeLocations.positionHigh,
179
- componentDatatype: ComponentDatatype.FLOAT,
180
- componentsPerAttribute: 3,
181
- vertexBuffer: Buffer.createVertexBuffer({
182
- typedArray: attributeArrays.positionHigh,
183
- context,
184
- usage: BufferUsage.STATIC_DRAW,
185
- }),
186
- },
187
- {
188
- index: BufferPolygonAttributeLocations.positionLow,
189
- componentDatatype: ComponentDatatype.FLOAT,
190
- componentsPerAttribute: 3,
191
- vertexBuffer: Buffer.createVertexBuffer({
192
- typedArray: attributeArrays.positionLow,
193
- context,
194
- usage: BufferUsage.STATIC_DRAW,
195
- }),
196
- },
197
- {
198
- index: BufferPolygonAttributeLocations.pickColor,
234
+ index: attributeLocations.pickColor,
199
235
  componentDatatype: ComponentDatatype.UNSIGNED_BYTE,
200
236
  componentsPerAttribute: 4,
201
237
  vertexBuffer: Buffer.createVertexBuffer({
@@ -205,11 +241,11 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
205
241
  }),
206
242
  },
207
243
  {
208
- index: BufferPolygonAttributeLocations.showAndColor,
244
+ index: attributeLocations.showColorAlpha,
209
245
  componentDatatype: ComponentDatatype.FLOAT,
210
- componentsPerAttribute: 2,
246
+ componentsPerAttribute: 3,
211
247
  vertexBuffer: Buffer.createVertexBuffer({
212
- typedArray: attributeArrays.showAndColor,
248
+ typedArray: attributeArrays.showColorAlpha,
213
249
  context,
214
250
  usage: BufferUsage.STATIC_DRAW,
215
251
  }),
@@ -226,11 +262,11 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
226
262
  indexCount,
227
263
  );
228
264
 
229
- for (const key in BufferPolygonAttributeLocations) {
230
- if (Object.hasOwn(BufferPolygonAttributeLocations, key)) {
265
+ for (const key in attributeLocations) {
266
+ if (Object.hasOwn(attributeLocations, key)) {
231
267
  const attribute = /** @type {BufferPolygonAttribute} */ (key);
232
268
  renderContext.vertexArray.copyAttributeFromRange(
233
- BufferPolygonAttributeLocations[attribute],
269
+ attributeLocations[attribute],
234
270
  renderContext.attributeArrays[attribute],
235
271
  vertexOffset,
236
272
  vertexCount,
@@ -241,7 +277,10 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
241
277
 
242
278
  if (!defined(renderContext.renderState)) {
243
279
  renderContext.renderState = RenderState.fromCache({
244
- blending: BlendingState.DISABLED,
280
+ blending:
281
+ collection._blendOption === BlendOption.OPAQUE
282
+ ? BlendingState.DISABLED
283
+ : BlendingState.ALPHA_BLEND,
245
284
  depthTest: { enabled: true },
246
285
  });
247
286
  }
@@ -251,11 +290,12 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
251
290
  context,
252
291
  vertexShaderSource: new ShaderSource({
253
292
  sources: [BufferPolygonMaterialVS],
293
+ defines: useFloat64 ? ["USE_FLOAT64"] : [],
254
294
  }),
255
295
  fragmentShaderSource: new ShaderSource({
256
296
  sources: [BufferPolygonMaterialFS],
257
297
  }),
258
- attributeLocations: BufferPolygonAttributeLocations,
298
+ attributeLocations,
259
299
  });
260
300
  }
261
301
 
@@ -267,12 +307,15 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
267
307
  renderState: renderContext.renderState,
268
308
  shaderProgram: renderContext.shaderProgram,
269
309
  primitiveType: PrimitiveType.TRIANGLES,
270
- pass: Pass.OPAQUE,
310
+ pass:
311
+ collection._blendOption === BlendOption.OPAQUE
312
+ ? Pass.OPAQUE
313
+ : Pass.TRANSLUCENT,
271
314
  pickId: collection._allowPicking ? "v_pickColor" : undefined,
272
315
  owner: collection,
273
316
  count: drawCount,
274
317
  modelMatrix: collection.modelMatrix, // shared reference
275
- boundingVolume: collection.boundingVolumeWC, // shared reference
318
+ boundingVolume: collection.boundingVolume, // shared reference
276
319
  debugShowBoundingVolume: collection.debugShowBoundingVolume,
277
320
  });
278
321
  }