@cesium/engine 16.0.0 → 18.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 (160) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +1 -1
  2. package/Build/Workers/{chunk-OWLBD6BL.js → chunk-2AXPWBJG.js} +1 -1
  3. package/Build/Workers/{chunk-PB6SE3SZ.js → chunk-2CAYUY2B.js} +8 -8
  4. package/Build/Workers/{chunk-SCUQTTCN.js → chunk-2NKHPWDY.js} +12 -12
  5. package/Build/Workers/{chunk-YA4XALD5.js → chunk-2QNKQVUT.js} +5 -5
  6. package/Build/Workers/{chunk-WGIOUM2S.js → chunk-3RKVDGRF.js} +8 -8
  7. package/Build/Workers/{chunk-RWAFHSX3.js → chunk-4DSTDGY3.js} +2 -2
  8. package/Build/Workers/{chunk-YL26OJCG.js → chunk-4MIY63FM.js} +13 -13
  9. package/Build/Workers/{chunk-34EWMUFG.js → chunk-5OL6XFNS.js} +1 -1
  10. package/Build/Workers/{chunk-B75OO2DU.js → chunk-5WVF4BK7.js} +5 -5
  11. package/Build/Workers/{chunk-EAWYQ44R.js → chunk-AEGAQ6FD.js} +12 -12
  12. package/Build/Workers/{chunk-4LHK6E47.js → chunk-CES6DHHV.js} +1 -1
  13. package/Build/Workers/{chunk-S3IQBSIB.js → chunk-DINSLSJD.js} +6 -6
  14. package/Build/Workers/{chunk-KV6TEHXY.js → chunk-EHB2OCQX.js} +4 -4
  15. package/Build/Workers/{chunk-NREPBWCX.js → chunk-EXEZHW3P.js} +4 -4
  16. package/Build/Workers/{chunk-ICU72UPR.js → chunk-F4ZAKN4V.js} +2 -2
  17. package/Build/Workers/{chunk-S2NKKWYE.js → chunk-FPYBD2P5.js} +1 -1
  18. package/Build/Workers/{chunk-KKV6XBF5.js → chunk-GAUF4F5A.js} +16 -16
  19. package/Build/Workers/{chunk-ERKJ7IWJ.js → chunk-GM55YFOB.js} +14 -14
  20. package/Build/Workers/{chunk-NB6D74SQ.js → chunk-GS55WTRX.js} +6 -6
  21. package/Build/Workers/{chunk-5TN3LG2T.js → chunk-HQE7KSR4.js} +2 -2
  22. package/Build/Workers/{chunk-EO44CO62.js → chunk-HS76VTVY.js} +2 -2
  23. package/Build/Workers/{chunk-TL5YKZJF.js → chunk-I3BAKR4S.js} +16 -16
  24. package/Build/Workers/{chunk-OMFZ4IN6.js → chunk-IWGMVQGG.js} +9 -9
  25. package/Build/Workers/{chunk-VVTAI2TN.js → chunk-IWZK2AIH.js} +5 -5
  26. package/Build/Workers/{chunk-GQVSADCI.js → chunk-J4MAVE6J.js} +6 -6
  27. package/Build/Workers/{chunk-XF6EBVKV.js → chunk-JF4IYQYC.js} +7 -7
  28. package/Build/Workers/{chunk-CUJH7PS5.js → chunk-KGXTCGX3.js} +12 -12
  29. package/Build/Workers/{chunk-TBSA4MNF.js → chunk-KNA65INJ.js} +4 -4
  30. package/Build/Workers/{chunk-EOIUWEAK.js → chunk-LIPZUYNR.js} +11 -11
  31. package/Build/Workers/{chunk-TEUGW455.js → chunk-LWJWWCZ4.js} +6 -6
  32. package/Build/Workers/{chunk-ORIMMEHO.js → chunk-LZFUG3GO.js} +10 -10
  33. package/Build/Workers/{chunk-COOLDICB.js → chunk-MFGVMUN3.js} +5 -5
  34. package/Build/Workers/{chunk-FW2OX42E.js → chunk-NR7KSD56.js} +3 -3
  35. package/Build/Workers/{chunk-2TQ64T4I.js → chunk-NVJ5JRIM.js} +2 -2
  36. package/Build/Workers/{chunk-OMZGZVHI.js → chunk-NWSAYFZG.js} +6 -6
  37. package/Build/Workers/{chunk-PT6U7UNY.js → chunk-OATG6PKE.js} +12 -12
  38. package/Build/Workers/{chunk-M5J3S3HY.js → chunk-OIHAAHBK.js} +10 -10
  39. package/Build/Workers/{chunk-LCSH4ZOB.js → chunk-QN7JEOQV.js} +5 -5
  40. package/Build/Workers/{chunk-XMKE4XB2.js → chunk-QUSP3NWA.js} +5 -5
  41. package/Build/Workers/{chunk-ZLJDDRGB.js → chunk-RWFYLWSF.js} +9 -9
  42. package/Build/Workers/{chunk-OD4Q7HE5.js → chunk-SIOVJ4L5.js} +4 -4
  43. package/Build/Workers/{chunk-EJJDBH5W.js → chunk-T6B6H3GR.js} +7 -7
  44. package/Build/Workers/{chunk-YFXXUW6U.js → chunk-UK33ZN4K.js} +4 -4
  45. package/Build/Workers/{chunk-V4Y7C25O.js → chunk-VGJSKEIB.js} +4 -4
  46. package/Build/Workers/{chunk-VXAAIRJ7.js → chunk-W6CPO62M.js} +6 -6
  47. package/Build/Workers/{chunk-ILVAXLMC.js → chunk-WGHUCZMX.js} +7 -7
  48. package/Build/Workers/{chunk-GH6I7PBY.js → chunk-WTFZHPUW.js} +5 -5
  49. package/Build/Workers/{chunk-VNDECE6N.js → chunk-WYCR5DWQ.js} +2 -2
  50. package/Build/Workers/{chunk-6B7KGA5P.js → chunk-YV37YFUM.js} +9 -9
  51. package/Build/Workers/{chunk-CQNYYX3N.js → chunk-ZADJ6FRX.js} +4 -4
  52. package/Build/Workers/{chunk-ESED7XBA.js → chunk-ZIP27IX6.js} +6 -6
  53. package/Build/Workers/combineGeometry.js +21 -21
  54. package/Build/Workers/createBoxGeometry.js +15 -15
  55. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  56. package/Build/Workers/createCircleGeometry.js +23 -23
  57. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  60. package/Build/Workers/createCorridorGeometry.js +26 -26
  61. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  62. package/Build/Workers/createCylinderGeometry.js +17 -17
  63. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  64. package/Build/Workers/createEllipseGeometry.js +23 -23
  65. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  66. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  68. package/Build/Workers/createFrustumGeometry.js +15 -15
  69. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  70. package/Build/Workers/createGeometry.js +21 -21
  71. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  72. package/Build/Workers/createPlaneGeometry.js +13 -13
  73. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  74. package/Build/Workers/createPolygonGeometry.js +29 -29
  75. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  76. package/Build/Workers/createPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  79. package/Build/Workers/createRectangleGeometry.js +24 -24
  80. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  81. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  82. package/Build/Workers/createSphereGeometry.js +16 -16
  83. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  86. package/Build/Workers/createVectorTileGeometries.js +21 -21
  87. package/Build/Workers/createVectorTilePoints.js +11 -11
  88. package/Build/Workers/createVectorTilePolygons.js +19 -19
  89. package/Build/Workers/createVectorTilePolylines.js +12 -12
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
  91. package/Build/Workers/createVerticesFromHeightmap.js +19 -19
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
  93. package/Build/Workers/createWallGeometry.js +21 -21
  94. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  95. package/Build/Workers/decodeDraco.js +10 -10
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +9 -9
  98. package/Build/Workers/transcodeKTX2.js +25 -6
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  101. package/Source/Core/Check.d.ts +4 -1
  102. package/Source/Core/ITwinPlatform.js +6 -3
  103. package/Source/Core/Ion.js +1 -1
  104. package/Source/Core/PixelFormat.js +36 -0
  105. package/Source/Core/PolygonGeometry.js +1 -0
  106. package/Source/Core/RectangleOutlineGeometry.js +1 -1
  107. package/Source/Renderer/Texture3D.js +568 -0
  108. package/Source/Renderer/createUniform.js +1 -0
  109. package/Source/Renderer/createUniformArray.js +1 -0
  110. package/Source/Scene/ArcGisMapService.js +1 -1
  111. package/Source/Scene/Cesium3DTilesVoxelProvider.js +18 -23
  112. package/Source/Scene/Cesium3DTileset.js +138 -0
  113. package/Source/Scene/GlobeSurfaceShaderSet.js +4 -5
  114. package/Source/Scene/ImageryLayer.js +21 -6
  115. package/Source/Scene/ImageryLayerCollection.js +3 -2
  116. package/Source/Scene/Model/CartesianRectangle.js +108 -0
  117. package/Source/Scene/Model/ImageryConfiguration.js +25 -0
  118. package/Source/Scene/Model/ImageryCoverage.js +488 -0
  119. package/Source/Scene/Model/ImageryFlags.js +31 -0
  120. package/Source/Scene/Model/ImageryInput.js +60 -0
  121. package/Source/Scene/Model/ImageryPipelineStage.js +1040 -0
  122. package/Source/Scene/Model/MappedPositions.js +84 -0
  123. package/Source/Scene/Model/Model.js +38 -0
  124. package/Source/Scene/Model/ModelImagery.js +403 -0
  125. package/Source/Scene/Model/ModelImageryMapping.js +489 -0
  126. package/Source/Scene/Model/ModelPrimitiveImagery.js +972 -0
  127. package/Source/Scene/Model/ModelReader.js +810 -0
  128. package/Source/Scene/Model/ModelRenderResources.js +13 -0
  129. package/Source/Scene/Model/ModelRuntimePrimitive.js +19 -0
  130. package/Source/Scene/Model/ModelSceneGraph.js +133 -27
  131. package/Source/Scene/Model/NodeRenderResources.js +10 -0
  132. package/Source/Scene/ModelComponents.js +10 -0
  133. package/Source/Scene/QuadtreePrimitive.js +5 -1
  134. package/Source/Scene/VoxelBoxShape.js +38 -81
  135. package/Source/Scene/VoxelCylinderShape.js +128 -262
  136. package/Source/Scene/VoxelPrimitive.js +24 -39
  137. package/Source/Scene/VoxelRenderResources.js +1 -1
  138. package/Source/Scene/processVoxelProperties.js +41 -100
  139. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +0 -1
  140. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +0 -1
  141. package/Source/Shaders/GlobeFS.glsl +22 -0
  142. package/Source/Shaders/GlobeFS.js +22 -0
  143. package/Source/Shaders/Model/MaterialStageFS.glsl +4 -0
  144. package/Source/Shaders/Model/MaterialStageFS.js +4 -0
  145. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  146. package/Source/Shaders/Model/ModelVS.js +4 -0
  147. package/Source/Shaders/PolylineCommon.glsl +1 -1
  148. package/Source/Shaders/PolylineCommon.js +1 -1
  149. package/Source/Shaders/Voxels/IntersectDepth.glsl +10 -3
  150. package/Source/Shaders/Voxels/IntersectDepth.js +10 -3
  151. package/Source/Shaders/Voxels/Intersection.glsl +1 -3
  152. package/Source/Shaders/Voxels/Intersection.js +1 -3
  153. package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -0
  154. package/Source/Shaders/Voxels/IntersectionUtils.js +1 -0
  155. package/Source/Shaders/Voxels/VoxelFS.glsl +37 -24
  156. package/Source/Shaders/Voxels/VoxelFS.js +37 -24
  157. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  158. package/index.d.ts +59 -7
  159. package/index.js +74 -62
  160. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.128
4
+ * Version 1.130
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -25,22 +25,22 @@
25
25
 
26
26
  import {
27
27
  createTaskProcessorWorker_default
28
- } from "./chunk-RWAFHSX3.js";
28
+ } from "./chunk-4DSTDGY3.js";
29
29
  import {
30
30
  WebGLConstants_default
31
- } from "./chunk-34EWMUFG.js";
31
+ } from "./chunk-5OL6XFNS.js";
32
32
  import {
33
33
  RuntimeError_default
34
- } from "./chunk-EO44CO62.js";
34
+ } from "./chunk-HS76VTVY.js";
35
35
  import {
36
36
  Check_default
37
- } from "./chunk-VNDECE6N.js";
37
+ } from "./chunk-WYCR5DWQ.js";
38
38
  import {
39
39
  __commonJS,
40
40
  __require,
41
41
  __toESM,
42
42
  defined_default
43
- } from "./chunk-S2NKKWYE.js";
43
+ } from "./chunk-FPYBD2P5.js";
44
44
 
45
45
  // packages/engine/Source/ThirdParty/Workers/basis_transcoder.js
46
46
  var require_basis_transcoder = __commonJS({
@@ -2552,6 +2552,13 @@ PixelFormat.textureSizeInBytes = function(pixelFormat, pixelDatatype, width, hei
2552
2552
  }
2553
2553
  return componentsLength * PixelDatatype_default.sizeInBytes(pixelDatatype) * width * height;
2554
2554
  };
2555
+ PixelFormat.texture3DSizeInBytes = function(pixelFormat, pixelDatatype, width, height, depth) {
2556
+ let componentsLength = PixelFormat.componentsLength(pixelFormat);
2557
+ if (PixelDatatype_default.isPacked(pixelDatatype)) {
2558
+ componentsLength = 1;
2559
+ }
2560
+ return componentsLength * PixelDatatype_default.sizeInBytes(pixelDatatype) * width * height * depth;
2561
+ };
2555
2562
  PixelFormat.alignmentInBytes = function(pixelFormat, pixelDatatype, width) {
2556
2563
  const mod = PixelFormat.textureSizeInBytes(pixelFormat, pixelDatatype, width, 1) % 4;
2557
2564
  return mod === 0 ? 4 : mod === 2 ? 2 : 1;
@@ -2620,6 +2627,18 @@ PixelFormat.toInternalFormat = function(pixelFormat, pixelDatatype, context) {
2620
2627
  return WebGLConstants_default.R16F;
2621
2628
  }
2622
2629
  }
2630
+ if (pixelDatatype === PixelDatatype_default.UNSIGNED_BYTE) {
2631
+ switch (pixelFormat) {
2632
+ case PixelFormat.RGBA:
2633
+ return WebGLConstants_default.RGBA8;
2634
+ case PixelFormat.RGB:
2635
+ return WebGLConstants_default.RGB8;
2636
+ case PixelFormat.RG:
2637
+ return WebGLConstants_default.RG8;
2638
+ case PixelFormat.RED:
2639
+ return WebGLConstants_default.R8;
2640
+ }
2641
+ }
2623
2642
  return pixelFormat;
2624
2643
  };
2625
2644
  var PixelFormat_default = Object.freeze(PixelFormat);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.128
4
+ * Version 1.130
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.128
4
+ * Version 1.130
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -26,48 +26,48 @@
26
26
  import {
27
27
  EllipsoidalOccluder_default,
28
28
  TerrainEncoding_default
29
- } from "./chunk-OMFZ4IN6.js";
29
+ } from "./chunk-IWGMVQGG.js";
30
30
  import {
31
31
  createTaskProcessorWorker_default
32
- } from "./chunk-RWAFHSX3.js";
32
+ } from "./chunk-4DSTDGY3.js";
33
33
  import {
34
34
  OrientedBoundingBox_default
35
- } from "./chunk-6B7KGA5P.js";
35
+ } from "./chunk-YV37YFUM.js";
36
36
  import {
37
37
  AttributeCompression_default
38
- } from "./chunk-XF6EBVKV.js";
39
- import "./chunk-PB6SE3SZ.js";
40
- import "./chunk-LCSH4ZOB.js";
41
- import "./chunk-TEUGW455.js";
42
- import "./chunk-NB6D74SQ.js";
38
+ } from "./chunk-JF4IYQYC.js";
39
+ import "./chunk-2CAYUY2B.js";
40
+ import "./chunk-QN7JEOQV.js";
41
+ import "./chunk-LWJWWCZ4.js";
42
+ import "./chunk-GS55WTRX.js";
43
43
  import {
44
44
  IndexDatatype_default
45
- } from "./chunk-XMKE4XB2.js";
45
+ } from "./chunk-QUSP3NWA.js";
46
46
  import {
47
47
  BoundingSphere_default
48
- } from "./chunk-GQVSADCI.js";
48
+ } from "./chunk-J4MAVE6J.js";
49
49
  import {
50
50
  Rectangle_default
51
- } from "./chunk-VXAAIRJ7.js";
52
- import "./chunk-YFXXUW6U.js";
51
+ } from "./chunk-W6CPO62M.js";
52
+ import "./chunk-UK33ZN4K.js";
53
53
  import {
54
54
  Cartesian2_default,
55
55
  Cartesian3_default,
56
56
  Cartographic_default,
57
57
  Ellipsoid_default
58
- } from "./chunk-V4Y7C25O.js";
58
+ } from "./chunk-VGJSKEIB.js";
59
59
  import {
60
60
  Math_default
61
- } from "./chunk-FW2OX42E.js";
62
- import "./chunk-34EWMUFG.js";
63
- import "./chunk-EO44CO62.js";
61
+ } from "./chunk-NR7KSD56.js";
62
+ import "./chunk-5OL6XFNS.js";
63
+ import "./chunk-HS76VTVY.js";
64
64
  import {
65
65
  Check_default,
66
66
  DeveloperError_default
67
- } from "./chunk-VNDECE6N.js";
67
+ } from "./chunk-WYCR5DWQ.js";
68
68
  import {
69
69
  defined_default
70
- } from "./chunk-S2NKKWYE.js";
70
+ } from "./chunk-FPYBD2P5.js";
71
71
 
72
72
  // packages/engine/Source/Core/Intersections2D.js
73
73
  var Intersections2D = {};
@@ -38,7 +38,10 @@ const Check: {
38
38
  * @param {*} test The value to test
39
39
  * @exception {DeveloperError} test must be typeof 'object'
40
40
  */
41
- object(name: string, test: any): asserts test is object;
41
+ object(
42
+ name: string,
43
+ test: any,
44
+ ): asserts test is Record<string | number | symbol, any>;
42
45
  /**
43
46
  * Throws if test is not typeof 'boolean'
44
47
  *
@@ -198,8 +198,9 @@ ITwinPlatform.getExports = async function (iModelId) {
198
198
  } catch (error) {
199
199
  const result = JSON.parse(error.response);
200
200
  if (error.statusCode === 401) {
201
+ const code = result.error.details?.[0].code ?? "";
201
202
  throw new RuntimeError(
202
- `Unauthorized, bad token, wrong scopes or headers bad. ${result.error.details[0].code}`,
203
+ `Unauthorized, bad token, wrong scopes or headers bad. ${code}`,
203
204
  );
204
205
  } else if (error.statusCode === 403) {
205
206
  console.error(result.error.code, result.error.message);
@@ -282,8 +283,9 @@ ITwinPlatform.getRealityDataMetadata = async function (iTwinId, realityDataId) {
282
283
  } catch (error) {
283
284
  const result = JSON.parse(error.response);
284
285
  if (error.statusCode === 401) {
286
+ const code = result.error.details?.[0].code ?? "";
285
287
  throw new RuntimeError(
286
- `Unauthorized, bad token, wrong scopes or headers bad. ${result.error.details[0].code}`,
288
+ `Unauthorized, bad token, wrong scopes or headers bad. ${code}`,
287
289
  );
288
290
  } else if (error.statusCode === 403) {
289
291
  console.error(result.error.code, result.error.message);
@@ -354,8 +356,9 @@ ITwinPlatform.getRealityDataURL = async function (
354
356
  } catch (error) {
355
357
  const result = JSON.parse(error.response);
356
358
  if (error.statusCode === 401) {
359
+ const code = result.error.details?.[0].code ?? "";
357
360
  throw new RuntimeError(
358
- `Unauthorized, bad token, wrong scopes or headers bad. ${result.error.details[0].code}`,
361
+ `Unauthorized, bad token, wrong scopes or headers bad. ${code}`,
359
362
  );
360
363
  } else if (error.statusCode === 403) {
361
364
  console.error(result.error.code, result.error.message);
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyNTM5MmUwMy0zM2M2LTQxODAtODA0Yy0xNzg4MTZlYzc1ZmUiLCJpZCI6MjU5LCJpYXQiOjE3NDM1MjIzOTN9.nRQlDkn6eRcBJ_SbJNFii4uikmlbeHZgqzQNiyah2EY";
7
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4ZTlhZTM1MC1lNjM0LTRkNTQtYTE3OC02NWI0YjQ3NTAxNzgiLCJpZCI6MjU5LCJpYXQiOjE3NDg4ODUxMzV9.8mGFxgmp1QW0MIdArET4EVn5c7DKlt_HHA_Gnnu7eF4";
8
8
  /**
9
9
  * Default settings for accessing the Cesium ion API.
10
10
  *
@@ -392,6 +392,29 @@ PixelFormat.textureSizeInBytes = function (
392
392
  );
393
393
  };
394
394
 
395
+ /**
396
+ * @private
397
+ */
398
+ PixelFormat.texture3DSizeInBytes = function (
399
+ pixelFormat,
400
+ pixelDatatype,
401
+ width,
402
+ height,
403
+ depth,
404
+ ) {
405
+ let componentsLength = PixelFormat.componentsLength(pixelFormat);
406
+ if (PixelDatatype.isPacked(pixelDatatype)) {
407
+ componentsLength = 1;
408
+ }
409
+ return (
410
+ componentsLength *
411
+ PixelDatatype.sizeInBytes(pixelDatatype) *
412
+ width *
413
+ height *
414
+ depth
415
+ );
416
+ };
417
+
395
418
  /**
396
419
  * @private
397
420
  */
@@ -499,6 +522,19 @@ PixelFormat.toInternalFormat = function (pixelFormat, pixelDatatype, context) {
499
522
  }
500
523
  }
501
524
 
525
+ if (pixelDatatype === PixelDatatype.UNSIGNED_BYTE) {
526
+ switch (pixelFormat) {
527
+ case PixelFormat.RGBA:
528
+ return WebGLConstants.RGBA8;
529
+ case PixelFormat.RGB:
530
+ return WebGLConstants.RGB8;
531
+ case PixelFormat.RG:
532
+ return WebGLConstants.RG8;
533
+ case PixelFormat.RED:
534
+ return WebGLConstants.R8;
535
+ }
536
+ }
537
+
502
538
  return pixelFormat;
503
539
  };
504
540
 
@@ -876,6 +876,7 @@ const dummyOptions = {
876
876
  * @param {number[]} array The packed array.
877
877
  * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
878
878
  * @param {PolygonGeometry} [result] The object into which to store the result.
879
+ * @returns {PolygonGeometry} The modified result parameter or a new PolygonGeometry instance if one was not provided.
879
880
  */
880
881
  PolygonGeometry.unpack = function (array, startingIndex, result) {
881
882
  //>>includeStart('debug', pragmas.debug);
@@ -364,7 +364,7 @@ const scratchOptions = {
364
364
  * @param {number[]} array The packed array.
365
365
  * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
366
366
  * @param {RectangleOutlineGeometry} [result] The object into which to store the result.
367
- * @returns {RectangleOutlineGeometry} The modified result parameter or a new Quaternion instance if one was not provided.
367
+ * @returns {RectangleOutlineGeometry} The modified result parameter or a new RectangleOutlineGeometry instance if one was not provided.
368
368
  */
369
369
  RectangleOutlineGeometry.unpack = function (array, startingIndex, result) {
370
370
  //>>includeStart('debug', pragmas.debug);