@cesium/engine 2.2.0 → 2.3.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/{AttributeCompression-8a5a065e.js → AttributeCompression-f9f6c717.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-379015ef.js → AxisAlignedBoundingBox-31fadcf0.js} +1 -1
- package/Build/Workers/{BoundingRectangle-57f2b24f.js → BoundingRectangle-995f0079.js} +1 -1
- package/Build/Workers/{BoxGeometry-ecabfc78.js → BoxGeometry-7eb1af60.js} +1 -1
- package/Build/Workers/{Color-14d1a36d.js → Color-2dc49658.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-048c3c14.js → CoplanarPolygonGeometryLibrary-d7d972d6.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-520c8619.js → CorridorGeometryLibrary-1f5ef7b3.js} +1 -1
- package/Build/Workers/{CylinderGeometry-119068b8.js → CylinderGeometry-23c67a6c.js} +1 -1
- package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
- package/Build/Workers/{EllipseGeometry-2dfc3523.js → EllipseGeometry-37014da4.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-0a1e0170.js → EllipseGeometryLibrary-92ab6b1e.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-c5251669.js → EllipseOutlineGeometry-12b6fef5.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-d10a5221.js → EllipsoidGeometry-508da15c.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-7039a0ae.js → EllipsoidOutlineGeometry-40d97455.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-857186be.js → EllipsoidTangentPlane-46d4d9c2.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
- package/Build/Workers/{FrustumGeometry-400fa1b7.js → FrustumGeometry-38605e69.js} +31 -3
- package/Build/Workers/{GeometryAttribute-7a2de5c6.js → GeometryAttribute-a466e9c7.js} +1 -1
- package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
- package/Build/Workers/{GeometryPipeline-916636fa.js → GeometryPipeline-dcf79306.js} +1 -1
- package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
- package/Build/Workers/{IntersectionTests-b4d02d4d.js → IntersectionTests-88c49b2e.js} +1 -1
- package/Build/Workers/{Math-dad82b4d.js → Math-0a2ac845.js} +12 -2
- package/Build/Workers/{Matrix2-1e403d0e.js → Matrix2-e1298525.js} +1 -1
- package/Build/Workers/{Matrix3-fa806b97.js → Matrix3-41c58dde.js} +1 -1
- package/Build/Workers/{OrientedBoundingBox-96fe1752.js → OrientedBoundingBox-2dd47921.js} +1 -1
- package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-931f1ec6.js → PolygonGeometryLibrary-59126025.js} +1 -1
- package/Build/Workers/PolygonPipeline-1fe328c0.js +1344 -0
- package/Build/Workers/{PolylinePipeline-6d5c63e5.js → PolylinePipeline-896735cc.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-f068c1fb.js → PolylineVolumeGeometryLibrary-9c0639f7.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-879f996a.js → PrimitivePipeline-fc1a47ff.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-2d6f36f3.js → RectangleGeometryLibrary-a23c9ebe.js} +1 -1
- package/Build/Workers/{TerrainEncoding-82882059.js → TerrainEncoding-51b8b33b.js} +1 -1
- package/Build/Workers/Transforms-bc45e707.js +14699 -0
- package/Build/Workers/{WallGeometryLibrary-db7a64fb.js → WallGeometryLibrary-007e9883.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-76a3fcc0.js → WebMercatorProjection-13ed1a6e.js} +1 -1
- package/Build/Workers/{arrayRemoveDuplicates-fac118a8.js → arrayRemoveDuplicates-d2061e85.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
- package/Build/Workers/combineGeometry.js +1 -1
- package/Build/Workers/createBoxGeometry.js +1 -1
- package/Build/Workers/createBoxOutlineGeometry.js +1 -1
- package/Build/Workers/createCircleGeometry.js +1 -1
- package/Build/Workers/createCircleOutlineGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createCorridorGeometry.js +1 -1
- package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
- package/Build/Workers/createCylinderGeometry.js +1 -1
- package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipseGeometry.js +1 -1
- package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipsoidGeometry.js +1 -1
- package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
- package/Build/Workers/createFrustumGeometry.js +1 -1
- package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
- package/Build/Workers/createGeometry.js +1 -1
- package/Build/Workers/createGroundPolylineGeometry.js +1 -1
- package/Build/Workers/createPlaneGeometry.js +1 -1
- package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
- package/Build/Workers/createPolygonGeometry.js +1 -1
- package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createPolylineGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
- package/Build/Workers/createRectangleGeometry.js +1 -1
- package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
- package/Build/Workers/createSimplePolylineGeometry.js +1 -1
- package/Build/Workers/createSphereGeometry.js +1 -1
- package/Build/Workers/createSphereOutlineGeometry.js +1 -1
- package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
- package/Build/Workers/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePoints.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVectorTilePolylines.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +5 -8
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeDraco.js +1 -1
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +1 -1
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/Source/Core/BingMapsGeocoderService.js +19 -1
- package/Source/Core/CartographicGeocoderService.js +15 -0
- package/Source/Core/Credit.js +1 -1
- package/Source/Core/FrustumGeometry.js +3 -2
- package/Source/Core/GeocoderService.js +32 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonGeocoderService.js +17 -2
- package/Source/Core/OpenCageGeocoderService.js +18 -1
- package/Source/Core/OrthographicFrustum.js +13 -0
- package/Source/Core/PeliasGeocoderService.js +14 -1
- package/Source/Core/PerspectiveFrustum.js +14 -0
- package/Source/Core/Request.js +3 -2
- package/Source/Core/RequestScheduler.js +9 -4
- package/Source/Core/Resource.js +228 -234
- package/Source/DataSources/DataSourceDisplay.js +2 -2
- package/Source/DataSources/EntityCluster.js +126 -128
- package/Source/DataSources/ModelVisualizer.js +5 -3
- package/Source/Renderer/UniformState.js +3 -2
- package/Source/Renderer/demodernizeShader.js +5 -5
- package/Source/Scene/ArcGisBaseMapType.js +12 -0
- package/Source/Scene/ArcGisMapServerImageryProvider.js +162 -20
- package/Source/Scene/ArcGisMapService.js +83 -0
- package/Source/Scene/Camera.js +8 -7
- package/Source/Scene/Cesium3DTile.js +4 -3
- package/Source/Scene/Cesium3DTileset.js +4 -4
- package/Source/Scene/CreditDisplay.js +112 -16
- package/Source/Scene/GlobeSurfaceTileProvider.js +4 -4
- package/Source/Scene/GltfJsonLoader.js +12 -0
- package/Source/Scene/GltfLoader.js +6 -37
- package/Source/Scene/IonImageryProvider.js +11 -11
- package/Source/Scene/Model/MaterialPipelineStage.js +12 -12
- package/Source/Scene/Model/Model.js +85 -44
- package/Source/Scene/Model/UniformType.js +1 -1
- package/Source/Scene/Picking.js +3 -2
- package/Source/Scene/QuadtreePrimitive.js +3 -2
- package/Source/Scene/SceneTransforms.js +3 -2
- package/Source/Scene/ScreenSpaceCameraController.js +1 -1
- package/Source/Scene/Vector3DTilePoints.js +25 -13
- package/Source/Shaders/AtmosphereCommon.glsl +51 -8
- package/Source/Shaders/AtmosphereCommon.js +51 -8
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +1 -1
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +1 -1
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +3 -3
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +3 -3
- package/Source/Widget/CesiumWidget.js +12 -0
- package/index.d.ts +207 -16
- package/index.js +286 -284
- package/package.json +4 -4
- package/Build/Workers/PolygonPipeline-32fc92cc.js +0 -1345
- package/Build/Workers/Transforms-9052372a.js +0 -14715
|
@@ -2509,19 +2509,19 @@ function addCreditsToCreditDisplay(model, frameState) {
|
|
|
2509
2509
|
// Add all credits to the credit display.
|
|
2510
2510
|
const credit = model._credit;
|
|
2511
2511
|
if (defined(credit)) {
|
|
2512
|
-
creditDisplay.
|
|
2512
|
+
creditDisplay.addCreditToNextFrame(credit);
|
|
2513
2513
|
}
|
|
2514
2514
|
|
|
2515
2515
|
const resourceCredits = model._resourceCredits;
|
|
2516
2516
|
const resourceCreditsLength = resourceCredits.length;
|
|
2517
2517
|
for (let c = 0; c < resourceCreditsLength; c++) {
|
|
2518
|
-
creditDisplay.
|
|
2518
|
+
creditDisplay.addCreditToNextFrame(resourceCredits[c]);
|
|
2519
2519
|
}
|
|
2520
2520
|
|
|
2521
2521
|
const gltfCredits = model._gltfCredits;
|
|
2522
2522
|
const gltfCreditsLength = gltfCredits.length;
|
|
2523
2523
|
for (let c = 0; c < gltfCreditsLength; c++) {
|
|
2524
|
-
creditDisplay.
|
|
2524
|
+
creditDisplay.addCreditToNextFrame(gltfCredits[c]);
|
|
2525
2525
|
}
|
|
2526
2526
|
}
|
|
2527
2527
|
|
|
@@ -2841,26 +2841,26 @@ Model.fromGltf = function (options) {
|
|
|
2841
2841
|
* <p>
|
|
2842
2842
|
* The model can be a traditional glTF asset with a .gltf extension or a Binary glTF using the .glb extension.
|
|
2843
2843
|
*
|
|
2844
|
-
* @param {
|
|
2845
|
-
* @param {
|
|
2846
|
-
* @param {
|
|
2847
|
-
* @param {
|
|
2844
|
+
* @param {object} options Object with the following properties:
|
|
2845
|
+
* @param {string|Resource} options.url The url to the .gltf or .glb file.
|
|
2846
|
+
* @param {string|Resource} [options.basePath=''] The base path that paths in the glTF JSON are relative to.
|
|
2847
|
+
* @param {boolean} [options.show=true] Whether or not to render the model.
|
|
2848
2848
|
* @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The 4x4 transformation matrix that transforms the model from model to world coordinates.
|
|
2849
|
-
* @param {
|
|
2850
|
-
* @param {
|
|
2851
|
-
* @param {
|
|
2852
|
-
* @param {
|
|
2853
|
-
* @param {
|
|
2854
|
-
* @param {
|
|
2855
|
-
* @param {
|
|
2856
|
-
* @param {
|
|
2849
|
+
* @param {number} [options.scale=1.0] A uniform scale applied to this model.
|
|
2850
|
+
* @param {number} [options.minimumPixelSize=0.0] The approximate minimum pixel size of the model regardless of zoom.
|
|
2851
|
+
* @param {number} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize.
|
|
2852
|
+
* @param {object} [options.id] A user-defined object to return when the model is picked with {@link Scene#pick}.
|
|
2853
|
+
* @param {boolean} [options.allowPicking=true] When <code>true</code>, each primitive is pickable with {@link Scene#pick}.
|
|
2854
|
+
* @param {boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded.
|
|
2855
|
+
* @param {boolean} [options.asynchronous=true] Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded.
|
|
2856
|
+
* @param {boolean} [options.clampAnimations=true] Determines if the model's animations should hold a pose over frames where no keyframes are specified.
|
|
2857
2857
|
* @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the model casts or receives shadows from light sources.
|
|
2858
|
-
* @param {
|
|
2859
|
-
* @param {
|
|
2860
|
-
* @param {
|
|
2861
|
-
* @param {
|
|
2862
|
-
* @param {
|
|
2863
|
-
* @param {
|
|
2858
|
+
* @param {boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
|
|
2859
|
+
* @param {boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each draw command in the model.
|
|
2860
|
+
* @param {boolean} [options.enableDebugWireframe=false] For debugging only. This must be set to true for debugWireframe to work in WebGL1. This cannot be set after the model has loaded.
|
|
2861
|
+
* @param {boolean} [options.debugWireframe=false] For debugging only. Draws the model in wireframe. Will only work for WebGL1 if enableDebugWireframe is set to true.
|
|
2862
|
+
* @param {boolean} [options.cull=true] Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used.
|
|
2863
|
+
* @param {boolean} [options.opaquePass=Pass.OPAQUE] The pass to use in the {@link DrawCommand} for the opaque portions of the model.
|
|
2864
2864
|
* @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
|
|
2865
2865
|
* @param {Axis} [options.forwardAxis=Axis.Z] The forward-axis of the glTF model.
|
|
2866
2866
|
* @param {CustomShader} [options.customShader] A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a {@link Cesium3DTileStyle} may lead to undefined behavior.
|
|
@@ -2870,28 +2870,31 @@ Model.fromGltf = function (options) {
|
|
|
2870
2870
|
* @param {DistanceDisplayCondition} [options.distanceDisplayCondition] The condition specifying at what distance from the camera that this model will be displayed.
|
|
2871
2871
|
* @param {Color} [options.color] A color that blends with the model's rendered color.
|
|
2872
2872
|
* @param {ColorBlendMode} [options.colorBlendMode=ColorBlendMode.HIGHLIGHT] Defines how the color blends with the model.
|
|
2873
|
-
* @param {
|
|
2873
|
+
* @param {number} [options.colorBlendAmount=0.5] Value used to determine the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
|
|
2874
2874
|
* @param {Color} [options.silhouetteColor=Color.RED] The silhouette color. If more than 256 models have silhouettes enabled, there is a small chance that overlapping models will have minor artifacts.
|
|
2875
|
-
* @param {
|
|
2876
|
-
* @param {
|
|
2877
|
-
* @param {
|
|
2875
|
+
* @param {number} [options.silhouetteSize=0.0] The size of the silhouette in pixels.
|
|
2876
|
+
* @param {boolean} [options.enableShowOutline=true] Whether to enable outlines for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. This can be set false to avoid post-processing geometry at load time. When false, the showOutlines and outlineColor options are ignored.
|
|
2877
|
+
* @param {boolean} [options.showOutline=true] Whether to display the outline for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. When true, outlines are displayed. When false, outlines are not displayed.
|
|
2878
2878
|
* @param {Color} [options.outlineColor=Color.BLACK] The color to use when rendering outlines.
|
|
2879
2879
|
* @param {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the model.
|
|
2880
2880
|
* @param {Cartesian3} [options.lightColor] The light color when shading the model. When <code>undefined</code> the scene's light color is used instead.
|
|
2881
2881
|
* @param {ImageBasedLighting} [options.imageBasedLighting] The properties for managing image-based lighting on this model.
|
|
2882
|
-
* @param {
|
|
2883
|
-
* @param {Credit|
|
|
2884
|
-
* @param {
|
|
2882
|
+
* @param {boolean} [options.backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent.
|
|
2883
|
+
* @param {Credit|string} [options.credit] A credit for the data source, which is displayed on the canvas.
|
|
2884
|
+
* @param {boolean} [options.showCreditsOnScreen=false] Whether to display the credits of this model on screen.
|
|
2885
2885
|
* @param {SplitDirection} [options.splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this model.
|
|
2886
|
-
* @param {
|
|
2887
|
-
* @param {
|
|
2888
|
-
* @param {
|
|
2889
|
-
* @param {
|
|
2886
|
+
* @param {boolean} [options.projectTo2D=false] Whether to accurately project the model's positions in 2D. If this is true, the model will be projected accurately to 2D, but it will use more memory to do so. If this is false, the model will use less memory and will still render in 2D / CV mode, but its positions may be inaccurate. This disables minimumPixelSize and prevents future modification to the model matrix. This also cannot be set after the model has loaded.
|
|
2887
|
+
* @param {string|number} [options.featureIdLabel="featureId_0"] Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
|
|
2888
|
+
* @param {string|number} [options.instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
|
|
2889
|
+
* @param {object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation and lighting.
|
|
2890
2890
|
* @param {ClassificationType} [options.classificationType] Determines whether terrain, 3D Tiles or both will be classified by this model. This cannot be set after the model has loaded.
|
|
2891
|
+
* @param {Model.GltfCallback} [options.gltfCallback] A function that is called with the loaded gltf object once loaded.
|
|
2891
2892
|
*
|
|
2892
2893
|
* @returns {Promise<Model>} A promise that resolves to the created model when it is ready to render.
|
|
2893
2894
|
*
|
|
2894
2895
|
* @exception {RuntimeError} The model failed to load.
|
|
2896
|
+
* @exception {RuntimeError} Unsupported glTF version.
|
|
2897
|
+
* @exception {RuntimeError} Unsupported glTF Extension
|
|
2895
2898
|
*
|
|
2896
2899
|
* @example
|
|
2897
2900
|
* // Load a model and add it to the scene
|
|
@@ -2931,6 +2934,28 @@ Model.fromGltf = function (options) {
|
|
|
2931
2934
|
* } catch (error) {
|
|
2932
2935
|
* console.log(`Failed to load model. ${error}`);
|
|
2933
2936
|
* }
|
|
2937
|
+
*
|
|
2938
|
+
* @example
|
|
2939
|
+
* // Load a model and play the last animation at half speed
|
|
2940
|
+
* let animations;
|
|
2941
|
+
* try {
|
|
2942
|
+
* const model = await Cesium.Model.fromGltfAsync({
|
|
2943
|
+
* url: "../../SampleData/models/CesiumMan/Cesium_Man.glb",
|
|
2944
|
+
* gltfCallback: gltf => {
|
|
2945
|
+
* animations = gltf.animations
|
|
2946
|
+
* }
|
|
2947
|
+
* });
|
|
2948
|
+
* viewer.scene.primitives.add(model);
|
|
2949
|
+
* model.readyEvent.addEventListener(() => {
|
|
2950
|
+
* model.activeAnimations.add({
|
|
2951
|
+
* index: animations.length - 1,
|
|
2952
|
+
* loop: Cesium.ModelAnimationLoop.REPEAT,
|
|
2953
|
+
* multiplier: 0.5,
|
|
2954
|
+
* });
|
|
2955
|
+
* });
|
|
2956
|
+
* } catch (error) {
|
|
2957
|
+
* console.log(`Failed to load model. ${error}`);
|
|
2958
|
+
* }
|
|
2934
2959
|
*/
|
|
2935
2960
|
Model.fromGltfAsync = async function (options) {
|
|
2936
2961
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
@@ -2988,22 +3013,31 @@ Model.fromGltfAsync = async function (options) {
|
|
|
2988
3013
|
// Further resource loading is handled synchronously in loader.process(), and requires
|
|
2989
3014
|
// hooking into model's update() as the frameState is needed
|
|
2990
3015
|
await loader.load();
|
|
2991
|
-
|
|
2992
|
-
const model = new Model(modelOptions);
|
|
2993
|
-
|
|
2994
|
-
const resourceCredits = model._resource.credits;
|
|
2995
|
-
if (defined(resourceCredits)) {
|
|
2996
|
-
const length = resourceCredits.length;
|
|
2997
|
-
for (let i = 0; i < length; i++) {
|
|
2998
|
-
model._resourceCredits.push(resourceCredits[i]);
|
|
2999
|
-
}
|
|
3000
|
-
}
|
|
3001
|
-
|
|
3002
|
-
return model;
|
|
3003
3016
|
} catch (error) {
|
|
3004
3017
|
loader.destroy();
|
|
3005
3018
|
throw ModelUtility.getError("model", resource, error);
|
|
3006
3019
|
}
|
|
3020
|
+
|
|
3021
|
+
const gltfCallback = options.gltfCallback;
|
|
3022
|
+
if (defined(gltfCallback)) {
|
|
3023
|
+
//>>includeStart('debug', pragmas.debug);
|
|
3024
|
+
Check.typeOf.func("options.gltfCallback", gltfCallback);
|
|
3025
|
+
//>>includeEnd('debug');
|
|
3026
|
+
|
|
3027
|
+
gltfCallback(loader.gltfJson);
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
const model = new Model(modelOptions);
|
|
3031
|
+
|
|
3032
|
+
const resourceCredits = model._resource.credits;
|
|
3033
|
+
if (defined(resourceCredits)) {
|
|
3034
|
+
const length = resourceCredits.length;
|
|
3035
|
+
for (let i = 0; i < length; i++) {
|
|
3036
|
+
model._resourceCredits.push(resourceCredits[i]);
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
return model;
|
|
3007
3041
|
};
|
|
3008
3042
|
|
|
3009
3043
|
/*
|
|
@@ -3214,4 +3248,11 @@ function makeModelOptions(loader, modelType, options) {
|
|
|
3214
3248
|
};
|
|
3215
3249
|
}
|
|
3216
3250
|
|
|
3251
|
+
/**
|
|
3252
|
+
* Interface for the function that is called with the loaded gltf object once loaded.
|
|
3253
|
+
* @callback Model.GltfCallback
|
|
3254
|
+
*
|
|
3255
|
+
* @param {object} gltf The gltf object
|
|
3256
|
+
*/
|
|
3257
|
+
|
|
3217
3258
|
export default Model;
|
package/Source/Scene/Picking.js
CHANGED
|
@@ -92,8 +92,9 @@ function getPickOrthographicCullingVolume(
|
|
|
92
92
|
) {
|
|
93
93
|
const camera = scene.camera;
|
|
94
94
|
let frustum = camera.frustum;
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
const offCenterFrustum = frustum.offCenterFrustum;
|
|
96
|
+
if (defined(offCenterFrustum)) {
|
|
97
|
+
frustum = offCenterFrustum;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
let x = (2.0 * (drawingBufferPosition.x - viewport.x)) / viewport.width - 1.0;
|
|
@@ -1275,8 +1275,9 @@ function screenSpaceError(primitive, frameState, tile) {
|
|
|
1275
1275
|
function screenSpaceError2D(primitive, frameState, tile) {
|
|
1276
1276
|
const camera = frameState.camera;
|
|
1277
1277
|
let frustum = camera.frustum;
|
|
1278
|
-
|
|
1279
|
-
|
|
1278
|
+
const offCenterFrustum = frustum.offCenterFrustum;
|
|
1279
|
+
if (defined(offCenterFrustum)) {
|
|
1280
|
+
frustum = offCenterFrustum;
|
|
1280
1281
|
}
|
|
1281
1282
|
|
|
1282
1283
|
const context = frameState.context;
|
|
@@ -432,8 +432,9 @@ SceneTransforms.drawingBufferToWgs84Coordinates = function (
|
|
|
432
432
|
let worldCoords;
|
|
433
433
|
let frustum = scene.camera.frustum;
|
|
434
434
|
if (!defined(frustum.fovy)) {
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
const offCenterFrustum = frustum.offCenterFrustum;
|
|
436
|
+
if (defined(offCenterFrustum)) {
|
|
437
|
+
frustum = offCenterFrustum;
|
|
437
438
|
}
|
|
438
439
|
worldCoords = scratchWorldCoords;
|
|
439
440
|
worldCoords.x =
|
|
@@ -592,7 +592,7 @@ function handleZoom(
|
|
|
592
592
|
if (camera.frustum instanceof OrthographicFrustum) {
|
|
593
593
|
if (Math.abs(distance) > 0.0) {
|
|
594
594
|
camera.zoomIn(distance);
|
|
595
|
-
camera._adjustOrthographicFrustum();
|
|
595
|
+
camera._adjustOrthographicFrustum(true);
|
|
596
596
|
}
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
@@ -394,11 +394,15 @@ Vector3DTilePoints.prototype.applyStyle = function (style, features) {
|
|
|
394
394
|
|
|
395
395
|
if (defined(style.scaleByDistance)) {
|
|
396
396
|
const scaleByDistanceCart4 = style.scaleByDistance.evaluate(feature);
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
397
|
+
if (defined(scaleByDistanceCart4)) {
|
|
398
|
+
scratchScaleByDistance.near = scaleByDistanceCart4.x;
|
|
399
|
+
scratchScaleByDistance.nearValue = scaleByDistanceCart4.y;
|
|
400
|
+
scratchScaleByDistance.far = scaleByDistanceCart4.z;
|
|
401
|
+
scratchScaleByDistance.farValue = scaleByDistanceCart4.w;
|
|
402
|
+
feature.scaleByDistance = scratchScaleByDistance;
|
|
403
|
+
} else {
|
|
404
|
+
feature.scaleByDistance = undefined;
|
|
405
|
+
}
|
|
402
406
|
} else {
|
|
403
407
|
feature.scaleByDistance = undefined;
|
|
404
408
|
}
|
|
@@ -407,11 +411,15 @@ Vector3DTilePoints.prototype.applyStyle = function (style, features) {
|
|
|
407
411
|
const translucencyByDistanceCart4 = style.translucencyByDistance.evaluate(
|
|
408
412
|
feature
|
|
409
413
|
);
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
414
|
+
if (defined(translucencyByDistanceCart4)) {
|
|
415
|
+
scratchTranslucencyByDistance.near = translucencyByDistanceCart4.x;
|
|
416
|
+
scratchTranslucencyByDistance.nearValue = translucencyByDistanceCart4.y;
|
|
417
|
+
scratchTranslucencyByDistance.far = translucencyByDistanceCart4.z;
|
|
418
|
+
scratchTranslucencyByDistance.farValue = translucencyByDistanceCart4.w;
|
|
419
|
+
feature.translucencyByDistance = scratchTranslucencyByDistance;
|
|
420
|
+
} else {
|
|
421
|
+
feature.translucencyByDistance = undefined;
|
|
422
|
+
}
|
|
415
423
|
} else {
|
|
416
424
|
feature.translucencyByDistance = undefined;
|
|
417
425
|
}
|
|
@@ -420,9 +428,13 @@ Vector3DTilePoints.prototype.applyStyle = function (style, features) {
|
|
|
420
428
|
const distanceDisplayConditionCart2 = style.distanceDisplayCondition.evaluate(
|
|
421
429
|
feature
|
|
422
430
|
);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
431
|
+
if (defined(distanceDisplayConditionCart2)) {
|
|
432
|
+
scratchDistanceDisplayCondition.near = distanceDisplayConditionCart2.x;
|
|
433
|
+
scratchDistanceDisplayCondition.far = distanceDisplayConditionCart2.y;
|
|
434
|
+
feature.distanceDisplayCondition = scratchDistanceDisplayCondition;
|
|
435
|
+
} else {
|
|
436
|
+
feature.distanceDisplayCondition = undefined;
|
|
437
|
+
}
|
|
426
438
|
} else {
|
|
427
439
|
feature.distanceDisplayCondition = undefined;
|
|
428
440
|
}
|
|
@@ -8,8 +8,16 @@ uniform vec3 u_atmosphereRayleighCoefficient;
|
|
|
8
8
|
uniform vec3 u_atmosphereMieCoefficient;
|
|
9
9
|
|
|
10
10
|
const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.
|
|
11
|
-
const int
|
|
12
|
-
const int
|
|
11
|
+
const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.
|
|
12
|
+
const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Rational approximation to tanh(x)
|
|
16
|
+
*/
|
|
17
|
+
float approximateTanh(float x) {
|
|
18
|
+
float x2 = x * x;
|
|
19
|
+
return max(-1.0, min(+1.0, x * (27.0 + x2) / (27.0 + 9.0 * x2)));
|
|
20
|
+
}
|
|
13
21
|
|
|
14
22
|
/**
|
|
15
23
|
* This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as
|
|
@@ -50,14 +58,36 @@ void computeScattering(
|
|
|
50
58
|
return;
|
|
51
59
|
}
|
|
52
60
|
|
|
61
|
+
// To deal with smaller values of PRIMARY_STEPS (e.g. 4)
|
|
62
|
+
// we implement a split strategy: sky or horizon.
|
|
63
|
+
// For performance reasons, instead of a if/else branch
|
|
64
|
+
// a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0
|
|
65
|
+
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
|
|
66
|
+
// Value close to 0.0: close to the horizon
|
|
67
|
+
// Value close to 1.0: above in the sky
|
|
68
|
+
float w_stop_gt_lprl = 0.5 * (1.0 + approximateTanh(x));
|
|
69
|
+
|
|
53
70
|
// The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.
|
|
71
|
+
float start_0 = primaryRayAtmosphereIntersect.start;
|
|
54
72
|
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
|
|
55
73
|
// The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.
|
|
56
74
|
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
|
|
57
75
|
|
|
76
|
+
// For the number of ray steps, distinguish inside or outside atmosphere (outer space)
|
|
77
|
+
// (1) from outer space we have to use more ray steps to get a realistic rendering
|
|
78
|
+
// (2) within atmosphere we need fewer steps for faster rendering
|
|
79
|
+
float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters
|
|
80
|
+
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + approximateTanh(x_o_a));
|
|
81
|
+
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.
|
|
82
|
+
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
|
83
|
+
|
|
58
84
|
// Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.
|
|
59
|
-
float rayStepLength = (primaryRayAtmosphereIntersect.stop - primaryRayAtmosphereIntersect.start) / float(PRIMARY_STEPS);
|
|
60
85
|
float rayPositionLength = primaryRayAtmosphereIntersect.start;
|
|
86
|
+
// (1) Outside the atmosphere: constant rayStepLength
|
|
87
|
+
// (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps
|
|
88
|
+
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
|
|
89
|
+
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
|
|
90
|
+
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
|
|
61
91
|
|
|
62
92
|
vec3 rayleighAccumulation = vec3(0.0);
|
|
63
93
|
vec3 mieAccumulation = vec3(0.0);
|
|
@@ -65,10 +95,17 @@ void computeScattering(
|
|
|
65
95
|
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);
|
|
66
96
|
|
|
67
97
|
// Sample positions on the primary ray.
|
|
68
|
-
for (int i = 0; i <
|
|
98
|
+
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {
|
|
99
|
+
|
|
100
|
+
// The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot
|
|
101
|
+
// loop with non-constant condition, so it has to break early instead
|
|
102
|
+
if (i >= PRIMARY_STEPS) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
|
|
69
106
|
// Calculate sample position along viewpoint ray.
|
|
70
107
|
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
|
|
71
|
-
|
|
108
|
+
|
|
72
109
|
// Calculate height of sample position above ellipsoid.
|
|
73
110
|
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
|
|
74
111
|
|
|
@@ -79,14 +116,20 @@ void computeScattering(
|
|
|
79
116
|
// Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.
|
|
80
117
|
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
|
|
81
118
|
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
|
|
82
|
-
|
|
119
|
+
|
|
83
120
|
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
|
|
84
121
|
float lightPositionLength = 0.0;
|
|
85
122
|
|
|
86
123
|
vec2 lightOpticalDepth = vec2(0.0);
|
|
87
124
|
|
|
88
125
|
// Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.
|
|
89
|
-
for (int j = 0; j <
|
|
126
|
+
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {
|
|
127
|
+
|
|
128
|
+
// The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot
|
|
129
|
+
// loop with non-constant condition, so it has to break early instead
|
|
130
|
+
if (j >= LIGHT_STEPS) {
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
90
133
|
|
|
91
134
|
// Calculate sample position along light ray.
|
|
92
135
|
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
|
|
@@ -109,7 +152,7 @@ void computeScattering(
|
|
|
109
152
|
mieAccumulation += sampleDensity.y * attenuation;
|
|
110
153
|
|
|
111
154
|
// Increment distance on primary ray.
|
|
112
|
-
rayPositionLength += rayStepLength;
|
|
155
|
+
rayPositionLength += (rayStepLength += rayStepLengthIncrease);
|
|
113
156
|
}
|
|
114
157
|
|
|
115
158
|
// Compute the scattering amount.
|
|
@@ -9,8 +9,16 @@ uniform vec3 u_atmosphereRayleighCoefficient;\n\
|
|
|
9
9
|
uniform vec3 u_atmosphereMieCoefficient;\n\
|
|
10
10
|
\n\
|
|
11
11
|
const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.\n\
|
|
12
|
-
const int
|
|
13
|
-
const int
|
|
12
|
+
const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.\n\
|
|
13
|
+
const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\
|
|
14
|
+
\n\
|
|
15
|
+
/**\n\
|
|
16
|
+
* Rational approximation to tanh(x)\n\
|
|
17
|
+
*/\n\
|
|
18
|
+
float approximateTanh(float x) {\n\
|
|
19
|
+
float x2 = x * x;\n\
|
|
20
|
+
return max(-1.0, min(+1.0, x * (27.0 + x2) / (27.0 + 9.0 * x2)));\n\
|
|
21
|
+
}\n\
|
|
14
22
|
\n\
|
|
15
23
|
/**\n\
|
|
16
24
|
* This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as\n\
|
|
@@ -51,14 +59,36 @@ void computeScattering(\n\
|
|
|
51
59
|
return;\n\
|
|
52
60
|
}\n\
|
|
53
61
|
\n\
|
|
62
|
+
// To deal with smaller values of PRIMARY_STEPS (e.g. 4)\n\
|
|
63
|
+
// we implement a split strategy: sky or horizon.\n\
|
|
64
|
+
// For performance reasons, instead of a if/else branch\n\
|
|
65
|
+
// a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0\n\
|
|
66
|
+
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);\n\
|
|
67
|
+
// Value close to 0.0: close to the horizon\n\
|
|
68
|
+
// Value close to 1.0: above in the sky\n\
|
|
69
|
+
float w_stop_gt_lprl = 0.5 * (1.0 + approximateTanh(x));\n\
|
|
70
|
+
\n\
|
|
54
71
|
// The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.\n\
|
|
72
|
+
float start_0 = primaryRayAtmosphereIntersect.start;\n\
|
|
55
73
|
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);\n\
|
|
56
74
|
// The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.\n\
|
|
57
75
|
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));\n\
|
|
76
|
+
\n\
|
|
77
|
+
// For the number of ray steps, distinguish inside or outside atmosphere (outer space)\n\
|
|
78
|
+
// (1) from outer space we have to use more ray steps to get a realistic rendering\n\
|
|
79
|
+
// (2) within atmosphere we need fewer steps for faster rendering\n\
|
|
80
|
+
float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters\n\
|
|
81
|
+
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + approximateTanh(x_o_a));\n\
|
|
82
|
+
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.\n\
|
|
83
|
+
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\
|
|
58
84
|
\n\
|
|
59
85
|
// Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.\n\
|
|
60
|
-
float rayStepLength = (primaryRayAtmosphereIntersect.stop - primaryRayAtmosphereIntersect.start) / float(PRIMARY_STEPS);\n\
|
|
61
86
|
float rayPositionLength = primaryRayAtmosphereIntersect.start;\n\
|
|
87
|
+
// (1) Outside the atmosphere: constant rayStepLength\n\
|
|
88
|
+
// (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps\n\
|
|
89
|
+
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;\n\
|
|
90
|
+
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));\n\
|
|
91
|
+
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));\n\
|
|
62
92
|
\n\
|
|
63
93
|
vec3 rayleighAccumulation = vec3(0.0);\n\
|
|
64
94
|
vec3 mieAccumulation = vec3(0.0);\n\
|
|
@@ -66,10 +96,17 @@ void computeScattering(\n\
|
|
|
66
96
|
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);\n\
|
|
67
97
|
\n\
|
|
68
98
|
// Sample positions on the primary ray.\n\
|
|
69
|
-
for (int i = 0; i <
|
|
99
|
+
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {\n\
|
|
100
|
+
\n\
|
|
101
|
+
// The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot\n\
|
|
102
|
+
// loop with non-constant condition, so it has to break early instead\n\
|
|
103
|
+
if (i >= PRIMARY_STEPS) {\n\
|
|
104
|
+
break;\n\
|
|
105
|
+
}\n\
|
|
106
|
+
\n\
|
|
70
107
|
// Calculate sample position along viewpoint ray.\n\
|
|
71
108
|
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);\n\
|
|
72
|
-
|
|
109
|
+
\n\
|
|
73
110
|
// Calculate height of sample position above ellipsoid.\n\
|
|
74
111
|
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;\n\
|
|
75
112
|
\n\
|
|
@@ -80,14 +117,20 @@ void computeScattering(\n\
|
|
|
80
117
|
// Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.\n\
|
|
81
118
|
czm_ray lightRay = czm_ray(samplePosition, lightDirection);\n\
|
|
82
119
|
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);\n\
|
|
83
|
-
|
|
120
|
+
\n\
|
|
84
121
|
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);\n\
|
|
85
122
|
float lightPositionLength = 0.0;\n\
|
|
86
123
|
\n\
|
|
87
124
|
vec2 lightOpticalDepth = vec2(0.0);\n\
|
|
88
125
|
\n\
|
|
89
126
|
// Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.\n\
|
|
90
|
-
for (int j = 0; j <
|
|
127
|
+
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {\n\
|
|
128
|
+
\n\
|
|
129
|
+
// The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot\n\
|
|
130
|
+
// loop with non-constant condition, so it has to break early instead\n\
|
|
131
|
+
if (j >= LIGHT_STEPS) {\n\
|
|
132
|
+
break;\n\
|
|
133
|
+
}\n\
|
|
91
134
|
\n\
|
|
92
135
|
// Calculate sample position along light ray.\n\
|
|
93
136
|
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);\n\
|
|
@@ -110,7 +153,7 @@ void computeScattering(\n\
|
|
|
110
153
|
mieAccumulation += sampleDensity.y * attenuation;\n\
|
|
111
154
|
\n\
|
|
112
155
|
// Increment distance on primary ray.\n\
|
|
113
|
-
rayPositionLength += rayStepLength;\n\
|
|
156
|
+
rayPositionLength += (rayStepLength += rayStepLengthIncrease);\n\
|
|
114
157
|
}\n\
|
|
115
158
|
\n\
|
|
116
159
|
// Compute the scattering amount.\n\
|
|
@@ -58,7 +58,7 @@ void main(void)
|
|
|
58
58
|
float gapAngle = 90.0 * czm_radiansPerDegree;
|
|
59
59
|
|
|
60
60
|
// RandomNoise
|
|
61
|
-
float randomVal = texture(randomTexture, v_textureCoordinates).x;
|
|
61
|
+
float randomVal = texture(randomTexture, v_textureCoordinates / pixelSize / 255.0).x;
|
|
62
62
|
|
|
63
63
|
//Loop for each direction
|
|
64
64
|
for (int i = 0; i < 4; i++)
|
|
@@ -59,7 +59,7 @@ void main(void)\n\
|
|
|
59
59
|
float gapAngle = 90.0 * czm_radiansPerDegree;\n\
|
|
60
60
|
\n\
|
|
61
61
|
// RandomNoise\n\
|
|
62
|
-
float randomVal = texture(randomTexture, v_textureCoordinates).x;\n\
|
|
62
|
+
float randomVal = texture(randomTexture, v_textureCoordinates / pixelSize / 255.0).x;\n\
|
|
63
63
|
\n\
|
|
64
64
|
//Loop for each direction\n\
|
|
65
65
|
for (int i = 0; i < 4; i++)\n\
|
|
@@ -5,7 +5,7 @@ in vec2 v_textureCoordinates;
|
|
|
5
5
|
|
|
6
6
|
void main(void)
|
|
7
7
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
out_FragColor
|
|
8
|
+
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
9
|
+
vec4 ao = texture(ambientOcclusionTexture, v_textureCoordinates);
|
|
10
|
+
out_FragColor = ambientOcclusionOnly ? ao : ao * color;
|
|
11
11
|
}
|
|
@@ -6,8 +6,8 @@ in vec2 v_textureCoordinates;\n\
|
|
|
6
6
|
\n\
|
|
7
7
|
void main(void)\n\
|
|
8
8
|
{\n\
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
out_FragColor
|
|
9
|
+
vec4 color = texture(colorTexture, v_textureCoordinates);\n\
|
|
10
|
+
vec4 ao = texture(ambientOcclusionTexture, v_textureCoordinates);\n\
|
|
11
|
+
out_FragColor = ambientOcclusionOnly ? ao : ao * color;\n\
|
|
12
12
|
}\n\
|
|
13
13
|
";
|
|
@@ -520,6 +520,18 @@ Object.defineProperties(CesiumWidget.prototype, {
|
|
|
520
520
|
},
|
|
521
521
|
},
|
|
522
522
|
|
|
523
|
+
/**
|
|
524
|
+
* Manages the list of credits to display on screen and in the lightbox.
|
|
525
|
+
* @memberof CesiumWidget.prototype
|
|
526
|
+
*
|
|
527
|
+
* @type {CreditDisplay}
|
|
528
|
+
*/
|
|
529
|
+
creditDisplay: {
|
|
530
|
+
get: function () {
|
|
531
|
+
return this._scene.frameState.creditDisplay;
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
|
|
523
535
|
/**
|
|
524
536
|
* Gets the camera.
|
|
525
537
|
* @memberof CesiumWidget.prototype
|