@cesium/engine 6.2.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
- package/Build/Workers/{chunk-RH4N2ONY.js → chunk-23UFSGND.js} +7 -7
- package/Build/Workers/{chunk-HPP4JLNH.js → chunk-2A75IWRS.js} +7 -7
- package/Build/Workers/{chunk-5IRLXUTA.js → chunk-2FRVPMCS.js} +10 -10
- package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-2FWRMUTY.js} +4 -4
- package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-2UPKWTMJ.js} +6 -6
- package/Build/Workers/{chunk-434ZTTFX.js → chunk-34FXV7D7.js} +2 -2
- package/Build/Workers/{chunk-MW3CJYLX.js → chunk-3VAZEH7M.js} +2 -2
- package/Build/Workers/{chunk-HUPNRBWW.js → chunk-4DO5W5XZ.js} +6 -6
- package/Build/Workers/{chunk-PIXK6KHB.js → chunk-4H7PY4U5.js} +2 -2
- package/Build/Workers/{chunk-BP467WX3.js → chunk-5QULIR53.js} +4 -4
- package/Build/Workers/{chunk-R3HUGXBH.js → chunk-7TC63SJW.js} +8 -8
- package/Build/Workers/{chunk-SQVTYRZY.js → chunk-7ZFGPDJA.js} +4 -4
- package/Build/Workers/{chunk-TIXXVKUY.js → chunk-A5DWLWCY.js} +10 -10
- package/Build/Workers/{chunk-CWJQGBWT.js → chunk-BBWDMCVU.js} +1 -1
- package/Build/Workers/{chunk-4KP73B43.js → chunk-BG4UCVXN.js} +3 -3
- package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-BIKA3NRA.js} +5 -5
- package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-BROJAZRZ.js} +13 -13
- package/Build/Workers/{chunk-FWGNCYP6.js → chunk-DDUQAJ4P.js} +7 -7
- package/Build/Workers/{chunk-QRBRVGZC.js → chunk-EERJKOAF.js} +4 -4
- package/Build/Workers/{chunk-52VSIKEA.js → chunk-EG6PTBY2.js} +15 -15
- package/Build/Workers/{chunk-O43GWBSF.js → chunk-EHWHNOEX.js} +1 -1
- package/Build/Workers/{chunk-MN34FIF5.js → chunk-F3YA3Y2Z.js} +1 -1
- package/Build/Workers/{chunk-GF5TNNKP.js → chunk-F4HFJMGM.js} +6 -6
- package/Build/Workers/{chunk-HOT2SNXP.js → chunk-FJKNFAKQ.js} +133 -553
- package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-FNIRWHJB.js} +10 -10
- package/Build/Workers/{chunk-DMCSY5BU.js → chunk-FZRIVR7Y.js} +5 -5
- package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-G43QFN4Q.js} +6 -6
- package/Build/Workers/{chunk-HPH5HSFE.js → chunk-GATZHF3K.js} +2 -2
- package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-GRC2ZTAF.js} +14 -14
- package/Build/Workers/{chunk-NE4JNU6H.js → chunk-HU6N6EXB.js} +10 -10
- package/Build/Workers/{chunk-GVL5I7TC.js → chunk-I46ZRR5W.js} +17 -17
- package/Build/Workers/{chunk-5GDBZTHX.js → chunk-JURN7NPV.js} +17 -17
- package/Build/Workers/{chunk-H5DUXHCV.js → chunk-KKCR2YOP.js} +11 -11
- package/Build/Workers/{chunk-LX6XV4DK.js → chunk-LPR3YNP2.js} +5 -5
- package/Build/Workers/{chunk-HFKSAB5K.js → chunk-M7ERACJJ.js} +13 -13
- package/Build/Workers/{chunk-BUZDZBUH.js → chunk-MDWEGWPA.js} +10 -10
- package/Build/Workers/{chunk-LGJUI2CE.js → chunk-OGXZVPPM.js} +9 -5
- package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-PGSJK77E.js} +6 -6
- package/Build/Workers/{chunk-ARPTYYKS.js → chunk-PPH7OFP3.js} +5 -5
- package/Build/Workers/{chunk-R4OZKBXH.js → chunk-SH5USDPI.js} +6 -6
- package/Build/Workers/{chunk-SV7DDPAC.js → chunk-SOWMRMWA.js} +1 -1
- package/Build/Workers/{chunk-RIDPF7PO.js → chunk-STW2DGFI.js} +2 -2
- package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-T3XIFPYR.js} +13 -13
- package/Build/Workers/chunk-TTUZP4BO.js +501 -0
- package/Build/Workers/{chunk-QTZQZY2C.js → chunk-UEXTBDBE.js} +34 -10
- package/Build/Workers/{chunk-XUTVA4K5.js → chunk-VOXYEYJT.js} +11 -11
- package/Build/Workers/{chunk-AXFRNOVC.js → chunk-X4356LRH.js} +12 -12
- package/Build/Workers/{chunk-5HLGKKG3.js → chunk-XGI5BXZY.js} +2 -2
- package/Build/Workers/{chunk-SNN7WOC2.js → chunk-Y2ME2IJV.js} +13 -13
- package/Build/Workers/{chunk-LGL4P5KL.js → chunk-Y5UQJLYE.js} +6 -6
- package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-YJEBABKH.js} +7 -7
- package/Build/Workers/{chunk-YBKFS53K.js → chunk-YWTJ2B4B.js} +1 -1
- package/Build/Workers/{chunk-5SK36PU4.js → chunk-Z3TIFFGF.js} +7 -7
- package/Build/Workers/{chunk-JGG36SQV.js → chunk-ZT7KWISZ.js} +4 -4
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +32 -166
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/LICENSE.md +1 -1
- package/Source/Assets/approximateTerrainHeights.json +1 -1
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/GregorianDate.js +85 -0
- package/Source/Core/HeadingPitchRange.js +2 -2
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/PolygonGeometry.js +0 -169
- package/Source/Core/Resource.js +30 -69
- package/Source/Core/Transforms.js +30 -18
- package/Source/Core/createWorldBathymetryAsync.js +45 -0
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
- package/Source/DataSources/Entity.js +28 -7
- package/Source/DataSources/EntityCollection.js +1 -2
- package/Source/DataSources/GeometryUpdater.js +1 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- package/Source/DataSources/GroundGeometryUpdater.js +6 -3
- package/Source/DataSources/ModelVisualizer.js +19 -98
- package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
- package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
- package/Source/DataSources/TerrainOffsetProperty.js +15 -23
- package/Source/Renderer/AutomaticUniforms.js +121 -1
- package/Source/Renderer/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/UniformState.js +127 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Atmosphere.js +127 -0
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Billboard.js +29 -26
- package/Source/Scene/BillboardCollection.js +3 -3
- package/Source/Scene/Camera.js +47 -5
- package/Source/Scene/Cesium3DTile.js +1 -0
- package/Source/Scene/Cesium3DTileContent.js +14 -0
- package/Source/Scene/Cesium3DTileset.js +364 -45
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
- package/Source/Scene/Composite3DTileContent.js +42 -0
- package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
- package/Source/Scene/Empty3DTileContent.js +4 -0
- package/Source/Scene/Fog.js +1 -0
- package/Source/Scene/FrameState.js +14 -1
- package/Source/Scene/Geometry3DTileContent.js +4 -0
- package/Source/Scene/Globe.js +3 -2
- package/Source/Scene/GlobeSurfaceTileProvider.js +3 -1
- package/Source/Scene/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfLoader.js +15 -5
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/HeightReference.js +59 -2
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/Implicit3DTileContent.js +4 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- package/Source/Scene/LabelCollection.js +2 -2
- package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
- package/Source/Scene/Model/B3dmLoader.js +4 -0
- package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
- package/Source/Scene/Model/I3dmLoader.js +4 -0
- package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
- package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
- package/Source/Scene/Model/Model.js +82 -32
- package/Source/Scene/Model/Model3DTileContent.js +31 -0
- package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
- package/Source/Scene/Model/ModelSceneGraph.js +6 -0
- package/Source/Scene/Model/pickModel.js +426 -0
- package/Source/Scene/Multiple3DTileContent.js +42 -0
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -2
- package/Source/Scene/QuadtreePrimitive.js +1 -1
- package/Source/Scene/Scene.js +312 -46
- package/Source/Scene/ScreenSpaceCameraController.js +23 -13
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SkyAtmosphere.js +5 -6
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- package/Source/Scene/Terrain.js +49 -0
- package/Source/Scene/TileBoundingS2Cell.js +2 -2
- package/Source/Scene/Tileset3DTileContent.js +4 -0
- package/Source/Scene/Vector3DTileContent.js +4 -0
- package/Source/Scene/VoxelBoxShape.js +76 -0
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +114 -43
- package/Source/Scene/VoxelEllipsoidShape.js +158 -116
- package/Source/Scene/VoxelPrimitive.js +3 -1
- package/Source/Scene/VoxelRenderResources.js +3 -0
- package/Source/Scene/VoxelShape.js +13 -0
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +2 -0
- package/Source/Shaders/AtmosphereCommon.glsl +3 -11
- package/Source/Shaders/AtmosphereCommon.js +3 -11
- package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
- package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
- package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
- package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
- package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
- package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
- package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
- package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
- package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
- package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
- package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
- package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
- package/Source/Shaders/GlobeFS.glsl +16 -25
- package/Source/Shaders/GlobeFS.js +16 -25
- package/Source/Shaders/GlobeVS.glsl +1 -1
- package/Source/Shaders/GlobeVS.js +1 -1
- package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
- package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
- package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
- package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
- package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
- package/Source/Shaders/Model/GeometryStageFS.js +1 -1
- package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
- package/Source/Shaders/Model/GeometryStageVS.js +4 -4
- package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
- package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +4 -0
- package/Source/Shaders/Model/ModelFS.js +4 -0
- package/Source/Shaders/Model/ModelVS.glsl +9 -4
- package/Source/Shaders/Model/ModelVS.js +9 -4
- package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
- package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
- package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
- package/Source/Shaders/SkyAtmosphereFS.js +5 -10
- package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
- package/Source/Shaders/SkyAtmosphereVS.js +3 -2
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
- package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
- package/Source/Shaders/Voxels/VoxelFS.js +39 -1
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
- package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/ThirdParty/draco_decoder.wasm +0 -0
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +574 -71
- package/index.js +217 -196
- package/package.json +3 -3
- package/Build/Workers/chunk-ATB2I7OS.js +0 -55
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import Check from "../Core/Check.js";
|
|
2
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import I3SDataProvider from "./I3SDataProvider.js";
|
|
5
|
+
import I3SLayer from "./I3SLayer.js";
|
|
6
|
+
import Resource from "../Core/Resource.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This class implements an I3S sublayer for Building Scene Layer.
|
|
10
|
+
* <p>
|
|
11
|
+
* This object is normally not instantiated directly, use {@link I3SSublayer.fromData}.
|
|
12
|
+
* </p>
|
|
13
|
+
* @alias I3SSublayer
|
|
14
|
+
* @internalConstructor
|
|
15
|
+
*/
|
|
16
|
+
function I3SSublayer(dataProvider, parent, sublayerData) {
|
|
17
|
+
this._dataProvider = dataProvider;
|
|
18
|
+
this._parent = parent;
|
|
19
|
+
this._data = sublayerData;
|
|
20
|
+
this._name = sublayerData.name;
|
|
21
|
+
this._modelName = sublayerData.modelName;
|
|
22
|
+
this._visibility = defaultValue(sublayerData.visibility, true);
|
|
23
|
+
this._resource = undefined;
|
|
24
|
+
this._sublayers = [];
|
|
25
|
+
this._i3sLayers = [];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Object.defineProperties(I3SSublayer.prototype, {
|
|
29
|
+
/**
|
|
30
|
+
* Gets the resource for the sublayer
|
|
31
|
+
* @memberof I3SSublayer.prototype
|
|
32
|
+
* @type {Resource}
|
|
33
|
+
* @readonly
|
|
34
|
+
*/
|
|
35
|
+
resource: {
|
|
36
|
+
get: function () {
|
|
37
|
+
return this._resource;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Gets the I3S data for this object.
|
|
43
|
+
* @memberof I3SSublayer.prototype
|
|
44
|
+
* @type {object}
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
data: {
|
|
48
|
+
get: function () {
|
|
49
|
+
return this._data;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Gets the name for the sublayer.
|
|
55
|
+
* @memberof I3SSublayer.prototype
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
name: {
|
|
60
|
+
get: function () {
|
|
61
|
+
return this._name;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Gets the model name for the sublayer.
|
|
67
|
+
* @memberof I3SSublayer.prototype
|
|
68
|
+
* @type {string}
|
|
69
|
+
* @readonly
|
|
70
|
+
*/
|
|
71
|
+
modelName: {
|
|
72
|
+
get: function () {
|
|
73
|
+
return this._modelName;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gets the collection of child sublayers.
|
|
79
|
+
* @memberof I3SSublayer.prototype
|
|
80
|
+
* @type {I3SSublayer[]}
|
|
81
|
+
* @readonly
|
|
82
|
+
*/
|
|
83
|
+
sublayers: {
|
|
84
|
+
get: function () {
|
|
85
|
+
return this._sublayers;
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Gets or sets the sublayer visibility.
|
|
91
|
+
* @memberof I3SSublayer.prototype
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
*/
|
|
94
|
+
visibility: {
|
|
95
|
+
get: function () {
|
|
96
|
+
return this._visibility;
|
|
97
|
+
},
|
|
98
|
+
set: function (value) {
|
|
99
|
+
//>>includeStart('debug', pragmas.debug);
|
|
100
|
+
Check.defined("value", value);
|
|
101
|
+
//>>includeEnd('debug');
|
|
102
|
+
|
|
103
|
+
if (this._visibility !== value) {
|
|
104
|
+
this._visibility = value;
|
|
105
|
+
for (let i = 0; i < this._i3sLayers.length; i++) {
|
|
106
|
+
this._i3sLayers[i]._updateVisibility();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Determines if the sublayer will be shown.
|
|
114
|
+
* @memberof I3SSublayer.prototype
|
|
115
|
+
* @type {boolean}
|
|
116
|
+
* @readonly
|
|
117
|
+
*/
|
|
118
|
+
show: {
|
|
119
|
+
get: function () {
|
|
120
|
+
return this._visibility && this._parent.show;
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @private
|
|
127
|
+
*/
|
|
128
|
+
I3SSublayer._fromData = async function (
|
|
129
|
+
dataProvider,
|
|
130
|
+
buildingLayerUrl,
|
|
131
|
+
sublayerData,
|
|
132
|
+
parent
|
|
133
|
+
) {
|
|
134
|
+
const sublayer = new I3SSublayer(dataProvider, parent, sublayerData);
|
|
135
|
+
if (sublayer._data.layerType === "group") {
|
|
136
|
+
const sublayers = sublayer._data.sublayers;
|
|
137
|
+
if (defined(sublayers)) {
|
|
138
|
+
const promises = [];
|
|
139
|
+
for (let i = 0; i < sublayers.length; i++) {
|
|
140
|
+
const promise = I3SSublayer._fromData(
|
|
141
|
+
dataProvider,
|
|
142
|
+
buildingLayerUrl,
|
|
143
|
+
sublayers[i],
|
|
144
|
+
sublayer
|
|
145
|
+
);
|
|
146
|
+
promises.push(promise);
|
|
147
|
+
}
|
|
148
|
+
const childSublayers = await Promise.all(promises);
|
|
149
|
+
for (let i = 0; i < childSublayers.length; i++) {
|
|
150
|
+
const childSublayer = childSublayers[i];
|
|
151
|
+
sublayer._sublayers.push(childSublayer);
|
|
152
|
+
sublayer._i3sLayers.push(...childSublayer._i3sLayers);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} else if (sublayer._data.layerType === "3DObject") {
|
|
156
|
+
const sublayerUrl = buildingLayerUrl.concat(
|
|
157
|
+
`/sublayers/${sublayer._data.id}`
|
|
158
|
+
);
|
|
159
|
+
const resource = new Resource({ url: sublayerUrl });
|
|
160
|
+
resource.setQueryParameters(dataProvider.resource.queryParameters);
|
|
161
|
+
resource.appendForwardSlash();
|
|
162
|
+
sublayer._resource = resource;
|
|
163
|
+
|
|
164
|
+
const layerData = await I3SDataProvider.loadJson(sublayer._resource);
|
|
165
|
+
const layer = new I3SLayer(dataProvider, layerData, sublayer);
|
|
166
|
+
sublayer._i3sLayers.push(layer);
|
|
167
|
+
} else {
|
|
168
|
+
// Filter other scene layer types out
|
|
169
|
+
console.log(
|
|
170
|
+
`${sublayer._data.layerType} layer ${sublayer._data.name} is skipped as not supported.`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return sublayer;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export default I3SSublayer;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import Color from "../Core/Color.js";
|
|
2
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import srgbToLinear from "../Core/srgbToLinear.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This class implements an I3S symbology for I3S Layers.
|
|
8
|
+
* <p>
|
|
9
|
+
* Do not construct this directly, instead access symbology through {@link I3SLayer}.
|
|
10
|
+
* </p>
|
|
11
|
+
* @alias I3SSymbology
|
|
12
|
+
* @internalConstructor
|
|
13
|
+
*/
|
|
14
|
+
function I3SSymbology(layer) {
|
|
15
|
+
this._layer = layer;
|
|
16
|
+
this._defaultSymbology = undefined;
|
|
17
|
+
this._valueFields = [];
|
|
18
|
+
this._uniqueValueHash = undefined;
|
|
19
|
+
this._classBreaksHash = undefined;
|
|
20
|
+
|
|
21
|
+
this._parseLayerSymbology();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Object.defineProperties(I3SSymbology.prototype, {
|
|
25
|
+
/**
|
|
26
|
+
* Gets the default symbology data.
|
|
27
|
+
* @memberof I3SSymbology.prototype
|
|
28
|
+
* @type {object}
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
31
|
+
defaultSymbology: {
|
|
32
|
+
get: function () {
|
|
33
|
+
return this._defaultSymbology;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function convertColor(color, transparency) {
|
|
39
|
+
// color is represented as a three or four-element array, values range from 0 through 255.
|
|
40
|
+
// transparency value has to lie between 100 (full transparency) and 0 (full opacity).
|
|
41
|
+
const convertedColor = [];
|
|
42
|
+
for (let i = 0; i < color.length; i++) {
|
|
43
|
+
const floatColor = Color.byteToFloat(color[i]);
|
|
44
|
+
if (i < 3) {
|
|
45
|
+
convertedColor.push(srgbToLinear(floatColor));
|
|
46
|
+
} else {
|
|
47
|
+
convertedColor.push(floatColor);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (convertedColor.length === 3) {
|
|
51
|
+
if (defined(transparency)) {
|
|
52
|
+
convertedColor.push(1.0 - transparency / 100.0);
|
|
53
|
+
} else {
|
|
54
|
+
convertedColor.push(1.0);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return convertedColor;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parseSymbol(symbol, isColorCaptured) {
|
|
61
|
+
const symbology = {
|
|
62
|
+
edges: undefined,
|
|
63
|
+
material: undefined,
|
|
64
|
+
};
|
|
65
|
+
if (defined(symbol) && defined(symbol.symbolLayers)) {
|
|
66
|
+
for (let i = 0; i < symbol.symbolLayers.length; i++) {
|
|
67
|
+
const symbolLayer = symbol.symbolLayers[i];
|
|
68
|
+
if (symbolLayer.type === "Fill") {
|
|
69
|
+
const edges = symbolLayer.edges;
|
|
70
|
+
const outline = symbolLayer.outline;
|
|
71
|
+
if (defined(edges)) {
|
|
72
|
+
symbology.edges = {};
|
|
73
|
+
if (defined(edges.color)) {
|
|
74
|
+
symbology.edges.color = convertColor(
|
|
75
|
+
edges.color,
|
|
76
|
+
edges.transparency
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
} else if (defined(outline)) {
|
|
80
|
+
symbology.edges = {};
|
|
81
|
+
if (defined(outline.color)) {
|
|
82
|
+
symbology.edges.color = convertColor(
|
|
83
|
+
outline.color,
|
|
84
|
+
outline.transparency
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!isColorCaptured) {
|
|
90
|
+
const material = symbolLayer.material;
|
|
91
|
+
if (defined(material)) {
|
|
92
|
+
symbology.material = {
|
|
93
|
+
colorMixMode: material.colorMixMode,
|
|
94
|
+
};
|
|
95
|
+
if (defined(material.color)) {
|
|
96
|
+
symbology.material.color = convertColor(
|
|
97
|
+
material.color,
|
|
98
|
+
material.transparency
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return symbology;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function buildUniqueValueHash(renderer, isColorCaptured) {
|
|
111
|
+
if (defined(renderer.uniqueValueGroups)) {
|
|
112
|
+
const valueHash = {};
|
|
113
|
+
for (
|
|
114
|
+
let groupIndex = 0;
|
|
115
|
+
groupIndex < renderer.uniqueValueGroups.length;
|
|
116
|
+
groupIndex++
|
|
117
|
+
) {
|
|
118
|
+
const classes = renderer.uniqueValueGroups[groupIndex].classes;
|
|
119
|
+
if (defined(classes)) {
|
|
120
|
+
for (let classIndex = 0; classIndex < classes.length; classIndex++) {
|
|
121
|
+
const classSymbology = parseSymbol(
|
|
122
|
+
classes[classIndex].symbol,
|
|
123
|
+
isColorCaptured
|
|
124
|
+
);
|
|
125
|
+
const values = classes[classIndex].values;
|
|
126
|
+
for (let valueIndex = 0; valueIndex < values.length; valueIndex++) {
|
|
127
|
+
const fieldValues = values[valueIndex];
|
|
128
|
+
let hash = valueHash;
|
|
129
|
+
for (
|
|
130
|
+
let fieldIndex = 0;
|
|
131
|
+
fieldIndex < fieldValues.length;
|
|
132
|
+
fieldIndex++
|
|
133
|
+
) {
|
|
134
|
+
const fieldValue = fieldValues[fieldIndex];
|
|
135
|
+
if (fieldIndex === fieldValues.length - 1) {
|
|
136
|
+
hash[fieldValue] = classSymbology;
|
|
137
|
+
} else {
|
|
138
|
+
if (!defined(hash[fieldValue])) {
|
|
139
|
+
hash[fieldValue] = {};
|
|
140
|
+
}
|
|
141
|
+
hash = hash[fieldValue];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return valueHash;
|
|
149
|
+
}
|
|
150
|
+
if (defined(renderer.uniqueValueInfos)) {
|
|
151
|
+
const valueHash = {};
|
|
152
|
+
for (
|
|
153
|
+
let infoIndex = 0;
|
|
154
|
+
infoIndex < renderer.uniqueValueInfos.length;
|
|
155
|
+
infoIndex++
|
|
156
|
+
) {
|
|
157
|
+
const info = renderer.uniqueValueInfos[infoIndex];
|
|
158
|
+
valueHash[info.value] = parseSymbol(info.symbol, isColorCaptured);
|
|
159
|
+
}
|
|
160
|
+
return valueHash;
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function buildClassBreaksHash(renderer, isColorCaptured) {
|
|
166
|
+
if (defined(renderer.classBreakInfos)) {
|
|
167
|
+
const classBreakInfos = [...renderer.classBreakInfos];
|
|
168
|
+
classBreakInfos.sort(function (a, b) {
|
|
169
|
+
const aMax = defaultValue(a.classMaxValue, a.classMinValue);
|
|
170
|
+
const bMax = defaultValue(b.classMaxValue, b.classMinValue);
|
|
171
|
+
return aMax - bMax;
|
|
172
|
+
});
|
|
173
|
+
const valueHash = {
|
|
174
|
+
ranges: [],
|
|
175
|
+
symbols: [],
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
if (defined(renderer.minValue)) {
|
|
179
|
+
valueHash.ranges.push(renderer.minValue);
|
|
180
|
+
valueHash.symbols.push(undefined);
|
|
181
|
+
}
|
|
182
|
+
for (let infoIndex = 0; infoIndex < classBreakInfos.length; infoIndex++) {
|
|
183
|
+
const info = classBreakInfos[infoIndex];
|
|
184
|
+
if (defined(info.classMinValue)) {
|
|
185
|
+
if (
|
|
186
|
+
valueHash.ranges.length === 0 ||
|
|
187
|
+
info.classMinValue > valueHash.ranges[valueHash.ranges.length - 1]
|
|
188
|
+
) {
|
|
189
|
+
valueHash.ranges.push(info.classMinValue);
|
|
190
|
+
valueHash.symbols.push(undefined);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (defined(info.classMaxValue)) {
|
|
194
|
+
if (
|
|
195
|
+
valueHash.ranges.length === 0 ||
|
|
196
|
+
info.classMaxValue > valueHash.ranges[valueHash.ranges.length - 1]
|
|
197
|
+
) {
|
|
198
|
+
valueHash.ranges.push(info.classMaxValue);
|
|
199
|
+
valueHash.symbols.push(parseSymbol(info.symbol, isColorCaptured));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
valueHash.symbols.push(undefined);
|
|
204
|
+
|
|
205
|
+
return valueHash;
|
|
206
|
+
}
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
I3SSymbology.prototype._parseLayerSymbology = function () {
|
|
214
|
+
const drawingInfo = this._layer.data.drawingInfo;
|
|
215
|
+
if (defined(drawingInfo) && defined(drawingInfo.renderer)) {
|
|
216
|
+
const cachedDrawingInfo = this._layer.data.cachedDrawingInfo;
|
|
217
|
+
const isColorCaptured =
|
|
218
|
+
defined(cachedDrawingInfo) && cachedDrawingInfo.color === true;
|
|
219
|
+
const renderer = drawingInfo.renderer;
|
|
220
|
+
if (renderer.type === "simple") {
|
|
221
|
+
this._defaultSymbology = parseSymbol(renderer.symbol, isColorCaptured);
|
|
222
|
+
} else if (renderer.type === "uniqueValue") {
|
|
223
|
+
this._defaultSymbology = parseSymbol(
|
|
224
|
+
renderer.defaultSymbol,
|
|
225
|
+
isColorCaptured
|
|
226
|
+
);
|
|
227
|
+
this._valueFields.push(renderer.field1);
|
|
228
|
+
if (defined(renderer.field2)) {
|
|
229
|
+
this._valueFields.push(renderer.field2);
|
|
230
|
+
}
|
|
231
|
+
if (defined(renderer.field3)) {
|
|
232
|
+
this._valueFields.push(renderer.field3);
|
|
233
|
+
}
|
|
234
|
+
this._uniqueValueHash = buildUniqueValueHash(renderer, isColorCaptured);
|
|
235
|
+
} else if (renderer.type === "classBreaks") {
|
|
236
|
+
this._defaultSymbology = parseSymbol(
|
|
237
|
+
renderer.defaultSymbol,
|
|
238
|
+
isColorCaptured
|
|
239
|
+
);
|
|
240
|
+
this._valueFields.push(renderer.field);
|
|
241
|
+
this._classBreaksHash = buildClassBreaksHash(renderer, isColorCaptured);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
function findHashForUniqueValues(hash, values, hashLevel, valueIndex) {
|
|
247
|
+
const levelValues = values[hashLevel];
|
|
248
|
+
if (valueIndex < levelValues.length) {
|
|
249
|
+
const hashValue = levelValues[valueIndex];
|
|
250
|
+
const innerHash = hash[hashValue];
|
|
251
|
+
if (defined(innerHash) && ++hashLevel < values.length) {
|
|
252
|
+
return findHashForUniqueValues(innerHash, values, hashLevel, valueIndex);
|
|
253
|
+
}
|
|
254
|
+
return innerHash;
|
|
255
|
+
}
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function bisect(array, value) {
|
|
260
|
+
let low = 0;
|
|
261
|
+
let high = array.length;
|
|
262
|
+
if (low < high) {
|
|
263
|
+
do {
|
|
264
|
+
const mid = (low + high) >>> 1;
|
|
265
|
+
if (array[mid] < value) {
|
|
266
|
+
low = mid + 1;
|
|
267
|
+
} else {
|
|
268
|
+
high = mid;
|
|
269
|
+
}
|
|
270
|
+
} while (low < high);
|
|
271
|
+
}
|
|
272
|
+
return low;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function findHashForClassBreaks(hash, values, valueIndex) {
|
|
276
|
+
const value = values[valueIndex];
|
|
277
|
+
const range = bisect(hash.ranges, value);
|
|
278
|
+
return hash.symbols[range];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
I3SSymbology.prototype._getSymbology = async function (node) {
|
|
285
|
+
const symbology = {
|
|
286
|
+
default: this._defaultSymbology,
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
if (this._valueFields.length > 0) {
|
|
290
|
+
const promises = [];
|
|
291
|
+
for (let i = 0; i < this._valueFields.length; i++) {
|
|
292
|
+
promises.push(node.loadField(this._valueFields[i]));
|
|
293
|
+
}
|
|
294
|
+
await Promise.all(promises);
|
|
295
|
+
|
|
296
|
+
const fieldsValues = [];
|
|
297
|
+
for (let i = 0; i < this._valueFields.length; i++) {
|
|
298
|
+
fieldsValues.push(node.fields[this._valueFields[i]].values);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
let featureHashFn;
|
|
302
|
+
if (defined(this._uniqueValueHash)) {
|
|
303
|
+
featureHashFn = (featureIndex) =>
|
|
304
|
+
findHashForUniqueValues(
|
|
305
|
+
this._uniqueValueHash,
|
|
306
|
+
fieldsValues,
|
|
307
|
+
0,
|
|
308
|
+
featureIndex
|
|
309
|
+
);
|
|
310
|
+
} else if (defined(this._classBreaksHash)) {
|
|
311
|
+
featureHashFn = (featureIndex) =>
|
|
312
|
+
findHashForClassBreaks(
|
|
313
|
+
this._classBreaksHash,
|
|
314
|
+
fieldsValues[0],
|
|
315
|
+
featureIndex
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (defined(featureHashFn)) {
|
|
320
|
+
const firstFieldValues = fieldsValues[0];
|
|
321
|
+
for (
|
|
322
|
+
let featureIndex = 0;
|
|
323
|
+
featureIndex < firstFieldValues.length;
|
|
324
|
+
featureIndex++
|
|
325
|
+
) {
|
|
326
|
+
const featureSymbology = featureHashFn(featureIndex);
|
|
327
|
+
if (defined(featureSymbology)) {
|
|
328
|
+
symbology[featureIndex] = featureSymbology;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return symbology;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export default I3SSymbology;
|
|
@@ -1177,6 +1177,10 @@ Implicit3DTileContent.prototype.applyStyle = function (style) {};
|
|
|
1177
1177
|
|
|
1178
1178
|
Implicit3DTileContent.prototype.update = function (tileset, frameState) {};
|
|
1179
1179
|
|
|
1180
|
+
Implicit3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
1181
|
+
return undefined;
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1180
1184
|
Implicit3DTileContent.prototype.isDestroyed = function () {
|
|
1181
1185
|
return false;
|
|
1182
1186
|
};
|
|
@@ -20,7 +20,7 @@ function KeyframeNode(spatialNode, keyframe) {
|
|
|
20
20
|
this.spatialNode = spatialNode;
|
|
21
21
|
this.keyframe = keyframe;
|
|
22
22
|
this.state = LoadState.UNLOADED;
|
|
23
|
-
this.
|
|
23
|
+
this.metadata = [];
|
|
24
24
|
this.megatextureIndex = -1;
|
|
25
25
|
this.priority = -Number.MAX_VALUE;
|
|
26
26
|
this.highPriorityFrameNumber = -1;
|
|
@@ -10,7 +10,7 @@ import writeTextToCanvas from "../Core/writeTextToCanvas.js";
|
|
|
10
10
|
import bitmapSDF from "bitmap-sdf";
|
|
11
11
|
import BillboardCollection from "./BillboardCollection.js";
|
|
12
12
|
import BlendOption from "./BlendOption.js";
|
|
13
|
-
import
|
|
13
|
+
import { isHeightReferenceClamp } from "./HeightReference.js";
|
|
14
14
|
import HorizontalOrigin from "./HorizontalOrigin.js";
|
|
15
15
|
import Label from "./Label.js";
|
|
16
16
|
import LabelStyle from "./LabelStyle.js";
|
|
@@ -510,7 +510,7 @@ function repositionAllGlyphs(label) {
|
|
|
510
510
|
);
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
if (label.heightReference
|
|
513
|
+
if (isHeightReferenceClamp(label.heightReference)) {
|
|
514
514
|
for (glyphIndex = 0; glyphIndex < glyphLength; ++glyphIndex) {
|
|
515
515
|
glyph = glyphs[glyphIndex];
|
|
516
516
|
const billboard = glyph.billboard;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
2
|
+
import CesiumMath from "../../Core/Math.js";
|
|
3
|
+
import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
4
|
+
import AtmosphereStageFS from "../../Shaders/Model/AtmosphereStageFS.js";
|
|
5
|
+
import AtmosphereStageVS from "../../Shaders/Model/AtmosphereStageVS.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The atmosphere pipeline stage applies all earth atmosphere effects that apply
|
|
9
|
+
* to models, including fog.
|
|
10
|
+
*
|
|
11
|
+
* @namespace AtmospherePipelineStage
|
|
12
|
+
*
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
const AtmospherePipelineStage = {
|
|
16
|
+
name: "AtmospherePipelineStage", // Helps with debugging
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
AtmospherePipelineStage.process = function (
|
|
20
|
+
renderResources,
|
|
21
|
+
model,
|
|
22
|
+
frameState
|
|
23
|
+
) {
|
|
24
|
+
const shaderBuilder = renderResources.shaderBuilder;
|
|
25
|
+
|
|
26
|
+
shaderBuilder.addDefine("HAS_ATMOSPHERE", undefined, ShaderDestination.BOTH);
|
|
27
|
+
shaderBuilder.addDefine(
|
|
28
|
+
"COMPUTE_POSITION_WC_ATMOSPHERE",
|
|
29
|
+
undefined,
|
|
30
|
+
ShaderDestination.BOTH
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
shaderBuilder.addVarying("vec3", "v_atmosphereRayleighColor");
|
|
34
|
+
shaderBuilder.addVarying("vec3", "v_atmosphereMieColor");
|
|
35
|
+
shaderBuilder.addVarying("float", "v_atmosphereOpacity");
|
|
36
|
+
|
|
37
|
+
shaderBuilder.addVertexLines([AtmosphereStageVS]);
|
|
38
|
+
shaderBuilder.addFragmentLines([AtmosphereStageFS]);
|
|
39
|
+
|
|
40
|
+
// Add a uniform so fog is only calculated when the efcfect would
|
|
41
|
+
// be non-negligible For example when the camera is in space, fog density decreases
|
|
42
|
+
// to 0 so fog shouldn't be rendered. Since this state may change rapidly if
|
|
43
|
+
// the camera is moving, this is implemented as a uniform, not a define.
|
|
44
|
+
shaderBuilder.addUniform("bool", "u_isInFog", ShaderDestination.FRAGMENT);
|
|
45
|
+
renderResources.uniformMap.u_isInFog = function () {
|
|
46
|
+
// We only need a rough measure of distance to the model, so measure
|
|
47
|
+
// from the camera to the bounding sphere center.
|
|
48
|
+
const distance = Cartesian3.distance(
|
|
49
|
+
frameState.camera.positionWC,
|
|
50
|
+
model.boundingSphere.center
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
CesiumMath.fog(distance, frameState.fog.density) > CesiumMath.EPSILON3
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default AtmospherePipelineStage;
|
|
@@ -50,6 +50,7 @@ const FeatureIdAttribute = ModelComponents.FeatureIdAttribute;
|
|
|
50
50
|
* @param {Axis} [options.forwardAxis=Axis.X] The forward-axis of the glTF model.
|
|
51
51
|
* @param {boolean} [options.loadAttributesAsTypedArray=false] If <code>true</code>, load all attributes as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
|
|
52
52
|
* @param {boolean} [options.loadAttributesFor2D=false] If <code>true</code>, load the positions buffer and any instanced attribute buffers as typed arrays for accurately projecting models to 2D.
|
|
53
|
+
* @param {boolean} [options.enablePick=false] If <code>true</code>, load the positions buffer, any instanced attribute buffers, and index buffer as typed arrays for CPU-enabled picking in WebGL1.
|
|
53
54
|
* @param {boolean} [options.loadIndicesForWireframe=false] If <code>true</code>, load the index buffer as a typed array. This is useful for creating wireframe indices in WebGL1.
|
|
54
55
|
* @param {boolean} [options.loadPrimitiveOutline=true] If <code>true</code>, load outlines from 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.
|
|
55
56
|
* @param {boolean} [options.loadForClassification=false] If <code>true</code> and if the model has feature IDs, load the feature IDs and indices as typed arrays. This is useful for batching features for classification.
|
|
@@ -74,6 +75,7 @@ function B3dmLoader(options) {
|
|
|
74
75
|
false
|
|
75
76
|
);
|
|
76
77
|
const loadAttributesFor2D = defaultValue(options.loadAttributesFor2D, false);
|
|
78
|
+
const enablePick = defaultValue(options.enablePick, false);
|
|
77
79
|
const loadIndicesForWireframe = defaultValue(
|
|
78
80
|
options.loadIndicesForWireframe,
|
|
79
81
|
false
|
|
@@ -102,6 +104,7 @@ function B3dmLoader(options) {
|
|
|
102
104
|
this._forwardAxis = forwardAxis;
|
|
103
105
|
this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
|
|
104
106
|
this._loadAttributesFor2D = loadAttributesFor2D;
|
|
107
|
+
this._enablePick = enablePick;
|
|
105
108
|
this._loadIndicesForWireframe = loadIndicesForWireframe;
|
|
106
109
|
this._loadPrimitiveOutline = loadPrimitiveOutline;
|
|
107
110
|
this._loadForClassification = loadForClassification;
|
|
@@ -223,6 +226,7 @@ B3dmLoader.prototype.load = function () {
|
|
|
223
226
|
incrementallyLoadTextures: this._incrementallyLoadTextures,
|
|
224
227
|
loadAttributesAsTypedArray: this._loadAttributesAsTypedArray,
|
|
225
228
|
loadAttributesFor2D: this._loadAttributesFor2D,
|
|
229
|
+
enablePick: this._enablePick,
|
|
226
230
|
loadIndicesForWireframe: this._loadIndicesForWireframe,
|
|
227
231
|
loadPrimitiveOutline: this._loadPrimitiveOutline,
|
|
228
232
|
loadForClassification: this._loadForClassification,
|
|
@@ -9,6 +9,7 @@ import FeatureIdStageVS from "../../Shaders/Model/FeatureIdStageVS.js";
|
|
|
9
9
|
import ModelComponents from "../ModelComponents.js";
|
|
10
10
|
import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
|
|
11
11
|
import ModelUtility from "./ModelUtility.js";
|
|
12
|
+
import Matrix3 from "../../Core/Matrix3.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* The feature ID pipeline stage is responsible for processing feature IDs
|
|
@@ -387,10 +388,32 @@ function processTexture(
|
|
|
387
388
|
ShaderDestination.FRAGMENT
|
|
388
389
|
);
|
|
389
390
|
|
|
391
|
+
// Get a GLSL expression for the texture coordinates
|
|
392
|
+
const texCoord = textureReader.texCoord;
|
|
393
|
+
const texCoordVariable = `v_texCoord_${texCoord}`;
|
|
394
|
+
let texCoordVariableExpression = texCoordVariable;
|
|
395
|
+
|
|
396
|
+
// Check if the texture defines a `transform` from a `KHR_texture_transform`
|
|
397
|
+
const transform = textureReader.transform;
|
|
398
|
+
if (defined(transform) && !Matrix3.equals(transform, Matrix3.IDENTITY)) {
|
|
399
|
+
// Add a uniform for the transformation matrix
|
|
400
|
+
const transformUniformName = `${uniformName}Transform`;
|
|
401
|
+
shaderBuilder.addUniform(
|
|
402
|
+
"mat3",
|
|
403
|
+
transformUniformName,
|
|
404
|
+
ShaderDestination.FRAGMENT
|
|
405
|
+
);
|
|
406
|
+
uniformMap[transformUniformName] = function () {
|
|
407
|
+
return transform;
|
|
408
|
+
};
|
|
409
|
+
// Update the expression for the texture coordinates
|
|
410
|
+
// with one that transforms the texture coordinates
|
|
411
|
+
// with the transform matrix first
|
|
412
|
+
texCoordVariableExpression = `vec2(${transformUniformName} * vec3(${texCoordVariable}, 1.0))`;
|
|
413
|
+
}
|
|
390
414
|
// Read one or more channels from the texture
|
|
391
415
|
// example: texture(u_featureIdTexture_0, v_texCoord_1).rg
|
|
392
|
-
const
|
|
393
|
-
const textureRead = `texture(${uniformName}, ${texCoord}).${channels}`;
|
|
416
|
+
const textureRead = `texture(${uniformName}, ${texCoordVariableExpression}).${channels}`;
|
|
394
417
|
|
|
395
418
|
// Finally, assign to the struct field. Example:
|
|
396
419
|
// featureIds.featureId_0 = unpacked;
|