@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.
- package/Build/ThirdParty/Workers/z-worker-pako.js +1 -5
- package/Build/Workers/{chunk-7XEAYGZK.js → chunk-24YTYWNB.js} +10 -10
- package/Build/Workers/{chunk-IQBYFRVW.js → chunk-2632RVPI.js} +7 -7
- package/Build/Workers/chunk-2KACWKS4.js +501 -0
- package/Build/Workers/{chunk-QZAD5O7I.js → chunk-2XPLH3JY.js} +7 -7
- package/Build/Workers/{chunk-JY5YEZFA.js → chunk-2ZBL3MVO.js} +8 -8
- package/Build/Workers/{chunk-ZK5JOS3D.js → chunk-3NCVAGDA.js} +14 -14
- package/Build/Workers/{chunk-AR5DNBJ4.js → chunk-5R6VWLMH.js} +6 -6
- package/Build/Workers/{chunk-PTQQUQC3.js → chunk-5TIV3L26.js} +13 -13
- package/Build/Workers/{chunk-BZP4T2JJ.js → chunk-6WF3KIF5.js} +10 -10
- package/Build/Workers/{chunk-5WQ523AW.js → chunk-73FKKY52.js} +5 -5
- package/Build/Workers/{chunk-F6SE42BK.js → chunk-7COR472O.js} +15 -472
- package/Build/Workers/{chunk-72SANQJV.js → chunk-ADOVHYWO.js} +9 -5
- package/Build/Workers/{chunk-5YLJ77FF.js → chunk-BCU2LH5T.js} +12 -11
- package/Build/Workers/{chunk-4EBHOMFX.js → chunk-C3XBUYBO.js} +17 -17
- package/Build/Workers/{chunk-IX2JCCNM.js → chunk-C6OI26DR.js} +1 -1
- package/Build/Workers/{chunk-2HJWSU7B.js → chunk-CO35JNNE.js} +4 -4
- package/Build/Workers/{chunk-OVLG3FRS.js → chunk-DGDUKCJJ.js} +6 -6
- package/Build/Workers/{chunk-DTAIXKTO.js → chunk-DPUSFA7S.js} +6 -6
- package/Build/Workers/{chunk-R5X4OQT4.js → chunk-E6WXPSJS.js} +7 -7
- package/Build/Workers/{chunk-VK3EJHWI.js → chunk-EOXYZ34O.js} +2 -2
- package/Build/Workers/{chunk-RAEV7K66.js → chunk-EPKE7GE3.js} +5 -5
- package/Build/Workers/{chunk-GV56Q4LU.js → chunk-GFA4SMXV.js} +11 -11
- package/Build/Workers/{chunk-NKPBIX7F.js → chunk-GXUXEOE2.js} +1 -1
- package/Build/Workers/{chunk-NY3K4IM3.js → chunk-HBQPB6IH.js} +12 -12
- package/Build/Workers/{chunk-6HZQPRUS.js → chunk-I37B3MZ2.js} +1 -1
- package/Build/Workers/{chunk-VRGFV2UO.js → chunk-L4BW3RUA.js} +10 -10
- package/Build/Workers/{chunk-6VJVYK2V.js → chunk-LAQP3SCC.js} +2 -2
- package/Build/Workers/{chunk-PNBGBETF.js → chunk-LQJ5FFFR.js} +10 -10
- package/Build/Workers/{chunk-UAEW6HKG.js → chunk-M2AYBTNH.js} +13 -13
- package/Build/Workers/{chunk-YUCVWAY6.js → chunk-MWV7IZK4.js} +7 -7
- package/Build/Workers/{chunk-JXDC723O.js → chunk-N4KXMWQU.js} +2 -2
- package/Build/Workers/{chunk-XWXM2O2R.js → chunk-NP2GYYE5.js} +6 -6
- package/Build/Workers/{chunk-GEJTYLCO.js → chunk-NZWNZA6S.js} +5 -5
- package/Build/Workers/{chunk-LZGHD6NY.js → chunk-P2YAAMT2.js} +15 -15
- package/Build/Workers/{chunk-S6SKF6DT.js → chunk-P4XKB3QZ.js} +5 -5
- package/Build/Workers/{chunk-U2VCRRQW.js → chunk-PXB7T27O.js} +6 -6
- package/Build/Workers/{chunk-RV7ZYPFT.js → chunk-QCQUZGXI.js} +4 -4
- package/Build/Workers/{chunk-JJ4VBOQ3.js → chunk-QKBGRKKG.js} +4 -4
- package/Build/Workers/{chunk-ODW7WYM4.js → chunk-RMOEYCZW.js} +2 -2
- package/Build/Workers/{chunk-ZUA2UUNV.js → chunk-RSJXEO2A.js} +2 -2
- package/Build/Workers/{chunk-UDO6BFSF.js → chunk-RV7ZOSS6.js} +13 -13
- package/Build/Workers/{chunk-LZ7JIV3K.js → chunk-SE4PXOEA.js} +17 -17
- package/Build/Workers/{chunk-S4MAZ3SS.js → chunk-SS4ESNE3.js} +2 -2
- package/Build/Workers/{chunk-AIPU2VSX.js → chunk-TJBU6GML.js} +6 -6
- package/Build/Workers/{chunk-5M3U6ZMA.js → chunk-TZORKRNK.js} +1 -1
- package/Build/Workers/{chunk-MY3VNFGQ.js → chunk-VR5RBW52.js} +7 -7
- package/Build/Workers/{chunk-FP6GYBFX.js → chunk-WHUSTDIB.js} +10 -10
- package/Build/Workers/{chunk-5HDYHG3F.js → chunk-X2F6BEPY.js} +13 -13
- package/Build/Workers/{chunk-WZU2YLWG.js → chunk-X6XOMPWL.js} +3 -3
- package/Build/Workers/{chunk-UGK3FCDY.js → chunk-YDVSBWEO.js} +1 -1
- package/Build/Workers/{chunk-46UD5ABS.js → chunk-YV4H2Y7M.js} +4 -4
- package/Build/Workers/{chunk-WBQCVXR3.js → chunk-Z7FQLK6N.js} +4 -4
- package/Build/Workers/{chunk-L2ZN645J.js → chunk-ZNVSKMQ2.js} +6 -6
- package/Build/Workers/{chunk-JCNXK6EL.js → chunk-ZYPTP7GS.js} +11 -11
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -28
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +33 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -30
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/Source/Core/Check.d.ts +127 -0
- package/Source/Core/Check.js +0 -1
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/Transforms.js +3 -0
- package/Source/Core/VerticalExaggeration.js +2 -1
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/Entity.js +20 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- package/Source/Renderer/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Billboard.js +32 -0
- package/Source/Scene/BillboardCollection.js +1 -1
- package/Source/Scene/BingMapsImageryProvider.js +4 -0
- package/Source/Scene/Camera.js +46 -4
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
- package/Source/Scene/Cesium3DTileset.js +10 -7
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- package/Source/Scene/FrameState.js +5 -0
- package/Source/Scene/Globe.js +0 -67
- package/Source/Scene/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- package/Source/Scene/Label.js +33 -0
- package/Source/Scene/LabelCollection.js +2 -1
- package/Source/Scene/Model/pickModel.js +25 -7
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -5
- package/Source/Scene/Scene.js +126 -42
- package/Source/Scene/ScreenSpaceCameraController.js +21 -7
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- package/Source/Scene/VoxelBoxShape.js +67 -6
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +117 -163
- package/Source/Scene/VoxelEllipsoidShape.js +255 -304
- package/Source/Scene/VoxelPrimitive.js +109 -15
- package/Source/Scene/VoxelRenderResources.js +12 -3
- package/Source/Scene/VoxelShape.js +7 -4
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +3 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
- package/Source/Shaders/Voxels/IntersectBox.js +21 -47
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +76 -203
- package/Source/Shaders/Voxels/IntersectCylinder.js +76 -203
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +220 -229
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +220 -229
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
- package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
- package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
- package/Source/Shaders/Voxels/Megatexture.js +1 -2
- package/Source/Shaders/Voxels/Octree.glsl +14 -9
- package/Source/Shaders/Voxels/Octree.js +14 -9
- package/Source/Shaders/Voxels/VoxelFS.glsl +128 -40
- package/Source/Shaders/Voxels/VoxelFS.js +128 -40
- package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
- package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
- package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +64 -40
- package/Source/Shaders/Voxels/convertUvToCylinder.js +64 -40
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +100 -91
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +100 -91
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +542 -40
- package/index.js +75 -66
- package/package.json +2 -2
|
@@ -95,16 +95,16 @@ function VoxelEllipsoidShape() {
|
|
|
95
95
|
*/
|
|
96
96
|
this.shaderUniforms = {
|
|
97
97
|
ellipsoidRadiiUv: new Cartesian3(),
|
|
98
|
+
eccentricitySquared: 0.0,
|
|
99
|
+
evoluteScale: new Cartesian2(),
|
|
98
100
|
ellipsoidInverseRadiiSquaredUv: new Cartesian3(),
|
|
99
101
|
ellipsoidRenderLongitudeMinMax: new Cartesian2(),
|
|
100
102
|
ellipsoidShapeUvLongitudeMinMaxMid: new Cartesian3(),
|
|
101
103
|
ellipsoidUvToShapeUvLongitude: new Cartesian2(),
|
|
102
104
|
ellipsoidUvToShapeUvLatitude: new Cartesian2(),
|
|
103
|
-
|
|
105
|
+
ellipsoidRenderLatitudeSinMinMax: new Cartesian2(),
|
|
104
106
|
ellipsoidInverseHeightDifferenceUv: 0.0,
|
|
105
|
-
|
|
106
|
-
ellipsoidInverseInnerScaleUv: 0.0,
|
|
107
|
-
ellipsoidInverseOuterScaleUv: 0.0,
|
|
107
|
+
clipMinMaxHeight: new Cartesian2(),
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
/**
|
|
@@ -115,29 +115,18 @@ function VoxelEllipsoidShape() {
|
|
|
115
115
|
ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE: undefined,
|
|
116
116
|
ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO: undefined,
|
|
117
117
|
ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF: undefined,
|
|
118
|
-
ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF: undefined,
|
|
119
118
|
ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF: undefined,
|
|
120
119
|
ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY: undefined,
|
|
121
120
|
ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY: undefined,
|
|
122
121
|
ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE: undefined,
|
|
123
|
-
ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO: undefined,
|
|
124
122
|
ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED: undefined,
|
|
125
|
-
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE: undefined,
|
|
126
123
|
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF: undefined,
|
|
127
124
|
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF: undefined,
|
|
128
125
|
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF: undefined,
|
|
129
126
|
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF: undefined,
|
|
130
127
|
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF: undefined,
|
|
131
128
|
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF: undefined,
|
|
132
|
-
ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO: undefined,
|
|
133
129
|
ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE: undefined,
|
|
134
|
-
ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO: undefined,
|
|
135
|
-
ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX: undefined,
|
|
136
|
-
ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN: undefined,
|
|
137
|
-
ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT: undefined,
|
|
138
|
-
ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN: undefined,
|
|
139
|
-
ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT: undefined,
|
|
140
|
-
ELLIPSOID_IS_SPHERE: undefined,
|
|
141
130
|
ELLIPSOID_INTERSECTION_INDEX_LONGITUDE: undefined,
|
|
142
131
|
ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX: undefined,
|
|
143
132
|
ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN: undefined,
|
|
@@ -153,12 +142,17 @@ function VoxelEllipsoidShape() {
|
|
|
153
142
|
this.shaderMaximumIntersectionsLength = 0; // not known until update
|
|
154
143
|
}
|
|
155
144
|
|
|
145
|
+
const scratchActualMinBounds = new Cartesian3();
|
|
146
|
+
const scratchShapeMinBounds = new Cartesian3();
|
|
147
|
+
const scratchShapeMaxBounds = new Cartesian3();
|
|
148
|
+
const scratchClipMinBounds = new Cartesian3();
|
|
149
|
+
const scratchClipMaxBounds = new Cartesian3();
|
|
150
|
+
const scratchRenderMinBounds = new Cartesian3();
|
|
151
|
+
const scratchRenderMaxBounds = new Cartesian3();
|
|
156
152
|
const scratchScale = new Cartesian3();
|
|
157
153
|
const scratchRotationScale = new Matrix3();
|
|
158
154
|
const scratchShapeOuterExtent = new Cartesian3();
|
|
159
|
-
const scratchShapeInnerExtent = new Cartesian3();
|
|
160
155
|
const scratchRenderOuterExtent = new Cartesian3();
|
|
161
|
-
const scratchRenderInnerExtent = new Cartesian3();
|
|
162
156
|
const scratchRenderRectangle = new Rectangle();
|
|
163
157
|
|
|
164
158
|
/**
|
|
@@ -178,132 +172,83 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
178
172
|
clipMinBounds,
|
|
179
173
|
clipMaxBounds
|
|
180
174
|
) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
);
|
|
185
|
-
clipMaxBounds = defaultValue(
|
|
186
|
-
clipMaxBounds,
|
|
187
|
-
VoxelEllipsoidShape.DefaultMaxBounds
|
|
188
|
-
);
|
|
175
|
+
const { DefaultMinBounds, DefaultMaxBounds } = VoxelEllipsoidShape;
|
|
176
|
+
clipMinBounds = defaultValue(clipMinBounds, DefaultMinBounds);
|
|
177
|
+
clipMaxBounds = defaultValue(clipMaxBounds, DefaultMaxBounds);
|
|
189
178
|
//>>includeStart('debug', pragmas.debug);
|
|
190
179
|
Check.typeOf.object("modelMatrix", modelMatrix);
|
|
191
180
|
Check.typeOf.object("minBounds", minBounds);
|
|
192
181
|
Check.typeOf.object("maxBounds", maxBounds);
|
|
193
182
|
//>>includeEnd('debug');
|
|
194
183
|
|
|
195
|
-
const defaultMinLongitude = VoxelEllipsoidShape.DefaultMinBounds.x;
|
|
196
|
-
const defaultMaxLongitude = VoxelEllipsoidShape.DefaultMaxBounds.x;
|
|
197
|
-
const defaultLongitudeRange = defaultMaxLongitude - defaultMinLongitude;
|
|
198
|
-
const defaultLongitudeRangeHalf = 0.5 * defaultLongitudeRange;
|
|
199
|
-
const defaultMinLatitude = VoxelEllipsoidShape.DefaultMinBounds.y;
|
|
200
|
-
const defaultMaxLatitude = VoxelEllipsoidShape.DefaultMaxBounds.y;
|
|
201
|
-
const defaultLatitudeRange = defaultMaxLatitude - defaultMinLatitude;
|
|
202
|
-
|
|
203
184
|
const epsilonZeroScale = CesiumMath.EPSILON10;
|
|
204
185
|
const epsilonLongitudeDiscontinuity = CesiumMath.EPSILON3; // 0.001 radians = 0.05729578 degrees
|
|
205
186
|
const epsilonLongitude = CesiumMath.EPSILON10;
|
|
206
187
|
const epsilonLatitude = CesiumMath.EPSILON10;
|
|
207
188
|
const epsilonLatitudeFlat = CesiumMath.EPSILON3; // 0.001 radians = 0.05729578 degrees
|
|
208
189
|
|
|
209
|
-
//
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
);
|
|
215
|
-
const shapeMaxLongitude = CesiumMath.clamp(
|
|
216
|
-
maxBounds.x,
|
|
217
|
-
defaultMinLongitude,
|
|
218
|
-
defaultMaxLongitude
|
|
190
|
+
// Don't let the height go below the center of the ellipsoid.
|
|
191
|
+
const radii = Matrix4.getScale(modelMatrix, scratchScale);
|
|
192
|
+
const actualMinBounds = Cartesian3.clone(
|
|
193
|
+
DefaultMinBounds,
|
|
194
|
+
scratchActualMinBounds
|
|
219
195
|
);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
196
|
+
actualMinBounds.z = -Cartesian3.minimumComponent(radii);
|
|
197
|
+
|
|
198
|
+
const shapeMinBounds = Cartesian3.clamp(
|
|
199
|
+
minBounds,
|
|
200
|
+
actualMinBounds,
|
|
201
|
+
DefaultMaxBounds,
|
|
202
|
+
scratchShapeMinBounds
|
|
224
203
|
);
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
204
|
+
const shapeMaxBounds = Cartesian3.clamp(
|
|
205
|
+
maxBounds,
|
|
206
|
+
actualMinBounds,
|
|
207
|
+
DefaultMaxBounds,
|
|
208
|
+
scratchShapeMaxBounds
|
|
229
209
|
);
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
defaultMinLatitude,
|
|
236
|
-
defaultMaxLatitude
|
|
210
|
+
const clampedClipMinBounds = Cartesian3.clamp(
|
|
211
|
+
clipMinBounds,
|
|
212
|
+
actualMinBounds,
|
|
213
|
+
DefaultMaxBounds,
|
|
214
|
+
scratchClipMinBounds
|
|
237
215
|
);
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
216
|
+
const clampedClipMaxBounds = Cartesian3.clamp(
|
|
217
|
+
clipMaxBounds,
|
|
218
|
+
actualMinBounds,
|
|
219
|
+
DefaultMaxBounds,
|
|
220
|
+
scratchClipMaxBounds
|
|
242
221
|
);
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
222
|
+
const renderMinBounds = Cartesian3.maximumByComponent(
|
|
223
|
+
shapeMinBounds,
|
|
224
|
+
clampedClipMinBounds,
|
|
225
|
+
scratchRenderMinBounds
|
|
247
226
|
);
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
227
|
+
const renderMaxBounds = Cartesian3.minimumByComponent(
|
|
228
|
+
shapeMaxBounds,
|
|
229
|
+
clampedClipMaxBounds,
|
|
230
|
+
scratchRenderMaxBounds
|
|
252
231
|
);
|
|
253
232
|
|
|
254
|
-
|
|
255
|
-
const renderMaxLatitude = Math.min(shapeMaxLatitude, clipMaxLatitude);
|
|
256
|
-
|
|
257
|
-
// Don't let the height go below the center of the ellipsoid.
|
|
258
|
-
const radii = Matrix4.getScale(modelMatrix, scratchScale);
|
|
259
|
-
const isSphere = radii.x === radii.y && radii.y === radii.z;
|
|
260
|
-
const minRadius = Cartesian3.minimumComponent(radii);
|
|
261
|
-
const shapeMinHeight = Math.max(minBounds.z, -minRadius);
|
|
262
|
-
const shapeMaxHeight = Math.max(maxBounds.z, -minRadius);
|
|
263
|
-
const clipMinHeight = Math.max(clipMinBounds.z, -minRadius);
|
|
264
|
-
const clipMaxHeight = Math.max(clipMaxBounds.z, -minRadius);
|
|
265
|
-
const renderMinHeight = Math.max(shapeMinHeight, clipMinHeight);
|
|
266
|
-
const renderMaxHeight = Math.min(shapeMaxHeight, clipMaxHeight);
|
|
267
|
-
|
|
268
|
-
// Compute the closest and farthest a point can be from the center of the ellipsoid.
|
|
269
|
-
const shapeInnerExtent = Cartesian3.add(
|
|
270
|
-
radii,
|
|
271
|
-
Cartesian3.fromElements(
|
|
272
|
-
shapeMinHeight,
|
|
273
|
-
shapeMinHeight,
|
|
274
|
-
shapeMinHeight,
|
|
275
|
-
scratchShapeInnerExtent
|
|
276
|
-
),
|
|
277
|
-
scratchShapeInnerExtent
|
|
278
|
-
);
|
|
233
|
+
// Compute the farthest a point can be from the center of the ellipsoid.
|
|
279
234
|
const shapeOuterExtent = Cartesian3.add(
|
|
280
235
|
radii,
|
|
281
236
|
Cartesian3.fromElements(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
237
|
+
shapeMaxBounds.z,
|
|
238
|
+
shapeMaxBounds.z,
|
|
239
|
+
shapeMaxBounds.z,
|
|
285
240
|
scratchShapeOuterExtent
|
|
286
241
|
),
|
|
287
242
|
scratchShapeOuterExtent
|
|
288
243
|
);
|
|
289
244
|
const shapeMaxExtent = Cartesian3.maximumComponent(shapeOuterExtent);
|
|
290
245
|
|
|
291
|
-
const renderInnerExtent = Cartesian3.add(
|
|
292
|
-
radii,
|
|
293
|
-
Cartesian3.fromElements(
|
|
294
|
-
renderMinHeight,
|
|
295
|
-
renderMinHeight,
|
|
296
|
-
renderMinHeight,
|
|
297
|
-
scratchRenderInnerExtent
|
|
298
|
-
),
|
|
299
|
-
scratchRenderInnerExtent
|
|
300
|
-
);
|
|
301
246
|
const renderOuterExtent = Cartesian3.add(
|
|
302
247
|
radii,
|
|
303
248
|
Cartesian3.fromElements(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
249
|
+
renderMaxBounds.z,
|
|
250
|
+
renderMaxBounds.z,
|
|
251
|
+
renderMaxBounds.z,
|
|
307
252
|
scratchRenderOuterExtent
|
|
308
253
|
),
|
|
309
254
|
scratchRenderOuterExtent
|
|
@@ -312,10 +257,10 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
312
257
|
// Exit early if the shape is not visible.
|
|
313
258
|
// Note that minLongitude may be greater than maxLongitude when crossing the 180th meridian.
|
|
314
259
|
if (
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
260
|
+
renderMinBounds.y > renderMaxBounds.y ||
|
|
261
|
+
renderMinBounds.y === DefaultMaxBounds.y ||
|
|
262
|
+
renderMaxBounds.y === DefaultMinBounds.y ||
|
|
263
|
+
renderMinBounds.z > renderMaxBounds.z ||
|
|
319
264
|
CesiumMath.equalsEpsilon(
|
|
320
265
|
renderOuterExtent,
|
|
321
266
|
Cartesian3.ZERO,
|
|
@@ -327,29 +272,29 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
327
272
|
}
|
|
328
273
|
|
|
329
274
|
this._rectangle = Rectangle.fromRadians(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
275
|
+
shapeMinBounds.x,
|
|
276
|
+
shapeMinBounds.y,
|
|
277
|
+
shapeMaxBounds.x,
|
|
278
|
+
shapeMaxBounds.y
|
|
334
279
|
);
|
|
335
280
|
this._translation = Matrix4.getTranslation(modelMatrix, this._translation);
|
|
336
281
|
this._rotation = Matrix4.getRotation(modelMatrix, this._rotation);
|
|
337
282
|
this._ellipsoid = Ellipsoid.fromCartesian3(radii, this._ellipsoid);
|
|
338
|
-
this._minimumHeight =
|
|
339
|
-
this._maximumHeight =
|
|
283
|
+
this._minimumHeight = shapeMinBounds.z;
|
|
284
|
+
this._maximumHeight = shapeMaxBounds.z;
|
|
340
285
|
|
|
341
286
|
const renderRectangle = Rectangle.fromRadians(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
287
|
+
renderMinBounds.x,
|
|
288
|
+
renderMinBounds.y,
|
|
289
|
+
renderMaxBounds.x,
|
|
290
|
+
renderMaxBounds.y,
|
|
346
291
|
scratchRenderRectangle
|
|
347
292
|
);
|
|
348
293
|
|
|
349
294
|
this.orientedBoundingBox = getEllipsoidChunkObb(
|
|
350
295
|
renderRectangle,
|
|
351
|
-
|
|
352
|
-
|
|
296
|
+
renderMinBounds.z,
|
|
297
|
+
renderMaxBounds.z,
|
|
353
298
|
this._ellipsoid,
|
|
354
299
|
this._translation,
|
|
355
300
|
this._rotation,
|
|
@@ -374,33 +319,30 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
374
319
|
);
|
|
375
320
|
|
|
376
321
|
// Longitude
|
|
377
|
-
const
|
|
322
|
+
const defaultLongitudeRange = DefaultMaxBounds.x - DefaultMinBounds.x;
|
|
323
|
+
const defaultLongitudeRangeHalf = 0.5 * defaultLongitudeRange;
|
|
324
|
+
const renderIsLongitudeReversed = renderMaxBounds.x < renderMinBounds.x;
|
|
378
325
|
const renderLongitudeRange =
|
|
379
|
-
|
|
380
|
-
|
|
326
|
+
renderMaxBounds.x -
|
|
327
|
+
renderMinBounds.x +
|
|
381
328
|
renderIsLongitudeReversed * defaultLongitudeRange;
|
|
382
329
|
const renderIsLongitudeRangeZero = renderLongitudeRange <= epsilonLongitude;
|
|
383
330
|
const renderIsLongitudeRangeUnderHalf =
|
|
384
|
-
renderLongitudeRange > defaultLongitudeRangeHalf + epsilonLongitude &&
|
|
385
|
-
renderLongitudeRange < defaultLongitudeRange - epsilonLongitude;
|
|
386
|
-
const renderIsLongitudeRangeHalf =
|
|
387
331
|
renderLongitudeRange >= defaultLongitudeRangeHalf - epsilonLongitude &&
|
|
388
|
-
renderLongitudeRange
|
|
332
|
+
renderLongitudeRange < defaultLongitudeRange - epsilonLongitude;
|
|
389
333
|
const renderIsLongitudeRangeOverHalf =
|
|
390
334
|
renderLongitudeRange > epsilonLongitude &&
|
|
391
335
|
renderLongitudeRange < defaultLongitudeRangeHalf - epsilonLongitude;
|
|
392
336
|
const renderHasLongitude =
|
|
393
337
|
renderIsLongitudeRangeZero ||
|
|
394
338
|
renderIsLongitudeRangeUnderHalf ||
|
|
395
|
-
renderIsLongitudeRangeHalf ||
|
|
396
339
|
renderIsLongitudeRangeOverHalf;
|
|
397
340
|
|
|
398
|
-
const shapeIsLongitudeReversed =
|
|
341
|
+
const shapeIsLongitudeReversed = shapeMaxBounds.x < shapeMinBounds.x;
|
|
399
342
|
const shapeLongitudeRange =
|
|
400
|
-
|
|
401
|
-
|
|
343
|
+
shapeMaxBounds.x -
|
|
344
|
+
shapeMinBounds.x +
|
|
402
345
|
shapeIsLongitudeReversed * defaultLongitudeRange;
|
|
403
|
-
const shapeIsLongitudeRangeZero = shapeLongitudeRange <= epsilonLongitude;
|
|
404
346
|
const shapeIsLongitudeRangeUnderHalf =
|
|
405
347
|
shapeLongitudeRange > defaultLongitudeRangeHalf + epsilonLongitude &&
|
|
406
348
|
shapeLongitudeRange < defaultLongitudeRange - epsilonLongitude;
|
|
@@ -408,87 +350,63 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
408
350
|
shapeLongitudeRange >= defaultLongitudeRangeHalf - epsilonLongitude &&
|
|
409
351
|
shapeLongitudeRange <= defaultLongitudeRangeHalf + epsilonLongitude;
|
|
410
352
|
const shapeIsLongitudeRangeOverHalf =
|
|
411
|
-
shapeLongitudeRange > epsilonLongitude &&
|
|
412
353
|
shapeLongitudeRange < defaultLongitudeRangeHalf - epsilonLongitude;
|
|
413
354
|
const shapeHasLongitude =
|
|
414
|
-
shapeIsLongitudeRangeZero ||
|
|
415
355
|
shapeIsLongitudeRangeUnderHalf ||
|
|
416
356
|
shapeIsLongitudeRangeHalf ||
|
|
417
357
|
shapeIsLongitudeRangeOverHalf;
|
|
418
358
|
|
|
419
359
|
// Latitude
|
|
420
|
-
const renderIsLatitudeMaxUnderHalf =
|
|
360
|
+
const renderIsLatitudeMaxUnderHalf = renderMaxBounds.y < -epsilonLatitudeFlat;
|
|
421
361
|
const renderIsLatitudeMaxHalf =
|
|
422
|
-
|
|
423
|
-
|
|
362
|
+
renderMaxBounds.y >= -epsilonLatitudeFlat &&
|
|
363
|
+
renderMaxBounds.y <= +epsilonLatitudeFlat;
|
|
424
364
|
const renderIsLatitudeMaxOverHalf =
|
|
425
|
-
|
|
426
|
-
|
|
365
|
+
renderMaxBounds.y > +epsilonLatitudeFlat &&
|
|
366
|
+
renderMaxBounds.y < DefaultMaxBounds.y - epsilonLatitude;
|
|
427
367
|
const renderHasLatitudeMax =
|
|
428
368
|
renderIsLatitudeMaxUnderHalf ||
|
|
429
369
|
renderIsLatitudeMaxHalf ||
|
|
430
370
|
renderIsLatitudeMaxOverHalf;
|
|
431
371
|
const renderIsLatitudeMinUnderHalf =
|
|
432
|
-
|
|
433
|
-
|
|
372
|
+
renderMinBounds.y > DefaultMinBounds.y + epsilonLatitude &&
|
|
373
|
+
renderMinBounds.y < -epsilonLatitudeFlat;
|
|
434
374
|
const renderIsLatitudeMinHalf =
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
const renderIsLatitudeMinOverHalf =
|
|
375
|
+
renderMinBounds.y >= -epsilonLatitudeFlat &&
|
|
376
|
+
renderMinBounds.y <= +epsilonLatitudeFlat;
|
|
377
|
+
const renderIsLatitudeMinOverHalf = renderMinBounds.y > +epsilonLatitudeFlat;
|
|
438
378
|
const renderHasLatitudeMin =
|
|
439
379
|
renderIsLatitudeMinUnderHalf ||
|
|
440
380
|
renderIsLatitudeMinHalf ||
|
|
441
381
|
renderIsLatitudeMinOverHalf;
|
|
442
382
|
const renderHasLatitude = renderHasLatitudeMax || renderHasLatitudeMin;
|
|
443
383
|
|
|
444
|
-
const shapeLatitudeRange =
|
|
445
|
-
const shapeIsLatitudeMaxUnderHalf =
|
|
384
|
+
const shapeLatitudeRange = shapeMaxBounds.y - shapeMinBounds.y;
|
|
385
|
+
const shapeIsLatitudeMaxUnderHalf = shapeMaxBounds.y < -epsilonLatitudeFlat;
|
|
446
386
|
const shapeIsLatitudeMaxHalf =
|
|
447
|
-
|
|
448
|
-
|
|
387
|
+
shapeMaxBounds.y >= -epsilonLatitudeFlat &&
|
|
388
|
+
shapeMaxBounds.y <= +epsilonLatitudeFlat;
|
|
449
389
|
const shapeIsLatitudeMaxOverHalf =
|
|
450
|
-
|
|
451
|
-
|
|
390
|
+
shapeMaxBounds.y > +epsilonLatitudeFlat &&
|
|
391
|
+
shapeMaxBounds.y < DefaultMaxBounds.y - epsilonLatitude;
|
|
452
392
|
const shapeHasLatitudeMax =
|
|
453
393
|
shapeIsLatitudeMaxUnderHalf ||
|
|
454
394
|
shapeIsLatitudeMaxHalf ||
|
|
455
395
|
shapeIsLatitudeMaxOverHalf;
|
|
456
396
|
const shapeIsLatitudeMinUnderHalf =
|
|
457
|
-
|
|
458
|
-
|
|
397
|
+
shapeMinBounds.y > DefaultMinBounds.y + epsilonLatitude &&
|
|
398
|
+
shapeMinBounds.y < -epsilonLatitudeFlat;
|
|
459
399
|
const shapeIsLatitudeMinHalf =
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
const shapeIsLatitudeMinOverHalf =
|
|
400
|
+
shapeMinBounds.y >= -epsilonLatitudeFlat &&
|
|
401
|
+
shapeMinBounds.y <= +epsilonLatitudeFlat;
|
|
402
|
+
const shapeIsLatitudeMinOverHalf = shapeMinBounds.y > +epsilonLatitudeFlat;
|
|
463
403
|
const shapeHasLatitudeMin =
|
|
464
404
|
shapeIsLatitudeMinUnderHalf ||
|
|
465
405
|
shapeIsLatitudeMinHalf ||
|
|
466
406
|
shapeIsLatitudeMinOverHalf;
|
|
467
407
|
const shapeHasLatitude = shapeHasLatitudeMax || shapeHasLatitudeMin;
|
|
468
408
|
|
|
469
|
-
|
|
470
|
-
const renderHasMinHeight = !Cartesian3.equals(
|
|
471
|
-
renderInnerExtent,
|
|
472
|
-
Cartesian3.ZERO
|
|
473
|
-
);
|
|
474
|
-
const renderHasMaxHeight = !Cartesian3.equals(
|
|
475
|
-
renderOuterExtent,
|
|
476
|
-
Cartesian3.ZERO
|
|
477
|
-
);
|
|
478
|
-
const renderHasHeight = renderHasMinHeight || renderHasMaxHeight;
|
|
479
|
-
const renderHeightRange = renderMaxHeight - renderMinHeight;
|
|
480
|
-
const shapeHasMinHeight = !Cartesian3.equals(
|
|
481
|
-
shapeInnerExtent,
|
|
482
|
-
Cartesian3.ZERO
|
|
483
|
-
);
|
|
484
|
-
const shapeHasMaxHeight = !Cartesian3.equals(
|
|
485
|
-
shapeOuterExtent,
|
|
486
|
-
Cartesian3.ZERO
|
|
487
|
-
);
|
|
488
|
-
const shapeHasHeight = shapeHasMinHeight || shapeHasMaxHeight;
|
|
489
|
-
|
|
490
|
-
const shaderUniforms = this.shaderUniforms;
|
|
491
|
-
const shaderDefines = this.shaderDefines;
|
|
409
|
+
const { shaderUniforms, shaderDefines } = this;
|
|
492
410
|
|
|
493
411
|
// To keep things simple, clear the defines every time
|
|
494
412
|
for (const key in shaderDefines) {
|
|
@@ -503,6 +421,14 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
503
421
|
shapeMaxExtent,
|
|
504
422
|
shaderUniforms.ellipsoidRadiiUv
|
|
505
423
|
);
|
|
424
|
+
const { x: radiiUvX, z: radiiUvZ } = shaderUniforms.ellipsoidRadiiUv;
|
|
425
|
+
const axisRatio = radiiUvZ / radiiUvX;
|
|
426
|
+
shaderUniforms.eccentricitySquared = 1.0 - axisRatio * axisRatio;
|
|
427
|
+
shaderUniforms.evoluteScale = Cartesian2.fromElements(
|
|
428
|
+
(radiiUvX * radiiUvX - radiiUvZ * radiiUvZ) / radiiUvX,
|
|
429
|
+
(radiiUvZ * radiiUvZ - radiiUvX * radiiUvX) / radiiUvZ,
|
|
430
|
+
shaderUniforms.evoluteScale
|
|
431
|
+
);
|
|
506
432
|
|
|
507
433
|
// Used to compute geodetic surface normal.
|
|
508
434
|
shaderUniforms.ellipsoidInverseRadiiSquaredUv = Cartesian3.divideComponents(
|
|
@@ -518,53 +444,23 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
518
444
|
// Keep track of how many intersections there are going to be.
|
|
519
445
|
let intersectionCount = 0;
|
|
520
446
|
|
|
521
|
-
// Intersects
|
|
447
|
+
// Intersects outer and inner ellipsoid for the max and min height.
|
|
522
448
|
shaderDefines["ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX"] = intersectionCount;
|
|
523
449
|
intersectionCount += 1;
|
|
450
|
+
shaderDefines["ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN"] = intersectionCount;
|
|
451
|
+
intersectionCount += 1;
|
|
524
452
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (renderHasMinHeight) {
|
|
531
|
-
shaderDefines["ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN"] = true;
|
|
532
|
-
shaderDefines[
|
|
533
|
-
"ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN"
|
|
534
|
-
] = intersectionCount;
|
|
535
|
-
intersectionCount += 1;
|
|
536
|
-
|
|
537
|
-
// The inverse of the percent of space that is taken up by the inner ellipsoid, relative to the shape bounds
|
|
538
|
-
// 1.0 / (1.0 - thickness) // thickness = percent of space that is between the min and max height.
|
|
539
|
-
// 1.0 / (1.0 - (shapeMaxHeight - renderMinHeight) / shapeMaxExtent)
|
|
540
|
-
// shapeMaxExtent / (shapeMaxExtent - (shapeMaxHeight - renderMinHeight))
|
|
541
|
-
shaderUniforms.ellipsoidInverseInnerScaleUv =
|
|
542
|
-
shapeMaxExtent / (shapeMaxExtent - (shapeMaxHeight - renderMinHeight));
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
if (renderHasMaxHeight) {
|
|
546
|
-
shaderDefines["ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX"] = true;
|
|
547
|
-
shaderUniforms.ellipsoidInverseOuterScaleUv =
|
|
548
|
-
shapeMaxExtent / (shapeMaxExtent - (shapeMaxHeight - renderMaxHeight));
|
|
549
|
-
}
|
|
550
|
-
}
|
|
453
|
+
shaderUniforms.clipMinMaxHeight = Cartesian2.fromElements(
|
|
454
|
+
(renderMinBounds.z - shapeMaxBounds.z) / shapeMaxExtent,
|
|
455
|
+
(renderMaxBounds.z - shapeMaxBounds.z) / shapeMaxExtent,
|
|
456
|
+
shaderUniforms.clipMinMaxHeight
|
|
457
|
+
);
|
|
551
458
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
const thickness = (shapeMaxHeight - shapeMinHeight) / shapeMaxExtent;
|
|
558
|
-
shaderUniforms.ellipsoidInverseHeightDifferenceUv = 1.0 / thickness;
|
|
559
|
-
shaderUniforms.ellipseInnerRadiiUv = Cartesian2.fromElements(
|
|
560
|
-
shaderUniforms.ellipsoidRadiiUv.x * (1.0 - thickness),
|
|
561
|
-
shaderUniforms.ellipsoidRadiiUv.z * (1.0 - thickness),
|
|
562
|
-
shaderUniforms.ellipseInnerRadiiUv
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
if (shapeMinHeight === shapeMaxHeight) {
|
|
566
|
-
shaderDefines["ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT"] = true;
|
|
567
|
-
}
|
|
459
|
+
// The percent of space that is between the inner and outer ellipsoid.
|
|
460
|
+
const thickness = (shapeMaxBounds.z - shapeMinBounds.z) / shapeMaxExtent;
|
|
461
|
+
shaderUniforms.ellipsoidInverseHeightDifferenceUv = 1.0 / thickness;
|
|
462
|
+
if (shapeMinBounds.z === shapeMaxBounds.z) {
|
|
463
|
+
shaderUniforms.ellipsoidInverseHeightDifferenceUv = 0.0;
|
|
568
464
|
}
|
|
569
465
|
|
|
570
466
|
// Intersects a wedge for the min and max longitude.
|
|
@@ -582,11 +478,6 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
582
478
|
"ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF"
|
|
583
479
|
] = true;
|
|
584
480
|
intersectionCount += 2;
|
|
585
|
-
} else if (renderIsLongitudeRangeHalf) {
|
|
586
|
-
shaderDefines[
|
|
587
|
-
"ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF"
|
|
588
|
-
] = true;
|
|
589
|
-
intersectionCount += 1;
|
|
590
481
|
} else if (renderIsLongitudeRangeZero) {
|
|
591
482
|
shaderDefines[
|
|
592
483
|
"ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO"
|
|
@@ -595,8 +486,8 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
595
486
|
}
|
|
596
487
|
|
|
597
488
|
shaderUniforms.ellipsoidRenderLongitudeMinMax = Cartesian2.fromElements(
|
|
598
|
-
|
|
599
|
-
|
|
489
|
+
renderMinBounds.x,
|
|
490
|
+
renderMaxBounds.x,
|
|
600
491
|
shaderUniforms.ellipsoidRenderLongitudeMinMax
|
|
601
492
|
);
|
|
602
493
|
}
|
|
@@ -604,7 +495,7 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
604
495
|
if (shapeHasLongitude) {
|
|
605
496
|
shaderDefines["ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE"] = true;
|
|
606
497
|
|
|
607
|
-
const shapeIsLongitudeReversed =
|
|
498
|
+
const shapeIsLongitudeReversed = shapeMaxBounds.x < shapeMinBounds.x;
|
|
608
499
|
|
|
609
500
|
if (shapeIsLongitudeReversed) {
|
|
610
501
|
shaderDefines[
|
|
@@ -621,26 +512,34 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
621
512
|
// offset = -minLongitudeUv / (maxLongitudeUv - minLongitudeUv)
|
|
622
513
|
// offset = -((minLongitude - pi) / (2.0 * pi)) / (((maxLongitude - pi) / (2.0 * pi)) - ((minLongitude - pi) / (2.0 * pi)))
|
|
623
514
|
// offset = -(minLongitude - pi) / (maxLongitude - minLongitude)
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
515
|
+
if (shapeLongitudeRange <= epsilonLongitude) {
|
|
516
|
+
shaderUniforms.ellipsoidUvToShapeUvLongitude = Cartesian2.fromElements(
|
|
517
|
+
0.0,
|
|
518
|
+
1.0,
|
|
519
|
+
shaderUniforms.ellipsoidUvToShapeUvLongitude
|
|
520
|
+
);
|
|
521
|
+
} else {
|
|
522
|
+
const scale = defaultLongitudeRange / shapeLongitudeRange;
|
|
523
|
+
const offset =
|
|
524
|
+
-(shapeMinBounds.x - DefaultMinBounds.x) / shapeLongitudeRange;
|
|
525
|
+
shaderUniforms.ellipsoidUvToShapeUvLongitude = Cartesian2.fromElements(
|
|
526
|
+
scale,
|
|
527
|
+
offset,
|
|
528
|
+
shaderUniforms.ellipsoidUvToShapeUvLongitude
|
|
529
|
+
);
|
|
530
|
+
}
|
|
632
531
|
}
|
|
633
532
|
|
|
634
533
|
if (renderHasLongitude) {
|
|
635
534
|
const renderIsMinLongitudeDiscontinuity = CesiumMath.equalsEpsilon(
|
|
636
|
-
|
|
637
|
-
|
|
535
|
+
renderMinBounds.x,
|
|
536
|
+
DefaultMinBounds.x,
|
|
638
537
|
undefined,
|
|
639
538
|
epsilonLongitudeDiscontinuity
|
|
640
539
|
);
|
|
641
540
|
const renderIsMaxLongitudeDiscontinuity = CesiumMath.equalsEpsilon(
|
|
642
|
-
|
|
643
|
-
|
|
541
|
+
renderMaxBounds.x,
|
|
542
|
+
DefaultMaxBounds.x,
|
|
644
543
|
undefined,
|
|
645
544
|
epsilonLongitudeDiscontinuity
|
|
646
545
|
);
|
|
@@ -656,12 +555,12 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
656
555
|
] = true;
|
|
657
556
|
}
|
|
658
557
|
const uvShapeMinLongitude =
|
|
659
|
-
(
|
|
558
|
+
(shapeMinBounds.x - DefaultMinBounds.x) / defaultLongitudeRange;
|
|
660
559
|
const uvShapeMaxLongitude =
|
|
661
|
-
(
|
|
560
|
+
(shapeMaxBounds.x - DefaultMinBounds.x) / defaultLongitudeRange;
|
|
662
561
|
|
|
663
562
|
const uvRenderMaxLongitude =
|
|
664
|
-
(
|
|
563
|
+
(renderMaxBounds.x - DefaultMinBounds.x) / defaultLongitudeRange;
|
|
665
564
|
const uvRenderLongitudeRangeZero =
|
|
666
565
|
1.0 - renderLongitudeRange / defaultLongitudeRange;
|
|
667
566
|
const uvRenderLongitudeRangeZeroMid =
|
|
@@ -676,8 +575,6 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
676
575
|
}
|
|
677
576
|
|
|
678
577
|
if (renderHasLatitude) {
|
|
679
|
-
shaderDefines["ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE"] = true;
|
|
680
|
-
|
|
681
578
|
// Intersects a cone for min latitude
|
|
682
579
|
if (renderHasLatitudeMin) {
|
|
683
580
|
shaderDefines["ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN"] = true;
|
|
@@ -728,36 +625,16 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
728
625
|
}
|
|
729
626
|
}
|
|
730
627
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
const minCosHalfAngleSqr = Math.pow(
|
|
738
|
-
Math.cos(CesiumMath.PI_OVER_TWO - Math.abs(renderMinLatitude)),
|
|
739
|
-
2.0
|
|
740
|
-
);
|
|
741
|
-
const maxCosHalfAngleSqr = Math.pow(
|
|
742
|
-
Math.cos(CesiumMath.PI_OVER_TWO - Math.abs(renderMaxLatitude)),
|
|
743
|
-
2.0
|
|
744
|
-
);
|
|
745
|
-
shaderUniforms.ellipsoidRenderLatitudeCosSqrHalfMinMax = Cartesian2.fromElements(
|
|
746
|
-
minCosHalfAngleSqr,
|
|
747
|
-
maxCosHalfAngleSqr,
|
|
748
|
-
shaderUniforms.ellipsoidRenderLatitudeCosSqrHalfMinMax
|
|
628
|
+
shaderUniforms.ellipsoidRenderLatitudeSinMinMax = Cartesian2.fromElements(
|
|
629
|
+
Math.sin(renderMinBounds.y),
|
|
630
|
+
Math.sin(renderMaxBounds.y),
|
|
631
|
+
shaderUniforms.ellipsoidRenderLatitudeSinMinMax
|
|
749
632
|
);
|
|
750
633
|
}
|
|
751
634
|
|
|
752
635
|
if (shapeHasLatitude) {
|
|
753
636
|
shaderDefines["ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE"] = true;
|
|
754
637
|
|
|
755
|
-
if (shapeMinLatitude === shapeMaxLatitude) {
|
|
756
|
-
shaderDefines[
|
|
757
|
-
"ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO"
|
|
758
|
-
] = true;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
638
|
// delerp(latitudeUv, minLatitudeUv, maxLatitudeUv)
|
|
762
639
|
// (latitudeUv - minLatitudeUv) / (maxLatitudeUv - minLatitudeUv)
|
|
763
640
|
// latitudeUv / (maxLatitudeUv - minLatitudeUv) - minLatitudeUv / (maxLatitudeUv - minLatitudeUv)
|
|
@@ -768,17 +645,23 @@ VoxelEllipsoidShape.prototype.update = function (
|
|
|
768
645
|
// offset = -((minLatitude - -pi) / (2.0 * pi)) / (((maxLatitude - pi) / (2.0 * pi)) - ((minLatitude - pi) / (2.0 * pi)))
|
|
769
646
|
// offset = -(minLatitude - -pi) / (maxLatitude - minLatitude)
|
|
770
647
|
// offset = (-pi - minLatitude) / (maxLatitude - minLatitude)
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
648
|
+
if (shapeLatitudeRange < epsilonLatitude) {
|
|
649
|
+
shaderUniforms.ellipsoidUvToShapeUvLatitude = Cartesian2.fromElements(
|
|
650
|
+
0.0,
|
|
651
|
+
1.0,
|
|
652
|
+
shaderUniforms.ellipsoidUvToShapeUvLatitude
|
|
653
|
+
);
|
|
654
|
+
} else {
|
|
655
|
+
const defaultLatitudeRange = DefaultMaxBounds.y - DefaultMinBounds.y;
|
|
656
|
+
const scale = defaultLatitudeRange / shapeLatitudeRange;
|
|
657
|
+
const offset =
|
|
658
|
+
(DefaultMinBounds.y - shapeMinBounds.y) / shapeLatitudeRange;
|
|
659
|
+
shaderUniforms.ellipsoidUvToShapeUvLatitude = Cartesian2.fromElements(
|
|
660
|
+
scale,
|
|
661
|
+
offset,
|
|
662
|
+
shaderUniforms.ellipsoidUvToShapeUvLatitude
|
|
663
|
+
);
|
|
664
|
+
}
|
|
782
665
|
}
|
|
783
666
|
|
|
784
667
|
this.shaderMaximumIntersectionsLength = intersectionCount;
|
|
@@ -854,29 +737,89 @@ VoxelEllipsoidShape.prototype.computeOrientedBoundingBoxForTile = function (
|
|
|
854
737
|
);
|
|
855
738
|
};
|
|
856
739
|
|
|
740
|
+
const sampleSizeScratch = new Cartesian3();
|
|
741
|
+
const scratchTileMinBounds = new Cartesian3();
|
|
742
|
+
const scratchTileMaxBounds = new Cartesian3();
|
|
743
|
+
|
|
857
744
|
/**
|
|
858
|
-
* Computes an
|
|
745
|
+
* Computes an oriented bounding box for a specified sample within a specified tile.
|
|
859
746
|
* The update function must be called before calling this function.
|
|
860
747
|
*
|
|
861
|
-
* @param {
|
|
862
|
-
* @
|
|
748
|
+
* @param {SpatialNode} spatialNode The spatial node containing the sample
|
|
749
|
+
* @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding
|
|
750
|
+
* @param {Cartesian3} tileUv The sample coordinate within the tile
|
|
751
|
+
* @param {OrientedBoundingBox} result The oriented bounding box that will be set to enclose the specified sample
|
|
752
|
+
* @returns {OrientedBoundingBox} The oriented bounding box.
|
|
863
753
|
*/
|
|
864
|
-
VoxelEllipsoidShape.prototype.
|
|
865
|
-
|
|
754
|
+
VoxelEllipsoidShape.prototype.computeOrientedBoundingBoxForSample = function (
|
|
755
|
+
spatialNode,
|
|
756
|
+
tileDimensions,
|
|
757
|
+
tileUv,
|
|
758
|
+
result
|
|
866
759
|
) {
|
|
867
760
|
//>>includeStart('debug', pragmas.debug);
|
|
868
|
-
Check.typeOf.object("
|
|
761
|
+
Check.typeOf.object("spatialNode", spatialNode);
|
|
762
|
+
Check.typeOf.object("tileDimensions", tileDimensions);
|
|
763
|
+
Check.typeOf.object("tileUv", tileUv);
|
|
764
|
+
Check.typeOf.object("result", result);
|
|
869
765
|
//>>includeEnd('debug');
|
|
870
766
|
|
|
871
|
-
const
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
|
|
767
|
+
const tileSizeAtLevel = 1.0 / Math.pow(2.0, spatialNode.level);
|
|
768
|
+
const sampleSize = Cartesian3.divideComponents(
|
|
769
|
+
Cartesian3.ONE,
|
|
770
|
+
tileDimensions,
|
|
771
|
+
sampleSizeScratch
|
|
772
|
+
);
|
|
773
|
+
const sampleSizeAtLevel = Cartesian3.multiplyByScalar(
|
|
774
|
+
sampleSize,
|
|
775
|
+
tileSizeAtLevel,
|
|
776
|
+
sampleSizeScratch
|
|
777
|
+
);
|
|
875
778
|
|
|
876
|
-
const
|
|
877
|
-
(
|
|
878
|
-
|
|
879
|
-
|
|
779
|
+
const minLerp = Cartesian3.multiplyByScalar(
|
|
780
|
+
Cartesian3.fromElements(
|
|
781
|
+
spatialNode.x + tileUv.x,
|
|
782
|
+
spatialNode.y + tileUv.y,
|
|
783
|
+
spatialNode.z + tileUv.z,
|
|
784
|
+
scratchTileMinBounds
|
|
785
|
+
),
|
|
786
|
+
tileSizeAtLevel,
|
|
787
|
+
scratchTileMinBounds
|
|
788
|
+
);
|
|
789
|
+
const maxLerp = Cartesian3.add(
|
|
790
|
+
minLerp,
|
|
791
|
+
sampleSizeAtLevel,
|
|
792
|
+
scratchTileMaxBounds
|
|
793
|
+
);
|
|
794
|
+
|
|
795
|
+
const rectangle = Rectangle.subsection(
|
|
796
|
+
this._rectangle,
|
|
797
|
+
minLerp.x,
|
|
798
|
+
minLerp.y,
|
|
799
|
+
maxLerp.x,
|
|
800
|
+
maxLerp.y,
|
|
801
|
+
scratchRectangle
|
|
802
|
+
);
|
|
803
|
+
const minHeight = CesiumMath.lerp(
|
|
804
|
+
this._minimumHeight,
|
|
805
|
+
this._maximumHeight,
|
|
806
|
+
minLerp.z
|
|
807
|
+
);
|
|
808
|
+
const maxHeight = CesiumMath.lerp(
|
|
809
|
+
this._minimumHeight,
|
|
810
|
+
this._maximumHeight,
|
|
811
|
+
maxLerp.z
|
|
812
|
+
);
|
|
813
|
+
|
|
814
|
+
return getEllipsoidChunkObb(
|
|
815
|
+
rectangle,
|
|
816
|
+
minHeight,
|
|
817
|
+
maxHeight,
|
|
818
|
+
this._ellipsoid,
|
|
819
|
+
this._translation,
|
|
820
|
+
this._rotation,
|
|
821
|
+
result
|
|
822
|
+
);
|
|
880
823
|
};
|
|
881
824
|
|
|
882
825
|
/**
|
|
@@ -928,7 +871,11 @@ function getEllipsoidChunkObb(
|
|
|
928
871
|
* @readonly
|
|
929
872
|
*/
|
|
930
873
|
VoxelEllipsoidShape.DefaultMinBounds = Object.freeze(
|
|
931
|
-
new Cartesian3(
|
|
874
|
+
new Cartesian3(
|
|
875
|
+
-CesiumMath.PI,
|
|
876
|
+
-CesiumMath.PI_OVER_TWO,
|
|
877
|
+
-Ellipsoid.WGS84.minimumRadius
|
|
878
|
+
)
|
|
932
879
|
);
|
|
933
880
|
|
|
934
881
|
/**
|
|
@@ -939,7 +886,11 @@ VoxelEllipsoidShape.DefaultMinBounds = Object.freeze(
|
|
|
939
886
|
* @readonly
|
|
940
887
|
*/
|
|
941
888
|
VoxelEllipsoidShape.DefaultMaxBounds = Object.freeze(
|
|
942
|
-
new Cartesian3(
|
|
889
|
+
new Cartesian3(
|
|
890
|
+
CesiumMath.PI,
|
|
891
|
+
CesiumMath.PI_OVER_TWO,
|
|
892
|
+
10.0 * Ellipsoid.WGS84.maximumRadius
|
|
893
|
+
)
|
|
943
894
|
);
|
|
944
895
|
|
|
945
896
|
export default VoxelEllipsoidShape;
|