@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
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import Cartesian2 from "../Core/Cartesian2.js";
|
|
2
1
|
import Cartesian3 from "../Core/Cartesian3.js";
|
|
3
|
-
import
|
|
2
|
+
import Check from "../Core/Check.js";
|
|
4
3
|
import ContextLimits from "../Renderer/ContextLimits.js";
|
|
5
4
|
import defined from "../Core/defined.js";
|
|
6
5
|
import destroyObject from "../Core/destroyObject.js";
|
|
7
6
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
8
|
-
import CesiumMath from "../Core/Math.js";
|
|
9
7
|
import MetadataComponentType from "./MetadataComponentType.js";
|
|
10
8
|
import PixelDatatype from "../Renderer/PixelDatatype.js";
|
|
11
9
|
import PixelFormat from "../Core/PixelFormat.js";
|
|
12
10
|
import RuntimeError from "../Core/RuntimeError.js";
|
|
13
11
|
import Sampler from "../Renderer/Sampler.js";
|
|
14
|
-
import
|
|
12
|
+
import Texture3D from "../Renderer/Texture3D.js";
|
|
15
13
|
import TextureMagnificationFilter from "../Renderer/TextureMagnificationFilter.js";
|
|
16
14
|
import TextureMinificationFilter from "../Renderer/TextureMinificationFilter.js";
|
|
17
15
|
import TextureWrap from "../Renderer/TextureWrap.js";
|
|
@@ -26,6 +24,9 @@ import TextureWrap from "../Renderer/TextureWrap.js";
|
|
|
26
24
|
* @param {MetadataComponentType} componentType The component type of the metadata.
|
|
27
25
|
* @param {number} [availableTextureMemoryBytes=134217728] An upper limit on the texture memory size in bytes.
|
|
28
26
|
*
|
|
27
|
+
* @exception {RuntimeError} The GL context does not support a 3D texture large enough to contain a tile with the given dimensions.
|
|
28
|
+
* @exception {RuntimeError} Not enough texture memory available to create a megatexture with the given tile dimensions.
|
|
29
|
+
*
|
|
29
30
|
* @private
|
|
30
31
|
*/
|
|
31
32
|
function Megatexture(
|
|
@@ -33,52 +34,28 @@ function Megatexture(
|
|
|
33
34
|
dimensions,
|
|
34
35
|
channelCount,
|
|
35
36
|
componentType,
|
|
36
|
-
availableTextureMemoryBytes,
|
|
37
|
+
availableTextureMemoryBytes = 134217728, // 128 MB
|
|
38
|
+
tileCount,
|
|
37
39
|
) {
|
|
38
|
-
const maximumTextureMemoryByteLength = 512 * 1024 * 1024;
|
|
39
|
-
availableTextureMemoryBytes = Math.min(
|
|
40
|
-
availableTextureMemoryBytes ?? 128 * 1024 * 1024,
|
|
41
|
-
maximumTextureMemoryByteLength,
|
|
42
|
-
);
|
|
43
|
-
|
|
44
40
|
// TODO there are a lot of texture packing rules, see https://github.com/CesiumGS/cesium/issues/9572
|
|
45
|
-
// Unsigned short textures not allowed in webgl 1, so treat as float
|
|
46
|
-
if (componentType === MetadataComponentType.UNSIGNED_SHORT) {
|
|
47
|
-
componentType = MetadataComponentType.FLOAT32;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
componentType === MetadataComponentType.FLOAT32 &&
|
|
52
|
-
!context.floatingPointTexture
|
|
53
|
-
) {
|
|
54
|
-
throw new RuntimeError("Floating point texture not supported");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
41
|
const pixelDataType = getPixelDataType(componentType);
|
|
58
|
-
const pixelFormat = getPixelFormat(channelCount
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
const pixelFormat = getPixelFormat(channelCount);
|
|
43
|
+
|
|
44
|
+
const bytesPerSample =
|
|
45
|
+
channelCount * MetadataComponentType.getSizeInBytes(componentType);
|
|
46
|
+
const textureDimension = Megatexture.get3DTextureDimension(
|
|
47
|
+
dimensions,
|
|
48
|
+
bytesPerSample,
|
|
62
49
|
availableTextureMemoryBytes,
|
|
63
|
-
|
|
64
|
-
componentTypeByteLength,
|
|
50
|
+
tileCount,
|
|
65
51
|
);
|
|
66
52
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const regionCountPerMegatextureX = Math.floor(
|
|
72
|
-
textureDimension / voxelCountPerRegionX,
|
|
73
|
-
);
|
|
74
|
-
const regionCountPerMegatextureY = Math.floor(
|
|
75
|
-
textureDimension / voxelCountPerRegionY,
|
|
53
|
+
const tileCounts = Cartesian3.divideComponents(
|
|
54
|
+
textureDimension,
|
|
55
|
+
dimensions,
|
|
56
|
+
new Cartesian3(),
|
|
76
57
|
);
|
|
77
58
|
|
|
78
|
-
if (regionCountPerMegatextureX === 0 || regionCountPerMegatextureY === 0) {
|
|
79
|
-
throw new RuntimeError("Tileset is too large to fit into megatexture");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
59
|
/**
|
|
83
60
|
* @type {number}
|
|
84
61
|
* @readonly
|
|
@@ -96,87 +73,43 @@ function Megatexture(
|
|
|
96
73
|
* @readonly
|
|
97
74
|
*/
|
|
98
75
|
this.textureMemoryByteLength =
|
|
99
|
-
|
|
76
|
+
bytesPerSample *
|
|
77
|
+
textureDimension.x *
|
|
78
|
+
textureDimension.y *
|
|
79
|
+
textureDimension.z;
|
|
100
80
|
|
|
101
81
|
/**
|
|
102
82
|
* @type {Cartesian3}
|
|
103
83
|
* @readonly
|
|
104
84
|
*/
|
|
105
|
-
this.
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @type {number}
|
|
109
|
-
* @readonly
|
|
110
|
-
*/
|
|
111
|
-
this.maximumTileCount =
|
|
112
|
-
regionCountPerMegatextureX * regionCountPerMegatextureY;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @type {Cartesian2}
|
|
116
|
-
* @readonly
|
|
117
|
-
*/
|
|
118
|
-
this.regionCountPerMegatexture = new Cartesian2(
|
|
119
|
-
regionCountPerMegatextureX,
|
|
120
|
-
regionCountPerMegatextureY,
|
|
121
|
-
);
|
|
85
|
+
this.tileCounts = Cartesian3.clone(tileCounts, new Cartesian3());
|
|
122
86
|
|
|
123
87
|
/**
|
|
124
|
-
* @type {
|
|
125
|
-
* @readonly
|
|
126
|
-
*/
|
|
127
|
-
this.voxelCountPerRegion = new Cartesian2(
|
|
128
|
-
voxelCountPerRegionX,
|
|
129
|
-
voxelCountPerRegionY,
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @type {Cartesian2}
|
|
134
|
-
* @readonly
|
|
135
|
-
*/
|
|
136
|
-
this.sliceCountPerRegion = new Cartesian2(
|
|
137
|
-
sliceCountPerRegionX,
|
|
138
|
-
sliceCountPerRegionY,
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* @type {Cartesian2}
|
|
143
|
-
* @readonly
|
|
144
|
-
*/
|
|
145
|
-
this.voxelSizeUv = new Cartesian2(
|
|
146
|
-
1.0 / textureDimension,
|
|
147
|
-
1.0 / textureDimension,
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @type {Cartesian2}
|
|
88
|
+
* @type {Cartesian3}
|
|
152
89
|
* @readonly
|
|
153
90
|
*/
|
|
154
|
-
this.
|
|
155
|
-
dimensions.x / textureDimension,
|
|
156
|
-
dimensions.y / textureDimension,
|
|
157
|
-
);
|
|
91
|
+
this.voxelCountPerTile = Cartesian3.clone(dimensions, new Cartesian3());
|
|
158
92
|
|
|
159
93
|
/**
|
|
160
|
-
* @type {
|
|
94
|
+
* @type {number}
|
|
161
95
|
* @readonly
|
|
162
96
|
*/
|
|
163
|
-
this.
|
|
164
|
-
voxelCountPerRegionX / textureDimension,
|
|
165
|
-
voxelCountPerRegionY / textureDimension,
|
|
166
|
-
);
|
|
97
|
+
this.maximumTileCount = tileCounts.x * tileCounts.y * tileCounts.z;
|
|
167
98
|
|
|
168
99
|
/**
|
|
169
|
-
* @type {
|
|
100
|
+
* @type {Texture3D}
|
|
170
101
|
* @readonly
|
|
171
102
|
*/
|
|
172
|
-
this.texture = new
|
|
103
|
+
this.texture = new Texture3D({
|
|
173
104
|
context: context,
|
|
174
105
|
pixelFormat: pixelFormat,
|
|
175
106
|
pixelDatatype: pixelDataType,
|
|
176
107
|
flipY: false,
|
|
177
|
-
width: textureDimension,
|
|
178
|
-
height: textureDimension,
|
|
108
|
+
width: textureDimension.x,
|
|
109
|
+
height: textureDimension.y,
|
|
110
|
+
depth: textureDimension.z,
|
|
179
111
|
sampler: new Sampler({
|
|
112
|
+
wrapR: TextureWrap.CLAMP_TO_EDGE,
|
|
180
113
|
wrapS: TextureWrap.CLAMP_TO_EDGE,
|
|
181
114
|
wrapT: TextureWrap.CLAMP_TO_EDGE,
|
|
182
115
|
minificationFilter: TextureMinificationFilter.LINEAR,
|
|
@@ -184,17 +117,6 @@ function Megatexture(
|
|
|
184
117
|
}),
|
|
185
118
|
});
|
|
186
119
|
|
|
187
|
-
const componentDatatype =
|
|
188
|
-
MetadataComponentType.toComponentDatatype(componentType);
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* @type {Array}
|
|
192
|
-
*/
|
|
193
|
-
this.tileVoxelDataTemp = ComponentDatatype.createTypedArray(
|
|
194
|
-
componentDatatype,
|
|
195
|
-
voxelCountPerRegionX * voxelCountPerRegionY * channelCount,
|
|
196
|
-
);
|
|
197
|
-
|
|
198
120
|
/**
|
|
199
121
|
* @type {MegatextureNode[]}
|
|
200
122
|
* @readonly
|
|
@@ -229,8 +151,42 @@ function Megatexture(
|
|
|
229
151
|
* @readonly
|
|
230
152
|
*/
|
|
231
153
|
this.occupiedCount = 0;
|
|
154
|
+
|
|
155
|
+
this._nearestSampling = false;
|
|
232
156
|
}
|
|
233
157
|
|
|
158
|
+
Object.defineProperties(Megatexture.prototype, {
|
|
159
|
+
/**
|
|
160
|
+
* Gets or sets the nearest sampling flag.
|
|
161
|
+
* @type {boolean}
|
|
162
|
+
*/
|
|
163
|
+
nearestSampling: {
|
|
164
|
+
get: function () {
|
|
165
|
+
return this._nearestSampling;
|
|
166
|
+
},
|
|
167
|
+
set: function (nearestSampling) {
|
|
168
|
+
//>>includeStart('debug', pragmas.debug);
|
|
169
|
+
Check.typeOf.bool("nearestSampling", nearestSampling);
|
|
170
|
+
//>>includeEnd('debug');
|
|
171
|
+
if (this._nearestSampling === nearestSampling) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (nearestSampling) {
|
|
175
|
+
this.texture.sampler = Sampler.NEAREST;
|
|
176
|
+
} else {
|
|
177
|
+
this.texture.sampler = new Sampler({
|
|
178
|
+
wrapR: TextureWrap.CLAMP_TO_EDGE,
|
|
179
|
+
wrapS: TextureWrap.CLAMP_TO_EDGE,
|
|
180
|
+
wrapT: TextureWrap.CLAMP_TO_EDGE,
|
|
181
|
+
minificationFilter: TextureMinificationFilter.LINEAR,
|
|
182
|
+
magnificationFilter: TextureMagnificationFilter.LINEAR,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
this._nearestSampling = nearestSampling;
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
|
|
234
190
|
/**
|
|
235
191
|
* Get the pixel data type to use in a megatexture.
|
|
236
192
|
* TODO support more
|
|
@@ -255,49 +211,23 @@ function getPixelDataType(componentType) {
|
|
|
255
211
|
* Get the pixel format to use for a megatexture.
|
|
256
212
|
*
|
|
257
213
|
* @param {number} channelCount The number of channels in the metadata. Must be 1 to 4.
|
|
258
|
-
* @param {boolean} webgl2 true if the context is using webgl2
|
|
259
214
|
* @returns {PixelFormat} The pixel format to use for a megatexture.
|
|
260
215
|
*
|
|
261
216
|
* @private
|
|
262
217
|
*/
|
|
263
|
-
function getPixelFormat(channelCount
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
218
|
+
function getPixelFormat(channelCount) {
|
|
219
|
+
switch (channelCount) {
|
|
220
|
+
case 1:
|
|
221
|
+
return PixelFormat.RED;
|
|
222
|
+
case 2:
|
|
223
|
+
return PixelFormat.RG;
|
|
224
|
+
case 3:
|
|
225
|
+
return PixelFormat.RGB;
|
|
226
|
+
case 4:
|
|
227
|
+
return PixelFormat.RGBA;
|
|
272
228
|
}
|
|
273
229
|
}
|
|
274
230
|
|
|
275
|
-
/**
|
|
276
|
-
* Compute the largest size of a square texture that will fit in the available memory.
|
|
277
|
-
*
|
|
278
|
-
* @param {number} availableTextureMemoryBytes An upper limit on the texture memory size.
|
|
279
|
-
* @param {number} channelCount The number of metadata channels per texel.
|
|
280
|
-
* @param {number} componentByteLength The byte length of each component of the metadata.
|
|
281
|
-
* @returns {number} The dimension of the square texture to use for the megatexture.
|
|
282
|
-
*
|
|
283
|
-
* @private
|
|
284
|
-
*/
|
|
285
|
-
function getTextureDimension(
|
|
286
|
-
availableTextureMemoryBytes,
|
|
287
|
-
channelCount,
|
|
288
|
-
componentByteLength,
|
|
289
|
-
) {
|
|
290
|
-
// Compute how many texels will fit in the available memory
|
|
291
|
-
const texelCount = Math.floor(
|
|
292
|
-
availableTextureMemoryBytes / (channelCount * componentByteLength),
|
|
293
|
-
);
|
|
294
|
-
// Return the largest power of two texture size that will fit in memory
|
|
295
|
-
return Math.min(
|
|
296
|
-
ContextLimits.maximumTextureSize,
|
|
297
|
-
CesiumMath.previousPowerOfTwo(Math.floor(Math.sqrt(texelCount))),
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
231
|
/**
|
|
302
232
|
* @alias MegatextureNode
|
|
303
233
|
* @constructor
|
|
@@ -327,6 +257,8 @@ function MegatextureNode(index) {
|
|
|
327
257
|
* Add an array of tile metadata to the megatexture.
|
|
328
258
|
* @param {Array} data The data to be added.
|
|
329
259
|
* @returns {number} The index of the tile's location in the megatexture.
|
|
260
|
+
*
|
|
261
|
+
* @exception {DeveloperError} Trying to add when there are no empty spots.
|
|
330
262
|
*/
|
|
331
263
|
Megatexture.prototype.add = function (data) {
|
|
332
264
|
if (this.isFull()) {
|
|
@@ -356,6 +288,7 @@ Megatexture.prototype.add = function (data) {
|
|
|
356
288
|
|
|
357
289
|
/**
|
|
358
290
|
* @param {number} index
|
|
291
|
+
* @exception {DeveloperError} Megatexture index out of bounds.
|
|
359
292
|
*/
|
|
360
293
|
Megatexture.prototype.remove = function (index) {
|
|
361
294
|
if (index < 0 || index >= this.maximumTileCount) {
|
|
@@ -389,130 +322,129 @@ Megatexture.prototype.isFull = function () {
|
|
|
389
322
|
};
|
|
390
323
|
|
|
391
324
|
/**
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* @param {
|
|
395
|
-
* @param {
|
|
396
|
-
* @
|
|
325
|
+
* Compute a 3D texture dimension that contains the given number of tiles, or as many tiles as can fit within the available texture memory.
|
|
326
|
+
* Not used outside the class, but exposed for testing.
|
|
327
|
+
* @param {Cartesian3} tileDimensions The dimensions of one tile in number of voxels.
|
|
328
|
+
* @param {number} bytesPerSample The number of bytes per voxel sample.
|
|
329
|
+
* @param {number} availableTextureMemoryBytes An upper limit on the texture memory size in bytes.
|
|
330
|
+
* @param {number} [tileCount] The total number of tiles in the tileset.
|
|
331
|
+
* @returns {Cartesian3} The computed 3D texture dimensions.
|
|
332
|
+
*
|
|
333
|
+
* @exception {RuntimeError} The GL context does not support a 3D texture large enough to contain a tile with the given dimensions.
|
|
334
|
+
* @exception {RuntimeError} Not enough texture memory available to create a megatexture with the given tile dimensions.
|
|
335
|
+
* @private
|
|
397
336
|
*/
|
|
398
|
-
Megatexture.
|
|
337
|
+
Megatexture.get3DTextureDimension = function (
|
|
338
|
+
tileDimensions,
|
|
339
|
+
bytesPerSample,
|
|
340
|
+
availableTextureMemoryBytes,
|
|
399
341
|
tileCount,
|
|
400
|
-
dimensions,
|
|
401
|
-
channelCount,
|
|
402
|
-
componentType,
|
|
403
342
|
) {
|
|
404
|
-
|
|
343
|
+
const { maximum3DTextureSize } = ContextLimits;
|
|
344
|
+
if (Cartesian3.maximumComponent(tileDimensions) > maximum3DTextureSize) {
|
|
345
|
+
throw new RuntimeError(
|
|
346
|
+
"The GL context does not support a 3D texture large enough to contain a tile with the given dimensions.",
|
|
347
|
+
);
|
|
348
|
+
}
|
|
405
349
|
|
|
406
|
-
//
|
|
407
|
-
|
|
408
|
-
|
|
350
|
+
// Find the number of tiles we can fit.
|
|
351
|
+
const tileSizeInBytes =
|
|
352
|
+
bytesPerSample * tileDimensions.x * tileDimensions.y * tileDimensions.z;
|
|
353
|
+
const maxTileCount = Math.floor(
|
|
354
|
+
availableTextureMemoryBytes / tileSizeInBytes,
|
|
355
|
+
);
|
|
356
|
+
if (maxTileCount < 1) {
|
|
357
|
+
throw new RuntimeError(
|
|
358
|
+
"Not enough texture memory available to create a megatexture with the given tile dimensions.",
|
|
359
|
+
);
|
|
409
360
|
}
|
|
410
361
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
tileCount
|
|
362
|
+
if (defined(tileCount)) {
|
|
363
|
+
tileCount = Math.min(tileCount, maxTileCount);
|
|
364
|
+
} else {
|
|
365
|
+
tileCount = maxTileCount;
|
|
366
|
+
}
|
|
415
367
|
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
368
|
+
// Sort the tile dimensions from largest to smallest.
|
|
369
|
+
const sortedDimensions = Object.entries(tileDimensions).sort(
|
|
370
|
+
(a, b) => b[1] - a[1],
|
|
371
|
+
);
|
|
420
372
|
|
|
421
|
-
//
|
|
422
|
-
//
|
|
423
|
-
|
|
424
|
-
Math.floor(
|
|
373
|
+
// Compute the number of tiles that we can fit along each axis of a 3D texture,
|
|
374
|
+
// starting from the largest texture the context can support
|
|
375
|
+
const tilesPerDimension = sortedDimensions.map(([axis, dimension]) =>
|
|
376
|
+
Math.floor(maximum3DTextureSize / dimension),
|
|
425
377
|
);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
378
|
+
|
|
379
|
+
// Reduce the number of tiles along each dimension until the total number of
|
|
380
|
+
// tiles is close to but not less than tileCount.
|
|
381
|
+
// Start from the dimension along which the tiles are largest, since
|
|
382
|
+
// along this dimension each removed slice will contain the most tiles.
|
|
383
|
+
for (let i = 0; i < 3; i++) {
|
|
384
|
+
const currentTileCount = getVolume(tilesPerDimension);
|
|
385
|
+
if (currentTileCount < tileCount) {
|
|
431
386
|
break;
|
|
432
|
-
} else {
|
|
433
|
-
textureDimension *= 2;
|
|
434
387
|
}
|
|
388
|
+
const sliceDimensions = tilesPerDimension.slice();
|
|
389
|
+
sliceDimensions.splice(i, 1);
|
|
390
|
+
const tilesPerSlice = sliceDimensions[0] * sliceDimensions[1];
|
|
391
|
+
const excessTiles = currentTileCount - tileCount;
|
|
392
|
+
const slicesToRemove = Math.floor(excessTiles / tilesPerSlice);
|
|
393
|
+
tilesPerDimension[i] -= slicesToRemove;
|
|
435
394
|
}
|
|
436
395
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
396
|
+
// Make sure we are less than maximumTileCount (to fit within memory)
|
|
397
|
+
if (getVolume(tilesPerDimension) > maxTileCount) {
|
|
398
|
+
tilesPerDimension[2] = Math.floor(
|
|
399
|
+
maxTileCount / (tilesPerDimension[0] * tilesPerDimension[1]),
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Compute the final texture dimensions
|
|
404
|
+
const textureDimension = new Cartesian3();
|
|
405
|
+
for (let i = 0; i < 3; i++) {
|
|
406
|
+
const [axis, dimension] = sortedDimensions[i];
|
|
407
|
+
textureDimension[axis] = tilesPerDimension[i] * dimension;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return textureDimension;
|
|
440
411
|
};
|
|
441
412
|
|
|
413
|
+
function getVolume(dimensionsArray) {
|
|
414
|
+
return dimensionsArray.reduce((p, d) => p * d);
|
|
415
|
+
}
|
|
416
|
+
|
|
442
417
|
/**
|
|
443
418
|
* Write an array of tile metadata to the megatexture.
|
|
444
419
|
* @param {number} index The index of the tile's location in the megatexture.
|
|
445
|
-
* @param {Float32Array|Uint16Array|Uint8Array}
|
|
420
|
+
* @param {Float32Array|Uint16Array|Uint8Array} tileData The data to be written.
|
|
446
421
|
*/
|
|
447
|
-
Megatexture.prototype.writeDataToTexture = function (index,
|
|
448
|
-
|
|
449
|
-
const tileData =
|
|
450
|
-
data.constructor === Uint16Array ? new Float32Array(data) : data;
|
|
451
|
-
|
|
452
|
-
const {
|
|
453
|
-
tileVoxelDataTemp,
|
|
454
|
-
voxelCountPerTile,
|
|
455
|
-
sliceCountPerRegion,
|
|
456
|
-
voxelCountPerRegion,
|
|
457
|
-
channelCount,
|
|
458
|
-
regionCountPerMegatexture,
|
|
459
|
-
} = this;
|
|
460
|
-
|
|
461
|
-
for (let z = 0; z < voxelCountPerTile.z; z++) {
|
|
462
|
-
const sliceVoxelOffsetX = (z % sliceCountPerRegion.x) * voxelCountPerTile.x;
|
|
463
|
-
const sliceVoxelOffsetY =
|
|
464
|
-
Math.floor(z / sliceCountPerRegion.x) * voxelCountPerTile.y;
|
|
465
|
-
for (let y = 0; y < voxelCountPerTile.y; y++) {
|
|
466
|
-
const readOffset = getReadOffset(voxelCountPerTile, y, z);
|
|
467
|
-
const writeOffset =
|
|
468
|
-
(sliceVoxelOffsetY + y) * voxelCountPerRegion.x + sliceVoxelOffsetX;
|
|
469
|
-
for (let x = 0; x < voxelCountPerTile.x; x++) {
|
|
470
|
-
const readIndex = readOffset + x;
|
|
471
|
-
const writeIndex = writeOffset + x;
|
|
472
|
-
for (let c = 0; c < channelCount; c++) {
|
|
473
|
-
tileVoxelDataTemp[writeIndex * channelCount + c] =
|
|
474
|
-
tileData[readIndex * channelCount + c];
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
const voxelOffsetX =
|
|
481
|
-
(index % regionCountPerMegatexture.x) * voxelCountPerRegion.x;
|
|
482
|
-
const voxelOffsetY =
|
|
483
|
-
Math.floor(index / regionCountPerMegatexture.x) * voxelCountPerRegion.y;
|
|
422
|
+
Megatexture.prototype.writeDataToTexture = function (index, tileData) {
|
|
423
|
+
const { tileCounts, voxelCountPerTile } = this;
|
|
484
424
|
|
|
485
425
|
const source = {
|
|
486
|
-
arrayBufferView:
|
|
487
|
-
width:
|
|
488
|
-
height:
|
|
426
|
+
arrayBufferView: tileData,
|
|
427
|
+
width: voxelCountPerTile.x,
|
|
428
|
+
height: voxelCountPerTile.y,
|
|
429
|
+
depth: voxelCountPerTile.z,
|
|
489
430
|
};
|
|
490
431
|
|
|
432
|
+
const tilesPerZ = tileCounts.x * tileCounts.y;
|
|
433
|
+
const iz = Math.floor(index / tilesPerZ);
|
|
434
|
+
const remainder = index - iz * tilesPerZ;
|
|
435
|
+
const iy = Math.floor(remainder / tileCounts.x);
|
|
436
|
+
const ix = remainder - iy * tileCounts.x;
|
|
437
|
+
|
|
491
438
|
const copyOptions = {
|
|
492
439
|
source: source,
|
|
493
|
-
xOffset:
|
|
494
|
-
yOffset:
|
|
440
|
+
xOffset: ix * voxelCountPerTile.x,
|
|
441
|
+
yOffset: iy * voxelCountPerTile.y,
|
|
442
|
+
zOffset: iz * voxelCountPerTile.z,
|
|
495
443
|
};
|
|
496
444
|
|
|
497
445
|
this.texture.copyFrom(copyOptions);
|
|
498
446
|
};
|
|
499
447
|
|
|
500
|
-
/**
|
|
501
|
-
* Get the offset into the data array for a given row of contiguous voxel data.
|
|
502
|
-
*
|
|
503
|
-
* @param {Cartesian3} dimensions The number of voxels in each dimension of the tile.
|
|
504
|
-
* @param {number} y The y index of the voxel row
|
|
505
|
-
* @param {number} z The z index of the voxel row
|
|
506
|
-
* @returns {number} The offset into the data array
|
|
507
|
-
* @private
|
|
508
|
-
*/
|
|
509
|
-
function getReadOffset(dimensions, y, z) {
|
|
510
|
-
const voxelsPerInputSlice = dimensions.y * dimensions.x;
|
|
511
|
-
const sliceIndex = z;
|
|
512
|
-
const rowIndex = y;
|
|
513
|
-
return sliceIndex * voxelsPerInputSlice + rowIndex * dimensions.x;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
448
|
/**
|
|
517
449
|
* Returns true if this object was destroyed; otherwise, false.
|
|
518
450
|
* <br /><br />
|