deeptwins-cesium-engine 0.0.43 → 0.1.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/LICENSE.md +32 -25
- package/Source/Core/ApproximateTerrainHeights.js +2 -3
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +8 -8
- package/Source/Core/ArcType.js +6 -1
- package/Source/Core/ArticulationStageType.js +5 -1
- package/Source/Core/AssociativeArray.js +100 -94
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/AxisAlignedBoundingBox.js +38 -3
- package/Source/Core/BingMapsGeocoderService.js +2 -2
- package/Source/Core/BoundingRectangle.js +7 -8
- package/Source/Core/BoundingSphere.js +1296 -1301
- package/Source/Core/BoxGeometry.js +8 -8
- package/Source/Core/BoxOutlineGeometry.js +7 -9
- package/Source/Core/Cartesian2.js +691 -685
- package/Source/Core/Cartesian3.js +1045 -1044
- package/Source/Core/Cartesian4.js +817 -813
- package/Source/Core/Cartographic.js +257 -250
- package/Source/Core/CatmullRomSpline.js +2 -2
- package/Source/Core/Cesium3DTilesTerrainData.js +932 -0
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +1868 -0
- package/Source/Core/Cesium3DTilesTerrainProvider.js +1052 -0
- package/Source/Core/CesiumTerrainProvider.js +13 -16
- package/Source/Core/Check.d.ts +4 -1
- package/Source/Core/CircleGeometry.js +2 -2
- package/Source/Core/CircleOutlineGeometry.js +2 -2
- package/Source/Core/Clock.js +7 -10
- package/Source/Core/ClockRange.js +6 -1
- package/Source/Core/ClockStep.js +6 -1
- package/Source/Core/Color.js +847 -819
- package/Source/Core/ColorGeometryInstanceAttribute.js +4 -5
- package/Source/Core/ComponentDatatype.js +43 -7
- package/Source/Core/CoplanarPolygonGeometry.js +8 -10
- package/Source/Core/CoplanarPolygonOutlineGeometry.js +5 -5
- package/Source/Core/CornerType.js +7 -2
- package/Source/Core/CorridorGeometry.js +16 -21
- package/Source/Core/CorridorOutlineGeometry.js +10 -15
- package/Source/Core/Credit.js +121 -125
- package/Source/Core/CullingVolume.js +1 -2
- package/Source/Core/CustomHeightmapTerrainProvider.js +3 -3
- package/Source/Core/CylinderGeometry.js +7 -7
- package/Source/Core/CylinderOutlineGeometry.js +7 -7
- package/Source/Core/DeveloperError.js +2 -1
- package/Source/Core/DistanceDisplayCondition.js +4 -5
- package/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js +2 -3
- package/Source/Core/EarthOrientationParameters.js +4 -4
- package/Source/Core/EllipseGeometry.js +17 -23
- package/Source/Core/EllipseOutlineGeometry.js +12 -15
- package/Source/Core/Ellipsoid.js +640 -655
- package/Source/Core/EllipsoidGeodesic.js +1 -2
- package/Source/Core/EllipsoidGeometry.js +15 -15
- package/Source/Core/EllipsoidOutlineGeometry.js +15 -15
- package/Source/Core/EllipsoidRhumbLine.js +2 -3
- package/Source/Core/EllipsoidTangentPlane.js +1 -2
- package/Source/Core/EllipsoidTerrainProvider.js +4 -4
- package/Source/Core/EllipsoidalOccluder.js +4 -5
- package/Source/Core/Event.js +94 -53
- package/Source/Core/ExtrapolationType.js +6 -1
- package/Source/Core/FeatureDetection.js +2 -36
- package/Source/Core/FrustumGeometry.js +7 -8
- package/Source/Core/FrustumOutlineGeometry.js +3 -4
- package/Source/Core/GeocodeType.js +6 -1
- package/Source/Core/GeographicProjection.js +74 -75
- package/Source/Core/GeographicTilingScheme.js +180 -205
- package/Source/Core/Geometry.js +5 -8
- package/Source/Core/GeometryAttribute.js +3 -3
- package/Source/Core/GeometryAttributes.js +2 -2
- package/Source/Core/GeometryInstance.js +4 -6
- package/Source/Core/GeometryInstanceAttribute.js +3 -3
- package/Source/Core/GeometryOffsetAttribute.js +7 -1
- package/Source/Core/GeometryPipeline.js +3 -4
- package/Source/Core/GeometryType.js +7 -1
- package/Source/Core/GoogleEarthEnterpriseMetadata.js +14 -25
- package/Source/Core/GoogleEarthEnterpriseTerrainData.js +11 -13
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +4 -4
- package/Source/Core/GoogleGeocoderService.js +2 -2
- package/Source/Core/GoogleMaps.js +25 -4
- package/Source/Core/GregorianDate.js +8 -9
- package/Source/Core/GroundPolylineGeometry.js +8 -8
- package/Source/Core/HeadingPitchRange.js +3 -4
- package/Source/Core/HeadingPitchRoll.js +3 -4
- package/Source/Core/Heap.js +3 -4
- package/Source/Core/HeightmapEncoding.js +6 -1
- package/Source/Core/HeightmapTerrainData.js +33 -59
- package/Source/Core/HeightmapTessellator.js +21 -37
- package/Source/Core/HermitePolynomialApproximation.js +1 -2
- package/Source/Core/HermiteSpline.js +5 -5
- package/Source/Core/HilbertOrder.js +0 -6
- package/Source/Core/ITwinPlatform.js +87 -22
- package/Source/Core/Iau2006XysData.js +32 -23
- package/Source/Core/IndexDatatype.js +3 -1
- package/Source/Core/InterpolationType.js +5 -1
- package/Source/Core/Intersect.js +6 -1
- package/Source/Core/IntersectionTests.js +83 -4
- package/Source/Core/Interval.js +2 -4
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonGeocodeProviderType.js +5 -1
- package/Source/Core/IonGeocoderService.js +6 -10
- package/Source/Core/IonResource.js +59 -19
- package/Source/Core/JulianDate.js +852 -851
- package/Source/Core/KeyboardEventModifier.js +6 -1
- package/Source/Core/LinearSpline.js +2 -2
- package/Source/Core/ManagedArray.js +2 -3
- package/Source/Core/MapProjection.js +40 -44
- package/Source/Core/Math.js +36 -27
- package/Source/Core/Matrix2.js +906 -894
- package/Source/Core/Matrix3.js +1643 -1576
- package/Source/Core/Matrix4.js +2904 -2873
- package/Source/Core/MorphWeightSpline.js +2 -2
- package/Source/Core/NearFarScalar.js +6 -7
- package/Source/Core/Occluder.js +1 -2
- package/Source/Core/OffsetGeometryInstanceAttribute.js +3 -4
- package/Source/Core/OpenCageGeocoderService.js +3 -5
- package/Source/Core/OrientedBoundingBox.js +7 -8
- package/Source/Core/OrthographicFrustum.js +6 -6
- package/Source/Core/OrthographicOffCenterFrustum.js +4 -4
- package/Source/Core/PerspectiveFrustum.js +8 -8
- package/Source/Core/PerspectiveOffCenterFrustum.js +4 -4
- package/Source/Core/PinBuilder.js +1 -1
- package/Source/Core/PixelFormat.js +60 -22
- package/Source/Core/PlaneGeometry.js +5 -5
- package/Source/Core/PolygonGeometry.js +18 -20
- package/Source/Core/PolygonGeometryLibrary.js +1 -2
- package/Source/Core/PolygonOutlineGeometry.js +11 -14
- package/Source/Core/PolygonPipeline.js +5 -6
- package/Source/Core/PolylineGeometry.js +11 -16
- package/Source/Core/PolylinePipeline.js +7 -14
- package/Source/Core/PolylineVolumeGeometry.js +9 -14
- package/Source/Core/PolylineVolumeOutlineGeometry.js +7 -12
- package/Source/Core/PrimitiveType.js +11 -1
- package/Source/Core/QuantizedMeshTerrainData.js +36 -73
- package/Source/Core/Quaternion.js +7 -8
- package/Source/Core/QuaternionSpline.js +2 -2
- package/Source/Core/Ray.js +62 -61
- package/Source/Core/Rectangle.js +913 -905
- package/Source/Core/RectangleGeometry.js +18 -26
- package/Source/Core/RectangleGeometryLibrary.js +1 -1
- package/Source/Core/RectangleOutlineGeometry.js +11 -14
- package/Source/Core/ReferenceFrame.js +6 -1
- package/Source/Core/Request.js +6 -6
- package/Source/Core/RequestScheduler.js +12 -9
- package/Source/Core/RequestState.js +6 -1
- package/Source/Core/RequestType.js +6 -1
- package/Source/Core/Resource.js +34 -29
- package/Source/Core/S2Cell.js +10 -23
- package/Source/Core/ScreenSpaceEventHandler.js +59 -54
- package/Source/Core/ScreenSpaceEventType.js +6 -1
- package/Source/Core/ShowGeometryInstanceAttribute.js +1 -2
- package/Source/Core/Simon1994PlanetaryPositions.js +9 -9
- package/Source/Core/SimplePolylineGeometry.js +8 -11
- package/Source/Core/SphereGeometry.js +1 -2
- package/Source/Core/SphereOutlineGeometry.js +1 -2
- package/Source/Core/Spherical.js +4 -5
- package/Source/Core/Spline.js +1 -2
- package/Source/Core/SteppedSpline.js +2 -2
- package/Source/Core/TaskProcessor.js +3 -10
- package/Source/Core/TerrainData.js +2 -1
- package/Source/Core/TerrainEncoding.js +219 -49
- package/Source/Core/TerrainMesh.js +227 -10
- package/Source/Core/TerrainPicker.js +625 -0
- package/Source/Core/TerrainProvider.js +152 -1
- package/Source/Core/TerrainQuantization.js +6 -1
- package/Source/Core/TexturePacker.js +27 -12
- package/Source/Core/TileProviderError.js +1 -2
- package/Source/Core/TilingScheme.js +100 -98
- package/Source/Core/TimeConstants.js +6 -1
- package/Source/Core/TimeInterval.js +7 -7
- package/Source/Core/TimeIntervalCollection.js +7 -7
- package/Source/Core/TimeStandard.js +6 -1
- package/Source/Core/Tipsify.js +5 -5
- package/Source/Core/TrackingReferenceFrame.js +6 -1
- package/Source/Core/Transforms.js +38 -34
- package/Source/Core/TranslationRotationScale.js +3 -6
- package/Source/Core/VRTheWorldTerrainProvider.js +7 -7
- package/Source/Core/VertexFormat.js +10 -10
- package/Source/Core/VerticalExaggeration.js +1 -1
- package/Source/Core/VideoSynchronizer.js +7 -7
- package/Source/Core/Visibility.js +6 -1
- package/Source/Core/VulkanConstants.js +6 -1
- package/Source/Core/WallGeometry.js +10 -13
- package/Source/Core/WallOutlineGeometry.js +8 -11
- package/Source/Core/WebGLConstants.js +6 -1
- package/Source/Core/WebMercatorProjection.js +108 -110
- package/Source/Core/WebMercatorTilingScheme.js +247 -249
- package/Source/Core/WindingOrder.js +3 -1
- package/Source/Core/addAllToArray.js +40 -0
- package/Source/Core/arrayRemoveDuplicates.js +1 -2
- package/Source/Core/assert.js +27 -0
- package/Source/Core/binarySearch.js +1 -1
- package/Source/Core/clone.js +1 -3
- package/Source/Core/combine.js +1 -2
- package/Source/Core/createColorRamp.js +37 -0
- package/Source/Core/createWorldBathymetryAsync.js +5 -5
- package/Source/Core/createWorldTerrainAsync.js +7 -7
- package/Source/Core/destroyObject.js +1 -5
- package/Source/Core/getAbsoluteUri.js +1 -2
- package/Source/Core/getMagic.js +1 -2
- package/Source/Core/getStringFromTypedArray.js +2 -3
- package/Source/Core/globalTypes.js +45 -0
- package/Source/Core/loadImageFromTypedArray.js +11 -9
- package/Source/Core/mergeSort.js +1 -1
- package/Source/Core/oneTimeWarning.js +1 -2
- package/Source/Core/writeTextToCanvas.js +50 -99
- package/Source/DataSources/BillboardGraphics.js +29 -55
- package/Source/DataSources/BillboardVisualizer.js +7 -4
- package/Source/DataSources/BoxGraphics.js +14 -19
- package/Source/DataSources/CallbackPositionProperty.js +2 -3
- package/Source/DataSources/Cesium3DTilesetGraphics.js +6 -8
- package/Source/DataSources/CheckerboardMaterialProperty.js +2 -2
- package/Source/DataSources/CompositePositionProperty.js +1 -2
- package/Source/DataSources/ConstantPositionProperty.js +1 -2
- package/Source/DataSources/CorridorGraphics.js +24 -36
- package/Source/DataSources/CylinderGraphics.js +18 -25
- package/Source/DataSources/CzmlDataSource.js +44 -61
- package/Source/DataSources/DataSourceClock.js +12 -13
- package/Source/DataSources/DataSourceCollection.js +2 -3
- package/Source/DataSources/DataSourceDisplay.js +2 -5
- package/Source/DataSources/EllipseGraphics.js +27 -41
- package/Source/DataSources/EllipsoidGeometryUpdater.js +1 -2
- package/Source/DataSources/EllipsoidGraphics.js +22 -33
- package/Source/DataSources/Entity.js +8 -10
- package/Source/DataSources/EntityCluster.js +11 -11
- package/Source/DataSources/EntityView.js +1 -2
- package/Source/DataSources/GeoJsonDataSource.js +14 -14
- package/Source/DataSources/GeometryUpdater.js +12 -17
- package/Source/DataSources/GeometryVisualizer.js +2 -3
- package/Source/DataSources/GpxDataSource.js +5 -8
- package/Source/DataSources/GridMaterialProperty.js +2 -2
- package/Source/DataSources/GroundGeometryUpdater.js +1 -2
- package/Source/DataSources/ImageMaterialProperty.js +2 -2
- package/Source/DataSources/KmlDataSource.js +147 -222
- package/Source/DataSources/KmlTour.js +1 -1
- package/Source/DataSources/LabelGraphics.js +28 -57
- package/Source/DataSources/LabelVisualizer.js +1 -2
- package/Source/DataSources/ModelGraphics.js +30 -64
- package/Source/DataSources/ModelVisualizer.js +1 -2
- package/Source/DataSources/NodeTransformationProperty.js +2 -2
- package/Source/DataSources/PathGraphics.js +23 -12
- package/Source/DataSources/PathVisualizer.js +330 -18
- package/Source/DataSources/PlaneGraphics.js +14 -16
- package/Source/DataSources/PointGraphics.js +17 -32
- package/Source/DataSources/PolygonGraphics.js +29 -46
- package/Source/DataSources/PolylineDashMaterialProperty.js +2 -2
- package/Source/DataSources/PolylineGeometryUpdater.js +9 -14
- package/Source/DataSources/PolylineGlowMaterialProperty.js +2 -2
- package/Source/DataSources/PolylineGraphics.js +17 -24
- package/Source/DataSources/PolylineOutlineMaterialProperty.js +2 -2
- package/Source/DataSources/PolylineVisualizer.js +2 -3
- package/Source/DataSources/PolylineVolumeGraphics.js +16 -18
- package/Source/DataSources/PositionPropertyArray.js +1 -2
- package/Source/DataSources/Property.js +1 -2
- package/Source/DataSources/PropertyArray.js +2 -2
- package/Source/DataSources/PropertyBag.js +1 -2
- package/Source/DataSources/RectangleGraphics.js +24 -36
- package/Source/DataSources/Rotation.js +4 -5
- package/Source/DataSources/SampledPositionProperty.js +2 -3
- package/Source/DataSources/SampledProperty.js +6 -11
- package/Source/DataSources/StaticGeometryColorBatch.js +7 -2
- package/Source/DataSources/StaticGeometryPerMaterialBatch.js +7 -2
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +58 -27
- package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +5 -3
- package/Source/DataSources/StripeMaterialProperty.js +2 -2
- package/Source/DataSources/StripeOrientation.js +6 -1
- package/Source/DataSources/TimeIntervalCollectionPositionProperty.js +1 -2
- package/Source/DataSources/VelocityOrientationProperty.js +1 -2
- package/Source/DataSources/VelocityVectorProperty.js +1 -2
- package/Source/DataSources/WallGraphics.js +16 -24
- package/Source/DataSources/createPropertyDescriptor.js +2 -3
- package/Source/DataSources/exportKml.js +39 -45
- package/Source/Renderer/AutomaticUniforms.js +61 -0
- package/Source/Renderer/Buffer.js +37 -5
- package/Source/Renderer/BufferUsage.js +21 -8
- package/Source/Renderer/ClearCommand.js +2 -2
- package/Source/Renderer/ComputeCommand.js +3 -3
- package/Source/Renderer/Context.js +130 -77
- package/Source/Renderer/ContextLimits.js +66 -33
- package/Source/Renderer/CubeMap.js +6 -6
- package/Source/Renderer/CubeMapFace.js +11 -12
- package/Source/Renderer/DrawCommand.js +436 -415
- package/Source/Renderer/Framebuffer.js +3 -3
- package/Source/Renderer/FramebufferManager.js +25 -39
- package/Source/Renderer/MipmapHint.js +5 -1
- package/Source/Renderer/MultisampleFramebuffer.js +2 -2
- package/Source/Renderer/Pass.js +18 -9
- package/Source/Renderer/PickId.js +44 -0
- package/Source/Renderer/PixelDatatype.js +3 -1
- package/Source/Renderer/RenderState.js +65 -94
- package/Source/Renderer/Renderbuffer.js +8 -6
- package/Source/Renderer/RenderbufferFormat.js +5 -1
- package/Source/Renderer/Sampler.js +15 -2
- package/Source/Renderer/ShaderBuilder.js +9 -9
- package/Source/Renderer/ShaderDestination.js +58 -14
- package/Source/Renderer/ShaderProgram.js +3 -3
- package/Source/Renderer/ShaderSource.js +22 -21
- package/Source/Renderer/SharedContext.js +186 -0
- package/Source/Renderer/Sync.js +104 -0
- package/Source/Renderer/Texture.js +22 -19
- package/Source/Renderer/Texture3D.js +166 -7
- package/Source/Renderer/TextureAtlas.js +81 -49
- package/Source/Renderer/TextureMagnificationFilter.js +3 -1
- package/Source/Renderer/TextureMinificationFilter.js +3 -1
- package/Source/Renderer/TextureWrap.js +5 -1
- package/Source/Renderer/UniformState.js +18 -11
- package/Source/Renderer/VertexArray.js +128 -32
- package/Source/Renderer/VertexArrayFacade.js +7 -11
- package/Source/Renderer/createUniform.js +348 -239
- package/Source/Renderer/createUniformArray.js +494 -381
- package/Source/Scene/AlphaMode.js +5 -1
- package/Source/Scene/Appearance.js +5 -5
- package/Source/Scene/ArcGisBaseMapType.js +6 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +24 -38
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/AttributeType.js +3 -1
- package/Source/Scene/Axis.js +3 -1
- package/Source/Scene/Azure2DImageryProvider.js +393 -0
- package/Source/Scene/B3dmParser.js +2 -3
- package/Source/Scene/BatchTable.js +2 -2
- package/Source/Scene/BatchTableHierarchy.js +8 -63
- package/Source/Scene/Billboard.js +108 -77
- package/Source/Scene/BillboardCollection.js +165 -409
- package/Source/Scene/BillboardTexture.js +61 -9
- package/Source/Scene/BingMapsImageryProvider.js +8 -8
- package/Source/Scene/BingMapsStyle.js +6 -1
- package/Source/Scene/BlendEquation.js +6 -1
- package/Source/Scene/BlendFunction.js +6 -1
- package/Source/Scene/BlendOption.js +6 -1
- package/Source/Scene/BlendingState.js +6 -1
- package/Source/Scene/BoundingVolumeSemantics.js +54 -62
- package/Source/Scene/BoxEmitter.js +1 -2
- package/Source/Scene/BufferLoader.js +66 -77
- package/Source/Scene/BufferPoint.js +149 -0
- package/Source/Scene/BufferPointCollection.js +151 -0
- package/Source/Scene/BufferPointMaterial.js +95 -0
- package/Source/Scene/BufferPolygon.js +517 -0
- package/Source/Scene/BufferPolygonCollection.js +380 -0
- package/Source/Scene/BufferPolygonMaterial.js +41 -0
- package/Source/Scene/BufferPolyline.js +186 -0
- package/Source/Scene/BufferPolylineCollection.js +140 -0
- package/Source/Scene/BufferPolylineMaterial.js +93 -0
- package/Source/Scene/BufferPrimitive.js +347 -0
- package/Source/Scene/BufferPrimitiveCollection.js +869 -0
- package/Source/Scene/BufferPrimitiveMaterial.js +140 -0
- package/Source/Scene/Camera.js +52 -60
- package/Source/Scene/CameraEventAggregator.js +30 -18
- package/Source/Scene/CameraEventType.js +6 -1
- package/Source/Scene/CameraFlightPath.js +6 -6
- package/Source/Scene/Cesium3DContentGroup.js +2 -2
- package/Source/Scene/Cesium3DTile.js +60 -8
- package/Source/Scene/Cesium3DTileBatchTable.js +12 -53
- package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
- package/Source/Scene/Cesium3DTileContent.js +196 -251
- package/Source/Scene/Cesium3DTileContentFactory.js +31 -0
- package/Source/Scene/Cesium3DTileContentState.js +6 -1
- package/Source/Scene/Cesium3DTileContentType.js +3 -1
- package/Source/Scene/Cesium3DTileFeature.js +289 -306
- package/Source/Scene/Cesium3DTileFeatureTable.js +2 -3
- package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
- package/Source/Scene/Cesium3DTilePass.js +5 -1
- package/Source/Scene/Cesium3DTilePointFeature.js +442 -528
- package/Source/Scene/Cesium3DTileRefine.js +6 -1
- package/Source/Scene/Cesium3DTileStyle.js +30 -10
- package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +58 -35
- package/Source/Scene/Cesium3DTileset.js +361 -150
- package/Source/Scene/Cesium3DTilesetMetadata.js +3 -3
- package/Source/Scene/CircleEmitter.js +2 -3
- package/Source/Scene/ClassificationPrimitive.js +15 -26
- package/Source/Scene/ClassificationType.js +3 -1
- package/Source/Scene/ClippingPlaneCollection.js +12 -17
- package/Source/Scene/ClippingPolygon.js +92 -4
- package/Source/Scene/ClippingPolygonCollection.js +274 -107
- package/Source/Scene/CloudCollection.js +11 -13
- package/Source/Scene/CloudType.js +3 -1
- package/Source/Scene/ColorBlendMode.js +4 -1
- package/Source/Scene/Composite3DTileContent.js +254 -293
- package/Source/Scene/ConditionsExpression.js +3 -2
- package/Source/Scene/ConeEmitter.js +1 -2
- package/Source/Scene/ContentMetadata.js +2 -2
- package/Source/Scene/CreditDisplay.js +6 -10
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/CullFace.js +6 -1
- package/Source/Scene/CumulusCloud.js +10 -16
- package/Source/Scene/DebugAppearance.js +7 -7
- package/Source/Scene/DebugCameraPrimitive.js +5 -5
- package/Source/Scene/DebugModelMatrixPrimitive.js +6 -8
- package/Source/Scene/DepthFunction.js +6 -1
- package/Source/Scene/DepthPlane.js +1 -2
- package/Source/Scene/DerivedCommand.js +1 -24
- package/Source/Scene/DirectionalLight.js +2 -3
- package/Source/Scene/DiscardMissingTileImagePolicy.js +2 -2
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
- package/Source/Scene/DynamicEnvironmentMapManager.js +55 -49
- package/Source/Scene/EdgeDisplayMode.js +50 -0
- package/Source/Scene/EdgeFramebuffer.js +245 -0
- package/Source/Scene/EllipsoidPrimitive.js +11 -19
- package/Source/Scene/EllipsoidSurfaceAppearance.js +11 -15
- package/Source/Scene/Empty3DTileContent.js +100 -132
- package/Source/Scene/EquirectangularPanorama.js +265 -0
- package/Source/Scene/ExpressionNodeType.js +6 -1
- package/Source/Scene/Fog.js +1 -1
- package/Source/Scene/FrameRateMonitor.js +12 -21
- package/Source/Scene/FrameState.js +19 -0
- package/Source/Scene/FrustumCommands.js +2 -3
- package/Source/Scene/GaussianSplat3DTileContent.js +778 -0
- package/Source/Scene/GaussianSplatPrimitive.js +2147 -0
- package/Source/Scene/GaussianSplatRenderResources.js +81 -0
- package/Source/Scene/GaussianSplatSorter.js +73 -0
- package/Source/Scene/GaussianSplatTextureGenerator.js +64 -0
- package/Source/Scene/GeoJsonPrimitive.js +874 -0
- package/Source/Scene/Geometry3DTileContent.js +160 -201
- package/Source/Scene/GetFeatureInfoFormat.js +3 -3
- package/Source/Scene/Globe.js +10 -16
- package/Source/Scene/GlobeSurfaceShaderSet.js +40 -37
- package/Source/Scene/GlobeSurfaceTile.js +28 -70
- package/Source/Scene/GlobeSurfaceTileProvider.js +20 -18
- package/Source/Scene/GlobeTranslucencyState.js +12 -25
- package/Source/Scene/GltfBufferViewLoader.js +125 -118
- package/Source/Scene/GltfDracoLoader.js +168 -179
- package/Source/Scene/GltfImageLoader.js +92 -105
- package/Source/Scene/GltfIndexBufferLoader.js +229 -246
- package/Source/Scene/GltfJsonLoader.js +91 -102
- package/Source/Scene/GltfLoader.js +786 -368
- package/Source/Scene/GltfLoaderUtil.js +25 -11
- package/Source/Scene/GltfPipeline/ForEach.js +7 -7
- package/Source/Scene/GltfPipeline/addDefaults.js +36 -64
- package/Source/Scene/GltfPipeline/addToArray.js +2 -2
- package/Source/Scene/GltfPipeline/findAccessorMinMax.js +1 -1
- package/Source/Scene/GltfPipeline/getComponentReader.js +16 -16
- package/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js +3 -6
- package/Source/Scene/GltfPipeline/moveTechniquesToExtension.js +3 -3
- package/Source/Scene/GltfPipeline/parseGlb.js +2 -6
- package/Source/Scene/GltfPipeline/readAccessorPacked.js +2 -2
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +6 -8
- package/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +34 -55
- package/Source/Scene/GltfSpzLoader.js +324 -0
- package/Source/Scene/GltfStructuralMetadataLoader.js +185 -193
- package/Source/Scene/GltfTextureLoader.js +218 -234
- package/Source/Scene/GltfVertexBufferLoader.js +391 -255
- package/Source/Scene/Google2DImageryProvider.js +621 -0
- package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +2 -2
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +4 -5
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/GridImageryProvider.js +10 -13
- package/Source/Scene/GroundPolylinePrimitive.js +11 -22
- package/Source/Scene/GroundPrimitive.js +13 -24
- package/Source/Scene/GroupMetadata.js +2 -2
- package/Source/Scene/HeightReference.js +6 -2
- package/Source/Scene/HorizontalOrigin.js +6 -1
- package/Source/Scene/I3SDataProvider.js +11 -16
- package/Source/Scene/I3SDecoder.js +3 -3
- package/Source/Scene/I3SNode.js +1 -6
- package/Source/Scene/I3SSublayer.js +1 -2
- package/Source/Scene/I3SSymbology.js +2 -3
- package/Source/Scene/I3dmParser.js +1 -2
- package/Source/Scene/ITwinData.js +61 -31
- package/Source/Scene/ImageBasedLighting.js +10 -6
- package/Source/Scene/ImageryLayer.js +74 -88
- package/Source/Scene/ImageryLayerCollection.js +7 -7
- package/Source/Scene/ImageryProvider.js +3 -3
- package/Source/Scene/ImageryState.js +6 -1
- package/Source/Scene/Implicit3DTileContent.js +199 -224
- package/Source/Scene/ImplicitAvailabilityBitstream.js +2 -5
- package/Source/Scene/ImplicitMetadataView.js +2 -2
- package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
- package/Source/Scene/ImplicitSubtree.js +11 -18
- package/Source/Scene/ImplicitSubtreeCache.js +3 -3
- package/Source/Scene/ImplicitSubtreeMetadata.js +2 -2
- package/Source/Scene/ImplicitTileset.js +2 -2
- package/Source/Scene/InstanceAttributeSemantic.js +4 -2
- package/Source/Scene/IonImageryProvider.js +18 -66
- package/Source/Scene/IonImageryProviderFactory.js +194 -0
- package/Source/Scene/IonWorldImageryStyle.js +6 -1
- package/Source/Scene/JobType.js +6 -1
- package/Source/Scene/Label.js +58 -41
- package/Source/Scene/LabelCollection.js +136 -65
- package/Source/Scene/LabelStyle.js +6 -1
- package/Source/Scene/MVTDataProvider.js +147 -0
- package/Source/Scene/MapMode2D.js +6 -1
- package/Source/Scene/MapboxImageryProvider.js +4 -4
- package/Source/Scene/MapboxStyleImageryProvider.js +5 -5
- package/Source/Scene/Material.js +269 -101
- package/Source/Scene/MaterialAppearance.js +13 -19
- package/Source/Scene/Megatexture.js +175 -243
- package/Source/Scene/MetadataClass.js +4 -4
- package/Source/Scene/MetadataClassProperty.js +236 -20
- package/Source/Scene/MetadataComponentType.js +254 -125
- package/Source/Scene/MetadataEnum.js +4 -7
- package/Source/Scene/MetadataEnumValue.js +2 -2
- package/Source/Scene/MetadataSchema.js +4 -4
- package/Source/Scene/MetadataSchemaLoader.js +61 -70
- package/Source/Scene/MetadataSemantic.js +6 -2
- package/Source/Scene/MetadataTable.js +16 -2
- package/Source/Scene/MetadataTableProperty.js +36 -41
- package/Source/Scene/MetadataType.js +3 -1
- package/Source/Scene/Model/AlphaPipelineStage.js +1 -2
- package/Source/Scene/Model/B3dmLoader.js +217 -239
- package/Source/Scene/Model/BatchTexturePipelineStage.js +1 -2
- package/Source/Scene/Model/CartesianRectangle.js +108 -0
- package/Source/Scene/Model/ClassificationModelDrawCommand.js +9 -8
- package/Source/Scene/Model/CustomShader.js +16 -13
- package/Source/Scene/Model/CustomShaderMode.js +3 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +124 -7
- package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
- package/Source/Scene/Model/EdgeDetectionPipelineStage.js +42 -0
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +1039 -0
- package/Source/Scene/Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js +3 -3
- package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
- package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
- package/Source/Scene/Model/FeatureIdPipelineStage.js +1 -5
- package/Source/Scene/Model/GeoJsonLoader.js +60 -71
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +233 -252
- package/Source/Scene/Model/ImageryConfiguration.js +26 -0
- package/Source/Scene/Model/ImageryCoverage.js +488 -0
- package/Source/Scene/Model/ImageryFlags.js +31 -0
- package/Source/Scene/Model/ImageryInput.js +60 -0
- package/Source/Scene/Model/ImageryPipelineStage.js +1046 -0
- package/Source/Scene/Model/InstancingPipelineStage.js +4 -9
- package/Source/Scene/Model/LightingModel.js +5 -1
- package/Source/Scene/Model/MappedPositions.js +84 -0
- package/Source/Scene/Model/MaterialPipelineStage.js +359 -6
- package/Source/Scene/Model/MetadataPipelineStage.js +444 -28
- package/Source/Scene/Model/Model.js +116 -63
- package/Source/Scene/Model/Model3DTileContent.js +424 -458
- package/Source/Scene/Model/ModelAnimation.js +5 -6
- package/Source/Scene/Model/ModelAnimationChannel.js +2 -2
- package/Source/Scene/Model/ModelAnimationCollection.js +4 -4
- package/Source/Scene/Model/ModelArticulation.js +2 -2
- package/Source/Scene/Model/ModelArticulationStage.js +2 -2
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +8 -2
- package/Source/Scene/Model/ModelDrawCommand.js +106 -3
- package/Source/Scene/Model/ModelFeatureTable.js +3 -9
- package/Source/Scene/Model/ModelImagery.js +410 -0
- package/Source/Scene/Model/ModelImageryMapping.js +489 -0
- package/Source/Scene/Model/ModelLightingOptions.js +3 -3
- package/Source/Scene/Model/ModelNode.js +1 -1
- package/Source/Scene/Model/ModelPrimitiveImagery.js +972 -0
- package/Source/Scene/Model/ModelReader.js +1281 -0
- package/Source/Scene/Model/ModelRenderResources.js +13 -0
- package/Source/Scene/Model/ModelRuntimeNode.js +4 -4
- package/Source/Scene/Model/ModelRuntimePrimitive.js +36 -4
- package/Source/Scene/Model/ModelSceneGraph.js +152 -33
- package/Source/Scene/Model/ModelSkin.js +2 -2
- package/Source/Scene/Model/ModelType.js +3 -1
- package/Source/Scene/Model/ModelUtility.js +9 -1
- package/Source/Scene/Model/NodeRenderResources.js +11 -1
- package/Source/Scene/Model/PickingPipelineStage.js +1 -2
- package/Source/Scene/Model/PntsLoader.js +92 -98
- package/Source/Scene/Model/PointCloudStylingPipelineStage.js +1 -5
- package/Source/Scene/Model/PrimitiveOutlineGenerator.js +2 -2
- package/Source/Scene/Model/PrimitiveRenderResources.js +1 -1
- package/Source/Scene/Model/SelectedFeatureIdPipelineStage.js +2 -3
- package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
- package/Source/Scene/Model/TextureUniform.js +5 -8
- package/Source/Scene/Model/UniformType.js +6 -2
- package/Source/Scene/Model/VaryingType.js +7 -3
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +691 -0
- package/Source/Scene/Model/pickModel.js +95 -301
- package/Source/Scene/ModelAnimationLoop.js +6 -1
- package/Source/Scene/ModelAnimationState.js +6 -1
- package/Source/Scene/ModelComponents.js +1683 -1528
- package/Source/Scene/Moon.js +5 -5
- package/Source/Scene/Multiple3DTileContent.js +291 -334
- package/Source/Scene/OIT.js +11 -1
- package/Source/Scene/OpenStreetMapImageryProvider.js +7 -7
- package/Source/Scene/OrderedGroundPrimitiveCollection.js +1 -2
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/Particle.js +11 -17
- package/Source/Scene/ParticleBurst.js +5 -5
- package/Source/Scene/ParticleSystem.js +26 -56
- package/Source/Scene/PerInstanceColorAppearance.js +8 -8
- package/Source/Scene/PerformanceDisplay.js +3 -3
- package/Source/Scene/PickFramebuffer.js +136 -53
- package/Source/Scene/PickedMetadataInfo.js +1 -0
- package/Source/Scene/Picking.js +235 -90
- package/Source/Scene/PntsParser.js +72 -5
- package/Source/Scene/PointCloud.js +6 -12
- package/Source/Scene/PointCloudShading.js +9 -18
- package/Source/Scene/PointPrimitive.js +12 -22
- package/Source/Scene/PointPrimitiveCollection.js +20 -36
- package/Source/Scene/Polyline.js +5 -6
- package/Source/Scene/PolylineCollection.js +6 -14
- package/Source/Scene/PolylineColorAppearance.js +8 -17
- package/Source/Scene/PolylineMaterialAppearance.js +8 -17
- package/Source/Scene/PostProcessStage.js +2 -2
- package/Source/Scene/PostProcessStageCollection.js +1 -1
- package/Source/Scene/PostProcessStageComposite.js +3 -6
- package/Source/Scene/Primitive.js +27 -43
- package/Source/Scene/PrimitiveCollection.js +36 -10
- package/Source/Scene/PrimitiveLoadPlan.js +23 -0
- package/Source/Scene/PrimitivePipeline.js +1 -2
- package/Source/Scene/PrimitiveState.js +130 -1
- package/Source/Scene/PropertyAttribute.js +2 -2
- package/Source/Scene/PropertyAttributeProperty.js +4 -4
- package/Source/Scene/PropertyTable.js +52 -14
- package/Source/Scene/PropertyTexture.js +3 -3
- package/Source/Scene/PropertyTextureProperty.js +4 -101
- package/Source/Scene/QuadtreeOccluders.js +20 -15
- package/Source/Scene/QuadtreePrimitive.js +129 -96
- package/Source/Scene/QuadtreeTile.js +581 -385
- package/Source/Scene/QuadtreeTileLoadState.js +6 -1
- package/Source/Scene/QuadtreeTileProvider.js +159 -175
- package/Source/Scene/ResourceCache.js +71 -14
- package/Source/Scene/ResourceCacheKey.js +50 -12
- package/Source/Scene/ResourceLoader.js +84 -93
- package/Source/Scene/ResourceLoaderState.js +8 -2
- package/Source/Scene/Scene.js +298 -74
- package/Source/Scene/SceneMode.js +4 -1
- package/Source/Scene/ScreenSpaceCameraController.js +26 -13
- package/Source/Scene/SensorVolumePortionToDisplay.js +6 -6
- package/Source/Scene/ShadowMap.js +16 -17
- package/Source/Scene/ShadowMode.js +3 -1
- package/Source/Scene/ShadowVolumeAppearance.js +1 -2
- package/Source/Scene/SingleTileImageryProvider.js +7 -7
- package/Source/Scene/SkyAtmosphere.js +1 -2
- package/Source/Scene/SkyBox.js +38 -165
- package/Source/Scene/SphereEmitter.js +2 -3
- package/Source/Scene/SplitDirection.js +6 -1
- package/Source/Scene/StencilFunction.js +6 -1
- package/Source/Scene/StencilOperation.js +6 -1
- package/Source/Scene/StructuralMetadata.js +20 -5
- package/Source/Scene/SunLight.js +4 -4
- package/Source/Scene/SupportedImageFormats.js +4 -4
- package/Source/Scene/Terrain.js +5 -5
- package/Source/Scene/TerrainFillMesh.js +1 -0
- package/Source/Scene/TerrainState.js +7 -1
- package/Source/Scene/TileBoundingRegion.js +5 -6
- package/Source/Scene/TileBoundingS2Cell.js +4 -5
- package/Source/Scene/TileBoundingSphere.js +1 -1
- package/Source/Scene/TileCoordinatesImageryProvider.js +5 -5
- package/Source/Scene/TileMapServiceImageryProvider.js +20 -29
- package/Source/Scene/TileMetadata.js +2 -2
- package/Source/Scene/TileState.js +7 -1
- package/Source/Scene/Tileset3DTileContent.js +113 -146
- package/Source/Scene/TilesetMetadata.js +2 -2
- package/Source/Scene/TimeDynamicImagery.js +2 -2
- package/Source/Scene/TimeDynamicPointCloud.js +8 -10
- package/Source/Scene/Tonemapper.js +5 -1
- package/Source/Scene/TweenCollection.js +20 -16
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
- package/Source/Scene/UrlTemplateImageryProvider.js +12 -16
- package/Source/Scene/Vector3DTileClampedPolylines.js +2 -7
- package/Source/Scene/Vector3DTileContent.js +224 -256
- package/Source/Scene/Vector3DTileGeometry.js +1 -2
- package/Source/Scene/Vector3DTilePoints.js +10 -0
- package/Source/Scene/Vector3DTilePolygons.js +2 -3
- package/Source/Scene/Vector3DTilePolylines.js +2 -7
- package/Source/Scene/Vector3DTilePrimitive.js +9 -13
- package/Source/Scene/VectorGltf3DTileContent.js +452 -0
- package/Source/Scene/VertexAttributeSemantic.js +49 -1
- package/Source/Scene/VerticalOrigin.js +6 -1
- package/Source/Scene/View.js +3 -0
- package/Source/Scene/VoxelBoundsCollection.js +494 -0
- package/Source/Scene/VoxelBoxShape.js +252 -155
- package/Source/Scene/VoxelContent.js +2 -0
- package/Source/Scene/VoxelCylinderShape.js +418 -447
- package/Source/Scene/VoxelEllipsoidShape.js +422 -190
- package/Source/Scene/VoxelMetadataOrder.js +20 -3
- package/Source/Scene/VoxelPrimitive.js +484 -503
- package/Source/Scene/VoxelProvider.js +64 -102
- package/Source/Scene/VoxelRenderResources.js +35 -39
- package/Source/Scene/VoxelShape.js +23 -6
- package/Source/Scene/VoxelShapeType.js +3 -1
- package/Source/Scene/VoxelTraversal.js +17 -66
- package/Source/Scene/WebMapServiceImageryProvider.js +22 -28
- package/Source/Scene/WebMapTileServiceImageryProvider.js +369 -159
- package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
- package/Source/Scene/buildVoxelCustomShader.js +199 -0
- package/Source/Scene/buildVoxelDrawCommands.js +61 -20
- package/Source/Scene/createElevationBandMaterial.js +5 -5
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +9 -17
- package/Source/Scene/createOsmBuildingsAsync.js +3 -6
- package/Source/Scene/createTangentSpaceDebugPrimitive.js +4 -6
- package/Source/Scene/createWorldImageryAsync.js +4 -4
- package/Source/Scene/decodeMVT.js +634 -0
- package/Source/Scene/findContentMetadata.js +2 -5
- package/Source/Scene/findTileMetadata.js +2 -5
- package/Source/Scene/getClippingFunction.js +79 -88
- package/Source/Scene/getMeshPrimitives.js +72 -0
- package/Source/Scene/parseBatchTable.js +1 -5
- package/Source/Scene/parseFeatureMetadataLegacy.js +2 -2
- package/Source/Scene/parseStructuralMetadata.js +306 -2
- package/Source/Scene/processVoxelProperties.js +42 -101
- package/Source/Scene/renderBufferPointCollection.js +331 -0
- package/Source/Scene/renderBufferPolygonCollection.js +386 -0
- package/Source/Scene/renderBufferPolylineCollection.js +677 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +85 -81
- package/Source/Shaders/BillboardCollectionVS.glsl +60 -118
- package/Source/Shaders/BufferPointMaterialFS.glsl +28 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +58 -0
- package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +39 -0
- package/Source/Shaders/BufferPolylineMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +63 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.glsl +10 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
- package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.glsl +2 -1
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +0 -1
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/EllipsoidVS.glsl +4 -4
- package/Source/Shaders/FXAA3_11.glsl +2 -0
- package/Source/Shaders/GlobeFS.glsl +22 -0
- package/Source/Shaders/GlobeVS.glsl +3 -2
- package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
- package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
- package/Source/Shaders/Model/EdgeDetectionStageFS.glsl +58 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +69 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +97 -0
- package/Source/Shaders/Model/MaterialStageFS.glsl +50 -20
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +32 -2
- package/Source/Shaders/Model/ModelVS.glsl +15 -1
- package/Source/Shaders/Model/PointCloudStylingStageVS.glsl +1 -1
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +0 -1
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +64 -33
- package/Source/Shaders/PolylineCommon.glsl +1 -1
- package/Source/Shaders/PrimitiveGaussianSplatFS.glsl +18 -0
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +196 -0
- package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +7 -15
- package/Source/Shaders/SkyAtmosphereVS.glsl +2 -1
- package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
- package/Source/Shaders/Voxels/IntersectDepth.glsl +10 -6
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
- package/Source/Shaders/Voxels/Intersection.glsl +3 -5
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +2 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
- package/Source/Shaders/Voxels/Octree.glsl +53 -61
- package/Source/Shaders/Voxels/VoxelFS.glsl +67 -52
- package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +29 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +95 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +183 -0
- package/Source/Widget/CesiumWidget.js +29 -30
- package/Source/Workers/createGeometry.js +1 -2
- package/Source/Workers/createVerticesFromCesium3DTilesTerrain.js +46 -0
- package/Source/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -2
- package/Source/Workers/decodeDraco.js +3 -0
- package/Source/Workers/decodeI3S.js +6 -7
- package/Source/Workers/gaussianSplatSorter.js +34 -0
- package/Source/Workers/gaussianSplatTextureGenerator.js +39 -0
- package/Source/Workers/incrementallyBuildTerrainPicker.js +122 -0
- package/Source/Workers/transcodeKTX2.js +1 -2
- package/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +55 -0
- package/index.js +1 -1
- package/package.json +11 -7
- package/Build/Unminified/index.js +0 -253841
- package/Build/Unminified/index.js.map +0 -7
- package/Source/Core/defaultValue.js +0 -29
- package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
|
@@ -0,0 +1,1046 @@
|
|
|
1
|
+
import defined from "../../Core/defined.js";
|
|
2
|
+
import Cartesian4 from "../../Core/Cartesian4.js";
|
|
3
|
+
import Check from "../../Core/Check.js";
|
|
4
|
+
import Rectangle from "../../Core/Rectangle.js";
|
|
5
|
+
|
|
6
|
+
import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
7
|
+
|
|
8
|
+
import ImageryLayer from "../ImageryLayer.js";
|
|
9
|
+
import AttributeType from "../AttributeType.js";
|
|
10
|
+
|
|
11
|
+
import ImageryFlags from "./ImageryFlags.js";
|
|
12
|
+
import ModelPrimitiveImagery from "./ModelPrimitiveImagery.js";
|
|
13
|
+
import ImageryInput from "./ImageryInput.js";
|
|
14
|
+
import ImageryState from "../ImageryState.js";
|
|
15
|
+
import oneTimeWarning from "../../Core/oneTimeWarning.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A compile-time debugging flag to draw the boundaries of imagery tiles
|
|
19
|
+
* (Similar to "SHOW_TILE_BOUNDARIES" in GlobeFS.glsl)
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
const debugDrawImageryBoundaries = false;
|
|
23
|
+
|
|
24
|
+
// Scratch variable for _computeTextureTranslationAndScale
|
|
25
|
+
const nativeBoundingRectangleScratch = new Rectangle();
|
|
26
|
+
|
|
27
|
+
// Scratch variable for _computeTextureTranslationAndScale
|
|
28
|
+
const nativeImageryRectangleScratch = new Rectangle();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A pipeline stage that modifies the model shader to take into account
|
|
32
|
+
* imagery textures that are draped over a primitive of the model, when it
|
|
33
|
+
* is part a <code>Model3DTileContent</code> of a <code>Cesium3DTileset</code>
|
|
34
|
+
* that has <code>imageryLayers</code> associated with it.
|
|
35
|
+
*
|
|
36
|
+
* Most of what is done here tries to emulate the parts from
|
|
37
|
+
* https://github.com/CesiumGS/cesium/blob/6cc004aaff586bb59f07f199216ae511014cf5a9/packages/engine/Source/Shaders/GlobeFS.glsl#L166
|
|
38
|
+
* that are relevant for imagery, using the more modern ShaderBuilder structures.
|
|
39
|
+
*
|
|
40
|
+
* @namespace ImageryPipelineStage
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
class ImageryPipelineStage {
|
|
45
|
+
/**
|
|
46
|
+
* Process a primitive.
|
|
47
|
+
*
|
|
48
|
+
* This will update the render resources of the given primitive,
|
|
49
|
+
* depending on the imagery that is covered by the given primitive.
|
|
50
|
+
*
|
|
51
|
+
* This will obtain the <code>ModelPrimitiveImagery</code> from
|
|
52
|
+
* the given primitive, and use that to compute the actual
|
|
53
|
+
* <code>ImageryInput</code> objects that describe the information
|
|
54
|
+
* that has to be passed to the shader for draping the imagery over
|
|
55
|
+
* the primitive.
|
|
56
|
+
*
|
|
57
|
+
* After the <code>ImageryInput</code> has been computed, it will
|
|
58
|
+
* extend the render resources with the texture coordinate
|
|
59
|
+
* attribute that has to be used for the imagery, and augment
|
|
60
|
+
* the <code>primitiveRenderResources.shaderBuilder</code> with
|
|
61
|
+
* the information hat is required for the draping.
|
|
62
|
+
*
|
|
63
|
+
* @param {PrimitiveRenderResources} primitiveRenderResources The render resources for the primitive
|
|
64
|
+
* @param {ModelComponents.Primitive} primitive The primitive to be rendered
|
|
65
|
+
* @param {FrameState} frameState The frame state.
|
|
66
|
+
*/
|
|
67
|
+
static process(primitiveRenderResources, primitive, frameState) {
|
|
68
|
+
const model = primitiveRenderResources.model;
|
|
69
|
+
const modelPrimitiveImagery = primitive.modelPrimitiveImagery;
|
|
70
|
+
|
|
71
|
+
// When the creation of the model primitive imagery is happening
|
|
72
|
+
// asynchronously, then the primitive may not yet contain it.
|
|
73
|
+
// Return early in this case
|
|
74
|
+
if (!defined(modelPrimitiveImagery)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Similarly, when the model primitive imagery is not yet ready,
|
|
79
|
+
// then nothing can be done here
|
|
80
|
+
if (!modelPrimitiveImagery.ready) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Compute the arrays containing ALL projections and the array
|
|
85
|
+
// containing the UNIQUE projections from the imagery layers,
|
|
86
|
+
// to establish the mapping between the imagery index and the
|
|
87
|
+
// imagery texture coordinate attribute set index.
|
|
88
|
+
// (This should be implemented and/or documented better...)
|
|
89
|
+
const imageryLayers = model.imageryLayers;
|
|
90
|
+
const allProjections =
|
|
91
|
+
ModelPrimitiveImagery._extractProjections(imageryLayers);
|
|
92
|
+
const uniqueProjections = [...new Set(allProjections)];
|
|
93
|
+
const imageryTexCoordAttributeSetIndices =
|
|
94
|
+
ImageryPipelineStage._computeIndexMapping(
|
|
95
|
+
allProjections,
|
|
96
|
+
uniqueProjections,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// Create the `ImageryInput` objects that describe
|
|
100
|
+
// - the texture
|
|
101
|
+
// - texture coordinate rectangle
|
|
102
|
+
// - translation and scale
|
|
103
|
+
// - index of the imagery texture coordinate attribute
|
|
104
|
+
// to be passed to the actual imagery pipeline stage execution
|
|
105
|
+
const imageryInputs = ImageryPipelineStage._createImageryInputs(
|
|
106
|
+
imageryLayers,
|
|
107
|
+
modelPrimitiveImagery,
|
|
108
|
+
imageryTexCoordAttributeSetIndices,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// This can happen when none of the imagery textures could
|
|
112
|
+
// be obtained, because they had all been INVALID/FAILED,
|
|
113
|
+
// or when none of the imagery layers is actually visible
|
|
114
|
+
// according to `show==true`
|
|
115
|
+
// Bail out in this case
|
|
116
|
+
if (imageryInputs.length === 0) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// TODO_DRAPING This will have to be handled with upsampling.
|
|
121
|
+
// For now, just truncate the textures to not exceed the
|
|
122
|
+
// number of texture units
|
|
123
|
+
if (imageryInputs.length > 10) {
|
|
124
|
+
oneTimeWarning(
|
|
125
|
+
"imagery-texture-units",
|
|
126
|
+
`Warning: Draped imagery requires ${imageryInputs.length} texture units, truncating`,
|
|
127
|
+
);
|
|
128
|
+
imageryInputs.length = 10;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Add the imagery texture coordinate attributes to the render
|
|
132
|
+
// resources
|
|
133
|
+
ImageryPipelineStage._addImageryTexCoordAttributesToRenderResources(
|
|
134
|
+
modelPrimitiveImagery,
|
|
135
|
+
primitiveRenderResources,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const imageryLayersArray = [];
|
|
139
|
+
for (let i = 0; i < imageryLayers.length; i++) {
|
|
140
|
+
imageryLayersArray.push(imageryLayers.get(i));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
ImageryPipelineStage._processImageryInputs(
|
|
144
|
+
imageryLayersArray,
|
|
145
|
+
primitiveRenderResources,
|
|
146
|
+
imageryInputs,
|
|
147
|
+
uniqueProjections.length,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Add one attribute to the render resources, for each imagery texture
|
|
153
|
+
* coordinate that was computed in the given model primitive imagery
|
|
154
|
+
* (one for each projection)
|
|
155
|
+
*
|
|
156
|
+
* @param {ModelPrimitiveImagery} modelPrimitiveImagery The model primitive imagery
|
|
157
|
+
* @param {PrimitiveRenderResources} primitiveRenderResources The render resources
|
|
158
|
+
*/
|
|
159
|
+
static _addImageryTexCoordAttributesToRenderResources(
|
|
160
|
+
modelPrimitiveImagery,
|
|
161
|
+
primitiveRenderResources,
|
|
162
|
+
) {
|
|
163
|
+
const imageryTexCoordAttributes =
|
|
164
|
+
modelPrimitiveImagery.imageryTexCoordAttributesPerProjection();
|
|
165
|
+
for (const imageryTexCoordAttribute of imageryTexCoordAttributes) {
|
|
166
|
+
ImageryPipelineStage._addImageryTexCoordAttributeToRenderResources(
|
|
167
|
+
imageryTexCoordAttribute,
|
|
168
|
+
primitiveRenderResources,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Add the given attribute to the render resources
|
|
175
|
+
*
|
|
176
|
+
* @param {ModelComponents.Attribute} imageryTexCoordAttribute The attribute
|
|
177
|
+
* @param {PrimitiveRenderResources} primitiveRenderResources The render resources
|
|
178
|
+
*/
|
|
179
|
+
static _addImageryTexCoordAttributeToRenderResources(
|
|
180
|
+
imageryTexCoordAttribute,
|
|
181
|
+
primitiveRenderResources,
|
|
182
|
+
) {
|
|
183
|
+
const componentsPerAttribute = AttributeType.getNumberOfComponents(
|
|
184
|
+
imageryTexCoordAttribute.type,
|
|
185
|
+
);
|
|
186
|
+
// Convert the given object into another object that essentially
|
|
187
|
+
// contains the same information, but not exactly, and with most
|
|
188
|
+
// properties having slightly different names. Shrug.
|
|
189
|
+
const renderResourcesAttribute = {
|
|
190
|
+
index: primitiveRenderResources.attributeIndex++,
|
|
191
|
+
value: defined(imageryTexCoordAttribute.buffer)
|
|
192
|
+
? undefined
|
|
193
|
+
: imageryTexCoordAttribute.constant,
|
|
194
|
+
vertexBuffer: imageryTexCoordAttribute.buffer,
|
|
195
|
+
count: imageryTexCoordAttribute.count,
|
|
196
|
+
componentsPerAttribute: componentsPerAttribute,
|
|
197
|
+
componentDatatype: imageryTexCoordAttribute.componentDatatype,
|
|
198
|
+
offsetInBytes: imageryTexCoordAttribute.byteOffset,
|
|
199
|
+
strideInBytes: imageryTexCoordAttribute.byteStride,
|
|
200
|
+
normalize: imageryTexCoordAttribute.normalized,
|
|
201
|
+
};
|
|
202
|
+
primitiveRenderResources.attributes.push(renderResourcesAttribute);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Process the <code>ImageryInput</code> objects that have been
|
|
207
|
+
* created in <code>process</code>.
|
|
208
|
+
*
|
|
209
|
+
* This will build the shader, containing the attributes, uniforms,
|
|
210
|
+
* and "sample and blend" function that is required according to
|
|
211
|
+
* the given imagery inputs
|
|
212
|
+
*
|
|
213
|
+
* @param {ImageryLayer[]} imageryLayersArray The imagery layers
|
|
214
|
+
* @param {PrimitiveRenderResources} primitiveRenderResources The primitive render resources
|
|
215
|
+
* @param {ImageryInput[]} imageryInputs The imagery inputs
|
|
216
|
+
* @param {number} numImageryTexCoordAttributes The number of texture coordinate
|
|
217
|
+
* attributes that have been created for the imagery (one for each distinct
|
|
218
|
+
* projection that was found in the imagery layers)
|
|
219
|
+
*/
|
|
220
|
+
static _processImageryInputs(
|
|
221
|
+
imageryLayersArray,
|
|
222
|
+
renderResources,
|
|
223
|
+
imageryInputs,
|
|
224
|
+
numImageryTexCoordAttributes,
|
|
225
|
+
) {
|
|
226
|
+
const shaderBuilder = renderResources.shaderBuilder;
|
|
227
|
+
|
|
228
|
+
const imageryFlags =
|
|
229
|
+
ImageryPipelineStage._computeImageryFlags(imageryLayersArray);
|
|
230
|
+
const numTextures = imageryInputs.length;
|
|
231
|
+
|
|
232
|
+
// Set the global defines indicating the presence and number of
|
|
233
|
+
// imagery textures.
|
|
234
|
+
shaderBuilder.addDefine(`HAS_IMAGERY`);
|
|
235
|
+
shaderBuilder.addDefine(`IMAGERY_TEXTURE_UNITS ${numTextures}`);
|
|
236
|
+
|
|
237
|
+
ImageryPipelineStage._addAttributes(
|
|
238
|
+
shaderBuilder,
|
|
239
|
+
numImageryTexCoordAttributes,
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
ImageryPipelineStage._defineUniforms(shaderBuilder, imageryFlags);
|
|
243
|
+
ImageryPipelineStage._buildSampleAndBlendFunction(
|
|
244
|
+
shaderBuilder,
|
|
245
|
+
imageryFlags,
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
ImageryPipelineStage._createMainImageryShader(
|
|
249
|
+
shaderBuilder,
|
|
250
|
+
imageryInputs,
|
|
251
|
+
imageryFlags,
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
const uniformMap = renderResources.uniformMap;
|
|
255
|
+
const uniforms = ImageryPipelineStage._createImageryUniforms(imageryInputs);
|
|
256
|
+
ImageryPipelineStage._setImageryUniforms(uniformMap, uniforms);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Add the attribute- and varying definitions for the imagery texture
|
|
261
|
+
* coordinates to the given shader.
|
|
262
|
+
*
|
|
263
|
+
* This includes the definition of the <code>initializeImageryAttributes</code>
|
|
264
|
+
* function that assigns the attribute values to varyings in the vertex shader.
|
|
265
|
+
*
|
|
266
|
+
* @param {ShaderBuilder} shaderBuilder The shader builder
|
|
267
|
+
* @param {number} numTexCoords The number of imagery texture coordinate sets
|
|
268
|
+
*/
|
|
269
|
+
static _addAttributes(shaderBuilder, numTexCoords) {
|
|
270
|
+
for (let i = 0; i < numTexCoords; i++) {
|
|
271
|
+
shaderBuilder.addAttribute("vec2", `a_imagery_texCoord_${i}`);
|
|
272
|
+
shaderBuilder.addVarying("vec2", `v_imagery_texCoord_${i}`);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const functionId = "initializeImageryAttributes";
|
|
276
|
+
const signature = `void ${functionId}()`;
|
|
277
|
+
shaderBuilder.addFunction(functionId, signature, ShaderDestination.VERTEX);
|
|
278
|
+
|
|
279
|
+
for (let i = 0; i < numTexCoords; i++) {
|
|
280
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
281
|
+
`v_imagery_texCoord_${i} = a_imagery_texCoord_${i};`,
|
|
282
|
+
]);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Returns the `ImageryFlags` that indicate the features that are
|
|
288
|
+
* required for the given imagery layers.
|
|
289
|
+
*
|
|
290
|
+
* The resulting flags will indicate whether any of the given
|
|
291
|
+
* imagery layer objects did *not* have the default value for
|
|
292
|
+
* the respective property, as defined by `ImageryLayer.DEFAULT_...`
|
|
293
|
+
*
|
|
294
|
+
* @param {ImageryLayer[]} imageryLayers The imagery layers
|
|
295
|
+
* @returns {ImageryFlags} The imagery flags
|
|
296
|
+
*/
|
|
297
|
+
static _computeImageryFlags(imageryLayers) {
|
|
298
|
+
const imageryFlags = new ImageryFlags();
|
|
299
|
+
for (let i = 0; i < imageryLayers.length; i++) {
|
|
300
|
+
const imageryLayer = imageryLayers[i];
|
|
301
|
+
|
|
302
|
+
// These are short-circuiting to `number` instead
|
|
303
|
+
// of `boolean` here. With "ecmaVersion: 2021", we
|
|
304
|
+
// could use "||=" here. Otherwise, there is no
|
|
305
|
+
// nice shortcut for this.
|
|
306
|
+
imageryFlags.alpha |= imageryLayer.alpha !== 1.0;
|
|
307
|
+
imageryFlags.brightness |=
|
|
308
|
+
imageryLayer.brightness !== ImageryLayer.DEFAULT_BRIGHTNESS;
|
|
309
|
+
imageryFlags.contrast |=
|
|
310
|
+
imageryLayer.contrast !== ImageryLayer.DEFAULT_CONTRAST;
|
|
311
|
+
imageryFlags.hue |= imageryLayer.hue !== ImageryLayer.DEFAULT_HUE;
|
|
312
|
+
imageryFlags.saturation |=
|
|
313
|
+
imageryLayer.saturation !== ImageryLayer.DEFAULT_SATURATION;
|
|
314
|
+
imageryFlags.gamma |= imageryLayer.gamma !== ImageryLayer.DEFAULT_GAMMA;
|
|
315
|
+
const hasColorToAlpha =
|
|
316
|
+
defined(imageryLayer.colorToAlpha) &&
|
|
317
|
+
imageryLayer.colorToAlphaThreshold > 0.0;
|
|
318
|
+
imageryFlags.colorToAlpha |= hasColorToAlpha;
|
|
319
|
+
}
|
|
320
|
+
return imageryFlags;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Adds the uniforms that are required for the imagery to the shader.
|
|
325
|
+
*
|
|
326
|
+
* This will use the given shader builder to add the uniforms to the
|
|
327
|
+
* shader that are always required for the imagery (e.g. the
|
|
328
|
+
* `sampler2D u_imageryTextures[...]`).
|
|
329
|
+
*
|
|
330
|
+
* The array size of all arrays will be `IMAGERY_TEXTURE_UNITS`,
|
|
331
|
+
* so this has to be added as a `define` with a positive value.
|
|
332
|
+
*
|
|
333
|
+
* Depending on the given imagery flags being `true`, it will add
|
|
334
|
+
* the optional uniforms, like `u_imageryTextureAlpha`.
|
|
335
|
+
*
|
|
336
|
+
* The naming pattern will be `u_imageryTexture<name>`, except for
|
|
337
|
+
* `gamma`: To safe that one measly division, the thane will be
|
|
338
|
+
* `oneOverGamma` there.
|
|
339
|
+
*
|
|
340
|
+
* @param {ShaderBuilder} shaderBuilder The shader builder
|
|
341
|
+
* @param {ImageryFlags} imageryFlags The imagery flags
|
|
342
|
+
*/
|
|
343
|
+
static _defineUniforms(shaderBuilder, imageryFlags) {
|
|
344
|
+
shaderBuilder.addUniform(
|
|
345
|
+
"sampler2D",
|
|
346
|
+
"u_imageryTextures[IMAGERY_TEXTURE_UNITS]",
|
|
347
|
+
ShaderDestination.FRAGMENT,
|
|
348
|
+
);
|
|
349
|
+
shaderBuilder.addUniform(
|
|
350
|
+
"vec4",
|
|
351
|
+
"u_imageryTextureCoordinateRectangle[IMAGERY_TEXTURE_UNITS]",
|
|
352
|
+
ShaderDestination.FRAGMENT,
|
|
353
|
+
);
|
|
354
|
+
shaderBuilder.addUniform(
|
|
355
|
+
"vec4",
|
|
356
|
+
"u_imageryTextureTranslationAndScale[IMAGERY_TEXTURE_UNITS]",
|
|
357
|
+
ShaderDestination.FRAGMENT,
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
if (imageryFlags.alpha) {
|
|
361
|
+
shaderBuilder.addUniform(
|
|
362
|
+
"float",
|
|
363
|
+
"u_imageryTextureAlpha[IMAGERY_TEXTURE_UNITS]",
|
|
364
|
+
ShaderDestination.FRAGMENT,
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
if (imageryFlags.brightness) {
|
|
368
|
+
shaderBuilder.addUniform(
|
|
369
|
+
"float",
|
|
370
|
+
"u_imageryTextureBrightness[IMAGERY_TEXTURE_UNITS]",
|
|
371
|
+
ShaderDestination.FRAGMENT,
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
if (imageryFlags.contrast) {
|
|
375
|
+
shaderBuilder.addUniform(
|
|
376
|
+
"float",
|
|
377
|
+
"u_imageryTextureContrast[IMAGERY_TEXTURE_UNITS]",
|
|
378
|
+
ShaderDestination.FRAGMENT,
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
if (imageryFlags.hue) {
|
|
382
|
+
shaderBuilder.addUniform(
|
|
383
|
+
"float",
|
|
384
|
+
"u_imageryTextureHue[IMAGERY_TEXTURE_UNITS]",
|
|
385
|
+
ShaderDestination.FRAGMENT,
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
if (imageryFlags.saturation) {
|
|
389
|
+
shaderBuilder.addUniform(
|
|
390
|
+
"float",
|
|
391
|
+
"u_imageryTextureSaturation[IMAGERY_TEXTURE_UNITS]",
|
|
392
|
+
ShaderDestination.FRAGMENT,
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
if (imageryFlags.gamma) {
|
|
396
|
+
shaderBuilder.addUniform(
|
|
397
|
+
"float",
|
|
398
|
+
"u_imageryTextureOneOverGamma[IMAGERY_TEXTURE_UNITS]",
|
|
399
|
+
ShaderDestination.FRAGMENT,
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
if (imageryFlags.colorToAlpha) {
|
|
403
|
+
shaderBuilder.addUniform(
|
|
404
|
+
"vec4",
|
|
405
|
+
"u_imageryTextureColorToAlpha[IMAGERY_TEXTURE_UNITS]",
|
|
406
|
+
ShaderDestination.FRAGMENT,
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Create the function signature for the `sampleAndBlend` function,
|
|
413
|
+
* based on the features that are required for the imagery.
|
|
414
|
+
*
|
|
415
|
+
* For details, see `buildSampleAndBlendFunction`
|
|
416
|
+
*
|
|
417
|
+
* @param {ImageryFlags} imageryFlags The imagery flags
|
|
418
|
+
* @returns {string} The string
|
|
419
|
+
*/
|
|
420
|
+
static _createSampleAndBlendFunctionSignature(imageryFlags) {
|
|
421
|
+
const functionId = "sampleAndBlend";
|
|
422
|
+
const parameters = [];
|
|
423
|
+
parameters.push(`vec4 previousColor`);
|
|
424
|
+
parameters.push(`sampler2D textureToSample`);
|
|
425
|
+
parameters.push(`vec2 textureCoordinates`);
|
|
426
|
+
parameters.push(`vec4 textureCoordinateRectangle`);
|
|
427
|
+
parameters.push(`vec4 textureCoordinateTranslationAndScale`);
|
|
428
|
+
if (imageryFlags.alpha) {
|
|
429
|
+
parameters.push(`float textureAlpha`);
|
|
430
|
+
}
|
|
431
|
+
if (imageryFlags.brightness) {
|
|
432
|
+
parameters.push(`float textureBrightness`);
|
|
433
|
+
}
|
|
434
|
+
if (imageryFlags.contrast) {
|
|
435
|
+
parameters.push(`float textureContrast`);
|
|
436
|
+
}
|
|
437
|
+
if (imageryFlags.hue) {
|
|
438
|
+
parameters.push(`float textureHue`);
|
|
439
|
+
}
|
|
440
|
+
if (imageryFlags.saturation) {
|
|
441
|
+
parameters.push(`float textureSaturation`);
|
|
442
|
+
}
|
|
443
|
+
if (imageryFlags.gamma) {
|
|
444
|
+
parameters.push(`float textureOneOverGamma`);
|
|
445
|
+
}
|
|
446
|
+
if (imageryFlags.colorToAlpha) {
|
|
447
|
+
parameters.push(`vec4 colorToAlpha`);
|
|
448
|
+
}
|
|
449
|
+
const parametersString = parameters.join(", ");
|
|
450
|
+
|
|
451
|
+
const signature = `vec4 ${functionId}(${parametersString})`;
|
|
452
|
+
return signature;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Build the `sampleAndBlend` function that will be called for each imagery,
|
|
457
|
+
* to combine the previous pixel color with the respective imagery input.
|
|
458
|
+
*
|
|
459
|
+
* The function that is built here resembles the function that was originally defined at
|
|
460
|
+
* https://github.com/CesiumGS/cesium/blob/6cc004aaff586bb59f07f199216ae511014cf5a9/packages/engine/Source/Shaders/GlobeFS.glsl#L166
|
|
461
|
+
*
|
|
462
|
+
* However, for the function that is built here, the signature will
|
|
463
|
+
* reflect the actual features that are required for the imagery:
|
|
464
|
+
* For example, the `float textureAlpha` parameter will only be
|
|
465
|
+
* present when `imageryFlags.alpha` is `true`.
|
|
466
|
+
*
|
|
467
|
+
* @param {ShaderBuilder} shaderBuilder The shader builder
|
|
468
|
+
* @param {ImageryFlags} imageryFlags The imagery flags
|
|
469
|
+
*/
|
|
470
|
+
static _buildSampleAndBlendFunction(shaderBuilder, imageryFlags) {
|
|
471
|
+
const functionId = "sampleAndBlend";
|
|
472
|
+
const signature =
|
|
473
|
+
ImageryPipelineStage._createSampleAndBlendFunctionSignature(imageryFlags);
|
|
474
|
+
shaderBuilder.addFunction(
|
|
475
|
+
functionId,
|
|
476
|
+
signature,
|
|
477
|
+
ShaderDestination.FRAGMENT,
|
|
478
|
+
);
|
|
479
|
+
|
|
480
|
+
shaderBuilder.addFunctionLines(functionId, [`float effectiveAlpha = 1.0;`]);
|
|
481
|
+
if (imageryFlags.alpha) {
|
|
482
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
483
|
+
`effectiveAlpha = textureAlpha;`,
|
|
484
|
+
]);
|
|
485
|
+
}
|
|
486
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
487
|
+
// This is the part that is documented as "This crazy step stuff"
|
|
488
|
+
// in GlobeFS.glsl. Using the if-approach here...
|
|
489
|
+
`if (textureCoordinates.x < textureCoordinateRectangle.x) effectiveAlpha = 0.0;`,
|
|
490
|
+
`if (textureCoordinates.x > textureCoordinateRectangle.z) effectiveAlpha = 0.0;`,
|
|
491
|
+
`if (textureCoordinates.y < textureCoordinateRectangle.y) effectiveAlpha = 0.0;`,
|
|
492
|
+
`if (textureCoordinates.y > textureCoordinateRectangle.w) effectiveAlpha = 0.0;`,
|
|
493
|
+
|
|
494
|
+
`vec2 translation = textureCoordinateTranslationAndScale.xy;`,
|
|
495
|
+
`vec2 scale = textureCoordinateTranslationAndScale.zw;`,
|
|
496
|
+
`vec2 effectiveTextureCoordinates = textureCoordinates * scale + translation;`,
|
|
497
|
+
`vec4 value = texture(textureToSample, effectiveTextureCoordinates);`,
|
|
498
|
+
`value = czm_srgbToLinear(value);`,
|
|
499
|
+
|
|
500
|
+
`vec3 color = value.rgb;`,
|
|
501
|
+
`float alpha = value.a;`,
|
|
502
|
+
]);
|
|
503
|
+
|
|
504
|
+
if (imageryFlags.colorToAlpha) {
|
|
505
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
506
|
+
`vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);`,
|
|
507
|
+
`colorDiff.r = czm_maximumComponent(colorDiff);`,
|
|
508
|
+
`alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);`,
|
|
509
|
+
]);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (imageryFlags.gamma) {
|
|
513
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
514
|
+
`color = pow(color, vec3(textureOneOverGamma));`,
|
|
515
|
+
]);
|
|
516
|
+
} else {
|
|
517
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
518
|
+
`vec4 tempColor = czm_gammaCorrect(vec4(color, alpha));`,
|
|
519
|
+
`color = tempColor.rgb;`,
|
|
520
|
+
`alpha = tempColor.a;`,
|
|
521
|
+
]);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (imageryFlags.brightness) {
|
|
525
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
526
|
+
`color = mix(vec3(0.0), color, textureBrightness);`,
|
|
527
|
+
]);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (imageryFlags.contrast) {
|
|
531
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
532
|
+
`color = mix(vec3(0.5), color, textureContrast);`,
|
|
533
|
+
]);
|
|
534
|
+
}
|
|
535
|
+
if (imageryFlags.hue) {
|
|
536
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
537
|
+
`color = czm_hue(color, textureHue);`,
|
|
538
|
+
]);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
if (imageryFlags.saturation) {
|
|
542
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
543
|
+
`color = czm_saturation(color, textureSaturation);`,
|
|
544
|
+
]);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
548
|
+
`float sourceAlpha = alpha * effectiveAlpha;`,
|
|
549
|
+
`float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);`,
|
|
550
|
+
`outAlpha += sign(outAlpha) - 1.0;`,
|
|
551
|
+
`vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;`,
|
|
552
|
+
// See comments in https://github.com/CesiumGS/cesium/blob/6cc004aaff586bb59f07f199216ae511014cf5a9/packages/engine/Source/Shaders/GlobeFS.glsl#L166
|
|
553
|
+
`vec4 result = vec4(outColor, max(outAlpha, 0.0));`,
|
|
554
|
+
]);
|
|
555
|
+
|
|
556
|
+
// Debug mode: Draw boundaries of imagery in red
|
|
557
|
+
if (debugDrawImageryBoundaries) {
|
|
558
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
559
|
+
`if (abs(textureCoordinates.x - textureCoordinateRectangle.x) < (1.0/256.0) || `,
|
|
560
|
+
` abs(textureCoordinates.x - textureCoordinateRectangle.z) < (1.0/256.0) || `,
|
|
561
|
+
` abs(textureCoordinates.y - textureCoordinateRectangle.y) < (1.0/256.0) || `,
|
|
562
|
+
` abs(textureCoordinates.y - textureCoordinateRectangle.w) < (1.0/256.0))`,
|
|
563
|
+
`{`,
|
|
564
|
+
` result = vec4(1.0, 0.0, 0.0, effectiveAlpha);`,
|
|
565
|
+
`}`,
|
|
566
|
+
]);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
shaderBuilder.addFunctionLines(functionId, [`return result;`]);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Creates the arguments for a call to `sampleAndBlend` for the
|
|
574
|
+
* specified imagery.
|
|
575
|
+
*
|
|
576
|
+
* For details, see `buildSampleAndBlendFunction`
|
|
577
|
+
*
|
|
578
|
+
* @param {ImageryFlags} imageryFlags The imagery flags
|
|
579
|
+
* @param {number} imageryTexCoordAttributeSetIndex The index for the texture coordinate attribute
|
|
580
|
+
* @param {number} i The imagery index
|
|
581
|
+
* @returns {string} The string
|
|
582
|
+
*/
|
|
583
|
+
static _createSampleAndBlendCallArguments(
|
|
584
|
+
imageryFlags,
|
|
585
|
+
imageryTexCoordAttributeSetIndex,
|
|
586
|
+
i,
|
|
587
|
+
) {
|
|
588
|
+
const textureCoordinates = `v_imagery_texCoord_${imageryTexCoordAttributeSetIndex}`;
|
|
589
|
+
|
|
590
|
+
const args = [];
|
|
591
|
+
args.push(`blendedBaseColor`);
|
|
592
|
+
args.push(`u_imageryTextures[${i}]`);
|
|
593
|
+
args.push(`${textureCoordinates}`);
|
|
594
|
+
args.push(`u_imageryTextureCoordinateRectangle[${i}]`);
|
|
595
|
+
args.push(`u_imageryTextureTranslationAndScale[${i}]`);
|
|
596
|
+
if (imageryFlags.alpha) {
|
|
597
|
+
args.push(`u_imageryTextureAlpha[${i}]`);
|
|
598
|
+
}
|
|
599
|
+
if (imageryFlags.brightness) {
|
|
600
|
+
args.push(`u_imageryTextureBrightness[${i}]`);
|
|
601
|
+
}
|
|
602
|
+
if (imageryFlags.contrast) {
|
|
603
|
+
args.push(`u_imageryTextureContrast[${i}]`);
|
|
604
|
+
}
|
|
605
|
+
if (imageryFlags.hue) {
|
|
606
|
+
args.push(`u_imageryTextureHue[${i}]`);
|
|
607
|
+
}
|
|
608
|
+
if (imageryFlags.saturation) {
|
|
609
|
+
args.push(`u_imageryTextureSaturation[${i}]`);
|
|
610
|
+
}
|
|
611
|
+
if (imageryFlags.gamma) {
|
|
612
|
+
args.push(`u_imageryTextureOneOverGamma[${i}]`);
|
|
613
|
+
}
|
|
614
|
+
if (imageryFlags.colorToAlpha) {
|
|
615
|
+
args.push(`u_imageryTextureColorToAlpha[${i}]`);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
const argsString = args.join(", ");
|
|
619
|
+
return argsString;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Creates the main part of the imagery shader.
|
|
624
|
+
*
|
|
625
|
+
* It adds the `blendBaseColorWithImagery` function, which is to be
|
|
626
|
+
* called in the `MaterialStageFS.glsl` when the `HAS_IMAGERY`
|
|
627
|
+
* flag was set in the shader.
|
|
628
|
+
*
|
|
629
|
+
* The `blendBaseColorWithImagery` function will go through all imagery
|
|
630
|
+
* layers in the input, and call the `sampleAndBlend` function, to
|
|
631
|
+
* incorporate the imagery input in the resulting pixel.
|
|
632
|
+
*
|
|
633
|
+
* @param {ShaderBuilder} shaderBuilder The shader builder
|
|
634
|
+
* @param {ImageryInput[]} imageryInputs The imagery inputs
|
|
635
|
+
* @param {ImageryFlags} imageryFlags The imagery flags
|
|
636
|
+
*/
|
|
637
|
+
static _createMainImageryShader(shaderBuilder, imageryInputs, imageryFlags) {
|
|
638
|
+
const functionId = "blendBaseColorWithImagery";
|
|
639
|
+
shaderBuilder.addFunction(
|
|
640
|
+
functionId,
|
|
641
|
+
`vec4 blendBaseColorWithImagery(vec4 baseColorWithAlpha)`,
|
|
642
|
+
ShaderDestination.FRAGMENT,
|
|
643
|
+
);
|
|
644
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
645
|
+
`vec4 blendedBaseColor = baseColorWithAlpha;`,
|
|
646
|
+
]);
|
|
647
|
+
|
|
648
|
+
// Roughly what was done in https://github.com/CesiumGS/cesium/blob/6cc004aaff586bb59f07f199216ae511014cf5a9/packages/engine/Source/Scene/GlobeSurfaceShaderSet.js#L394
|
|
649
|
+
for (let i = 0; i < imageryInputs.length; i++) {
|
|
650
|
+
const imageryInput = imageryInputs[i];
|
|
651
|
+
const imageryTexCoordAttributeSetIndex =
|
|
652
|
+
imageryInput.imageryTexCoordAttributeSetIndex;
|
|
653
|
+
const argsString =
|
|
654
|
+
ImageryPipelineStage._createSampleAndBlendCallArguments(
|
|
655
|
+
imageryFlags,
|
|
656
|
+
imageryTexCoordAttributeSetIndex,
|
|
657
|
+
i,
|
|
658
|
+
);
|
|
659
|
+
shaderBuilder.addFunctionLines(functionId, [
|
|
660
|
+
`blendedBaseColor = sampleAndBlend(${argsString});`,
|
|
661
|
+
]);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
shaderBuilder.addFunctionLines(functionId, [`return blendedBaseColor;`]);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Creates an object that contains the uniform values the given imagery inputs.
|
|
669
|
+
*
|
|
670
|
+
* The result will be a structure that contains the uniform values
|
|
671
|
+
* that match the definitions that have been created by `defineUniforms`.
|
|
672
|
+
* (It will include the ones that still have their default values
|
|
673
|
+
* and may not be needed eventually)
|
|
674
|
+
*
|
|
675
|
+
* @param {ImageryInput[]} imageryInputs The imagery inputs
|
|
676
|
+
* @returns {object} The uniforms
|
|
677
|
+
*/
|
|
678
|
+
static _createImageryUniforms(imageryInputs) {
|
|
679
|
+
const length = imageryInputs.length;
|
|
680
|
+
const uniforms = {};
|
|
681
|
+
uniforms.imageryTextures = Array(length);
|
|
682
|
+
uniforms.imageryTextureCoordinateRectangle = Array(length);
|
|
683
|
+
uniforms.imageryTextureTranslationAndScale = Array(length);
|
|
684
|
+
uniforms.imageryTextureAlpha = Array(length);
|
|
685
|
+
uniforms.imageryTextureBrightness = Array(length);
|
|
686
|
+
uniforms.imageryTextureContrast = Array(length);
|
|
687
|
+
uniforms.imageryTextureHue = Array(length);
|
|
688
|
+
uniforms.imageryTextureSaturation = Array(length);
|
|
689
|
+
uniforms.imageryTextureOneOverGamma = Array(length);
|
|
690
|
+
uniforms.imageryTextureColorToAlpha = Array(length);
|
|
691
|
+
|
|
692
|
+
for (let i = 0; i < length; i++) {
|
|
693
|
+
const imageryInput = imageryInputs[i];
|
|
694
|
+
|
|
695
|
+
const imageryLayer = imageryInput.imageryLayer;
|
|
696
|
+
const texture = imageryInput.texture;
|
|
697
|
+
const textureCoordinateRectangle =
|
|
698
|
+
imageryInput.textureCoordinateRectangle;
|
|
699
|
+
const textureTranslationAndScale =
|
|
700
|
+
imageryInput.textureTranslationAndScale;
|
|
701
|
+
|
|
702
|
+
uniforms.imageryTextures[i] = texture;
|
|
703
|
+
uniforms.imageryTextureTranslationAndScale[i] =
|
|
704
|
+
textureTranslationAndScale;
|
|
705
|
+
uniforms.imageryTextureCoordinateRectangle[i] =
|
|
706
|
+
textureCoordinateRectangle;
|
|
707
|
+
|
|
708
|
+
uniforms.imageryTextureAlpha[i] = imageryLayer.alpha;
|
|
709
|
+
uniforms.imageryTextureBrightness[i] = imageryLayer.brightness;
|
|
710
|
+
uniforms.imageryTextureContrast[i] = imageryLayer.contrast;
|
|
711
|
+
uniforms.imageryTextureHue[i] = imageryLayer.hue;
|
|
712
|
+
uniforms.imageryTextureSaturation[i] = imageryLayer.saturation;
|
|
713
|
+
uniforms.imageryTextureOneOverGamma[i] = 1.0 / imageryLayer.gamma;
|
|
714
|
+
|
|
715
|
+
let colorToAlpha = uniforms.imageryTextureColorToAlpha[i];
|
|
716
|
+
if (!defined(colorToAlpha)) {
|
|
717
|
+
colorToAlpha = new Cartesian4();
|
|
718
|
+
uniforms.imageryTextureColorToAlpha[i] = colorToAlpha;
|
|
719
|
+
}
|
|
720
|
+
const hasColorToAlpha =
|
|
721
|
+
defined(imageryLayer.colorToAlpha) &&
|
|
722
|
+
imageryLayer.colorToAlphaThreshold > 0.0;
|
|
723
|
+
if (hasColorToAlpha) {
|
|
724
|
+
const color = imageryLayer.colorToAlpha;
|
|
725
|
+
colorToAlpha.x = color.red;
|
|
726
|
+
colorToAlpha.y = color.green;
|
|
727
|
+
colorToAlpha.z = color.blue;
|
|
728
|
+
colorToAlpha.w = imageryLayer.colorToAlphaThreshold;
|
|
729
|
+
} else {
|
|
730
|
+
colorToAlpha.w = -1.0;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return uniforms;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Fill the given uniform map with functions for all properties
|
|
738
|
+
* in the given uniforms object.
|
|
739
|
+
*
|
|
740
|
+
* The uniform names will be created as `u_<propertyName>`, and
|
|
741
|
+
* their value will just be a function that returns the respective
|
|
742
|
+
* property value.
|
|
743
|
+
*
|
|
744
|
+
* @param {UniformMap} uniformMap The uniform map
|
|
745
|
+
* @param {object} uniforms The uniforms
|
|
746
|
+
*/
|
|
747
|
+
static _setImageryUniforms(uniformMap, uniforms) {
|
|
748
|
+
for (const key in uniforms) {
|
|
749
|
+
if (uniforms.hasOwnProperty(key)) {
|
|
750
|
+
const name = `u_${key}`;
|
|
751
|
+
uniformMap[name] = function () {
|
|
752
|
+
return uniforms[key];
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Create the <code>ImageryInput</code> objects that have to be fed to the imagery
|
|
760
|
+
* pipeline stage for draping the given imagery layers over the primitive
|
|
761
|
+
* that is described by the given model primitive imagery.
|
|
762
|
+
*
|
|
763
|
+
* For each imagery layer that is currently visible (as of `show==true`), this
|
|
764
|
+
* will obtain the <code>ImageryCoverage</code> objects that are provided by
|
|
765
|
+
* the given model primitive imagery (and that describe the imagery tiles
|
|
766
|
+
* that are covered by the primitive), and create one <code>ImageryInput</code> for
|
|
767
|
+
* each of them.
|
|
768
|
+
*
|
|
769
|
+
* @param {ImageryLayerCollection} imageryLayers The imagery layers
|
|
770
|
+
* @param {ModelPrimitiveImagery} modelPrimitiveImagery The model primitive imagery
|
|
771
|
+
* @param {number[]} imageryTexCoordAttributeSetIndices The array that contains,
|
|
772
|
+
* for each imagery layer index, the set index of the texture coordinate
|
|
773
|
+
* attribute that should be used for this imagery. This is the value that
|
|
774
|
+
* will be used to access the texture coordinate attribute
|
|
775
|
+
* <code>a_imagery_texCoord_${imageryTexCoordAttributeSetIndex}</code>
|
|
776
|
+
* in the shader.
|
|
777
|
+
* @returns {ImageryInput[]} The imagery inputs
|
|
778
|
+
*/
|
|
779
|
+
static _createImageryInputs(
|
|
780
|
+
imageryLayers,
|
|
781
|
+
modelPrimitiveImagery,
|
|
782
|
+
imageryTexCoordAttributeSetIndices,
|
|
783
|
+
) {
|
|
784
|
+
//>>includeStart('debug', pragmas.debug);
|
|
785
|
+
Check.defined("imageryLayers", imageryLayers);
|
|
786
|
+
Check.defined("modelPrimitiveImagery", modelPrimitiveImagery);
|
|
787
|
+
Check.defined(
|
|
788
|
+
"imageryTexCoordAttributeSetIndices",
|
|
789
|
+
imageryTexCoordAttributeSetIndices,
|
|
790
|
+
);
|
|
791
|
+
//>>includeEnd('debug');
|
|
792
|
+
|
|
793
|
+
const imageryInputs = [];
|
|
794
|
+
|
|
795
|
+
for (let i = 0; i < imageryLayers.length; i++) {
|
|
796
|
+
const imageryLayer = imageryLayers.get(i);
|
|
797
|
+
if (!imageryLayer.show) {
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
800
|
+
const imageryTexCoordAttributeSetIndex =
|
|
801
|
+
imageryTexCoordAttributeSetIndices[i];
|
|
802
|
+
const mappedPositions =
|
|
803
|
+
modelPrimitiveImagery.mappedPositionsForImageryLayer(imageryLayer);
|
|
804
|
+
const cartographicBoundingRectangle =
|
|
805
|
+
mappedPositions.cartographicBoundingRectangle;
|
|
806
|
+
const coverages =
|
|
807
|
+
modelPrimitiveImagery.coveragesForImageryLayer(imageryLayer);
|
|
808
|
+
|
|
809
|
+
for (let j = 0; j < coverages.length; j++) {
|
|
810
|
+
const coverage = coverages[j];
|
|
811
|
+
const imageryInput = ImageryPipelineStage._createImageryInput(
|
|
812
|
+
imageryLayer,
|
|
813
|
+
coverage,
|
|
814
|
+
cartographicBoundingRectangle,
|
|
815
|
+
imageryTexCoordAttributeSetIndex,
|
|
816
|
+
);
|
|
817
|
+
if (defined(imageryInput)) {
|
|
818
|
+
imageryInputs.push(imageryInput);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
return imageryInputs;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Create the `ImageryInput` that has to be passed to the imagery pipeline
|
|
827
|
+
* stage, for the given `ImageryCoverage`.
|
|
828
|
+
*
|
|
829
|
+
* The `ImageryCoverage` describes on imagery tile that is covered by the
|
|
830
|
+
* cartographic bounding rectangle of the primitive positions. This function
|
|
831
|
+
* obtains the actual `Imagery` object and its texture, computes the
|
|
832
|
+
* required texture coordinate and scale, and assembles this information
|
|
833
|
+
* into an `ImageryInput`.
|
|
834
|
+
*
|
|
835
|
+
* @param {ImageryLayer} imageryLayer The imagery layer
|
|
836
|
+
* @param {ImageryCoverage} coverage The imagery coverage
|
|
837
|
+
* @param {Rectangle} cartographicBoundingRectangle The bounding rectangle
|
|
838
|
+
* of the cartographic primitive positions
|
|
839
|
+
* @param {number} imageryTexCoordAttributeSetIndex The set index of the
|
|
840
|
+
* texture coordinate attribute that should be used for this imagery.
|
|
841
|
+
* This is the value that will be used to access the texture coordinate
|
|
842
|
+
* attribute <code>a_imagery_texCoord_${imageryTexCoordAttributeSetIndex}</code>
|
|
843
|
+
* in the shader.
|
|
844
|
+
* @returns {ImageryInput|undefined} The imagery input, or undefined if
|
|
845
|
+
* the imagery for the given coverage turned out to be in the
|
|
846
|
+
* <code>ImageryState.INVALID/FAILED<code> state, or did not have
|
|
847
|
+
* a valid texture.
|
|
848
|
+
* @private
|
|
849
|
+
*/
|
|
850
|
+
static _createImageryInput(
|
|
851
|
+
imageryLayer,
|
|
852
|
+
coverage,
|
|
853
|
+
cartographicBoundingRectangle,
|
|
854
|
+
imageryTexCoordAttributeSetIndex,
|
|
855
|
+
) {
|
|
856
|
+
//>>includeStart('debug', pragmas.debug);
|
|
857
|
+
Check.defined("imageryLayer", imageryLayer);
|
|
858
|
+
Check.defined("coverage", coverage);
|
|
859
|
+
Check.defined(
|
|
860
|
+
"cartographicBoundingRectangle",
|
|
861
|
+
cartographicBoundingRectangle,
|
|
862
|
+
);
|
|
863
|
+
Check.typeOf.number.greaterThanOrEquals(
|
|
864
|
+
"imageryTexCoordAttributeSetIndex",
|
|
865
|
+
imageryTexCoordAttributeSetIndex,
|
|
866
|
+
0,
|
|
867
|
+
);
|
|
868
|
+
//>>includeEnd('debug');
|
|
869
|
+
|
|
870
|
+
// Bail out early if something went wrong in the imagery
|
|
871
|
+
// loading state machine
|
|
872
|
+
const imagery = coverage.imagery;
|
|
873
|
+
if (
|
|
874
|
+
imagery.state === ImageryState.FAILED ||
|
|
875
|
+
imagery.state === ImageryState.INVALID
|
|
876
|
+
) {
|
|
877
|
+
return undefined;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// The texture coordinates are computed for the respective
|
|
881
|
+
// imagery, so pick either the textureWebMercator or the
|
|
882
|
+
// texture here
|
|
883
|
+
let texture = imagery.textureWebMercator;
|
|
884
|
+
if (!defined(texture)) {
|
|
885
|
+
texture = imagery.texture;
|
|
886
|
+
if (!defined(texture)) {
|
|
887
|
+
// Print an error message only when the imagery
|
|
888
|
+
// SHOULD actually have a texture
|
|
889
|
+
if (imagery.state === ImageryState.READY) {
|
|
890
|
+
console.log(
|
|
891
|
+
`Imagery at ${coverage.x}, ${coverage.y} (level ${coverage.level}) does not have any texture - state ${imagery.state}`,
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
return undefined;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
const textureTranslationAndScale =
|
|
899
|
+
ImageryPipelineStage._computeTextureTranslationAndScale(
|
|
900
|
+
imageryLayer,
|
|
901
|
+
cartographicBoundingRectangle,
|
|
902
|
+
imagery.rectangle,
|
|
903
|
+
);
|
|
904
|
+
|
|
905
|
+
// Convert the texture coordinate rectangle into a Cartesian4
|
|
906
|
+
// for the consumption as a uniform in the shader
|
|
907
|
+
const textureCoordinateCartesianRectangle =
|
|
908
|
+
coverage.textureCoordinateRectangle;
|
|
909
|
+
const textureCoordinateRectangle = new Cartesian4(
|
|
910
|
+
textureCoordinateCartesianRectangle.minX,
|
|
911
|
+
textureCoordinateCartesianRectangle.minY,
|
|
912
|
+
textureCoordinateCartesianRectangle.maxX,
|
|
913
|
+
textureCoordinateCartesianRectangle.maxY,
|
|
914
|
+
);
|
|
915
|
+
|
|
916
|
+
const imageryInput = new ImageryInput(
|
|
917
|
+
imageryLayer,
|
|
918
|
+
texture,
|
|
919
|
+
textureTranslationAndScale,
|
|
920
|
+
textureCoordinateRectangle,
|
|
921
|
+
imageryTexCoordAttributeSetIndex,
|
|
922
|
+
);
|
|
923
|
+
return imageryInput;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Compute the translation and scale that has to be applied to
|
|
928
|
+
* the texture coordinates for mapping the given imagery to
|
|
929
|
+
* the geometry.
|
|
930
|
+
*
|
|
931
|
+
* The given rectangles will be converted into their "native" representation,
|
|
932
|
+
* using the tiling scheme of the given imagery layer, and passed
|
|
933
|
+
* to `_computeTextureTranslationAndScaleFromNative` (see that for details).
|
|
934
|
+
*
|
|
935
|
+
* @param {ImageryLayer} imageryLayer The imagery layer
|
|
936
|
+
* @param {Rectangle} nonNativeBoundingRectangle The bounding
|
|
937
|
+
* rectangle of the geometry
|
|
938
|
+
* @param {Rectangle} nonNativeImageryRectangle The bounding
|
|
939
|
+
* rectangle of the imagery
|
|
940
|
+
* @returns {Cartesian4} The translation and scale
|
|
941
|
+
* @private
|
|
942
|
+
*/
|
|
943
|
+
static _computeTextureTranslationAndScale(
|
|
944
|
+
imageryLayer,
|
|
945
|
+
nonNativeBoundingRectangle,
|
|
946
|
+
nonNativeImageryRectangle,
|
|
947
|
+
) {
|
|
948
|
+
//>>includeStart('debug', pragmas.debug);
|
|
949
|
+
Check.defined("imageryLayer", imageryLayer);
|
|
950
|
+
Check.defined("nonNativeBoundingRectangle", nonNativeBoundingRectangle);
|
|
951
|
+
Check.defined("nonNativeImageryRectangle", nonNativeImageryRectangle);
|
|
952
|
+
//>>includeEnd('debug');
|
|
953
|
+
|
|
954
|
+
const tilingScheme = imageryLayer.imageryProvider.tilingScheme;
|
|
955
|
+
|
|
956
|
+
const nativeBoundingRectangle = tilingScheme.rectangleToNativeRectangle(
|
|
957
|
+
nonNativeBoundingRectangle,
|
|
958
|
+
nativeBoundingRectangleScratch,
|
|
959
|
+
);
|
|
960
|
+
const nativeImageryRectangle = tilingScheme.rectangleToNativeRectangle(
|
|
961
|
+
nonNativeImageryRectangle,
|
|
962
|
+
nativeImageryRectangleScratch,
|
|
963
|
+
);
|
|
964
|
+
|
|
965
|
+
const translationAndScale =
|
|
966
|
+
ImageryPipelineStage._computeTextureTranslationAndScaleFromNative(
|
|
967
|
+
nativeBoundingRectangle,
|
|
968
|
+
nativeImageryRectangle,
|
|
969
|
+
);
|
|
970
|
+
return translationAndScale;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Compute the translation and scale that has to be applied to
|
|
975
|
+
* the texture coordinates for mapping the given imagery rectangle
|
|
976
|
+
* to the geometry rectangle.
|
|
977
|
+
*
|
|
978
|
+
* This will compute a Cartesian4 containing the
|
|
979
|
+
* (offsetX, offsetY, scaleX, scaleY) that have to be applied to
|
|
980
|
+
* the texture coordinates that that have been computed with
|
|
981
|
+
* `ModelImageryMapping.createTextureCoordinatesAttributeForMappedPositions`.
|
|
982
|
+
* In the shader, this offset and scale will map the given imagery rectangle
|
|
983
|
+
* to the geometry * rectangle.
|
|
984
|
+
*
|
|
985
|
+
* @param {Imagery} imagery The imagery
|
|
986
|
+
* @param {Rectangle} nonNativeBoundingRectangle The bounding
|
|
987
|
+
* rectangle of the geometry
|
|
988
|
+
* @param {Rectangle} nonNativeImageryRectangle The bounding
|
|
989
|
+
* rectangle of the imagery
|
|
990
|
+
* @returns {Cartesian4} The translation and scale
|
|
991
|
+
* @private
|
|
992
|
+
*/
|
|
993
|
+
static _computeTextureTranslationAndScaleFromNative(
|
|
994
|
+
nativeBoundingRectangle,
|
|
995
|
+
nativeImageryRectangle,
|
|
996
|
+
) {
|
|
997
|
+
//>>includeStart('debug', pragmas.debug);
|
|
998
|
+
Check.defined("nativeBoundingRectangle", nativeBoundingRectangle);
|
|
999
|
+
Check.defined("nativeImageryRectangle", nativeImageryRectangle);
|
|
1000
|
+
//>>includeEnd('debug');
|
|
1001
|
+
|
|
1002
|
+
const invImageryWidth = 1.0 / nativeImageryRectangle.width;
|
|
1003
|
+
const invImageryHeight = 1.0 / nativeImageryRectangle.height;
|
|
1004
|
+
const deltaWest =
|
|
1005
|
+
nativeBoundingRectangle.west - nativeImageryRectangle.west;
|
|
1006
|
+
const deltaSouth =
|
|
1007
|
+
nativeBoundingRectangle.south - nativeImageryRectangle.south;
|
|
1008
|
+
const offsetX = deltaWest * invImageryWidth;
|
|
1009
|
+
const offsetY = deltaSouth * invImageryHeight;
|
|
1010
|
+
const scaleX = nativeBoundingRectangle.width * invImageryWidth;
|
|
1011
|
+
const scaleY = nativeBoundingRectangle.height * invImageryHeight;
|
|
1012
|
+
return new Cartesian4(offsetX, offsetY, scaleX, scaleY);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Computes the index mapping from the given source to the given target.
|
|
1017
|
+
*
|
|
1018
|
+
* The result will be an array that has the same length as the source,
|
|
1019
|
+
* and contains the indices that the source elements have in the
|
|
1020
|
+
* target array.
|
|
1021
|
+
*
|
|
1022
|
+
* @param {object[]} source The source array
|
|
1023
|
+
* @param {object[]} target The target array
|
|
1024
|
+
* @returns {number[]} The result
|
|
1025
|
+
*/
|
|
1026
|
+
static _computeIndexMapping(source, target) {
|
|
1027
|
+
//>>includeStart('debug', pragmas.debug);
|
|
1028
|
+
Check.defined("source", source);
|
|
1029
|
+
Check.defined("target", target);
|
|
1030
|
+
//>>includeEnd('debug');
|
|
1031
|
+
|
|
1032
|
+
const result = [];
|
|
1033
|
+
const length = source.length;
|
|
1034
|
+
for (let i = 0; i < length; i++) {
|
|
1035
|
+
const element = source[i];
|
|
1036
|
+
const index = target.indexOf(element);
|
|
1037
|
+
result.push(index);
|
|
1038
|
+
}
|
|
1039
|
+
return result;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// Static properties (direct initialization disallowed by eslint)
|
|
1044
|
+
//ImageryPipelineStage.name = "ImageryPipelineStage"; // Helps with debugging, if you know where to look
|
|
1045
|
+
|
|
1046
|
+
export default ImageryPipelineStage;
|