@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.
- package/Build/ThirdParty/Workers/zip-web-worker.js +637 -0
- package/Build/Workers/{chunk-7P7R7ERW.js → chunk-2T4WAVWX.js} +6 -6
- package/Build/Workers/{chunk-DNMSVJ4S.js → chunk-3G5XEUPY.js} +1 -1
- package/Build/Workers/{chunk-O7KDJVRH.js → chunk-3MSNTCHW.js} +9 -9
- package/Build/Workers/{chunk-7MCEUVPM.js → chunk-3OPG2FGI.js} +4 -4
- package/Build/Workers/{chunk-M4FSVD3C.js → chunk-3PUG3T2H.js} +12 -12
- package/Build/Workers/{chunk-CTU7LCVZ.js → chunk-4PH27XAL.js} +2 -2
- package/Build/Workers/{chunk-ZBLPNAYB.js → chunk-4VJYMLR6.js} +8 -8
- package/Build/Workers/{chunk-DAZVD3AH.js → chunk-5B3PGBQW.js} +11 -11
- package/Build/Workers/{chunk-UXIZVXIR.js → chunk-5GHCWGC4.js} +1 -1
- package/Build/Workers/{chunk-HZ22ZI3Q.js → chunk-5PEQUMCB.js} +12 -12
- package/Build/Workers/{chunk-HSVZWLJD.js → chunk-64WSG7AT.js} +4 -4
- package/Build/Workers/{chunk-ZJGO7T2S.js → chunk-6J6WGCWP.js} +4 -4
- package/Build/Workers/{chunk-OWV4L2GH.js → chunk-75B34CC6.js} +5 -5
- package/Build/Workers/{chunk-4MCKK5XE.js → chunk-7PLX65MV.js} +5 -5
- package/Build/Workers/{chunk-YVAOKOKX.js → chunk-AR2FUSG6.js} +1 -1
- package/Build/Workers/{chunk-JVNWWKXF.js → chunk-ARYRHDEB.js} +6 -6
- package/Build/Workers/{chunk-DAGWF5MM.js → chunk-B7INTBBB.js} +13 -13
- package/Build/Workers/{chunk-WNEY4A5P.js → chunk-BDPSQXLX.js} +5 -5
- package/Build/Workers/{chunk-LYKXQPGW.js → chunk-BU4CGMHO.js} +6 -6
- package/Build/Workers/{chunk-ECGKCTPM.js → chunk-BUBVUXDO.js} +6 -6
- package/Build/Workers/{chunk-LSYTMSIQ.js → chunk-CF72FAKC.js} +4 -4
- package/Build/Workers/{chunk-LZZA3PAR.js → chunk-DJ4ROETJ.js} +5 -5
- package/Build/Workers/{chunk-YNRRVRHO.js → chunk-E5XCZVIY.js} +1 -1
- package/Build/Workers/{chunk-RP4KKY2E.js → chunk-EAYW4CFP.js} +16 -16
- package/Build/Workers/{chunk-YW2UXIBU.js → chunk-EHFMZFVC.js} +4 -4
- package/Build/Workers/{chunk-HKHD5FDM.js → chunk-FFCKCQPK.js} +5 -5
- package/Build/Workers/{chunk-VQLQAENU.js → chunk-GKCZ2G36.js} +7 -7
- package/Build/Workers/{chunk-DJCPJJSP.js → chunk-HJ7IZBEI.js} +4 -4
- package/Build/Workers/{chunk-7FEVXX5D.js → chunk-JJZWDROM.js} +2 -2
- package/Build/Workers/{chunk-SLPWFCXZ.js → chunk-JUOEBO4F.js} +10 -10
- package/Build/Workers/{chunk-LHZKPI55.js → chunk-K4IDXMIZ.js} +9 -9
- package/Build/Workers/{chunk-D4VFVSGU.js → chunk-LL6HN3W4.js} +10 -10
- package/Build/Workers/{chunk-CZGSJ6ZG.js → chunk-LNTUIO55.js} +2 -2
- package/Build/Workers/{chunk-QFMJIXCL.js → chunk-LWOCFJEH.js} +9 -9
- package/Build/Workers/{chunk-2K5PKWLP.js → chunk-MMUISYW4.js} +16 -16
- package/Build/Workers/{chunk-IQKHPQNT.js → chunk-MXYW4BQ3.js} +2 -2
- package/Build/Workers/{chunk-XMIVNU5H.js → chunk-N6DVKXZD.js} +12 -12
- package/Build/Workers/{chunk-E2533KCN.js → chunk-NP46ZIBY.js} +3 -3
- package/Build/Workers/{chunk-O4DA3KRB.js → chunk-OW6F6CPZ.js} +7 -7
- package/Build/Workers/{chunk-QWHUQ4B7.js → chunk-P6OAOFBU.js} +8 -8
- package/Build/Workers/{chunk-4Z7AGRTU.js → chunk-PXDMWXO5.js} +2 -2
- package/Build/Workers/{chunk-WJ5THCIZ.js → chunk-QS7623NH.js} +6 -6
- package/Build/Workers/{chunk-OYFINQQA.js → chunk-ROH45IXJ.js} +7 -7
- package/Build/Workers/{chunk-2MEON5V4.js → chunk-S2P6LCIB.js} +4 -4
- package/Build/Workers/{chunk-JIXKGUWR.js → chunk-S4NZVXU6.js} +2 -2
- package/Build/Workers/{chunk-JHTZDMN6.js → chunk-SGGO5WVA.js} +5 -5
- package/Build/Workers/{chunk-UUXKGCBU.js → chunk-TG7N7TPY.js} +47 -50
- package/Build/Workers/{chunk-PFUF2QIK.js → chunk-TUZQG4RW.js} +14 -14
- package/Build/Workers/{chunk-LF74EILW.js → chunk-UHVE7V65.js} +12 -12
- package/Build/Workers/{chunk-L7PWWHKM.js → chunk-UY2HVPDL.js} +5 -5
- package/Build/Workers/{chunk-V65LOTF3.js → chunk-YNLPRFUQ.js} +6 -6
- package/Build/Workers/{chunk-RB3XS7EZ.js → chunk-ZYOHBCCE.js} +1 -1
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +21 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +19 -19
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/Source/Core/Event.js +41 -49
- package/Source/Core/GoogleMaps.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +30 -4
- package/Source/Core/Resource.js +5 -1
- package/Source/DataSources/KmlDataSource.js +62 -63
- package/Source/DataSources/exportKml.js +27 -30
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +308 -0
- package/Source/Scene/BatchTableHierarchy.js +2 -50
- package/Source/Scene/Billboard.js +4 -0
- package/Source/Scene/BillboardCollection.js +9 -2
- package/Source/Scene/ClippingPlaneCollection.js +3 -3
- package/Source/Scene/ClippingPolygon.js +91 -2
- package/Source/Scene/CreditDisplay.js +1 -1
- package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
- package/Source/Scene/GaussianSplatPrimitive.js +49 -50
- package/Source/Scene/Google2DImageryProvider.js +614 -0
- package/Source/Scene/IonImageryProvider.js +22 -1
- package/Source/Scene/LabelCollection.js +1 -0
- package/Source/Scene/Material.js +248 -80
- package/Source/Scene/PntsParser.js +65 -0
- package/Source/Scene/Primitive.js +6 -0
- package/Source/Scene/PrimitiveState.js +123 -0
- package/Source/Scene/Scene.js +2 -2
- package/Source/Scene/VoxelBoundsCollection.js +494 -0
- package/Source/Scene/VoxelBoxShape.js +236 -101
- package/Source/Scene/VoxelCylinderShape.js +315 -204
- package/Source/Scene/VoxelEllipsoidShape.js +402 -119
- package/Source/Scene/VoxelPrimitive.js +119 -84
- package/Source/Scene/VoxelRenderResources.js +17 -10
- package/Source/Scene/VoxelShape.js +21 -6
- package/Source/Scene/buildVoxelDrawCommands.js +61 -20
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
- package/Source/Scene/getClippingFunction.js +79 -88
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
- package/Source/Shaders/BillboardCollectionVS.js +2 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
- package/Source/Shaders/Voxels/IntersectBox.js +20 -33
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
- package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
- package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
- package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
- package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
- package/Source/Shaders/Voxels/Intersection.glsl +3 -3
- package/Source/Shaders/Voxels/Intersection.js +3 -3
- package/Source/Shaders/Voxels/Octree.glsl +46 -51
- package/Source/Shaders/Voxels/Octree.js +46 -51
- package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
- package/Source/Shaders/Voxels/VoxelFS.js +50 -48
- package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
- package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
- package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.d.ts +340 -14
- package/index.js +116 -114
- package/package.json +2 -2
- package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
- package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
- package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
- package/Source/Core/defaultValue.js +0 -48
- package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
- package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
- package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
- package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
- package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
- 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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
76
|
+
ellipsoidCurvatureAtLatitude: new Cartesian2(),
|
|
77
|
+
ellipsoidInverseRadiiSquared: new Cartesian3(),
|
|
108
78
|
ellipsoidRenderLongitudeMinMax: new Cartesian2(),
|
|
79
|
+
ellipsoidShapeUvLongitudeRangeOrigin: 0.0,
|
|
109
80
|
ellipsoidShapeUvLongitudeMinMaxMid: new Cartesian3(),
|
|
110
|
-
|
|
111
|
-
|
|
81
|
+
ellipsoidLocalToShapeUvLongitude: new Cartesian2(),
|
|
82
|
+
ellipsoidLocalToShapeUvLatitude: new Cartesian2(),
|
|
112
83
|
ellipsoidRenderLatitudeSinMinMax: new Cartesian2(),
|
|
113
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
363
|
+
this._orientedBoundingBox,
|
|
311
364
|
);
|
|
312
365
|
|
|
313
|
-
this.
|
|
314
|
-
|
|
366
|
+
this._shapeTransform = Matrix4.fromRotationTranslation(
|
|
367
|
+
this._rotation,
|
|
315
368
|
this._translation,
|
|
316
|
-
this.
|
|
369
|
+
this._shapeTransform,
|
|
317
370
|
);
|
|
318
371
|
|
|
319
|
-
this.
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
322
|
-
this.
|
|
372
|
+
this._boundTransform = Matrix4.fromRotationTranslation(
|
|
373
|
+
this._orientedBoundingBox.halfAxes,
|
|
374
|
+
this._orientedBoundingBox.center,
|
|
375
|
+
this._boundTransform,
|
|
323
376
|
);
|
|
324
377
|
|
|
325
|
-
this.
|
|
326
|
-
this.
|
|
327
|
-
this.
|
|
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
|
|
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
|
-
|
|
428
|
-
shaderUniforms.ellipsoidRadiiUv = Cartesian3.divideByScalar(
|
|
481
|
+
shaderUniforms.ellipsoidRadii = Cartesian3.clone(
|
|
429
482
|
shapeOuterExtent,
|
|
430
|
-
|
|
431
|
-
shaderUniforms.ellipsoidRadiiUv,
|
|
483
|
+
shaderUniforms.ellipsoidRadii,
|
|
432
484
|
);
|
|
433
|
-
const { x:
|
|
434
|
-
const axisRatio =
|
|
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
|
-
(
|
|
438
|
-
(
|
|
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.
|
|
495
|
+
shaderUniforms.ellipsoidInverseRadiiSquared = Cartesian3.divideComponents(
|
|
444
496
|
Cartesian3.ONE,
|
|
445
497
|
Cartesian3.multiplyComponents(
|
|
446
|
-
shaderUniforms.
|
|
447
|
-
shaderUniforms.
|
|
448
|
-
shaderUniforms.
|
|
498
|
+
shaderUniforms.ellipsoidRadii,
|
|
499
|
+
shaderUniforms.ellipsoidRadii,
|
|
500
|
+
shaderUniforms.ellipsoidInverseRadiiSquared,
|
|
449
501
|
),
|
|
450
|
-
shaderUniforms.
|
|
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
|
-
|
|
464
|
-
|
|
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 =
|
|
470
|
-
shaderUniforms.
|
|
521
|
+
const thickness = shapeMaxBounds.z - shapeMinBounds.z;
|
|
522
|
+
shaderUniforms.ellipsoidInverseHeightDifference = 1.0 / thickness;
|
|
471
523
|
if (shapeMinBounds.z === shapeMaxBounds.z) {
|
|
472
|
-
shaderUniforms.
|
|
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
|
|
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.
|
|
575
|
+
shaderUniforms.ellipsoidLocalToShapeUvLongitude = Cartesian2.fromElements(
|
|
522
576
|
0.0,
|
|
523
577
|
1.0,
|
|
524
|
-
shaderUniforms.
|
|
578
|
+
shaderUniforms.ellipsoidLocalToShapeUvLongitude,
|
|
525
579
|
);
|
|
526
580
|
} else {
|
|
527
581
|
const scale = defaultLongitudeRange / shapeLongitudeRange;
|
|
582
|
+
const shiftedMinLongitude = uvShapeMinLongitude - uvLongitudeRangeOrigin;
|
|
528
583
|
const offset =
|
|
529
|
-
-(
|
|
530
|
-
shaderUniforms.
|
|
584
|
+
-scale * (shiftedMinLongitude - Math.floor(shiftedMinLongitude));
|
|
585
|
+
shaderUniforms.ellipsoidLocalToShapeUvLongitude = Cartesian2.fromElements(
|
|
531
586
|
scale,
|
|
532
587
|
offset,
|
|
533
|
-
shaderUniforms.
|
|
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.
|
|
689
|
+
shaderUniforms.ellipsoidLocalToShapeUvLatitude = Cartesian2.fromElements(
|
|
645
690
|
0.0,
|
|
646
691
|
1.0,
|
|
647
|
-
shaderUniforms.
|
|
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.
|
|
699
|
+
shaderUniforms.ellipsoidLocalToShapeUvLatitude = Cartesian2.fromElements(
|
|
655
700
|
scale,
|
|
656
701
|
offset,
|
|
657
|
-
shaderUniforms.
|
|
702
|
+
shaderUniforms.ellipsoidLocalToShapeUvLatitude,
|
|
658
703
|
);
|
|
659
704
|
}
|
|
660
705
|
}
|
|
661
706
|
|
|
662
|
-
this.
|
|
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
|