@cesium/engine 10.0.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-AA4GZKOT.js → chunk-2EDC3QGH.js} +1 -1
- package/Build/Workers/{chunk-DKVHRNFY.js → chunk-2MKRG7L7.js} +5 -5
- package/Build/Workers/{chunk-X23FRWHJ.js → chunk-2RZYNSMR.js} +6 -6
- package/Build/Workers/{chunk-TO2PVHKI.js → chunk-4NBRIKB3.js} +2 -2
- package/Build/Workers/{chunk-GRAT5GE7.js → chunk-4TK5YR6Q.js} +5 -5
- package/Build/Workers/{chunk-XD445VDH.js → chunk-54VC7SCM.js} +7 -7
- package/Build/Workers/{chunk-G3YR53LY.js → chunk-5IY5BXCT.js} +13 -13
- package/Build/Workers/{chunk-O3JCMSS3.js → chunk-6FFGOENI.js} +54 -7
- package/Build/Workers/{chunk-7XGC6YB2.js → chunk-6PJIHPQB.js} +13 -13
- package/Build/Workers/{chunk-GR3CDLCP.js → chunk-6ZREIBKS.js} +7 -7
- package/Build/Workers/{chunk-4MSUJ4I7.js → chunk-AI3O7UN2.js} +6 -6
- package/Build/Workers/{chunk-COYFZ5VA.js → chunk-AS7P4BHI.js} +6 -6
- package/Build/Workers/{chunk-JYAHOGGL.js → chunk-AUM45VEG.js} +16 -15
- package/Build/Workers/{chunk-BDFNKFOE.js → chunk-BBO6BGLC.js} +13 -13
- package/Build/Workers/{chunk-AVI4IUWC.js → chunk-BH5ZEN4I.js} +10 -10
- package/Build/Workers/{chunk-4BAE4PWO.js → chunk-BJ3WF5RW.js} +6 -6
- package/Build/Workers/{chunk-Q55ECN3Y.js → chunk-BUOFSNFW.js} +1 -1
- package/Build/Workers/{chunk-QX5XS4LC.js → chunk-BZXF3GNX.js} +2 -2
- package/Build/Workers/{chunk-PYHLO636.js → chunk-DJXXI7UF.js} +5 -5
- package/Build/Workers/{chunk-LCLJJ2MZ.js → chunk-DVAIU7A4.js} +17 -17
- package/Build/Workers/{chunk-SYCPRK3D.js → chunk-FJT3ERV7.js} +9 -9
- package/Build/Workers/{chunk-L6RTJ3RE.js → chunk-GOHDOWU5.js} +14 -14
- package/Build/Workers/{chunk-MSKXMXJI.js → chunk-HA6TZ3XT.js} +4 -4
- package/Build/Workers/{chunk-PCP4YQST.js → chunk-HBZSCVZC.js} +11 -11
- package/Build/Workers/{chunk-5S7OLEPK.js → chunk-HC7RYWPZ.js} +12 -12
- package/Build/Workers/{chunk-VE7BFUIX.js → chunk-HFMJM3SX.js} +1 -1
- package/Build/Workers/{chunk-OOK53QUQ.js → chunk-HFPMX5L2.js} +1 -1
- package/Build/Workers/{chunk-VFBNELXB.js → chunk-HO2NTC7I.js} +6 -6
- package/Build/Workers/{chunk-DOXCPOG4.js → chunk-HZPMWR4H.js} +7 -7
- package/Build/Workers/{chunk-I2RC4XVN.js → chunk-IBG5FVXC.js} +4 -4
- package/Build/Workers/{chunk-LEABCTLP.js → chunk-IXLNNST6.js} +4 -4
- package/Build/Workers/{chunk-4YSNMHZ4.js → chunk-JYUCC5NV.js} +6 -6
- package/Build/Workers/{chunk-BCL4PHHT.js → chunk-KFW4UNQH.js} +10 -10
- package/Build/Workers/{chunk-R6B7UCQB.js → chunk-KKAEXHDY.js} +2 -2
- package/Build/Workers/{chunk-BJF5LOWE.js → chunk-L6FARMF6.js} +7 -7
- package/Build/Workers/{chunk-C2CGMAIU.js → chunk-N3BIL6WA.js} +13 -13
- package/Build/Workers/{chunk-STBBMQGG.js → chunk-O5SSW3B3.js} +6 -6
- package/Build/Workers/{chunk-S3PI2KFM.js → chunk-OC4MYPVW.js} +2 -2
- package/Build/Workers/{chunk-MDHQR3ZS.js → chunk-OOA6GXKD.js} +7 -7
- package/Build/Workers/{chunk-AD5HBJ2F.js → chunk-OSCHEWSG.js} +7 -7
- package/Build/Workers/{chunk-NTXTUNEF.js → chunk-QGT2GMOK.js} +4 -4
- package/Build/Workers/{chunk-VO3ACQB2.js → chunk-RFQYEYAL.js} +17 -17
- package/Build/Workers/{chunk-KUN2ZA5X.js → chunk-RJF5ZP76.js} +4 -4
- package/Build/Workers/{chunk-QD4KM3GO.js → chunk-SIZXFNJY.js} +6 -5
- package/Build/Workers/{chunk-FXIHSF7O.js → chunk-SRZJCF7G.js} +9 -9
- package/Build/Workers/{chunk-T77JILCU.js → chunk-T4MB73MC.js} +2 -2
- package/Build/Workers/{chunk-3WUV74WM.js → chunk-TTI2SUWJ.js} +2 -2
- package/Build/Workers/{chunk-QMLTCCYG.js → chunk-VHJ5ESXF.js} +1 -1
- package/Build/Workers/{chunk-2J3JKXCP.js → chunk-VSFFJGTA.js} +9 -5
- package/Build/Workers/{chunk-DGS5QNIO.js → chunk-WQRXRDCZ.js} +11 -11
- package/Build/Workers/{chunk-OORVMGDU.js → chunk-WXDGOYTT.js} +12 -7
- package/Build/Workers/{chunk-RJYML24O.js → chunk-XLCZE6DD.js} +423 -448
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +24 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +28 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +20 -22
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/CompressedTextureBuffer.js +11 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/KTX2Transcoder.js +9 -16
- package/Source/Core/PixelFormat.js +1 -15
- package/Source/Core/Simon1994PlanetaryPositions.js +2 -1
- package/Source/Core/Transforms.js +137 -2
- package/Source/DataSources/BillboardGraphics.js +16 -0
- package/Source/DataSources/BillboardVisualizer.js +7 -0
- package/Source/DataSources/CallbackProperty.js +8 -2
- package/Source/DataSources/CheckerboardMaterialProperty.js +7 -1
- package/Source/DataSources/ColorMaterialProperty.js +7 -1
- package/Source/DataSources/CompositeMaterialProperty.js +5 -4
- package/Source/DataSources/CompositePositionProperty.js +7 -1
- package/Source/DataSources/CompositeProperty.js +5 -5
- package/Source/DataSources/ConstantPositionProperty.js +7 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/GridMaterialProperty.js +7 -1
- package/Source/DataSources/ImageMaterialProperty.js +8 -1
- package/Source/DataSources/MaterialProperty.js +7 -1
- package/Source/DataSources/NodeTransformationProperty.js +7 -1
- package/Source/DataSources/PathVisualizer.js +4 -4
- package/Source/DataSources/PointGraphics.js +17 -0
- package/Source/DataSources/PointVisualizer.js +12 -0
- package/Source/DataSources/PolylineArrowMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineDashMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineGlowMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineOutlineMaterialProperty.js +7 -1
- package/Source/DataSources/PositionProperty.js +5 -8
- package/Source/DataSources/PositionPropertyArray.js +7 -1
- package/Source/DataSources/Property.js +1 -1
- package/Source/DataSources/PropertyArray.js +5 -5
- package/Source/DataSources/PropertyBag.js +5 -4
- package/Source/DataSources/ReferenceProperty.js +7 -1
- package/Source/DataSources/SampledPositionProperty.js +7 -1
- package/Source/DataSources/SampledProperty.js +6 -4
- package/Source/DataSources/ScaledPositionProperty.js +6 -0
- package/Source/DataSources/StripeMaterialProperty.js +7 -1
- package/Source/DataSources/TerrainOffsetProperty.js +9 -0
- package/Source/DataSources/TimeIntervalCollectionPositionProperty.js +7 -1
- package/Source/DataSources/TimeIntervalCollectionProperty.js +5 -5
- package/Source/DataSources/VelocityOrientationProperty.js +6 -1
- package/Source/DataSources/VelocityVectorProperty.js +3 -5
- package/Source/Renderer/AutomaticUniforms.js +3 -18
- package/Source/Renderer/Context.js +15 -0
- package/Source/Renderer/CubeMap.js +326 -348
- package/Source/Renderer/CubeMapFace.js +26 -48
- package/Source/Renderer/PixelDatatype.js +23 -0
- package/Source/Renderer/Sampler.js +7 -13
- package/Source/Renderer/ShaderProgram.js +7 -0
- package/Source/Renderer/Texture.js +396 -332
- package/Source/Renderer/UniformState.js +8 -33
- package/Source/Renderer/demodernizeShader.js +2 -0
- package/Source/Renderer/loadCubeMap.js +3 -8
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +29 -2
- package/Source/Scene/BillboardCollection.js +49 -0
- package/Source/Scene/BingMapsImageryProvider.js +10 -1
- package/Source/Scene/CameraEventAggregator.js +49 -5
- package/Source/Scene/Globe.js +1 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +29 -24
- package/Source/Scene/GlobeSurfaceTileProvider.js +5 -3
- package/Source/Scene/ImageBasedLighting.js +36 -36
- package/Source/Scene/Label.js +2 -2
- package/Source/Scene/Material.js +24 -2
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -15
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/PointPrimitive.js +28 -2
- package/Source/Scene/PointPrimitiveCollection.js +22 -9
- package/Source/Scene/PostProcessStageCollection.js +45 -15
- package/Source/Scene/PostProcessStageLibrary.js +26 -0
- package/Source/Scene/Scene.js +20 -22
- package/Source/Scene/SceneTransforms.js +0 -62
- package/Source/Scene/ScreenSpaceCameraController.js +11 -4
- package/Source/Scene/SkyBox.js +13 -19
- package/Source/Scene/SpecularEnvironmentCubeMap.js +240 -0
- package/Source/Scene/Tonemapper.js +35 -23
- package/Source/Scene/VoxelPrimitive.js +0 -29
- package/Source/Scene/VoxelRenderResources.js +0 -3
- package/Source/Shaders/BillboardCollectionFS.glsl +4 -0
- package/Source/Shaders/BillboardCollectionFS.js +4 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +3 -1
- package/Source/Shaders/BillboardCollectionVS.js +3 -1
- package/Source/Shaders/BrdfLutGeneratorFS.glsl +30 -13
- package/Source/Shaders/BrdfLutGeneratorFS.js +30 -13
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -2
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +42 -41
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +42 -41
- package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.glsl +23 -0
- package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.js +25 -0
- package/Source/Shaders/Builtin/Functions/textureCube.glsl +21 -2
- package/Source/Shaders/Builtin/Functions/textureCube.js +21 -2
- package/Source/Shaders/Builtin/Structs/materialInput.glsl +2 -0
- package/Source/Shaders/Builtin/Structs/materialInput.js +2 -0
- package/Source/Shaders/GlobeFS.glsl +10 -4
- package/Source/Shaders/GlobeFS.js +10 -4
- package/Source/Shaders/Materials/WaterMaskMaterial.glsl +15 -0
- package/Source/Shaders/Materials/WaterMaskMaterial.js +17 -0
- package/Source/Shaders/Model/AtmosphereStageFS.glsl +1 -1
- package/Source/Shaders/Model/AtmosphereStageFS.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +57 -46
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +57 -46
- package/Source/Shaders/Model/LightingStageFS.glsl +8 -7
- package/Source/Shaders/Model/LightingStageFS.js +8 -7
- package/Source/Shaders/Model/MaterialStageFS.glsl +10 -14
- package/Source/Shaders/Model/MaterialStageFS.js +10 -14
- package/Source/Shaders/PointPrimitiveCollectionFS.glsl +4 -0
- package/Source/Shaders/PointPrimitiveCollectionFS.js +4 -0
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +9 -7
- package/Source/Shaders/PointPrimitiveCollectionVS.js +9 -7
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.glsl +4 -0
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.js +4 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.js +4 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js +4 -0
- package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.glsl +25 -0
- package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.js +27 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.js +4 -0
- package/Source/Shaders/SkyAtmosphereFS.glsl +1 -1
- package/Source/Shaders/SkyAtmosphereFS.js +1 -1
- package/Source/Widget/CesiumWidget.js +1 -1
- package/index.d.ts +191 -106
- package/index.js +133 -134
- package/package.json +4 -4
- package/Source/Scene/OctahedralProjectedCubeMap.js +0 -445
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +0 -78
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +0 -80
- package/Source/Shaders/OctahedralProjectionAtlasFS.glsl +0 -89
- package/Source/Shaders/OctahedralProjectionAtlasFS.js +0 -91
- package/Source/Shaders/OctahedralProjectionFS.glsl +0 -14
- package/Source/Shaders/OctahedralProjectionFS.js +0 -16
- package/Source/Shaders/OctahedralProjectionVS.glsl +0 -10
- package/Source/Shaders/OctahedralProjectionVS.js +0 -12
package/Source/Scene/Scene.js
CHANGED
|
@@ -57,7 +57,6 @@ import GlobeTranslucencyState from "./GlobeTranslucencyState.js";
|
|
|
57
57
|
import InvertClassification from "./InvertClassification.js";
|
|
58
58
|
import JobScheduler from "./JobScheduler.js";
|
|
59
59
|
import MapMode2D from "./MapMode2D.js";
|
|
60
|
-
import OctahedralProjectedCubeMap from "./OctahedralProjectedCubeMap.js";
|
|
61
60
|
import PerformanceDisplay from "./PerformanceDisplay.js";
|
|
62
61
|
import PerInstanceColorAppearance from "./PerInstanceColorAppearance.js";
|
|
63
62
|
import Picking from "./Picking.js";
|
|
@@ -69,6 +68,7 @@ import SceneTransforms from "./SceneTransforms.js";
|
|
|
69
68
|
import SceneTransitioner from "./SceneTransitioner.js";
|
|
70
69
|
import ScreenSpaceCameraController from "./ScreenSpaceCameraController.js";
|
|
71
70
|
import ShadowMap from "./ShadowMap.js";
|
|
71
|
+
import SpecularEnvironmentCubeMap from "./SpecularEnvironmentCubeMap.js";
|
|
72
72
|
import StencilConstants from "./StencilConstants.js";
|
|
73
73
|
import SunLight from "./SunLight.js";
|
|
74
74
|
import SunPostProcess from "./SunPostProcess.js";
|
|
@@ -107,7 +107,7 @@ const requestRenderAfterFrame = function (scene) {
|
|
|
107
107
|
* @param {boolean} [options.requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling improves performance of the application, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
|
|
108
108
|
* @param {number} [options.maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
|
|
109
109
|
* @param {number} [options.depthPlaneEllipsoidOffset=0.0] Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation.
|
|
110
|
-
* @param {number} [options.msaaSamples=
|
|
110
|
+
* @param {number} [options.msaaSamples=4] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. Set to 1 to disable MSAA.
|
|
111
111
|
*
|
|
112
112
|
* @see CesiumWidget
|
|
113
113
|
* @see {@link http://www.khronos.org/registry/webgl/specs/latest/#5.2|WebGLContextAttributes}
|
|
@@ -228,7 +228,7 @@ function Scene(options) {
|
|
|
228
228
|
this._minimumDisableDepthTestDistance = 0.0;
|
|
229
229
|
this._debugInspector = new DebugInspector();
|
|
230
230
|
|
|
231
|
-
this._msaaSamples = defaultValue(options.msaaSamples,
|
|
231
|
+
this._msaaSamples = defaultValue(options.msaaSamples, 4);
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
234
|
* Exceptions occurring in <code>render</code> are always caught in order to raise the
|
|
@@ -738,7 +738,7 @@ function Scene(options) {
|
|
|
738
738
|
* @type {string}
|
|
739
739
|
*/
|
|
740
740
|
this.specularEnvironmentMaps = undefined;
|
|
741
|
-
this.
|
|
741
|
+
this._specularEnvironmentCubeMap = undefined;
|
|
742
742
|
|
|
743
743
|
/**
|
|
744
744
|
* The light source for shading. Defaults to a directional light from the Sun.
|
|
@@ -927,7 +927,7 @@ Object.defineProperties(Scene.prototype, {
|
|
|
927
927
|
*/
|
|
928
928
|
specularEnvironmentMapsSupported: {
|
|
929
929
|
get: function () {
|
|
930
|
-
return
|
|
930
|
+
return SpecularEnvironmentCubeMap.isSupported(this._context);
|
|
931
931
|
},
|
|
932
932
|
},
|
|
933
933
|
|
|
@@ -1630,7 +1630,7 @@ Object.defineProperties(Scene.prototype, {
|
|
|
1630
1630
|
* The sample rate of multisample antialiasing (values greater than 1 enable MSAA).
|
|
1631
1631
|
* @memberof Scene.prototype
|
|
1632
1632
|
* @type {number}
|
|
1633
|
-
* @default
|
|
1633
|
+
* @default 4
|
|
1634
1634
|
*/
|
|
1635
1635
|
msaaSamples: {
|
|
1636
1636
|
get: function () {
|
|
@@ -1964,11 +1964,11 @@ Scene.prototype.updateFrameState = function () {
|
|
|
1964
1964
|
frameState.verticalExaggerationRelativeHeight = this.verticalExaggerationRelativeHeight;
|
|
1965
1965
|
|
|
1966
1966
|
if (
|
|
1967
|
-
defined(this.
|
|
1968
|
-
this.
|
|
1967
|
+
defined(this._specularEnvironmentCubeMap) &&
|
|
1968
|
+
this._specularEnvironmentCubeMap.ready
|
|
1969
1969
|
) {
|
|
1970
|
-
frameState.specularEnvironmentMaps = this.
|
|
1971
|
-
frameState.specularEnvironmentMapsMaximumLOD = this.
|
|
1970
|
+
frameState.specularEnvironmentMaps = this._specularEnvironmentCubeMap.texture;
|
|
1971
|
+
frameState.specularEnvironmentMapsMaximumLOD = this._specularEnvironmentCubeMap.maximumMipmapLevel;
|
|
1972
1972
|
} else {
|
|
1973
1973
|
frameState.specularEnvironmentMaps = undefined;
|
|
1974
1974
|
frameState.specularEnvironmentMapsMaximumLOD = undefined;
|
|
@@ -3328,20 +3328,18 @@ Scene.prototype.updateEnvironment = function () {
|
|
|
3328
3328
|
);
|
|
3329
3329
|
|
|
3330
3330
|
const envMaps = this.specularEnvironmentMaps;
|
|
3331
|
-
let
|
|
3332
|
-
if (
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
envMapAtlas.destroy();
|
|
3340
|
-
this._specularEnvironmentMapAtlas = undefined;
|
|
3331
|
+
let specularEnvironmentCubeMap = this._specularEnvironmentCubeMap;
|
|
3332
|
+
if (defined(envMaps) && specularEnvironmentCubeMap?.url !== envMaps) {
|
|
3333
|
+
specularEnvironmentCubeMap =
|
|
3334
|
+
specularEnvironmentCubeMap && specularEnvironmentCubeMap.destroy();
|
|
3335
|
+
this._specularEnvironmentCubeMap = new SpecularEnvironmentCubeMap(envMaps);
|
|
3336
|
+
} else if (!defined(envMaps) && defined(specularEnvironmentCubeMap)) {
|
|
3337
|
+
specularEnvironmentCubeMap.destroy();
|
|
3338
|
+
this._specularEnvironmentCubeMap = undefined;
|
|
3341
3339
|
}
|
|
3342
3340
|
|
|
3343
|
-
if (defined(this.
|
|
3344
|
-
this.
|
|
3341
|
+
if (defined(this._specularEnvironmentCubeMap)) {
|
|
3342
|
+
this._specularEnvironmentCubeMap.update(frameState);
|
|
3345
3343
|
}
|
|
3346
3344
|
};
|
|
3347
3345
|
|
|
@@ -4,7 +4,6 @@ import Cartesian3 from "../Core/Cartesian3.js";
|
|
|
4
4
|
import Cartesian4 from "../Core/Cartesian4.js";
|
|
5
5
|
import Cartographic from "../Core/Cartographic.js";
|
|
6
6
|
import defined from "../Core/defined.js";
|
|
7
|
-
import deprecationWarning from "../Core/deprecationWarning.js";
|
|
8
7
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
9
8
|
import CesiumMath from "../Core/Math.js";
|
|
10
9
|
import Matrix4 from "../Core/Matrix4.js";
|
|
@@ -53,33 +52,6 @@ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) {
|
|
|
53
52
|
);
|
|
54
53
|
};
|
|
55
54
|
|
|
56
|
-
/**
|
|
57
|
-
* Transforms a position in WGS84 coordinates to window coordinates. This is commonly used to place an
|
|
58
|
-
* HTML element at the same screen position as an object in the scene.
|
|
59
|
-
*
|
|
60
|
-
* @param {Scene} scene The scene.
|
|
61
|
-
* @param {Cartesian3} position The position in WGS84 (world) coordinates.
|
|
62
|
-
* @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates.
|
|
63
|
-
* @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* // Output the window position of longitude/latitude (0, 0) every time the mouse moves.
|
|
67
|
-
* const scene = widget.scene;
|
|
68
|
-
* const ellipsoid = scene.ellipsoid;
|
|
69
|
-
* const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
|
|
70
|
-
* const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
|
|
71
|
-
* handler.setInputAction(function(movement) {
|
|
72
|
-
* console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
|
|
73
|
-
* }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
74
|
-
*/
|
|
75
|
-
SceneTransforms.wgs84ToWindowCoordinates = function (scene, position, result) {
|
|
76
|
-
deprecationWarning(
|
|
77
|
-
"SceneTransforms.wgs84ToWindowCoordinates",
|
|
78
|
-
"SceneTransforms.wgs84ToWindowCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToWindowCoordinates instead."
|
|
79
|
-
);
|
|
80
|
-
return SceneTransforms.worldToWindowCoordinates(scene, position, result);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
55
|
const scratchCartesian4 = new Cartesian4();
|
|
84
56
|
const scratchEyeOffset = new Cartesian3();
|
|
85
57
|
|
|
@@ -320,40 +292,6 @@ SceneTransforms.worldToDrawingBufferCoordinates = function (
|
|
|
320
292
|
return SceneTransforms.transformWindowToDrawingBuffer(scene, result, result);
|
|
321
293
|
};
|
|
322
294
|
|
|
323
|
-
/**
|
|
324
|
-
* Transforms a position in world coordinates to drawing buffer coordinates. This may produce different
|
|
325
|
-
* results from SceneTransforms.wgs84ToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays.
|
|
326
|
-
*
|
|
327
|
-
* @param {Scene} scene The scene.
|
|
328
|
-
* @param {Cartesian3} position The position in world (WGS84 or alternative ellipsoid) coordinates.
|
|
329
|
-
* @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates.
|
|
330
|
-
* @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* // Output the window position of longitude/latitude (0, 0) every time the mouse moves.
|
|
334
|
-
* const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
|
|
335
|
-
* const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
|
|
336
|
-
* handler.setInputAction(function(movement) {
|
|
337
|
-
* console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
|
|
338
|
-
* }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
339
|
-
*/
|
|
340
|
-
SceneTransforms.wgs84ToDrawingBufferCoordinates = function (
|
|
341
|
-
scene,
|
|
342
|
-
position,
|
|
343
|
-
result
|
|
344
|
-
) {
|
|
345
|
-
deprecationWarning(
|
|
346
|
-
"SceneTransforms.wgs84ToDrawingBufferCoordinates",
|
|
347
|
-
"SceneTransforms.wgs84ToDrawingBufferCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToDrawingBufferCoordinates instead."
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
return SceneTransforms.worldToDrawingBufferCoordinates(
|
|
351
|
-
scene,
|
|
352
|
-
position,
|
|
353
|
-
result
|
|
354
|
-
);
|
|
355
|
-
};
|
|
356
|
-
|
|
357
295
|
const projectedPosition = new Cartesian3();
|
|
358
296
|
const positionInCartographic = new Cartographic();
|
|
359
297
|
|
|
@@ -137,6 +137,14 @@ function ScreenSpaceCameraController(scene) {
|
|
|
137
137
|
* @default {@link Number.POSITIVE_INFINITY}
|
|
138
138
|
*/
|
|
139
139
|
this.maximumZoomDistance = Number.POSITIVE_INFINITY;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* A multiplier for the speed at which the camera will zoom.
|
|
143
|
+
* @type {Number}
|
|
144
|
+
* @default 5.0
|
|
145
|
+
*/
|
|
146
|
+
this.zoomFactor = 5.0;
|
|
147
|
+
|
|
140
148
|
/**
|
|
141
149
|
* The input that allows the user to pan around the map. This only applies in 2D and Columbus view modes.
|
|
142
150
|
* <p>
|
|
@@ -324,7 +332,6 @@ function ScreenSpaceCameraController(scene) {
|
|
|
324
332
|
);
|
|
325
333
|
|
|
326
334
|
// Constants, Make any of these public?
|
|
327
|
-
this._zoomFactor = 5.0;
|
|
328
335
|
this._rotateFactor = undefined;
|
|
329
336
|
this._rotateRateRangeAdjustment = undefined;
|
|
330
337
|
this._maximumRotateRate = 1.77;
|
|
@@ -1005,7 +1012,7 @@ function zoom2D(controller, startPosition, movement) {
|
|
|
1005
1012
|
controller,
|
|
1006
1013
|
startPosition,
|
|
1007
1014
|
movement,
|
|
1008
|
-
controller.
|
|
1015
|
+
controller.zoomFactor,
|
|
1009
1016
|
camera.getMagnitude()
|
|
1010
1017
|
);
|
|
1011
1018
|
}
|
|
@@ -1763,7 +1770,7 @@ function zoomCV(controller, startPosition, movement) {
|
|
|
1763
1770
|
controller,
|
|
1764
1771
|
startPosition,
|
|
1765
1772
|
movement,
|
|
1766
|
-
controller.
|
|
1773
|
+
controller.zoomFactor,
|
|
1767
1774
|
distance
|
|
1768
1775
|
);
|
|
1769
1776
|
}
|
|
@@ -2363,7 +2370,7 @@ function zoom3D(controller, startPosition, movement) {
|
|
|
2363
2370
|
controller,
|
|
2364
2371
|
startPosition,
|
|
2365
2372
|
movement,
|
|
2366
|
-
controller.
|
|
2373
|
+
controller.zoomFactor,
|
|
2367
2374
|
distance,
|
|
2368
2375
|
Cartesian3.dot(unitPosition, camera.direction)
|
|
2369
2376
|
);
|
package/Source/Scene/SkyBox.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import buildModuleUrl from "../Core/buildModuleUrl.js";
|
|
2
2
|
import BoxGeometry from "../Core/BoxGeometry.js";
|
|
3
3
|
import Cartesian3 from "../Core/Cartesian3.js";
|
|
4
|
+
import Check from "../Core/Check.js";
|
|
4
5
|
import defaultValue from "../Core/defaultValue.js";
|
|
5
6
|
import defined from "../Core/defined.js";
|
|
6
7
|
import destroyObject from "../Core/destroyObject.js";
|
|
@@ -95,49 +96,42 @@ function SkyBox(options) {
|
|
|
95
96
|
*/
|
|
96
97
|
SkyBox.prototype.update = function (frameState, useHdr) {
|
|
97
98
|
const that = this;
|
|
99
|
+
const { mode, passes, context } = frameState;
|
|
98
100
|
|
|
99
101
|
if (!this.show) {
|
|
100
102
|
return undefined;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
if (
|
|
104
|
-
frameState.mode !== SceneMode.SCENE3D &&
|
|
105
|
-
frameState.mode !== SceneMode.MORPHING
|
|
106
|
-
) {
|
|
105
|
+
if (mode !== SceneMode.SCENE3D && mode !== SceneMode.MORPHING) {
|
|
107
106
|
return undefined;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
// The sky box is only rendered during the render pass; it is not pickable, it doesn't cast shadows, etc.
|
|
111
|
-
if (!
|
|
110
|
+
if (!passes.render) {
|
|
112
111
|
return undefined;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
const context = frameState.context;
|
|
116
|
-
|
|
117
114
|
if (this._sources !== this.sources) {
|
|
118
115
|
this._sources = this.sources;
|
|
119
116
|
const sources = this.sources;
|
|
120
117
|
|
|
121
118
|
//>>includeStart('debug', pragmas.debug);
|
|
119
|
+
Check.defined("this.sources", sources);
|
|
122
120
|
if (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
!defined(sources.negativeY) ||
|
|
127
|
-
!defined(sources.positiveZ) ||
|
|
128
|
-
!defined(sources.negativeZ)
|
|
121
|
+
Object.values(CubeMap.FaceName).some(
|
|
122
|
+
(faceName) => !defined(sources[faceName])
|
|
123
|
+
)
|
|
129
124
|
) {
|
|
130
125
|
throw new DeveloperError(
|
|
131
|
-
"this.sources
|
|
126
|
+
"this.sources must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
|
|
132
127
|
);
|
|
133
128
|
}
|
|
134
129
|
|
|
130
|
+
const sourceType = typeof sources.positiveX;
|
|
135
131
|
if (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
typeof sources.positiveX !== typeof sources.positiveZ ||
|
|
140
|
-
typeof sources.positiveX !== typeof sources.negativeZ
|
|
132
|
+
Object.values(CubeMap.FaceName).some(
|
|
133
|
+
(faceName) => typeof sources[faceName] !== sourceType
|
|
134
|
+
)
|
|
141
135
|
) {
|
|
142
136
|
throw new DeveloperError(
|
|
143
137
|
"this.sources properties must all be the same type."
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import defined from "../Core/defined.js";
|
|
2
|
+
import destroyObject from "../Core/destroyObject.js";
|
|
3
|
+
import Event from "../Core/Event.js";
|
|
4
|
+
import loadKTX2 from "../Core/loadKTX2.js";
|
|
5
|
+
import PixelFormat from "../Core/PixelFormat.js";
|
|
6
|
+
import CubeMap from "../Renderer/CubeMap.js";
|
|
7
|
+
import PixelDatatype from "../Renderer/PixelDatatype.js";
|
|
8
|
+
import Sampler from "../Renderer/Sampler.js";
|
|
9
|
+
import TextureMinificationFilter from "../Renderer/TextureMinificationFilter.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Manages a cube map for use as a specular environment map.
|
|
13
|
+
*
|
|
14
|
+
* @alias SpecularEnvironmentCubeMap
|
|
15
|
+
* @constructor
|
|
16
|
+
*
|
|
17
|
+
* @param {string} url The url to the KTX2 file containing the specular environment map and convoluted mipmaps.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
function SpecularEnvironmentCubeMap(url) {
|
|
21
|
+
this._url = url;
|
|
22
|
+
|
|
23
|
+
this._cubeMapBuffers = undefined;
|
|
24
|
+
this._texture = undefined;
|
|
25
|
+
|
|
26
|
+
this._maximumMipmapLevel = undefined;
|
|
27
|
+
|
|
28
|
+
this._loading = false;
|
|
29
|
+
this._ready = false;
|
|
30
|
+
|
|
31
|
+
this._errorEvent = new Event();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Object.defineProperties(SpecularEnvironmentCubeMap.prototype, {
|
|
35
|
+
/**
|
|
36
|
+
* The url to the KTX2 file containing the specular environment map and convoluted mipmaps.
|
|
37
|
+
* @memberof SpecularEnvironmentCubeMap.prototype
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @readonly
|
|
40
|
+
*/
|
|
41
|
+
url: {
|
|
42
|
+
get: function () {
|
|
43
|
+
return this._url;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Gets an event that is raised when encountering an asynchronous error. By subscribing
|
|
48
|
+
* to the event, you will be notified of the error and can potentially recover from it.
|
|
49
|
+
* @memberof SpecularEnvironmentCubeMap.prototype
|
|
50
|
+
* @type {Event}
|
|
51
|
+
* @readonly
|
|
52
|
+
*/
|
|
53
|
+
errorEvent: {
|
|
54
|
+
get: function () {
|
|
55
|
+
return this._errorEvent;
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* A texture containing all the packed convolutions.
|
|
60
|
+
* @memberof SpecularEnvironmentCubeMap.prototype
|
|
61
|
+
* @type {Texture}
|
|
62
|
+
* @readonly
|
|
63
|
+
*/
|
|
64
|
+
texture: {
|
|
65
|
+
get: function () {
|
|
66
|
+
return this._texture;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* The maximum number of mip levels with valid environment map data.
|
|
71
|
+
* This may differ from the number of mips in the WebGL cubemap.
|
|
72
|
+
* The data loaded at <code>maximumMipmapLevel</code> is suitable for
|
|
73
|
+
* PBR rendering of a material with maximum roughness (1.0).
|
|
74
|
+
* @memberOf SpecularEnvironmentCubeMap.prototype
|
|
75
|
+
* @type {number}
|
|
76
|
+
* @readonly
|
|
77
|
+
*/
|
|
78
|
+
maximumMipmapLevel: {
|
|
79
|
+
get: function () {
|
|
80
|
+
return this._maximumMipmapLevel;
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Determines if the cube map is complete and ready to use.
|
|
85
|
+
* @memberof SpecularEnvironmentCubeMap.prototype
|
|
86
|
+
* @type {boolean}
|
|
87
|
+
* @readonly
|
|
88
|
+
*/
|
|
89
|
+
ready: {
|
|
90
|
+
get: function () {
|
|
91
|
+
return this._ready;
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
SpecularEnvironmentCubeMap.isSupported = function (context) {
|
|
97
|
+
const supportsFloatBuffersAndTextures =
|
|
98
|
+
(context.colorBufferHalfFloat && context.halfFloatingPointTexture) ||
|
|
99
|
+
(context.floatingPointTexture && context.colorBufferFloat);
|
|
100
|
+
return supportsFloatBuffersAndTextures && context.supportsTextureLod;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
function cleanupResources(map) {
|
|
104
|
+
map._cubeMapBuffers = undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Loads the environment map image and constructs the cube map for specular radiance calculations.
|
|
109
|
+
* <p>
|
|
110
|
+
* Once the image is loaded, the next call cleans up unused resources. Every call after that is a no-op.
|
|
111
|
+
* </p>
|
|
112
|
+
* @param {FrameState} frameState The frame state.
|
|
113
|
+
*
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
SpecularEnvironmentCubeMap.prototype.update = function (frameState) {
|
|
117
|
+
const { context } = frameState;
|
|
118
|
+
|
|
119
|
+
if (!SpecularEnvironmentCubeMap.isSupported(context)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (defined(this._texture)) {
|
|
124
|
+
cleanupResources(this);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (!defined(this._texture) && !this._loading) {
|
|
129
|
+
const cachedTexture = context.textureCache.getTexture(this._url);
|
|
130
|
+
if (defined(cachedTexture)) {
|
|
131
|
+
cleanupResources(this);
|
|
132
|
+
this._texture = cachedTexture;
|
|
133
|
+
this._maximumMipmapLevel = this._texture.maximumMipmapLevel;
|
|
134
|
+
this._ready = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const cubeMapBuffers = this._cubeMapBuffers;
|
|
139
|
+
if (!defined(cubeMapBuffers) && !this._loading) {
|
|
140
|
+
const that = this;
|
|
141
|
+
loadKTX2(this._url)
|
|
142
|
+
.then(function (buffers) {
|
|
143
|
+
that._cubeMapBuffers = buffers;
|
|
144
|
+
that._loading = false;
|
|
145
|
+
})
|
|
146
|
+
.catch(function (error) {
|
|
147
|
+
if (that.isDestroyed()) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
that._errorEvent.raiseEvent(error);
|
|
151
|
+
});
|
|
152
|
+
this._loading = true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (!defined(this._cubeMapBuffers)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Datatype is defined if it is a normalized type (i.e. ..._UNORM, ..._SFLOAT)
|
|
160
|
+
let { pixelDatatype } = cubeMapBuffers[0].positiveX;
|
|
161
|
+
if (!defined(pixelDatatype)) {
|
|
162
|
+
pixelDatatype = context.halfFloatingPointTexture
|
|
163
|
+
? PixelDatatype.HALF_FLOAT
|
|
164
|
+
: PixelDatatype.FLOAT;
|
|
165
|
+
}
|
|
166
|
+
const pixelFormat = PixelFormat.RGBA;
|
|
167
|
+
|
|
168
|
+
const mipLevels = cubeMapBuffers.length;
|
|
169
|
+
this._maximumMipmapLevel = mipLevels - 1;
|
|
170
|
+
|
|
171
|
+
const faceSize = cubeMapBuffers[0].positiveX.width;
|
|
172
|
+
const expectedMipLevels = Math.log2(faceSize) + 1;
|
|
173
|
+
if (mipLevels !== expectedMipLevels) {
|
|
174
|
+
// We assume the last supplied mip level was computed as the specular radiance
|
|
175
|
+
// for roughness 1.0.
|
|
176
|
+
// Fill the remaining levels with null values, to avoid WebGL errors.
|
|
177
|
+
const dummyMipLevel = {};
|
|
178
|
+
Object.values(CubeMap.FaceName).forEach((faceName) => {
|
|
179
|
+
dummyMipLevel[faceName] = undefined;
|
|
180
|
+
});
|
|
181
|
+
for (let mipLevel = mipLevels; mipLevel < expectedMipLevels; mipLevel++) {
|
|
182
|
+
cubeMapBuffers.push(dummyMipLevel);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const sampler = new Sampler({
|
|
187
|
+
minificationFilter: TextureMinificationFilter.LINEAR_MIPMAP_LINEAR,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const cubeMap = new CubeMap({
|
|
191
|
+
context: context,
|
|
192
|
+
source: cubeMapBuffers[0],
|
|
193
|
+
flipY: false,
|
|
194
|
+
pixelDatatype: pixelDatatype,
|
|
195
|
+
pixelFormat: pixelFormat,
|
|
196
|
+
sampler: sampler,
|
|
197
|
+
});
|
|
198
|
+
cubeMap.loadMipmaps(cubeMapBuffers.slice(1));
|
|
199
|
+
this._texture = cubeMap;
|
|
200
|
+
|
|
201
|
+
this._texture.maximumMipmapLevel = this._maximumMipmapLevel;
|
|
202
|
+
context.textureCache.addTexture(this._url, this._texture);
|
|
203
|
+
|
|
204
|
+
this._ready = true;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
209
|
+
* <p>
|
|
210
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
211
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
212
|
+
* </p>
|
|
213
|
+
*
|
|
214
|
+
* @returns {boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
215
|
+
*
|
|
216
|
+
* @see SpecularEnvironmentCubeMap#destroy
|
|
217
|
+
*/
|
|
218
|
+
SpecularEnvironmentCubeMap.prototype.isDestroyed = function () {
|
|
219
|
+
return false;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
224
|
+
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
225
|
+
* <p>
|
|
226
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
227
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
228
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
229
|
+
* </p>
|
|
230
|
+
*
|
|
231
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
232
|
+
*
|
|
233
|
+
* @see SpecularEnvironmentCubeMap#isDestroyed
|
|
234
|
+
*/
|
|
235
|
+
SpecularEnvironmentCubeMap.prototype.destroy = function () {
|
|
236
|
+
cleanupResources(this);
|
|
237
|
+
this._texture = this._texture && this._texture.destroy();
|
|
238
|
+
return destroyObject(this);
|
|
239
|
+
};
|
|
240
|
+
export default SpecularEnvironmentCubeMap;
|
|
@@ -1,52 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A tonemapping algorithm when rendering with high dynamic range.
|
|
3
3
|
*
|
|
4
|
-
* @enum {
|
|
5
|
-
* @private
|
|
4
|
+
* @enum {string}
|
|
6
5
|
*/
|
|
7
6
|
const Tonemapper = {
|
|
8
7
|
/**
|
|
9
|
-
* Use the Reinhard tonemapping
|
|
8
|
+
* Use the Reinhard tonemapping.
|
|
10
9
|
*
|
|
11
|
-
* @type {
|
|
10
|
+
* @type {string}
|
|
12
11
|
* @constant
|
|
13
12
|
*/
|
|
14
|
-
REINHARD:
|
|
13
|
+
REINHARD: "REINHARD",
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
|
-
* Use the modified Reinhard tonemapping
|
|
16
|
+
* Use the modified Reinhard tonemapping.
|
|
18
17
|
*
|
|
19
|
-
* @type {
|
|
18
|
+
* @type {string}
|
|
20
19
|
* @constant
|
|
21
20
|
*/
|
|
22
|
-
MODIFIED_REINHARD:
|
|
21
|
+
MODIFIED_REINHARD: "MODIFIED_REINHARD",
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
|
-
* Use the Filmic tonemapping
|
|
24
|
+
* Use the Filmic tonemapping.
|
|
26
25
|
*
|
|
27
|
-
* @type {
|
|
26
|
+
* @type {string}
|
|
28
27
|
* @constant
|
|
29
28
|
*/
|
|
30
|
-
FILMIC:
|
|
29
|
+
FILMIC: "FILMIC",
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
|
-
* Use the ACES tonemapping
|
|
32
|
+
* Use the ACES tonemapping.
|
|
34
33
|
*
|
|
35
|
-
* @type {
|
|
34
|
+
* @type {string}
|
|
36
35
|
* @constant
|
|
37
36
|
*/
|
|
38
|
-
ACES:
|
|
37
|
+
ACES: "ACES",
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
|
-
* @
|
|
40
|
+
* Use the PBR Neutral tonemapping {@link https://github.com/KhronosGroup/ToneMapping/tree/main/PBR_Neutral|from Khronos}.
|
|
41
|
+
*
|
|
42
|
+
* @type {string}
|
|
43
|
+
* @constant
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
tonemapper === Tonemapper.REINHARD ||
|
|
46
|
-
tonemapper === Tonemapper.MODIFIED_REINHARD ||
|
|
47
|
-
tonemapper === Tonemapper.FILMIC ||
|
|
48
|
-
tonemapper === Tonemapper.ACES
|
|
49
|
-
);
|
|
50
|
-
},
|
|
45
|
+
PBR_NEUTRAL: "PBR_NEUTRAL",
|
|
51
46
|
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Validate whether the provided value is a known Tonemapper type
|
|
50
|
+
* @private
|
|
51
|
+
*
|
|
52
|
+
* @param {string} tonemapper
|
|
53
|
+
*/
|
|
54
|
+
export function validateTonemapper(tonemapper) {
|
|
55
|
+
return (
|
|
56
|
+
tonemapper === Tonemapper.REINHARD ||
|
|
57
|
+
tonemapper === Tonemapper.MODIFIED_REINHARD ||
|
|
58
|
+
tonemapper === Tonemapper.FILMIC ||
|
|
59
|
+
tonemapper === Tonemapper.ACES ||
|
|
60
|
+
tonemapper === Tonemapper.PBR_NEUTRAL
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
52
64
|
export default Object.freeze(Tonemapper);
|
|
@@ -332,12 +332,6 @@ function VoxelPrimitive(options) {
|
|
|
332
332
|
this._transformNormalLocalToWorld = new Matrix3();
|
|
333
333
|
|
|
334
334
|
// Rendering
|
|
335
|
-
/**
|
|
336
|
-
* @type {boolean}
|
|
337
|
-
* @private
|
|
338
|
-
*/
|
|
339
|
-
this._jitter = false;
|
|
340
|
-
|
|
341
335
|
/**
|
|
342
336
|
* @type {boolean}
|
|
343
337
|
* @private
|
|
@@ -704,29 +698,6 @@ Object.defineProperties(VoxelPrimitive.prototype, {
|
|
|
704
698
|
},
|
|
705
699
|
},
|
|
706
700
|
|
|
707
|
-
/**
|
|
708
|
-
* Gets or sets whether or not to jitter the view ray during the raymarch.
|
|
709
|
-
* This reduces stair-step artifacts but introduces noise.
|
|
710
|
-
*
|
|
711
|
-
* @memberof VoxelPrimitive.prototype
|
|
712
|
-
* @type {boolean}
|
|
713
|
-
*/
|
|
714
|
-
jitter: {
|
|
715
|
-
get: function () {
|
|
716
|
-
return this._jitter;
|
|
717
|
-
},
|
|
718
|
-
set: function (jitter) {
|
|
719
|
-
//>>includeStart('debug', pragmas.debug);
|
|
720
|
-
Check.typeOf.bool("jitter", jitter);
|
|
721
|
-
//>>includeEnd('debug');
|
|
722
|
-
|
|
723
|
-
if (this._jitter !== jitter) {
|
|
724
|
-
this._jitter = jitter;
|
|
725
|
-
this._shaderDirty = true;
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
},
|
|
729
|
-
|
|
730
701
|
/**
|
|
731
702
|
* Gets or sets the nearest sampling.
|
|
732
703
|
*
|
|
@@ -215,9 +215,6 @@ function VoxelRenderResources(primitive) {
|
|
|
215
215
|
ShaderDestination.FRAGMENT
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
|
-
if (primitive._jitter) {
|
|
219
|
-
shaderBuilder.addDefine("JITTER", undefined, ShaderDestination.FRAGMENT);
|
|
220
|
-
}
|
|
221
218
|
if (primitive._nearestSampling) {
|
|
222
219
|
shaderBuilder.addDefine(
|
|
223
220
|
"NEAREST_SAMPLING",
|