@cesium/engine 21.0.1 → 22.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 (267) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +10 -7
  2. package/Build/Workers/chunk-23T2IPHV.js +55 -0
  3. package/Build/Workers/{chunk-TGJQMEL4.js → chunk-2AM4E2WD.js} +2 -2
  4. package/Build/Workers/{chunk-4CORGH7N.js → chunk-2MWF4IES.js} +16 -14
  5. package/Build/Workers/{chunk-3RKX3UFI.js → chunk-2RCIRXNI.js} +1 -1
  6. package/Build/Workers/{chunk-LV3G32QE.js → chunk-3YTMGEXW.js} +5 -1424
  7. package/Build/Workers/{chunk-PJAA7QSC.js → chunk-4BHWJWS3.js} +6 -6
  8. package/Build/Workers/{chunk-FE565QHX.js → chunk-5JKH4AMT.js} +2 -2
  9. package/Build/Workers/{chunk-KZ7GDSAJ.js → chunk-6HKAPCSO.js} +1 -1
  10. package/Build/Workers/{chunk-VVALNLSH.js → chunk-A53R2F2L.js} +4 -4
  11. package/Build/Workers/{chunk-KVB73ECP.js → chunk-A6YFUGJO.js} +7 -7
  12. package/Build/Workers/{chunk-QNOIRRJK.js → chunk-AJYWXC6I.js} +4 -4
  13. package/Build/Workers/{chunk-UKA7OISV.js → chunk-AOIO5VUS.js} +282 -2284
  14. package/Build/Workers/{chunk-OBS5EMZ6.js → chunk-B7JRBTT6.js} +10 -10
  15. package/Build/Workers/{chunk-5YXA47QD.js → chunk-CHNDJRYA.js} +20 -18
  16. package/Build/Workers/{chunk-X3ZV3XNO.js → chunk-CJOV55CW.js} +20 -18
  17. package/Build/Workers/{chunk-W6I3LNPF.js → chunk-COGPE5Z2.js} +10 -8
  18. package/Build/Workers/{chunk-2QPH5QDK.js → chunk-CW7W27IZ.js} +14 -10
  19. package/Build/Workers/{chunk-MXOGBWMP.js → chunk-DICY26ID.js} +20 -16
  20. package/Build/Workers/{chunk-W6KMV4F5.js → chunk-DMEFNTUV.js} +69 -7
  21. package/Build/Workers/{chunk-T7HU6E7G.js → chunk-DQSJEOZY.js} +1 -1
  22. package/Build/Workers/{chunk-ASVODZNK.js → chunk-GDU4RZSZ.js} +16 -36
  23. package/Build/Workers/{chunk-MQPDOWGH.js → chunk-GKWOUMYA.js} +1 -1
  24. package/Build/Workers/{chunk-A2SP2EJZ.js → chunk-GTY4K4IA.js} +9 -7
  25. package/Build/Workers/{chunk-KEPPNSBL.js → chunk-H6Q7E4BQ.js} +8 -6
  26. package/Build/Workers/{chunk-JG3C3LPY.js → chunk-HHGOFZVQ.js} +7 -5
  27. package/Build/Workers/chunk-HXKUEOOD.js +352 -0
  28. package/Build/Workers/{chunk-UFSYRVC5.js → chunk-I4REFVXB.js} +4 -4
  29. package/Build/Workers/{chunk-LU7DLY2L.js → chunk-IL5F6WEE.js} +3 -3
  30. package/Build/Workers/{chunk-RVRN4KDB.js → chunk-JKXPC5HD.js} +2 -2
  31. package/Build/Workers/{chunk-CBPNIEGH.js → chunk-KKGD7HAW.js} +13 -11
  32. package/Build/Workers/{chunk-DTKSVIH5.js → chunk-KROSQJUA.js} +2 -2
  33. package/Build/Workers/{chunk-42EJCSIV.js → chunk-L4JLDVCM.js} +5 -5
  34. package/Build/Workers/{chunk-LPKJSIMD.js → chunk-LIYMRHGR.js} +15 -13
  35. package/Build/Workers/{chunk-J2XQVKVH.js → chunk-MKMZHRB3.js} +74 -35
  36. package/Build/Workers/{chunk-CSDYSXBI.js → chunk-MO25ZQ2I.js} +14 -12
  37. package/Build/Workers/{chunk-3YNW5K6O.js → chunk-O6RZEKHZ.js} +12 -12
  38. package/Build/Workers/{chunk-RR3NCT4R.js → chunk-OOCGX2OD.js} +4 -4
  39. package/Build/Workers/{chunk-XG54SG4O.js → chunk-OXFU5HNU.js} +13 -5
  40. package/Build/Workers/{chunk-P2UKEFCK.js → chunk-P5CGIJUY.js} +2 -2
  41. package/Build/Workers/{chunk-DBHL2UVG.js → chunk-QEANVUGT.js} +2 -2
  42. package/Build/Workers/{chunk-2SI7DEW5.js → chunk-QFBCIX7J.js} +8 -6
  43. package/Build/Workers/{chunk-DDXI6UYW.js → chunk-QUAH3XOT.js} +4 -4
  44. package/Build/Workers/{chunk-PZUZCAX3.js → chunk-RXZDTDIY.js} +13 -9
  45. package/Build/Workers/{chunk-YZ3RCE45.js → chunk-SPA2KPH3.js} +14 -12
  46. package/Build/Workers/chunk-TDSVSW5A.js +1460 -0
  47. package/Build/Workers/{chunk-G3CKZ34K.js → chunk-UG2DPFOL.js} +8 -6
  48. package/Build/Workers/{chunk-IKUOV6DO.js → chunk-URGEDZBS.js} +7 -7
  49. package/Build/Workers/{chunk-U2GR5FDL.js → chunk-V35NQOJC.js} +21 -11
  50. package/Build/Workers/chunk-W4XUEDU5.js +2058 -0
  51. package/Build/Workers/chunk-WB4TSSBQ.js +3514 -0
  52. package/Build/Workers/{chunk-EBDZDBJN.js → chunk-WTLYD4FE.js} +19 -15
  53. package/Build/Workers/{chunk-WQZL6CA2.js → chunk-Y4ALZ4SS.js} +9 -7
  54. package/Build/Workers/{chunk-DAJKOQW6.js → chunk-YF2NVO5B.js} +19 -13
  55. package/Build/Workers/{chunk-XJVRYJVZ.js → chunk-YSYSXSHF.js} +1 -1
  56. package/Build/Workers/{chunk-YNOVMSUX.js → chunk-YX562XOB.js} +15 -11
  57. package/Build/Workers/{chunk-J3KPR6DJ.js → chunk-YZWA5B4R.js} +15 -13
  58. package/Build/Workers/{chunk-NYYQZ3LH.js → chunk-Z6DFT4D3.js} +15 -11
  59. package/Build/Workers/combineGeometry.js +24 -21
  60. package/Build/Workers/createBoxGeometry.js +18 -15
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -13
  62. package/Build/Workers/createCircleGeometry.js +28 -24
  63. package/Build/Workers/createCircleOutlineGeometry.js +21 -17
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +35 -31
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -29
  66. package/Build/Workers/createCorridorGeometry.js +32 -28
  67. package/Build/Workers/createCorridorOutlineGeometry.js +30 -26
  68. package/Build/Workers/createCylinderGeometry.js +20 -17
  69. package/Build/Workers/createCylinderOutlineGeometry.js +20 -16
  70. package/Build/Workers/createEllipseGeometry.js +28 -24
  71. package/Build/Workers/createEllipseOutlineGeometry.js +21 -17
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -16
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -15
  74. package/Build/Workers/createFrustumGeometry.js +18 -15
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -15
  76. package/Build/Workers/createGeometry.js +28 -22
  77. package/Build/Workers/createGroundPolylineGeometry.js +25 -21
  78. package/Build/Workers/createPlaneGeometry.js +16 -13
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -12
  80. package/Build/Workers/createPolygonGeometry.js +35 -31
  81. package/Build/Workers/createPolygonOutlineGeometry.js +32 -28
  82. package/Build/Workers/createPolylineGeometry.js +27 -23
  83. package/Build/Workers/createPolylineVolumeGeometry.js +33 -29
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +29 -25
  85. package/Build/Workers/createRectangleGeometry.js +30 -26
  86. package/Build/Workers/createRectangleOutlineGeometry.js +23 -19
  87. package/Build/Workers/createSimplePolylineGeometry.js +25 -21
  88. package/Build/Workers/createSphereGeometry.js +19 -16
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -15
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +16 -13
  92. package/Build/Workers/createVectorTileGeometries.js +24 -21
  93. package/Build/Workers/createVectorTilePoints.js +15 -12
  94. package/Build/Workers/createVectorTilePolygons.js +24 -20
  95. package/Build/Workers/createVectorTilePolylines.js +16 -13
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +91 -0
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +28 -23
  98. package/Build/Workers/createVerticesFromHeightmap.js +28 -23
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +26 -279
  100. package/Build/Workers/createWallGeometry.js +26 -22
  101. package/Build/Workers/createWallOutlineGeometry.js +25 -21
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +13 -11
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +121 -0
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +24 -20
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +95 -0
  112. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +2 -2
  113. package/Source/Core/AxisAlignedBoundingBox.js +36 -0
  114. package/Source/Core/Cesium3DTilesTerrainData.js +932 -0
  115. package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +1868 -0
  116. package/Source/Core/Cesium3DTilesTerrainProvider.js +1052 -0
  117. package/Source/Core/CesiumTerrainProvider.js +2 -2
  118. package/Source/Core/Color.js +23 -6
  119. package/Source/Core/EllipsoidalOccluder.js +2 -2
  120. package/Source/Core/FeatureDetection.js +0 -2
  121. package/Source/Core/GoogleEarthEnterpriseMetadata.js +1 -1
  122. package/Source/Core/GoogleEarthEnterpriseTerrainData.js +2 -1
  123. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
  124. package/Source/Core/HeightmapTerrainData.js +12 -22
  125. package/Source/Core/HilbertOrder.js +0 -6
  126. package/Source/Core/ITwinPlatform.js +6 -6
  127. package/Source/Core/IntersectionTests.js +80 -0
  128. package/Source/Core/Ion.js +1 -1
  129. package/Source/Core/IonResource.js +35 -27
  130. package/Source/Core/PixelFormat.js +2 -2
  131. package/Source/Core/QuantizedMeshTerrainData.js +24 -57
  132. package/Source/Core/Resource.js +15 -11
  133. package/Source/Core/S2Cell.js +6 -18
  134. package/Source/Core/TaskProcessor.js +1 -1
  135. package/Source/Core/TerrainData.js +2 -1
  136. package/Source/Core/TerrainEncoding.js +215 -38
  137. package/Source/Core/TerrainMesh.js +215 -8
  138. package/Source/Core/TerrainPicker.js +607 -0
  139. package/Source/Core/TerrainProvider.js +151 -0
  140. package/Source/Core/TexturePacker.js +27 -12
  141. package/Source/Core/Transforms.js +28 -19
  142. package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
  143. package/Source/Core/binarySearch.js +1 -1
  144. package/Source/Core/createWorldBathymetryAsync.js +2 -2
  145. package/Source/Core/createWorldTerrainAsync.js +3 -3
  146. package/Source/Core/loadImageFromTypedArray.js +9 -3
  147. package/Source/Core/mergeSort.js +1 -1
  148. package/Source/DataSources/BillboardGraphics.js +1 -1
  149. package/Source/DataSources/BillboardVisualizer.js +7 -4
  150. package/Source/DataSources/PropertyArray.js +2 -2
  151. package/Source/Renderer/AutomaticUniforms.js +61 -0
  152. package/Source/Renderer/Buffer.js +32 -0
  153. package/Source/Renderer/BufferUsage.js +3 -1
  154. package/Source/Renderer/Context.js +98 -14
  155. package/Source/Renderer/Pass.js +10 -9
  156. package/Source/Renderer/Sync.js +104 -0
  157. package/Source/Renderer/TextureAtlas.js +67 -27
  158. package/Source/Renderer/UniformState.js +12 -0
  159. package/Source/Renderer/VertexArray.js +1 -1
  160. package/Source/Scene/ArcGisMapServerImageryProvider.js +1 -1
  161. package/Source/Scene/ArcGisMapService.js +1 -1
  162. package/Source/Scene/Azure2DImageryProvider.js +99 -13
  163. package/Source/Scene/BatchTable.js +2 -2
  164. package/Source/Scene/Billboard.js +75 -28
  165. package/Source/Scene/BillboardCollection.js +24 -15
  166. package/Source/Scene/BillboardTexture.js +56 -7
  167. package/Source/Scene/BingMapsImageryProvider.js +1 -1
  168. package/Source/Scene/BoundingVolumeSemantics.js +54 -62
  169. package/Source/Scene/Cesium3DTile.js +3 -3
  170. package/Source/Scene/Cesium3DTilesVoxelProvider.js +1 -1
  171. package/Source/Scene/Cesium3DTileset.js +1 -1
  172. package/Source/Scene/EdgeFramebuffer.js +245 -0
  173. package/Source/Scene/FrameState.js +12 -0
  174. package/Source/Scene/GaussianSplat3DTileContent.js +12 -16
  175. package/Source/Scene/GaussianSplatPrimitive.js +12 -8
  176. package/Source/Scene/GaussianSplatSorter.js +2 -2
  177. package/Source/Scene/Globe.js +4 -2
  178. package/Source/Scene/GlobeSurfaceTile.js +28 -70
  179. package/Source/Scene/GlobeSurfaceTileProvider.js +11 -0
  180. package/Source/Scene/GltfBufferViewLoader.js +18 -0
  181. package/Source/Scene/GltfLoader.js +46 -8
  182. package/Source/Scene/Google2DImageryProvider.js +48 -41
  183. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
  184. package/Source/Scene/I3SDataProvider.js +1 -1
  185. package/Source/Scene/I3SDecoder.js +3 -3
  186. package/Source/Scene/ITwinData.js +4 -4
  187. package/Source/Scene/ImageryLayer.js +1 -1
  188. package/Source/Scene/Implicit3DTileContent.js +18 -7
  189. package/Source/Scene/ImplicitSubtree.js +3 -3
  190. package/Source/Scene/ImplicitTileset.js +2 -2
  191. package/Source/Scene/IonImageryProvider.js +15 -84
  192. package/Source/Scene/IonImageryProviderFactory.js +194 -0
  193. package/Source/Scene/LabelCollection.js +54 -36
  194. package/Source/Scene/MetadataComponentType.js +5 -5
  195. package/Source/Scene/MetadataTableProperty.js +3 -9
  196. package/Source/Scene/Model/EdgeDetectionPipelineStage.js +42 -0
  197. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +800 -0
  198. package/Source/Scene/Model/MetadataPipelineStage.js +7 -7
  199. package/Source/Scene/Model/ModelDrawCommand.js +69 -0
  200. package/Source/Scene/Model/ModelImagery.js +4 -0
  201. package/Source/Scene/Model/ModelRuntimeNode.js +2 -2
  202. package/Source/Scene/Model/ModelRuntimePrimitive.js +13 -2
  203. package/Source/Scene/Model/ModelSceneGraph.js +15 -3
  204. package/Source/Scene/Model/ModelUtility.js +0 -1
  205. package/Source/Scene/Model/NodeRenderResources.js +1 -1
  206. package/Source/Scene/Model/PrimitiveRenderResources.js +1 -1
  207. package/Source/Scene/OIT.js +11 -1
  208. package/Source/Scene/PickFramebuffer.js +134 -50
  209. package/Source/Scene/Picking.js +195 -89
  210. package/Source/Scene/QuadtreePrimitive.js +34 -26
  211. package/Source/Scene/QuadtreeTile.js +66 -46
  212. package/Source/Scene/ResourceLoaderState.js +1 -1
  213. package/Source/Scene/Scene.js +160 -16
  214. package/Source/Scene/ScreenSpaceCameraController.js +1 -1
  215. package/Source/Scene/SensorVolumePortionToDisplay.js +6 -6
  216. package/Source/Scene/SingleTileImageryProvider.js +3 -3
  217. package/Source/Scene/Terrain.js +5 -5
  218. package/Source/Scene/TerrainFillMesh.js +1 -0
  219. package/Source/Scene/TileMapServiceImageryProvider.js +2 -2
  220. package/Source/Scene/UrlTemplateImageryProvider.js +1 -1
  221. package/Source/Scene/View.js +3 -0
  222. package/Source/Scene/VoxelPrimitive.js +196 -189
  223. package/Source/Scene/VoxelShape.js +2 -0
  224. package/Source/Scene/createWorldImageryAsync.js +1 -1
  225. package/Source/Shaders/BillboardCollectionFS.glsl +115 -62
  226. package/Source/Shaders/BillboardCollectionFS.js +115 -63
  227. package/Source/Shaders/BillboardCollectionVS.glsl +44 -37
  228. package/Source/Shaders/BillboardCollectionVS.js +45 -38
  229. package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
  230. package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
  231. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
  232. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
  233. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
  234. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
  235. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.glsl +10 -0
  236. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.js +12 -0
  237. package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
  238. package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
  239. package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
  240. package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
  241. package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
  242. package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
  243. package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
  244. package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
  245. package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
  246. package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
  247. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
  248. package/Source/Shaders/GlobeVS.glsl +1 -1
  249. package/Source/Shaders/GlobeVS.js +1 -1
  250. package/Source/Shaders/Model/EdgeDetectionStageFS.glsl +58 -0
  251. package/Source/Shaders/Model/EdgeDetectionStageFS.js +60 -0
  252. package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +83 -0
  253. package/Source/Shaders/Model/EdgeVisibilityStageFS.js +85 -0
  254. package/Source/Shaders/Model/ModelFS.glsl +5 -0
  255. package/Source/Shaders/Model/ModelFS.js +5 -0
  256. package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +0 -1
  257. package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +0 -1
  258. package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +7 -15
  259. package/Source/Shaders/ShadowVolumeAppearanceFS.js +7 -15
  260. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
  261. package/Source/ThirdParty/zip-module.wasm +0 -0
  262. package/Source/Workers/createVerticesFromCesium3DTilesTerrain.js +46 -0
  263. package/Source/Workers/incrementallyBuildTerrainPicker.js +108 -0
  264. package/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +55 -0
  265. package/index.d.ts +488 -31
  266. package/index.js +202 -190
  267. package/package.json +3 -2
@@ -15,6 +15,8 @@ import CesiumMath from "./Math.js";
15
15
  * @see CesiumTerrainProvider
16
16
  * @see VRTheWorldTerrainProvider
17
17
  * @see GoogleEarthEnterpriseTerrainProvider
18
+ * @see ArcGISTiledElevationTerrainProvider
19
+ * @see Cesium3DTilesTerrainProvider
18
20
  */
19
21
  function TerrainProvider() {
20
22
  DeveloperError.throwInstantiationError();
@@ -236,7 +238,80 @@ TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices = function (
236
238
  };
237
239
 
238
240
  /**
241
+ * Calculates the number of skirt vertices given the edge indices.
239
242
  * @private
243
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} westIndicesSouthToNorth Edge indices along the west side of the tile.
244
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} southIndicesEastToWest Edge indices along the south side of the tile.
245
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} eastIndicesNorthToSouth Edge indices along the east side of the tile.
246
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} northIndicesWestToEast Edge indices along the north side of the tile.
247
+ * @returns {number} The number of skirt vertices.
248
+ */
249
+ TerrainProvider.getSkirtVertexCount = function (
250
+ westIndicesSouthToNorth,
251
+ southIndicesEastToWest,
252
+ eastIndicesNorthToSouth,
253
+ northIndicesWestToEast,
254
+ ) {
255
+ return (
256
+ westIndicesSouthToNorth.length +
257
+ southIndicesEastToWest.length +
258
+ eastIndicesNorthToSouth.length +
259
+ northIndicesWestToEast.length
260
+ );
261
+ };
262
+
263
+ /**
264
+ * Compute the number of skirt indices given the number of skirt vertices.
265
+ * Consider a 3x3 grid of vertices. There will be 8 skirt vertices around the edge:
266
+ * - 16 edge triangles
267
+ * - 48 indices
268
+ *
269
+ * |\|\|
270
+ * |/| |/|
271
+ * |/| |/|
272
+ * |\|\|
273
+ *
274
+ * @private
275
+ * @param {number} skirtVertexCount
276
+ * @returns {number}
277
+ */
278
+ TerrainProvider.getSkirtIndexCount = function (skirtVertexCount) {
279
+ return (skirtVertexCount - 4) * 2 * 3;
280
+ };
281
+
282
+ /**
283
+ * Compute the number of skirt indices given the number of skirt vertices with filled corners.
284
+ * Consider a 3x3 grid of vertices. There will be 8 skirt vertices around the edge:
285
+ * - 16 edge triangles
286
+ * - 4 cap triangles
287
+ * - 60 indices
288
+ *
289
+ * /|\|\|\
290
+ * |/| |/|
291
+ * |/| |/|
292
+ * \|\|\|/
293
+ *
294
+ * @private
295
+ * @param {number} skirtVertexCount
296
+ * @returns {number}
297
+ */
298
+ TerrainProvider.getSkirtIndexCountWithFilledCorners = function (
299
+ skirtVertexCount,
300
+ ) {
301
+ return ((skirtVertexCount - 4) * 2 + 4) * 3;
302
+ };
303
+
304
+ /**
305
+ * Adds skirt indices.
306
+ * This does not add filled corners. Use {@link TerrainProvider.addSkirtIndicesWithFilledCorners} to add skirt indices with filled corners.
307
+ * @private
308
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} westIndicesSouthToNorth The indices of the vertices on the Western edge of the tile, ordered from South to North.
309
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} southIndicesEastToWest The indices of the vertices on the Southern edge of the tile, ordered from East to West.
310
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} eastIndicesNorthToSouth The indices of the vertices on the Eastern edge of the tile, ordered from North to South.
311
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} northIndicesWestToEast The indices of the vertices on the Northern edge of the tile, ordered from West to East.
312
+ * @param {number} vertexCount The number of vertices in the tile before adding skirt vertices.
313
+ * @param {Uint16Array|Uint32Array} indices The array of indices to which skirt indices are added.
314
+ * @param {number} offset The offset into the indices array at which to start adding skirt indices.
240
315
  */
241
316
  TerrainProvider.addSkirtIndices = function (
242
317
  westIndicesSouthToNorth,
@@ -272,6 +347,82 @@ TerrainProvider.addSkirtIndices = function (
272
347
  addSkirtIndices(northIndicesWestToEast, vertexIndex, indices, offset);
273
348
  };
274
349
 
350
+ /**
351
+ * Adds skirt indices with filled corners.
352
+ * @private
353
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} westIndicesSouthToNorth The indices of the vertices on the Western edge of the tile, ordered from South to North.
354
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} southIndicesEastToWest The indices of the vertices on the Southern edge of the tile, ordered from East to West.
355
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} eastIndicesNorthToSouth The indices of the vertices on the Eastern edge of the tile, ordered from North to South.
356
+ * @param {number[]|Uint8Array|Uint16Array|Uint32Array} northIndicesWestToEast The indices of the vertices on the Northern edge of the tile, ordered from West to East.
357
+ * @param {number} vertexCount The number of vertices in the tile before adding skirt vertices.
358
+ * @param {Uint16Array|Uint32Array} indices The array of indices to which skirt indices are added.
359
+ * @param {number} offset The offset into the indices array at which to start adding skirt indices.
360
+ */
361
+ TerrainProvider.addSkirtIndicesWithFilledCorners = function (
362
+ westIndicesSouthToNorth,
363
+ southIndicesEastToWest,
364
+ eastIndicesNorthToSouth,
365
+ northIndicesWestToEast,
366
+ vertexCount,
367
+ indices,
368
+ offset,
369
+ ) {
370
+ // Add skirt indices without filled corners
371
+ TerrainProvider.addSkirtIndices(
372
+ westIndicesSouthToNorth,
373
+ southIndicesEastToWest,
374
+ eastIndicesNorthToSouth,
375
+ northIndicesWestToEast,
376
+ vertexCount,
377
+ indices,
378
+ offset,
379
+ );
380
+
381
+ const skirtVertexCount = TerrainProvider.getSkirtVertexCount(
382
+ westIndicesSouthToNorth,
383
+ southIndicesEastToWest,
384
+ eastIndicesNorthToSouth,
385
+ northIndicesWestToEast,
386
+ );
387
+ const skirtIndexCountWithoutCaps =
388
+ TerrainProvider.getSkirtIndexCount(skirtVertexCount);
389
+
390
+ const cornerStartIdx = offset + skirtIndexCountWithoutCaps;
391
+
392
+ const cornerSWIndex = westIndicesSouthToNorth[0];
393
+ const cornerNWIndex = northIndicesWestToEast[0];
394
+ const cornerNEIndex = eastIndicesNorthToSouth[0];
395
+ const cornerSEIndex = southIndicesEastToWest[0];
396
+
397
+ // Indices based on edge order in addSkirtIndices
398
+ const westSouthIndex = vertexCount;
399
+ const westNorthIndex = westSouthIndex + westIndicesSouthToNorth.length - 1;
400
+ const southEastIndex = westNorthIndex + 1;
401
+ const southWestIndex = southEastIndex + southIndicesEastToWest.length - 1;
402
+ const eastNorthIndex = southWestIndex + 1;
403
+ const eastSouthIndex = eastNorthIndex + eastIndicesNorthToSouth.length - 1;
404
+ const northWestIndex = eastSouthIndex + 1;
405
+ const northEastIndex = northWestIndex + northIndicesWestToEast.length - 1;
406
+
407
+ // Connect the corner vertices with the skirt vertices extending from the corner
408
+
409
+ indices[cornerStartIdx + 0] = cornerSWIndex;
410
+ indices[cornerStartIdx + 1] = westSouthIndex;
411
+ indices[cornerStartIdx + 2] = southWestIndex;
412
+
413
+ indices[cornerStartIdx + 3] = cornerSEIndex;
414
+ indices[cornerStartIdx + 4] = southEastIndex;
415
+ indices[cornerStartIdx + 5] = eastSouthIndex;
416
+
417
+ indices[cornerStartIdx + 6] = cornerNEIndex;
418
+ indices[cornerStartIdx + 7] = eastNorthIndex;
419
+ indices[cornerStartIdx + 8] = northEastIndex;
420
+
421
+ indices[cornerStartIdx + 9] = cornerNWIndex;
422
+ indices[cornerStartIdx + 10] = northWestIndex;
423
+ indices[cornerStartIdx + 11] = westNorthIndex;
424
+ };
425
+
275
426
  function getEdgeIndices(width, height) {
276
427
  const westIndicesSouthToNorth = new Array(height);
277
428
  const southIndicesEastToWest = new Array(width);
@@ -122,6 +122,8 @@ TexturePacker.prototype._findNode = function (node, { width, height }) {
122
122
  return node;
123
123
  }
124
124
 
125
+ const borderPadding = this._borderPadding;
126
+
125
127
  // Vertical split (childNode1 = left half, childNode2 = right half).
126
128
  if (widthDifference > heightDifference) {
127
129
  node.childNode1 = new TextureNode({
@@ -130,12 +132,18 @@ TexturePacker.prototype._findNode = function (node, { width, height }) {
130
132
  width,
131
133
  height: nodeHeight,
132
134
  });
133
- node.childNode2 = new TextureNode({
134
- x: rectangle.x + width,
135
- y: rectangle.y,
136
- width: widthDifference,
137
- height: nodeHeight,
138
- });
135
+
136
+ // Apply padding only along the vertical "cut".
137
+ const widthDifferencePadded = widthDifference - borderPadding;
138
+
139
+ if (widthDifferencePadded > 0) {
140
+ node.childNode2 = new TextureNode({
141
+ x: rectangle.x + width + borderPadding,
142
+ y: rectangle.y,
143
+ width: widthDifferencePadded,
144
+ height: nodeHeight,
145
+ });
146
+ }
139
147
 
140
148
  return this._findNode(node.childNode1, { width, height });
141
149
  }
@@ -147,12 +155,19 @@ TexturePacker.prototype._findNode = function (node, { width, height }) {
147
155
  width: nodeWidth,
148
156
  height,
149
157
  });
150
- node.childNode2 = new TextureNode({
151
- x: rectangle.x,
152
- y: rectangle.y + height,
153
- width: nodeWidth,
154
- height: heightDifference,
155
- });
158
+
159
+ // Apply padding only along the horizontal "cut".
160
+ const heightDifferencePadded = heightDifference - borderPadding;
161
+
162
+ if (heightDifferencePadded > 0) {
163
+ node.childNode2 = new TextureNode({
164
+ x: rectangle.x,
165
+ y: rectangle.y + height + borderPadding,
166
+ width: nodeWidth,
167
+ height: heightDifferencePadded,
168
+ });
169
+ }
170
+
156
171
  return this._findNode(node.childNode1, { width, height });
157
172
  }
158
173
 
@@ -1131,23 +1131,32 @@ Transforms.rotationMatrixFromPositionVelocity = function (
1131
1131
  return result;
1132
1132
  };
1133
1133
 
1134
- const swizzleMatrix = new Matrix4(
1135
- 0.0,
1136
- 0.0,
1137
- 1.0,
1138
- 0.0,
1139
- 1.0,
1140
- 0.0,
1141
- 0.0,
1142
- 0.0,
1143
- 0.0,
1144
- 1.0,
1145
- 0.0,
1146
- 0.0,
1147
- 0.0,
1148
- 0.0,
1149
- 0.0,
1150
- 1.0,
1134
+ /**
1135
+ * An immutable matrix that swaps x, y, z for 2D.
1136
+ *
1137
+ * @type {Matrix4}
1138
+ * @constant
1139
+ * @private
1140
+ */
1141
+ Transforms.SWIZZLE_3D_TO_2D_MATRIX = Object.freeze(
1142
+ new Matrix4(
1143
+ 0.0,
1144
+ 0.0,
1145
+ 1.0,
1146
+ 0.0,
1147
+ 1.0,
1148
+ 0.0,
1149
+ 0.0,
1150
+ 0.0,
1151
+ 0.0,
1152
+ 1.0,
1153
+ 0.0,
1154
+ 0.0,
1155
+ 0.0,
1156
+ 0.0,
1157
+ 0.0,
1158
+ 1.0,
1159
+ ),
1151
1160
  );
1152
1161
 
1153
1162
  const scratchCartographic = new Cartographic();
@@ -1210,7 +1219,7 @@ Transforms.basisTo2D = function (projection, matrix, result) {
1210
1219
  const toENU = Matrix4.inverseTransformation(fromENU, scratchToENU);
1211
1220
  const rotation = Matrix4.getMatrix3(matrix, scratchRotation);
1212
1221
  const local = Matrix4.multiplyByMatrix3(toENU, rotation, result);
1213
- Matrix4.multiply(swizzleMatrix, local, result); // Swap x, y, z for 2D
1222
+ Matrix4.multiply(Transforms.SWIZZLE_3D_TO_2D_MATRIX, local, result); // Swap x, y, z for 2D
1214
1223
  Matrix4.setTranslation(result, projectedPosition, result); // Use the projected center
1215
1224
 
1216
1225
  return result;
@@ -1260,7 +1269,7 @@ Transforms.ellipsoidTo2DModelMatrix = function (projection, center, result) {
1260
1269
  projectedPosition,
1261
1270
  scratchFromENU,
1262
1271
  );
1263
- Matrix4.multiply(swizzleMatrix, toENU, result);
1272
+ Matrix4.multiply(Transforms.SWIZZLE_3D_TO_2D_MATRIX, toENU, result);
1264
1273
  Matrix4.multiply(translation, result, result);
1265
1274
 
1266
1275
  return result;
@@ -20,7 +20,7 @@ function DataRectangle(rectangle, maxLevel) {
20
20
  }
21
21
 
22
22
  /**
23
- * @typedef {Object} VRTheWorldTerrainProvider.ConstructorOptions
23
+ * @typedef {object} VRTheWorldTerrainProvider.ConstructorOptions
24
24
  *
25
25
  * Initialization options for the VRTheWorldTerrainProvider constructor
26
26
  *
@@ -265,7 +265,7 @@ Object.defineProperties(VRTheWorldTerrainProvider.prototype, {
265
265
  * Creates a {@link TerrainProvider} that produces terrain geometry by tessellating height maps
266
266
  * retrieved from a {@link http://vr-theworld.com/|VT MÄK VR-TheWorld server}.
267
267
  *
268
- * @param {Resource|String} url The URL of the VR-TheWorld TileMap.
268
+ * @param {Resource|string} url The URL of the VR-TheWorld TileMap.
269
269
  * @param {VRTheWorldTerrainProvider.ConstructorOptions} [options] An object describing initialization options.
270
270
  * @returns {Promise<VRTheWorldTerrainProvider>}
271
271
  *
@@ -4,7 +4,7 @@ import Check from "./Check.js";
4
4
  * Finds an item in a sorted array.
5
5
  *
6
6
  * @function
7
- * @param {Array} array The sorted array to search.
7
+ * @param {Array|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} array The sorted array to search.
8
8
  * @param {*} itemToFind The item to find in the array.
9
9
  * @param {binarySearchComparator} comparator The function to use to compare the item to
10
10
  * elements in the array.
@@ -6,8 +6,8 @@ import Frozen from "./Frozen.js";
6
6
  *
7
7
  * @function
8
8
  *
9
- * @param {Object} [options] Object with the following properties:
10
- * @param {Boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available.
9
+ * @param {object} [options] Object with the following properties:
10
+ * @param {boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available.
11
11
  * @returns {Promise<CesiumTerrainProvider>} A promise that resolves to the created CesiumTerrainProvider
12
12
  *
13
13
  * @see Ion
@@ -7,9 +7,9 @@ import Ellipsoid from "./Ellipsoid.js";
7
7
  *
8
8
  * @function
9
9
  *
10
- * @param {Object} [options] Object with the following properties:
11
- * @param {Boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available.
12
- * @param {Boolean} [options.requestWaterMask=false] Flag that indicates if the client should request per tile water masks from the server if available.
10
+ * @param {object} [options] Object with the following properties:
11
+ * @param {boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available.
12
+ * @param {boolean} [options.requestWaterMask=false] Flag that indicates if the client should request per tile water masks from the server if available.
13
13
  * @returns {Promise<CesiumTerrainProvider>} A promise that resolves to the created CesiumTerrainProvider
14
14
  *
15
15
  * @see Ion
@@ -3,12 +3,18 @@ import defined from "./defined.js";
3
3
  import Resource from "./Resource.js";
4
4
 
5
5
  /**
6
+ * Loads an image from a typed array.
7
+ * @param {Object} options An object containing the following properties:
8
+ * @param {Uint8Array} options.uint8Array The typed array containing the image data.
9
+ * @param {string} options.format The MIME format of the image (e.g., "image/png").
10
+ * @param {Request} [options.request] The request object to use to fetch the image.
11
+ * @param {boolean} [options.flipY=false] Whether to flip the image vertically.
12
+ * @param {boolean} [options.skipColorSpaceConversion=false] Whether to skip color space conversion.
13
+ * @returns {Promise<HTMLImageElement|HTMLCanvasElement|ImageBitmap>|undefined} A promise that resolves to the loaded image. Returns undefined if <code>request.throttle</code> is true and the request does not have high enough priority.
6
14
  * @private
7
15
  */
8
16
  function loadImageFromTypedArray(options) {
9
- const uint8Array = options.uint8Array;
10
- const format = options.format;
11
- const request = options.request;
17
+ const { uint8Array, format, request } = options;
12
18
  const flipY = options.flipY ?? false;
13
19
  const skipColorSpaceConversion = options.skipColorSpaceConversion ?? false;
14
20
  //>>includeStart('debug', pragmas.debug);
@@ -56,7 +56,7 @@ function sort(array, compare, userDefinedObject, start, end) {
56
56
  * A stable merge sort.
57
57
  *
58
58
  * @function mergeSort
59
- * @param {Array} array The array to sort.
59
+ * @param {Array|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} array The array to sort.
60
60
  * @param {mergeSortComparator} comparator The function to use to compare elements in the array.
61
61
  * @param {*} [userDefinedObject] Any item to pass as the third parameter to <code>comparator</code>.
62
62
  *
@@ -10,7 +10,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
10
10
  * Initialization options for the BillboardGraphics constructor
11
11
  *
12
12
  * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the billboard.
13
- * @property {Property | string | HTMLCanvasElement} [image] A Property specifying the Image, URI, or Canvas to use for the billboard.
13
+ * @property {Property | string | HTMLImageElement | HTMLCanvasElement} [image] A Property specifying the Image, URI, or Canvas to use for the billboard.
14
14
  * @property {Property | number} [scale=1.0] A numeric Property specifying the scale to apply to the image size.
15
15
  * @property {Property | Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset.
16
16
  * @property {Property | Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset.
@@ -131,10 +131,6 @@ BillboardVisualizer.prototype.update = function (time) {
131
131
  }
132
132
 
133
133
  billboard.show = show;
134
- if (item.textureValue !== textureValue) {
135
- billboard.image = textureValue;
136
- item.textureValue = textureValue;
137
- }
138
134
  billboard.position = position;
139
135
  billboard.color = Property.getValueOrDefault(
140
136
  billboardGraphics._color,
@@ -227,6 +223,13 @@ BillboardVisualizer.prototype.update = function (time) {
227
223
  defaultSplitDirection,
228
224
  );
229
225
 
226
+ // Apply .image last, so any necessary property values are available
227
+ // in Billboard#_computeImageTextureSize before adding to the atlas.
228
+ if (item.textureValue !== textureValue) {
229
+ billboard.image = textureValue;
230
+ item.textureValue = textureValue;
231
+ }
232
+
230
233
  const subRegion = Property.getValueOrUndefined(
231
234
  billboardGraphics._imageSubRegion,
232
235
  time,
@@ -66,8 +66,8 @@ const timeScratch = new JulianDate();
66
66
  * Gets the value of the property.
67
67
  *
68
68
  * @param {JulianDate} [time=JulianDate.now()] The time for which to retrieve the value. If omitted, the current system time is used.
69
- * @param {Object[]} [result] The object to store the value into, if omitted, a new instance is created and returned.
70
- * @returns {Object[]} The modified result parameter, which is an array of values produced by evaluating each of the contained properties at the given time or a new instance if the result parameter was not supplied.
69
+ * @param {object[]} [result] The object to store the value into, if omitted, a new instance is created and returned.
70
+ * @returns {object[]} The modified result parameter, which is an array of values produced by evaluating each of the contained properties at the given time or a new instance if the result parameter was not supplied.
71
71
  */
72
72
  PropertyArray.prototype.getValue = function (time, result) {
73
73
  if (!defined(time)) {
@@ -161,6 +161,67 @@ const AutomaticUniforms = {
161
161
  },
162
162
  }),
163
163
 
164
+ /**
165
+ * An automatic GLSL uniform representing a texture containing edge IDs
166
+ * from the 3D Tiles edge rendering pass. Used for edge detection and
167
+ * avoiding z-fighting between edges and surfaces.
168
+ *
169
+ * @example
170
+ * // GLSL declaration
171
+ * uniform sampler2D czm_edgeIdTexture;
172
+ *
173
+ * // Get the edge ID at the current fragment
174
+ * vec2 coords = gl_FragCoord.xy / czm_viewport.zw;
175
+ * vec4 edgeId = texture(czm_edgeIdTexture, coords);
176
+ */
177
+ czm_edgeIdTexture: new AutomaticUniform({
178
+ size: 1,
179
+ datatype: WebGLConstants.SAMPLER_2D,
180
+ getValue: function (uniformState) {
181
+ return uniformState.edgeIdTexture;
182
+ },
183
+ }),
184
+
185
+ /**
186
+ * An automatic GLSL uniform containing the edge color texture.
187
+ * This texture contains the edge content rendered during the CESIUM_3D_TILE_EDGES pass.
188
+ *
189
+ * @example
190
+ * // GLSL declaration
191
+ * uniform sampler2D czm_edgeColorTexture;
192
+ *
193
+ * // Sample the edge color at the current fragment
194
+ * vec2 coords = gl_FragCoord.xy / czm_viewport.zw;
195
+ * vec4 edgeColor = texture(czm_edgeColorTexture, coords);
196
+ */
197
+ czm_edgeColorTexture: new AutomaticUniform({
198
+ size: 1,
199
+ datatype: WebGLConstants.SAMPLER_2D,
200
+ getValue: function (uniformState) {
201
+ return uniformState.edgeColorTexture;
202
+ },
203
+ }),
204
+
205
+ /**
206
+ * An automatic GLSL uniform containing the packed depth texture produced by the
207
+ * edge visibility pass. The depth is packed via czm_packDepth and should be
208
+ * unpacked with czm_unpackDepth.
209
+ *
210
+ * @example
211
+ * // GLSL declaration
212
+ * uniform sampler2D czm_edgeDepthTexture;
213
+ *
214
+ * vec2 coords = gl_FragCoord.xy / czm_viewport.zw;
215
+ * float d = czm_unpackDepth(texture(czm_edgeDepthTexture, coords));
216
+ */
217
+ czm_edgeDepthTexture: new AutomaticUniform({
218
+ size: 1,
219
+ datatype: WebGLConstants.SAMPLER_2D,
220
+ getValue: function (uniformState) {
221
+ return uniformState.edgeDepthTexture;
222
+ },
223
+ }),
224
+
164
225
  /**
165
226
  * An automatic GLSL uniform representing a 4x4 model transformation matrix that
166
227
  * transforms model coordinates to world coordinates.
@@ -72,6 +72,26 @@ function Buffer(options) {
72
72
  this.vertexArrayDestroyable = true;
73
73
  }
74
74
 
75
+ Buffer.createPixelBuffer = function (options) {
76
+ //>>includeStart('debug', pragmas.debug);
77
+ Check.defined("options.context", options.context);
78
+ //>>includeEnd('debug');
79
+
80
+ if (!options.context._webgl2) {
81
+ throw new DeveloperError(
82
+ "A WebGL 2 context is required to create PixelBuffers.",
83
+ );
84
+ }
85
+
86
+ return new Buffer({
87
+ context: options.context,
88
+ bufferTarget: WebGLConstants.PIXEL_PACK_BUFFER,
89
+ typedArray: options.typedArray,
90
+ sizeInBytes: options.sizeInBytes,
91
+ usage: options.usage,
92
+ });
93
+ };
94
+
75
95
  /**
76
96
  * Creates a vertex buffer, which contains untyped vertex data in GPU-controlled memory.
77
97
  * <br /><br />
@@ -242,6 +262,18 @@ Buffer.prototype._getBuffer = function () {
242
262
  return this._buffer;
243
263
  };
244
264
 
265
+ Buffer.prototype._bind = function () {
266
+ const gl = this._gl;
267
+ const target = this._bufferTarget;
268
+ gl.bindBuffer(target, this._buffer);
269
+ };
270
+
271
+ Buffer.prototype._unBind = function () {
272
+ const gl = this._gl;
273
+ const target = this._bufferTarget;
274
+ gl.bindBuffer(target, null);
275
+ };
276
+
245
277
  Buffer.prototype.copyFromArrayView = function (arrayView, offsetInBytes) {
246
278
  offsetInBytes = offsetInBytes ?? 0;
247
279
 
@@ -7,12 +7,14 @@ const BufferUsage = {
7
7
  STREAM_DRAW: WebGLConstants.STREAM_DRAW,
8
8
  STATIC_DRAW: WebGLConstants.STATIC_DRAW,
9
9
  DYNAMIC_DRAW: WebGLConstants.DYNAMIC_DRAW,
10
+ DYNAMIC_READ: WebGLConstants.DYNAMIC_READ,
10
11
 
11
12
  validate: function (bufferUsage) {
12
13
  return (
13
14
  bufferUsage === BufferUsage.STREAM_DRAW ||
14
15
  bufferUsage === BufferUsage.STATIC_DRAW ||
15
- bufferUsage === BufferUsage.DYNAMIC_DRAW
16
+ bufferUsage === BufferUsage.DYNAMIC_DRAW ||
17
+ bufferUsage === BufferUsage.DYNAMIC_READ
16
18
  );
17
19
  },
18
20
  };