@cesium/engine 3.0.1 → 4.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 (234) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +605 -0
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +800 -0
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +502 -0
  4. package/Build/Workers/chunk-27R2KRIK.js +634 -0
  5. package/Build/Workers/chunk-2C65EKYA.js +55 -0
  6. package/Build/Workers/chunk-2NLMZNJI.js +138 -0
  7. package/Build/Workers/chunk-4V6RCTVH.js +289 -0
  8. package/Build/Workers/chunk-4VWUFKYW.js +368 -0
  9. package/Build/Workers/chunk-527JG4D7.js +629 -0
  10. package/Build/Workers/chunk-5U4UHRZ2.js +8644 -0
  11. package/Build/Workers/chunk-7CZEWQWE.js +353 -0
  12. package/Build/Workers/chunk-7IMAWM6A.js +842 -0
  13. package/Build/Workers/{package.js → chunk-A6EA6KIE.js} +13 -2
  14. package/Build/Workers/chunk-AXGQUPXA.js +1075 -0
  15. package/Build/Workers/chunk-BT6YIL2N.js +39 -0
  16. package/Build/Workers/chunk-C6MRR5YL.js +476 -0
  17. package/Build/Workers/chunk-DJUTBX6A.js +1860 -0
  18. package/Build/Workers/chunk-EQ6ZAP37.js +218 -0
  19. package/Build/Workers/chunk-F7P2HCYZ.js +73 -0
  20. package/Build/Workers/chunk-FE2XG3SS.js +73 -0
  21. package/Build/Workers/chunk-FKHRSGKP.js +781 -0
  22. package/Build/Workers/chunk-FVDTKX3F.js +58 -0
  23. package/Build/Workers/chunk-FYHCAKU6.js +684 -0
  24. package/Build/Workers/chunk-G3MOT7BZ.js +157 -0
  25. package/Build/Workers/chunk-H52L6U76.js +421 -0
  26. package/Build/Workers/chunk-H6MBQ4W4.js +305 -0
  27. package/Build/Workers/chunk-HCZR75II.js +2716 -0
  28. package/Build/Workers/chunk-I5MQWHBR.js +102 -0
  29. package/Build/Workers/chunk-KAFF2QX3.js +258 -0
  30. package/Build/Workers/chunk-LGSGX2RH.js +757 -0
  31. package/Build/Workers/chunk-LQRFWCNX.js +124 -0
  32. package/Build/Workers/chunk-N5MMDSD2.js +44 -0
  33. package/Build/Workers/chunk-NRETMGYL.js +390 -0
  34. package/Build/Workers/chunk-P4M4QUNQ.js +196 -0
  35. package/Build/Workers/chunk-P7PWX5HR.js +430 -0
  36. package/Build/Workers/chunk-PGB3EFR7.js +171 -0
  37. package/Build/Workers/chunk-PW5CA4MJ.js +3273 -0
  38. package/Build/Workers/chunk-PWDYKCNC.js +501 -0
  39. package/Build/Workers/chunk-QIS3NB7U.js +1258 -0
  40. package/Build/Workers/chunk-QVJ6IRKV.js +77 -0
  41. package/Build/Workers/chunk-RDCDRNJ7.js +117 -0
  42. package/Build/Workers/chunk-RDM3BKNC.js +1009 -0
  43. package/Build/Workers/chunk-RRUPTJ6P.js +452 -0
  44. package/Build/Workers/chunk-SGRWJKNO.js +400 -0
  45. package/Build/Workers/chunk-TF5D2H7B.js +138 -0
  46. package/Build/Workers/chunk-TVYIHH4V.js +513 -0
  47. package/Build/Workers/chunk-U5LKG6LX.js +101 -0
  48. package/Build/Workers/chunk-UGZGTV5K.js +302 -0
  49. package/Build/Workers/chunk-UN7AK64D.js +163 -0
  50. package/Build/Workers/chunk-V2LKNJGT.js +59 -0
  51. package/Build/Workers/chunk-VSCXSFHE.js +1477 -0
  52. package/Build/Workers/chunk-XJCTFTBM.js +2041 -0
  53. package/Build/Workers/chunk-XZVQMPWG.js +100 -0
  54. package/Build/Workers/chunk-YLAFWVOW.js +834 -0
  55. package/Build/Workers/chunk-YLS3FX3U.js +236 -0
  56. package/Build/Workers/chunk-YMJPANZZ.js +693 -0
  57. package/Build/Workers/combineGeometry.js +65 -15
  58. package/Build/Workers/createBoxGeometry.js +55 -10
  59. package/Build/Workers/createBoxOutlineGeometry.js +231 -310
  60. package/Build/Workers/createCircleGeometry.js +185 -202
  61. package/Build/Workers/createCircleOutlineGeometry.js +141 -155
  62. package/Build/Workers/createCoplanarPolygonGeometry.js +477 -557
  63. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  64. package/Build/Workers/createCorridorGeometry.js +1162 -1307
  65. package/Build/Workers/createCorridorOutlineGeometry.js +533 -569
  66. package/Build/Workers/createCylinderGeometry.js +57 -10
  67. package/Build/Workers/createCylinderOutlineGeometry.js +224 -258
  68. package/Build/Workers/createEllipseGeometry.js +68 -12
  69. package/Build/Workers/createEllipseOutlineGeometry.js +61 -12
  70. package/Build/Workers/createEllipsoidGeometry.js +56 -10
  71. package/Build/Workers/createEllipsoidOutlineGeometry.js +58 -13
  72. package/Build/Workers/createFrustumGeometry.js +55 -10
  73. package/Build/Workers/createFrustumOutlineGeometry.js +226 -243
  74. package/Build/Workers/createGeometry.js +143 -48
  75. package/Build/Workers/createGroundPolylineGeometry.js +1484 -2011
  76. package/Build/Workers/createPlaneGeometry.js +216 -243
  77. package/Build/Workers/createPlaneOutlineGeometry.js +121 -113
  78. package/Build/Workers/createPolygonGeometry.js +1041 -1327
  79. package/Build/Workers/createPolygonOutlineGeometry.js +516 -657
  80. package/Build/Workers/createPolylineGeometry.js +471 -547
  81. package/Build/Workers/createPolylineVolumeGeometry.js +352 -384
  82. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +271 -295
  83. package/Build/Workers/createRectangleGeometry.js +1128 -1331
  84. package/Build/Workers/createRectangleOutlineGeometry.js +445 -500
  85. package/Build/Workers/createSimplePolylineGeometry.js +381 -440
  86. package/Build/Workers/createSphereGeometry.js +112 -118
  87. package/Build/Workers/createSphereOutlineGeometry.js +112 -121
  88. package/Build/Workers/createTaskProcessorWorker.js +32 -127
  89. package/Build/Workers/createVectorTileClampedPolylines.js +462 -505
  90. package/Build/Workers/createVectorTileGeometries.js +377 -436
  91. package/Build/Workers/createVectorTilePoints.js +110 -77
  92. package/Build/Workers/createVectorTilePolygons.js +369 -391
  93. package/Build/Workers/createVectorTilePolylines.js +252 -244
  94. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  95. package/Build/Workers/createVerticesFromHeightmap.js +2244 -2677
  96. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -904
  97. package/Build/Workers/createWallGeometry.js +459 -593
  98. package/Build/Workers/createWallOutlineGeometry.js +324 -419
  99. package/Build/Workers/decodeDraco.js +327 -347
  100. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  101. package/Build/Workers/decodeI3S.js +765 -970
  102. package/Build/Workers/transcodeKTX2.js +3353 -1464
  103. package/Build/Workers/transferTypedArrayTest.js +3 -4
  104. package/Build/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  105. package/LICENSE.md +0 -12
  106. package/Source/Core/FeatureDetection.js +9 -0
  107. package/Source/Core/GoogleMaps.js +1 -1
  108. package/Source/Core/GroundPolylineGeometry.js +3 -2
  109. package/Source/Core/Ion.js +1 -1
  110. package/Source/Core/KTX2Transcoder.js +7 -3
  111. package/Source/Core/RequestScheduler.js +1 -0
  112. package/Source/Core/TaskProcessor.js +150 -146
  113. package/Source/Core/Transforms.js +2 -2
  114. package/Source/Core/buildModuleUrl.js +6 -5
  115. package/Source/DataSources/CzmlDataSource.js +6 -4
  116. package/Source/Scene/ArcGisMapService.js +1 -1
  117. package/Source/Scene/DracoLoader.js +26 -3
  118. package/Source/Scene/GltfLoaderUtil.js +1 -7
  119. package/Source/Scene/I3SDataProvider.js +0 -27
  120. package/Source/Scene/I3SDecoder.js +127 -0
  121. package/Source/Scene/I3SNode.js +32 -110
  122. package/Source/Scene/ImageryLayer.js +2 -2
  123. package/Source/Scene/Implicit3DTileContent.js +13 -0
  124. package/Source/Scene/ImplicitTileset.js +5 -0
  125. package/Source/Scene/Model/I3dmLoader.js +5 -1
  126. package/Source/Scene/Model/Model.js +4 -1
  127. package/Source/Scene/OpenStreetMapImageryProvider.js +7 -4
  128. package/Source/Scene/SingleTileImageryProvider.js +4 -2
  129. package/Source/ThirdParty/Workers/basis_transcoder.js +1 -1
  130. package/Source/{WorkersES6 → Workers}/createGeometry.js +11 -12
  131. package/Source/{WorkersES6 → Workers}/createTaskProcessorWorker.js +43 -59
  132. package/Source/{WorkersES6 → Workers}/decodeDraco.js +19 -25
  133. package/Source/{WorkersES6 → Workers}/decodeI3S.js +18 -32
  134. package/Source/{WorkersES6 → Workers}/transcodeKTX2.js +19 -26
  135. package/Source/Workers/transferTypedArrayTest.js +0 -6
  136. package/index.d.ts +20 -11
  137. package/index.js +170 -169
  138. package/package.json +3 -2
  139. package/Build/Workers/ArcType-2d9abbbc.js +0 -37
  140. package/Build/Workers/AttributeCompression-f9f6c717.js +0 -716
  141. package/Build/Workers/AxisAlignedBoundingBox-4bfd84f3.js +0 -258
  142. package/Build/Workers/BoundingRectangle-5fd6403a.js +0 -369
  143. package/Build/Workers/BoxGeometry-7aa4ce7f.js +0 -884
  144. package/Build/Workers/Check-6ede7e26.js +0 -290
  145. package/Build/Workers/Color-8e135f71.js +0 -2262
  146. package/Build/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  147. package/Build/Workers/CoplanarPolygonGeometryLibrary-59c69b0a.js +0 -132
  148. package/Build/Workers/CorridorGeometryLibrary-63907365.js +0 -498
  149. package/Build/Workers/CylinderGeometry-8fc7c44b.js +0 -467
  150. package/Build/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  151. package/Build/Workers/EllipseGeometry-16b3736a.js +0 -1304
  152. package/Build/Workers/EllipseGeometryLibrary-21262a28.js +0 -366
  153. package/Build/Workers/EllipseOutlineGeometry-05d35d18.js +0 -443
  154. package/Build/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  155. package/Build/Workers/EllipsoidGeometry-a503d1d6.js +0 -637
  156. package/Build/Workers/EllipsoidOutlineGeometry-7b09f24d.js +0 -454
  157. package/Build/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  158. package/Build/Workers/EllipsoidTangentPlane-546c0d5e.js +0 -373
  159. package/Build/Workers/EncodedCartesian3-57415c8a.js +0 -171
  160. package/Build/Workers/FrustumGeometry-87ce8622.js +0 -2540
  161. package/Build/Workers/GeometryAttribute-8fcff0d5.js +0 -619
  162. package/Build/Workers/GeometryAttributes-ad136444.js +0 -91
  163. package/Build/Workers/GeometryInstance-34d9e21e.js +0 -121
  164. package/Build/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  165. package/Build/Workers/GeometryPipeline-70d69a43.js +0 -3690
  166. package/Build/Workers/IndexDatatype-2643aa47.js +0 -200
  167. package/Build/Workers/IntersectionTests-85350792.js +0 -1836
  168. package/Build/Workers/Math-0a2ac845.js +0 -1340
  169. package/Build/Workers/Matrix2-e1298525.js +0 -7086
  170. package/Build/Workers/Matrix3-41c58dde.js +0 -4283
  171. package/Build/Workers/OrientedBoundingBox-29fb0fcd.js +0 -1259
  172. package/Build/Workers/Plane-4c3d403b.js +0 -309
  173. package/Build/Workers/PolygonGeometryLibrary-bad6329a.js +0 -1074
  174. package/Build/Workers/PolygonPipeline-dd13ee78.js +0 -1344
  175. package/Build/Workers/PolylinePipeline-7119eb3f.js +0 -573
  176. package/Build/Workers/PolylineVolumeGeometryLibrary-d25f0050.js +0 -781
  177. package/Build/Workers/PrimitivePipeline-111ee29f.js +0 -966
  178. package/Build/Workers/RectangleGeometryLibrary-bb378fb6.js +0 -280
  179. package/Build/Workers/RuntimeError-ef395448.js +0 -68
  180. package/Build/Workers/TerrainEncoding-c8e029a2.js +0 -1227
  181. package/Build/Workers/Transforms-e2d4a55a.js +0 -14713
  182. package/Build/Workers/VertexFormat-030f11ff.js +0 -312
  183. package/Build/Workers/WallGeometryLibrary-3e0819ec.js +0 -211
  184. package/Build/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  185. package/Build/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  186. package/Build/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  187. package/Build/Workers/cesiumWorkerBootstrapper.js +0 -1363
  188. package/Build/Workers/combine-d9581036.js +0 -82
  189. package/Build/Workers/defaultValue-fe22d8c0.js +0 -51
  190. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  191. package/Source/Workers/cesiumWorkerBootstrapper.js +0 -2290
  192. package/Source/Workers/package.json +0 -1
  193. /package/Source/{WorkersES6 → Workers}/combineGeometry.js +0 -0
  194. /package/Source/{WorkersES6 → Workers}/createBoxGeometry.js +0 -0
  195. /package/Source/{WorkersES6 → Workers}/createBoxOutlineGeometry.js +0 -0
  196. /package/Source/{WorkersES6 → Workers}/createCircleGeometry.js +0 -0
  197. /package/Source/{WorkersES6 → Workers}/createCircleOutlineGeometry.js +0 -0
  198. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonGeometry.js +0 -0
  199. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonOutlineGeometry.js +0 -0
  200. /package/Source/{WorkersES6 → Workers}/createCorridorGeometry.js +0 -0
  201. /package/Source/{WorkersES6 → Workers}/createCorridorOutlineGeometry.js +0 -0
  202. /package/Source/{WorkersES6 → Workers}/createCylinderGeometry.js +0 -0
  203. /package/Source/{WorkersES6 → Workers}/createCylinderOutlineGeometry.js +0 -0
  204. /package/Source/{WorkersES6 → Workers}/createEllipseGeometry.js +0 -0
  205. /package/Source/{WorkersES6 → Workers}/createEllipseOutlineGeometry.js +0 -0
  206. /package/Source/{WorkersES6 → Workers}/createEllipsoidGeometry.js +0 -0
  207. /package/Source/{WorkersES6 → Workers}/createEllipsoidOutlineGeometry.js +0 -0
  208. /package/Source/{WorkersES6 → Workers}/createFrustumGeometry.js +0 -0
  209. /package/Source/{WorkersES6 → Workers}/createFrustumOutlineGeometry.js +0 -0
  210. /package/Source/{WorkersES6 → Workers}/createGroundPolylineGeometry.js +0 -0
  211. /package/Source/{WorkersES6 → Workers}/createPlaneGeometry.js +0 -0
  212. /package/Source/{WorkersES6 → Workers}/createPlaneOutlineGeometry.js +0 -0
  213. /package/Source/{WorkersES6 → Workers}/createPolygonGeometry.js +0 -0
  214. /package/Source/{WorkersES6 → Workers}/createPolygonOutlineGeometry.js +0 -0
  215. /package/Source/{WorkersES6 → Workers}/createPolylineGeometry.js +0 -0
  216. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeGeometry.js +0 -0
  217. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeOutlineGeometry.js +0 -0
  218. /package/Source/{WorkersES6 → Workers}/createRectangleGeometry.js +0 -0
  219. /package/Source/{WorkersES6 → Workers}/createRectangleOutlineGeometry.js +0 -0
  220. /package/Source/{WorkersES6 → Workers}/createSimplePolylineGeometry.js +0 -0
  221. /package/Source/{WorkersES6 → Workers}/createSphereGeometry.js +0 -0
  222. /package/Source/{WorkersES6 → Workers}/createSphereOutlineGeometry.js +0 -0
  223. /package/Source/{WorkersES6 → Workers}/createVectorTileClampedPolylines.js +0 -0
  224. /package/Source/{WorkersES6 → Workers}/createVectorTileGeometries.js +0 -0
  225. /package/Source/{WorkersES6 → Workers}/createVectorTilePoints.js +0 -0
  226. /package/Source/{WorkersES6 → Workers}/createVectorTilePolygons.js +0 -0
  227. /package/Source/{WorkersES6 → Workers}/createVectorTilePolylines.js +0 -0
  228. /package/Source/{WorkersES6 → Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -0
  229. /package/Source/{WorkersES6 → Workers}/createVerticesFromHeightmap.js +0 -0
  230. /package/Source/{WorkersES6 → Workers}/createVerticesFromQuantizedTerrainMesh.js +0 -0
  231. /package/Source/{WorkersES6 → Workers}/createWallGeometry.js +0 -0
  232. /package/Source/{WorkersES6 → Workers}/createWallOutlineGeometry.js +0 -0
  233. /package/Source/{WorkersES6 → Workers}/decodeGoogleEarthEnterprisePacket.js +0 -0
  234. /package/Source/{WorkersES6 → Workers}/upsampleQuantizedTerrainMesh.js +0 -0
@@ -1,716 +0,0 @@
1
- define(['exports', './Matrix2-e1298525', './Matrix3-41c58dde', './ComponentDatatype-cf1fa08e', './Check-6ede7e26', './defaultValue-fe22d8c0', './Math-0a2ac845'], (function (exports, Matrix2, Matrix3, ComponentDatatype, Check, defaultValue, Math$1) { 'use strict';
2
-
3
- /**
4
- * An enum describing the attribute type for glTF and 3D Tiles.
5
- *
6
- * @enum {string}
7
- *
8
- * @private
9
- */
10
- const AttributeType = {
11
- /**
12
- * The attribute is a single component.
13
- *
14
- * @type {string}
15
- * @constant
16
- */
17
- SCALAR: "SCALAR",
18
-
19
- /**
20
- * The attribute is a two-component vector.
21
- *
22
- * @type {string}
23
- * @constant
24
- */
25
- VEC2: "VEC2",
26
-
27
- /**
28
- * The attribute is a three-component vector.
29
- *
30
- * @type {string}
31
- * @constant
32
- */
33
- VEC3: "VEC3",
34
-
35
- /**
36
- * The attribute is a four-component vector.
37
- *
38
- * @type {string}
39
- * @constant
40
- */
41
- VEC4: "VEC4",
42
-
43
- /**
44
- * The attribute is a 2x2 matrix.
45
- *
46
- * @type {string}
47
- * @constant
48
- */
49
- MAT2: "MAT2",
50
-
51
- /**
52
- * The attribute is a 3x3 matrix.
53
- *
54
- * @type {string}
55
- * @constant
56
- */
57
- MAT3: "MAT3",
58
-
59
- /**
60
- * The attribute is a 4x4 matrix.
61
- *
62
- * @type {string}
63
- * @constant
64
- */
65
- MAT4: "MAT4",
66
- };
67
-
68
- /**
69
- * Gets the scalar, vector, or matrix type for the attribute type.
70
- *
71
- * @param {AttributeType} attributeType The attribute type.
72
- * @returns {*} The math type.
73
- *
74
- * @private
75
- */
76
- AttributeType.getMathType = function (attributeType) {
77
- switch (attributeType) {
78
- case AttributeType.SCALAR:
79
- return Number;
80
- case AttributeType.VEC2:
81
- return Matrix2.Cartesian2;
82
- case AttributeType.VEC3:
83
- return Matrix3.Cartesian3;
84
- case AttributeType.VEC4:
85
- return Matrix2.Cartesian4;
86
- case AttributeType.MAT2:
87
- return Matrix2.Matrix2;
88
- case AttributeType.MAT3:
89
- return Matrix3.Matrix3;
90
- case AttributeType.MAT4:
91
- return Matrix2.Matrix4;
92
- //>>includeStart('debug', pragmas.debug);
93
- default:
94
- throw new Check.DeveloperError("attributeType is not a valid value.");
95
- //>>includeEnd('debug');
96
- }
97
- };
98
-
99
- /**
100
- * Gets the number of components per attribute.
101
- *
102
- * @param {AttributeType} attributeType The attribute type.
103
- * @returns {number} The number of components.
104
- *
105
- * @private
106
- */
107
- AttributeType.getNumberOfComponents = function (attributeType) {
108
- switch (attributeType) {
109
- case AttributeType.SCALAR:
110
- return 1;
111
- case AttributeType.VEC2:
112
- return 2;
113
- case AttributeType.VEC3:
114
- return 3;
115
- case AttributeType.VEC4:
116
- case AttributeType.MAT2:
117
- return 4;
118
- case AttributeType.MAT3:
119
- return 9;
120
- case AttributeType.MAT4:
121
- return 16;
122
- //>>includeStart('debug', pragmas.debug);
123
- default:
124
- throw new Check.DeveloperError("attributeType is not a valid value.");
125
- //>>includeEnd('debug');
126
- }
127
- };
128
-
129
- /**
130
- * Get the number of attribute locations needed to fit this attribute. Most
131
- * types require one, but matrices require multiple attribute locations.
132
- *
133
- * @param {AttributeType} attributeType The attribute type.
134
- * @returns {number} The number of attribute locations needed in the shader
135
- *
136
- * @private
137
- */
138
- AttributeType.getAttributeLocationCount = function (attributeType) {
139
- switch (attributeType) {
140
- case AttributeType.SCALAR:
141
- case AttributeType.VEC2:
142
- case AttributeType.VEC3:
143
- case AttributeType.VEC4:
144
- return 1;
145
- case AttributeType.MAT2:
146
- return 2;
147
- case AttributeType.MAT3:
148
- return 3;
149
- case AttributeType.MAT4:
150
- return 4;
151
- //>>includeStart('debug', pragmas.debug);
152
- default:
153
- throw new Check.DeveloperError("attributeType is not a valid value.");
154
- //>>includeEnd('debug');
155
- }
156
- };
157
-
158
- /**
159
- * Gets the GLSL type for the attribute type.
160
- *
161
- * @param {AttributeType} attributeType The attribute type.
162
- * @returns {string} The GLSL type for the attribute type.
163
- *
164
- * @private
165
- */
166
- AttributeType.getGlslType = function (attributeType) {
167
- //>>includeStart('debug', pragmas.debug);
168
- Check.Check.typeOf.string("attributeType", attributeType);
169
- //>>includeEnd('debug');
170
-
171
- switch (attributeType) {
172
- case AttributeType.SCALAR:
173
- return "float";
174
- case AttributeType.VEC2:
175
- return "vec2";
176
- case AttributeType.VEC3:
177
- return "vec3";
178
- case AttributeType.VEC4:
179
- return "vec4";
180
- case AttributeType.MAT2:
181
- return "mat2";
182
- case AttributeType.MAT3:
183
- return "mat3";
184
- case AttributeType.MAT4:
185
- return "mat4";
186
- //>>includeStart('debug', pragmas.debug);
187
- default:
188
- throw new Check.DeveloperError("attributeType is not a valid value.");
189
- //>>includeEnd('debug');
190
- }
191
- };
192
-
193
- var AttributeType$1 = Object.freeze(AttributeType);
194
-
195
- const RIGHT_SHIFT = 1.0 / 256.0;
196
- const LEFT_SHIFT = 256.0;
197
-
198
- /**
199
- * Attribute compression and decompression functions.
200
- *
201
- * @namespace AttributeCompression
202
- *
203
- * @private
204
- */
205
- const AttributeCompression = {};
206
-
207
- /**
208
- * Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding.
209
- *
210
- * Oct encoding is a compact representation of unit length vectors.
211
- * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
212
- * Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/}
213
- *
214
- * @param {Cartesian3} vector The normalized vector to be compressed into 2 component 'oct' encoding.
215
- * @param {Cartesian2} result The 2 component oct-encoded unit length vector.
216
- * @param {number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
217
- * @returns {Cartesian2} The 2 component oct-encoded unit length vector.
218
- *
219
- * @exception {DeveloperError} vector must be normalized.
220
- *
221
- * @see AttributeCompression.octDecodeInRange
222
- */
223
- AttributeCompression.octEncodeInRange = function (vector, rangeMax, result) {
224
- //>>includeStart('debug', pragmas.debug);
225
- Check.Check.defined("vector", vector);
226
- Check.Check.defined("result", result);
227
- const magSquared = Matrix3.Cartesian3.magnitudeSquared(vector);
228
- if (Math.abs(magSquared - 1.0) > Math$1.CesiumMath.EPSILON6) {
229
- throw new Check.DeveloperError("vector must be normalized.");
230
- }
231
- //>>includeEnd('debug');
232
-
233
- result.x =
234
- vector.x / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
235
- result.y =
236
- vector.y / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
237
- if (vector.z < 0) {
238
- const x = result.x;
239
- const y = result.y;
240
- result.x = (1.0 - Math.abs(y)) * Math$1.CesiumMath.signNotZero(x);
241
- result.y = (1.0 - Math.abs(x)) * Math$1.CesiumMath.signNotZero(y);
242
- }
243
-
244
- result.x = Math$1.CesiumMath.toSNorm(result.x, rangeMax);
245
- result.y = Math$1.CesiumMath.toSNorm(result.y, rangeMax);
246
-
247
- return result;
248
- };
249
-
250
- /**
251
- * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding.
252
- *
253
- * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding.
254
- * @param {Cartesian2} result The 2 byte oct-encoded unit length vector.
255
- * @returns {Cartesian2} The 2 byte oct-encoded unit length vector.
256
- *
257
- * @exception {DeveloperError} vector must be normalized.
258
- *
259
- * @see AttributeCompression.octEncodeInRange
260
- * @see AttributeCompression.octDecode
261
- */
262
- AttributeCompression.octEncode = function (vector, result) {
263
- return AttributeCompression.octEncodeInRange(vector, 255, result);
264
- };
265
-
266
- const octEncodeScratch = new Matrix2.Cartesian2();
267
- const uint8ForceArray = new Uint8Array(1);
268
- function forceUint8(value) {
269
- uint8ForceArray[0] = value;
270
- return uint8ForceArray[0];
271
- }
272
- /**
273
- * @param {Cartesian3} vector The normalized vector to be compressed into 4 byte 'oct' encoding.
274
- * @param {Cartesian4} result The 4 byte oct-encoded unit length vector.
275
- * @returns {Cartesian4} The 4 byte oct-encoded unit length vector.
276
- *
277
- * @exception {DeveloperError} vector must be normalized.
278
- *
279
- * @see AttributeCompression.octEncodeInRange
280
- * @see AttributeCompression.octDecodeFromCartesian4
281
- */
282
- AttributeCompression.octEncodeToCartesian4 = function (vector, result) {
283
- AttributeCompression.octEncodeInRange(vector, 65535, octEncodeScratch);
284
- result.x = forceUint8(octEncodeScratch.x * RIGHT_SHIFT);
285
- result.y = forceUint8(octEncodeScratch.x);
286
- result.z = forceUint8(octEncodeScratch.y * RIGHT_SHIFT);
287
- result.w = forceUint8(octEncodeScratch.y);
288
- return result;
289
- };
290
-
291
- /**
292
- * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector.
293
- *
294
- * @param {number} x The x component of the oct-encoded unit length vector.
295
- * @param {number} y The y component of the oct-encoded unit length vector.
296
- * @param {number} rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
297
- * @param {Cartesian3} result The decoded and normalized vector
298
- * @returns {Cartesian3} The decoded and normalized vector.
299
- *
300
- * @exception {DeveloperError} x and y must be unsigned normalized integers between 0 and rangeMax.
301
- *
302
- * @see AttributeCompression.octEncodeInRange
303
- */
304
- AttributeCompression.octDecodeInRange = function (x, y, rangeMax, result) {
305
- //>>includeStart('debug', pragmas.debug);
306
- Check.Check.defined("result", result);
307
- if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) {
308
- throw new Check.DeveloperError(
309
- `x and y must be unsigned normalized integers between 0 and ${rangeMax}`
310
- );
311
- }
312
- //>>includeEnd('debug');
313
-
314
- result.x = Math$1.CesiumMath.fromSNorm(x, rangeMax);
315
- result.y = Math$1.CesiumMath.fromSNorm(y, rangeMax);
316
- result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y));
317
-
318
- if (result.z < 0.0) {
319
- const oldVX = result.x;
320
- result.x = (1.0 - Math.abs(result.y)) * Math$1.CesiumMath.signNotZero(oldVX);
321
- result.y = (1.0 - Math.abs(oldVX)) * Math$1.CesiumMath.signNotZero(result.y);
322
- }
323
-
324
- return Matrix3.Cartesian3.normalize(result, result);
325
- };
326
-
327
- /**
328
- * Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector.
329
- *
330
- * @param {number} x The x component of the oct-encoded unit length vector.
331
- * @param {number} y The y component of the oct-encoded unit length vector.
332
- * @param {Cartesian3} result The decoded and normalized vector.
333
- * @returns {Cartesian3} The decoded and normalized vector.
334
- *
335
- * @exception {DeveloperError} x and y must be an unsigned normalized integer between 0 and 255.
336
- *
337
- * @see AttributeCompression.octDecodeInRange
338
- */
339
- AttributeCompression.octDecode = function (x, y, result) {
340
- return AttributeCompression.octDecodeInRange(x, y, 255, result);
341
- };
342
-
343
- /**
344
- * Decodes a unit-length vector in 4 byte 'oct' encoding to a normalized 3-component vector.
345
- *
346
- * @param {Cartesian4} encoded The oct-encoded unit length vector.
347
- * @param {Cartesian3} result The decoded and normalized vector.
348
- * @returns {Cartesian3} The decoded and normalized vector.
349
- *
350
- * @exception {DeveloperError} x, y, z, and w must be unsigned normalized integers between 0 and 255.
351
- *
352
- * @see AttributeCompression.octDecodeInRange
353
- * @see AttributeCompression.octEncodeToCartesian4
354
- */
355
- AttributeCompression.octDecodeFromCartesian4 = function (encoded, result) {
356
- //>>includeStart('debug', pragmas.debug);
357
- Check.Check.typeOf.object("encoded", encoded);
358
- Check.Check.typeOf.object("result", result);
359
- //>>includeEnd('debug');
360
- const x = encoded.x;
361
- const y = encoded.y;
362
- const z = encoded.z;
363
- const w = encoded.w;
364
- //>>includeStart('debug', pragmas.debug);
365
- if (
366
- x < 0 ||
367
- x > 255 ||
368
- y < 0 ||
369
- y > 255 ||
370
- z < 0 ||
371
- z > 255 ||
372
- w < 0 ||
373
- w > 255
374
- ) {
375
- throw new Check.DeveloperError(
376
- "x, y, z, and w must be unsigned normalized integers between 0 and 255"
377
- );
378
- }
379
- //>>includeEnd('debug');
380
-
381
- const xOct16 = x * LEFT_SHIFT + y;
382
- const yOct16 = z * LEFT_SHIFT + w;
383
- return AttributeCompression.octDecodeInRange(xOct16, yOct16, 65535, result);
384
- };
385
-
386
- /**
387
- * Packs an oct encoded vector into a single floating-point number.
388
- *
389
- * @param {Cartesian2} encoded The oct encoded vector.
390
- * @returns {number} The oct encoded vector packed into a single float.
391
- *
392
- */
393
- AttributeCompression.octPackFloat = function (encoded) {
394
- //>>includeStart('debug', pragmas.debug);
395
- Check.Check.defined("encoded", encoded);
396
- //>>includeEnd('debug');
397
- return 256.0 * encoded.x + encoded.y;
398
- };
399
-
400
- const scratchEncodeCart2 = new Matrix2.Cartesian2();
401
-
402
- /**
403
- * Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding and
404
- * stores those values in a single float-point number.
405
- *
406
- * @param {Cartesian3} vector The normalized vector to be compressed into 2 byte 'oct' encoding.
407
- * @returns {number} The 2 byte oct-encoded unit length vector.
408
- *
409
- * @exception {DeveloperError} vector must be normalized.
410
- */
411
- AttributeCompression.octEncodeFloat = function (vector) {
412
- AttributeCompression.octEncode(vector, scratchEncodeCart2);
413
- return AttributeCompression.octPackFloat(scratchEncodeCart2);
414
- };
415
-
416
- /**
417
- * Decodes a unit-length vector in 'oct' encoding packed in a floating-point number to a normalized 3-component vector.
418
- *
419
- * @param {number} value The oct-encoded unit length vector stored as a single floating-point number.
420
- * @param {Cartesian3} result The decoded and normalized vector
421
- * @returns {Cartesian3} The decoded and normalized vector.
422
- *
423
- */
424
- AttributeCompression.octDecodeFloat = function (value, result) {
425
- //>>includeStart('debug', pragmas.debug);
426
- Check.Check.defined("value", value);
427
- //>>includeEnd('debug');
428
-
429
- const temp = value / 256.0;
430
- const x = Math.floor(temp);
431
- const y = (temp - x) * 256.0;
432
-
433
- return AttributeCompression.octDecode(x, y, result);
434
- };
435
-
436
- /**
437
- * Encodes three normalized vectors into 6 SNORM values in the range of [0-255] following the 'oct' encoding and
438
- * packs those into two floating-point numbers.
439
- *
440
- * @param {Cartesian3} v1 A normalized vector to be compressed.
441
- * @param {Cartesian3} v2 A normalized vector to be compressed.
442
- * @param {Cartesian3} v3 A normalized vector to be compressed.
443
- * @param {Cartesian2} result The 'oct' encoded vectors packed into two floating-point numbers.
444
- * @returns {Cartesian2} The 'oct' encoded vectors packed into two floating-point numbers.
445
- *
446
- */
447
- AttributeCompression.octPack = function (v1, v2, v3, result) {
448
- //>>includeStart('debug', pragmas.debug);
449
- Check.Check.defined("v1", v1);
450
- Check.Check.defined("v2", v2);
451
- Check.Check.defined("v3", v3);
452
- Check.Check.defined("result", result);
453
- //>>includeEnd('debug');
454
-
455
- const encoded1 = AttributeCompression.octEncodeFloat(v1);
456
- const encoded2 = AttributeCompression.octEncodeFloat(v2);
457
-
458
- const encoded3 = AttributeCompression.octEncode(v3, scratchEncodeCart2);
459
- result.x = 65536.0 * encoded3.x + encoded1;
460
- result.y = 65536.0 * encoded3.y + encoded2;
461
- return result;
462
- };
463
-
464
- /**
465
- * Decodes three unit-length vectors in 'oct' encoding packed into a floating-point number to a normalized 3-component vector.
466
- *
467
- * @param {Cartesian2} packed The three oct-encoded unit length vectors stored as two floating-point number.
468
- * @param {Cartesian3} v1 One decoded and normalized vector.
469
- * @param {Cartesian3} v2 One decoded and normalized vector.
470
- * @param {Cartesian3} v3 One decoded and normalized vector.
471
- */
472
- AttributeCompression.octUnpack = function (packed, v1, v2, v3) {
473
- //>>includeStart('debug', pragmas.debug);
474
- Check.Check.defined("packed", packed);
475
- Check.Check.defined("v1", v1);
476
- Check.Check.defined("v2", v2);
477
- Check.Check.defined("v3", v3);
478
- //>>includeEnd('debug');
479
-
480
- let temp = packed.x / 65536.0;
481
- const x = Math.floor(temp);
482
- const encodedFloat1 = (temp - x) * 65536.0;
483
-
484
- temp = packed.y / 65536.0;
485
- const y = Math.floor(temp);
486
- const encodedFloat2 = (temp - y) * 65536.0;
487
-
488
- AttributeCompression.octDecodeFloat(encodedFloat1, v1);
489
- AttributeCompression.octDecodeFloat(encodedFloat2, v2);
490
- AttributeCompression.octDecode(x, y, v3);
491
- };
492
-
493
- /**
494
- * Pack texture coordinates into a single float. The texture coordinates will only preserve 12 bits of precision.
495
- *
496
- * @param {Cartesian2} textureCoordinates The texture coordinates to compress. Both coordinates must be in the range 0.0-1.0.
497
- * @returns {number} The packed texture coordinates.
498
- *
499
- */
500
- AttributeCompression.compressTextureCoordinates = function (
501
- textureCoordinates
502
- ) {
503
- //>>includeStart('debug', pragmas.debug);
504
- Check.Check.defined("textureCoordinates", textureCoordinates);
505
- //>>includeEnd('debug');
506
-
507
- // Move x and y to the range 0-4095;
508
- const x = (textureCoordinates.x * 4095.0) | 0;
509
- const y = (textureCoordinates.y * 4095.0) | 0;
510
- return 4096.0 * x + y;
511
- };
512
-
513
- /**
514
- * Decompresses texture coordinates that were packed into a single float.
515
- *
516
- * @param {number} compressed The compressed texture coordinates.
517
- * @param {Cartesian2} result The decompressed texture coordinates.
518
- * @returns {Cartesian2} The modified result parameter.
519
- *
520
- */
521
- AttributeCompression.decompressTextureCoordinates = function (
522
- compressed,
523
- result
524
- ) {
525
- //>>includeStart('debug', pragmas.debug);
526
- Check.Check.defined("compressed", compressed);
527
- Check.Check.defined("result", result);
528
- //>>includeEnd('debug');
529
-
530
- const temp = compressed / 4096.0;
531
- const xZeroTo4095 = Math.floor(temp);
532
- result.x = xZeroTo4095 / 4095.0;
533
- result.y = (compressed - xZeroTo4095 * 4096) / 4095;
534
- return result;
535
- };
536
-
537
- function zigZagDecode(value) {
538
- return (value >> 1) ^ -(value & 1);
539
- }
540
-
541
- /**
542
- * Decodes delta and ZigZag encoded vertices. This modifies the buffers in place.
543
- *
544
- * @param {Uint16Array} uBuffer The buffer view of u values.
545
- * @param {Uint16Array} vBuffer The buffer view of v values.
546
- * @param {Uint16Array} [heightBuffer] The buffer view of height values.
547
- *
548
- * @see {@link https://github.com/CesiumGS/quantized-mesh|quantized-mesh-1.0 terrain format}
549
- */
550
- AttributeCompression.zigZagDeltaDecode = function (
551
- uBuffer,
552
- vBuffer,
553
- heightBuffer
554
- ) {
555
- //>>includeStart('debug', pragmas.debug);
556
- Check.Check.defined("uBuffer", uBuffer);
557
- Check.Check.defined("vBuffer", vBuffer);
558
- Check.Check.typeOf.number.equals(
559
- "uBuffer.length",
560
- "vBuffer.length",
561
- uBuffer.length,
562
- vBuffer.length
563
- );
564
- if (defaultValue.defined(heightBuffer)) {
565
- Check.Check.typeOf.number.equals(
566
- "uBuffer.length",
567
- "heightBuffer.length",
568
- uBuffer.length,
569
- heightBuffer.length
570
- );
571
- }
572
- //>>includeEnd('debug');
573
-
574
- const count = uBuffer.length;
575
-
576
- let u = 0;
577
- let v = 0;
578
- let height = 0;
579
-
580
- for (let i = 0; i < count; ++i) {
581
- u += zigZagDecode(uBuffer[i]);
582
- v += zigZagDecode(vBuffer[i]);
583
-
584
- uBuffer[i] = u;
585
- vBuffer[i] = v;
586
-
587
- if (defaultValue.defined(heightBuffer)) {
588
- height += zigZagDecode(heightBuffer[i]);
589
- heightBuffer[i] = height;
590
- }
591
- }
592
- };
593
-
594
- /**
595
- * Dequantizes a quantized typed array into a floating point typed array.
596
- *
597
- * @see {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data}
598
- *
599
- * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array} typedArray The typed array for the quantized data.
600
- * @param {ComponentDatatype} componentDatatype The component datatype of the quantized data.
601
- * @param {AttributeType} type The attribute type of the quantized data.
602
- * @param {number} count The number of attributes referenced in the dequantized array.
603
- *
604
- * @returns {Float32Array} The dequantized array.
605
- */
606
- AttributeCompression.dequantize = function (
607
- typedArray,
608
- componentDatatype,
609
- type,
610
- count
611
- ) {
612
- //>>includeStart('debug', pragmas.debug);
613
- Check.Check.defined("typedArray", typedArray);
614
- Check.Check.defined("componentDatatype", componentDatatype);
615
- Check.Check.defined("type", type);
616
- Check.Check.defined("count", count);
617
- //>>includeEnd('debug');
618
-
619
- const componentsPerAttribute = AttributeType$1.getNumberOfComponents(type);
620
-
621
- let divisor;
622
- switch (componentDatatype) {
623
- case ComponentDatatype.ComponentDatatype.BYTE:
624
- divisor = 127.0;
625
- break;
626
- case ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE:
627
- divisor = 255.0;
628
- break;
629
- case ComponentDatatype.ComponentDatatype.SHORT:
630
- divisor = 32767.0;
631
- break;
632
- case ComponentDatatype.ComponentDatatype.UNSIGNED_SHORT:
633
- divisor = 65535.0;
634
- break;
635
- case ComponentDatatype.ComponentDatatype.INT:
636
- divisor = 2147483647.0;
637
- break;
638
- case ComponentDatatype.ComponentDatatype.UNSIGNED_INT:
639
- divisor = 4294967295.0;
640
- break;
641
- //>>includeStart('debug', pragmas.debug);
642
- default:
643
- throw new Check.DeveloperError(
644
- `Cannot dequantize component datatype: ${componentDatatype}`
645
- );
646
- //>>includeEnd('debug');
647
- }
648
-
649
- const dequantizedTypedArray = new Float32Array(
650
- count * componentsPerAttribute
651
- );
652
-
653
- for (let i = 0; i < count; i++) {
654
- for (let j = 0; j < componentsPerAttribute; j++) {
655
- const index = i * componentsPerAttribute + j;
656
- dequantizedTypedArray[index] = Math.max(
657
- typedArray[index] / divisor,
658
- -1.0
659
- );
660
- }
661
- }
662
-
663
- return dequantizedTypedArray;
664
- };
665
-
666
- /**
667
- * Decode RGB565-encoded colors into a floating point typed array containing
668
- * normalized RGB values.
669
- *
670
- * @param {Uint16Array} typedArray Array of RGB565 values
671
- * @param {Float32Array} [result] Array to store the normalized VEC3 result
672
- */
673
- AttributeCompression.decodeRGB565 = function (typedArray, result) {
674
- //>>includeStart('debug', pragmas.debug);
675
- Check.Check.defined("typedArray", typedArray);
676
-
677
- const expectedLength = typedArray.length * 3;
678
- if (defaultValue.defined(result)) {
679
- Check.Check.typeOf.number.equals(
680
- "result.length",
681
- "typedArray.length * 3",
682
- result.length,
683
- expectedLength
684
- );
685
- }
686
- //>>includeEnd('debug');
687
-
688
- const count = typedArray.length;
689
- if (!defaultValue.defined(result)) {
690
- result = new Float32Array(count * 3);
691
- }
692
-
693
- const mask5 = (1 << 5) - 1;
694
- const mask6 = (1 << 6) - 1;
695
- const normalize5 = 1.0 / 31.0;
696
- const normalize6 = 1.0 / 63.0;
697
- for (let i = 0; i < count; i++) {
698
- const value = typedArray[i];
699
- const red = value >> 11;
700
- const green = (value >> 5) & mask6;
701
- const blue = value & mask5;
702
-
703
- const offset = 3 * i;
704
- result[offset] = red * normalize5;
705
- result[offset + 1] = green * normalize6;
706
- result[offset + 2] = blue * normalize5;
707
- }
708
-
709
- return result;
710
- };
711
-
712
- var AttributeCompression$1 = AttributeCompression;
713
-
714
- exports.AttributeCompression = AttributeCompression$1;
715
-
716
- }));