@cesium/engine 23.0.1 → 24.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-G6MJ3ZW3.js → chunk-2N4KDHS3.js} +10 -10
- package/Build/Workers/{chunk-C6HHBKT5.js → chunk-44EMEGKW.js} +5 -5
- package/Build/Workers/{chunk-TNXOPEIG.js → chunk-4TIG36AW.js} +12 -12
- package/Build/Workers/{chunk-PQTSXJBJ.js → chunk-5A2SW66E.js} +16 -16
- package/Build/Workers/{chunk-TXYQNXNW.js → chunk-5GXYJQ2K.js} +3 -3
- package/Build/Workers/{chunk-O67UP5YO.js → chunk-63SIWPLS.js} +13 -13
- package/Build/Workers/{chunk-CVAAIRNP.js → chunk-6MPGQEHA.js} +2 -2
- package/Build/Workers/{chunk-LHFC4R7Z.js → chunk-6RMS4S72.js} +6 -6
- package/Build/Workers/{chunk-77DJBHMI.js → chunk-6WLHJFD3.js} +7 -7
- package/Build/Workers/{chunk-HXEPZWJN.js → chunk-72VYSVEW.js} +9 -9
- package/Build/Workers/{chunk-VPWYHFQA.js → chunk-7MDYBRYJ.js} +4 -4
- package/Build/Workers/{chunk-XPMXRJDD.js → chunk-7O5XJTVE.js} +5 -5
- package/Build/Workers/{chunk-UEWYSOFD.js → chunk-7QRFIKWQ.js} +2 -2
- package/Build/Workers/{chunk-3UQ2YMPP.js → chunk-7TYLCBGK.js} +8 -8
- package/Build/Workers/{chunk-GLCPE2BJ.js → chunk-7X322WP2.js} +13 -13
- package/Build/Workers/{chunk-2OBWHTIC.js → chunk-A47HVBC5.js} +7 -7
- package/Build/Workers/{chunk-CID5SY7L.js → chunk-AF3MU2RL.js} +5 -5
- package/Build/Workers/{chunk-BTP3634E.js → chunk-AJLTU6PF.js} +1 -1
- package/Build/Workers/{chunk-YSJRB2UZ.js → chunk-AMIHNSST.js} +2 -2
- package/Build/Workers/{chunk-QPXGGVHC.js → chunk-B6SCUUFP.js} +10 -10
- package/Build/Workers/{chunk-QNABVTTP.js → chunk-BJD6QGXZ.js} +12 -12
- package/Build/Workers/{chunk-RZX6LOG6.js → chunk-C6P4IG5P.js} +6 -6
- package/Build/Workers/{chunk-4JJQRZYL.js → chunk-D4EJ2NXG.js} +17 -17
- package/Build/Workers/{chunk-K7UTK4OM.js → chunk-DHKPFLSJ.js} +1 -1
- package/Build/Workers/{chunk-S53HSRT6.js → chunk-DVB56LG7.js} +6 -6
- package/Build/Workers/{chunk-PBECJOWF.js → chunk-EDXL4W76.js} +2 -2
- package/Build/Workers/{chunk-ALTCIHRH.js → chunk-EV3VGO6Y.js} +17 -17
- package/Build/Workers/{chunk-UOQB7XQI.js → chunk-GOQBUCXH.js} +10 -10
- package/Build/Workers/{chunk-TMCTZ5E3.js → chunk-GQUNK2XC.js} +14 -14
- package/Build/Workers/{chunk-PAFMAR7A.js → chunk-HKUES6UG.js} +12 -12
- package/Build/Workers/{chunk-6U5QMZU3.js → chunk-HRHRYFHS.js} +9 -9
- package/Build/Workers/{chunk-PUO7BYDY.js → chunk-HXJMS2ZI.js} +1 -1
- package/Build/Workers/{chunk-FXSRA5UG.js → chunk-ILMFADZA.js} +4 -4
- package/Build/Workers/{chunk-U4SWB6TI.js → chunk-ISY4EZCA.js} +4 -4
- package/Build/Workers/{chunk-PGZ3B6CB.js → chunk-J6AW5YHS.js} +14 -14
- package/Build/Workers/{chunk-VX774SWE.js → chunk-JCI63T3K.js} +6 -6
- package/Build/Workers/{chunk-54O3AGOA.js → chunk-KLPGTXS3.js} +6 -6
- package/Build/Workers/{chunk-CNLXMOPM.js → chunk-LIB2H534.js} +10 -10
- package/Build/Workers/{chunk-H3TVRJLY.js → chunk-LXMCPFFS.js} +4 -4
- package/Build/Workers/{chunk-DNMASBMH.js → chunk-MKM27KGV.js} +2 -2
- package/Build/Workers/{chunk-66OWUDO7.js → chunk-N65BAKSH.js} +8 -8
- package/Build/Workers/{chunk-ZEMJQKHD.js → chunk-NKT5K3K3.js} +11 -11
- package/Build/Workers/{chunk-EIC3VAOZ.js → chunk-NPF7SSHZ.js} +7 -7
- package/Build/Workers/{chunk-YDR5LX5Z.js → chunk-PVV64VFW.js} +1 -1
- package/Build/Workers/{chunk-FKU77FNM.js → chunk-Q3C6VQH6.js} +4 -4
- package/Build/Workers/{chunk-CYOPNGPX.js → chunk-RQNJD3O4.js} +12 -12
- package/Build/Workers/{chunk-IJ3SUMK3.js → chunk-UIGVOKKI.js} +1 -1
- package/Build/Workers/{chunk-TFPG3ZKW.js → chunk-UQU4RXLT.js} +27 -19
- package/Build/Workers/{chunk-N6HRZLS6.js → chunk-VLDEUTOP.js} +2 -2
- package/Build/Workers/{chunk-MNSNOONX.js → chunk-VMVOUQ5J.js} +7 -7
- package/Build/Workers/{chunk-OZYB3AOR.js → chunk-XJRBB253.js} +11 -11
- package/Build/Workers/{chunk-B2VA6IEL.js → chunk-XY6HMDGI.js} +5 -5
- package/Build/Workers/{chunk-2M7DKGLW.js → chunk-Y7HNNPNK.js} +10 -10
- package/Build/Workers/{chunk-CJ7ZDY77.js → chunk-YAOZMOFL.js} +5 -5
- package/Build/Workers/{chunk-FCJQO4NC.js → chunk-YJZGW74L.js} +8 -8
- package/Build/Workers/{chunk-JUKGMJX7.js → chunk-YQFTYQMZ.js} +1 -1
- package/Build/Workers/{chunk-HNDE73JK.js → chunk-ZBZRTRJB.js} +10 -10
- 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 +25 -25
- package/Build/Workers/createWallOutlineGeometry.js +24 -24
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +12 -12
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- 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/BoundingSphere.js +1 -1
- package/Source/Core/Cartesian2.js +7 -5
- package/Source/Core/Cartesian3.js +8 -6
- package/Source/Core/Cartesian4.js +8 -6
- package/Source/Core/Color.js +5 -3
- package/Source/Core/DeveloperError.js +2 -1
- package/Source/Core/ITwinPlatform.js +1 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/S2Cell.js +2 -2
- package/Source/Core/TerrainMesh.js +10 -1
- package/Source/Core/TerrainPicker.js +1 -0
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/assert.js +27 -0
- package/Source/Core/globalTypes.js +4 -0
- package/Source/DataSources/CzmlDataSource.js +9 -0
- package/Source/DataSources/PathGraphics.js +13 -0
- package/Source/DataSources/PathVisualizer.js +330 -18
- package/Source/DataSources/StaticGeometryColorBatch.js +7 -2
- package/Source/DataSources/StaticGeometryPerMaterialBatch.js +7 -2
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +3 -1
- package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +3 -1
- package/Source/Renderer/Context.js +1 -1
- package/Source/Renderer/RenderState.js +2 -2
- package/Source/Renderer/VertexArray.js +80 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BillboardCollection.js +65 -364
- package/Source/Scene/BufferPoint.js +148 -0
- package/Source/Scene/BufferPointCollection.js +135 -0
- package/Source/Scene/BufferPointMaterial.js +95 -0
- package/Source/Scene/BufferPolygon.js +516 -0
- package/Source/Scene/BufferPolygonCollection.js +368 -0
- package/Source/Scene/BufferPolygonMaterial.js +41 -0
- package/Source/Scene/BufferPolyline.js +185 -0
- package/Source/Scene/BufferPolylineCollection.js +136 -0
- package/Source/Scene/BufferPolylineMaterial.js +93 -0
- package/Source/Scene/BufferPrimitive.js +347 -0
- package/Source/Scene/BufferPrimitiveCollection.js +702 -0
- package/Source/Scene/BufferPrimitiveMaterial.js +140 -0
- package/Source/Scene/Cesium3DTileContent.js +5 -1
- package/Source/Scene/Cesium3DTileContentFactory.js +9 -0
- package/Source/Scene/Cesium3DTileStyle.js +22 -0
- package/Source/Scene/Cesium3DTileset.js +1 -0
- package/Source/Scene/ClippingPolygonCollection.js +270 -101
- package/Source/Scene/CubeMapPanorama.js +4 -4
- package/Source/Scene/GaussianSplat3DTileContent.js +40 -46
- package/Source/Scene/GaussianSplatPrimitive.js +413 -70
- package/Source/Scene/GetFeatureInfoFormat.js +3 -3
- package/Source/Scene/GltfLoader.js +215 -34
- package/Source/Scene/GltfSpzLoader.js +109 -0
- package/Source/Scene/ITwinData.js +1 -0
- package/Source/Scene/Label.js +32 -0
- package/Source/Scene/LabelCollection.js +14 -13
- package/Source/Scene/Material.js +2 -0
- package/Source/Scene/Megatexture.js +1 -0
- package/Source/Scene/MetadataClassProperty.js +24 -10
- package/Source/Scene/MetadataComponentType.js +115 -23
- package/Source/Scene/Model/CustomShaderPipelineStage.js +3 -1
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +761 -263
- package/Source/Scene/Model/MaterialPipelineStage.js +147 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +3 -3
- package/Source/Scene/Model/ModelDrawCommand.js +6 -0
- package/Source/Scene/Model/ModelReader.js +1 -1
- package/Source/Scene/Model/ModelUtility.js +3 -1
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +330 -0
- package/Source/Scene/ModelComponents.js +1632 -1542
- package/Source/Scene/PickedMetadataInfo.js +1 -0
- package/Source/Scene/ScreenSpaceCameraController.js +13 -0
- package/Source/Scene/SkyBox.js +17 -8
- package/Source/Scene/TileBoundingRegion.js +1 -1
- package/Source/Scene/TileBoundingS2Cell.js +1 -1
- package/Source/Scene/TileBoundingSphere.js +1 -1
- package/Source/Scene/TweenCollection.js +7 -0
- package/Source/Scene/VectorGltf3DTileContent.js +382 -0
- package/Source/Scene/VertexAttributeSemantic.js +14 -0
- package/Source/Scene/WebMapServiceImageryProvider.js +2 -2
- package/Source/Scene/WebMapTileServiceImageryProvider.js +366 -131
- package/Source/Scene/parseStructuralMetadata.js +97 -37
- package/Source/Scene/renderBufferPointCollection.js +334 -0
- package/Source/Scene/renderBufferPolygonCollection.js +386 -0
- package/Source/Scene/renderBufferPolylineCollection.js +529 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +2 -77
- package/Source/Shaders/BillboardCollectionFS.js +2 -77
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -60
- package/Source/Shaders/BillboardCollectionVS.js +2 -60
- package/Source/Shaders/BufferPointMaterialFS.glsl +27 -0
- package/Source/Shaders/BufferPointMaterialFS.js +29 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +48 -0
- package/Source/Shaders/BufferPointMaterialVS.js +50 -0
- package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +30 -0
- package/Source/Shaders/BufferPolygonMaterialVS.js +32 -0
- package/Source/Shaders/BufferPolylineMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolylineMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +49 -0
- package/Source/Shaders/BufferPolylineMaterialVS.js +51 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +34 -48
- package/Source/Shaders/Model/EdgeVisibilityStageFS.js +34 -49
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +98 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +100 -0
- package/Source/Shaders/Model/ModelFS.glsl +15 -0
- package/Source/Shaders/Model/ModelFS.js +15 -0
- package/Source/Shaders/Model/ModelVS.glsl +8 -0
- package/Source/Shaders/Model/ModelVS.js +8 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +64 -33
- package/Source/Shaders/PolygonSignedDistanceFS.js +64 -33
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +9 -2
- package/Source/Shaders/PrimitiveGaussianSplatVS.js +9 -2
- package/Source/Shaders/Voxels/VoxelFS.glsl +1 -1
- package/Source/Shaders/Voxels/VoxelFS.js +1 -1
- package/Source/Workers/decodeDraco.js +3 -0
- package/Source/Workers/decodeI3S.js +5 -2
- package/index.d.ts +1007 -111
- package/index.js +394 -369
- package/package.json +2 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import BufferPrimitiveCollection from "./BufferPrimitiveCollection.js";
|
|
5
|
+
import BufferPolyline from "./BufferPolyline.js";
|
|
6
|
+
import renderPolylines from "./renderBufferPolylineCollection.js";
|
|
7
|
+
import BufferPolylineMaterial from "./BufferPolylineMaterial.js";
|
|
8
|
+
|
|
9
|
+
/** @import { TypedArray } from "../Core/globalTypes.js"; */
|
|
10
|
+
/** @import Matrix4 from "../Core/Matrix4.js"; */
|
|
11
|
+
/** @import FrameState from "./FrameState.js" */
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {object} BufferPolylineOptions
|
|
15
|
+
* @property {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] Transforms geometry from model to world coordinates.
|
|
16
|
+
* @property {boolean} [show=true]
|
|
17
|
+
* @property {BufferPolylineMaterial} [material=BufferPolylineMaterial.DEFAULT_MATERIAL]
|
|
18
|
+
* @property {TypedArray} [positions]
|
|
19
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Collection of polylines held in ArrayBuffer storage for performance and memory optimization.
|
|
24
|
+
*
|
|
25
|
+
* <p>Default buffer memory allocation is arbitrary, and collections cannot be resized,
|
|
26
|
+
* so specific per-buffer capacities should be provided in the collection
|
|
27
|
+
* constructor when available.</p>
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const collection = new BufferPolylineCollection({
|
|
31
|
+
* primitiveCountMax: 1024,
|
|
32
|
+
* vertexCountMax: 4096,
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* const polyline = new BufferPolyline();
|
|
36
|
+
* const material = new BufferPolylineMaterial({color: Color.WHITE});
|
|
37
|
+
*
|
|
38
|
+
* // Create a new polyline, temporarily bound to 'polyline' local variable.
|
|
39
|
+
* collection.add({
|
|
40
|
+
* positions: new Float64Array([ ... ]),
|
|
41
|
+
* material,
|
|
42
|
+
* }, polyline);
|
|
43
|
+
*
|
|
44
|
+
* // Iterate over all polylines in collection, temporarily binding 'polyline'
|
|
45
|
+
* // local variable to each, and updating polyline material.
|
|
46
|
+
* for (let i = 0; i < collection.primitiveCount; i++) {
|
|
47
|
+
* collection.get(i, polyline);
|
|
48
|
+
* polyline.setMaterial(material);
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* @see BufferPolyline
|
|
52
|
+
* @see BufferPolylineMaterial
|
|
53
|
+
* @see BufferPrimitiveCollection
|
|
54
|
+
* @extends BufferPrimitiveCollection<BufferPolyline>
|
|
55
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
56
|
+
*/
|
|
57
|
+
class BufferPolylineCollection extends BufferPrimitiveCollection {
|
|
58
|
+
_getCollectionClass() {
|
|
59
|
+
return BufferPolylineCollection;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_getPrimitiveClass() {
|
|
63
|
+
return BufferPolyline;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_getMaterialClass() {
|
|
67
|
+
return BufferPolylineMaterial;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
71
|
+
// COLLECTION LIFECYCLE
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {BufferPolylineCollection} collection
|
|
75
|
+
* @returns {BufferPolylineCollection}
|
|
76
|
+
* @override
|
|
77
|
+
* @ignore
|
|
78
|
+
*/
|
|
79
|
+
static _cloneEmpty(collection) {
|
|
80
|
+
return new BufferPolylineCollection({
|
|
81
|
+
primitiveCountMax: collection.primitiveCountMax,
|
|
82
|
+
vertexCountMax: collection.vertexCountMax,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
87
|
+
// PRIMITIVE LIFECYCLE
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Adds a new polyline to the collection, with the specified options. A
|
|
91
|
+
* {@link BufferPolyline} instance is linked to the new polyline, using
|
|
92
|
+
* the 'result' argument if given, or a new instance if not. For repeated
|
|
93
|
+
* calls, prefer to reuse a single BufferPolyline instance rather than
|
|
94
|
+
* allocating a new instance on each call.
|
|
95
|
+
*
|
|
96
|
+
* @param {BufferPolylineOptions} options
|
|
97
|
+
* @param {BufferPolyline} result
|
|
98
|
+
* @returns {BufferPolyline}
|
|
99
|
+
* @override
|
|
100
|
+
*/
|
|
101
|
+
add(options, result = new BufferPolyline()) {
|
|
102
|
+
super.add(options, result);
|
|
103
|
+
|
|
104
|
+
const vertexOffset = this._positionCount;
|
|
105
|
+
result._setUint32(BufferPolyline.Layout.POSITION_OFFSET_U32, vertexOffset);
|
|
106
|
+
result._setUint32(BufferPolyline.Layout.POSITION_COUNT_U32, 0);
|
|
107
|
+
|
|
108
|
+
if (defined(options.positions)) {
|
|
109
|
+
result.setPositions(options.positions);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
116
|
+
// RENDER
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @param {FrameState} frameState
|
|
120
|
+
* @ignore
|
|
121
|
+
*/
|
|
122
|
+
update(frameState) {
|
|
123
|
+
super.update(frameState);
|
|
124
|
+
|
|
125
|
+
const passes = frameState.passes;
|
|
126
|
+
if (this.show && (passes.render || passes.pick)) {
|
|
127
|
+
this._renderContext = renderPolylines(
|
|
128
|
+
this,
|
|
129
|
+
frameState,
|
|
130
|
+
this._renderContext,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export default BufferPolylineCollection;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import Frozen from "../Core/Frozen.js";
|
|
4
|
+
import BufferPrimitiveMaterial from "./BufferPrimitiveMaterial.js";
|
|
5
|
+
|
|
6
|
+
/** @import Color from "../Core/Color.js"; */
|
|
7
|
+
/** @import BufferPolyline from "./BufferPolyline.js"; */
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} BufferPolylineMaterialOptions
|
|
11
|
+
* @property {Color} [color=Color.WHITE] Color of fill.
|
|
12
|
+
* @property {Color} [outlineColor=Color.WHITE] Color of outline.
|
|
13
|
+
* @property {number} [outlineWidth=0.0] Width of outline, 0-255px.
|
|
14
|
+
* @property {number} [width=1.0] Width of line, 0-255px.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Material description for a {@link BufferPolyline}.
|
|
19
|
+
*
|
|
20
|
+
* <p>BufferPolylineMaterial objects are {@link Packable|packable}, stored
|
|
21
|
+
* when calling {@link BufferPolyline#setMaterial}. Subsequent changes to the
|
|
22
|
+
* material will not affect the polyline until setMaterial() is called again.</p>
|
|
23
|
+
*
|
|
24
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
25
|
+
* @extends BufferPrimitiveMaterial
|
|
26
|
+
*/
|
|
27
|
+
class BufferPolylineMaterial extends BufferPrimitiveMaterial {
|
|
28
|
+
/** @ignore */
|
|
29
|
+
static Layout = {
|
|
30
|
+
...BufferPrimitiveMaterial.Layout,
|
|
31
|
+
WIDTH_U8: BufferPrimitiveMaterial.Layout.__BYTE_LENGTH,
|
|
32
|
+
__BYTE_LENGTH: BufferPrimitiveMaterial.Layout.__BYTE_LENGTH + 4,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @type {BufferPolylineMaterial}
|
|
37
|
+
* @ignore
|
|
38
|
+
*/
|
|
39
|
+
static DEFAULT_MATERIAL = Object.freeze(new BufferPolylineMaterial());
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {BufferPolylineMaterialOptions} [options]
|
|
43
|
+
*/
|
|
44
|
+
constructor(options = Frozen.EMPTY_OBJECT) {
|
|
45
|
+
super(options);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Width of polyline, 0–255px.
|
|
49
|
+
* @type {number}
|
|
50
|
+
*/
|
|
51
|
+
this.width = options.width ?? 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {BufferPolylineMaterial} material
|
|
56
|
+
* @param {DataView} view
|
|
57
|
+
* @param {number} byteOffset
|
|
58
|
+
* @override
|
|
59
|
+
*/
|
|
60
|
+
static pack(material, view, byteOffset) {
|
|
61
|
+
super.pack(material, view, byteOffset);
|
|
62
|
+
view.setUint8(this.Layout.WIDTH_U8 + byteOffset, material.width);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {DataView} view
|
|
67
|
+
* @param {number} byteOffset
|
|
68
|
+
* @param {BufferPolylineMaterial} result
|
|
69
|
+
* @returns {BufferPolylineMaterial}
|
|
70
|
+
* @override
|
|
71
|
+
*/
|
|
72
|
+
static unpack(view, byteOffset, result) {
|
|
73
|
+
super.unpack(view, byteOffset, result);
|
|
74
|
+
result.width = view.getUint8(this.Layout.WIDTH_U8 + byteOffset);
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
79
|
+
// DEBUG
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns a JSON-serializable object representing the material. This encoding
|
|
83
|
+
* is not memory-efficient, and should generally be used for debugging and
|
|
84
|
+
* testing.
|
|
85
|
+
*
|
|
86
|
+
* @returns {Object} JSON-serializable object.
|
|
87
|
+
*/
|
|
88
|
+
toJSON() {
|
|
89
|
+
return { ...super.toJSON(), width: this.width };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default BufferPolylineMaterial;
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import assert from "../Core/assert.js";
|
|
4
|
+
|
|
5
|
+
/** @import BufferPrimitiveCollection from './BufferPrimitiveCollection.js'; */
|
|
6
|
+
/** @import BufferPrimitiveMaterial from "./BufferPrimitiveMaterial.js"; */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* View bound to the underlying buffer data of a {@link BufferPrimitiveCollection}. Abstract.
|
|
10
|
+
*
|
|
11
|
+
* <p>BufferPrimitive instances are intended to be reused when iterating over large collections,
|
|
12
|
+
* and temporarily bound to a primitive index while performing read/write operations on that primitive,
|
|
13
|
+
* before being rebound to the next primitive, using the
|
|
14
|
+
* {@link https://en.wikipedia.org/wiki/Flyweight_pattern|flyweight pattern}.</p>
|
|
15
|
+
*
|
|
16
|
+
* @see BufferPrimitiveCollection
|
|
17
|
+
* @see BufferPrimitiveMaterial
|
|
18
|
+
* @see BufferPoint
|
|
19
|
+
* @see BufferPolyline
|
|
20
|
+
* @see BufferPolygon
|
|
21
|
+
*
|
|
22
|
+
* @abstract
|
|
23
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
24
|
+
*/
|
|
25
|
+
class BufferPrimitive {
|
|
26
|
+
/**
|
|
27
|
+
* Collecton containing the primitive(s) for which this instance currently
|
|
28
|
+
* provides a view.
|
|
29
|
+
*
|
|
30
|
+
* @type {BufferPrimitiveCollection<BufferPrimitive>}
|
|
31
|
+
* @ignore
|
|
32
|
+
*/
|
|
33
|
+
_collection = null;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Index of the primitive for which this instance currently provides a view.
|
|
37
|
+
*
|
|
38
|
+
* @type {number}
|
|
39
|
+
* @ignore
|
|
40
|
+
*/
|
|
41
|
+
_index = -1;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Byte offset, into the collection's primitive buffer, of the primitive for
|
|
45
|
+
* which this instance currently provides a view.
|
|
46
|
+
*
|
|
47
|
+
* @type {number}
|
|
48
|
+
* @ignore
|
|
49
|
+
*/
|
|
50
|
+
_byteOffset = -1;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Binary layout for this primitive type in collection's primitive buffer.
|
|
54
|
+
* Each `Layout.MY_KEY_U32` entry is an offset in bytes, relative to the
|
|
55
|
+
* start offset of the primitive, with the suffix indicating the data type
|
|
56
|
+
* stored at that offset.
|
|
57
|
+
*
|
|
58
|
+
* The final entry, `__BYTE_LENGTH`, is not a pointer into a buffer — its
|
|
59
|
+
* literal value is the total byte length of one primitive in the primitive
|
|
60
|
+
* buffer, exclusive of other buffers.
|
|
61
|
+
*
|
|
62
|
+
* @ignore
|
|
63
|
+
*/
|
|
64
|
+
static Layout = {
|
|
65
|
+
/**
|
|
66
|
+
* Feature ID associated with the primitive; not required to be unique.
|
|
67
|
+
* @type {number}
|
|
68
|
+
* @ignore
|
|
69
|
+
*/
|
|
70
|
+
FEATURE_ID_U32: 0,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Boolean (0 or 1) flag indicating whether primitive is shown.
|
|
74
|
+
* @type {number}
|
|
75
|
+
* @ignore
|
|
76
|
+
*/
|
|
77
|
+
SHOW_U8: 4,
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Boolean (0 or 1) flag indicating whether primitive is dirty.
|
|
81
|
+
* @type {number}
|
|
82
|
+
* @ignore
|
|
83
|
+
*/
|
|
84
|
+
DIRTY_U8: 5,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Pick ID (uint32) of primitive.
|
|
88
|
+
* @type {number}
|
|
89
|
+
* @ignore
|
|
90
|
+
*/
|
|
91
|
+
PICK_ID_U32: 8,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Byte length of one primitive in the primitive buffer, exclusive of
|
|
95
|
+
* other buffers. Literal value, not a pointer.
|
|
96
|
+
* @type {number}
|
|
97
|
+
* @ignore
|
|
98
|
+
*/
|
|
99
|
+
__BYTE_LENGTH: 12,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
103
|
+
// LIFECYCLE
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Copies data from source primitive to result. If the result primitive is not
|
|
107
|
+
* new (the last primitive in the collection) then source and result primitives
|
|
108
|
+
* must have the same vertex counts.
|
|
109
|
+
*
|
|
110
|
+
* @param {BufferPrimitive} primitive
|
|
111
|
+
* @param {BufferPrimitive} result
|
|
112
|
+
* @returns {BufferPrimitive}
|
|
113
|
+
*/
|
|
114
|
+
static clone(primitive, result) {
|
|
115
|
+
const SrcMaterialClass = primitive._collection._getMaterialClass();
|
|
116
|
+
|
|
117
|
+
//>>includeStart('debug', pragmas.debug);
|
|
118
|
+
const DstMaterialClass = result._collection._getMaterialClass();
|
|
119
|
+
assert(SrcMaterialClass === DstMaterialClass, "Incompatible materials");
|
|
120
|
+
//>>includeEnd('debug');
|
|
121
|
+
|
|
122
|
+
result.featureId = primitive.featureId;
|
|
123
|
+
result.show = primitive.show;
|
|
124
|
+
result.setMaterial(primitive.getMaterial(new SrcMaterialClass()));
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Returns true if this primitive's memory footprint is resizable. Only the
|
|
130
|
+
* newest (most recently created) primitive in a collection can be resized,
|
|
131
|
+
* to guarantee fast and stable performance.
|
|
132
|
+
*
|
|
133
|
+
* @returns {boolean}
|
|
134
|
+
* @protected
|
|
135
|
+
* @ignore
|
|
136
|
+
*/
|
|
137
|
+
_isResizable() {
|
|
138
|
+
return this._index === this._collection.primitiveCount - 1;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
142
|
+
// ACCESSORS
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Feature ID associated with the primitive; not required to be unique.
|
|
146
|
+
* @type {number}
|
|
147
|
+
*/
|
|
148
|
+
get featureId() {
|
|
149
|
+
return this._getUint32(BufferPrimitive.Layout.FEATURE_ID_U32);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
set featureId(featureId) {
|
|
153
|
+
this._setUint32(BufferPrimitive.Layout.FEATURE_ID_U32, featureId);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Whether primitive is shown.
|
|
158
|
+
* @type {boolean}
|
|
159
|
+
*/
|
|
160
|
+
get show() {
|
|
161
|
+
return this._getUint8(BufferPrimitive.Layout.SHOW_U8) === 1;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
set show(show) {
|
|
165
|
+
this._setUint8(BufferPrimitive.Layout.SHOW_U8, show ? 1 : 0);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @param {BufferPrimitiveMaterial} result
|
|
170
|
+
* @returns {BufferPrimitiveMaterial}
|
|
171
|
+
*/
|
|
172
|
+
getMaterial(result) {
|
|
173
|
+
const collection = this._collection;
|
|
174
|
+
const MaterialClass = collection._getMaterialClass();
|
|
175
|
+
|
|
176
|
+
return MaterialClass.unpack(
|
|
177
|
+
collection._materialView,
|
|
178
|
+
this._index * MaterialClass.packedLength,
|
|
179
|
+
result,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @param {BufferPrimitiveMaterial} material
|
|
185
|
+
*/
|
|
186
|
+
setMaterial(material) {
|
|
187
|
+
const collection = this._collection;
|
|
188
|
+
const MaterialClass = collection._getMaterialClass();
|
|
189
|
+
|
|
190
|
+
MaterialClass.pack(
|
|
191
|
+
material,
|
|
192
|
+
collection._materialView,
|
|
193
|
+
this._index * MaterialClass.packedLength,
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
this._dirty = true;
|
|
197
|
+
|
|
198
|
+
return material;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Whether the primitive requires an update on next render. Renderers should
|
|
203
|
+
* _not_ iterate over all primitives each frame, but must instead inspect
|
|
204
|
+
* only the dirty range of the parent collection. This flag is managed
|
|
205
|
+
* automatically, by primitive setters and collection renderers.
|
|
206
|
+
*
|
|
207
|
+
* @type {boolean}
|
|
208
|
+
* @ignore
|
|
209
|
+
*
|
|
210
|
+
* @see BufferPrimitiveCollection#_dirtyOffset
|
|
211
|
+
* @see BufferPrimitiveCollection#_dirtyCount
|
|
212
|
+
*/
|
|
213
|
+
get _dirty() {
|
|
214
|
+
return this._getUint8(BufferPrimitive.Layout.DIRTY_U8) === 1;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
set _dirty(dirty) {
|
|
218
|
+
// Avoid `._setUint8()` here, which would infinitely loop `._dirty = true`.
|
|
219
|
+
this._collection._primitiveView.setUint8(
|
|
220
|
+
this._byteOffset + BufferPrimitive.Layout.DIRTY_U8,
|
|
221
|
+
dirty ? 1 : 0,
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
// A 'dirty' primitive is responsible for notifying the collection. Applying
|
|
225
|
+
// updates and marking the primitive 'clean' will be handled by the collection,
|
|
226
|
+
// so we don't notify the collection here in that case.
|
|
227
|
+
if (dirty) {
|
|
228
|
+
this._collection._makeDirty(this._index);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Pick ID (uint32) of primitive.
|
|
234
|
+
* @type {number}
|
|
235
|
+
* @ignore
|
|
236
|
+
*/
|
|
237
|
+
get _pickId() {
|
|
238
|
+
return this._getUint32(BufferPrimitive.Layout.PICK_ID_U32);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
set _pickId(pickId) {
|
|
242
|
+
this._setUint32(BufferPrimitive.Layout.PICK_ID_U32, pickId);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
246
|
+
// BUFFER ACCESSORS
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @param {number} itemByteOffset
|
|
250
|
+
* @returns {number}
|
|
251
|
+
* @ignore
|
|
252
|
+
*/
|
|
253
|
+
_getUint8(itemByteOffset) {
|
|
254
|
+
return this._collection._primitiveView.getUint8(
|
|
255
|
+
this._byteOffset + itemByteOffset,
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @param {number} itemByteOffset
|
|
261
|
+
* @param {number} itemValue
|
|
262
|
+
* @ignore
|
|
263
|
+
*/
|
|
264
|
+
_setUint8(itemByteOffset, itemValue) {
|
|
265
|
+
this._collection._primitiveView.setUint8(
|
|
266
|
+
this._byteOffset + itemByteOffset,
|
|
267
|
+
itemValue,
|
|
268
|
+
);
|
|
269
|
+
this._dirty = true;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* @param {number} itemByteOffset
|
|
274
|
+
* @returns {number}
|
|
275
|
+
* @ignore
|
|
276
|
+
*/
|
|
277
|
+
_getUint32(itemByteOffset) {
|
|
278
|
+
return this._collection._primitiveView.getUint32(
|
|
279
|
+
this._byteOffset + itemByteOffset,
|
|
280
|
+
true,
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @param {number} itemByteOffset
|
|
286
|
+
* @param {number} itemValue
|
|
287
|
+
* @ignore
|
|
288
|
+
*/
|
|
289
|
+
_setUint32(itemByteOffset, itemValue) {
|
|
290
|
+
this._collection._primitiveView.setUint32(
|
|
291
|
+
this._byteOffset + itemByteOffset,
|
|
292
|
+
itemValue,
|
|
293
|
+
true,
|
|
294
|
+
);
|
|
295
|
+
this._dirty = true;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @param {number} itemByteOffset
|
|
300
|
+
* @returns {number}
|
|
301
|
+
* @ignore
|
|
302
|
+
*/
|
|
303
|
+
_getFloat32(itemByteOffset) {
|
|
304
|
+
return this._collection._primitiveView.getFloat32(
|
|
305
|
+
this._byteOffset + itemByteOffset,
|
|
306
|
+
true,
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @param {number} itemByteOffset
|
|
312
|
+
* @param {number} itemValue
|
|
313
|
+
* @ignore
|
|
314
|
+
*/
|
|
315
|
+
_setFloat32(itemByteOffset, itemValue) {
|
|
316
|
+
this._collection._primitiveView.setFloat32(
|
|
317
|
+
this._byteOffset + itemByteOffset,
|
|
318
|
+
itemValue,
|
|
319
|
+
true,
|
|
320
|
+
);
|
|
321
|
+
this._dirty = true;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
325
|
+
// DEBUG
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Returns a JSON-serializable object representing the primitive. This encoding
|
|
329
|
+
* is not memory-efficient, and should generally be used for debugging and
|
|
330
|
+
* testing.
|
|
331
|
+
*
|
|
332
|
+
* @returns {Object} JSON-serializable object.
|
|
333
|
+
*/
|
|
334
|
+
toJSON() {
|
|
335
|
+
const collection = this._collection;
|
|
336
|
+
const MaterialClass = collection._getMaterialClass();
|
|
337
|
+
|
|
338
|
+
return {
|
|
339
|
+
featureId: this.featureId,
|
|
340
|
+
show: this.show,
|
|
341
|
+
dirty: this._dirty,
|
|
342
|
+
material: this.getMaterial(new MaterialClass()).toJSON(),
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export default BufferPrimitive;
|