@cesium/engine 20.0.2-ion.0 → 21.0.1-ion.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 (182) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +637 -0
  2. package/Build/Workers/{chunk-AFKNTEMH.js → chunk-26ZRRKTU.js} +16 -16
  3. package/Build/Workers/{chunk-NKKNQMEH.js → chunk-2PX2ULSM.js} +3 -3
  4. package/Build/Workers/{chunk-OIMV4OE5.js → chunk-3K4DRV7Y.js} +9 -9
  5. package/Build/Workers/{chunk-IS5FETN7.js → chunk-3XTJC4CV.js} +5 -5
  6. package/Build/Workers/{chunk-Z2W7ZIGV.js → chunk-6KX3IUUT.js} +2 -2
  7. package/Build/Workers/{chunk-BHAATGZA.js → chunk-75UG66GR.js} +5 -5
  8. package/Build/Workers/{chunk-YXTWHLJA.js → chunk-ADADBRLI.js} +4 -4
  9. package/Build/Workers/{chunk-CUU3WGXJ.js → chunk-AGT6W3JS.js} +6 -6
  10. package/Build/Workers/{chunk-QID3DXQA.js → chunk-AQ4A5CMC.js} +7 -7
  11. package/Build/Workers/{chunk-MTBXKKSQ.js → chunk-B56XVJRS.js} +12 -12
  12. package/Build/Workers/{chunk-VODCZKV2.js → chunk-DTYIUWZU.js} +4 -4
  13. package/Build/Workers/{chunk-VSMKMGX4.js → chunk-E6T4LSM6.js} +5 -5
  14. package/Build/Workers/{chunk-WZKTQZUW.js → chunk-EEDSGIH7.js} +6 -6
  15. package/Build/Workers/{chunk-FNUSHLOY.js → chunk-EHMAKCWQ.js} +1 -1
  16. package/Build/Workers/{chunk-CYC7JX3P.js → chunk-ESPNIYL5.js} +8 -8
  17. package/Build/Workers/{chunk-LS63ERFB.js → chunk-EZJXK2UP.js} +4 -4
  18. package/Build/Workers/{chunk-Q3OWKSC5.js → chunk-G5RX7BPJ.js} +10 -10
  19. package/Build/Workers/{chunk-FAQ2XNFV.js → chunk-G74UMFQ4.js} +5 -5
  20. package/Build/Workers/{chunk-YUHWFX5H.js → chunk-H3G7OYZY.js} +2 -2
  21. package/Build/Workers/{chunk-6LULWCX3.js → chunk-HDBIC7IL.js} +1 -1
  22. package/Build/Workers/{chunk-WORBFT5H.js → chunk-JESBYOH5.js} +9 -9
  23. package/Build/Workers/{chunk-P2V7PVDH.js → chunk-KGL66RWW.js} +8 -8
  24. package/Build/Workers/{chunk-USK6ZAY2.js → chunk-L73TRTIG.js} +1 -1
  25. package/Build/Workers/{chunk-VA7LWA5Q.js → chunk-LEFV6H2V.js} +9 -9
  26. package/Build/Workers/{chunk-23B3EYUM.js → chunk-LK7H6V2E.js} +4 -4
  27. package/Build/Workers/{chunk-JVG6T2WE.js → chunk-LSNF6CIP.js} +12 -12
  28. package/Build/Workers/{chunk-ABTG74AR.js → chunk-MBIUW42A.js} +1 -1
  29. package/Build/Workers/{chunk-VZNF2GT7.js → chunk-MFPT34BC.js} +4 -4
  30. package/Build/Workers/{chunk-X6GXYB3M.js → chunk-MIFUV36K.js} +1 -1
  31. package/Build/Workers/{chunk-K6THSIDU.js → chunk-MJWRSKJV.js} +2 -2
  32. package/Build/Workers/{chunk-FYYP46TF.js → chunk-NWJRIJQG.js} +2 -2
  33. package/Build/Workers/{chunk-H5IQLAJP.js → chunk-OLH67Z2S.js} +82 -54
  34. package/Build/Workers/{chunk-FHLPYFIW.js → chunk-OWCFUM4Z.js} +13 -13
  35. package/Build/Workers/{chunk-66MGJQFZ.js → chunk-PQW63B2T.js} +2 -2
  36. package/Build/Workers/{chunk-UR36KLNW.js → chunk-RFZAUDYZ.js} +4 -4
  37. package/Build/Workers/{chunk-XWRUYDF6.js → chunk-SDFGZML6.js} +2 -2
  38. package/Build/Workers/{chunk-AHFTST3Q.js → chunk-SF2XXYOB.js} +12 -12
  39. package/Build/Workers/{chunk-QZGZIAK2.js → chunk-SGEAS4NZ.js} +6 -6
  40. package/Build/Workers/{chunk-MFXTB5I4.js → chunk-T7WXNKIA.js} +11 -11
  41. package/Build/Workers/{chunk-H7HFDM3G.js → chunk-TXK2FF6N.js} +5 -5
  42. package/Build/Workers/{chunk-D4XRQNUO.js → chunk-UTL4WVC3.js} +5 -5
  43. package/Build/Workers/{chunk-V6ZGOX4I.js → chunk-UTTKH2UG.js} +7 -7
  44. package/Build/Workers/{chunk-X55ZOYMS.js → chunk-VIDWZGD6.js} +12 -12
  45. package/Build/Workers/{chunk-TZDR2BAP.js → chunk-WIPOMPA5.js} +6 -6
  46. package/Build/Workers/{chunk-CEA3L7M7.js → chunk-WJV24LAS.js} +4 -4
  47. package/Build/Workers/{chunk-F4PS6RFF.js → chunk-WMG6UOCJ.js} +10 -10
  48. package/Build/Workers/{chunk-XIDMFHR4.js → chunk-XFS2ORSO.js} +14 -14
  49. package/Build/Workers/{chunk-VLGVUVJY.js → chunk-XPTKQIVN.js} +6 -6
  50. package/Build/Workers/{chunk-D5X2LOJ2.js → chunk-XYBFMHXA.js} +7 -7
  51. package/Build/Workers/{chunk-YNPZU55A.js → chunk-YFZMB6FZ.js} +6 -6
  52. package/Build/Workers/{chunk-YSDOO7AG.js → chunk-ZOVMWDPW.js} +5 -5
  53. package/Build/Workers/{chunk-5DF5RVIO.js → chunk-ZTGZMKAB.js} +16 -16
  54. package/Build/Workers/combineGeometry.js +21 -21
  55. package/Build/Workers/createBoxGeometry.js +15 -15
  56. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  57. package/Build/Workers/createCircleGeometry.js +23 -23
  58. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  59. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  60. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  61. package/Build/Workers/createCorridorGeometry.js +26 -26
  62. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  63. package/Build/Workers/createCylinderGeometry.js +17 -17
  64. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  65. package/Build/Workers/createEllipseGeometry.js +23 -23
  66. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  67. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  68. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  69. package/Build/Workers/createFrustumGeometry.js +15 -15
  70. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  71. package/Build/Workers/createGeometry.js +21 -21
  72. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  73. package/Build/Workers/createPlaneGeometry.js +13 -13
  74. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  75. package/Build/Workers/createPolygonGeometry.js +29 -29
  76. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  77. package/Build/Workers/createPolylineGeometry.js +22 -22
  78. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  79. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  80. package/Build/Workers/createRectangleGeometry.js +24 -24
  81. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  82. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  83. package/Build/Workers/createSphereGeometry.js +16 -16
  84. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  85. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  86. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  87. package/Build/Workers/createVectorTileGeometries.js +21 -21
  88. package/Build/Workers/createVectorTilePoints.js +11 -11
  89. package/Build/Workers/createVectorTilePolygons.js +19 -19
  90. package/Build/Workers/createVectorTilePolylines.js +12 -12
  91. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
  92. package/Build/Workers/createVerticesFromHeightmap.js +19 -19
  93. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
  94. package/Build/Workers/createWallGeometry.js +21 -21
  95. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  96. package/Build/Workers/decodeDraco.js +10 -10
  97. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  98. package/Build/Workers/decodeI3S.js +9 -9
  99. package/Build/Workers/gaussianSplatSorter.js +4 -4
  100. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  101. package/Build/Workers/transcodeKTX2.js +6 -6
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  104. package/Source/Core/Event.js +94 -53
  105. package/Source/Core/GoogleMaps.js +2 -2
  106. package/Source/Core/Ion.js +1 -1
  107. package/Source/Core/IonResource.js +30 -4
  108. package/Source/Core/Resource.js +5 -1
  109. package/Source/DataSources/KmlDataSource.js +62 -63
  110. package/Source/DataSources/exportKml.js +27 -30
  111. package/Source/Scene/ArcGisMapService.js +1 -1
  112. package/Source/Scene/Azure2DImageryProvider.js +308 -0
  113. package/Source/Scene/Billboard.js +4 -0
  114. package/Source/Scene/BillboardCollection.js +9 -2
  115. package/Source/Scene/ClippingPlaneCollection.js +3 -3
  116. package/Source/Scene/ClippingPolygon.js +91 -2
  117. package/Source/Scene/CreditDisplay.js +1 -1
  118. package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
  119. package/Source/Scene/GaussianSplatPrimitive.js +49 -50
  120. package/Source/Scene/Google2DImageryProvider.js +614 -0
  121. package/Source/Scene/IonImageryProvider.js +22 -1
  122. package/Source/Scene/LabelCollection.js +1 -0
  123. package/Source/Scene/Material.js +248 -80
  124. package/Source/Scene/Primitive.js +6 -0
  125. package/Source/Scene/PrimitiveState.js +123 -0
  126. package/Source/Scene/Scene.js +2 -2
  127. package/Source/Scene/VoxelBoundsCollection.js +494 -0
  128. package/Source/Scene/VoxelBoxShape.js +236 -101
  129. package/Source/Scene/VoxelCylinderShape.js +315 -204
  130. package/Source/Scene/VoxelEllipsoidShape.js +402 -119
  131. package/Source/Scene/VoxelPrimitive.js +119 -84
  132. package/Source/Scene/VoxelRenderResources.js +17 -10
  133. package/Source/Scene/VoxelShape.js +21 -6
  134. package/Source/Scene/buildVoxelDrawCommands.js +61 -20
  135. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
  136. package/Source/Scene/getClippingFunction.js +79 -88
  137. package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
  138. package/Source/Shaders/BillboardCollectionVS.js +2 -0
  139. package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
  140. package/Source/Shaders/Voxels/IntersectBox.js +20 -33
  141. package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
  142. package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
  143. package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
  144. package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
  145. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
  146. package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
  147. package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
  148. package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
  149. package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
  150. package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
  151. package/Source/Shaders/Voxels/Intersection.glsl +3 -3
  152. package/Source/Shaders/Voxels/Intersection.js +3 -3
  153. package/Source/Shaders/Voxels/Octree.glsl +46 -51
  154. package/Source/Shaders/Voxels/Octree.js +46 -51
  155. package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
  156. package/Source/Shaders/Voxels/VoxelFS.js +50 -48
  157. package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
  158. package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
  159. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
  160. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
  161. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
  162. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
  163. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
  164. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
  165. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
  166. package/Source/ThirdParty/zip-module.wasm +0 -0
  167. package/index.d.ts +317 -14
  168. package/index.js +177 -175
  169. package/package.json +2 -2
  170. package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
  171. package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
  172. package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
  173. package/Source/Core/defaultValue.js +0 -48
  174. package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
  175. package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
  176. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
  177. package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
  178. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
  179. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
  180. package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
  181. package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
  182. package/Source/ThirdParty/Workers/z-worker-pako.js +0 -1
@@ -1,6 +1,8 @@
1
+ import defined from "../Core/defined.js";
1
2
  import BoundingSphere from "../Core/BoundingSphere.js";
2
3
  import Cartesian2 from "../Core/Cartesian2.js";
3
4
  import Cartesian3 from "../Core/Cartesian3.js";
5
+ import Cartographic from "../Core/Cartographic.js";
4
6
  import Check from "../Core/Check.js";
5
7
  import Ellipsoid from "../Core/Ellipsoid.js";
6
8
  import CesiumMath from "../Core/Math.js";
@@ -8,6 +10,7 @@ import Matrix3 from "../Core/Matrix3.js";
8
10
  import Matrix4 from "../Core/Matrix4.js";
9
11
  import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
10
12
  import Rectangle from "../Core/Rectangle.js";
13
+ import Transforms from "../Core/Transforms.js";
11
14
 
12
15
  /**
13
16
  * An ellipsoid {@link VoxelShape}.
@@ -23,41 +26,10 @@ import Rectangle from "../Core/Rectangle.js";
23
26
  * @private
24
27
  */
25
28
  function VoxelEllipsoidShape() {
26
- /**
27
- * An oriented bounding box containing the bounded shape.
28
- * The update function must be called before accessing this value.
29
- * @type {OrientedBoundingBox}
30
- * @readonly
31
- * @private
32
- */
33
- this.orientedBoundingBox = new OrientedBoundingBox();
34
-
35
- /**
36
- * A bounding sphere containing the bounded shape.
37
- * The update function must be called before accessing this value.
38
- * @type {BoundingSphere}
39
- * @readonly
40
- * @private
41
- */
42
- this.boundingSphere = new BoundingSphere();
43
-
44
- /**
45
- * A transformation matrix containing the bounded shape.
46
- * The update function must be called before accessing this value.
47
- * @type {Matrix4}
48
- * @readonly
49
- * @private
50
- */
51
- this.boundTransform = new Matrix4();
52
-
53
- /**
54
- * A transformation matrix containing the shape, ignoring the bounds.
55
- * The update function must be called before accessing this value.
56
- * @type {Matrix4}
57
- * @readonly
58
- * @private
59
- */
60
- this.shapeTransform = new Matrix4();
29
+ this._orientedBoundingBox = new OrientedBoundingBox();
30
+ this._boundingSphere = new BoundingSphere();
31
+ this._boundTransform = new Matrix4();
32
+ this._shapeTransform = new Matrix4();
61
33
 
62
34
  /**
63
35
  * @type {Rectangle}
@@ -95,31 +67,25 @@ function VoxelEllipsoidShape() {
95
67
  */
96
68
  this._rotation = new Matrix3();
97
69
 
98
- /**
99
- * @type {Object<string, any>}
100
- * @readonly
101
- * @private
102
- */
103
- this.shaderUniforms = {
104
- ellipsoidRadiiUv: new Cartesian3(),
70
+ this._shaderUniforms = {
71
+ cameraPositionCartographic: new Cartesian3(),
72
+ ellipsoidEcToEastNorthUp: new Matrix3(),
73
+ ellipsoidRadii: new Cartesian3(),
105
74
  eccentricitySquared: 0.0,
106
75
  evoluteScale: new Cartesian2(),
107
- ellipsoidInverseRadiiSquaredUv: new Cartesian3(),
76
+ ellipsoidCurvatureAtLatitude: new Cartesian2(),
77
+ ellipsoidInverseRadiiSquared: new Cartesian3(),
108
78
  ellipsoidRenderLongitudeMinMax: new Cartesian2(),
79
+ ellipsoidShapeUvLongitudeRangeOrigin: 0.0,
109
80
  ellipsoidShapeUvLongitudeMinMaxMid: new Cartesian3(),
110
- ellipsoidUvToShapeUvLongitude: new Cartesian2(),
111
- ellipsoidUvToShapeUvLatitude: new Cartesian2(),
81
+ ellipsoidLocalToShapeUvLongitude: new Cartesian2(),
82
+ ellipsoidLocalToShapeUvLatitude: new Cartesian2(),
112
83
  ellipsoidRenderLatitudeSinMinMax: new Cartesian2(),
113
- ellipsoidInverseHeightDifferenceUv: 0.0,
84
+ ellipsoidInverseHeightDifference: 0.0,
114
85
  clipMinMaxHeight: new Cartesian2(),
115
86
  };
116
87
 
117
- /**
118
- * @type {Object<string, any>}
119
- * @readonly
120
- * @private
121
- */
122
- this.shaderDefines = {
88
+ this._shaderDefines = {
123
89
  ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE: undefined,
124
90
  ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO: undefined,
125
91
  ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF: undefined,
@@ -142,14 +108,103 @@ function VoxelEllipsoidShape() {
142
108
  ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN: undefined,
143
109
  };
144
110
 
111
+ this._shaderMaximumIntersectionsLength = 0; // not known until update
112
+ }
113
+
114
+ Object.defineProperties(VoxelEllipsoidShape.prototype, {
115
+ /**
116
+ * An oriented bounding box containing the bounded shape.
117
+ *
118
+ * @memberof VoxelEllipsoidShape.prototype
119
+ * @type {OrientedBoundingBox}
120
+ * @readonly
121
+ * @private
122
+ */
123
+ orientedBoundingBox: {
124
+ get: function () {
125
+ return this._orientedBoundingBox;
126
+ },
127
+ },
128
+
129
+ /**
130
+ * A bounding sphere containing the bounded shape.
131
+ *
132
+ * @memberof VoxelEllipsoidShape.prototype
133
+ * @type {BoundingSphere}
134
+ * @readonly
135
+ * @private
136
+ */
137
+ boundingSphere: {
138
+ get: function () {
139
+ return this._boundingSphere;
140
+ },
141
+ },
142
+
143
+ /**
144
+ * A transformation matrix containing the bounded shape.
145
+ *
146
+ * @memberof VoxelEllipsoidShape.prototype
147
+ * @type {Matrix4}
148
+ * @readonly
149
+ * @private
150
+ */
151
+ boundTransform: {
152
+ get: function () {
153
+ return this._boundTransform;
154
+ },
155
+ },
156
+
157
+ /**
158
+ * A transformation matrix containing the shape, ignoring the bounds.
159
+ *
160
+ * @memberof VoxelEllipsoidShape.prototype
161
+ * @type {Matrix4}
162
+ * @readonly
163
+ * @private
164
+ */
165
+ shapeTransform: {
166
+ get: function () {
167
+ return this._shapeTransform;
168
+ },
169
+ },
170
+
171
+ /**
172
+ * @memberof VoxelEllipsoidShape.prototype
173
+ * @type {Object<string, any>}
174
+ * @readonly
175
+ * @private
176
+ */
177
+ shaderUniforms: {
178
+ get: function () {
179
+ return this._shaderUniforms;
180
+ },
181
+ },
182
+
183
+ /**
184
+ * @memberof VoxelEllipsoidShape.prototype
185
+ * @type {Object<string, any>}
186
+ * @readonly
187
+ * @private
188
+ */
189
+ shaderDefines: {
190
+ get: function () {
191
+ return this._shaderDefines;
192
+ },
193
+ },
194
+
145
195
  /**
146
196
  * The maximum number of intersections against the shape for any ray direction.
197
+ * @memberof VoxelEllipsoidShape.prototype
147
198
  * @type {number}
148
199
  * @readonly
149
200
  * @private
150
201
  */
151
- this.shaderMaximumIntersectionsLength = 0; // not known until update
152
- }
202
+ shaderMaximumIntersectionsLength: {
203
+ get: function () {
204
+ return this._shaderMaximumIntersectionsLength;
205
+ },
206
+ },
207
+ });
153
208
 
154
209
  const scratchActualMinBounds = new Cartesian3();
155
210
  const scratchShapeMinBounds = new Cartesian3();
@@ -159,7 +214,6 @@ const scratchClipMaxBounds = new Cartesian3();
159
214
  const scratchRenderMinBounds = new Cartesian3();
160
215
  const scratchRenderMaxBounds = new Cartesian3();
161
216
  const scratchScale = new Cartesian3();
162
- const scratchRotationScale = new Matrix3();
163
217
  const scratchShapeOuterExtent = new Cartesian3();
164
218
  const scratchRenderOuterExtent = new Cartesian3();
165
219
  const scratchRenderRectangle = new Rectangle();
@@ -250,7 +304,6 @@ VoxelEllipsoidShape.prototype.update = function (
250
304
  ),
251
305
  scratchShapeOuterExtent,
252
306
  );
253
- const shapeMaxExtent = Cartesian3.maximumComponent(shapeOuterExtent);
254
307
 
255
308
  const renderOuterExtent = Cartesian3.add(
256
309
  radii,
@@ -300,31 +353,31 @@ VoxelEllipsoidShape.prototype.update = function (
300
353
  scratchRenderRectangle,
301
354
  );
302
355
 
303
- this.orientedBoundingBox = getEllipsoidChunkObb(
356
+ this._orientedBoundingBox = getEllipsoidChunkObb(
304
357
  renderRectangle,
305
358
  renderMinBounds.z,
306
359
  renderMaxBounds.z,
307
360
  this._ellipsoid,
308
361
  this._translation,
309
362
  this._rotation,
310
- this.orientedBoundingBox,
363
+ this._orientedBoundingBox,
311
364
  );
312
365
 
313
- this.shapeTransform = Matrix4.fromRotationTranslation(
314
- Matrix3.setScale(this._rotation, shapeOuterExtent, scratchRotationScale),
366
+ this._shapeTransform = Matrix4.fromRotationTranslation(
367
+ this._rotation,
315
368
  this._translation,
316
- this.shapeTransform,
369
+ this._shapeTransform,
317
370
  );
318
371
 
319
- this.boundTransform = Matrix4.fromRotationTranslation(
320
- this.orientedBoundingBox.halfAxes,
321
- this.orientedBoundingBox.center,
322
- this.boundTransform,
372
+ this._boundTransform = Matrix4.fromRotationTranslation(
373
+ this._orientedBoundingBox.halfAxes,
374
+ this._orientedBoundingBox.center,
375
+ this._boundTransform,
323
376
  );
324
377
 
325
- this.boundingSphere = BoundingSphere.fromOrientedBoundingBox(
326
- this.orientedBoundingBox,
327
- this.boundingSphere,
378
+ this._boundingSphere = BoundingSphere.fromOrientedBoundingBox(
379
+ this._orientedBoundingBox,
380
+ this._boundingSphere,
328
381
  );
329
382
 
330
383
  // Longitude
@@ -415,7 +468,8 @@ VoxelEllipsoidShape.prototype.update = function (
415
468
  shapeIsLatitudeMinOverHalf;
416
469
  const shapeHasLatitude = shapeHasLatitudeMax || shapeHasLatitudeMin;
417
470
 
418
- const { shaderUniforms, shaderDefines } = this;
471
+ const shaderUniforms = this._shaderUniforms;
472
+ const shaderDefines = this._shaderDefines;
419
473
 
420
474
  // To keep things simple, clear the defines every time
421
475
  for (const key in shaderDefines) {
@@ -424,30 +478,28 @@ VoxelEllipsoidShape.prototype.update = function (
424
478
  }
425
479
  }
426
480
 
427
- // The ellipsoid radii scaled to [0,1]. The max ellipsoid radius will be 1.0 and others will be less.
428
- shaderUniforms.ellipsoidRadiiUv = Cartesian3.divideByScalar(
481
+ shaderUniforms.ellipsoidRadii = Cartesian3.clone(
429
482
  shapeOuterExtent,
430
- shapeMaxExtent,
431
- shaderUniforms.ellipsoidRadiiUv,
483
+ shaderUniforms.ellipsoidRadii,
432
484
  );
433
- const { x: radiiUvX, z: radiiUvZ } = shaderUniforms.ellipsoidRadiiUv;
434
- const axisRatio = radiiUvZ / radiiUvX;
485
+ const { x: radiiX, z: radiiZ } = shaderUniforms.ellipsoidRadii;
486
+ const axisRatio = radiiZ / radiiX;
435
487
  shaderUniforms.eccentricitySquared = 1.0 - axisRatio * axisRatio;
436
488
  shaderUniforms.evoluteScale = Cartesian2.fromElements(
437
- (radiiUvX * radiiUvX - radiiUvZ * radiiUvZ) / radiiUvX,
438
- (radiiUvZ * radiiUvZ - radiiUvX * radiiUvX) / radiiUvZ,
489
+ (radiiX * radiiX - radiiZ * radiiZ) / radiiX,
490
+ (radiiZ * radiiZ - radiiX * radiiX) / radiiZ,
439
491
  shaderUniforms.evoluteScale,
440
492
  );
441
493
 
442
494
  // Used to compute geodetic surface normal.
443
- shaderUniforms.ellipsoidInverseRadiiSquaredUv = Cartesian3.divideComponents(
495
+ shaderUniforms.ellipsoidInverseRadiiSquared = Cartesian3.divideComponents(
444
496
  Cartesian3.ONE,
445
497
  Cartesian3.multiplyComponents(
446
- shaderUniforms.ellipsoidRadiiUv,
447
- shaderUniforms.ellipsoidRadiiUv,
448
- shaderUniforms.ellipsoidInverseRadiiSquaredUv,
498
+ shaderUniforms.ellipsoidRadii,
499
+ shaderUniforms.ellipsoidRadii,
500
+ shaderUniforms.ellipsoidInverseRadiiSquared,
449
501
  ),
450
- shaderUniforms.ellipsoidInverseRadiiSquaredUv,
502
+ shaderUniforms.ellipsoidInverseRadiiSquared,
451
503
  );
452
504
 
453
505
  // Keep track of how many intersections there are going to be.
@@ -460,16 +512,16 @@ VoxelEllipsoidShape.prototype.update = function (
460
512
  intersectionCount += 1;
461
513
 
462
514
  shaderUniforms.clipMinMaxHeight = Cartesian2.fromElements(
463
- (renderMinBounds.z - shapeMaxBounds.z) / shapeMaxExtent,
464
- (renderMaxBounds.z - shapeMaxBounds.z) / shapeMaxExtent,
515
+ renderMinBounds.z - shapeMaxBounds.z,
516
+ renderMaxBounds.z - shapeMaxBounds.z,
465
517
  shaderUniforms.clipMinMaxHeight,
466
518
  );
467
519
 
468
520
  // The percent of space that is between the inner and outer ellipsoid.
469
- const thickness = (shapeMaxBounds.z - shapeMinBounds.z) / shapeMaxExtent;
470
- shaderUniforms.ellipsoidInverseHeightDifferenceUv = 1.0 / thickness;
521
+ const thickness = shapeMaxBounds.z - shapeMinBounds.z;
522
+ shaderUniforms.ellipsoidInverseHeightDifference = 1.0 / thickness;
471
523
  if (shapeMinBounds.z === shapeMaxBounds.z) {
472
- shaderUniforms.ellipsoidInverseHeightDifferenceUv = 0.0;
524
+ shaderUniforms.ellipsoidInverseHeightDifference = 0.0;
473
525
  }
474
526
 
475
527
  // Intersects a wedge for the min and max longitude.
@@ -501,36 +553,39 @@ VoxelEllipsoidShape.prototype.update = function (
501
553
  if (shapeHasLongitude) {
502
554
  shaderDefines["ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE"] = true;
503
555
 
504
- const shapeIsLongitudeReversed = shapeMaxBounds.x < shapeMinBounds.x;
556
+ const uvShapeMinLongitude =
557
+ (shapeMinBounds.x - DefaultMinBounds.x) / defaultLongitudeRange;
558
+ const uvShapeMaxLongitude =
559
+ (shapeMaxBounds.x - DefaultMinBounds.x) / defaultLongitudeRange;
560
+ const uvLongitudeRangeZero =
561
+ 1.0 - shapeLongitudeRange / defaultLongitudeRange;
562
+ // Translate the origin of UV angles (in [0,1]) to the center of the unoccupied space
563
+ const uvLongitudeRangeOrigin =
564
+ (uvShapeMaxLongitude + 0.5 * uvLongitudeRangeZero) % 1.0;
565
+ shaderUniforms.ellipsoidShapeUvLongitudeRangeOrigin =
566
+ uvLongitudeRangeOrigin;
505
567
 
568
+ const shapeIsLongitudeReversed = shapeMaxBounds.x < shapeMinBounds.x;
506
569
  if (shapeIsLongitudeReversed) {
507
570
  shaderDefines["ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED"] =
508
571
  true;
509
572
  }
510
573
 
511
- // delerp(longitudeUv, minLongitudeUv, maxLongitudeUv)
512
- // (longitudeUv - minLongitudeUv) / (maxLongitudeUv - minLongitudeUv)
513
- // longitudeUv / (maxLongitudeUv - minLongitudeUv) - minLongitudeUv / (maxLongitudeUv - minLongitudeUv)
514
- // scale = 1.0 / (maxLongitudeUv - minLongitudeUv)
515
- // scale = 1.0 / (((maxLongitude - pi) / (2.0 * pi)) - ((minLongitude - pi) / (2.0 * pi)))
516
- // scale = 2.0 * pi / (maxLongitude - minLongitude)
517
- // offset = -minLongitudeUv / (maxLongitudeUv - minLongitudeUv)
518
- // offset = -((minLongitude - pi) / (2.0 * pi)) / (((maxLongitude - pi) / (2.0 * pi)) - ((minLongitude - pi) / (2.0 * pi)))
519
- // offset = -(minLongitude - pi) / (maxLongitude - minLongitude)
520
574
  if (shapeLongitudeRange <= epsilonLongitude) {
521
- shaderUniforms.ellipsoidUvToShapeUvLongitude = Cartesian2.fromElements(
575
+ shaderUniforms.ellipsoidLocalToShapeUvLongitude = Cartesian2.fromElements(
522
576
  0.0,
523
577
  1.0,
524
- shaderUniforms.ellipsoidUvToShapeUvLongitude,
578
+ shaderUniforms.ellipsoidLocalToShapeUvLongitude,
525
579
  );
526
580
  } else {
527
581
  const scale = defaultLongitudeRange / shapeLongitudeRange;
582
+ const shiftedMinLongitude = uvShapeMinLongitude - uvLongitudeRangeOrigin;
528
583
  const offset =
529
- -(shapeMinBounds.x - DefaultMinBounds.x) / shapeLongitudeRange;
530
- shaderUniforms.ellipsoidUvToShapeUvLongitude = Cartesian2.fromElements(
584
+ -scale * (shiftedMinLongitude - Math.floor(shiftedMinLongitude));
585
+ shaderUniforms.ellipsoidLocalToShapeUvLongitude = Cartesian2.fromElements(
531
586
  scale,
532
587
  offset,
533
- shaderUniforms.ellipsoidUvToShapeUvLongitude,
588
+ shaderUniforms.ellipsoidLocalToShapeUvLongitude,
534
589
  );
535
590
  }
536
591
  }
@@ -630,45 +685,92 @@ VoxelEllipsoidShape.prototype.update = function (
630
685
  if (shapeHasLatitude) {
631
686
  shaderDefines["ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE"] = true;
632
687
 
633
- // delerp(latitudeUv, minLatitudeUv, maxLatitudeUv)
634
- // (latitudeUv - minLatitudeUv) / (maxLatitudeUv - minLatitudeUv)
635
- // latitudeUv / (maxLatitudeUv - minLatitudeUv) - minLatitudeUv / (maxLatitudeUv - minLatitudeUv)
636
- // scale = 1.0 / (maxLatitudeUv - minLatitudeUv)
637
- // scale = 1.0 / (((maxLatitude - pi) / (2.0 * pi)) - ((minLatitude - pi) / (2.0 * pi)))
638
- // scale = 2.0 * pi / (maxLatitude - minLatitude)
639
- // offset = -minLatitudeUv / (maxLatitudeUv - minLatitudeUv)
640
- // offset = -((minLatitude - -pi) / (2.0 * pi)) / (((maxLatitude - pi) / (2.0 * pi)) - ((minLatitude - pi) / (2.0 * pi)))
641
- // offset = -(minLatitude - -pi) / (maxLatitude - minLatitude)
642
- // offset = (-pi - minLatitude) / (maxLatitude - minLatitude)
643
688
  if (shapeLatitudeRange < epsilonLatitude) {
644
- shaderUniforms.ellipsoidUvToShapeUvLatitude = Cartesian2.fromElements(
689
+ shaderUniforms.ellipsoidLocalToShapeUvLatitude = Cartesian2.fromElements(
645
690
  0.0,
646
691
  1.0,
647
- shaderUniforms.ellipsoidUvToShapeUvLatitude,
692
+ shaderUniforms.ellipsoidLocalToShapeUvLatitude,
648
693
  );
649
694
  } else {
650
695
  const defaultLatitudeRange = DefaultMaxBounds.y - DefaultMinBounds.y;
651
696
  const scale = defaultLatitudeRange / shapeLatitudeRange;
652
697
  const offset =
653
698
  (DefaultMinBounds.y - shapeMinBounds.y) / shapeLatitudeRange;
654
- shaderUniforms.ellipsoidUvToShapeUvLatitude = Cartesian2.fromElements(
699
+ shaderUniforms.ellipsoidLocalToShapeUvLatitude = Cartesian2.fromElements(
655
700
  scale,
656
701
  offset,
657
- shaderUniforms.ellipsoidUvToShapeUvLatitude,
702
+ shaderUniforms.ellipsoidLocalToShapeUvLatitude,
658
703
  );
659
704
  }
660
705
  }
661
706
 
662
- this.shaderMaximumIntersectionsLength = intersectionCount;
707
+ this._shaderMaximumIntersectionsLength = intersectionCount;
663
708
 
664
709
  return true;
665
710
  };
666
711
 
712
+ const scratchCameraPositionCartographic = new Cartographic();
713
+ const surfacePositionScratch = new Cartesian3();
714
+ const enuTransformScratch = new Matrix4();
715
+ const enuRotationScratch = new Matrix3();
716
+ /**
717
+ * Update any view-dependent transforms.
718
+ * @private
719
+ * @param {FrameState} frameState The frame state.
720
+ */
721
+ VoxelEllipsoidShape.prototype.updateViewTransforms = function (frameState) {
722
+ const shaderUniforms = this._shaderUniforms;
723
+ const ellipsoid = this._ellipsoid;
724
+ // TODO: incorporate modelMatrix or shapeTransform here?
725
+ const cameraWC = frameState.camera.positionWC;
726
+ const cameraPositionCartographic = ellipsoid.cartesianToCartographic(
727
+ cameraWC,
728
+ scratchCameraPositionCartographic,
729
+ );
730
+ Cartesian3.fromElements(
731
+ cameraPositionCartographic.longitude,
732
+ cameraPositionCartographic.latitude,
733
+ cameraPositionCartographic.height,
734
+ shaderUniforms.cameraPositionCartographic,
735
+ );
736
+
737
+ // TODO: incorporate modelMatrix here?
738
+ const surfacePosition = Cartesian3.fromRadians(
739
+ cameraPositionCartographic.longitude,
740
+ cameraPositionCartographic.latitude,
741
+ 0.0,
742
+ ellipsoid,
743
+ surfacePositionScratch,
744
+ );
745
+
746
+ shaderUniforms.ellipsoidCurvatureAtLatitude = ellipsoid.getLocalCurvature(
747
+ surfacePosition,
748
+ shaderUniforms.ellipsoidCurvatureAtLatitude,
749
+ );
750
+
751
+ const enuToWorld = Transforms.eastNorthUpToFixedFrame(
752
+ surfacePosition,
753
+ ellipsoid,
754
+ enuTransformScratch,
755
+ );
756
+ const rotateEnuToWorld = Matrix4.getRotation(enuToWorld, enuRotationScratch);
757
+ const rotateWorldToView = frameState.context.uniformState.viewRotation;
758
+ const rotateEnuToView = Matrix3.multiply(
759
+ rotateWorldToView,
760
+ rotateEnuToWorld,
761
+ enuRotationScratch,
762
+ );
763
+ // Inverse is the transpose since it's a pure rotation.
764
+ shaderUniforms.ellipsoidEcToEastNorthUp = Matrix3.transpose(
765
+ rotateEnuToView,
766
+ shaderUniforms.ellipsoidEcToEastNorthUp,
767
+ );
768
+ };
769
+
667
770
  const scratchRectangle = new Rectangle();
668
771
 
669
772
  /**
670
773
  * Computes an oriented bounding box for a specified tile.
671
- * The update function must be called before calling this function.
672
774
  * @private
673
775
  * @param {number} tileLevel The tile's level.
674
776
  * @param {number} tileX The tile's x coordinate.
@@ -732,13 +834,194 @@ VoxelEllipsoidShape.prototype.computeOrientedBoundingBoxForTile = function (
732
834
  );
733
835
  };
734
836
 
837
+ const scratchQuadrantPosition = new Cartesian2();
838
+ const scratchInverseRadii = new Cartesian2();
839
+ const scratchEllipseTrigs = new Cartesian2();
840
+ const scratchEllipseGuess = new Cartesian2();
841
+ const scratchEvolute = new Cartesian2();
842
+ const scratchQ = new Cartesian2();
843
+
844
+ /**
845
+ * Find the nearest point on an ellipse and its radius.
846
+ * @param {Cartesian2} position
847
+ * @param {Cartesian2} radii
848
+ * @param {Cartesian2} evoluteScale
849
+ * @param {Cartesian3} result The Cartesian3 to store the result in. .x and .y components contain the nearest point on the ellipse, .z contains the local radius of curvature.
850
+ * @returns {Cartesian3} The nearest point on the ellipse and its radius.
851
+ * @private
852
+ */
853
+ function nearestPointAndRadiusOnEllipse(position, radii, evoluteScale, result) {
854
+ // Map to the first quadrant
855
+ const p = Cartesian2.abs(position, scratchQuadrantPosition);
856
+ const inverseRadii = Cartesian2.fromElements(
857
+ 1.0 / radii.x,
858
+ 1.0 / radii.y,
859
+ scratchInverseRadii,
860
+ );
861
+ // We describe the ellipse parametrically: v = radii * vec2(cos(t), sin(t))
862
+ // but store the cos and sin of t in a vec2 for efficiency.
863
+ // Initial guess: t = pi/4
864
+ let tTrigs = Cartesian2.fromElements(
865
+ Math.SQRT1_2,
866
+ Math.SQRT1_2,
867
+ scratchEllipseTrigs,
868
+ );
869
+ // TODO: too much duplication. Move v and evolute declarations inside loop?
870
+ // Initial guess of point on ellipsoid
871
+ let v = Cartesian2.multiplyComponents(radii, tTrigs, scratchEllipseGuess);
872
+ // Center of curvature of the ellipse at v
873
+ let evolute = Cartesian2.fromElements(
874
+ evoluteScale.x * tTrigs.x * tTrigs.x * tTrigs.x,
875
+ evoluteScale.y * tTrigs.y * tTrigs.y * tTrigs.y,
876
+ scratchEvolute,
877
+ );
878
+ for (let i = 0; i < 3; ++i) {
879
+ // Find the (approximate) intersection of p - evolute with the ellipsoid.
880
+ const distance = Cartesian2.magnitude(
881
+ Cartesian2.subtract(v, evolute, scratchQ),
882
+ );
883
+ const direction = Cartesian2.normalize(
884
+ Cartesian2.subtract(p, evolute, scratchQ),
885
+ scratchQ,
886
+ );
887
+ const q = Cartesian2.multiplyByScalar(direction, distance, scratchQ);
888
+ // Update the estimate of t
889
+ tTrigs = Cartesian2.multiplyComponents(
890
+ Cartesian2.add(q, evolute, scratchEllipseTrigs),
891
+ inverseRadii,
892
+ scratchEllipseTrigs,
893
+ );
894
+ tTrigs = Cartesian2.normalize(
895
+ Cartesian2.clamp(
896
+ tTrigs,
897
+ Cartesian2.ZERO,
898
+ Cartesian2.ONE,
899
+ scratchEllipseTrigs,
900
+ ),
901
+ scratchEllipseTrigs,
902
+ );
903
+ v = Cartesian2.multiplyComponents(radii, tTrigs, scratchEllipseGuess);
904
+ evolute = Cartesian2.fromElements(
905
+ evoluteScale.x * tTrigs.x * tTrigs.x * tTrigs.x,
906
+ evoluteScale.y * tTrigs.y * tTrigs.y * tTrigs.y,
907
+ scratchEvolute,
908
+ );
909
+ }
910
+
911
+ // Map back to the original quadrant
912
+ return Cartesian3.fromElements(
913
+ Math.sign(position.x) * v.x,
914
+ Math.sign(position.y) * v.y,
915
+ Cartesian2.magnitude(Cartesian2.subtract(v, evolute, scratchQ)),
916
+ result,
917
+ );
918
+ }
919
+
920
+ const scratchEllipseRadii = new Cartesian2();
921
+ const scratchEllipsePosition = new Cartesian2();
922
+ const scratchSurfacePointAndRadius = new Cartesian3();
923
+ const scratchNormal2d = new Cartesian2();
924
+ /**
925
+ * Convert a UV coordinate to the shape's UV space.
926
+ * @private
927
+ * @param {Cartesian3} positionLocal The local position to convert.
928
+ * @param {Cartesian3} result The Cartesian3 to store the result in.
929
+ * @returns {Cartesian3} The converted UV coordinate.
930
+ */
931
+ VoxelEllipsoidShape.prototype.convertLocalToShapeUvSpace = function (
932
+ positionLocal,
933
+ result,
934
+ ) {
935
+ //>>includeStart('debug', pragmas.debug);
936
+ Check.typeOf.object("positionLocal", positionLocal);
937
+ Check.typeOf.object("result", result);
938
+ //>>includeEnd('debug');
939
+
940
+ let longitude = Math.atan2(positionLocal.y, positionLocal.x);
941
+
942
+ const {
943
+ ellipsoidRadii,
944
+ evoluteScale,
945
+ ellipsoidInverseRadiiSquared,
946
+ ellipsoidInverseHeightDifference,
947
+ ellipsoidShapeUvLongitudeRangeOrigin,
948
+ ellipsoidLocalToShapeUvLongitude,
949
+ ellipsoidLocalToShapeUvLatitude,
950
+ } = this._shaderUniforms;
951
+
952
+ const distanceFromZAxis = Math.hypot(positionLocal.x, positionLocal.y);
953
+ const posEllipse = Cartesian2.fromElements(
954
+ distanceFromZAxis,
955
+ positionLocal.z,
956
+ scratchEllipsePosition,
957
+ );
958
+ const surfacePointAndRadius = nearestPointAndRadiusOnEllipse(
959
+ posEllipse,
960
+ Cartesian2.fromElements(
961
+ ellipsoidRadii.x,
962
+ ellipsoidRadii.z,
963
+ scratchEllipseRadii,
964
+ ),
965
+ evoluteScale,
966
+ scratchSurfacePointAndRadius,
967
+ );
968
+
969
+ const normal2d = Cartesian2.normalize(
970
+ Cartesian2.fromElements(
971
+ surfacePointAndRadius.x * ellipsoidInverseRadiiSquared.x,
972
+ surfacePointAndRadius.y * ellipsoidInverseRadiiSquared.z,
973
+ scratchNormal2d,
974
+ ),
975
+ scratchNormal2d,
976
+ );
977
+ let latitude = Math.atan2(normal2d.y, normal2d.x);
978
+
979
+ const heightSign =
980
+ Cartesian2.magnitude(posEllipse) <
981
+ Cartesian2.magnitude(surfacePointAndRadius)
982
+ ? -1.0
983
+ : 1.0;
984
+ const heightVector = Cartesian2.subtract(
985
+ posEllipse,
986
+ surfacePointAndRadius,
987
+ scratchEllipsePosition,
988
+ );
989
+ let height = heightSign * Cartesian2.magnitude(heightVector);
990
+
991
+ const {
992
+ ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE,
993
+ ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE,
994
+ } = this._shaderDefines;
995
+
996
+ longitude = (longitude + Math.PI) / (2.0 * Math.PI);
997
+ if (defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)) {
998
+ longitude -= ellipsoidShapeUvLongitudeRangeOrigin;
999
+ longitude = longitude - Math.floor(longitude);
1000
+ // Scale and shift so [0, 1] covers the occupied space.
1001
+ longitude =
1002
+ longitude * ellipsoidLocalToShapeUvLongitude.x +
1003
+ ellipsoidLocalToShapeUvLongitude.y;
1004
+ }
1005
+
1006
+ latitude = (latitude + Math.PI / 2.0) / Math.PI;
1007
+ if (defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)) {
1008
+ // Scale and shift so [0, 1] covers the occupied space.
1009
+ latitude =
1010
+ latitude * ellipsoidLocalToShapeUvLatitude.x +
1011
+ ellipsoidLocalToShapeUvLatitude.y;
1012
+ }
1013
+
1014
+ height = 1.0 + height * ellipsoidInverseHeightDifference;
1015
+
1016
+ return Cartesian3.fromElements(longitude, latitude, height, result);
1017
+ };
1018
+
735
1019
  const sampleSizeScratch = new Cartesian3();
736
1020
  const scratchTileMinBounds = new Cartesian3();
737
1021
  const scratchTileMaxBounds = new Cartesian3();
738
1022
 
739
1023
  /**
740
1024
  * Computes an oriented bounding box for a specified sample within a specified tile.
741
- * The update function must be called before calling this function.
742
1025
  * @private
743
1026
  * @param {SpatialNode} spatialNode The spatial node containing the sample
744
1027
  * @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding