@cesium/engine 1.0.0 → 2.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/{AttributeCompression-4589338a.js → AttributeCompression-b646d393.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-bfb1234f.js → AxisAlignedBoundingBox-47525601.js} +1 -1
- package/Build/Workers/{BoundingRectangle-7ffc2153.js → BoundingRectangle-93b263ac.js} +1 -1
- package/Build/Workers/{BoxGeometry-93f344a3.js → BoxGeometry-8c4b4125.js} +1 -1
- package/Build/Workers/{Color-0c5aaf47.js → Color-52c60ed7.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-6597982a.js → CoplanarPolygonGeometryLibrary-33c4c1f8.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-2119580e.js → CorridorGeometryLibrary-5039cd8e.js} +1 -1
- package/Build/Workers/{CylinderGeometry-f9503c6d.js → CylinderGeometry-3ac44974.js} +1 -1
- package/Build/Workers/{EllipseGeometry-fedf72d5.js → EllipseGeometry-a9c9b3be.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-4ea68687.js → EllipseGeometryLibrary-855d4681.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-e2ae6a35.js → EllipseOutlineGeometry-017a5929.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-16de63ea.js → EllipsoidGeodesic-98c62a56.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-95c0330e.js → EllipsoidGeometry-826e7bce.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-d6d2ceec.js → EllipsoidOutlineGeometry-784dcdb5.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-ae5e65e0.js → EllipsoidRhumbLine-19756602.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-bfc674bf.js → EllipsoidTangentPlane-ed9443a1.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-f473ea18.js → EncodedCartesian3-81f70735.js} +1 -1
- package/Build/Workers/{FrustumGeometry-3bf2e4eb.js → FrustumGeometry-9f1ee4d8.js} +1 -1
- package/Build/Workers/{GeometryAttribute-df5f473e.js → GeometryAttribute-334718f8.js} +1 -1
- package/Build/Workers/{GeometryInstance-aa75b4cf.js → GeometryInstance-451dc1cd.js} +1 -1
- package/Build/Workers/{GeometryPipeline-f0e46c42.js → GeometryPipeline-8fb0db69.js} +1 -1
- package/Build/Workers/{IntersectionTests-9de29d51.js → IntersectionTests-27d49265.js} +1 -1
- package/Build/Workers/{Matrix2-ce637455.js → Matrix2-13178034.js} +4 -2
- package/Build/Workers/{Matrix3-4f4df527.js → Matrix3-315394f6.js} +2 -1
- package/Build/Workers/{OrientedBoundingBox-d3ff3d4d.js → OrientedBoundingBox-79ee7cbb.js} +5 -5
- package/Build/Workers/{Plane-b81241c2.js → Plane-900aa728.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-6f4937bb.js → PolygonGeometryLibrary-6b5a29e9.js} +1 -1
- package/Build/Workers/PolygonPipeline-21668b3f.js +1345 -0
- package/Build/Workers/{PolylinePipeline-2e2b015c.js → PolylinePipeline-5e2e1b21.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-7ee1d449.js → PolylineVolumeGeometryLibrary-97f0b94e.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-a9b7aae0.js → PrimitivePipeline-5640850a.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-9aa6c8f6.js → RectangleGeometryLibrary-d5457f7b.js} +1 -1
- package/Build/Workers/{TerrainEncoding-b52dcfc5.js → TerrainEncoding-bfdf2021.js} +1 -1
- package/Build/Workers/{Transforms-2f755df8.js → Transforms-a05e5e6e.js} +114 -83
- package/Build/Workers/{WallGeometryLibrary-ab19a93d.js → WallGeometryLibrary-6db0ebb6.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-9f25de49.js → WebMercatorProjection-13a90d41.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +92 -2
- 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 +7 -3
- 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 +9 -1
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +25 -1
- package/Build/Workers/transcodeKTX2.js +22 -2
- package/Build/Workers/transferTypedArrayTest.js +25 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/README.md +14 -16
- package/Source/Core/EarthOrientationParameters.js +67 -63
- package/Source/Core/FeatureDetection.js +18 -0
- package/Source/Core/Ion.js +1 -2
- package/Source/Core/Matrix2.js +2 -1
- package/Source/Core/Matrix3.js +2 -1
- package/Source/Core/Matrix4.js +1 -0
- package/Source/Core/OrientedBoundingBox.js +4 -4
- package/Source/Core/PixelFormat.js +22 -2
- package/Source/Core/S2Cell.js +3 -3
- package/Source/Core/Transforms.js +3 -7
- package/Source/Core/sampleTerrain.js +5 -0
- package/Source/DataSources/GpxDataSource.js +4 -6
- package/Source/DataSources/KmlDataSource.js +3 -5
- package/Source/Renderer/AutomaticUniforms.js +3 -3
- package/Source/Renderer/Context.js +20 -12
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Renderer/ShaderBuilder.js +13 -12
- package/Source/Renderer/ShaderSource.js +31 -26
- package/Source/Renderer/demodernizeShader.js +76 -0
- package/Source/Scene/AutoExposure.js +5 -5
- package/Source/Scene/BatchTable.js +5 -5
- package/Source/Scene/BillboardCollection.js +2 -2
- package/Source/Scene/BingMapsImageryProvider.js +1 -1
- package/Source/Scene/Cesium3DTile.js +8 -2
- package/Source/Scene/Cesium3DTileBatchTable.js +28 -28
- package/Source/Scene/Cesium3DTileContentType.js +19 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +494 -0
- package/Source/Scene/Cesium3DTileset.js +6 -1
- package/Source/Scene/Cesium3DTilesetMetadata.js +2 -2
- package/Source/Scene/ClassificationPrimitive.js +3 -8
- package/Source/Scene/ContentMetadata.js +2 -2
- package/Source/Scene/DebugAppearance.js +7 -9
- package/Source/Scene/DebugInspector.js +5 -5
- package/Source/Scene/DepthPlane.js +0 -6
- package/Source/Scene/DerivedCommand.js +15 -22
- package/Source/Scene/EllipsoidPrimitive.js +0 -7
- package/Source/Scene/Expression.js +1 -1
- package/Source/Scene/Globe.js +10 -0
- package/Source/Scene/GlobeSurfaceTileProvider.js +7 -0
- package/Source/Scene/GlobeTranslucencyState.js +6 -6
- package/Source/Scene/GltfImageLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +10 -2
- package/Source/Scene/GroundPolylinePrimitive.js +2 -4
- package/Source/Scene/GroupMetadata.js +2 -2
- package/Source/Scene/ImplicitMetadataView.js +2 -2
- package/Source/Scene/ImplicitSubtreeCache.js +127 -0
- package/Source/Scene/ImplicitSubtreeMetadata.js +2 -2
- package/Source/Scene/ImplicitTileset.js +3 -2
- package/Source/Scene/InvertClassification.js +9 -10
- package/Source/Scene/KeyframeNode.js +47 -0
- package/Source/Scene/Material.js +6 -6
- package/Source/Scene/Megatexture.js +490 -0
- package/Source/Scene/MetadataClass.js +60 -25
- package/Source/Scene/MetadataClassProperty.js +132 -68
- package/Source/Scene/MetadataComponentType.js +78 -57
- package/Source/Scene/MetadataEnum.js +59 -23
- package/Source/Scene/MetadataEnumValue.js +49 -15
- package/Source/Scene/MetadataSchema.js +53 -24
- package/Source/Scene/MetadataSchemaLoader.js +2 -2
- package/Source/Scene/MetadataSemantic.js +8 -0
- package/Source/Scene/MetadataTableProperty.js +2 -2
- package/Source/Scene/MetadataType.js +6 -14
- package/Source/Scene/Model/CustomShader.js +1 -1
- package/Source/Scene/Model/FeatureIdPipelineStage.js +4 -4
- package/Source/Scene/Model/GeoJsonLoader.js +1 -1
- package/Source/Scene/Model/LightingModel.js +1 -1
- package/Source/Scene/Model/MetadataPipelineStage.js +1 -1
- package/Source/Scene/Model/Model.js +2 -3
- package/Source/Scene/Model/PickingPipelineStage.js +1 -1
- package/Source/Scene/Model/buildDrawCommand.js +19 -11
- package/Source/Scene/OIT.js +211 -119
- package/Source/Scene/PickDepth.js +2 -2
- package/Source/Scene/PointCloud.js +12 -12
- package/Source/Scene/PointCloudEyeDomeLighting.js +9 -4
- package/Source/Scene/PolylineCollection.js +2 -7
- package/Source/Scene/PolylineMaterialAppearance.js +2 -3
- package/Source/Scene/PostProcessStage.js +13 -13
- package/Source/Scene/PostProcessStageLibrary.js +3 -3
- package/Source/Scene/Primitive.js +22 -31
- package/Source/Scene/PropertyAttribute.js +2 -2
- package/Source/Scene/PropertyAttributeProperty.js +2 -2
- package/Source/Scene/PropertyTable.js +2 -2
- package/Source/Scene/PropertyTexture.js +2 -2
- package/Source/Scene/PropertyTextureProperty.js +2 -2
- package/Source/Scene/ResourceCache.js +9 -1
- package/Source/Scene/ResourceCacheKey.js +9 -1
- package/Source/Scene/Scene.js +17 -0
- package/Source/Scene/ShadowMap.js +7 -7
- package/Source/Scene/ShadowMapShader.js +9 -9
- package/Source/Scene/ShadowVolumeAppearance.js +1 -1
- package/Source/Scene/SpatialNode.js +375 -0
- package/Source/Scene/StructuralMetadata.js +2 -2
- package/Source/Scene/TextureAtlas.js +5 -3
- package/Source/Scene/TileMetadata.js +2 -2
- package/Source/Scene/TilesetMetadata.js +2 -2
- package/Source/Scene/Vector3DTilePolylines.js +1 -1
- package/Source/Scene/Vector3DTilePrimitive.js +2 -2
- package/Source/Scene/VoxelBoxShape.js +527 -0
- package/Source/Scene/VoxelContent.js +169 -0
- package/Source/Scene/VoxelCylinderShape.js +937 -0
- package/Source/Scene/VoxelEllipsoidShape.js +945 -0
- package/Source/Scene/VoxelPrimitive.js +1919 -0
- package/Source/Scene/VoxelProvider.js +255 -0
- package/Source/Scene/VoxelRenderResources.js +224 -0
- package/Source/Scene/VoxelShape.js +152 -0
- package/Source/Scene/VoxelShapeType.js +105 -0
- package/Source/Scene/VoxelTraversal.js +1144 -0
- package/Source/Scene/buildVoxelDrawCommands.js +116 -0
- package/Source/Scene/computeFlyToLocationForRectangle.js +10 -1
- package/Source/Scene/createElevationBandMaterial.js +10 -15
- package/Source/Scene/getClipAndStyleCode.js +1 -1
- package/Source/Scene/getClippingFunction.js +3 -3
- package/Source/Scene/parseBatchTable.js +18 -2
- package/Source/Scene/preprocess3DTileContent.js +8 -0
- package/Source/Scene/processVoxelProperties.js +455 -0
- package/Source/Shaders/AdjustTranslucentFS.glsl +9 -6
- package/Source/Shaders/AdjustTranslucentFS.js +9 -6
- package/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl +7 -7
- package/Source/Shaders/Appearances/AllMaterialAppearanceFS.js +7 -7
- package/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl +12 -12
- package/Source/Shaders/Appearances/AllMaterialAppearanceVS.js +12 -12
- package/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl +4 -4
- package/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js +4 -4
- package/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl +6 -6
- package/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js +6 -6
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl +5 -5
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js +5 -5
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl +7 -7
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js +7 -7
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +4 -4
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js +4 -4
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl +8 -8
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js +8 -8
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +2 -2
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js +2 -2
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl +5 -5
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js +5 -5
- package/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +10 -10
- package/Source/Shaders/Appearances/PolylineColorAppearanceVS.js +10 -10
- package/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +12 -12
- package/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js +12 -12
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl +5 -5
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js +5 -5
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl +8 -8
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js +8 -8
- package/Source/Shaders/BillboardCollectionFS.glsl +15 -15
- package/Source/Shaders/BillboardCollectionFS.js +15 -15
- package/Source/Shaders/BillboardCollectionVS.glsl +24 -24
- package/Source/Shaders/BillboardCollectionVS.js +24 -24
- package/Source/Shaders/BrdfLutGeneratorFS.glsl +2 -2
- package/Source/Shaders/BrdfLutGeneratorFS.js +2 -2
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passVoxels.js +11 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +19 -15
- package/Source/Shaders/Builtin/Functions/depthClamp.glsl +3 -3
- package/Source/Shaders/Builtin/Functions/depthClamp.js +3 -3
- package/Source/Shaders/Builtin/Functions/getWaterNoise.glsl +4 -4
- package/Source/Shaders/Builtin/Functions/getWaterNoise.js +4 -4
- package/Source/Shaders/Builtin/Functions/phong.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/phong.js +1 -1
- package/Source/Shaders/Builtin/Functions/readDepth.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/readDepth.js +1 -1
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +5 -5
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +5 -5
- package/Source/Shaders/Builtin/Functions/shadowDepthCompare.glsl +3 -3
- package/Source/Shaders/Builtin/Functions/shadowDepthCompare.js +3 -3
- package/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js +1 -1
- package/Source/Shaders/Builtin/Functions/textureCube.glsl +17 -0
- package/Source/Shaders/Builtin/Functions/textureCube.js +18 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +2 -2
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +2 -2
- package/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl +2 -2
- package/Source/Shaders/Builtin/Functions/vertexLogDepth.js +2 -2
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +55 -43
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +55 -43
- package/Source/Shaders/Builtin/Functions/writeDepthClamp.glsl +5 -8
- package/Source/Shaders/Builtin/Functions/writeDepthClamp.js +5 -8
- package/Source/Shaders/Builtin/Functions/writeLogDepth.glsl +6 -6
- package/Source/Shaders/Builtin/Functions/writeLogDepth.js +6 -6
- package/Source/Shaders/CloudCollectionFS.glsl +18 -18
- package/Source/Shaders/CloudCollectionFS.js +18 -18
- package/Source/Shaders/CloudCollectionVS.glsl +11 -11
- package/Source/Shaders/CloudCollectionVS.js +11 -11
- package/Source/Shaders/CloudNoiseFS.glsl +5 -5
- package/Source/Shaders/CloudNoiseFS.js +5 -5
- package/Source/Shaders/CloudNoiseVS.glsl +2 -2
- package/Source/Shaders/CloudNoiseVS.js +2 -2
- package/Source/Shaders/CompareAndPackTranslucentDepth.glsl +4 -4
- package/Source/Shaders/CompareAndPackTranslucentDepth.js +4 -4
- package/Source/Shaders/CompositeOITFS.glsl +6 -6
- package/Source/Shaders/CompositeOITFS.js +6 -6
- package/Source/Shaders/DepthPlaneFS.glsl +2 -2
- package/Source/Shaders/DepthPlaneFS.js +2 -2
- package/Source/Shaders/DepthPlaneVS.glsl +2 -2
- package/Source/Shaders/DepthPlaneVS.js +2 -2
- package/Source/Shaders/EllipsoidFS.glsl +5 -13
- package/Source/Shaders/EllipsoidFS.js +6 -14
- package/Source/Shaders/EllipsoidVS.glsl +2 -2
- package/Source/Shaders/EllipsoidVS.js +2 -2
- package/Source/Shaders/FXAA3_11.glsl +4 -4
- package/Source/Shaders/FXAA3_11.js +4 -4
- package/Source/Shaders/GlobeFS.glsl +17 -16
- package/Source/Shaders/GlobeFS.js +17 -16
- package/Source/Shaders/GlobeVS.glsl +17 -17
- package/Source/Shaders/GlobeVS.js +17 -17
- package/Source/Shaders/Materials/AspectRampMaterial.glsl +1 -1
- package/Source/Shaders/Materials/AspectRampMaterial.js +1 -1
- package/Source/Shaders/Materials/BumpMapMaterial.glsl +3 -3
- package/Source/Shaders/Materials/BumpMapMaterial.js +3 -3
- package/Source/Shaders/Materials/ElevationBandMaterial.glsl +3 -3
- package/Source/Shaders/Materials/ElevationBandMaterial.js +3 -3
- package/Source/Shaders/Materials/ElevationContourMaterial.glsl +2 -1
- package/Source/Shaders/Materials/ElevationContourMaterial.js +2 -1
- package/Source/Shaders/Materials/ElevationRampMaterial.glsl +1 -1
- package/Source/Shaders/Materials/ElevationRampMaterial.js +1 -1
- package/Source/Shaders/Materials/GridMaterial.glsl +3 -2
- package/Source/Shaders/Materials/GridMaterial.js +3 -2
- package/Source/Shaders/Materials/NormalMapMaterial.glsl +1 -1
- package/Source/Shaders/Materials/NormalMapMaterial.js +1 -1
- package/Source/Shaders/Materials/PolylineArrowMaterial.glsl +3 -2
- package/Source/Shaders/Materials/PolylineArrowMaterial.js +3 -2
- package/Source/Shaders/Materials/PolylineDashMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineDashMaterial.js +1 -1
- package/Source/Shaders/Materials/PolylineOutlineMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineOutlineMaterial.js +1 -1
- package/Source/Shaders/Materials/SlopeRampMaterial.glsl +1 -1
- package/Source/Shaders/Materials/SlopeRampMaterial.js +1 -1
- package/Source/Shaders/Materials/Water.glsl +1 -1
- package/Source/Shaders/Materials/Water.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +3 -3
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +3 -3
- package/Source/Shaders/Model/MaterialStageFS.glsl +10 -10
- package/Source/Shaders/Model/MaterialStageFS.js +10 -10
- package/Source/Shaders/Model/ModelClippingPlanesStageFS.glsl +3 -3
- package/Source/Shaders/Model/ModelClippingPlanesStageFS.js +3 -3
- package/Source/Shaders/Model/ModelFS.glsl +1 -1
- package/Source/Shaders/Model/ModelFS.js +1 -1
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +3 -3
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +3 -3
- package/Source/Shaders/Model/SelectedFeatureIdStageCommon.glsl +1 -1
- package/Source/Shaders/Model/SelectedFeatureIdStageCommon.js +1 -1
- package/Source/Shaders/OctahedralProjectionAtlasFS.glsl +8 -8
- package/Source/Shaders/OctahedralProjectionAtlasFS.js +8 -8
- package/Source/Shaders/OctahedralProjectionFS.glsl +4 -4
- package/Source/Shaders/OctahedralProjectionFS.js +4 -4
- package/Source/Shaders/OctahedralProjectionVS.glsl +3 -3
- package/Source/Shaders/OctahedralProjectionVS.js +3 -3
- package/Source/Shaders/PointPrimitiveCollectionFS.glsl +6 -6
- package/Source/Shaders/PointPrimitiveCollectionFS.js +6 -6
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +17 -14
- package/Source/Shaders/PointPrimitiveCollectionVS.js +17 -14
- package/Source/Shaders/PolylineFS.glsl +3 -3
- package/Source/Shaders/PolylineFS.js +3 -3
- package/Source/Shaders/PolylineShadowVolumeFS.glsl +12 -16
- package/Source/Shaders/PolylineShadowVolumeFS.js +12 -16
- package/Source/Shaders/PolylineShadowVolumeMorphFS.glsl +8 -8
- package/Source/Shaders/PolylineShadowVolumeMorphFS.js +8 -8
- package/Source/Shaders/PolylineShadowVolumeMorphVS.glsl +20 -20
- package/Source/Shaders/PolylineShadowVolumeMorphVS.js +20 -20
- package/Source/Shaders/PolylineShadowVolumeVS.glsl +20 -20
- package/Source/Shaders/PolylineShadowVolumeVS.js +20 -20
- package/Source/Shaders/PolylineVS.glsl +17 -17
- package/Source/Shaders/PolylineVS.js +17 -17
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.js +4 -4
- package/Source/Shaders/PostProcessStages/AdditiveBlend.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AdditiveBlend.js +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +4 -4
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +4 -4
- package/Source/Shaders/PostProcessStages/BlackAndWhite.glsl +4 -4
- package/Source/Shaders/PostProcessStages/BlackAndWhite.js +4 -4
- package/Source/Shaders/PostProcessStages/BloomComposite.glsl +5 -5
- package/Source/Shaders/PostProcessStages/BloomComposite.js +5 -5
- package/Source/Shaders/PostProcessStages/BrightPass.glsl +3 -3
- package/Source/Shaders/PostProcessStages/BrightPass.js +3 -3
- package/Source/Shaders/PostProcessStages/Brightness.glsl +3 -3
- package/Source/Shaders/PostProcessStages/Brightness.js +3 -3
- package/Source/Shaders/PostProcessStages/CompositeTranslucentClassification.glsl +5 -5
- package/Source/Shaders/PostProcessStages/CompositeTranslucentClassification.js +5 -5
- package/Source/Shaders/PostProcessStages/ContrastBias.glsl +3 -3
- package/Source/Shaders/PostProcessStages/ContrastBias.js +3 -3
- package/Source/Shaders/PostProcessStages/DepthOfField.glsl +2 -2
- package/Source/Shaders/PostProcessStages/DepthOfField.js +2 -2
- package/Source/Shaders/PostProcessStages/DepthView.glsl +2 -2
- package/Source/Shaders/PostProcessStages/DepthView.js +2 -2
- package/Source/Shaders/PostProcessStages/DepthViewPacked.glsl +3 -3
- package/Source/Shaders/PostProcessStages/DepthViewPacked.js +3 -3
- package/Source/Shaders/PostProcessStages/EdgeDetection.glsl +7 -7
- package/Source/Shaders/PostProcessStages/EdgeDetection.js +7 -7
- package/Source/Shaders/PostProcessStages/FXAA.glsl +3 -3
- package/Source/Shaders/PostProcessStages/FXAA.js +3 -3
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.glsl +4 -4
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.js +4 -4
- package/Source/Shaders/PostProcessStages/GaussianBlur1D.glsl +5 -5
- package/Source/Shaders/PostProcessStages/GaussianBlur1D.js +5 -5
- package/Source/Shaders/PostProcessStages/LensFlare.glsl +13 -13
- package/Source/Shaders/PostProcessStages/LensFlare.js +13 -13
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl +4 -4
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js +4 -4
- package/Source/Shaders/PostProcessStages/NightVision.glsl +3 -3
- package/Source/Shaders/PostProcessStages/NightVision.js +3 -3
- package/Source/Shaders/PostProcessStages/PassThrough.glsl +2 -2
- package/Source/Shaders/PostProcessStages/PassThrough.js +2 -2
- package/Source/Shaders/PostProcessStages/PassThroughDepth.glsl +2 -2
- package/Source/Shaders/PostProcessStages/PassThroughDepth.js +2 -2
- package/Source/Shaders/PostProcessStages/PointCloudEyeDomeLighting.glsl +7 -9
- package/Source/Shaders/PostProcessStages/PointCloudEyeDomeLighting.js +8 -10
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl +4 -4
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.js +4 -4
- package/Source/Shaders/PostProcessStages/Silhouette.glsl +4 -4
- package/Source/Shaders/PostProcessStages/Silhouette.js +4 -4
- package/Source/Shaders/ReprojectWebMercatorFS.glsl +2 -2
- package/Source/Shaders/ReprojectWebMercatorFS.js +2 -2
- package/Source/Shaders/ReprojectWebMercatorVS.glsl +3 -3
- package/Source/Shaders/ReprojectWebMercatorVS.js +3 -3
- package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +19 -23
- package/Source/Shaders/ShadowVolumeAppearanceFS.js +20 -24
- package/Source/Shaders/ShadowVolumeAppearanceVS.glsl +12 -12
- package/Source/Shaders/ShadowVolumeAppearanceVS.js +12 -12
- package/Source/Shaders/ShadowVolumeFS.glsl +2 -6
- package/Source/Shaders/ShadowVolumeFS.js +3 -7
- package/Source/Shaders/SkyAtmosphereFS.glsl +6 -6
- package/Source/Shaders/SkyAtmosphereFS.js +6 -6
- package/Source/Shaders/SkyAtmosphereVS.glsl +6 -6
- package/Source/Shaders/SkyAtmosphereVS.js +6 -6
- package/Source/Shaders/SkyBoxFS.glsl +3 -3
- package/Source/Shaders/SkyBoxFS.js +3 -3
- package/Source/Shaders/SkyBoxVS.glsl +2 -2
- package/Source/Shaders/SkyBoxVS.js +2 -2
- package/Source/Shaders/SunFS.glsl +3 -3
- package/Source/Shaders/SunFS.js +3 -3
- package/Source/Shaders/SunTextureFS.glsl +2 -2
- package/Source/Shaders/SunTextureFS.js +2 -2
- package/Source/Shaders/SunVS.glsl +2 -2
- package/Source/Shaders/SunVS.js +2 -2
- package/Source/Shaders/Vector3DTileClampedPolylinesFS.glsl +9 -13
- package/Source/Shaders/Vector3DTileClampedPolylinesFS.js +9 -13
- package/Source/Shaders/Vector3DTileClampedPolylinesVS.glsl +12 -12
- package/Source/Shaders/Vector3DTileClampedPolylinesVS.js +12 -12
- package/Source/Shaders/Vector3DTilePolylinesVS.glsl +5 -5
- package/Source/Shaders/Vector3DTilePolylinesVS.js +5 -5
- package/Source/Shaders/VectorTileVS.glsl +2 -2
- package/Source/Shaders/VectorTileVS.js +2 -2
- package/Source/Shaders/ViewportQuadFS.glsl +2 -2
- package/Source/Shaders/ViewportQuadFS.js +2 -2
- package/Source/Shaders/ViewportQuadVS.glsl +3 -3
- package/Source/Shaders/ViewportQuadVS.js +3 -3
- package/Source/Shaders/Voxels/IntersectBox.glsl +79 -0
- package/Source/Shaders/Voxels/IntersectBox.js +81 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +70 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +72 -0
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +273 -0
- package/Source/Shaders/Voxels/IntersectCylinder.js +275 -0
- package/Source/Shaders/Voxels/IntersectDepth.glsl +23 -0
- package/Source/Shaders/Voxels/IntersectDepth.js +25 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +347 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +349 -0
- package/Source/Shaders/Voxels/Intersection.glsl +54 -0
- package/Source/Shaders/Voxels/Intersection.js +56 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +151 -0
- package/Source/Shaders/Voxels/IntersectionUtils.js +153 -0
- package/Source/Shaders/Voxels/Megatexture.glsl +136 -0
- package/Source/Shaders/Voxels/Megatexture.js +138 -0
- package/Source/Shaders/Voxels/Octree.glsl +221 -0
- package/Source/Shaders/Voxels/Octree.js +223 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +150 -0
- package/Source/Shaders/Voxels/VoxelFS.js +152 -0
- package/Source/Shaders/Voxels/VoxelVS.glsl +11 -0
- package/Source/Shaders/Voxels/VoxelVS.js +13 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +16 -0
- package/Source/Shaders/Voxels/convertUvToBox.js +18 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +75 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.js +77 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +130 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +132 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -0
- package/Source/WorkersES6/decodeDraco.js +9 -1
- package/index.d.ts +3148 -2297
- package/index.js +1118 -1085
- package/package.json +3 -4
- package/Build/Workers/PolygonPipeline-774a8aaf.js +0 -1341
- package/Source/Renderer/modernizeShader.js +0 -242
|
@@ -517,13 +517,13 @@ Cesium3DTileBatchTable.prototype.getVertexShaderCallback = function (
|
|
|
517
517
|
newMain +=
|
|
518
518
|
`${
|
|
519
519
|
"uniform sampler2D tile_batchTexture; \n" +
|
|
520
|
-
"
|
|
521
|
-
"
|
|
520
|
+
"out vec4 tile_featureColor; \n" +
|
|
521
|
+
"out vec2 tile_featureSt; \n" +
|
|
522
522
|
"void main() \n" +
|
|
523
523
|
"{ \n" +
|
|
524
524
|
" vec2 st = computeSt("
|
|
525
525
|
}${batchIdAttributeName}); \n` +
|
|
526
|
-
` vec4 featureProperties =
|
|
526
|
+
` vec4 featureProperties = texture(tile_batchTexture, st); \n` +
|
|
527
527
|
` tile_color(featureProperties); \n` +
|
|
528
528
|
` float show = ceil(featureProperties.a); \n` + // 0 - false, non-zero - true
|
|
529
529
|
` gl_Position *= show; \n`; // Per-feature show/hide
|
|
@@ -553,7 +553,7 @@ Cesium3DTileBatchTable.prototype.getVertexShaderCallback = function (
|
|
|
553
553
|
// When VTF is not supported, color blend mode MIX will look incorrect due to the feature's color not being available in the vertex shader
|
|
554
554
|
newMain =
|
|
555
555
|
`${
|
|
556
|
-
"
|
|
556
|
+
"out vec2 tile_featureSt; \n" +
|
|
557
557
|
"void main() \n" +
|
|
558
558
|
"{ \n" +
|
|
559
559
|
" tile_color(vec4(1.0)); \n" +
|
|
@@ -578,22 +578,22 @@ function getDefaultShader(source, applyHighlight) {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
// The color blend mode is intended for the RGB channels so alpha is always just multiplied.
|
|
581
|
-
//
|
|
581
|
+
// out_FragColor is multiplied by the tile color only when tile_colorBlend is 0.0 (highlight)
|
|
582
582
|
return (
|
|
583
583
|
`${source}uniform float tile_colorBlend; \n` +
|
|
584
584
|
`void tile_color(vec4 tile_featureColor) \n` +
|
|
585
585
|
`{ \n` +
|
|
586
586
|
` tile_main(); \n` +
|
|
587
587
|
` tile_featureColor = czm_gammaCorrect(tile_featureColor); \n` +
|
|
588
|
-
`
|
|
588
|
+
` out_FragColor.a *= tile_featureColor.a; \n` +
|
|
589
589
|
` float highlight = ceil(tile_colorBlend); \n` +
|
|
590
|
-
`
|
|
590
|
+
` out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n` +
|
|
591
591
|
`} \n`
|
|
592
592
|
);
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
function replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName) {
|
|
596
|
-
const functionCall = `
|
|
596
|
+
const functionCall = `texture(${diffuseAttributeOrUniformName}`;
|
|
597
597
|
|
|
598
598
|
let fromIndex = 0;
|
|
599
599
|
let startIndex = source.indexOf(functionCall, fromIndex);
|
|
@@ -668,12 +668,12 @@ function modifyDiffuse(source, diffuseAttributeOrUniformName, applyHighlight) {
|
|
|
668
668
|
"} \n";
|
|
669
669
|
|
|
670
670
|
// The color blend mode is intended for the RGB channels so alpha is always just multiplied.
|
|
671
|
-
//
|
|
671
|
+
// out_FragColor is multiplied by the tile color only when tile_colorBlend is 0.0 (highlight)
|
|
672
672
|
const highlight =
|
|
673
673
|
" tile_featureColor = czm_gammaCorrect(tile_featureColor); \n" +
|
|
674
|
-
"
|
|
674
|
+
" out_FragColor.a *= tile_featureColor.a; \n" +
|
|
675
675
|
" float highlight = ceil(tile_colorBlend); \n" +
|
|
676
|
-
"
|
|
676
|
+
" out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n";
|
|
677
677
|
|
|
678
678
|
let setColor;
|
|
679
679
|
if (type === "vec3" || type === "vec4") {
|
|
@@ -691,8 +691,8 @@ function modifyDiffuse(source, diffuseAttributeOrUniformName, applyHighlight) {
|
|
|
691
691
|
` tile_main(); \n`;
|
|
692
692
|
} else if (type === "sampler2D") {
|
|
693
693
|
// Handles any number of nested parentheses
|
|
694
|
-
// E.g.
|
|
695
|
-
// E.g.
|
|
694
|
+
// E.g. texture(u_diffuse, uv)
|
|
695
|
+
// E.g. texture(u_diffuse, computeUV(index))
|
|
696
696
|
source = replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName);
|
|
697
697
|
setColor =
|
|
698
698
|
" tile_diffuse = tile_featureColor; \n" + " tile_main(); \n";
|
|
@@ -727,14 +727,14 @@ Cesium3DTileBatchTable.prototype.getFragmentShaderCallback = function (
|
|
|
727
727
|
// When VTF is supported, per-feature show/hide already happened in the fragment shader
|
|
728
728
|
source +=
|
|
729
729
|
"uniform sampler2D tile_pickTexture; \n" +
|
|
730
|
-
"
|
|
731
|
-
"
|
|
730
|
+
"in vec2 tile_featureSt; \n" +
|
|
731
|
+
"in vec4 tile_featureColor; \n" +
|
|
732
732
|
"void main() \n" +
|
|
733
733
|
"{ \n" +
|
|
734
734
|
" tile_color(tile_featureColor); \n";
|
|
735
735
|
|
|
736
736
|
if (hasPremultipliedAlpha) {
|
|
737
|
-
source += "
|
|
737
|
+
source += " out_FragColor.rgb *= out_FragColor.a; \n";
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
source += "}";
|
|
@@ -745,10 +745,10 @@ Cesium3DTileBatchTable.prototype.getFragmentShaderCallback = function (
|
|
|
745
745
|
source +=
|
|
746
746
|
"uniform sampler2D tile_pickTexture; \n" +
|
|
747
747
|
"uniform sampler2D tile_batchTexture; \n" +
|
|
748
|
-
"
|
|
748
|
+
"in vec2 tile_featureSt; \n" +
|
|
749
749
|
"void main() \n" +
|
|
750
750
|
"{ \n" +
|
|
751
|
-
" vec4 featureProperties =
|
|
751
|
+
" vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); \n" +
|
|
752
752
|
" if (featureProperties.a == 0.0) { \n" + // show: alpha == 0 - false, non-zeo - true
|
|
753
753
|
" discard; \n" +
|
|
754
754
|
" } \n";
|
|
@@ -775,7 +775,7 @@ Cesium3DTileBatchTable.prototype.getFragmentShaderCallback = function (
|
|
|
775
775
|
source += " tile_color(featureProperties); \n";
|
|
776
776
|
|
|
777
777
|
if (hasPremultipliedAlpha) {
|
|
778
|
-
source += "
|
|
778
|
+
source += " out_FragColor.rgb *= out_FragColor.a; \n";
|
|
779
779
|
}
|
|
780
780
|
|
|
781
781
|
source += "} \n";
|
|
@@ -794,28 +794,28 @@ Cesium3DTileBatchTable.prototype.getClassificationFragmentShaderCallback = funct
|
|
|
794
794
|
// When VTF is supported, per-feature show/hide already happened in the fragment shader
|
|
795
795
|
source +=
|
|
796
796
|
"uniform sampler2D tile_pickTexture;\n" +
|
|
797
|
-
"
|
|
798
|
-
"
|
|
797
|
+
"in vec2 tile_featureSt; \n" +
|
|
798
|
+
"in vec4 tile_featureColor; \n" +
|
|
799
799
|
"void main() \n" +
|
|
800
800
|
"{ \n" +
|
|
801
801
|
" tile_main(); \n" +
|
|
802
|
-
"
|
|
803
|
-
"
|
|
802
|
+
" out_FragColor = tile_featureColor; \n" +
|
|
803
|
+
" out_FragColor.rgb *= out_FragColor.a; \n" +
|
|
804
804
|
"}";
|
|
805
805
|
} else {
|
|
806
806
|
source +=
|
|
807
807
|
"uniform sampler2D tile_batchTexture; \n" +
|
|
808
808
|
"uniform sampler2D tile_pickTexture;\n" +
|
|
809
|
-
"
|
|
809
|
+
"in vec2 tile_featureSt; \n" +
|
|
810
810
|
"void main() \n" +
|
|
811
811
|
"{ \n" +
|
|
812
812
|
" tile_main(); \n" +
|
|
813
|
-
" vec4 featureProperties =
|
|
813
|
+
" vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); \n" +
|
|
814
814
|
" if (featureProperties.a == 0.0) { \n" + // show: alpha == 0 - false, non-zero - true
|
|
815
815
|
" discard; \n" +
|
|
816
816
|
" } \n" +
|
|
817
|
-
"
|
|
818
|
-
"
|
|
817
|
+
" out_FragColor = featureProperties; \n" +
|
|
818
|
+
" out_FragColor.rgb *= out_FragColor.a; \n" +
|
|
819
819
|
"} \n";
|
|
820
820
|
}
|
|
821
821
|
return source;
|
|
@@ -875,7 +875,7 @@ Cesium3DTileBatchTable.prototype.getUniformMapCallback = function () {
|
|
|
875
875
|
};
|
|
876
876
|
|
|
877
877
|
Cesium3DTileBatchTable.prototype.getPickId = function () {
|
|
878
|
-
return "
|
|
878
|
+
return "texture(tile_pickTexture, tile_featureSt)";
|
|
879
879
|
};
|
|
880
880
|
|
|
881
881
|
///////////////////////////////////////////////////////////////////////////
|
|
@@ -132,6 +132,24 @@ const Cesium3DTileContentType = {
|
|
|
132
132
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
133
133
|
*/
|
|
134
134
|
GEOJSON: "geoJson",
|
|
135
|
+
/**
|
|
136
|
+
* Binary voxel content for <code>3DTILES_content_voxels</code> extension.
|
|
137
|
+
*
|
|
138
|
+
* @type {String}
|
|
139
|
+
* @constant
|
|
140
|
+
* @private
|
|
141
|
+
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
142
|
+
*/
|
|
143
|
+
VOXEL_BINARY: "voxl",
|
|
144
|
+
/**
|
|
145
|
+
* Binary voxel content for <code>3DTILES_content_voxels</code> extension.
|
|
146
|
+
*
|
|
147
|
+
* @type {String}
|
|
148
|
+
* @constant
|
|
149
|
+
* @private
|
|
150
|
+
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
151
|
+
*/
|
|
152
|
+
VOXEL_JSON: "voxelJson",
|
|
135
153
|
};
|
|
136
154
|
|
|
137
155
|
/**
|
|
@@ -150,6 +168,7 @@ Cesium3DTileContentType.isBinaryFormat = function (contentType) {
|
|
|
150
168
|
case Cesium3DTileContentType.VECTOR:
|
|
151
169
|
case Cesium3DTileContentType.GEOMETRY:
|
|
152
170
|
case Cesium3DTileContentType.IMPLICIT_SUBTREE:
|
|
171
|
+
case Cesium3DTileContentType.VOXEL_BINARY:
|
|
153
172
|
case Cesium3DTileContentType.GLTF_BINARY:
|
|
154
173
|
return true;
|
|
155
174
|
default:
|
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
2
|
+
import Check from "../Core/Check.js";
|
|
3
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
4
|
+
import defined from "../Core/defined.js";
|
|
5
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
6
|
+
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
7
|
+
import Matrix4 from "../Core/Matrix4.js";
|
|
8
|
+
import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
|
|
9
|
+
import Resource from "../Core/Resource.js";
|
|
10
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
11
|
+
import Cesium3DTilesetMetadata from "./Cesium3DTilesetMetadata.js";
|
|
12
|
+
import hasExtension from "./hasExtension.js";
|
|
13
|
+
import ImplicitSubtree from "./ImplicitSubtree.js";
|
|
14
|
+
import ImplicitSubtreeCache from "./ImplicitSubtreeCache.js";
|
|
15
|
+
import ImplicitTileCoordinates from "./ImplicitTileCoordinates.js";
|
|
16
|
+
import ImplicitTileset from "./ImplicitTileset.js";
|
|
17
|
+
import MetadataSemantic from "./MetadataSemantic.js";
|
|
18
|
+
import MetadataType from "./MetadataType.js";
|
|
19
|
+
import preprocess3DTileContent from "./preprocess3DTileContent.js";
|
|
20
|
+
import ResourceCache from "./ResourceCache.js";
|
|
21
|
+
import VoxelBoxShape from "./VoxelBoxShape.js";
|
|
22
|
+
import VoxelContent from "./VoxelContent.js";
|
|
23
|
+
import VoxelCylinderShape from "./VoxelCylinderShape.js";
|
|
24
|
+
import VoxelShapeType from "./VoxelShapeType.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A {@link VoxelProvider} that fetches voxel data from a 3D Tiles tileset.
|
|
28
|
+
* <p>
|
|
29
|
+
* Implements the {@link VoxelProvider} interface.
|
|
30
|
+
* </p>
|
|
31
|
+
*
|
|
32
|
+
* @alias Cesium3DTilesVoxelProvider
|
|
33
|
+
* @constructor
|
|
34
|
+
* @augments VoxelProvider
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} options Object with the following properties:
|
|
37
|
+
* @param {Resource|String|Promise<Resource>|Promise<String>} options.url The URL to a tileset JSON file.
|
|
38
|
+
*
|
|
39
|
+
* @see VoxelProvider
|
|
40
|
+
* @see VoxelPrimitive
|
|
41
|
+
* @see VoxelShapeType
|
|
42
|
+
*
|
|
43
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
44
|
+
*/
|
|
45
|
+
function Cesium3DTilesVoxelProvider(options) {
|
|
46
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
47
|
+
//>>includeStart('debug', pragmas.debug)
|
|
48
|
+
Check.defined("options.url", options.url);
|
|
49
|
+
//>>includeEnd('debug');
|
|
50
|
+
|
|
51
|
+
/** @inheritdoc */
|
|
52
|
+
this.ready = false;
|
|
53
|
+
|
|
54
|
+
/** @inheritdoc */
|
|
55
|
+
this.shapeTransform = undefined;
|
|
56
|
+
|
|
57
|
+
/** @inheritdoc */
|
|
58
|
+
this.globalTransform = undefined;
|
|
59
|
+
|
|
60
|
+
/** @inheritdoc */
|
|
61
|
+
this.shape = undefined;
|
|
62
|
+
|
|
63
|
+
/** @inheritdoc */
|
|
64
|
+
this.minBounds = undefined;
|
|
65
|
+
|
|
66
|
+
/** @inheritdoc */
|
|
67
|
+
this.maxBounds = undefined;
|
|
68
|
+
|
|
69
|
+
/** @inheritdoc */
|
|
70
|
+
this.dimensions = undefined;
|
|
71
|
+
|
|
72
|
+
/** @inheritdoc */
|
|
73
|
+
this.paddingBefore = undefined;
|
|
74
|
+
|
|
75
|
+
/** @inheritdoc */
|
|
76
|
+
this.paddingAfter = undefined;
|
|
77
|
+
|
|
78
|
+
/** @inheritdoc */
|
|
79
|
+
this.names = undefined;
|
|
80
|
+
|
|
81
|
+
/** @inheritdoc */
|
|
82
|
+
this.types = undefined;
|
|
83
|
+
|
|
84
|
+
/** @inheritdoc */
|
|
85
|
+
this.componentTypes = undefined;
|
|
86
|
+
|
|
87
|
+
/** @inheritdoc */
|
|
88
|
+
this.minimumValues = undefined;
|
|
89
|
+
|
|
90
|
+
/** @inheritdoc */
|
|
91
|
+
this.maximumValues = undefined;
|
|
92
|
+
|
|
93
|
+
/** @inheritdoc */
|
|
94
|
+
this.maximumTileCount = undefined;
|
|
95
|
+
|
|
96
|
+
this._implicitTileset = undefined;
|
|
97
|
+
this._subtreeCache = new ImplicitSubtreeCache();
|
|
98
|
+
|
|
99
|
+
const that = this;
|
|
100
|
+
let tilesetJson;
|
|
101
|
+
|
|
102
|
+
this._readyPromise = Promise.resolve(options.url).then(function (url) {
|
|
103
|
+
const resource = Resource.createIfNeeded(url);
|
|
104
|
+
return resource
|
|
105
|
+
.fetchJson()
|
|
106
|
+
.then(function (tileset) {
|
|
107
|
+
tilesetJson = tileset;
|
|
108
|
+
validate(tilesetJson);
|
|
109
|
+
return getMetadataSchemaLoader(tilesetJson, resource).promise;
|
|
110
|
+
})
|
|
111
|
+
.then(function (schemaLoader) {
|
|
112
|
+
const root = tilesetJson.root;
|
|
113
|
+
const voxel = root.content.extensions["3DTILES_content_voxels"];
|
|
114
|
+
const className = voxel.class;
|
|
115
|
+
|
|
116
|
+
const metadataJson = hasExtension(tilesetJson, "3DTILES_metadata")
|
|
117
|
+
? tilesetJson.extensions["3DTILES_metadata"]
|
|
118
|
+
: tilesetJson;
|
|
119
|
+
|
|
120
|
+
const metadataSchema = schemaLoader.schema;
|
|
121
|
+
const metadata = new Cesium3DTilesetMetadata({
|
|
122
|
+
metadataJson: metadataJson,
|
|
123
|
+
schema: metadataSchema,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
addAttributeInfo(that, metadata, className);
|
|
127
|
+
|
|
128
|
+
const implicitTileset = new ImplicitTileset(
|
|
129
|
+
resource,
|
|
130
|
+
root,
|
|
131
|
+
metadataSchema
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const {
|
|
135
|
+
shape,
|
|
136
|
+
minBounds,
|
|
137
|
+
maxBounds,
|
|
138
|
+
shapeTransform,
|
|
139
|
+
globalTransform,
|
|
140
|
+
} = getShape(root);
|
|
141
|
+
|
|
142
|
+
that.shape = shape;
|
|
143
|
+
that.minBounds = minBounds;
|
|
144
|
+
that.maxBounds = maxBounds;
|
|
145
|
+
that.dimensions = Cartesian3.unpack(voxel.dimensions);
|
|
146
|
+
that.shapeTransform = shapeTransform;
|
|
147
|
+
that.globalTransform = globalTransform;
|
|
148
|
+
that.maximumTileCount = getTileCount(metadata);
|
|
149
|
+
|
|
150
|
+
let paddingBefore;
|
|
151
|
+
let paddingAfter;
|
|
152
|
+
|
|
153
|
+
if (defined(voxel.padding)) {
|
|
154
|
+
paddingBefore = Cartesian3.unpack(voxel.padding.before);
|
|
155
|
+
paddingAfter = Cartesian3.unpack(voxel.padding.after);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
that.paddingBefore = paddingBefore;
|
|
159
|
+
that.paddingAfter = paddingAfter;
|
|
160
|
+
|
|
161
|
+
that._implicitTileset = implicitTileset;
|
|
162
|
+
|
|
163
|
+
ResourceCache.unload(schemaLoader);
|
|
164
|
+
|
|
165
|
+
that.ready = true;
|
|
166
|
+
return that;
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
172
|
+
/** @inheritdoc */
|
|
173
|
+
readyPromise: {
|
|
174
|
+
get: function () {
|
|
175
|
+
return this._readyPromise;
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
function getTileCount(metadata) {
|
|
181
|
+
if (!defined(metadata.tileset)) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return metadata.tileset.getPropertyBySemantic(
|
|
186
|
+
MetadataSemantic.TILESET_TILE_COUNT
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function validate(tileset) {
|
|
191
|
+
const root = tileset.root;
|
|
192
|
+
|
|
193
|
+
if (!defined(root.content)) {
|
|
194
|
+
throw new RuntimeError("Root must have content");
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (!hasExtension(root.content, "3DTILES_content_voxels")) {
|
|
198
|
+
throw new RuntimeError(
|
|
199
|
+
"Root tile content must have 3DTILES_content_voxels extension"
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (
|
|
204
|
+
!hasExtension(root, "3DTILES_implicit_tiling") &&
|
|
205
|
+
!defined(root.implicitTiling)
|
|
206
|
+
) {
|
|
207
|
+
throw new RuntimeError("Root tile must have implicit tiling");
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (
|
|
211
|
+
!defined(tileset.schema) &&
|
|
212
|
+
!defined(tileset.schemaUri) &&
|
|
213
|
+
!hasExtension(tileset, "3DTILES_metadata")
|
|
214
|
+
) {
|
|
215
|
+
throw new RuntimeError("Tileset must have a metadata schema");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function getShape(tile) {
|
|
220
|
+
const boundingVolume = tile.boundingVolume;
|
|
221
|
+
|
|
222
|
+
let tileTransform;
|
|
223
|
+
if (defined(tile.transform)) {
|
|
224
|
+
tileTransform = Matrix4.unpack(tile.transform);
|
|
225
|
+
} else {
|
|
226
|
+
tileTransform = Matrix4.clone(Matrix4.IDENTITY);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (defined(boundingVolume.box)) {
|
|
230
|
+
return getBoxShape(boundingVolume.box, tileTransform);
|
|
231
|
+
} else if (defined(boundingVolume.region)) {
|
|
232
|
+
return getEllipsoidShape(boundingVolume.region);
|
|
233
|
+
} else if (hasExtension(boundingVolume, "3DTILES_bounding_volume_cylinder")) {
|
|
234
|
+
return getCylinderShape(
|
|
235
|
+
boundingVolume.extensions["3DTILES_bounding_volume_cylinder"].cylinder,
|
|
236
|
+
tileTransform
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
throw new RuntimeError(
|
|
241
|
+
"Only box, region and 3DTILES_bounding_volume_cylinder are supported in Cesium3DTilesVoxelProvider"
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function getEllipsoidShape(region) {
|
|
246
|
+
const west = region[0];
|
|
247
|
+
const south = region[1];
|
|
248
|
+
const east = region[2];
|
|
249
|
+
const north = region[3];
|
|
250
|
+
const minHeight = region[4];
|
|
251
|
+
const maxHeight = region[5];
|
|
252
|
+
|
|
253
|
+
const shapeTransform = Matrix4.fromScale(Ellipsoid.WGS84.radii);
|
|
254
|
+
|
|
255
|
+
const minBoundsX = west;
|
|
256
|
+
const maxBoundsX = east;
|
|
257
|
+
const minBoundsY = south;
|
|
258
|
+
const maxBoundsY = north;
|
|
259
|
+
const minBoundsZ = minHeight;
|
|
260
|
+
const maxBoundsZ = maxHeight;
|
|
261
|
+
|
|
262
|
+
const minBounds = new Cartesian3(minBoundsX, minBoundsY, minBoundsZ);
|
|
263
|
+
const maxBounds = new Cartesian3(maxBoundsX, maxBoundsY, maxBoundsZ);
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
shape: VoxelShapeType.ELLIPSOID,
|
|
267
|
+
minBounds: minBounds,
|
|
268
|
+
maxBounds: maxBounds,
|
|
269
|
+
shapeTransform: shapeTransform,
|
|
270
|
+
globalTransform: Matrix4.clone(Matrix4.IDENTITY),
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function getBoxShape(box, tileTransform) {
|
|
275
|
+
const obb = OrientedBoundingBox.unpack(box);
|
|
276
|
+
const shapeTransform = Matrix4.fromRotationTranslation(
|
|
277
|
+
obb.halfAxes,
|
|
278
|
+
obb.center
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
return {
|
|
282
|
+
shape: VoxelShapeType.BOX,
|
|
283
|
+
minBounds: Cartesian3.clone(VoxelBoxShape.DefaultMinBounds),
|
|
284
|
+
maxBounds: Cartesian3.clone(VoxelBoxShape.DefaultMaxBounds),
|
|
285
|
+
shapeTransform: shapeTransform,
|
|
286
|
+
globalTransform: tileTransform,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function getCylinderShape(cylinder, tileTransform) {
|
|
291
|
+
const obb = OrientedBoundingBox.unpack(cylinder);
|
|
292
|
+
const shapeTransform = Matrix4.fromRotationTranslation(
|
|
293
|
+
obb.halfAxes,
|
|
294
|
+
obb.center
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
return {
|
|
298
|
+
shape: VoxelShapeType.CYLINDER,
|
|
299
|
+
minBounds: Cartesian3.clone(VoxelCylinderShape.DefaultMinBounds),
|
|
300
|
+
maxBounds: Cartesian3.clone(VoxelCylinderShape.DefaultMaxBounds),
|
|
301
|
+
shapeTransform: shapeTransform,
|
|
302
|
+
globalTransform: tileTransform,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function getMetadataSchemaLoader(tilesetJson, resource) {
|
|
307
|
+
const { schemaUri, schema } = tilesetJson;
|
|
308
|
+
if (!defined(schemaUri)) {
|
|
309
|
+
return ResourceCache.loadSchema({ schema });
|
|
310
|
+
}
|
|
311
|
+
return ResourceCache.loadSchema({
|
|
312
|
+
resource: resource.getDerivedResource({
|
|
313
|
+
url: schemaUri,
|
|
314
|
+
}),
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function addAttributeInfo(provider, metadata, className) {
|
|
319
|
+
const { schema, statistics } = metadata;
|
|
320
|
+
const classStatistics = statistics?.classes[className];
|
|
321
|
+
const properties = schema.classes[className].properties;
|
|
322
|
+
|
|
323
|
+
const propertyInfo = Object.entries(properties).map(([id, property]) => {
|
|
324
|
+
const { type, componentType } = property;
|
|
325
|
+
const min = classStatistics?.properties[id].min;
|
|
326
|
+
const max = classStatistics?.properties[id].max;
|
|
327
|
+
const componentCount = MetadataType.getComponentCount(type);
|
|
328
|
+
const minValue = copyArray(min, componentCount);
|
|
329
|
+
const maxValue = copyArray(max, componentCount);
|
|
330
|
+
|
|
331
|
+
return { id, type, componentType, minValue, maxValue };
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
provider.names = propertyInfo.map((info) => info.id);
|
|
335
|
+
provider.types = propertyInfo.map((info) => info.type);
|
|
336
|
+
provider.componentTypes = propertyInfo.map((info) => info.componentType);
|
|
337
|
+
|
|
338
|
+
const minimumValues = propertyInfo.map((info) => info.minValue);
|
|
339
|
+
const maximumValues = propertyInfo.map((info) => info.maxValue);
|
|
340
|
+
const hasMinimumValues = minimumValues.some(defined);
|
|
341
|
+
|
|
342
|
+
provider.minimumValues = hasMinimumValues ? minimumValues : undefined;
|
|
343
|
+
provider.maximumValues = hasMinimumValues ? maximumValues : undefined;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function copyArray(values, length) {
|
|
347
|
+
// Copy input values into a new array of a specified length.
|
|
348
|
+
// If the input is not an array, its value will be copied into the first element
|
|
349
|
+
// of the returned array. If the input is an array shorter than the returned
|
|
350
|
+
// array, the extra elements in the returned array will be undefined. If the
|
|
351
|
+
// input is undefined, the return will be undefined.
|
|
352
|
+
if (!defined(values)) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const valuesArray = Array.isArray(values) ? values : [values];
|
|
356
|
+
return Array.from({ length }, (v, i) => valuesArray[i]);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function getVoxelPromise(implicitTileset, tileCoordinates) {
|
|
360
|
+
const voxelRelative = implicitTileset.contentUriTemplates[0].getDerivedResource(
|
|
361
|
+
{
|
|
362
|
+
templateValues: tileCoordinates.getTemplateValues(),
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
const voxelResource = implicitTileset.baseResource.getDerivedResource({
|
|
366
|
+
url: voxelRelative.url,
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
return voxelResource.fetchArrayBuffer().then(function (arrayBuffer) {
|
|
370
|
+
const preprocessed = preprocess3DTileContent(arrayBuffer);
|
|
371
|
+
|
|
372
|
+
const voxelContent = new VoxelContent(
|
|
373
|
+
voxelResource,
|
|
374
|
+
preprocessed.jsonPayload,
|
|
375
|
+
preprocessed.binaryPayload,
|
|
376
|
+
implicitTileset.metadataSchema
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
return voxelContent.readyPromise;
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function getSubtreePromise(provider, subtreeCoord) {
|
|
384
|
+
const implicitTileset = provider._implicitTileset;
|
|
385
|
+
const subtreeCache = provider._subtreeCache;
|
|
386
|
+
|
|
387
|
+
// First load the subtree to check if the tile is available.
|
|
388
|
+
// If the subtree has been requested previously it might still be in the cache
|
|
389
|
+
const subtree = subtreeCache.find(subtreeCoord);
|
|
390
|
+
if (defined(subtree)) {
|
|
391
|
+
return subtree.readyPromise;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const subtreeRelative = implicitTileset.subtreeUriTemplate.getDerivedResource(
|
|
395
|
+
{
|
|
396
|
+
templateValues: subtreeCoord.getTemplateValues(),
|
|
397
|
+
}
|
|
398
|
+
);
|
|
399
|
+
const subtreeResource = implicitTileset.baseResource.getDerivedResource({
|
|
400
|
+
url: subtreeRelative.url,
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
return subtreeResource.fetchArrayBuffer().then(function (arrayBuffer) {
|
|
404
|
+
// Check one more time if the subtree is in the cache.
|
|
405
|
+
// This could happen if there are two in-flight tile requests from the same
|
|
406
|
+
// subtree and one finishes before the other.
|
|
407
|
+
let subtree = subtreeCache.find(subtreeCoord);
|
|
408
|
+
if (defined(subtree)) {
|
|
409
|
+
return subtree.readyPromise;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const preprocessed = preprocess3DTileContent(arrayBuffer);
|
|
413
|
+
subtree = new ImplicitSubtree(
|
|
414
|
+
subtreeResource,
|
|
415
|
+
preprocessed.jsonPayload,
|
|
416
|
+
preprocessed.binaryPayload,
|
|
417
|
+
implicitTileset,
|
|
418
|
+
subtreeCoord
|
|
419
|
+
);
|
|
420
|
+
subtreeCache.addSubtree(subtree);
|
|
421
|
+
return subtree.readyPromise;
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** @inheritdoc */
|
|
426
|
+
Cesium3DTilesVoxelProvider.prototype.requestData = function (options) {
|
|
427
|
+
//>>includeStart('debug', pragmas.debug);
|
|
428
|
+
if (!this.ready) {
|
|
429
|
+
throw new DeveloperError(
|
|
430
|
+
"The provider is not ready. Use Cesium3DTilesVoxelProvider.readyPromise or wait for Cesium3DTilesVoxelProvider.ready to be true."
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
//>>includeEnd('debug');
|
|
434
|
+
|
|
435
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
436
|
+
const tileLevel = defaultValue(options.tileLevel, 0);
|
|
437
|
+
const tileX = defaultValue(options.tileX, 0);
|
|
438
|
+
const tileY = defaultValue(options.tileY, 0);
|
|
439
|
+
const tileZ = defaultValue(options.tileZ, 0);
|
|
440
|
+
const keyframe = defaultValue(options.keyframe, 0);
|
|
441
|
+
|
|
442
|
+
// 3D Tiles currently doesn't support time-dynamic data.
|
|
443
|
+
if (keyframe !== 0) {
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// 1. Load the subtree that the tile belongs to (possibly from the subtree cache)
|
|
448
|
+
// 2. Load the voxel content if available
|
|
449
|
+
|
|
450
|
+
const implicitTileset = this._implicitTileset;
|
|
451
|
+
const names = this.names;
|
|
452
|
+
|
|
453
|
+
// Can't use a scratch variable here because the object is used inside the promise chain.
|
|
454
|
+
const tileCoordinates = new ImplicitTileCoordinates({
|
|
455
|
+
subdivisionScheme: implicitTileset.subdivisionScheme,
|
|
456
|
+
subtreeLevels: implicitTileset.subtreeLevels,
|
|
457
|
+
level: tileLevel,
|
|
458
|
+
x: tileX,
|
|
459
|
+
y: tileY,
|
|
460
|
+
z: tileZ,
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// Find the coordinates of the parent subtree containing tileCoordinates
|
|
464
|
+
// If tileCoordinates is a subtree child, use that subtree
|
|
465
|
+
// If tileCoordinates is a subtree root, use its parent subtree
|
|
466
|
+
const isSubtreeRoot =
|
|
467
|
+
tileCoordinates.isSubtreeRoot() && tileCoordinates.level > 0;
|
|
468
|
+
|
|
469
|
+
const subtreeCoord = isSubtreeRoot
|
|
470
|
+
? tileCoordinates.getParentSubtreeCoordinates()
|
|
471
|
+
: tileCoordinates.getSubtreeCoordinates();
|
|
472
|
+
|
|
473
|
+
const that = this;
|
|
474
|
+
|
|
475
|
+
return getSubtreePromise(that, subtreeCoord)
|
|
476
|
+
.then(function (subtree) {
|
|
477
|
+
const available = isSubtreeRoot
|
|
478
|
+
? subtree.childSubtreeIsAvailableAtCoordinates(tileCoordinates)
|
|
479
|
+
: subtree.tileIsAvailableAtCoordinates(tileCoordinates);
|
|
480
|
+
|
|
481
|
+
if (!available) {
|
|
482
|
+
return Promise.reject("Tile is not available");
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return getVoxelPromise(implicitTileset, tileCoordinates);
|
|
486
|
+
})
|
|
487
|
+
.then(function (voxelContent) {
|
|
488
|
+
return names.map(function (name) {
|
|
489
|
+
return voxelContent.metadataTable.getPropertyTypedArray(name);
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
export default Cesium3DTilesVoxelProvider;
|