@cesium/engine 7.0.0 → 9.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 (200) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +1 -5
  2. package/Build/Workers/{chunk-7XEAYGZK.js → chunk-24YTYWNB.js} +10 -10
  3. package/Build/Workers/{chunk-IQBYFRVW.js → chunk-2632RVPI.js} +7 -7
  4. package/Build/Workers/chunk-2KACWKS4.js +501 -0
  5. package/Build/Workers/{chunk-QZAD5O7I.js → chunk-2XPLH3JY.js} +7 -7
  6. package/Build/Workers/{chunk-JY5YEZFA.js → chunk-2ZBL3MVO.js} +8 -8
  7. package/Build/Workers/{chunk-ZK5JOS3D.js → chunk-3NCVAGDA.js} +14 -14
  8. package/Build/Workers/{chunk-AR5DNBJ4.js → chunk-5R6VWLMH.js} +6 -6
  9. package/Build/Workers/{chunk-PTQQUQC3.js → chunk-5TIV3L26.js} +13 -13
  10. package/Build/Workers/{chunk-BZP4T2JJ.js → chunk-6WF3KIF5.js} +10 -10
  11. package/Build/Workers/{chunk-5WQ523AW.js → chunk-73FKKY52.js} +5 -5
  12. package/Build/Workers/{chunk-F6SE42BK.js → chunk-7COR472O.js} +15 -472
  13. package/Build/Workers/{chunk-72SANQJV.js → chunk-ADOVHYWO.js} +9 -5
  14. package/Build/Workers/{chunk-5YLJ77FF.js → chunk-BCU2LH5T.js} +12 -11
  15. package/Build/Workers/{chunk-4EBHOMFX.js → chunk-C3XBUYBO.js} +17 -17
  16. package/Build/Workers/{chunk-IX2JCCNM.js → chunk-C6OI26DR.js} +1 -1
  17. package/Build/Workers/{chunk-2HJWSU7B.js → chunk-CO35JNNE.js} +4 -4
  18. package/Build/Workers/{chunk-OVLG3FRS.js → chunk-DGDUKCJJ.js} +6 -6
  19. package/Build/Workers/{chunk-DTAIXKTO.js → chunk-DPUSFA7S.js} +6 -6
  20. package/Build/Workers/{chunk-R5X4OQT4.js → chunk-E6WXPSJS.js} +7 -7
  21. package/Build/Workers/{chunk-VK3EJHWI.js → chunk-EOXYZ34O.js} +2 -2
  22. package/Build/Workers/{chunk-RAEV7K66.js → chunk-EPKE7GE3.js} +5 -5
  23. package/Build/Workers/{chunk-GV56Q4LU.js → chunk-GFA4SMXV.js} +11 -11
  24. package/Build/Workers/{chunk-NKPBIX7F.js → chunk-GXUXEOE2.js} +1 -1
  25. package/Build/Workers/{chunk-NY3K4IM3.js → chunk-HBQPB6IH.js} +12 -12
  26. package/Build/Workers/{chunk-6HZQPRUS.js → chunk-I37B3MZ2.js} +1 -1
  27. package/Build/Workers/{chunk-VRGFV2UO.js → chunk-L4BW3RUA.js} +10 -10
  28. package/Build/Workers/{chunk-6VJVYK2V.js → chunk-LAQP3SCC.js} +2 -2
  29. package/Build/Workers/{chunk-PNBGBETF.js → chunk-LQJ5FFFR.js} +10 -10
  30. package/Build/Workers/{chunk-UAEW6HKG.js → chunk-M2AYBTNH.js} +13 -13
  31. package/Build/Workers/{chunk-YUCVWAY6.js → chunk-MWV7IZK4.js} +7 -7
  32. package/Build/Workers/{chunk-JXDC723O.js → chunk-N4KXMWQU.js} +2 -2
  33. package/Build/Workers/{chunk-XWXM2O2R.js → chunk-NP2GYYE5.js} +6 -6
  34. package/Build/Workers/{chunk-GEJTYLCO.js → chunk-NZWNZA6S.js} +5 -5
  35. package/Build/Workers/{chunk-LZGHD6NY.js → chunk-P2YAAMT2.js} +15 -15
  36. package/Build/Workers/{chunk-S6SKF6DT.js → chunk-P4XKB3QZ.js} +5 -5
  37. package/Build/Workers/{chunk-U2VCRRQW.js → chunk-PXB7T27O.js} +6 -6
  38. package/Build/Workers/{chunk-RV7ZYPFT.js → chunk-QCQUZGXI.js} +4 -4
  39. package/Build/Workers/{chunk-JJ4VBOQ3.js → chunk-QKBGRKKG.js} +4 -4
  40. package/Build/Workers/{chunk-ODW7WYM4.js → chunk-RMOEYCZW.js} +2 -2
  41. package/Build/Workers/{chunk-ZUA2UUNV.js → chunk-RSJXEO2A.js} +2 -2
  42. package/Build/Workers/{chunk-UDO6BFSF.js → chunk-RV7ZOSS6.js} +13 -13
  43. package/Build/Workers/{chunk-LZ7JIV3K.js → chunk-SE4PXOEA.js} +17 -17
  44. package/Build/Workers/{chunk-S4MAZ3SS.js → chunk-SS4ESNE3.js} +2 -2
  45. package/Build/Workers/{chunk-AIPU2VSX.js → chunk-TJBU6GML.js} +6 -6
  46. package/Build/Workers/{chunk-5M3U6ZMA.js → chunk-TZORKRNK.js} +1 -1
  47. package/Build/Workers/{chunk-MY3VNFGQ.js → chunk-VR5RBW52.js} +7 -7
  48. package/Build/Workers/{chunk-FP6GYBFX.js → chunk-WHUSTDIB.js} +10 -10
  49. package/Build/Workers/{chunk-5HDYHG3F.js → chunk-X2F6BEPY.js} +13 -13
  50. package/Build/Workers/{chunk-WZU2YLWG.js → chunk-X6XOMPWL.js} +3 -3
  51. package/Build/Workers/{chunk-UGK3FCDY.js → chunk-YDVSBWEO.js} +1 -1
  52. package/Build/Workers/{chunk-46UD5ABS.js → chunk-YV4H2Y7M.js} +4 -4
  53. package/Build/Workers/{chunk-WBQCVXR3.js → chunk-Z7FQLK6N.js} +4 -4
  54. package/Build/Workers/{chunk-L2ZN645J.js → chunk-ZNVSKMQ2.js} +6 -6
  55. package/Build/Workers/{chunk-JCNXK6EL.js → chunk-ZYPTP7GS.js} +11 -11
  56. package/Build/Workers/combineGeometry.js +24 -23
  57. package/Build/Workers/createBoxGeometry.js +18 -17
  58. package/Build/Workers/createBoxOutlineGeometry.js +16 -15
  59. package/Build/Workers/createCircleGeometry.js +26 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +19 -18
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
  63. package/Build/Workers/createCorridorGeometry.js +29 -28
  64. package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
  65. package/Build/Workers/createCylinderGeometry.js +20 -19
  66. package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
  67. package/Build/Workers/createEllipseGeometry.js +26 -25
  68. package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
  69. package/Build/Workers/createEllipsoidGeometry.js +19 -18
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
  71. package/Build/Workers/createFrustumGeometry.js +18 -17
  72. package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
  73. package/Build/Workers/createGeometry.js +54 -33
  74. package/Build/Workers/createGroundPolylineGeometry.js +22 -21
  75. package/Build/Workers/createPlaneGeometry.js +16 -15
  76. package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
  77. package/Build/Workers/createPolygonGeometry.js +33 -32
  78. package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
  79. package/Build/Workers/createPolylineGeometry.js +25 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +31 -30
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
  82. package/Build/Workers/createRectangleGeometry.js +27 -26
  83. package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +23 -22
  85. package/Build/Workers/createSphereGeometry.js +19 -18
  86. package/Build/Workers/createSphereOutlineGeometry.js +18 -17
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  89. package/Build/Workers/createVectorTileGeometries.js +24 -23
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +22 -21
  92. package/Build/Workers/createVectorTilePolylines.js +14 -14
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
  94. package/Build/Workers/createVerticesFromHeightmap.js +22 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
  96. package/Build/Workers/createWallGeometry.js +24 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +23 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +601 -92
  101. package/Build/Workers/transcodeKTX2.js +7 -7
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
  104. package/Source/Core/Check.d.ts +127 -0
  105. package/Source/Core/Check.js +0 -1
  106. package/Source/Core/Ellipsoid.js +6 -0
  107. package/Source/Core/Geometry.js +1 -1
  108. package/Source/Core/IntersectionTests.js +6 -3
  109. package/Source/Core/Ion.js +1 -1
  110. package/Source/Core/PixelFormat.js +5 -0
  111. package/Source/Core/PolygonGeometry.js +1 -1
  112. package/Source/Core/Transforms.js +3 -0
  113. package/Source/Core/VerticalExaggeration.js +2 -1
  114. package/Source/Core/srgbToLinear.js +32 -0
  115. package/Source/DataSources/CzmlDataSource.js +51 -23
  116. package/Source/DataSources/DataSourceDisplay.js +27 -0
  117. package/Source/DataSources/Entity.js +20 -2
  118. package/Source/DataSources/GeometryUpdaterSet.js +114 -0
  119. package/Source/DataSources/GeometryVisualizer.js +19 -83
  120. package/Source/Renderer/Context.js +10 -0
  121. package/Source/Renderer/ContextLimits.js +2 -0
  122. package/Source/Renderer/demodernizeShader.js +4 -1
  123. package/Source/Scene/ArcGisMapService.js +1 -1
  124. package/Source/Scene/Axis.js +12 -7
  125. package/Source/Scene/Billboard.js +32 -0
  126. package/Source/Scene/BillboardCollection.js +1 -1
  127. package/Source/Scene/BingMapsImageryProvider.js +4 -0
  128. package/Source/Scene/Camera.js +46 -4
  129. package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
  130. package/Source/Scene/Cesium3DTileset.js +10 -7
  131. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
  132. package/Source/Scene/FrameState.js +5 -0
  133. package/Source/Scene/Globe.js +0 -67
  134. package/Source/Scene/GlobeTranslucencyState.js +1 -1
  135. package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
  136. package/Source/Scene/I3SDataProvider.js +270 -53
  137. package/Source/Scene/I3SDecoder.js +8 -1
  138. package/Source/Scene/I3SFeature.js +2 -5
  139. package/Source/Scene/I3SField.js +136 -31
  140. package/Source/Scene/I3SGeometry.js +70 -2
  141. package/Source/Scene/I3SLayer.js +55 -10
  142. package/Source/Scene/I3SNode.js +175 -18
  143. package/Source/Scene/I3SStatistics.js +94 -0
  144. package/Source/Scene/I3SSublayer.js +176 -0
  145. package/Source/Scene/I3SSymbology.js +337 -0
  146. package/Source/Scene/KeyframeNode.js +1 -1
  147. package/Source/Scene/Label.js +33 -0
  148. package/Source/Scene/LabelCollection.js +2 -1
  149. package/Source/Scene/Model/pickModel.js +25 -7
  150. package/Source/Scene/PickFramebuffer.js +37 -2
  151. package/Source/Scene/Picking.js +113 -39
  152. package/Source/Scene/Primitive.js +6 -5
  153. package/Source/Scene/Scene.js +126 -42
  154. package/Source/Scene/ScreenSpaceCameraController.js +21 -7
  155. package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
  156. package/Source/Scene/SpatialNode.js +12 -19
  157. package/Source/Scene/StructuralMetadata.js +1 -1
  158. package/Source/Scene/VoxelBoxShape.js +67 -6
  159. package/Source/Scene/VoxelCell.js +273 -0
  160. package/Source/Scene/VoxelCylinderShape.js +117 -163
  161. package/Source/Scene/VoxelEllipsoidShape.js +255 -304
  162. package/Source/Scene/VoxelPrimitive.js +109 -15
  163. package/Source/Scene/VoxelRenderResources.js +12 -3
  164. package/Source/Scene/VoxelShape.js +7 -4
  165. package/Source/Scene/VoxelTraversal.js +76 -54
  166. package/Source/Scene/buildVoxelDrawCommands.js +23 -0
  167. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
  168. package/Source/Scene/processVoxelProperties.js +3 -0
  169. package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
  170. package/Source/Shaders/Voxels/IntersectBox.js +21 -47
  171. package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
  172. package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
  173. package/Source/Shaders/Voxels/IntersectCylinder.glsl +76 -203
  174. package/Source/Shaders/Voxels/IntersectCylinder.js +76 -203
  175. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +220 -229
  176. package/Source/Shaders/Voxels/IntersectEllipsoid.js +220 -229
  177. package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
  178. package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
  179. package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
  180. package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
  181. package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
  182. package/Source/Shaders/Voxels/Megatexture.js +1 -2
  183. package/Source/Shaders/Voxels/Octree.glsl +14 -9
  184. package/Source/Shaders/Voxels/Octree.js +14 -9
  185. package/Source/Shaders/Voxels/VoxelFS.glsl +128 -40
  186. package/Source/Shaders/Voxels/VoxelFS.js +128 -40
  187. package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
  188. package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
  189. package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
  190. package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
  191. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +64 -40
  192. package/Source/Shaders/Voxels/convertUvToCylinder.js +64 -40
  193. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +100 -91
  194. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +100 -91
  195. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  196. package/Source/Workers/createGeometry.js +40 -11
  197. package/Source/Workers/decodeI3S.js +720 -94
  198. package/index.d.ts +542 -40
  199. package/index.js +75 -66
  200. package/package.json +2 -2
@@ -1,22 +1,19 @@
1
- // See IntersectionUtils.glsl for the definitions of Ray, Intersections,
2
- // setIntersection, setIntersectionPair, INF_HIT, NO_HIT
1
+ // See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, INF_HIT, Intersections,
2
+ // RayShapeIntersection, setSurfaceIntersection, setShapeIntersection
3
+ // See IntersectLongitude.glsl for the definitions of intersectHalfPlane,
4
+ // intersectFlippedWedge, intersectRegularWedge
3
5
 
4
6
  /* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
5
7
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE
6
8
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
7
9
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF
8
- #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF
9
10
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF
10
- #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE
11
11
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF
12
12
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF
13
13
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF
14
14
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF
15
15
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF
16
16
  #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF
17
- #define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX
18
- #define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN
19
- #define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT
20
17
  #define ELLIPSOID_INTERSECTION_INDEX_LONGITUDE
21
18
  #define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX
22
19
  #define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN
@@ -27,205 +24,225 @@
27
24
  #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE)
28
25
  uniform vec2 u_ellipsoidRenderLongitudeMinMax;
29
26
  #endif
30
- #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
31
- uniform vec2 u_ellipsoidRenderLatitudeCosSqrHalfMinMax;
32
- #endif
33
- #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX)
34
- uniform float u_ellipsoidInverseOuterScaleUv;
35
- #endif
36
- #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN)
37
- uniform float u_ellipsoidInverseInnerScaleUv;
38
- #endif
39
-
40
- vec2 intersectZPlane(Ray ray)
41
- {
42
- float o = ray.pos.z;
43
- float d = ray.dir.z;
44
- float t = -o / d;
45
- float s = sign(o);
46
-
47
- if (t >= 0.0 != s >= 0.0) return vec2(t, +INF_HIT);
48
- else return vec2(-INF_HIT, t);
49
- }
50
-
51
- vec4 intersectHalfPlane(Ray ray, float angle) {
52
- vec2 o = ray.pos.xy;
53
- vec2 d = ray.dir.xy;
54
- vec2 planeDirection = vec2(cos(angle), sin(angle));
55
- vec2 planeNormal = vec2(planeDirection.y, -planeDirection.x);
27
+ uniform float u_eccentricitySquared;
28
+ uniform vec2 u_ellipsoidRenderLatitudeSinMinMax;
29
+ uniform vec2 u_clipMinMaxHeight;
56
30
 
57
- float a = dot(o, planeNormal);
58
- float b = dot(d, planeNormal);
59
- float t = -a / b;
31
+ RayShapeIntersection intersectZPlane(in Ray ray, in float z) {
32
+ float t = -ray.pos.z / ray.dir.z;
60
33
 
61
- vec2 p = o + t * d;
62
- bool outside = dot(p, planeDirection) < 0.0;
63
- if (outside) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
34
+ bool startsOutside = sign(ray.pos.z) == sign(z);
35
+ bool entry = (t >= 0.0) != startsOutside;
64
36
 
65
- return vec4(-INF_HIT, t, t, +INF_HIT);
66
- }
67
-
68
- vec2 intersectHalfSpace(Ray ray, float angle)
69
- {
70
- vec2 o = ray.pos.xy;
71
- vec2 d = ray.dir.xy;
72
- vec2 n = vec2(sin(angle), -cos(angle));
73
-
74
- float a = dot(o, n);
75
- float b = dot(d, n);
76
- float t = -a / b;
77
- float s = sign(a);
37
+ vec4 intersect = vec4(0.0, 0.0, z, t);
38
+ vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
78
39
 
79
- if (t >= 0.0 != s >= 0.0) return vec2(t, +INF_HIT);
80
- else return vec2(-INF_HIT, t);
40
+ if (entry) {
41
+ return RayShapeIntersection(intersect, farSide);
42
+ } else {
43
+ return RayShapeIntersection(-1.0 * farSide, intersect);
44
+ }
81
45
  }
82
46
 
83
- vec2 intersectRegularWedge(Ray ray, float minAngle, float maxAngle)
47
+ RayShapeIntersection intersectHeight(in Ray ray, in float relativeHeight, in bool convex)
84
48
  {
85
- vec2 o = ray.pos.xy;
86
- vec2 d = ray.dir.xy;
87
- vec2 n1 = vec2(sin(minAngle), -cos(minAngle));
88
- vec2 n2 = vec2(-sin(maxAngle), cos(maxAngle));
89
-
90
- float a1 = dot(o, n1);
91
- float a2 = dot(o, n2);
92
- float b1 = dot(d, n1);
93
- float b2 = dot(d, n2);
49
+ // Scale the ray by the ellipsoid axes to make it a unit sphere
50
+ // Note: approximating ellipsoid + height as an ellipsoid
51
+ vec3 radiiCorrection = u_ellipsoidRadiiUv / (u_ellipsoidRadiiUv + relativeHeight);
52
+ vec3 position = ray.pos * radiiCorrection;
53
+ vec3 direction = ray.dir * radiiCorrection;
54
+
55
+ float a = dot(direction, direction); // ~ 1.0 (or maybe 4.0 if ray is scaled)
56
+ float b = dot(direction, position); // roughly inside [-1.0, 1.0] when zoomed in
57
+ float c = dot(position, position) - 1.0; // ~ 0.0 when zoomed in.
58
+ float determinant = b * b - a * c; // ~ b * b when zoomed in
59
+
60
+ if (determinant < 0.0) {
61
+ vec4 miss = vec4(normalize(direction), NO_HIT);
62
+ return RayShapeIntersection(miss, miss);
63
+ }
94
64
 
95
- float t1 = -a1 / b1;
96
- float t2 = -a2 / b2;
97
- float s1 = sign(a1);
98
- float s2 = sign(a2);
65
+ determinant = sqrt(determinant);
99
66
 
67
+ // Compute larger root using standard formula
68
+ float signB = b < 0.0 ? -1.0 : 1.0;
69
+ // The other root may suffer from subtractive cancellation in the standard formula.
70
+ // Compute it from the first root instead.
71
+ float t1 = (-b - signB * determinant) / a;
72
+ float t2 = c / (a * t1);
100
73
  float tmin = min(t1, t2);
101
74
  float tmax = max(t1, t2);
102
- float smin = tmin == t1 ? s1 : s2;
103
- float smax = tmin == t1 ? s2 : s1;
104
-
105
- bool e = tmin >= 0.0;
106
- bool f = tmax >= 0.0;
107
- bool g = smin >= 0.0;
108
- bool h = smax >= 0.0;
109
-
110
- if (e != g && f == h) return vec2(tmin, tmax);
111
- else if (e == g && f == h) return vec2(-INF_HIT, tmin);
112
- else if (e != g && f != h) return vec2(tmax, +INF_HIT);
113
- else return vec2(NO_HIT);
114
- }
115
75
 
116
- vec4 intersectFlippedWedge(Ray ray, float minAngle, float maxAngle)
117
- {
118
- vec2 planeIntersectMin = intersectHalfSpace(ray, minAngle);
119
- vec2 planeIntersectMax = intersectHalfSpace(ray, maxAngle + czm_pi);
120
- return vec4(planeIntersectMin, planeIntersectMax);
76
+ float directionScale = convex ? 1.0 : -1.0;
77
+ vec3 d1 = directionScale * normalize(position + tmin * direction);
78
+ vec3 d2 = directionScale * normalize(position + tmax * direction);
79
+
80
+ return RayShapeIntersection(vec4(d1, tmin), vec4(d2, tmax));
121
81
  }
122
82
 
123
- vec2 intersectUnitSphere(Ray ray)
83
+ /**
84
+ * Given a circular cone around the z-axis, with apex at the origin,
85
+ * find the parametric distance(s) along a ray where that ray intersects
86
+ * the cone.
87
+ * The cone opening angle is described by the squared cosine of
88
+ * its half-angle (the angle between the Z-axis and the surface)
89
+ */
90
+ vec2 intersectDoubleEndedCone(in Ray ray, in float cosSqrHalfAngle)
124
91
  {
125
92
  vec3 o = ray.pos;
126
93
  vec3 d = ray.dir;
94
+ float sinSqrHalfAngle = 1.0 - cosSqrHalfAngle;
127
95
 
128
- float b = dot(d, o);
129
- float c = dot(o, o) - 1.0;
130
- float det = b * b - c;
131
-
132
- if (det < 0.0) {
133
- return vec2(NO_HIT);
134
- }
135
-
136
- det = sqrt(det);
137
- float t1 = -b - det;
138
- float t2 = -b + det;
139
- float tmin = min(t1, t2);
140
- float tmax = max(t1, t2);
141
-
142
- return vec2(tmin, tmax);
143
- }
96
+ float aSin = d.z * d.z * sinSqrHalfAngle;
97
+ float aCos = -dot(d.xy, d.xy) * cosSqrHalfAngle;
98
+ float a = aSin + aCos;
144
99
 
145
- vec2 intersectUnitSphereUnnormalizedDirection(Ray ray)
146
- {
147
- vec3 o = ray.pos;
148
- vec3 d = ray.dir;
100
+ float bSin = d.z * o.z * sinSqrHalfAngle;
101
+ float bCos = -dot(o.xy, d.xy) * cosSqrHalfAngle;
102
+ float b = bSin + bCos;
149
103
 
150
- float a = dot(d, d);
151
- float b = dot(d, o);
152
- float c = dot(o, o) - 1.0;
153
- float det = b * b - a * c;
104
+ float cSin = o.z * o.z * sinSqrHalfAngle;
105
+ float cCos = -dot(o.xy, o.xy) * cosSqrHalfAngle;
106
+ float c = cSin + cCos;
107
+ // determinant = b * b - a * c. But bSin * bSin = aSin * cSin.
108
+ // Avoid subtractive cancellation by expanding to eliminate these terms
109
+ float determinant = 2.0 * bSin * bCos + bCos * bCos - aSin * cCos - aCos * cSin - aCos * cCos;
154
110
 
155
- if (det < 0.0) {
111
+ if (determinant < 0.0) {
156
112
  return vec2(NO_HIT);
113
+ } else if (a == 0.0) {
114
+ // Ray is parallel to cone surface
115
+ return (b == 0.0)
116
+ ? vec2(NO_HIT) // Ray is on cone surface
117
+ : vec2(-0.5 * c / b, NO_HIT);
157
118
  }
158
119
 
159
- det = sqrt(det);
160
- float t1 = (-b - det) / a;
161
- float t2 = (-b + det) / a;
120
+ determinant = sqrt(determinant);
121
+
122
+ // Compute larger root using standard formula
123
+ float signB = b < 0.0 ? -1.0 : 1.0;
124
+ float t1 = (-b - signB * determinant) / a;
125
+ // The other root may suffer from subtractive cancellation in the standard formula.
126
+ // Compute it from the first root instead.
127
+ float t2 = c / (a * t1);
162
128
  float tmin = min(t1, t2);
163
129
  float tmax = max(t1, t2);
164
-
165
130
  return vec2(tmin, tmax);
166
131
  }
167
132
 
168
- vec2 intersectDoubleEndedCone(Ray ray, float cosSqrHalfAngle)
169
- {
170
- vec3 o = ray.pos;
171
- vec3 d = ray.dir;
172
- float a = d.z * d.z - dot(d, d) * cosSqrHalfAngle;
173
- float b = d.z * o.z - dot(o, d) * cosSqrHalfAngle;
174
- float c = o.z * o.z - dot(o, o) * cosSqrHalfAngle;
175
- float det = b * b - a * c;
176
-
177
- if (det < 0.0) {
178
- return vec2(NO_HIT);
179
- }
133
+ /**
134
+ * Given a point on a conical surface, find the surface normal at that point.
135
+ */
136
+ vec3 getConeNormal(in vec3 p, in bool convex) {
137
+ // Start with radial component pointing toward z-axis
138
+ vec2 radial = -abs(p.z) * normalize(p.xy);
139
+ // Z component points toward opening of cone
140
+ float zSign = (p.z < 0.0) ? -1.0 : 1.0;
141
+ float z = length(p.xy) * zSign;
142
+ // Flip normal if shape is convex
143
+ float flip = (convex) ? -1.0 : 1.0;
144
+ return normalize(vec3(radial, z) * flip);
145
+ }
180
146
 
181
- det = sqrt(det);
182
- float t1 = (-b - det) / a;
183
- float t2 = (-b + det) / a;
184
- float tmin = min(t1, t2);
185
- float tmax = max(t1, t2);
186
- return vec2(tmin, tmax);
147
+ /**
148
+ * Compute the shift between the ellipsoid origin and the apex of a cone of latitude
149
+ */
150
+ float getLatitudeConeShift(in float sinLatitude) {
151
+ // Find prime vertical radius of curvature:
152
+ // the distance along the ellipsoid normal to the intersection with the z-axis
153
+ float x2 = u_eccentricitySquared * sinLatitude * sinLatitude;
154
+ float primeVerticalRadius = inversesqrt(1.0 - x2);
155
+
156
+ // Compute a shift from the origin to the intersection of the cone with the z-axis
157
+ return primeVerticalRadius * u_eccentricitySquared * sinLatitude;
187
158
  }
188
159
 
189
- vec4 intersectFlippedCone(Ray ray, float cosSqrHalfAngle) {
160
+ void intersectFlippedCone(in Ray ray, in float cosHalfAngle, out RayShapeIntersection intersections[2]) {
161
+ // Undo the scaling from ellipsoid to sphere
162
+ ray.pos = ray.pos * u_ellipsoidRadiiUv;
163
+ ray.dir = ray.dir * u_ellipsoidRadiiUv;
164
+ // Shift the ray to account for the latitude cone not being centered at the Earth center
165
+ ray.pos.z += getLatitudeConeShift(cosHalfAngle);
166
+
167
+ float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
190
168
  vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
191
169
 
170
+ vec4 miss = vec4(normalize(ray.dir), NO_HIT);
171
+ vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
172
+
173
+ // Initialize output with no intersections
174
+ intersections[0].entry = -1.0 * farSide;
175
+ intersections[0].exit = farSide;
176
+ intersections[1].entry = miss;
177
+ intersections[1].exit = miss;
178
+
192
179
  if (intersect.x == NO_HIT) {
193
- return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
180
+ return;
194
181
  }
195
182
 
196
- vec3 o = ray.pos;
197
- vec3 d = ray.dir;
183
+ // Find the points of intersection
198
184
  float tmin = intersect.x;
199
185
  float tmax = intersect.y;
200
- float zmin = o.z + tmin * d.z;
201
- float zmax = o.z + tmax * d.z;
202
-
203
- // One interval
204
- if (zmin < 0.0 && zmax < 0.0) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
205
- else if (zmin < 0.0) return vec4(-INF_HIT, tmax, NO_HIT, NO_HIT);
206
- else if (zmax < 0.0) return vec4(tmin, +INF_HIT, NO_HIT, NO_HIT);
207
- // Two intervals
208
- else return vec4(-INF_HIT, tmin, tmax, +INF_HIT);
186
+ vec3 p0 = ray.pos + tmin * ray.dir;
187
+ vec3 p1 = ray.pos + tmax * ray.dir;
188
+
189
+ vec4 intersect0 = vec4(getConeNormal(p0, true), tmin);
190
+ vec4 intersect1 = vec4(getConeNormal(p1, true), tmax);
191
+
192
+ bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
193
+ bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
194
+
195
+ if (p0InShadowCone && p1InShadowCone) {
196
+ // no valid intersections
197
+ } else if (p0InShadowCone) {
198
+ intersections[0].exit = intersect1;
199
+ } else if (p1InShadowCone) {
200
+ intersections[0].entry = intersect0;
201
+ } else {
202
+ intersections[0].exit = intersect0;
203
+ intersections[1].entry = intersect1;
204
+ intersections[1].exit = farSide;
205
+ }
209
206
  }
210
207
 
211
- vec2 intersectRegularCone(Ray ray, float cosSqrHalfAngle) {
208
+ RayShapeIntersection intersectRegularCone(in Ray ray, in float cosHalfAngle, in bool convex) {
209
+ // Undo the scaling from ellipsoid to sphere
210
+ ray.pos = ray.pos * u_ellipsoidRadiiUv;
211
+ ray.dir = ray.dir * u_ellipsoidRadiiUv;
212
+ // Shift the ray to account for the latitude cone not being centered at the Earth center
213
+ ray.pos.z += getLatitudeConeShift(cosHalfAngle);
214
+
215
+ float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
212
216
  vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
213
217
 
218
+ vec4 miss = vec4(normalize(ray.dir), NO_HIT);
219
+ vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
220
+
214
221
  if (intersect.x == NO_HIT) {
215
- return vec2(NO_HIT);
222
+ return RayShapeIntersection(miss, miss);
216
223
  }
217
224
 
218
- vec3 o = ray.pos;
219
- vec3 d = ray.dir;
225
+ // Find the points of intersection
220
226
  float tmin = intersect.x;
221
227
  float tmax = intersect.y;
222
- float zmin = o.z + tmin * d.z;
223
- float zmax = o.z + tmax * d.z;
224
-
225
- if (zmin < 0.0 && zmax < 0.0) return vec2(NO_HIT);
226
- else if (zmin < 0.0) return vec2(tmax, +INF_HIT);
227
- else if (zmax < 0.0) return vec2(-INF_HIT, tmin);
228
- else return vec2(tmin, tmax);
228
+ vec3 p0 = ray.pos + tmin * ray.dir;
229
+ vec3 p1 = ray.pos + tmax * ray.dir;
230
+
231
+ vec4 intersect0 = vec4(getConeNormal(p0, convex), tmin);
232
+ vec4 intersect1 = vec4(getConeNormal(p1, convex), tmax);
233
+
234
+ bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
235
+ bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
236
+
237
+ if (p0InShadowCone && p1InShadowCone) {
238
+ return RayShapeIntersection(miss, miss);
239
+ } else if (p0InShadowCone) {
240
+ return RayShapeIntersection(intersect1, farSide);
241
+ } else if (p1InShadowCone) {
242
+ return RayShapeIntersection(-1.0 * farSide, intersect0);
243
+ } else {
244
+ return RayShapeIntersection(intersect0, intersect1);
245
+ }
229
246
  }
230
247
 
231
248
  void intersectShape(in Ray ray, inout Intersections ix) {
@@ -234,25 +251,25 @@ void intersectShape(in Ray ray, inout Intersections ix) {
234
251
  ray.pos = ray.pos * 2.0 - 1.0;
235
252
  ray.dir *= 2.0;
236
253
 
237
- #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX)
238
- Ray outerRay = Ray(ray.pos * u_ellipsoidInverseOuterScaleUv, ray.dir * u_ellipsoidInverseOuterScaleUv);
239
- #else
240
- Ray outerRay = ray;
241
- #endif
242
-
243
254
  // Outer ellipsoid
244
- vec2 outerIntersect = intersectUnitSphereUnnormalizedDirection(outerRay);
245
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);
255
+ RayShapeIntersection outerIntersect = intersectHeight(ray, u_clipMinMaxHeight.y, true);
256
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);
246
257
 
247
258
  // Exit early if the outer ellipsoid was missed.
248
- if (outerIntersect.x == NO_HIT) {
259
+ if (outerIntersect.entry.w == NO_HIT) {
249
260
  return;
250
261
  }
251
262
 
252
263
  // Inner ellipsoid
253
- #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
254
- // When the ellipsoid is perfectly thin it's necessary to sandwich the
255
- // inner ellipsoid intersection inside the outer ellipsoid intersection.
264
+ RayShapeIntersection innerIntersect = intersectHeight(ray, u_clipMinMaxHeight.x, false);
265
+
266
+ if (innerIntersect.entry.w == NO_HIT) {
267
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);
268
+ } else {
269
+ // When the ellipsoid is large and thin it's possible for floating point math
270
+ // to cause the ray to intersect the inner ellipsoid before the outer ellipsoid.
271
+ // To prevent this from happening, clamp innerIntersect to outerIntersect and
272
+ // sandwich the inner ellipsoid intersection inside the outer ellipsoid intersection.
256
273
 
257
274
  // Without this special case,
258
275
  // [outerMin, outerMax, innerMin, innerMax] will bubble sort to
@@ -267,81 +284,55 @@ void intersectShape(in Ray ray, inout Intersections ix) {
267
284
 
268
285
  // Note: If initializeIntersections() changes its sorting function
269
286
  // from bubble sort to something else, this code may need to change.
270
- setIntersection(ix, 0, outerIntersect.x, true, true); // positive, enter
271
- setIntersection(ix, 1, outerIntersect.x, false, true); // negative, enter
272
- setIntersection(ix, 2, outerIntersect.y, false, false); // negative, exit
273
- setIntersection(ix, 3, outerIntersect.y, true, false); // positive, exit
274
- #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN)
275
- Ray innerRay = Ray(ray.pos * u_ellipsoidInverseInnerScaleUv, ray.dir * u_ellipsoidInverseInnerScaleUv);
276
- vec2 innerIntersect = intersectUnitSphereUnnormalizedDirection(innerRay);
277
-
278
- if (innerIntersect == vec2(NO_HIT)) {
279
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);
280
- } else {
281
- // When the ellipsoid is very large and thin it's possible for floating
282
- // point math to cause the ray to intersect the inner ellipsoid before
283
- // the outer ellipsoid. To prevent this from happening, clamp innerIntersect
284
- // to outerIntersect and sandwhich the intersections like described above.
285
- //
286
- // In theory a similar fix is needed for cylinders, however it's more
287
- // complicated to implement because the inner shape is allowed to be
288
- // intersected first.
289
- innerIntersect.x = max(innerIntersect.x, outerIntersect.x);
290
- innerIntersect.y = min(innerIntersect.y, outerIntersect.y);
291
- setIntersection(ix, 0, outerIntersect.x, true, true); // positive, enter
292
- setIntersection(ix, 1, innerIntersect.x, false, true); // negative, enter
293
- setIntersection(ix, 2, innerIntersect.y, false, false); // negative, exit
294
- setIntersection(ix, 3, outerIntersect.y, true, false); // positive, exit
295
- }
296
- #endif
297
-
298
- // Flip the ray because the intersection function expects a cone growing towards +Z.
299
- #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
300
- Ray flippedRay = outerRay;
301
- flippedRay.dir.z *= -1.0;
302
- flippedRay.pos.z *= -1.0;
303
- #endif
287
+ innerIntersect.entry.w = max(innerIntersect.entry.w, outerIntersect.entry.w);
288
+ innerIntersect.exit.w = min(innerIntersect.exit.w, outerIntersect.exit.w);
289
+ setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true); // positive, enter
290
+ setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true); // negative, enter
291
+ setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false); // negative, exit
292
+ setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false); // positive, exit
293
+ }
304
294
 
305
295
  // Bottom cone
306
296
  #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF)
307
- vec2 bottomConeIntersection = intersectRegularCone(flippedRay, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.x);
308
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
297
+ RayShapeIntersection bottomConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, false);
298
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
309
299
  #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF)
310
- vec2 bottomConeIntersection = intersectZPlane(flippedRay);
311
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
300
+ RayShapeIntersection bottomConeIntersection = intersectZPlane(ray, -1.0);
301
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
312
302
  #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF)
313
- vec4 bottomConeIntersection = intersectFlippedCone(ray, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.x);
314
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersection.xy);
315
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersection.zw);
303
+ RayShapeIntersection bottomConeIntersections[2];
304
+ intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, bottomConeIntersections);
305
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersections[0]);
306
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersections[1]);
316
307
  #endif
317
308
 
318
309
  // Top cone
319
310
  #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
320
- vec4 topConeIntersection = intersectFlippedCone(flippedRay, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.y);
321
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersection.xy);
322
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersection.zw);
311
+ RayShapeIntersection topConeIntersections[2];
312
+ intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, topConeIntersections);
313
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersections[0]);
314
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersections[1]);
323
315
  #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF)
324
- vec2 topConeIntersection = intersectZPlane(ray);
325
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
316
+ RayShapeIntersection topConeIntersection = intersectZPlane(ray, 1.0);
317
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
326
318
  #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
327
- vec2 topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.y);
328
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
319
+ RayShapeIntersection topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, false);
320
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
329
321
  #endif
330
322
 
331
323
  // Wedge
332
324
  #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
333
- vec4 wedgeIntersect = intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x);
334
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersect.xy);
335
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersect.zw);
325
+ RayShapeIntersection wedgeIntersects[2];
326
+ intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x, wedgeIntersects);
327
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
328
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
336
329
  #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF)
337
- vec2 wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax.x, u_ellipsoidRenderLongitudeMinMax.y);
338
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
339
- #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF)
340
- vec2 wedgeIntersect = intersectHalfSpace(ray, u_ellipsoidRenderLongitudeMinMax.x);
341
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
330
+ RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax);
331
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
342
332
  #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF)
343
- vec4 wedgeIntersect = intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax.x, u_ellipsoidRenderLongitudeMinMax.y);
344
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersect.xy);
345
- setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersect.zw);
333
+ RayShapeIntersection wedgeIntersects[2];
334
+ intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax, wedgeIntersects);
335
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
336
+ setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
346
337
  #endif
347
338
  }