@cesium/engine 20.0.1 → 21.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 (184) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +637 -0
  2. package/Build/Workers/{chunk-7P7R7ERW.js → chunk-2T4WAVWX.js} +6 -6
  3. package/Build/Workers/{chunk-DNMSVJ4S.js → chunk-3G5XEUPY.js} +1 -1
  4. package/Build/Workers/{chunk-O7KDJVRH.js → chunk-3MSNTCHW.js} +9 -9
  5. package/Build/Workers/{chunk-7MCEUVPM.js → chunk-3OPG2FGI.js} +4 -4
  6. package/Build/Workers/{chunk-M4FSVD3C.js → chunk-3PUG3T2H.js} +12 -12
  7. package/Build/Workers/{chunk-CTU7LCVZ.js → chunk-4PH27XAL.js} +2 -2
  8. package/Build/Workers/{chunk-ZBLPNAYB.js → chunk-4VJYMLR6.js} +8 -8
  9. package/Build/Workers/{chunk-DAZVD3AH.js → chunk-5B3PGBQW.js} +11 -11
  10. package/Build/Workers/{chunk-UXIZVXIR.js → chunk-5GHCWGC4.js} +1 -1
  11. package/Build/Workers/{chunk-HZ22ZI3Q.js → chunk-5PEQUMCB.js} +12 -12
  12. package/Build/Workers/{chunk-HSVZWLJD.js → chunk-64WSG7AT.js} +4 -4
  13. package/Build/Workers/{chunk-ZJGO7T2S.js → chunk-6J6WGCWP.js} +4 -4
  14. package/Build/Workers/{chunk-OWV4L2GH.js → chunk-75B34CC6.js} +5 -5
  15. package/Build/Workers/{chunk-4MCKK5XE.js → chunk-7PLX65MV.js} +5 -5
  16. package/Build/Workers/{chunk-YVAOKOKX.js → chunk-AR2FUSG6.js} +1 -1
  17. package/Build/Workers/{chunk-JVNWWKXF.js → chunk-ARYRHDEB.js} +6 -6
  18. package/Build/Workers/{chunk-DAGWF5MM.js → chunk-B7INTBBB.js} +13 -13
  19. package/Build/Workers/{chunk-WNEY4A5P.js → chunk-BDPSQXLX.js} +5 -5
  20. package/Build/Workers/{chunk-LYKXQPGW.js → chunk-BU4CGMHO.js} +6 -6
  21. package/Build/Workers/{chunk-ECGKCTPM.js → chunk-BUBVUXDO.js} +6 -6
  22. package/Build/Workers/{chunk-LSYTMSIQ.js → chunk-CF72FAKC.js} +4 -4
  23. package/Build/Workers/{chunk-LZZA3PAR.js → chunk-DJ4ROETJ.js} +5 -5
  24. package/Build/Workers/{chunk-YNRRVRHO.js → chunk-E5XCZVIY.js} +1 -1
  25. package/Build/Workers/{chunk-RP4KKY2E.js → chunk-EAYW4CFP.js} +16 -16
  26. package/Build/Workers/{chunk-YW2UXIBU.js → chunk-EHFMZFVC.js} +4 -4
  27. package/Build/Workers/{chunk-HKHD5FDM.js → chunk-FFCKCQPK.js} +5 -5
  28. package/Build/Workers/{chunk-VQLQAENU.js → chunk-GKCZ2G36.js} +7 -7
  29. package/Build/Workers/{chunk-DJCPJJSP.js → chunk-HJ7IZBEI.js} +4 -4
  30. package/Build/Workers/{chunk-7FEVXX5D.js → chunk-JJZWDROM.js} +2 -2
  31. package/Build/Workers/{chunk-SLPWFCXZ.js → chunk-JUOEBO4F.js} +10 -10
  32. package/Build/Workers/{chunk-LHZKPI55.js → chunk-K4IDXMIZ.js} +9 -9
  33. package/Build/Workers/{chunk-D4VFVSGU.js → chunk-LL6HN3W4.js} +10 -10
  34. package/Build/Workers/{chunk-CZGSJ6ZG.js → chunk-LNTUIO55.js} +2 -2
  35. package/Build/Workers/{chunk-QFMJIXCL.js → chunk-LWOCFJEH.js} +9 -9
  36. package/Build/Workers/{chunk-2K5PKWLP.js → chunk-MMUISYW4.js} +16 -16
  37. package/Build/Workers/{chunk-IQKHPQNT.js → chunk-MXYW4BQ3.js} +2 -2
  38. package/Build/Workers/{chunk-XMIVNU5H.js → chunk-N6DVKXZD.js} +12 -12
  39. package/Build/Workers/{chunk-E2533KCN.js → chunk-NP46ZIBY.js} +3 -3
  40. package/Build/Workers/{chunk-O4DA3KRB.js → chunk-OW6F6CPZ.js} +7 -7
  41. package/Build/Workers/{chunk-QWHUQ4B7.js → chunk-P6OAOFBU.js} +8 -8
  42. package/Build/Workers/{chunk-4Z7AGRTU.js → chunk-PXDMWXO5.js} +2 -2
  43. package/Build/Workers/{chunk-WJ5THCIZ.js → chunk-QS7623NH.js} +6 -6
  44. package/Build/Workers/{chunk-OYFINQQA.js → chunk-ROH45IXJ.js} +7 -7
  45. package/Build/Workers/{chunk-2MEON5V4.js → chunk-S2P6LCIB.js} +4 -4
  46. package/Build/Workers/{chunk-JIXKGUWR.js → chunk-S4NZVXU6.js} +2 -2
  47. package/Build/Workers/{chunk-JHTZDMN6.js → chunk-SGGO5WVA.js} +5 -5
  48. package/Build/Workers/{chunk-UUXKGCBU.js → chunk-TG7N7TPY.js} +47 -50
  49. package/Build/Workers/{chunk-PFUF2QIK.js → chunk-TUZQG4RW.js} +14 -14
  50. package/Build/Workers/{chunk-LF74EILW.js → chunk-UHVE7V65.js} +12 -12
  51. package/Build/Workers/{chunk-L7PWWHKM.js → chunk-UY2HVPDL.js} +5 -5
  52. package/Build/Workers/{chunk-V65LOTF3.js → chunk-YNLPRFUQ.js} +6 -6
  53. package/Build/Workers/{chunk-RB3XS7EZ.js → chunk-ZYOHBCCE.js} +1 -1
  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 +41 -49
  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/BatchTableHierarchy.js +2 -50
  114. package/Source/Scene/Billboard.js +4 -0
  115. package/Source/Scene/BillboardCollection.js +9 -2
  116. package/Source/Scene/ClippingPlaneCollection.js +3 -3
  117. package/Source/Scene/ClippingPolygon.js +91 -2
  118. package/Source/Scene/CreditDisplay.js +1 -1
  119. package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
  120. package/Source/Scene/GaussianSplatPrimitive.js +49 -50
  121. package/Source/Scene/Google2DImageryProvider.js +614 -0
  122. package/Source/Scene/IonImageryProvider.js +22 -1
  123. package/Source/Scene/LabelCollection.js +1 -0
  124. package/Source/Scene/Material.js +248 -80
  125. package/Source/Scene/PntsParser.js +65 -0
  126. package/Source/Scene/Primitive.js +6 -0
  127. package/Source/Scene/PrimitiveState.js +123 -0
  128. package/Source/Scene/Scene.js +2 -2
  129. package/Source/Scene/VoxelBoundsCollection.js +494 -0
  130. package/Source/Scene/VoxelBoxShape.js +236 -101
  131. package/Source/Scene/VoxelCylinderShape.js +315 -204
  132. package/Source/Scene/VoxelEllipsoidShape.js +402 -119
  133. package/Source/Scene/VoxelPrimitive.js +119 -84
  134. package/Source/Scene/VoxelRenderResources.js +17 -10
  135. package/Source/Scene/VoxelShape.js +21 -6
  136. package/Source/Scene/buildVoxelDrawCommands.js +61 -20
  137. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
  138. package/Source/Scene/getClippingFunction.js +79 -88
  139. package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
  140. package/Source/Shaders/BillboardCollectionVS.js +2 -0
  141. package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
  142. package/Source/Shaders/Voxels/IntersectBox.js +20 -33
  143. package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
  144. package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
  145. package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
  146. package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
  147. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
  148. package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
  149. package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
  150. package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
  151. package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
  152. package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
  153. package/Source/Shaders/Voxels/Intersection.glsl +3 -3
  154. package/Source/Shaders/Voxels/Intersection.js +3 -3
  155. package/Source/Shaders/Voxels/Octree.glsl +46 -51
  156. package/Source/Shaders/Voxels/Octree.js +46 -51
  157. package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
  158. package/Source/Shaders/Voxels/VoxelFS.js +50 -48
  159. package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
  160. package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
  161. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
  162. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
  163. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
  164. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
  165. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
  166. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
  167. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
  168. package/Source/ThirdParty/zip-module.wasm +0 -0
  169. package/index.d.ts +340 -14
  170. package/index.js +116 -114
  171. package/package.json +2 -2
  172. package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
  173. package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
  174. package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
  175. package/Source/Core/defaultValue.js +0 -48
  176. package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
  177. package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
  178. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
  179. package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
  180. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
  181. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
  182. package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
  183. package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
  184. package/Source/ThirdParty/Workers/z-worker-pako.js +0 -1
@@ -4,9 +4,11 @@ import Cartesian3 from "../Core/Cartesian3.js";
4
4
  import Cartesian4 from "../Core/Cartesian4.js";
5
5
  import CesiumMath from "../Core/Math.js";
6
6
  import Check from "../Core/Check.js";
7
+ import ClippingPlane from "./ClippingPlane.js";
7
8
  import Matrix3 from "../Core/Matrix3.js";
8
9
  import Matrix4 from "../Core/Matrix4.js";
9
10
  import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
11
+ import VoxelBoundsCollection from "./VoxelBoundsCollection.js";
10
12
 
11
13
  /**
12
14
  * A cylinder {@link VoxelShape}.
@@ -22,111 +24,179 @@ import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
22
24
  * @private
23
25
  */
24
26
  function VoxelCylinderShape() {
27
+ this._orientedBoundingBox = new OrientedBoundingBox();
28
+ this._boundingSphere = new BoundingSphere();
29
+ this._boundTransform = new Matrix4();
30
+ this._shapeTransform = new Matrix4();
31
+
25
32
  /**
26
- * An oriented bounding box containing the bounded shape.
27
- * The update function must be called before accessing this value.
33
+ * The minimum bounds of the shape, corresponding to minimum radius, angle, and height.
34
+ * @type {Cartesian3}
28
35
  * @private
29
- * @type {OrientedBoundingBox}
30
- * @readonly
31
36
  */
32
- this.orientedBoundingBox = new OrientedBoundingBox();
37
+ this._minBounds = VoxelCylinderShape.DefaultMinBounds.clone();
33
38
 
34
39
  /**
35
- * A bounding sphere containing the bounded shape.
36
- * The update function must be called before accessing this value.
40
+ * The maximum bounds of the shape, corresponding to maximum radius, angle, and height.
41
+ * @type {Cartesian3}
37
42
  * @private
38
- * @type {BoundingSphere}
39
- * @readonly
40
43
  */
41
- this.boundingSphere = new BoundingSphere();
44
+ this._maxBounds = VoxelCylinderShape.DefaultMaxBounds.clone();
45
+
46
+ const { DefaultMinBounds, DefaultMaxBounds } = VoxelCylinderShape;
47
+ const boundPlanes = [
48
+ new ClippingPlane(
49
+ Cartesian3.negate(Cartesian3.UNIT_Z, new Cartesian3()),
50
+ DefaultMinBounds.z,
51
+ ),
52
+ new ClippingPlane(Cartesian3.UNIT_Z, -DefaultMaxBounds.z),
53
+ ];
54
+
55
+ this._renderBoundPlanes = new VoxelBoundsCollection({ planes: boundPlanes });
56
+
57
+ this._shaderUniforms = {
58
+ cameraShapePosition: new Cartesian3(),
59
+ cylinderEcToRadialTangentUp: new Matrix3(),
60
+ cylinderRenderRadiusMinMax: new Cartesian2(),
61
+ cylinderRenderAngleMinMax: new Cartesian2(),
62
+ cylinderLocalToShapeUvRadius: new Cartesian2(),
63
+ cylinderLocalToShapeUvAngle: new Cartesian2(),
64
+ cylinderLocalToShapeUvHeight: new Cartesian2(),
65
+ cylinderShapeUvAngleRangeOrigin: 0.0,
66
+ };
67
+
68
+ this._shaderDefines = {
69
+ CYLINDER_HAS_SHAPE_BOUNDS_ANGLE: undefined,
70
+ CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN: undefined,
71
+ CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT: undefined,
72
+ CYLINDER_HAS_RENDER_BOUNDS_ANGLE: undefined,
73
+ CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO: undefined,
74
+ CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF: undefined,
75
+ CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF: undefined,
76
+ CYLINDER_INTERSECTION_INDEX_RADIUS_MAX: undefined,
77
+ CYLINDER_INTERSECTION_INDEX_RADIUS_MIN: undefined,
78
+ CYLINDER_INTERSECTION_INDEX_ANGLE: undefined,
79
+ };
80
+
81
+ this._shaderMaximumIntersectionsLength = 0; // not known until update
82
+ }
42
83
 
84
+ Object.defineProperties(VoxelCylinderShape.prototype, {
43
85
  /**
44
- * A transformation matrix containing the bounded shape.
45
- * The update function must be called before accessing this value.
46
- * @private
47
- * @type {Matrix4}
86
+ * An oriented bounding box containing the bounded shape.
87
+ *
88
+ * @memberof VoxelCylinderShape.prototype
89
+ * @type {OrientedBoundingBox}
48
90
  * @readonly
91
+ * @private
49
92
  */
50
- this.boundTransform = new Matrix4();
93
+ orientedBoundingBox: {
94
+ get: function () {
95
+ return this._orientedBoundingBox;
96
+ },
97
+ },
51
98
 
52
99
  /**
53
- * A transformation matrix containing the shape, ignoring the bounds.
54
- * The update function must be called before accessing this value.
55
- * @private
56
- * @type {Matrix4}
100
+ * A collection of planes used for the render bounds
101
+ * @memberof VoxelCylinderShape.prototype
102
+ * @type {VoxelBoundsCollection}
57
103
  * @readonly
104
+ * @private
58
105
  */
59
- this.shapeTransform = new Matrix4();
106
+ renderBoundPlanes: {
107
+ get: function () {
108
+ return this._renderBoundPlanes;
109
+ },
110
+ },
60
111
 
61
112
  /**
62
- * The minimum bounds of the shape, corresponding to minimum radius, angle, and height.
63
- * @type {Cartesian3}
113
+ * A bounding sphere containing the bounded shape.
114
+ *
115
+ * @memberof VoxelCylinderShape.prototype
116
+ * @type {BoundingSphere}
117
+ * @readonly
64
118
  * @private
65
119
  */
66
- this._minBounds = VoxelCylinderShape.DefaultMinBounds.clone();
120
+ boundingSphere: {
121
+ get: function () {
122
+ return this._boundingSphere;
123
+ },
124
+ },
67
125
 
68
126
  /**
69
- * The maximum bounds of the shape, corresponding to maximum radius, angle, and height.
70
- * @type {Cartesian3}
127
+ * A transformation matrix containing the bounded shape.
128
+ *
129
+ * @memberof VoxelCylinderShape.prototype
130
+ * @type {Matrix4}
131
+ * @readonly
71
132
  * @private
72
133
  */
73
- this._maxBounds = VoxelCylinderShape.DefaultMaxBounds.clone();
134
+ boundTransform: {
135
+ get: function () {
136
+ return this._boundTransform;
137
+ },
138
+ },
74
139
 
75
140
  /**
141
+ * A transformation matrix containing the shape, ignoring the bounds.
142
+ *
143
+ * @memberof VoxelCylinderShape.prototype
144
+ * @type {Matrix4}
145
+ * @readonly
76
146
  * @private
147
+ */
148
+ shapeTransform: {
149
+ get: function () {
150
+ return this._shapeTransform;
151
+ },
152
+ },
153
+
154
+ /**
155
+ * @memberof VoxelCylinderShape.prototype
77
156
  * @type {Object<string, any>}
78
157
  * @readonly
158
+ * @private
79
159
  */
80
- this.shaderUniforms = {
81
- cylinderRenderRadiusMinMax: new Cartesian2(),
82
- cylinderRenderAngleMinMax: new Cartesian2(),
83
- cylinderRenderHeightMinMax: new Cartesian2(),
84
- cylinderUvToShapeUvRadius: new Cartesian2(),
85
- cylinderUvToShapeUvAngle: new Cartesian2(),
86
- cylinderUvToShapeUvHeight: new Cartesian2(),
87
- cylinderShapeUvAngleMinMax: new Cartesian2(),
88
- cylinderShapeUvAngleRangeZeroMid: 0.0,
89
- };
160
+ shaderUniforms: {
161
+ get: function () {
162
+ return this._shaderUniforms;
163
+ },
164
+ },
90
165
 
91
166
  /**
92
- * @private
167
+ * @memberof VoxelCylinderShape.prototype
93
168
  * @type {Object<string, any>}
94
169
  * @readonly
170
+ * @private
95
171
  */
96
- this.shaderDefines = {
97
- CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN: undefined,
98
- CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT: undefined,
99
- CYLINDER_HAS_RENDER_BOUNDS_ANGLE: undefined,
100
- CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO: undefined,
101
- CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF: undefined,
102
- CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF: undefined,
103
-
104
- CYLINDER_HAS_SHAPE_BOUNDS_RADIUS: undefined,
105
- CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT: undefined,
106
- CYLINDER_HAS_SHAPE_BOUNDS_ANGLE: undefined,
107
- CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY: undefined,
108
- CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY: undefined,
109
- CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED: undefined,
110
-
111
- CYLINDER_INTERSECTION_INDEX_RADIUS_MAX: undefined,
112
- CYLINDER_INTERSECTION_INDEX_RADIUS_MIN: undefined,
113
- CYLINDER_INTERSECTION_INDEX_ANGLE: undefined,
114
- };
172
+ shaderDefines: {
173
+ get: function () {
174
+ return this._shaderDefines;
175
+ },
176
+ },
115
177
 
116
178
  /**
117
179
  * The maximum number of intersections against the shape for any ray direction.
118
- * @private
180
+ * @memberof VoxelCylinderShape.prototype
119
181
  * @type {number}
120
182
  * @readonly
183
+ * @private
121
184
  */
122
- this.shaderMaximumIntersectionsLength = 0; // not known until update
123
- }
185
+ shaderMaximumIntersectionsLength: {
186
+ get: function () {
187
+ return this._shaderMaximumIntersectionsLength;
188
+ },
189
+ },
190
+ });
124
191
 
125
192
  const scratchScale = new Cartesian3();
126
193
  const scratchClipMinBounds = new Cartesian3();
127
194
  const scratchClipMaxBounds = new Cartesian3();
128
195
  const scratchRenderMinBounds = new Cartesian3();
129
196
  const scratchRenderMaxBounds = new Cartesian3();
197
+ const scratchTransformPositionWorldToLocal = new Matrix4();
198
+ const scratchCameraPositionLocal = new Cartesian3();
199
+ const scratchCameraRadialPosition = new Cartesian2();
130
200
 
131
201
  /**
132
202
  * Update the shape's state.
@@ -158,15 +228,15 @@ VoxelCylinderShape.prototype.update = function (
158
228
  maxBounds = Cartesian3.clone(maxBounds, this._maxBounds);
159
229
 
160
230
  const { DefaultMinBounds, DefaultMaxBounds } = VoxelCylinderShape;
161
- const defaultAngleRange = DefaultMaxBounds.y - DefaultMinBounds.y;
162
- const defaultAngleRangeHalf = 0.5 * defaultAngleRange;
231
+ const defaultAngleRange = DefaultMaxBounds.y - DefaultMinBounds.y; // == 2 * PI
232
+ const defaultAngleRangeHalf = 0.5 * defaultAngleRange; // == PI
163
233
 
164
234
  const epsilonZeroScale = CesiumMath.EPSILON10;
165
- const epsilonAngleDiscontinuity = CesiumMath.EPSILON3; // 0.001 radians = 0.05729578 degrees
166
235
  const epsilonAngle = CesiumMath.EPSILON10;
167
236
 
168
237
  // Clamp the bounds to the valid range
169
238
  minBounds.x = Math.max(0.0, minBounds.x);
239
+ // TODO: require maxBounds.x >= minBounds.x ?
170
240
  maxBounds.x = Math.max(0.0, maxBounds.x);
171
241
  minBounds.y = CesiumMath.negativePiToPi(minBounds.y);
172
242
  maxBounds.y = CesiumMath.negativePiToPi(maxBounds.y);
@@ -174,6 +244,10 @@ VoxelCylinderShape.prototype.update = function (
174
244
  clipMinBounds.y = CesiumMath.negativePiToPi(clipMinBounds.y);
175
245
  clipMaxBounds.y = CesiumMath.negativePiToPi(clipMaxBounds.y);
176
246
 
247
+ // TODO: what does this do with partial volumes crossing the antimeridian?
248
+ // We could have minBounds.y = +PI/2 and maxBounds.y = -PI/2.
249
+ // Then clipMinBounds.y = +PI/4 and clipMaxBounds.y = -PI/4.
250
+ // This maximumByComponent would cancel the clipping.
177
251
  const renderMinBounds = Cartesian3.maximumByComponent(
178
252
  minBounds,
179
253
  clipMinBounds,
@@ -205,57 +279,35 @@ VoxelCylinderShape.prototype.update = function (
205
279
  return false;
206
280
  }
207
281
 
208
- this.shapeTransform = Matrix4.clone(modelMatrix, this.shapeTransform);
282
+ // Update the render bounds planes
283
+ const renderBoundPlanes = this._renderBoundPlanes;
284
+ renderBoundPlanes.get(0).distance = renderMinBounds.z;
285
+ renderBoundPlanes.get(1).distance = -renderMaxBounds.z;
209
286
 
210
- this.orientedBoundingBox = getCylinderChunkObb(
287
+ this._shapeTransform = Matrix4.clone(modelMatrix, this._shapeTransform);
288
+
289
+ this._orientedBoundingBox = getCylinderChunkObb(
211
290
  renderMinBounds,
212
291
  renderMaxBounds,
213
- this.shapeTransform,
214
- this.orientedBoundingBox,
292
+ this._shapeTransform,
293
+ this._orientedBoundingBox,
215
294
  );
216
295
 
217
- this.boundTransform = Matrix4.fromRotationTranslation(
218
- this.orientedBoundingBox.halfAxes,
219
- this.orientedBoundingBox.center,
220
- this.boundTransform,
296
+ this._boundTransform = Matrix4.fromRotationTranslation(
297
+ this._orientedBoundingBox.halfAxes,
298
+ this._orientedBoundingBox.center,
299
+ this._boundTransform,
221
300
  );
222
301
 
223
- this.boundingSphere = BoundingSphere.fromOrientedBoundingBox(
224
- this.orientedBoundingBox,
225
- this.boundingSphere,
302
+ this._boundingSphere = BoundingSphere.fromOrientedBoundingBox(
303
+ this._orientedBoundingBox,
304
+ this._boundingSphere,
226
305
  );
227
306
 
228
- const shapeIsDefaultRadius =
229
- minBounds.x === DefaultMinBounds.x && maxBounds.x === DefaultMaxBounds.x;
230
307
  const shapeIsAngleReversed = maxBounds.y < minBounds.y;
231
308
  const shapeAngleRange =
232
309
  maxBounds.y - minBounds.y + shapeIsAngleReversed * defaultAngleRange;
233
- const shapeIsAngleRegular =
234
- shapeAngleRange > defaultAngleRangeHalf + epsilonAngle &&
235
- shapeAngleRange < defaultAngleRange - epsilonAngle;
236
- const shapeIsAngleFlipped =
237
- shapeAngleRange < defaultAngleRangeHalf - epsilonAngle;
238
- const shapeIsAngleRangeHalf =
239
- shapeAngleRange >= defaultAngleRangeHalf - epsilonAngle &&
240
- shapeAngleRange <= defaultAngleRangeHalf + epsilonAngle;
241
- const shapeHasAngle =
242
- shapeIsAngleRegular || shapeIsAngleFlipped || shapeIsAngleRangeHalf;
243
- const shapeIsMinAngleDiscontinuity = CesiumMath.equalsEpsilon(
244
- minBounds.y,
245
- DefaultMinBounds.y,
246
- undefined,
247
- epsilonAngleDiscontinuity,
248
- );
249
- const shapeIsMaxAngleDiscontinuity = CesiumMath.equalsEpsilon(
250
- maxBounds.y,
251
- DefaultMaxBounds.y,
252
- undefined,
253
- epsilonAngleDiscontinuity,
254
- );
255
- const shapeIsDefaultHeight =
256
- minBounds.z === DefaultMinBounds.z && maxBounds.z === DefaultMaxBounds.z;
257
310
 
258
- const renderIsDefaultMinRadius = renderMinBounds.x === DefaultMinBounds.x;
259
311
  const renderIsAngleReversed = renderMaxBounds.y < renderMinBounds.y;
260
312
  const renderAngleRange =
261
313
  renderMaxBounds.y -
@@ -271,7 +323,8 @@ VoxelCylinderShape.prototype.update = function (
271
323
  const renderHasAngle =
272
324
  renderIsAngleRegular || renderIsAngleFlipped || renderIsAngleRangeZero;
273
325
 
274
- const { shaderUniforms, shaderDefines } = this;
326
+ const shaderUniforms = this._shaderUniforms;
327
+ const shaderDefines = this._shaderDefines;
275
328
 
276
329
  // To keep things simple, clear the defines every time
277
330
  for (const key in shaderDefines) {
@@ -286,7 +339,11 @@ VoxelCylinderShape.prototype.update = function (
286
339
  shaderDefines["CYLINDER_INTERSECTION_INDEX_RADIUS_MAX"] = intersectionCount;
287
340
  intersectionCount += 1;
288
341
 
289
- if (!renderIsDefaultMinRadius) {
342
+ if (shapeAngleRange < defaultAngleRange - epsilonAngle) {
343
+ shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE"] = true;
344
+ }
345
+
346
+ if (renderMinBounds.x !== DefaultMinBounds.x) {
290
347
  shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN"] = true;
291
348
  shaderDefines["CYLINDER_INTERSECTION_INDEX_RADIUS_MIN"] = intersectionCount;
292
349
  intersectionCount += 1;
@@ -300,65 +357,32 @@ VoxelCylinderShape.prototype.update = function (
300
357
  if (renderMinBounds.x === renderMaxBounds.x) {
301
358
  shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT"] = true;
302
359
  }
303
- if (!shapeIsDefaultRadius) {
304
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_RADIUS"] = true;
305
-
306
- // delerp(radius, minRadius, maxRadius)
307
- // (radius - minRadius) / (maxRadius - minRadius)
308
- // radius / (maxRadius - minRadius) - minRadius / (maxRadius - minRadius)
309
- // scale = 1.0 / (maxRadius - minRadius)
310
- // offset = -minRadius / (maxRadius - minRadius)
311
- // offset = minRadius / (minRadius - maxRadius)
312
- const radiusRange = maxBounds.x - minBounds.x;
313
- let scale = 0.0;
314
- let offset = 1.0;
315
- if (radiusRange !== 0.0) {
316
- scale = 1.0 / radiusRange;
317
- offset = -minBounds.x / radiusRange;
318
- }
319
- shaderUniforms.cylinderUvToShapeUvRadius = Cartesian2.fromElements(
320
- scale,
321
- offset,
322
- shaderUniforms.cylinderUvToShapeUvRadius,
323
- );
324
- }
325
360
 
326
- if (!shapeIsDefaultHeight) {
327
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT"] = true;
328
-
329
- // delerp(heightUv, minHeightUv, maxHeightUv)
330
- // (heightUv - minHeightUv) / (maxHeightUv - minHeightUv)
331
- // heightUv / (maxHeightUv - minHeightUv) - minHeightUv / (maxHeightUv - minHeightUv)
332
- // scale = 1.0 / (maxHeightUv - minHeightUv)
333
- // scale = 1.0 / ((maxHeight * 0.5 + 0.5) - (minHeight * 0.5 + 0.5))
334
- // scale = 2.0 / (maxHeight - minHeight)
335
- // offset = -minHeightUv / (maxHeightUv - minHeightUv)
336
- // offset = -minHeightUv / ((maxHeight * 0.5 + 0.5) - (minHeight * 0.5 + 0.5))
337
- // offset = -2.0 * (minHeight * 0.5 + 0.5) / (maxHeight - minHeight)
338
- // offset = -(minHeight + 1.0) / (maxHeight - minHeight)
339
- // offset = (minHeight + 1.0) / (minHeight - maxHeight)
340
- const heightRange = maxBounds.z - minBounds.z;
341
- let scale = 0.0;
342
- let offset = 1.0;
343
- if (heightRange !== 0.0) {
344
- scale = 2.0 / heightRange;
345
- offset = -(minBounds.z + 1.0) / heightRange;
346
- }
347
- shaderUniforms.cylinderUvToShapeUvHeight = Cartesian2.fromElements(
348
- scale,
349
- offset,
350
- shaderUniforms.cylinderUvToShapeUvHeight,
351
- );
361
+ const radiusRange = maxBounds.x - minBounds.x;
362
+ let radialScale = 0.0;
363
+ let radialOffset = 1.0;
364
+ if (radiusRange !== 0.0) {
365
+ radialScale = 1.0 / radiusRange;
366
+ radialOffset = -minBounds.x * radialScale;
352
367
  }
353
- shaderUniforms.cylinderRenderHeightMinMax = Cartesian2.fromElements(
354
- renderMinBounds.z,
355
- renderMaxBounds.z,
356
- shaderUniforms.cylinderRenderHeightMinMax,
368
+ shaderUniforms.cylinderLocalToShapeUvRadius = Cartesian2.fromElements(
369
+ radialScale,
370
+ radialOffset,
371
+ shaderUniforms.cylinderLocalToShapeUvRadius,
357
372
  );
358
373
 
359
- if (shapeIsAngleReversed) {
360
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED"] = true;
374
+ const heightRange = maxBounds.z - minBounds.z; // Default 2.0
375
+ let heightScale = 0.0;
376
+ let heightOffset = 1.0;
377
+ if (heightRange !== 0.0) {
378
+ heightScale = 1.0 / heightRange;
379
+ heightOffset = -minBounds.z * heightScale;
361
380
  }
381
+ shaderUniforms.cylinderLocalToShapeUvHeight = Cartesian2.fromElements(
382
+ heightScale,
383
+ heightOffset,
384
+ shaderUniforms.cylinderLocalToShapeUvHeight,
385
+ );
362
386
 
363
387
  if (renderHasAngle) {
364
388
  shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_ANGLE"] = true;
@@ -382,64 +406,151 @@ VoxelCylinderShape.prototype.update = function (
382
406
  );
383
407
  }
384
408
 
385
- if (shapeHasAngle) {
386
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE"] = true;
387
- if (shapeIsMinAngleDiscontinuity) {
388
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY"] = true;
389
- }
390
- if (shapeIsMaxAngleDiscontinuity) {
391
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY"] = true;
392
- }
409
+ const uvMinAngle = (minBounds.y - DefaultMinBounds.y) / defaultAngleRange;
410
+ const uvMaxAngle = (maxBounds.y - DefaultMinBounds.y) / defaultAngleRange;
411
+ const uvAngleRangeZero = 1.0 - shapeAngleRange / defaultAngleRange;
393
412
 
394
- const uvMinAngle = (minBounds.y - DefaultMinBounds.y) / defaultAngleRange;
395
- const uvMaxAngle = (maxBounds.y - DefaultMinBounds.y) / defaultAngleRange;
396
- const uvAngleRangeZero = 1.0 - shapeAngleRange / defaultAngleRange;
413
+ // Translate the origin of UV angles (in [0,1]) to the center of the unoccupied space
414
+ const uvAngleRangeOrigin = (uvMaxAngle + 0.5 * uvAngleRangeZero) % 1.0;
415
+ shaderUniforms.cylinderShapeUvAngleRangeOrigin = uvAngleRangeOrigin;
397
416
 
398
- shaderUniforms.cylinderShapeUvAngleMinMax = Cartesian2.fromElements(
399
- uvMinAngle,
400
- uvMaxAngle,
401
- shaderUniforms.cylinderShapeUvAngleMinMax,
417
+ if (shapeAngleRange <= epsilonAngle) {
418
+ shaderUniforms.cylinderLocalToShapeUvAngle = Cartesian2.fromElements(
419
+ 0.0,
420
+ 1.0,
421
+ shaderUniforms.cylinderLocalToShapeUvAngle,
422
+ );
423
+ } else {
424
+ const scale = defaultAngleRange / shapeAngleRange;
425
+ const shiftedMinAngle = uvMinAngle - uvAngleRangeOrigin;
426
+ const offset = -scale * (shiftedMinAngle - Math.floor(shiftedMinAngle));
427
+ shaderUniforms.cylinderLocalToShapeUvAngle = Cartesian2.fromElements(
428
+ scale,
429
+ offset,
430
+ shaderUniforms.cylinderLocalToShapeUvAngle,
402
431
  );
403
- shaderUniforms.cylinderShapeUvAngleRangeZeroMid =
404
- (uvMaxAngle + 0.5 * uvAngleRangeZero) % 1.0;
405
-
406
- // delerp(angleUv, uvMinAngle, uvMaxAngle)
407
- // (angelUv - uvMinAngle) / (uvMaxAngle - uvMinAngle)
408
- // angleUv / (uvMaxAngle - uvMinAngle) - uvMinAngle / (uvMaxAngle - uvMinAngle)
409
- // scale = 1.0 / (uvMaxAngle - uvMinAngle)
410
- // scale = 1.0 / (((maxAngle - pi) / (2.0 * pi)) - ((minAngle - pi) / (2.0 * pi)))
411
- // scale = 2.0 * pi / (maxAngle - minAngle)
412
- // offset = -uvMinAngle / (uvMaxAngle - uvMinAngle)
413
- // offset = -((minAngle - pi) / (2.0 * pi)) / (((maxAngle - pi) / (2.0 * pi)) - ((minAngle - pi) / (2.0 * pi)))
414
- // offset = -(minAngle - pi) / (maxAngle - minAngle)
415
- if (shapeAngleRange <= epsilonAngle) {
416
- shaderUniforms.cylinderUvToShapeUvAngle = Cartesian2.fromElements(
417
- 0.0,
418
- 1.0,
419
- shaderUniforms.cylinderUvToShapeUvAngle,
420
- );
421
- } else {
422
- const scale = defaultAngleRange / shapeAngleRange;
423
- const offset = -(minBounds.y - DefaultMinBounds.y) / shapeAngleRange;
424
- shaderUniforms.cylinderUvToShapeUvAngle = Cartesian2.fromElements(
425
- scale,
426
- offset,
427
- shaderUniforms.cylinderUvToShapeUvAngle,
428
- );
429
- }
430
432
  }
431
433
 
432
- this.shaderMaximumIntersectionsLength = intersectionCount;
434
+ this._shaderMaximumIntersectionsLength = intersectionCount;
433
435
 
434
436
  return true;
435
437
  };
436
438
 
439
+ const scratchRotateRtuToLocal = new Matrix3();
440
+ const scratchRtuRotation = new Matrix3();
441
+ const scratchTransformPositionViewToLocal = new Matrix4();
442
+
443
+ /**
444
+ * Update any view-dependent transforms.
445
+ * @private
446
+ * @param {FrameState} frameState The frame state.
447
+ */
448
+ VoxelCylinderShape.prototype.updateViewTransforms = function (frameState) {
449
+ const shaderUniforms = this._shaderUniforms;
450
+ // 1. Update camera position in cylindrical coordinates
451
+ const transformPositionWorldToLocal = Matrix4.inverse(
452
+ this._shapeTransform,
453
+ scratchTransformPositionWorldToLocal,
454
+ );
455
+ const cameraPositionLocal = Matrix4.multiplyByPoint(
456
+ transformPositionWorldToLocal,
457
+ frameState.camera.positionWC,
458
+ scratchCameraPositionLocal,
459
+ );
460
+ shaderUniforms.cameraShapePosition = Cartesian3.fromElements(
461
+ Cartesian2.magnitude(cameraPositionLocal),
462
+ Math.atan2(cameraPositionLocal.y, cameraPositionLocal.x),
463
+ cameraPositionLocal.z,
464
+ shaderUniforms.cameraShapePosition,
465
+ );
466
+ // 2. Find radial, tangent, and up components at camera position
467
+ const cameraRadialDirection = Cartesian2.normalize(
468
+ Cartesian2.fromCartesian3(cameraPositionLocal, scratchCameraRadialPosition),
469
+ scratchCameraRadialPosition,
470
+ );
471
+ // As row vectors, the radial, tangent, and up vectors constitute a rotation matrix from local to RTU.
472
+ const rotateLocalToRtu = Matrix3.fromRowMajorArray(
473
+ [
474
+ cameraRadialDirection.x,
475
+ cameraRadialDirection.y,
476
+ 0.0,
477
+ -cameraRadialDirection.y,
478
+ cameraRadialDirection.x,
479
+ 0.0,
480
+ 0.0,
481
+ 0.0,
482
+ 1.0,
483
+ ],
484
+ scratchRotateRtuToLocal,
485
+ );
486
+ // 3. Get rotation from eye to local coordinates
487
+ const transformPositionViewToWorld =
488
+ frameState.context.uniformState.inverseView;
489
+ const transformPositionViewToLocal = Matrix4.multiplyTransformation(
490
+ transformPositionWorldToLocal,
491
+ transformPositionViewToWorld,
492
+ scratchTransformPositionViewToLocal,
493
+ );
494
+ const transformDirectionViewToLocal = Matrix4.getMatrix3(
495
+ transformPositionViewToLocal,
496
+ scratchRtuRotation,
497
+ );
498
+ // 4. Multiply to get rotation from eye to RTU coordinates
499
+ shaderUniforms.cylinderEcToRadialTangentUp = Matrix3.multiply(
500
+ rotateLocalToRtu,
501
+ transformDirectionViewToLocal,
502
+ shaderUniforms.cylinderEcToRadialTangentUp,
503
+ );
504
+ };
505
+
506
+ /**
507
+ * Convert a UV coordinate to the shape's UV space.
508
+ * @private
509
+ * @param {Cartesian3} positionLocal The local coordinate to convert.
510
+ * @param {Cartesian3} result The Cartesian3 to store the result in.
511
+ * @returns {Cartesian3} The converted UV coordinate.
512
+ */
513
+ VoxelCylinderShape.prototype.convertLocalToShapeUvSpace = function (
514
+ positionLocal,
515
+ result,
516
+ ) {
517
+ //>>includeStart('debug', pragmas.debug);
518
+ Check.typeOf.object("positionLocal", positionLocal);
519
+ Check.typeOf.object("result", result);
520
+ //>>includeEnd('debug');
521
+
522
+ let radius = Math.hypot(positionLocal.x, positionLocal.y);
523
+ let angle = Math.atan2(positionLocal.y, positionLocal.x);
524
+ let height = positionLocal.z;
525
+
526
+ const {
527
+ cylinderLocalToShapeUvRadius,
528
+ cylinderLocalToShapeUvAngle,
529
+ cylinderShapeUvAngleRangeOrigin,
530
+ cylinderLocalToShapeUvHeight,
531
+ } = this._shaderUniforms;
532
+
533
+ radius =
534
+ radius * cylinderLocalToShapeUvRadius.x + cylinderLocalToShapeUvRadius.y;
535
+
536
+ // Convert angle to a "UV" in [0,1] with 0 defined at the center of the unoccupied space.
537
+ angle = (angle + Math.PI) / (2.0 * Math.PI);
538
+ angle -= cylinderShapeUvAngleRangeOrigin;
539
+ angle = angle - Math.floor(angle);
540
+ // Scale and shift so [0,1] covers the occupied space.
541
+ angle = angle * cylinderLocalToShapeUvAngle.x + cylinderLocalToShapeUvAngle.y;
542
+
543
+ height =
544
+ height * cylinderLocalToShapeUvHeight.x + cylinderLocalToShapeUvHeight.y;
545
+
546
+ return Cartesian3.fromElements(radius, angle, height, result);
547
+ };
548
+
437
549
  const scratchMinBounds = new Cartesian3();
438
550
  const scratchMaxBounds = new Cartesian3();
439
551
 
440
552
  /**
441
553
  * Computes an oriented bounding box for a specified tile.
442
- * The update function must be called before calling this function.
443
554
  * @private
444
555
  * @param {number} tileLevel The tile's level.
445
556
  * @param {number} tileX The tile's x coordinate.
@@ -484,7 +595,7 @@ VoxelCylinderShape.prototype.computeOrientedBoundingBoxForTile = function (
484
595
  return getCylinderChunkObb(
485
596
  tileMinBounds,
486
597
  tileMaxBounds,
487
- this.shapeTransform,
598
+ this._shapeTransform,
488
599
  result,
489
600
  );
490
601
  };
@@ -493,7 +604,6 @@ const sampleSizeScratch = new Cartesian3();
493
604
 
494
605
  /**
495
606
  * Computes an oriented bounding box for a specified sample within a specified tile.
496
- * The update function must be called before calling this function.
497
607
  * @private
498
608
  * @param {SpatialNode} spatialNode The spatial node containing the sample
499
609
  * @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding
@@ -557,7 +667,7 @@ VoxelCylinderShape.prototype.computeOrientedBoundingBoxForSample = function (
557
667
  return getCylinderChunkObb(
558
668
  sampleMinBounds,
559
669
  sampleMaxBounds,
560
- this.shapeTransform,
670
+ this._shapeTransform,
561
671
  result,
562
672
  );
563
673
  };
@@ -639,6 +749,7 @@ function computeLooseOrientedBoundingBox(matrix, result) {
639
749
  return OrientedBoundingBox.fromPoints(corners, result);
640
750
  }
641
751
 
752
+ const scratchBoxScale = new Cartesian3();
642
753
  /**
643
754
  * Computes an {@link OrientedBoundingBox} for a subregion of the shape.
644
755
  *
@@ -720,7 +831,7 @@ function getCylinderChunkObb(chunkMinBounds, chunkMaxBounds, matrix, result) {
720
831
  extentX,
721
832
  extentY,
722
833
  extentZ,
723
- scratchScale,
834
+ scratchBoxScale,
724
835
  );
725
836
 
726
837
  const scaleMatrix = Matrix4.fromScale(scale, scratchScaleMatrix);