@cesium/engine 22.2.0 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-YFEZPDAY.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-A3NUMZBG.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-3JB2X2PR.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-VSZ5DB2W.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-PSHZAHFE.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-AMWXJ5A7.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-LDSQMLRC.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-MSTAVM2N.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-IWOSJVFQ.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-PMDPP22G.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-DIJ7IG5D.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-L2FSBEW2.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-G6WQA27G.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-3HUEBDFC.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-GMHDOQPH.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-7CDQUIP5.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-IVN5HSOI.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-72LZ3FN6.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-UBJYWGMV.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-VGH2CSC7.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-ED4UXMYY.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-JFN2DQHY.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-JERDRSEI.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-NY3CWLIZ.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-O3GWUTWM.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-64PJ4MTB.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-FPRM6PCE.js → chunk-IFA7VHHP.js} +560 -306
- package/Build/Workers/{chunk-FM5XPC2E.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-P7ISUYLW.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-JONWM4IO.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-JUOSYFXT.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-MWGB6DLR.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-C6FTHSJA.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-WH4HDRGN.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-4ZQN7M7E.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-SDUH3N6G.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-7OPRTZBT.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-CQCEPC6N.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-35J4D6PX.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-I45CATZK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-7MGTX4WP.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-DCR62BCO.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-XPNY2VY3.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-4I7BCCNU.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-2JNPWPLE.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-K64RQCRK.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-K6BXEBAF.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-2YVTOY5Z.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-4MCPC4TE.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-C35SJ4QP.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-BKYJBTHW.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-I4D5IP46.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-QO6Z5UJE.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-ZUWF63QU.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-N5MNKWED.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-V26Y7ZQL.js → chunk-ZIW5FCIW.js} +37 -27
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +20 -12
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/BoxGeometry.js +1 -1
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/CornerType.js +1 -1
- package/Source/Core/CorridorGeometry.js +1 -1
- package/Source/Core/FeatureDetection.js +1 -32
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/IntersectionTests.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/PinBuilder.js +1 -1
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometry.js +1 -1
- package/Source/Core/RectangleGeometry.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +4 -8
- package/Source/Core/TerrainMesh.js +11 -8
- package/Source/Core/TerrainPicker.js +24 -7
- package/Source/Core/VideoSynchronizer.js +1 -1
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Core/writeTextToCanvas.js +40 -86
- package/Source/DataSources/BillboardGraphics.js +1 -1
- package/Source/DataSources/BoxGraphics.js +1 -1
- package/Source/DataSources/CallbackPositionProperty.js +1 -1
- package/Source/DataSources/CorridorGraphics.js +1 -1
- package/Source/DataSources/CzmlDataSource.js +1 -1
- package/Source/DataSources/EllipseGraphics.js +1 -1
- package/Source/DataSources/EllipsoidGraphics.js +1 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/EntityCluster.js +2 -2
- package/Source/DataSources/GeoJsonDataSource.js +2 -2
- package/Source/DataSources/GpxDataSource.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -1
- package/Source/DataSources/KmlTour.js +1 -1
- package/Source/DataSources/LabelGraphics.js +1 -1
- package/Source/DataSources/ModelGraphics.js +1 -1
- package/Source/DataSources/PlaneGraphics.js +1 -1
- package/Source/DataSources/PolygonGraphics.js +1 -1
- package/Source/DataSources/PolylineGraphics.js +1 -1
- package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
- package/Source/DataSources/RectangleGraphics.js +1 -1
- package/Source/DataSources/WallGraphics.js +1 -1
- package/Source/DataSources/exportKml.js +1 -1
- package/Source/Renderer/Context.js +11 -10
- package/Source/Renderer/ContextLimits.js +66 -33
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Renderer/ShaderSource.js +19 -18
- package/Source/Renderer/Texture.js +1 -1
- package/Source/Renderer/Texture3D.js +166 -7
- package/Source/Renderer/TextureAtlas.js +2 -2
- package/Source/Scene/Appearance.js +1 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +8 -5
- package/Source/Scene/BillboardCollection.js +65 -26
- package/Source/Scene/BillboardTexture.js +4 -1
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/Camera.js +13 -2
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/CloudCollection.js +2 -2
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/CumulusCloud.js +1 -1
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/Fog.js +1 -1
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +907 -168
- package/Source/Scene/Globe.js +3 -10
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +323 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/ImageBasedLighting.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +2 -2
- package/Source/Scene/ImageryProvider.js +2 -2
- package/Source/Scene/Label.js +7 -5
- package/Source/Scene/LabelCollection.js +60 -2
- package/Source/Scene/Material.js +1 -1
- package/Source/Scene/MaterialAppearance.js +1 -1
- package/Source/Scene/Megatexture.js +174 -242
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/ModelComponents.js +10 -0
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/ParticleSystem.js +2 -2
- package/Source/Scene/PointPrimitive.js +1 -1
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/Polyline.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -4
- package/Source/Scene/PolylineColorAppearance.js +1 -6
- package/Source/Scene/PolylineMaterialAppearance.js +1 -6
- package/Source/Scene/PostProcessStageCollection.js +1 -1
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/QuadtreePrimitive.js +6 -3
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/ShadowMap.js +1 -2
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
- package/Source/Scene/Vector3DTilePolylines.js +1 -5
- package/Source/Scene/VoxelPrimitive.js +16 -33
- package/Source/Scene/VoxelRenderResources.js +1 -8
- package/Source/Scene/VoxelTraversal.js +16 -61
- package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Scene/processVoxelProperties.js +1 -1
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +9 -1
- package/Source/Shaders/Model/ModelFS.js +9 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -2
- package/Source/Shaders/Model/ModelVS.js +4 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
- package/Source/Shaders/Voxels/Megatexture.js +15 -83
- package/Source/Shaders/Voxels/Octree.glsl +6 -9
- package/Source/Shaders/Voxels/Octree.js +6 -9
- package/Source/Widget/CesiumWidget.js +1 -1
- package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
- package/index.d.ts +582 -193
- package/index.js +91 -83
- package/package.json +2 -1
- package/Build/Workers/chunk-ZGWX2R5I.js +0 -1443
|
@@ -4,7 +4,6 @@ import ComponentDatatype from "../Core/ComponentDatatype.js";
|
|
|
4
4
|
import defined from "../Core/defined.js";
|
|
5
5
|
import destroyObject from "../Core/destroyObject.js";
|
|
6
6
|
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
7
|
-
import FeatureDetection from "../Core/FeatureDetection.js";
|
|
8
7
|
import IndexDatatype from "../Core/IndexDatatype.js";
|
|
9
8
|
import Matrix4 from "../Core/Matrix4.js";
|
|
10
9
|
import Rectangle from "../Core/Rectangle.js";
|
|
@@ -456,10 +455,7 @@ function createShaders(primitive, context) {
|
|
|
456
455
|
)(PolylineFS);
|
|
457
456
|
|
|
458
457
|
const vs = new ShaderSource({
|
|
459
|
-
defines: [
|
|
460
|
-
"VECTOR_TILE",
|
|
461
|
-
!FeatureDetection.isInternetExplorer() ? "CLIP_POLYLINE" : "",
|
|
462
|
-
],
|
|
458
|
+
defines: ["VECTOR_TILE", "CLIP_POLYLINE"],
|
|
463
459
|
sources: [PolylineCommon, vsSource],
|
|
464
460
|
});
|
|
465
461
|
const fs = new ShaderSource({
|
|
@@ -405,11 +405,7 @@ function VoxelPrimitive(options) {
|
|
|
405
405
|
octreeLeafNodeTilesPerRow: 0,
|
|
406
406
|
octreeLeafNodeTexelSizeUv: new Cartesian2(),
|
|
407
407
|
megatextureTextures: [],
|
|
408
|
-
|
|
409
|
-
megatextureTileDimensions: new Cartesian2(),
|
|
410
|
-
megatextureVoxelSizeUv: new Cartesian2(),
|
|
411
|
-
megatextureSliceSizeUv: new Cartesian2(),
|
|
412
|
-
megatextureTileSizeUv: new Cartesian2(),
|
|
408
|
+
megatextureTileCounts: new Cartesian3(),
|
|
413
409
|
dimensions: new Cartesian3(),
|
|
414
410
|
inputDimensions: new Cartesian3(),
|
|
415
411
|
paddingBefore: new Cartesian3(),
|
|
@@ -855,10 +851,7 @@ Object.defineProperties(VoxelPrimitive.prototype, {
|
|
|
855
851
|
Check.typeOf.bool("nearestSampling", nearestSampling);
|
|
856
852
|
//>>includeEnd('debug');
|
|
857
853
|
|
|
858
|
-
|
|
859
|
-
this._nearestSampling = nearestSampling;
|
|
860
|
-
this._shaderDirty = true;
|
|
861
|
-
}
|
|
854
|
+
this._nearestSampling = nearestSampling;
|
|
862
855
|
},
|
|
863
856
|
},
|
|
864
857
|
|
|
@@ -1282,6 +1275,7 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1282
1275
|
);
|
|
1283
1276
|
uniforms.stepSize = this._stepSizeMultiplier;
|
|
1284
1277
|
|
|
1278
|
+
updateNearestSampling(this);
|
|
1285
1279
|
updateRenderBoundPlanes(this, frameState);
|
|
1286
1280
|
|
|
1287
1281
|
// Render the primitive
|
|
@@ -1294,6 +1288,13 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1294
1288
|
frameState.commandList.push(command);
|
|
1295
1289
|
};
|
|
1296
1290
|
|
|
1291
|
+
function updateNearestSampling(primitive) {
|
|
1292
|
+
const { megatextures } = primitive._traversal;
|
|
1293
|
+
for (let i = 0; i < megatextures.length; ++i) {
|
|
1294
|
+
megatextures[i].nearestSampling = primitive._nearestSampling;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1297
1298
|
function updateRenderBoundPlanes(primitive, frameState) {
|
|
1298
1299
|
const uniforms = primitive._uniforms;
|
|
1299
1300
|
const { renderBoundPlanes } = primitive._shape;
|
|
@@ -1689,33 +1690,15 @@ function setTraversalUniforms(traversal, uniforms) {
|
|
|
1689
1690
|
);
|
|
1690
1691
|
uniforms.octreeInternalNodeTilesPerRow = traversal.internalNodeTilesPerRow;
|
|
1691
1692
|
|
|
1692
|
-
const megatextures = traversal
|
|
1693
|
+
const { megatextures } = traversal;
|
|
1693
1694
|
const megatexture = megatextures[0];
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
for (let i = 0; i < megatextureLength; i++) {
|
|
1695
|
+
uniforms.megatextureTextures = new Array(megatextures.length);
|
|
1696
|
+
for (let i = 0; i < megatextures.length; i++) {
|
|
1697
1697
|
uniforms.megatextureTextures[i] = megatextures[i].texture;
|
|
1698
1698
|
}
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
uniforms.megatextureSliceDimensions,
|
|
1703
|
-
);
|
|
1704
|
-
uniforms.megatextureTileDimensions = Cartesian2.clone(
|
|
1705
|
-
megatexture.regionCountPerMegatexture,
|
|
1706
|
-
uniforms.megatextureTileDimensions,
|
|
1707
|
-
);
|
|
1708
|
-
uniforms.megatextureVoxelSizeUv = Cartesian2.clone(
|
|
1709
|
-
megatexture.voxelSizeUv,
|
|
1710
|
-
uniforms.megatextureVoxelSizeUv,
|
|
1711
|
-
);
|
|
1712
|
-
uniforms.megatextureSliceSizeUv = Cartesian2.clone(
|
|
1713
|
-
megatexture.sliceSizeUv,
|
|
1714
|
-
uniforms.megatextureSliceSizeUv,
|
|
1715
|
-
);
|
|
1716
|
-
uniforms.megatextureTileSizeUv = Cartesian2.clone(
|
|
1717
|
-
megatexture.regionSizeUv,
|
|
1718
|
-
uniforms.megatextureTileSizeUv,
|
|
1699
|
+
uniforms.megatextureTileCounts = Cartesian3.clone(
|
|
1700
|
+
megatexture.tileCounts,
|
|
1701
|
+
uniforms.megatextureTileCounts,
|
|
1719
1702
|
);
|
|
1720
1703
|
}
|
|
1721
1704
|
|
|
@@ -62,7 +62,7 @@ function VoxelRenderResources(primitive) {
|
|
|
62
62
|
// The reason this uniform is added by shader builder is because some of the
|
|
63
63
|
// dynamically generated shader code reads from it.
|
|
64
64
|
shaderBuilder.addUniform(
|
|
65
|
-
"
|
|
65
|
+
"sampler3D",
|
|
66
66
|
"u_megatextureTextures[METADATA_COUNT]",
|
|
67
67
|
ShaderDestination.FRAGMENT,
|
|
68
68
|
);
|
|
@@ -241,13 +241,6 @@ function VoxelRenderResources(primitive) {
|
|
|
241
241
|
ShaderDestination.FRAGMENT,
|
|
242
242
|
);
|
|
243
243
|
}
|
|
244
|
-
if (primitive._nearestSampling) {
|
|
245
|
-
shaderBuilder.addDefine(
|
|
246
|
-
"NEAREST_SAMPLING",
|
|
247
|
-
undefined,
|
|
248
|
-
ShaderDestination.FRAGMENT,
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
244
|
const traversal = primitive._traversal;
|
|
252
245
|
shaderBuilder.addDefine(
|
|
253
246
|
"SAMPLE_COUNT",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Cartesian2 from "../Core/Cartesian2.js";
|
|
2
|
-
import Cartesian3 from "../Core/Cartesian3.js";
|
|
3
2
|
import CesiumMath from "../Core/Math.js";
|
|
4
3
|
import CullingVolume from "../Core/CullingVolume.js";
|
|
5
4
|
import defined from "../Core/defined.js";
|
|
@@ -16,7 +15,6 @@ import SpatialNode from "./SpatialNode.js";
|
|
|
16
15
|
import Texture from "../Renderer/Texture.js";
|
|
17
16
|
import TextureMagnificationFilter from "../Renderer/TextureMagnificationFilter.js";
|
|
18
17
|
import TextureMinificationFilter from "../Renderer/TextureMinificationFilter.js";
|
|
19
|
-
import VoxelMetadataOrder from "./VoxelMetadataOrder.js";
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* Handles tileset traversal, tile requests, and GPU resources. Intended to be
|
|
@@ -28,7 +26,7 @@ import VoxelMetadataOrder from "./VoxelMetadataOrder.js";
|
|
|
28
26
|
* @param {VoxelPrimitive} primitive The voxel primitive for which this traversal will be used.
|
|
29
27
|
* @param {Context} context The context in which to create GPU resources.
|
|
30
28
|
* @param {number} keyframeCount The number of keyframes in the tileset.
|
|
31
|
-
* @param {number} [maximumTextureMemoryByteLength] The maximum amount of memory to use for textures.
|
|
29
|
+
* @param {number} [maximumTextureMemoryByteLength=536870912] The maximum amount of memory to use for textures.
|
|
32
30
|
*
|
|
33
31
|
* @private
|
|
34
32
|
*/
|
|
@@ -38,32 +36,16 @@ function VoxelTraversal(
|
|
|
38
36
|
keyframeCount,
|
|
39
37
|
maximumTextureMemoryByteLength,
|
|
40
38
|
) {
|
|
41
|
-
const { provider, dimensions,
|
|
42
|
-
const { types, componentTypes
|
|
39
|
+
const { provider, dimensions, inputDimensions } = primitive;
|
|
40
|
+
const { types, componentTypes } = provider;
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
Cartesian3.add(inputDimensions, paddingAfter, inputDimensions);
|
|
50
|
-
|
|
51
|
-
if (metadataOrder === VoxelMetadataOrder.Y_UP) {
|
|
52
|
-
const inputDimensionsY = inputDimensions.y;
|
|
53
|
-
inputDimensions.y = inputDimensions.z;
|
|
54
|
-
inputDimensions.z = inputDimensionsY;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
!defined(maximumTextureMemoryByteLength) &&
|
|
59
|
-
defined(provider.maximumTileCount)
|
|
60
|
-
) {
|
|
61
|
-
maximumTextureMemoryByteLength = getApproximateTextureMemoryByteLength(
|
|
62
|
-
provider.maximumTileCount,
|
|
63
|
-
inputDimensions,
|
|
64
|
-
types,
|
|
65
|
-
componentTypes,
|
|
42
|
+
if (defined(maximumTextureMemoryByteLength)) {
|
|
43
|
+
maximumTextureMemoryByteLength = Math.min(
|
|
44
|
+
Math.max(0, maximumTextureMemoryByteLength),
|
|
45
|
+
512 * 1024 * 1024,
|
|
66
46
|
);
|
|
47
|
+
} else {
|
|
48
|
+
maximumTextureMemoryByteLength = 128 * 1024 * 1024;
|
|
67
49
|
}
|
|
68
50
|
|
|
69
51
|
/**
|
|
@@ -84,7 +66,12 @@ function VoxelTraversal(
|
|
|
84
66
|
*/
|
|
85
67
|
this.megatextures = new Array(types.length);
|
|
86
68
|
|
|
87
|
-
|
|
69
|
+
const providerTileCount = defined(provider.maximumTileCount)
|
|
70
|
+
? provider.maximumTileCount
|
|
71
|
+
: defined(provider.availableLevels)
|
|
72
|
+
? (8 ** provider.availableLevels - 1) / 7
|
|
73
|
+
: undefined;
|
|
74
|
+
|
|
88
75
|
for (let i = 0; i < types.length; i++) {
|
|
89
76
|
const type = types[i];
|
|
90
77
|
const componentCount = MetadataType.getComponentCount(type);
|
|
@@ -96,6 +83,7 @@ function VoxelTraversal(
|
|
|
96
83
|
componentCount,
|
|
97
84
|
componentType,
|
|
98
85
|
maximumTextureMemoryByteLength,
|
|
86
|
+
providerTileCount,
|
|
99
87
|
);
|
|
100
88
|
|
|
101
89
|
this.textureMemoryByteLength +=
|
|
@@ -1228,37 +1216,4 @@ function copyToLeafNodeTexture(data, texelsPerTile, tilesPerRow, texture) {
|
|
|
1228
1216
|
texture.copyFrom(copyOptions);
|
|
1229
1217
|
}
|
|
1230
1218
|
|
|
1231
|
-
/**
|
|
1232
|
-
* @param {number} tileCount
|
|
1233
|
-
* @param {Cartesian3} dimensions
|
|
1234
|
-
* @param {MetadataType[]} types
|
|
1235
|
-
* @param {MetadataComponentType[]} componentTypes
|
|
1236
|
-
* @private
|
|
1237
|
-
*/
|
|
1238
|
-
function getApproximateTextureMemoryByteLength(
|
|
1239
|
-
tileCount,
|
|
1240
|
-
dimensions,
|
|
1241
|
-
types,
|
|
1242
|
-
componentTypes,
|
|
1243
|
-
) {
|
|
1244
|
-
let textureMemoryByteLength = 0;
|
|
1245
|
-
|
|
1246
|
-
const length = types.length;
|
|
1247
|
-
for (let i = 0; i < length; i++) {
|
|
1248
|
-
const type = types[i];
|
|
1249
|
-
const componentType = componentTypes[i];
|
|
1250
|
-
const componentCount = MetadataType.getComponentCount(type);
|
|
1251
|
-
|
|
1252
|
-
textureMemoryByteLength +=
|
|
1253
|
-
Megatexture.getApproximateTextureMemoryByteLength(
|
|
1254
|
-
tileCount,
|
|
1255
|
-
dimensions,
|
|
1256
|
-
componentCount,
|
|
1257
|
-
componentType,
|
|
1258
|
-
);
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
return textureMemoryByteLength;
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
1219
|
export default VoxelTraversal;
|
|
@@ -51,7 +51,7 @@ const defaultParameters = Object.freeze({
|
|
|
51
51
|
*
|
|
52
52
|
* @param {WebMapTileServiceImageryProvider.ConstructorOptions} options Object describing initialization options
|
|
53
53
|
*
|
|
54
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
54
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=web-map-tile-service-with-time|Cesium Sandcastle Web Map Tile Service with Time Demo}
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* // Example 1. USGS shaded relief tiles (KVP)
|
|
@@ -435,7 +435,7 @@ function createLayeredEntries(layers) {
|
|
|
435
435
|
* @param {createElevationBandMaterialBand[]} options.layers A list of bands ordered from lowest to highest precedence.
|
|
436
436
|
* @returns {Material} A new {@link Material} instance.
|
|
437
437
|
*
|
|
438
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
438
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=elevation-band-material|Cesium Sandcastle Elevation Band Demo}
|
|
439
439
|
*
|
|
440
440
|
* @example
|
|
441
441
|
* scene.globe.material = Cesium.createElevationBandMaterial({
|
|
@@ -6,6 +6,18 @@ import PropertyTexture from "./PropertyTexture.js";
|
|
|
6
6
|
import PropertyAttribute from "./PropertyAttribute.js";
|
|
7
7
|
import StructuralMetadata from "./StructuralMetadata.js";
|
|
8
8
|
import MetadataTable from "./MetadataTable.js";
|
|
9
|
+
import Sampler from "../Renderer/Sampler.js";
|
|
10
|
+
import Texture from "../Renderer/Texture.js";
|
|
11
|
+
import PixelFormat from "../Core/PixelFormat.js";
|
|
12
|
+
import PixelDatatype from "../Renderer/PixelDatatype.js";
|
|
13
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
14
|
+
import oneTimeWarning from "../Core/oneTimeWarning.js";
|
|
15
|
+
import TextureWrap from "../Renderer/TextureWrap.js";
|
|
16
|
+
import TextureMagnificationFilter from "../Renderer/TextureMagnificationFilter.js";
|
|
17
|
+
import TextureMinificationFilter from "../Renderer/TextureMinificationFilter.js";
|
|
18
|
+
import ContextLimits from "../Renderer/ContextLimits.js";
|
|
19
|
+
import MetadataComponentType from "./MetadataComponentType.js";
|
|
20
|
+
import MetadataType from "./MetadataType.js";
|
|
9
21
|
|
|
10
22
|
/**
|
|
11
23
|
* Parse the <code>EXT_structural_metadata</code> glTF extension to create a
|
|
@@ -16,6 +28,7 @@ import MetadataTable from "./MetadataTable.js";
|
|
|
16
28
|
* @param {MetadataSchema} options.schema The parsed schema.
|
|
17
29
|
* @param {Object<string, Uint8Array>} [options.bufferViews] An object mapping bufferView IDs to Uint8Array objects.
|
|
18
30
|
* @param {Object<string, Texture>} [options.textures] An object mapping texture IDs to {@link Texture} objects.
|
|
31
|
+
* @param {Context} [options.context] The current rendering context.
|
|
19
32
|
* @return {StructuralMetadata} A structural metadata object
|
|
20
33
|
* @private
|
|
21
34
|
* @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.
|
|
@@ -38,12 +51,20 @@ function parseStructuralMetadata(options) {
|
|
|
38
51
|
for (let i = 0; i < extension.propertyTables.length; i++) {
|
|
39
52
|
const propertyTable = extension.propertyTables[i];
|
|
40
53
|
const classDefinition = schema.classes[propertyTable.class];
|
|
54
|
+
const propertyTableTexture = createTextureForPropertyTable(
|
|
55
|
+
propertyTable,
|
|
56
|
+
options.bufferViews,
|
|
57
|
+
classDefinition,
|
|
58
|
+
options.context,
|
|
59
|
+
);
|
|
60
|
+
|
|
41
61
|
const metadataTable = new MetadataTable({
|
|
42
62
|
count: propertyTable.count,
|
|
43
63
|
properties: propertyTable.properties,
|
|
44
64
|
class: classDefinition,
|
|
45
65
|
bufferViews: options.bufferViews,
|
|
46
66
|
});
|
|
67
|
+
|
|
47
68
|
propertyTables.push(
|
|
48
69
|
new PropertyTable({
|
|
49
70
|
id: i,
|
|
@@ -52,6 +73,7 @@ function parseStructuralMetadata(options) {
|
|
|
52
73
|
metadataTable: metadataTable,
|
|
53
74
|
extras: propertyTable.extras,
|
|
54
75
|
extensions: propertyTable.extensions,
|
|
76
|
+
texture: propertyTableTexture,
|
|
55
77
|
}),
|
|
56
78
|
);
|
|
57
79
|
}
|
|
@@ -99,4 +121,226 @@ function parseStructuralMetadata(options) {
|
|
|
99
121
|
});
|
|
100
122
|
}
|
|
101
123
|
|
|
124
|
+
// Always use four channels for property table textures.
|
|
125
|
+
const NUM_CHANNELS = 4;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Creates a texture from a set of property table properties (those which are GPU compatible).
|
|
129
|
+
* Each row of the texture is a property, with each column corresponding to a given feature.
|
|
130
|
+
*
|
|
131
|
+
* @param {PropertyTable} propertyTable The property table.
|
|
132
|
+
* @param {Object<string, Uint8Array>} bufferViews An object mapping bufferView IDs to Uint8Array objects for the given property table.
|
|
133
|
+
* @param {MetadataClass} classDefinition Class defined in the schema
|
|
134
|
+
* @param {Context} context The rendering context.
|
|
135
|
+
* @returns {Texture|undefined} The created texture, or <code>undefined</code> if no properties are GPU compatible.
|
|
136
|
+
*
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
function createTextureForPropertyTable(
|
|
140
|
+
propertyTable,
|
|
141
|
+
bufferViews,
|
|
142
|
+
classDefinition,
|
|
143
|
+
context,
|
|
144
|
+
) {
|
|
145
|
+
const properties = propertyTable.properties;
|
|
146
|
+
if (!defined(properties)) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const numFeatures = propertyTable.count;
|
|
151
|
+
|
|
152
|
+
let gpuCompatiblePropertyBufferViews;
|
|
153
|
+
try {
|
|
154
|
+
gpuCompatiblePropertyBufferViews = collectGpuCompatiblePropertyBufferViews(
|
|
155
|
+
properties,
|
|
156
|
+
bufferViews,
|
|
157
|
+
classDefinition,
|
|
158
|
+
numFeatures,
|
|
159
|
+
);
|
|
160
|
+
} catch (error) {
|
|
161
|
+
console.warn(
|
|
162
|
+
`Failed to create texture for property table "${propertyTable.name}": ${error.message}`,
|
|
163
|
+
);
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const numGpuCompatibleProperties = gpuCompatiblePropertyBufferViews.length;
|
|
168
|
+
|
|
169
|
+
if (numGpuCompatibleProperties === 0) {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// In the future, we could use multiple textures if we would exceed the maximum texture size.
|
|
174
|
+
if (
|
|
175
|
+
numFeatures > ContextLimits.maximumTextureSize ||
|
|
176
|
+
numGpuCompatibleProperties > ContextLimits.maximumTextureSize
|
|
177
|
+
) {
|
|
178
|
+
oneTimeWarning(
|
|
179
|
+
"PropertyTableTextureExceedsMaximumSize",
|
|
180
|
+
`Cannot create a texture for the property table "${propertyTable.name}" because it exceeds the maximum texture size of ${ContextLimits.maximumTextureSize}.`,
|
|
181
|
+
);
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const packedBufferView = packPropertyTablePropertiesIntoRGBA8(
|
|
186
|
+
gpuCompatiblePropertyBufferViews,
|
|
187
|
+
numFeatures,
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
// Create a sampler fit for sampling raw data without mipmapping / filtering etc.
|
|
191
|
+
const sampler = new Sampler({
|
|
192
|
+
wrapS: TextureWrap.CLAMP_TO_EDGE,
|
|
193
|
+
wrapT: TextureWrap.CLAMP_TO_EDGE,
|
|
194
|
+
minificationFilter: TextureMinificationFilter.NEAREST,
|
|
195
|
+
magnificationFilter: TextureMagnificationFilter.NEAREST,
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
return Texture.create({
|
|
199
|
+
context: context,
|
|
200
|
+
pixelFormat: PixelFormat.RGBA,
|
|
201
|
+
pixelDatatype: PixelDatatype.UNSIGNED_BYTE,
|
|
202
|
+
sampler: sampler,
|
|
203
|
+
flipY: false,
|
|
204
|
+
source: {
|
|
205
|
+
width: numFeatures,
|
|
206
|
+
height: numGpuCompatibleProperties,
|
|
207
|
+
arrayBufferView: packedBufferView,
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function collectGpuCompatiblePropertyBufferViews(
|
|
213
|
+
properties,
|
|
214
|
+
bufferViews,
|
|
215
|
+
classDefinition,
|
|
216
|
+
numFeatures,
|
|
217
|
+
) {
|
|
218
|
+
const bufferViewsForThisTable = [];
|
|
219
|
+
const classProperties = classDefinition.properties;
|
|
220
|
+
|
|
221
|
+
// It's possible for a primitive in a tileset to only use a subset of the class properties defined in the schema.
|
|
222
|
+
// For instance, the Design Tiler merges classes together by default, and omits properties in primitives that aren't used.
|
|
223
|
+
// To make the default values available to the GPU, and to avoid compiling different versions of the shader for each primitive,
|
|
224
|
+
// we iterate over _all_ class properties here - not just the properties in the property table.
|
|
225
|
+
for (const [propertyId, classProperty] of Object.entries(classProperties)) {
|
|
226
|
+
// Certain properties like strings, dynamic-sized arrays, and 64-bit types cannot be represented natively on the GPU.
|
|
227
|
+
if (!classProperty.isGpuCompatible(NUM_CHANNELS)) {
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const property = properties[propertyId];
|
|
232
|
+
const bufferView = defined(property)
|
|
233
|
+
? bufferViews[property.values]
|
|
234
|
+
: createNoDataBufferView(classProperty, numFeatures);
|
|
235
|
+
|
|
236
|
+
const bufferViewLength = bufferView.length;
|
|
237
|
+
const bytesPerElement = classProperty.bytesPerElement();
|
|
238
|
+
const numBufferElements = bufferViewLength / bytesPerElement;
|
|
239
|
+
if (numBufferElements !== numFeatures) {
|
|
240
|
+
throw new RuntimeError(
|
|
241
|
+
`Property with ID: "${propertyId}" has (${numBufferElements}), which does not match number of features in the property table: (${numFeatures}).`,
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
bufferViewsForThisTable.push({
|
|
246
|
+
view: bufferView,
|
|
247
|
+
bytesPerElement: bytesPerElement,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return bufferViewsForThisTable;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* When a property is part of a tileset class schema but not used in a property table,
|
|
256
|
+
* we create a buffer view filled with the property's noData value.
|
|
257
|
+
*
|
|
258
|
+
* @param {MetadataClassProperty} classProperty The class property definition.
|
|
259
|
+
* @param {number} numFeatures The number of features in the property table.
|
|
260
|
+
*
|
|
261
|
+
* @returns {Uint8Array} A buffer view filled with the property's noData value.
|
|
262
|
+
*
|
|
263
|
+
* @private
|
|
264
|
+
*/
|
|
265
|
+
function createNoDataBufferView(classProperty, numFeatures) {
|
|
266
|
+
// noData can be a number, an array of numbers (e.g. for vecN types), or a nested array of numbers (e.g. for arrays of vecN types).
|
|
267
|
+
let noData = classProperty.noData;
|
|
268
|
+
const metadataComponentCount = MetadataType.getComponentCount(
|
|
269
|
+
classProperty.type,
|
|
270
|
+
);
|
|
271
|
+
const metadataArrayLength = classProperty.isArray
|
|
272
|
+
? classProperty.arrayLength
|
|
273
|
+
: 1;
|
|
274
|
+
|
|
275
|
+
// Special case: noData enum values are specified as strings, so we need to convert them to numbers here.
|
|
276
|
+
if (classProperty.type === MetadataType.ENUM) {
|
|
277
|
+
const enumDefinition = classProperty.enumType;
|
|
278
|
+
noData = enumDefinition.valuesByName[noData];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Wrap noData in an array (up to two times) so we can treat it uniformly in the loop below.
|
|
282
|
+
if (metadataComponentCount === 1) {
|
|
283
|
+
noData = [noData];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (metadataArrayLength === 1) {
|
|
287
|
+
noData = [noData];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const bytesPerElement = classProperty.bytesPerElement();
|
|
291
|
+
const buffer = new ArrayBuffer(bytesPerElement * numFeatures);
|
|
292
|
+
const view = new DataView(buffer);
|
|
293
|
+
const setter = MetadataComponentType.getDataViewSetter(
|
|
294
|
+
view,
|
|
295
|
+
classProperty.componentType,
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
for (let i = 0; i < numFeatures; i++) {
|
|
299
|
+
for (let j = 0; j < metadataArrayLength; j++) {
|
|
300
|
+
for (let k = 0; k < metadataComponentCount; k++) {
|
|
301
|
+
setter(bytesPerElement * i + j + k, noData[j][k]);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return new Uint8Array(buffer);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Make one big buffer view to load into the texture
|
|
310
|
+
// Since each texel is always 4 bytes (RGBA8 format), elements less than 4 bytes need to be padded (respecting little-endian order).
|
|
311
|
+
function packPropertyTablePropertiesIntoRGBA8(
|
|
312
|
+
bufferViewsForThisTable,
|
|
313
|
+
numFeatures,
|
|
314
|
+
) {
|
|
315
|
+
const numGpuCompatibleProperties = bufferViewsForThisTable.length;
|
|
316
|
+
const packedBufferView = new Uint8Array(
|
|
317
|
+
numGpuCompatibleProperties * numFeatures * NUM_CHANNELS,
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
for (let i = 0, offset = 0; i < bufferViewsForThisTable.length; i++) {
|
|
321
|
+
const bufferView = bufferViewsForThisTable[i].view;
|
|
322
|
+
const bytesPerElement = bufferViewsForThisTable[i].bytesPerElement;
|
|
323
|
+
const numElements = bufferView.length / bytesPerElement;
|
|
324
|
+
|
|
325
|
+
for (let j = 0; j < numElements; j++) {
|
|
326
|
+
const sourceOffset = j * bytesPerElement;
|
|
327
|
+
const destOffset = offset + j * NUM_CHANNELS;
|
|
328
|
+
|
|
329
|
+
packedBufferView.set(
|
|
330
|
+
bufferView.subarray(sourceOffset, sourceOffset + bytesPerElement),
|
|
331
|
+
destOffset,
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
// Pad remaining channels with 0
|
|
335
|
+
for (let k = bytesPerElement; k < NUM_CHANNELS; k++) {
|
|
336
|
+
packedBufferView[destOffset + k] = 0;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
offset += numElements * NUM_CHANNELS;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return packedBufferView;
|
|
344
|
+
}
|
|
345
|
+
|
|
102
346
|
export default parseStructuralMetadata;
|
|
@@ -294,7 +294,7 @@ function processVoxelProperties(renderResources, primitive) {
|
|
|
294
294
|
const functionId = "getPropertiesFromMegatextureAtUv";
|
|
295
295
|
shaderBuilder.addFunction(
|
|
296
296
|
functionId,
|
|
297
|
-
`${propertiesStructName} getPropertiesFromMegatextureAtUv(
|
|
297
|
+
`${propertiesStructName} getPropertiesFromMegatextureAtUv(vec3 texcoord)`,
|
|
298
298
|
ShaderDestination.FRAGMENT,
|
|
299
299
|
);
|
|
300
300
|
shaderBuilder.addFunctionLines(functionId, [
|