@cesium/engine 22.2.0 → 23.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/Workers/{chunk-YFEZPDAY.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-A3NUMZBG.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-3JB2X2PR.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-VSZ5DB2W.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-PSHZAHFE.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-AMWXJ5A7.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-LDSQMLRC.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-MSTAVM2N.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-IWOSJVFQ.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-PMDPP22G.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-DIJ7IG5D.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-L2FSBEW2.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-G6WQA27G.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-3HUEBDFC.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-GMHDOQPH.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-7CDQUIP5.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-IVN5HSOI.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-72LZ3FN6.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-UBJYWGMV.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-VGH2CSC7.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-ED4UXMYY.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-JFN2DQHY.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-JERDRSEI.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-NY3CWLIZ.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-O3GWUTWM.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-64PJ4MTB.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-FPRM6PCE.js → chunk-IFA7VHHP.js} +560 -306
- package/Build/Workers/{chunk-FM5XPC2E.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-P7ISUYLW.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-JONWM4IO.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-JUOSYFXT.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-MWGB6DLR.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-C6FTHSJA.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-WH4HDRGN.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-4ZQN7M7E.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-SDUH3N6G.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-7OPRTZBT.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-CQCEPC6N.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-35J4D6PX.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-I45CATZK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-7MGTX4WP.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-DCR62BCO.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-XPNY2VY3.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-4I7BCCNU.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-2JNPWPLE.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-K64RQCRK.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-K6BXEBAF.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-2YVTOY5Z.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-4MCPC4TE.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-C35SJ4QP.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-BKYJBTHW.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-I4D5IP46.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-QO6Z5UJE.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-ZUWF63QU.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-N5MNKWED.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-V26Y7ZQL.js → chunk-ZIW5FCIW.js} +37 -27
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +20 -12
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/BoxGeometry.js +1 -1
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/CornerType.js +1 -1
- package/Source/Core/CorridorGeometry.js +1 -1
- package/Source/Core/FeatureDetection.js +1 -32
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/IntersectionTests.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/PinBuilder.js +1 -1
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometry.js +1 -1
- package/Source/Core/RectangleGeometry.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +4 -8
- package/Source/Core/TerrainMesh.js +11 -8
- package/Source/Core/TerrainPicker.js +24 -7
- package/Source/Core/VideoSynchronizer.js +1 -1
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Core/writeTextToCanvas.js +40 -86
- package/Source/DataSources/BillboardGraphics.js +1 -1
- package/Source/DataSources/BoxGraphics.js +1 -1
- package/Source/DataSources/CallbackPositionProperty.js +1 -1
- package/Source/DataSources/CorridorGraphics.js +1 -1
- package/Source/DataSources/CzmlDataSource.js +1 -1
- package/Source/DataSources/EllipseGraphics.js +1 -1
- package/Source/DataSources/EllipsoidGraphics.js +1 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/EntityCluster.js +2 -2
- package/Source/DataSources/GeoJsonDataSource.js +2 -2
- package/Source/DataSources/GpxDataSource.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -1
- package/Source/DataSources/KmlTour.js +1 -1
- package/Source/DataSources/LabelGraphics.js +1 -1
- package/Source/DataSources/ModelGraphics.js +1 -1
- package/Source/DataSources/PlaneGraphics.js +1 -1
- package/Source/DataSources/PolygonGraphics.js +1 -1
- package/Source/DataSources/PolylineGraphics.js +1 -1
- package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
- package/Source/DataSources/RectangleGraphics.js +1 -1
- package/Source/DataSources/WallGraphics.js +1 -1
- package/Source/DataSources/exportKml.js +1 -1
- package/Source/Renderer/Context.js +11 -10
- package/Source/Renderer/ContextLimits.js +66 -33
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Renderer/ShaderSource.js +19 -18
- package/Source/Renderer/Texture.js +1 -1
- package/Source/Renderer/Texture3D.js +166 -7
- package/Source/Renderer/TextureAtlas.js +2 -2
- package/Source/Scene/Appearance.js +1 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +8 -5
- package/Source/Scene/BillboardCollection.js +65 -26
- package/Source/Scene/BillboardTexture.js +4 -1
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/Camera.js +13 -2
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/CloudCollection.js +2 -2
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/CumulusCloud.js +1 -1
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/Fog.js +1 -1
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +907 -168
- package/Source/Scene/Globe.js +3 -10
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +323 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/ImageBasedLighting.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +2 -2
- package/Source/Scene/ImageryProvider.js +2 -2
- package/Source/Scene/Label.js +7 -5
- package/Source/Scene/LabelCollection.js +60 -2
- package/Source/Scene/Material.js +1 -1
- package/Source/Scene/MaterialAppearance.js +1 -1
- package/Source/Scene/Megatexture.js +174 -242
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/ModelComponents.js +10 -0
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/ParticleSystem.js +2 -2
- package/Source/Scene/PointPrimitive.js +1 -1
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/Polyline.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -4
- package/Source/Scene/PolylineColorAppearance.js +1 -6
- package/Source/Scene/PolylineMaterialAppearance.js +1 -6
- package/Source/Scene/PostProcessStageCollection.js +1 -1
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/QuadtreePrimitive.js +6 -3
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/ShadowMap.js +1 -2
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
- package/Source/Scene/Vector3DTilePolylines.js +1 -5
- package/Source/Scene/VoxelPrimitive.js +16 -33
- package/Source/Scene/VoxelRenderResources.js +1 -8
- package/Source/Scene/VoxelTraversal.js +16 -61
- package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Scene/processVoxelProperties.js +1 -1
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +9 -1
- package/Source/Shaders/Model/ModelFS.js +9 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -2
- package/Source/Shaders/Model/ModelVS.js +4 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
- package/Source/Shaders/Voxels/Megatexture.js +15 -83
- package/Source/Shaders/Voxels/Octree.glsl +6 -9
- package/Source/Shaders/Voxels/Octree.js +6 -9
- package/Source/Widget/CesiumWidget.js +1 -1
- package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
- package/index.d.ts +582 -193
- package/index.js +91 -83
- package/package.json +2 -1
- package/Build/Workers/chunk-ZGWX2R5I.js +0 -1443
|
@@ -9,7 +9,7 @@ uniform vec4 u_highlightColor;
|
|
|
9
9
|
in vec2 v_textureCoordinates;
|
|
10
10
|
in vec4 v_pickColor;
|
|
11
11
|
in vec4 v_color;
|
|
12
|
-
in
|
|
12
|
+
flat in vec2 v_splitDirectionAndEllipsoidDepthEC;
|
|
13
13
|
|
|
14
14
|
#ifdef SDF
|
|
15
15
|
in vec4 v_outlineColor;
|
|
@@ -126,28 +126,39 @@ void doThreePointDepthTest(float eyeDepth, bool applyTranslate) {
|
|
|
126
126
|
float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner
|
|
127
127
|
if (globeDepth3 == 0.0 || globeDepth3 < epsilonEyeDepth) return;
|
|
128
128
|
|
|
129
|
-
// All three key points are occluded, discard the fragment (and by extension the entire billboard)
|
|
129
|
+
// All three key points are occluded, discard the fragment (and by extension the entire billboard)
|
|
130
130
|
discard;
|
|
131
131
|
}
|
|
132
132
|
#endif
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
// by the globe when near and far from the camera.
|
|
136
|
-
void doDepthTest(float globeDepth) {
|
|
134
|
+
bool getDepthTestEnabled() {
|
|
137
135
|
float temp = v_compressed.y;
|
|
138
136
|
temp = temp * SHIFT_RIGHT1;
|
|
139
137
|
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
return temp2 != 0.0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
float getRelativeEyeDepth(float eyeDepth, float distanceToEllipsoid, float epsilon) {
|
|
142
|
+
float depthDifferential = eyeDepth - distanceToEllipsoid;
|
|
143
|
+
float depthRatio = abs(depthDifferential / distanceToEllipsoid);
|
|
144
|
+
if (depthRatio < epsilon) {
|
|
145
|
+
// The approximations are imprecise, so use an epsilon check for small value differences and assume a value of 0.0
|
|
146
|
+
return 0.0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return depthDifferential;
|
|
150
|
+
}
|
|
142
151
|
|
|
143
|
-
|
|
152
|
+
// Extra manual depth testing is done to allow more control over how a billboard is occluded
|
|
153
|
+
// by the globe when near and far from the camera.
|
|
154
|
+
void doDepthTest(float eyeDepth, float globeDepth) {
|
|
144
155
|
|
|
145
156
|
#ifdef FS_THREE_POINT_DEPTH_CHECK
|
|
146
157
|
// If the billboard is clamped to the ground and within a given distance, we do a 3-point depth test. This test is performed in the vertex shader, unless
|
|
147
158
|
// vertex texture sampling is not supported, in which case we do it here.
|
|
148
159
|
bool applyTranslate = floor(temp) != 0.0;
|
|
149
160
|
doThreePointDepthTest(eyeDepth, applyTranslate);
|
|
150
|
-
|
|
161
|
+
|
|
151
162
|
#elif defined(VS_THREE_POINT_DEPTH_CHECK)
|
|
152
163
|
// Since discarding vertices is not possible, the vertex shader sets eyeDepth to 0 to indicate the depth test failed. Apply the discard here.
|
|
153
164
|
if (eyeDepth > -u_threePointDepthTestDistance) {
|
|
@@ -157,27 +168,58 @@ void doDepthTest(float globeDepth) {
|
|
|
157
168
|
return;
|
|
158
169
|
}
|
|
159
170
|
#endif
|
|
171
|
+
bool useGlobeDepth = eyeDepth > -u_coarseDepthTestDistance;
|
|
172
|
+
if (useGlobeDepth && globeDepth == 0.0) {
|
|
173
|
+
// Pixel is not on the globe, so there is no distance to compare against. Pass.
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
160
176
|
|
|
161
|
-
// If
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (globeDepth == 0.0) return; // Not on globe
|
|
165
|
-
float distanceToEllipsoidCenter = -length(czm_viewerPositionWC); // depth is negative by convention
|
|
166
|
-
float testDistance = (eyeDepth > -u_coarseDepthTestDistance) ? globeDepth : distanceToEllipsoidCenter;
|
|
167
|
-
if (eyeDepth < testDistance) {
|
|
177
|
+
// If the camera is close, compare against the globe depth texture that includes depth from the 3D tile pass.
|
|
178
|
+
if (useGlobeDepth && getRelativeEyeDepth(eyeDepth, globeDepth, czm_epsilon1) < 0.0) {
|
|
168
179
|
discard;
|
|
169
180
|
}
|
|
170
181
|
}
|
|
171
182
|
|
|
183
|
+
#ifdef LOG_DEPTH
|
|
184
|
+
void writeDepth(float eyeDepth, float globeDepth, float distanceToEllipsoid) {
|
|
185
|
+
// If we've made it here, the manual depth test above determined that this fragment should be visible.
|
|
186
|
+
// But the automatic depth test must still run in order to write the result to the depth buffer, and its results may
|
|
187
|
+
// disagree with our manual depth test's results. To prefer our manual results when in front of the globe, apply an offset towards the camera.
|
|
188
|
+
|
|
189
|
+
float depthArg = v_depthFromNearPlusOne;
|
|
190
|
+
|
|
191
|
+
if (globeDepth != 0.0 && getRelativeEyeDepth(eyeDepth, distanceToEllipsoid, czm_epsilon3) > 0.0) {
|
|
192
|
+
float globeDepthFromNearPlusOne = (-globeDepth - czm_currentFrustum.x) + 1.0;
|
|
193
|
+
float nudge = max(globeDepthFromNearPlusOne * 5e-6, czm_epsilon7);
|
|
194
|
+
float globeOnTop = max(1.0, globeDepthFromNearPlusOne - nudge);
|
|
195
|
+
depthArg = min(depthArg, globeOnTop);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
czm_writeLogDepth(depthArg);
|
|
199
|
+
}
|
|
200
|
+
#endif
|
|
201
|
+
|
|
172
202
|
void main()
|
|
173
203
|
{
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
204
|
+
if (v_splitDirectionAndEllipsoidDepthEC.x < 0.0 && gl_FragCoord.x > czm_splitPosition) {
|
|
205
|
+
discard;
|
|
206
|
+
}
|
|
207
|
+
if (v_splitDirectionAndEllipsoidDepthEC.x > 0.0 && gl_FragCoord.x < czm_splitPosition) {
|
|
208
|
+
discard;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (getDepthTestEnabled()) {
|
|
212
|
+
vec2 fragSt = gl_FragCoord.xy / czm_viewport.zw;
|
|
213
|
+
float eyeDepth = v_compressed.x;
|
|
214
|
+
float globeDepth = getGlobeDepthAtCoords(fragSt);
|
|
215
|
+
float distanceToEllipsoid = -v_splitDirectionAndEllipsoidDepthEC.y;
|
|
216
|
+
doDepthTest(eyeDepth, globeDepth);
|
|
217
|
+
|
|
218
|
+
#ifdef LOG_DEPTH
|
|
219
|
+
writeDepth(eyeDepth, globeDepth, distanceToEllipsoid);
|
|
220
|
+
#endif
|
|
221
|
+
}
|
|
222
|
+
|
|
181
223
|
vec4 color = texture(u_atlas, v_textureCoordinates);
|
|
182
224
|
|
|
183
225
|
#ifdef SDF
|
|
@@ -242,20 +284,4 @@ void main()
|
|
|
242
284
|
color *= u_highlightColor;
|
|
243
285
|
#endif
|
|
244
286
|
out_FragColor = color;
|
|
245
|
-
|
|
246
|
-
#ifdef LOG_DEPTH
|
|
247
|
-
// If we've made it here, we passed our manual depth test, above. But the automatic depth test will
|
|
248
|
-
// still run, and some fragments of the billboard may clip against the globe. To prevent that,
|
|
249
|
-
// ensure the depth value we write out is in front of the globe depth.
|
|
250
|
-
float depthArg = v_depthFromNearPlusOne;
|
|
251
|
-
|
|
252
|
-
if (globeDepth != 0.0) { // On the globe
|
|
253
|
-
float globeDepthFromNearPlusOne = (-globeDepth - czm_currentFrustum.x) + 1.0;
|
|
254
|
-
float nudge = max(globeDepthFromNearPlusOne * 5e-6, czm_epsilon7);
|
|
255
|
-
float globeOnTop = max(1.0, globeDepthFromNearPlusOne - nudge);
|
|
256
|
-
depthArg = min(depthArg, globeOnTop);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
czm_writeLogDepth(depthArg);
|
|
260
|
-
#endif
|
|
261
|
-
}
|
|
287
|
+
}
|
|
@@ -10,7 +10,7 @@ uniform vec4 u_highlightColor;\n\
|
|
|
10
10
|
in vec2 v_textureCoordinates;\n\
|
|
11
11
|
in vec4 v_pickColor;\n\
|
|
12
12
|
in vec4 v_color;\n\
|
|
13
|
-
in
|
|
13
|
+
flat in vec2 v_splitDirectionAndEllipsoidDepthEC;\n\
|
|
14
14
|
\n\
|
|
15
15
|
#ifdef SDF\n\
|
|
16
16
|
in vec4 v_outlineColor;\n\
|
|
@@ -127,28 +127,39 @@ void doThreePointDepthTest(float eyeDepth, bool applyTranslate) {\n\
|
|
|
127
127
|
float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner\n\
|
|
128
128
|
if (globeDepth3 == 0.0 || globeDepth3 < epsilonEyeDepth) return;\n\
|
|
129
129
|
\n\
|
|
130
|
-
// All three key points are occluded, discard the fragment (and by extension the entire billboard)
|
|
130
|
+
// All three key points are occluded, discard the fragment (and by extension the entire billboard)\n\
|
|
131
131
|
discard;\n\
|
|
132
132
|
}\n\
|
|
133
133
|
#endif\n\
|
|
134
134
|
\n\
|
|
135
|
-
|
|
136
|
-
// by the globe when near and far from the camera.\n\
|
|
137
|
-
void doDepthTest(float globeDepth) {\n\
|
|
135
|
+
bool getDepthTestEnabled() {\n\
|
|
138
136
|
float temp = v_compressed.y;\n\
|
|
139
137
|
temp = temp * SHIFT_RIGHT1;\n\
|
|
140
138
|
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;\n\
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
return temp2 != 0.0;\n\
|
|
140
|
+
}\n\
|
|
141
|
+
\n\
|
|
142
|
+
float getRelativeEyeDepth(float eyeDepth, float distanceToEllipsoid, float epsilon) {\n\
|
|
143
|
+
float depthDifferential = eyeDepth - distanceToEllipsoid;\n\
|
|
144
|
+
float depthRatio = abs(depthDifferential / distanceToEllipsoid);\n\
|
|
145
|
+
if (depthRatio < epsilon) {\n\
|
|
146
|
+
// The approximations are imprecise, so use an epsilon check for small value differences and assume a value of 0.0\n\
|
|
147
|
+
return 0.0;\n\
|
|
148
|
+
}\n\
|
|
149
|
+
\n\
|
|
150
|
+
return depthDifferential;\n\
|
|
151
|
+
}\n\
|
|
143
152
|
\n\
|
|
144
|
-
|
|
153
|
+
// Extra manual depth testing is done to allow more control over how a billboard is occluded\n\
|
|
154
|
+
// by the globe when near and far from the camera.\n\
|
|
155
|
+
void doDepthTest(float eyeDepth, float globeDepth) {\n\
|
|
145
156
|
\n\
|
|
146
157
|
#ifdef FS_THREE_POINT_DEPTH_CHECK\n\
|
|
147
158
|
// If the billboard is clamped to the ground and within a given distance, we do a 3-point depth test. This test is performed in the vertex shader, unless\n\
|
|
148
159
|
// vertex texture sampling is not supported, in which case we do it here.\n\
|
|
149
160
|
bool applyTranslate = floor(temp) != 0.0;\n\
|
|
150
161
|
doThreePointDepthTest(eyeDepth, applyTranslate);\n\
|
|
151
|
-
|
|
162
|
+
\n\
|
|
152
163
|
#elif defined(VS_THREE_POINT_DEPTH_CHECK)\n\
|
|
153
164
|
// Since discarding vertices is not possible, the vertex shader sets eyeDepth to 0 to indicate the depth test failed. Apply the discard here.\n\
|
|
154
165
|
if (eyeDepth > -u_threePointDepthTestDistance) {\n\
|
|
@@ -158,27 +169,58 @@ void doDepthTest(float globeDepth) {\n\
|
|
|
158
169
|
return;\n\
|
|
159
170
|
}\n\
|
|
160
171
|
#endif\n\
|
|
172
|
+
bool useGlobeDepth = eyeDepth > -u_coarseDepthTestDistance;\n\
|
|
173
|
+
if (useGlobeDepth && globeDepth == 0.0) {\n\
|
|
174
|
+
// Pixel is not on the globe, so there is no distance to compare against. Pass.\n\
|
|
175
|
+
return;\n\
|
|
176
|
+
}\n\
|
|
161
177
|
\n\
|
|
162
|
-
// If
|
|
163
|
-
|
|
164
|
-
\n\
|
|
165
|
-
if (globeDepth == 0.0) return; // Not on globe \n\
|
|
166
|
-
float distanceToEllipsoidCenter = -length(czm_viewerPositionWC); // depth is negative by convention\n\
|
|
167
|
-
float testDistance = (eyeDepth > -u_coarseDepthTestDistance) ? globeDepth : distanceToEllipsoidCenter;\n\
|
|
168
|
-
if (eyeDepth < testDistance) {\n\
|
|
178
|
+
// If the camera is close, compare against the globe depth texture that includes depth from the 3D tile pass.\n\
|
|
179
|
+
if (useGlobeDepth && getRelativeEyeDepth(eyeDepth, globeDepth, czm_epsilon1) < 0.0) {\n\
|
|
169
180
|
discard;\n\
|
|
170
181
|
}\n\
|
|
171
182
|
}\n\
|
|
172
183
|
\n\
|
|
184
|
+
#ifdef LOG_DEPTH\n\
|
|
185
|
+
void writeDepth(float eyeDepth, float globeDepth, float distanceToEllipsoid) {\n\
|
|
186
|
+
// If we've made it here, the manual depth test above determined that this fragment should be visible.\n\
|
|
187
|
+
// But the automatic depth test must still run in order to write the result to the depth buffer, and its results may\n\
|
|
188
|
+
// disagree with our manual depth test's results. To prefer our manual results when in front of the globe, apply an offset towards the camera.\n\
|
|
189
|
+
\n\
|
|
190
|
+
float depthArg = v_depthFromNearPlusOne;\n\
|
|
191
|
+
\n\
|
|
192
|
+
if (globeDepth != 0.0 && getRelativeEyeDepth(eyeDepth, distanceToEllipsoid, czm_epsilon3) > 0.0) { \n\
|
|
193
|
+
float globeDepthFromNearPlusOne = (-globeDepth - czm_currentFrustum.x) + 1.0;\n\
|
|
194
|
+
float nudge = max(globeDepthFromNearPlusOne * 5e-6, czm_epsilon7);\n\
|
|
195
|
+
float globeOnTop = max(1.0, globeDepthFromNearPlusOne - nudge);\n\
|
|
196
|
+
depthArg = min(depthArg, globeOnTop);\n\
|
|
197
|
+
}\n\
|
|
198
|
+
\n\
|
|
199
|
+
czm_writeLogDepth(depthArg);\n\
|
|
200
|
+
}\n\
|
|
201
|
+
#endif\n\
|
|
202
|
+
\n\
|
|
173
203
|
void main()\n\
|
|
174
204
|
{\n\
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
\n\
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
205
|
+
if (v_splitDirectionAndEllipsoidDepthEC.x < 0.0 && gl_FragCoord.x > czm_splitPosition) {\n\
|
|
206
|
+
discard;\n\
|
|
207
|
+
}\n\
|
|
208
|
+
if (v_splitDirectionAndEllipsoidDepthEC.x > 0.0 && gl_FragCoord.x < czm_splitPosition) {\n\
|
|
209
|
+
discard;\n\
|
|
210
|
+
}\n\
|
|
211
|
+
\n\
|
|
212
|
+
if (getDepthTestEnabled()) {\n\
|
|
213
|
+
vec2 fragSt = gl_FragCoord.xy / czm_viewport.zw;\n\
|
|
214
|
+
float eyeDepth = v_compressed.x;\n\
|
|
215
|
+
float globeDepth = getGlobeDepthAtCoords(fragSt);\n\
|
|
216
|
+
float distanceToEllipsoid = -v_splitDirectionAndEllipsoidDepthEC.y;\n\
|
|
217
|
+
doDepthTest(eyeDepth, globeDepth);\n\
|
|
218
|
+
\n\
|
|
219
|
+
#ifdef LOG_DEPTH\n\
|
|
220
|
+
writeDepth(eyeDepth, globeDepth, distanceToEllipsoid);\n\
|
|
221
|
+
#endif\n\
|
|
222
|
+
}\n\
|
|
223
|
+
\n\
|
|
182
224
|
vec4 color = texture(u_atlas, v_textureCoordinates);\n\
|
|
183
225
|
\n\
|
|
184
226
|
#ifdef SDF\n\
|
|
@@ -243,20 +285,5 @@ void main()\n\
|
|
|
243
285
|
color *= u_highlightColor;\n\
|
|
244
286
|
#endif\n\
|
|
245
287
|
out_FragColor = color;\n\
|
|
246
|
-
\n\
|
|
247
|
-
|
|
248
|
-
// If we've made it here, we passed our manual depth test, above. But the automatic depth test will\n\
|
|
249
|
-
// still run, and some fragments of the billboard may clip against the globe. To prevent that,\n\
|
|
250
|
-
// ensure the depth value we write out is in front of the globe depth.\n\
|
|
251
|
-
float depthArg = v_depthFromNearPlusOne;\n\
|
|
252
|
-
\n\
|
|
253
|
-
if (globeDepth != 0.0) { // On the globe\n\
|
|
254
|
-
float globeDepthFromNearPlusOne = (-globeDepth - czm_currentFrustum.x) + 1.0;\n\
|
|
255
|
-
float nudge = max(globeDepthFromNearPlusOne * 5e-6, czm_epsilon7);\n\
|
|
256
|
-
float globeOnTop = max(1.0, globeDepthFromNearPlusOne - nudge);\n\
|
|
257
|
-
depthArg = min(depthArg, globeOnTop);\n\
|
|
258
|
-
}\n\
|
|
259
|
-
\n\
|
|
260
|
-
czm_writeLogDepth(depthArg);\n\
|
|
261
|
-
#endif\n\
|
|
262
|
-
}";
|
|
288
|
+
}\n\
|
|
289
|
+
";
|
|
@@ -26,11 +26,11 @@ out vec4 v_textureCoordinateBounds;
|
|
|
26
26
|
out vec4 v_originTextureCoordinateAndTranslate;
|
|
27
27
|
out mat2 v_rotationMatrix;
|
|
28
28
|
#endif
|
|
29
|
-
out vec4 v_compressed;
|
|
29
|
+
out vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
|
30
30
|
|
|
31
31
|
out vec4 v_pickColor;
|
|
32
32
|
out vec4 v_color;
|
|
33
|
-
out
|
|
33
|
+
flat out vec2 v_splitDirectionAndEllipsoidDepthEC; // x: splitDirection, y: ellipsoid depth in eye coordinates
|
|
34
34
|
#ifdef SDF
|
|
35
35
|
out vec4 v_outlineColor;
|
|
36
36
|
out float v_outlineWidth;
|
|
@@ -219,32 +219,18 @@ void main()
|
|
|
219
219
|
bool validAlignedAxis = false;
|
|
220
220
|
#endif
|
|
221
221
|
|
|
222
|
-
vec4
|
|
223
|
-
vec4
|
|
224
|
-
|
|
225
|
-
temp = compressedAttribute2.y;
|
|
226
|
-
temp = temp * SHIFT_RIGHT8;
|
|
227
|
-
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
228
|
-
temp = floor(temp) * SHIFT_RIGHT8;
|
|
229
|
-
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
230
|
-
pickColor.r = floor(temp);
|
|
231
|
-
|
|
232
|
-
temp = compressedAttribute2.x;
|
|
233
|
-
temp = temp * SHIFT_RIGHT8;
|
|
234
|
-
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
235
|
-
temp = floor(temp) * SHIFT_RIGHT8;
|
|
236
|
-
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
237
|
-
color.r = floor(temp);
|
|
222
|
+
vec4 color = czm_decodeRGB8(compressedAttribute2.x);
|
|
223
|
+
vec4 pickColor = czm_decodeRGB8(compressedAttribute2.y);
|
|
238
224
|
|
|
239
225
|
temp = compressedAttribute2.z * SHIFT_RIGHT8;
|
|
240
226
|
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;
|
|
241
227
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
242
228
|
|
|
243
229
|
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
244
|
-
pickColor /= 255.0;
|
|
230
|
+
pickColor.a /= 255.0;
|
|
245
231
|
|
|
246
232
|
color.a = floor(temp);
|
|
247
|
-
color /= 255.0;
|
|
233
|
+
color.a /= 255.0;
|
|
248
234
|
|
|
249
235
|
///////////////////////////////////////////////////////////////////////////
|
|
250
236
|
|
|
@@ -322,13 +308,25 @@ void main()
|
|
|
322
308
|
}
|
|
323
309
|
#endif
|
|
324
310
|
|
|
311
|
+
v_splitDirectionAndEllipsoidDepthEC.y = czm_infinity;
|
|
312
|
+
vec3 ellipsoidCenter = czm_view[3].xyz;
|
|
313
|
+
vec3 rayDirection = normalize(positionEC.xyz);
|
|
314
|
+
czm_ray ray = czm_ray(vec3(0.0), rayDirection);
|
|
315
|
+
vec3 ellipsoid_inverseRadii = czm_ellipsoidInverseRadii;
|
|
316
|
+
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);
|
|
317
|
+
|
|
318
|
+
if (!czm_isEmpty(intersection))
|
|
319
|
+
{
|
|
320
|
+
v_splitDirectionAndEllipsoidDepthEC.y = intersection.start;
|
|
321
|
+
}
|
|
322
|
+
|
|
325
323
|
v_compressed.y = enableDepthCheck;
|
|
326
324
|
|
|
327
325
|
#ifdef VS_THREE_POINT_DEPTH_CHECK
|
|
328
326
|
if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) && (enableDepthCheck == 1.0)) {
|
|
329
327
|
float depthsilon = 10.0;
|
|
330
328
|
vec2 depthOrigin;
|
|
331
|
-
// Horizontal origin for labels comes from a special attribute. If that value is 0, this is a billboard - use the regular origin.
|
|
329
|
+
// Horizontal origin for labels comes from a special attribute. If that value is 0, this is a billboard - use the regular origin.
|
|
332
330
|
// Otherwise, transform the label origin to -1, 0, 1 (right, center, left).
|
|
333
331
|
depthOrigin.x = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));
|
|
334
332
|
depthOrigin.x = czm_branchFreeTernary(depthOrigin.x == 0.0, origin.x, depthOrigin.x - 2.0);
|
|
@@ -414,23 +412,16 @@ if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) &
|
|
|
414
412
|
#endif
|
|
415
413
|
|
|
416
414
|
#ifdef SDF
|
|
417
|
-
vec4 outlineColor;
|
|
415
|
+
vec4 outlineColor = czm_decodeRGB8(sdf.x);
|
|
418
416
|
float outlineWidth;
|
|
419
417
|
|
|
420
|
-
temp = sdf.x;
|
|
421
|
-
temp = temp * SHIFT_RIGHT8;
|
|
422
|
-
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
423
|
-
temp = floor(temp) * SHIFT_RIGHT8;
|
|
424
|
-
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
425
|
-
outlineColor.r = floor(temp);
|
|
426
|
-
|
|
427
418
|
temp = sdf.y;
|
|
428
419
|
temp = temp * SHIFT_RIGHT8;
|
|
429
420
|
float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
430
421
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
431
422
|
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
432
423
|
outlineColor.a = floor(temp);
|
|
433
|
-
outlineColor /= 255.0;
|
|
424
|
+
outlineColor.a /= 255.0;
|
|
434
425
|
|
|
435
426
|
v_outlineWidth = outlineWidth / 255.0;
|
|
436
427
|
v_outlineColor = outlineColor;
|
|
@@ -441,5 +432,5 @@ if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) &
|
|
|
441
432
|
|
|
442
433
|
v_color = color;
|
|
443
434
|
v_color.a *= translucency;
|
|
444
|
-
|
|
435
|
+
v_splitDirectionAndEllipsoidDepthEC.x = splitDirection;
|
|
445
436
|
}
|
|
@@ -27,11 +27,11 @@ out vec4 v_textureCoordinateBounds;\n\
|
|
|
27
27
|
out vec4 v_originTextureCoordinateAndTranslate;\n\
|
|
28
28
|
out mat2 v_rotationMatrix;\n\
|
|
29
29
|
#endif\n\
|
|
30
|
-
out vec4 v_compressed;
|
|
30
|
+
out vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize\n\
|
|
31
31
|
\n\
|
|
32
32
|
out vec4 v_pickColor;\n\
|
|
33
33
|
out vec4 v_color;\n\
|
|
34
|
-
out
|
|
34
|
+
flat out vec2 v_splitDirectionAndEllipsoidDepthEC; // x: splitDirection, y: ellipsoid depth in eye coordinates\n\
|
|
35
35
|
#ifdef SDF\n\
|
|
36
36
|
out vec4 v_outlineColor;\n\
|
|
37
37
|
out float v_outlineWidth;\n\
|
|
@@ -220,32 +220,18 @@ void main()\n\
|
|
|
220
220
|
bool validAlignedAxis = false;\n\
|
|
221
221
|
#endif\n\
|
|
222
222
|
\n\
|
|
223
|
-
vec4
|
|
224
|
-
vec4
|
|
225
|
-
\n\
|
|
226
|
-
temp = compressedAttribute2.y;\n\
|
|
227
|
-
temp = temp * SHIFT_RIGHT8;\n\
|
|
228
|
-
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
229
|
-
temp = floor(temp) * SHIFT_RIGHT8;\n\
|
|
230
|
-
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
231
|
-
pickColor.r = floor(temp);\n\
|
|
232
|
-
\n\
|
|
233
|
-
temp = compressedAttribute2.x;\n\
|
|
234
|
-
temp = temp * SHIFT_RIGHT8;\n\
|
|
235
|
-
color.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
236
|
-
temp = floor(temp) * SHIFT_RIGHT8;\n\
|
|
237
|
-
color.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
238
|
-
color.r = floor(temp);\n\
|
|
223
|
+
vec4 color = czm_decodeRGB8(compressedAttribute2.x);\n\
|
|
224
|
+
vec4 pickColor = czm_decodeRGB8(compressedAttribute2.y);\n\
|
|
239
225
|
\n\
|
|
240
226
|
temp = compressedAttribute2.z * SHIFT_RIGHT8;\n\
|
|
241
227
|
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;\n\
|
|
242
228
|
temp = floor(temp) * SHIFT_RIGHT8;\n\
|
|
243
229
|
\n\
|
|
244
230
|
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
245
|
-
pickColor /= 255.0;\n\
|
|
231
|
+
pickColor.a /= 255.0;\n\
|
|
246
232
|
\n\
|
|
247
233
|
color.a = floor(temp);\n\
|
|
248
|
-
color /= 255.0;\n\
|
|
234
|
+
color.a /= 255.0;\n\
|
|
249
235
|
\n\
|
|
250
236
|
///////////////////////////////////////////////////////////////////////////\n\
|
|
251
237
|
\n\
|
|
@@ -322,6 +308,18 @@ void main()\n\
|
|
|
322
308
|
enableDepthCheck = 0.0;\n\
|
|
323
309
|
}\n\
|
|
324
310
|
#endif\n\
|
|
311
|
+
\n\
|
|
312
|
+
v_splitDirectionAndEllipsoidDepthEC.y = czm_infinity;\n\
|
|
313
|
+
vec3 ellipsoidCenter = czm_view[3].xyz;\n\
|
|
314
|
+
vec3 rayDirection = normalize(positionEC.xyz);\n\
|
|
315
|
+
czm_ray ray = czm_ray(vec3(0.0), rayDirection);\n\
|
|
316
|
+
vec3 ellipsoid_inverseRadii = czm_ellipsoidInverseRadii;\n\
|
|
317
|
+
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\n\
|
|
318
|
+
\n\
|
|
319
|
+
if (!czm_isEmpty(intersection))\n\
|
|
320
|
+
{\n\
|
|
321
|
+
v_splitDirectionAndEllipsoidDepthEC.y = intersection.start;\n\
|
|
322
|
+
}\n\
|
|
325
323
|
\n\
|
|
326
324
|
v_compressed.y = enableDepthCheck;\n\
|
|
327
325
|
\n\
|
|
@@ -329,7 +327,7 @@ void main()\n\
|
|
|
329
327
|
if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) && (enableDepthCheck == 1.0)) {\n\
|
|
330
328
|
float depthsilon = 10.0;\n\
|
|
331
329
|
vec2 depthOrigin;\n\
|
|
332
|
-
// Horizontal origin for labels comes from a special attribute. If that value is 0, this is a billboard - use the regular origin
|
|
330
|
+
// Horizontal origin for labels comes from a special attribute. If that value is 0, this is a billboard - use the regular origin.\n\
|
|
333
331
|
// Otherwise, transform the label origin to -1, 0, 1 (right, center, left).\n\
|
|
334
332
|
depthOrigin.x = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));\n\
|
|
335
333
|
depthOrigin.x = czm_branchFreeTernary(depthOrigin.x == 0.0, origin.x, depthOrigin.x - 2.0);\n\
|
|
@@ -415,15 +413,8 @@ if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) &
|
|
|
415
413
|
#endif\n\
|
|
416
414
|
\n\
|
|
417
415
|
#ifdef SDF\n\
|
|
418
|
-
vec4 outlineColor;\n\
|
|
416
|
+
vec4 outlineColor = czm_decodeRGB8(sdf.x);\n\
|
|
419
417
|
float outlineWidth;\n\
|
|
420
|
-
\n\
|
|
421
|
-
temp = sdf.x;\n\
|
|
422
|
-
temp = temp * SHIFT_RIGHT8;\n\
|
|
423
|
-
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
424
|
-
temp = floor(temp) * SHIFT_RIGHT8;\n\
|
|
425
|
-
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
426
|
-
outlineColor.r = floor(temp);\n\
|
|
427
418
|
\n\
|
|
428
419
|
temp = sdf.y;\n\
|
|
429
420
|
temp = temp * SHIFT_RIGHT8;\n\
|
|
@@ -431,7 +422,7 @@ if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) &
|
|
|
431
422
|
temp = floor(temp) * SHIFT_RIGHT8;\n\
|
|
432
423
|
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
433
424
|
outlineColor.a = floor(temp);\n\
|
|
434
|
-
outlineColor /= 255.0;\n\
|
|
425
|
+
outlineColor.a /= 255.0;\n\
|
|
435
426
|
\n\
|
|
436
427
|
v_outlineWidth = outlineWidth / 255.0;\n\
|
|
437
428
|
v_outlineColor = outlineColor;\n\
|
|
@@ -442,6 +433,6 @@ if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) &
|
|
|
442
433
|
\n\
|
|
443
434
|
v_color = color;\n\
|
|
444
435
|
v_color.a *= translucency;\n\
|
|
445
|
-
|
|
436
|
+
v_splitDirectionAndEllipsoidDepthEC.x = splitDirection;\n\
|
|
446
437
|
}\n\
|
|
447
438
|
";
|
|
@@ -72,6 +72,7 @@ import czm_computeGroundAtmosphereScattering from './Functions/computeGroundAtmo
|
|
|
72
72
|
import czm_computePosition from './Functions/computePosition.js'
|
|
73
73
|
import czm_computeScattering from './Functions/computeScattering.js'
|
|
74
74
|
import czm_cosineAndSine from './Functions/cosineAndSine.js'
|
|
75
|
+
import czm_decodeRGB8 from './Functions/decodeRGB8.js'
|
|
75
76
|
import czm_decompressTextureCoordinates from './Functions/decompressTextureCoordinates.js'
|
|
76
77
|
import czm_depthClamp from './Functions/depthClamp.js'
|
|
77
78
|
import czm_eastNorthUpToEyeCoordinates from './Functions/eastNorthUpToEyeCoordinates.js'
|
|
@@ -130,6 +131,7 @@ import czm_transpose from './Functions/transpose.js'
|
|
|
130
131
|
import czm_unpackClippingExtents from './Functions/unpackClippingExtents.js'
|
|
131
132
|
import czm_unpackDepth from './Functions/unpackDepth.js'
|
|
132
133
|
import czm_unpackFloat from './Functions/unpackFloat.js'
|
|
134
|
+
import czm_unpackTexture from './Functions/unpackTexture.js'
|
|
133
135
|
import czm_unpackUint from './Functions/unpackUint.js'
|
|
134
136
|
import czm_valueTransform from './Functions/valueTransform.js'
|
|
135
137
|
import czm_vertexLogDepth from './Functions/vertexLogDepth.js'
|
|
@@ -212,6 +214,7 @@ export default {
|
|
|
212
214
|
czm_computePosition : czm_computePosition,
|
|
213
215
|
czm_computeScattering : czm_computeScattering,
|
|
214
216
|
czm_cosineAndSine : czm_cosineAndSine,
|
|
217
|
+
czm_decodeRGB8 : czm_decodeRGB8,
|
|
215
218
|
czm_decompressTextureCoordinates : czm_decompressTextureCoordinates,
|
|
216
219
|
czm_depthClamp : czm_depthClamp,
|
|
217
220
|
czm_eastNorthUpToEyeCoordinates : czm_eastNorthUpToEyeCoordinates,
|
|
@@ -270,6 +273,7 @@ export default {
|
|
|
270
273
|
czm_unpackClippingExtents : czm_unpackClippingExtents,
|
|
271
274
|
czm_unpackDepth : czm_unpackDepth,
|
|
272
275
|
czm_unpackFloat : czm_unpackFloat,
|
|
276
|
+
czm_unpackTexture : czm_unpackTexture,
|
|
273
277
|
czm_unpackUint : czm_unpackUint,
|
|
274
278
|
czm_valueTransform : czm_valueTransform,
|
|
275
279
|
czm_vertexLogDepth : czm_vertexLogDepth,
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
|
|
8
8
|
{
|
|
9
9
|
// Just linear for now.
|
|
10
|
-
|
|
10
|
+
// We're manually doing the equivalent of a `mix` here because, some GPUs
|
|
11
|
+
// (NVidia GeForce 3070 Ti and Intel Arc A750, to name two), `mix` seems to
|
|
12
|
+
// use an alternate formulation that introduces jitter even when `time` is
|
|
13
|
+
// 0.0 or 1.0. That is, the value of `p` won't be exactly `position2D.xyz`
|
|
14
|
+
// when `time` is 0.0 and it won't be exactly `position3D.xyz` when `time` is
|
|
15
|
+
// 1.0. The "textbook" formulation here, while probably a bit slower,
|
|
16
|
+
// does not have this problem.
|
|
17
|
+
vec3 p = position2D.xyz * (1.0 - time) + position3D.xyz * time;
|
|
11
18
|
return vec4(p, 1.0);
|
|
12
19
|
}
|
|
@@ -8,7 +8,14 @@ export default "/**\n\
|
|
|
8
8
|
vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n\
|
|
9
9
|
{\n\
|
|
10
10
|
// Just linear for now.\n\
|
|
11
|
-
|
|
11
|
+
// We're manually doing the equivalent of a `mix` here because, some GPUs\n\
|
|
12
|
+
// (NVidia GeForce 3070 Ti and Intel Arc A750, to name two), `mix` seems to\n\
|
|
13
|
+
// use an alternate formulation that introduces jitter even when `time` is\n\
|
|
14
|
+
// 0.0 or 1.0. That is, the value of `p` won't be exactly `position2D.xyz`\n\
|
|
15
|
+
// when `time` is 0.0 and it won't be exactly `position3D.xyz` when `time` is\n\
|
|
16
|
+
// 1.0. The \"textbook\" formulation here, while probably a bit slower,\n\
|
|
17
|
+
// does not have this problem.\n\
|
|
18
|
+
vec3 p = position2D.xyz * (1.0 - time) + position3D.xyz * time;\n\
|
|
12
19
|
return vec4(p, 1.0);\n\
|
|
13
20
|
}\n\
|
|
14
21
|
";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes RGB values packed into a single float at 8-bit precision. Encoded
|
|
3
|
+
* representation is equivalent to 0xFFFFFF in JavaScript.
|
|
4
|
+
*
|
|
5
|
+
* @name czm_decodeRGB8
|
|
6
|
+
* @glslFunction
|
|
7
|
+
*
|
|
8
|
+
* @param {float} encoded Float-encoded RGB values.
|
|
9
|
+
* @returns {vec4} Decoded RGB values.
|
|
10
|
+
*/
|
|
11
|
+
vec4 czm_decodeRGB8(float encoded) {
|
|
12
|
+
const float SHIFT_RIGHT16 = 1.0 / 65536.0;
|
|
13
|
+
const float SHIFT_RIGHT8 = 1.0 / 256.0;
|
|
14
|
+
const float SHIFT_LEFT16 = 65536.0;
|
|
15
|
+
const float SHIFT_LEFT8 = 256.0;
|
|
16
|
+
|
|
17
|
+
vec4 color = vec4(255.0);
|
|
18
|
+
color.r = floor(encoded * SHIFT_RIGHT16);
|
|
19
|
+
color.g = floor((encoded - color.r * SHIFT_LEFT16) * SHIFT_RIGHT8);
|
|
20
|
+
color.b = floor(encoded - color.r * SHIFT_LEFT16 - color.g * SHIFT_LEFT8);
|
|
21
|
+
return color / 255.0;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//This file is automatically rebuilt by the Cesium build process.
|
|
2
|
+
export default "/**\n\
|
|
3
|
+
* Decodes RGB values packed into a single float at 8-bit precision. Encoded\n\
|
|
4
|
+
* representation is equivalent to 0xFFFFFF in JavaScript.\n\
|
|
5
|
+
*\n\
|
|
6
|
+
* @name czm_decodeRGB8\n\
|
|
7
|
+
* @glslFunction\n\
|
|
8
|
+
*\n\
|
|
9
|
+
* @param {float} encoded Float-encoded RGB values.\n\
|
|
10
|
+
* @returns {vec4} Decoded RGB values.\n\
|
|
11
|
+
*/\n\
|
|
12
|
+
vec4 czm_decodeRGB8(float encoded) {\n\
|
|
13
|
+
const float SHIFT_RIGHT16 = 1.0 / 65536.0;\n\
|
|
14
|
+
const float SHIFT_RIGHT8 = 1.0 / 256.0;\n\
|
|
15
|
+
const float SHIFT_LEFT16 = 65536.0;\n\
|
|
16
|
+
const float SHIFT_LEFT8 = 256.0;\n\
|
|
17
|
+
\n\
|
|
18
|
+
vec4 color = vec4(255.0);\n\
|
|
19
|
+
color.r = floor(encoded * SHIFT_RIGHT16);\n\
|
|
20
|
+
color.g = floor((encoded - color.r * SHIFT_LEFT16) * SHIFT_RIGHT8);\n\
|
|
21
|
+
color.b = floor(encoded - color.r * SHIFT_LEFT16 - color.g * SHIFT_LEFT8);\n\
|
|
22
|
+
return color / 255.0;\n\
|
|
23
|
+
}\n\
|
|
24
|
+
";
|