@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
@@ -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,28 +85,33 @@ 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
 
87
109
  if (collection._dirtyCount > 0) {
88
110
  const { attributeArrays } = renderContext;
89
111
 
90
- const positionHighArray = attributeArrays.positionHigh;
91
- const positionLowArray = attributeArrays.positionLow;
92
112
  const pickColorArray = attributeArrays.pickColor;
93
- const showSizeAndColorArray = attributeArrays.showSizeAndColor;
94
- const outlineWidthAndOutlineColorArray =
95
- attributeArrays.outlineWidthAndOutlineColor;
113
+ const showSizeColorAlphaArray = attributeArrays.showSizeColorAlpha;
114
+ const outlineWidthColorAlphaArray = attributeArrays.outlineWidthColorAlpha;
96
115
 
97
116
  const { _dirtyOffset, _dirtyCount } = collection;
98
117
 
@@ -103,33 +122,37 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
103
122
  continue;
104
123
  }
105
124
 
106
- point.getPosition(cartesian);
107
- EncodedCartesian3.fromCartesian(cartesian, encodedCartesian);
125
+ if (useFloat64) {
126
+ point.getPosition(cartesian);
127
+ EncodedCartesian3.fromCartesian(cartesian, encodedCartesian);
128
+ attributeArrays.positionHigh[i * 3] = encodedCartesian.high.x;
129
+ attributeArrays.positionHigh[i * 3 + 1] = encodedCartesian.high.y;
130
+ attributeArrays.positionHigh[i * 3 + 2] = encodedCartesian.high.z;
131
+ attributeArrays.positionLow[i * 3] = encodedCartesian.low.x;
132
+ attributeArrays.positionLow[i * 3 + 1] = encodedCartesian.low.y;
133
+ attributeArrays.positionLow[i * 3 + 2] = encodedCartesian.low.z;
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
+ material.outlineColor,
154
+ );
155
+ outlineWidthColorAlphaArray[i * 3 + 2] = material.outlineColor.alpha;
133
156
 
134
157
  point._dirty = false;
135
158
  }
@@ -141,28 +164,44 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
141
164
  renderContext.vertexArray = new VertexArray({
142
165
  context,
143
166
  attributes: [
167
+ ...(!useFloat64
168
+ ? [
169
+ {
170
+ index: BufferPointAttributeLocations.position,
171
+ componentDatatype: collection._positionDatatype,
172
+ componentsPerAttribute: 3,
173
+ normalize: collection._positionNormalized,
174
+ vertexBuffer: Buffer.createVertexBuffer({
175
+ typedArray: collection._positionView,
176
+ context,
177
+ usage: BufferUsage.STATIC_DRAW,
178
+ }),
179
+ },
180
+ ]
181
+ : [
182
+ {
183
+ index: BufferPointAttributeLocationsFloat64.positionHigh,
184
+ componentDatatype: ComponentDatatype.FLOAT,
185
+ componentsPerAttribute: 3,
186
+ vertexBuffer: Buffer.createVertexBuffer({
187
+ typedArray: attributeArrays.positionHigh,
188
+ context,
189
+ usage: BufferUsage.STATIC_DRAW,
190
+ }),
191
+ },
192
+ {
193
+ index: BufferPointAttributeLocationsFloat64.positionLow,
194
+ componentDatatype: ComponentDatatype.FLOAT,
195
+ componentsPerAttribute: 3,
196
+ vertexBuffer: Buffer.createVertexBuffer({
197
+ typedArray: attributeArrays.positionLow,
198
+ context,
199
+ usage: BufferUsage.STATIC_DRAW,
200
+ }),
201
+ },
202
+ ]),
144
203
  {
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,
204
+ index: attributeLocations.pickColor,
166
205
  componentDatatype: ComponentDatatype.UNSIGNED_BYTE,
167
206
  componentsPerAttribute: 4,
168
207
  vertexBuffer: Buffer.createVertexBuffer({
@@ -172,21 +211,21 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
172
211
  }),
173
212
  },
174
213
  {
175
- index: BufferPointAttributeLocations.showSizeAndColor,
214
+ index: attributeLocations.showSizeColorAlpha,
176
215
  componentDatatype: ComponentDatatype.FLOAT,
177
- componentsPerAttribute: 3,
216
+ componentsPerAttribute: 4,
178
217
  vertexBuffer: Buffer.createVertexBuffer({
179
- typedArray: attributeArrays.showSizeAndColor,
218
+ typedArray: attributeArrays.showSizeColorAlpha,
180
219
  context,
181
220
  usage: BufferUsage.STATIC_DRAW,
182
221
  }),
183
222
  },
184
223
  {
185
- index: BufferPointAttributeLocations.outlineWidthAndOutlineColor,
224
+ index: attributeLocations.outlineWidthColorAlpha,
186
225
  componentDatatype: ComponentDatatype.FLOAT,
187
- componentsPerAttribute: 2,
226
+ componentsPerAttribute: 3,
188
227
  vertexBuffer: Buffer.createVertexBuffer({
189
- typedArray: attributeArrays.outlineWidthAndOutlineColor,
228
+ typedArray: attributeArrays.outlineWidthColorAlpha,
190
229
  context,
191
230
  usage: BufferUsage.STATIC_DRAW,
192
231
  }),
@@ -194,11 +233,11 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
194
233
  ],
195
234
  });
196
235
  } else if (collection._dirtyCount > 0) {
197
- for (const key in BufferPointAttributeLocations) {
198
- if (Object.hasOwn(BufferPointAttributeLocations, key)) {
236
+ for (const key in attributeLocations) {
237
+ if (Object.hasOwn(attributeLocations, key)) {
199
238
  const attribute = /** @type {BufferPointAttribute} */ (key);
200
239
  renderContext.vertexArray.copyAttributeFromRange(
201
- BufferPointAttributeLocations[attribute],
240
+ attributeLocations[attribute],
202
241
  renderContext.attributeArrays[attribute],
203
242
  collection._dirtyOffset,
204
243
  collection._dirtyCount,
@@ -209,7 +248,10 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
209
248
 
210
249
  if (!defined(renderContext.renderState)) {
211
250
  renderContext.renderState = RenderState.fromCache({
212
- blending: BlendingState.ALPHA_BLEND,
251
+ blending:
252
+ collection._blendOption === BlendOption.OPAQUE
253
+ ? BlendingState.DISABLED
254
+ : BlendingState.ALPHA_BLEND,
213
255
  depthTest: { enabled: true },
214
256
  });
215
257
  }
@@ -219,11 +261,12 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
219
261
  context,
220
262
  vertexShaderSource: new ShaderSource({
221
263
  sources: [BufferPointMaterialVS],
264
+ defines: useFloat64 ? ["USE_FLOAT64"] : [],
222
265
  }),
223
266
  fragmentShaderSource: new ShaderSource({
224
267
  sources: [BufferPointMaterialFS],
225
268
  }),
226
- attributeLocations: BufferPointAttributeLocations,
269
+ attributeLocations,
227
270
  });
228
271
  }
229
272
 
@@ -233,12 +276,15 @@ function renderBufferPointCollection(collection, frameState, renderContext) {
233
276
  renderState: renderContext.renderState,
234
277
  shaderProgram: renderContext.shaderProgram,
235
278
  primitiveType: PrimitiveType.POINTS,
236
- pass: Pass.OPAQUE,
279
+ pass:
280
+ collection._blendOption === BlendOption.OPAQUE
281
+ ? Pass.OPAQUE
282
+ : Pass.TRANSLUCENT,
237
283
  pickId: collection._allowPicking ? "v_pickColor" : undefined,
238
284
  owner: collection,
239
285
  count: collection.primitiveCount,
240
286
  modelMatrix: collection.modelMatrix, // shared reference
241
- boundingVolume: collection.boundingVolumeWC, // shared reference
287
+ boundingVolume: collection.boundingVolume, // shared reference
242
288
  debugShowBoundingVolume: collection.debugShowBoundingVolume,
243
289
  });
244
290
  }
@@ -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]
@@ -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
 
@@ -98,10 +119,8 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
98
119
  const { _dirtyOffset, _dirtyCount } = collection;
99
120
 
100
121
  const indexArray = renderContext.indexArray;
101
- const positionHighArray = attributeArrays.positionHigh;
102
- const positionLowArray = attributeArrays.positionLow;
103
122
  const pickColorArray = attributeArrays.pickColor;
104
- const showAndColorArray = attributeArrays.showAndColor;
123
+ const showColorAlphaArray = attributeArrays.showColorAlpha;
105
124
 
106
125
  for (let i = _dirtyOffset, il = _dirtyOffset + _dirtyCount; i < il; i++) {
107
126
  collection.get(i, polygon);
@@ -125,32 +144,37 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
125
144
  }
126
145
 
127
146
  const show = polygon.show;
128
- const cartesianArray = polygon.getPositions();
147
+ const cartesianArray = !useFloat64 ? null : polygon.getPositions();
129
148
  polygon.getMaterial(material);
130
149
  const encodedColor = AttributeCompression.encodeRGB8(material.color);
131
150
  Color.fromRgba(polygon._pickId, pickColor);
132
151
 
133
152
  // Update vertex arrays.
134
153
  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;
154
+ if (useFloat64) {
155
+ // @ts-expect-error TODO(tsd-jsdoc): See https://github.com/CesiumGS/cesium/pull/13302.
156
+ Cartesian3.fromArray(cartesianArray, j * 3, cartesian);
157
+ EncodedCartesian3.fromCartesian(cartesian, encodedCartesian);
158
+
159
+ attributeArrays.positionHigh[vOffset * 3] = encodedCartesian.high.x;
160
+ attributeArrays.positionHigh[vOffset * 3 + 1] =
161
+ encodedCartesian.high.y;
162
+ attributeArrays.positionHigh[vOffset * 3 + 2] =
163
+ encodedCartesian.high.z;
164
+
165
+ attributeArrays.positionLow[vOffset * 3] = encodedCartesian.low.x;
166
+ attributeArrays.positionLow[vOffset * 3 + 1] = encodedCartesian.low.y;
167
+ attributeArrays.positionLow[vOffset * 3 + 2] = encodedCartesian.low.z;
168
+ }
146
169
 
147
170
  pickColorArray[vOffset * 4] = Color.floatToByte(pickColor.red);
148
171
  pickColorArray[vOffset * 4 + 1] = Color.floatToByte(pickColor.green);
149
172
  pickColorArray[vOffset * 4 + 2] = Color.floatToByte(pickColor.blue);
150
173
  pickColorArray[vOffset * 4 + 3] = Color.floatToByte(pickColor.alpha);
151
174
 
152
- showAndColorArray[vOffset * 2] = show ? 1 : 0;
153
- showAndColorArray[vOffset * 2 + 1] = encodedColor;
175
+ showColorAlphaArray[vOffset * 3] = show ? 1 : 0;
176
+ showColorAlphaArray[vOffset * 3 + 1] = encodedColor;
177
+ showColorAlphaArray[vOffset * 3 + 2] = material.color.alpha;
154
178
 
155
179
  vOffset++;
156
180
  }
@@ -174,28 +198,44 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
174
198
  }),
175
199
 
176
200
  attributes: [
201
+ ...(!useFloat64
202
+ ? [
203
+ {
204
+ index: BufferPolygonAttributeLocations.position,
205
+ componentDatatype: collection._positionDatatype,
206
+ componentsPerAttribute: 3,
207
+ normalize: collection._positionNormalized,
208
+ vertexBuffer: Buffer.createVertexBuffer({
209
+ typedArray: attributeArrays.position,
210
+ context,
211
+ usage: BufferUsage.STATIC_DRAW,
212
+ }),
213
+ },
214
+ ]
215
+ : [
216
+ {
217
+ index: BufferPolygonAttributeLocationsFloat64.positionHigh,
218
+ componentDatatype: ComponentDatatype.FLOAT,
219
+ componentsPerAttribute: 3,
220
+ vertexBuffer: Buffer.createVertexBuffer({
221
+ typedArray: attributeArrays.positionHigh,
222
+ context,
223
+ usage: BufferUsage.STATIC_DRAW,
224
+ }),
225
+ },
226
+ {
227
+ index: BufferPolygonAttributeLocationsFloat64.positionLow,
228
+ componentDatatype: ComponentDatatype.FLOAT,
229
+ componentsPerAttribute: 3,
230
+ vertexBuffer: Buffer.createVertexBuffer({
231
+ typedArray: attributeArrays.positionLow,
232
+ context,
233
+ usage: BufferUsage.STATIC_DRAW,
234
+ }),
235
+ },
236
+ ]),
177
237
  {
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,
238
+ index: attributeLocations.pickColor,
199
239
  componentDatatype: ComponentDatatype.UNSIGNED_BYTE,
200
240
  componentsPerAttribute: 4,
201
241
  vertexBuffer: Buffer.createVertexBuffer({
@@ -205,11 +245,11 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
205
245
  }),
206
246
  },
207
247
  {
208
- index: BufferPolygonAttributeLocations.showAndColor,
248
+ index: attributeLocations.showColorAlpha,
209
249
  componentDatatype: ComponentDatatype.FLOAT,
210
- componentsPerAttribute: 2,
250
+ componentsPerAttribute: 3,
211
251
  vertexBuffer: Buffer.createVertexBuffer({
212
- typedArray: attributeArrays.showAndColor,
252
+ typedArray: attributeArrays.showColorAlpha,
213
253
  context,
214
254
  usage: BufferUsage.STATIC_DRAW,
215
255
  }),
@@ -226,11 +266,11 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
226
266
  indexCount,
227
267
  );
228
268
 
229
- for (const key in BufferPolygonAttributeLocations) {
230
- if (Object.hasOwn(BufferPolygonAttributeLocations, key)) {
269
+ for (const key in attributeLocations) {
270
+ if (Object.hasOwn(attributeLocations, key)) {
231
271
  const attribute = /** @type {BufferPolygonAttribute} */ (key);
232
272
  renderContext.vertexArray.copyAttributeFromRange(
233
- BufferPolygonAttributeLocations[attribute],
273
+ attributeLocations[attribute],
234
274
  renderContext.attributeArrays[attribute],
235
275
  vertexOffset,
236
276
  vertexCount,
@@ -241,7 +281,10 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
241
281
 
242
282
  if (!defined(renderContext.renderState)) {
243
283
  renderContext.renderState = RenderState.fromCache({
244
- blending: BlendingState.DISABLED,
284
+ blending:
285
+ collection._blendOption === BlendOption.OPAQUE
286
+ ? BlendingState.DISABLED
287
+ : BlendingState.ALPHA_BLEND,
245
288
  depthTest: { enabled: true },
246
289
  });
247
290
  }
@@ -251,11 +294,12 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
251
294
  context,
252
295
  vertexShaderSource: new ShaderSource({
253
296
  sources: [BufferPolygonMaterialVS],
297
+ defines: useFloat64 ? ["USE_FLOAT64"] : [],
254
298
  }),
255
299
  fragmentShaderSource: new ShaderSource({
256
300
  sources: [BufferPolygonMaterialFS],
257
301
  }),
258
- attributeLocations: BufferPolygonAttributeLocations,
302
+ attributeLocations,
259
303
  });
260
304
  }
261
305
 
@@ -267,12 +311,15 @@ function renderBufferPolygonCollection(collection, frameState, renderContext) {
267
311
  renderState: renderContext.renderState,
268
312
  shaderProgram: renderContext.shaderProgram,
269
313
  primitiveType: PrimitiveType.TRIANGLES,
270
- pass: Pass.OPAQUE,
314
+ pass:
315
+ collection._blendOption === BlendOption.OPAQUE
316
+ ? Pass.OPAQUE
317
+ : Pass.TRANSLUCENT,
271
318
  pickId: collection._allowPicking ? "v_pickColor" : undefined,
272
319
  owner: collection,
273
320
  count: drawCount,
274
321
  modelMatrix: collection.modelMatrix, // shared reference
275
- boundingVolume: collection.boundingVolumeWC, // shared reference
322
+ boundingVolume: collection.boundingVolume, // shared reference
276
323
  debugShowBoundingVolume: collection.debugShowBoundingVolume,
277
324
  });
278
325
  }