@cesium/engine 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{AttributeCompression-4589338a.js → AttributeCompression-b646d393.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-bfb1234f.js → AxisAlignedBoundingBox-a4321399.js} +1 -1
- package/Build/Workers/{BoundingRectangle-7ffc2153.js → BoundingRectangle-80d8801f.js} +1 -1
- package/Build/Workers/{BoxGeometry-93f344a3.js → BoxGeometry-33c10a4f.js} +1 -1
- package/Build/Workers/{Color-0c5aaf47.js → Color-1bf9a6e0.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-6597982a.js → CoplanarPolygonGeometryLibrary-5c5b981b.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-2119580e.js → CorridorGeometryLibrary-7cbae7a0.js} +1 -1
- package/Build/Workers/{CylinderGeometry-f9503c6d.js → CylinderGeometry-42740df0.js} +1 -1
- package/Build/Workers/{EllipseGeometry-fedf72d5.js → EllipseGeometry-49a3ac21.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-4ea68687.js → EllipseGeometryLibrary-b891b2f8.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-e2ae6a35.js → EllipseOutlineGeometry-fbd72e07.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-16de63ea.js → EllipsoidGeodesic-98c62a56.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-95c0330e.js → EllipsoidGeometry-a351dba8.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-d6d2ceec.js → EllipsoidOutlineGeometry-3e8779bf.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-ae5e65e0.js → EllipsoidRhumbLine-19756602.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-bfc674bf.js → EllipsoidTangentPlane-cfb50678.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-f473ea18.js → EncodedCartesian3-81f70735.js} +1 -1
- package/Build/Workers/{FrustumGeometry-3bf2e4eb.js → FrustumGeometry-c5754412.js} +1 -1
- package/Build/Workers/{GeometryAttribute-df5f473e.js → GeometryAttribute-0bfd05e8.js} +1 -1
- package/Build/Workers/{GeometryInstance-aa75b4cf.js → GeometryInstance-451dc1cd.js} +1 -1
- package/Build/Workers/{GeometryPipeline-f0e46c42.js → GeometryPipeline-0166905d.js} +1 -1
- package/Build/Workers/{IntersectionTests-9de29d51.js → IntersectionTests-a93d3de9.js} +1 -1
- package/Build/Workers/{Matrix2-ce637455.js → Matrix2-13178034.js} +4 -2
- package/Build/Workers/{Matrix3-4f4df527.js → Matrix3-315394f6.js} +2 -1
- package/Build/Workers/{OrientedBoundingBox-d3ff3d4d.js → OrientedBoundingBox-b450cb61.js} +5 -5
- package/Build/Workers/{Plane-b81241c2.js → Plane-900aa728.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-6f4937bb.js → PolygonGeometryLibrary-f918ac26.js} +1 -1
- package/Build/Workers/PolygonPipeline-f59a8f0a.js +1345 -0
- package/Build/Workers/{PolylinePipeline-2e2b015c.js → PolylinePipeline-d8e6bd9b.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-7ee1d449.js → PolylineVolumeGeometryLibrary-125d2edf.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-a9b7aae0.js → PrimitivePipeline-0d7b5ed4.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-9aa6c8f6.js → RectangleGeometryLibrary-0768db63.js} +1 -1
- package/Build/Workers/{TerrainEncoding-b52dcfc5.js → TerrainEncoding-06470d7f.js} +1 -1
- package/Build/Workers/{Transforms-2f755df8.js → Transforms-26539bce.js} +97 -83
- package/Build/Workers/{WallGeometryLibrary-ab19a93d.js → WallGeometryLibrary-6167b0fc.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-9f25de49.js → WebMercatorProjection-13a90d41.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +25 -1
- package/Build/Workers/combineGeometry.js +1 -1
- package/Build/Workers/createBoxGeometry.js +1 -1
- package/Build/Workers/createBoxOutlineGeometry.js +1 -1
- package/Build/Workers/createCircleGeometry.js +1 -1
- package/Build/Workers/createCircleOutlineGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createCorridorGeometry.js +1 -1
- package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
- package/Build/Workers/createCylinderGeometry.js +1 -1
- package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipseGeometry.js +1 -1
- package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipsoidGeometry.js +1 -1
- package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
- package/Build/Workers/createFrustumGeometry.js +1 -1
- package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
- package/Build/Workers/createGeometry.js +1 -1
- package/Build/Workers/createGroundPolylineGeometry.js +1 -1
- package/Build/Workers/createPlaneGeometry.js +1 -1
- package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
- package/Build/Workers/createPolygonGeometry.js +1 -1
- package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createPolylineGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
- package/Build/Workers/createRectangleGeometry.js +1 -1
- package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
- package/Build/Workers/createSimplePolylineGeometry.js +1 -1
- package/Build/Workers/createSphereGeometry.js +1 -1
- package/Build/Workers/createSphereOutlineGeometry.js +1 -1
- package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
- package/Build/Workers/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePoints.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVectorTilePolylines.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +7 -3
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +25 -1
- package/Build/Workers/transferTypedArrayTest.js +25 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/Source/Core/EarthOrientationParameters.js +67 -63
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Matrix2.js +2 -1
- package/Source/Core/Matrix3.js +2 -1
- package/Source/Core/Matrix4.js +1 -0
- package/Source/Core/OrientedBoundingBox.js +4 -4
- package/Source/Core/S2Cell.js +3 -3
- package/Source/Core/Transforms.js +3 -7
- package/Source/DataSources/GpxDataSource.js +4 -6
- package/Source/DataSources/KmlDataSource.js +3 -5
- package/Source/Renderer/Context.js +27 -9
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Scene/Cesium3DTileContentType.js +19 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +482 -0
- package/Source/Scene/Cesium3DTilesetMetadata.js +2 -2
- package/Source/Scene/ContentMetadata.js +2 -2
- package/Source/Scene/DerivedCommand.js +7 -0
- package/Source/Scene/Expression.js +1 -1
- package/Source/Scene/Globe.js +10 -0
- package/Source/Scene/GlobeSurfaceTileProvider.js +7 -0
- package/Source/Scene/GltfImageLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +10 -2
- package/Source/Scene/GroupMetadata.js +2 -2
- package/Source/Scene/ImplicitMetadataView.js +2 -2
- package/Source/Scene/ImplicitSubtreeCache.js +127 -0
- package/Source/Scene/ImplicitSubtreeMetadata.js +2 -2
- package/Source/Scene/ImplicitTileset.js +3 -2
- package/Source/Scene/KeyframeNode.js +47 -0
- package/Source/Scene/Megatexture.js +490 -0
- package/Source/Scene/MetadataClass.js +60 -25
- package/Source/Scene/MetadataClassProperty.js +132 -68
- package/Source/Scene/MetadataComponentType.js +78 -57
- package/Source/Scene/MetadataEnum.js +59 -23
- package/Source/Scene/MetadataEnumValue.js +49 -15
- package/Source/Scene/MetadataSchema.js +53 -24
- package/Source/Scene/MetadataSchemaLoader.js +2 -2
- package/Source/Scene/MetadataTableProperty.js +2 -2
- package/Source/Scene/MetadataType.js +6 -14
- package/Source/Scene/Model/GeoJsonLoader.js +1 -1
- package/Source/Scene/Model/Model.js +2 -3
- package/Source/Scene/Model/buildDrawCommand.js +19 -11
- package/Source/Scene/PointCloud.js +1 -1
- package/Source/Scene/PropertyAttribute.js +2 -2
- package/Source/Scene/PropertyAttributeProperty.js +2 -2
- package/Source/Scene/PropertyTable.js +2 -2
- package/Source/Scene/PropertyTexture.js +2 -2
- package/Source/Scene/PropertyTextureProperty.js +2 -2
- package/Source/Scene/ResourceCache.js +9 -1
- package/Source/Scene/ResourceCacheKey.js +9 -1
- package/Source/Scene/Scene.js +17 -0
- package/Source/Scene/SpatialNode.js +375 -0
- package/Source/Scene/StructuralMetadata.js +2 -2
- package/Source/Scene/TileMetadata.js +2 -2
- package/Source/Scene/TilesetMetadata.js +2 -2
- package/Source/Scene/VoxelBoxShape.js +527 -0
- package/Source/Scene/VoxelContent.js +169 -0
- package/Source/Scene/VoxelCylinderShape.js +937 -0
- package/Source/Scene/VoxelEllipsoidShape.js +937 -0
- package/Source/Scene/VoxelPrimitive.js +1919 -0
- package/Source/Scene/VoxelProvider.js +255 -0
- package/Source/Scene/VoxelRenderResources.js +224 -0
- package/Source/Scene/VoxelShape.js +152 -0
- package/Source/Scene/VoxelShapeType.js +105 -0
- package/Source/Scene/VoxelTraversal.js +1144 -0
- package/Source/Scene/buildVoxelDrawCommands.js +116 -0
- package/Source/Scene/parseBatchTable.js +18 -2
- package/Source/Scene/preprocess3DTileContent.js +8 -0
- package/Source/Scene/processVoxelProperties.js +455 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +1 -1
- package/Source/Shaders/BillboardCollectionVS.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passVoxels.js +11 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +17 -15
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +55 -43
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +55 -43
- package/Source/Shaders/GlobeFS.glsl +2 -1
- package/Source/Shaders/GlobeFS.js +2 -1
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +5 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.js +5 -2
- package/Source/Shaders/Voxels/IntersectBox.glsl +79 -0
- package/Source/Shaders/Voxels/IntersectBox.js +81 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +70 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +72 -0
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +273 -0
- package/Source/Shaders/Voxels/IntersectCylinder.js +275 -0
- package/Source/Shaders/Voxels/IntersectDepth.glsl +23 -0
- package/Source/Shaders/Voxels/IntersectDepth.js +25 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +337 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +339 -0
- package/Source/Shaders/Voxels/Intersection.glsl +54 -0
- package/Source/Shaders/Voxels/Intersection.js +56 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +151 -0
- package/Source/Shaders/Voxels/IntersectionUtils.js +153 -0
- package/Source/Shaders/Voxels/Megatexture.glsl +136 -0
- package/Source/Shaders/Voxels/Megatexture.js +138 -0
- package/Source/Shaders/Voxels/Octree.glsl +221 -0
- package/Source/Shaders/Voxels/Octree.js +223 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +150 -0
- package/Source/Shaders/Voxels/VoxelFS.js +152 -0
- package/Source/Shaders/Voxels/VoxelVS.glsl +11 -0
- package/Source/Shaders/Voxels/VoxelVS.js +13 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +16 -0
- package/Source/Shaders/Voxels/convertUvToBox.js +18 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +79 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.js +81 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +133 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +135 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -0
- package/index.d.ts +3124 -2287
- package/index.js +1117 -1085
- package/package.json +3 -4
- package/Build/Workers/PolygonPipeline-774a8aaf.js +0 -1341
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import CesiumMath from "../Core/Math.js";
|
|
2
2
|
import Check from "../Core/Check.js";
|
|
3
|
+
import ComponentDatatype from "../Core/ComponentDatatype.js";
|
|
3
4
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
4
5
|
import FeatureDetection from "../Core/FeatureDetection.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* An enum of metadata component types.
|
|
8
9
|
*
|
|
9
|
-
* @enum
|
|
10
|
-
* @private
|
|
10
|
+
* @enum {String}
|
|
11
11
|
* @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.
|
|
12
12
|
*/
|
|
13
13
|
const MetadataComponentType = {
|
|
@@ -16,7 +16,6 @@ const MetadataComponentType = {
|
|
|
16
16
|
*
|
|
17
17
|
* @type {String}
|
|
18
18
|
* @constant
|
|
19
|
-
* @private
|
|
20
19
|
*/
|
|
21
20
|
INT8: "INT8",
|
|
22
21
|
/**
|
|
@@ -24,7 +23,6 @@ const MetadataComponentType = {
|
|
|
24
23
|
*
|
|
25
24
|
* @type {String}
|
|
26
25
|
* @constant
|
|
27
|
-
* @private
|
|
28
26
|
*/
|
|
29
27
|
UINT8: "UINT8",
|
|
30
28
|
/**
|
|
@@ -32,7 +30,6 @@ const MetadataComponentType = {
|
|
|
32
30
|
*
|
|
33
31
|
* @type {String}
|
|
34
32
|
* @constant
|
|
35
|
-
* @private
|
|
36
33
|
*/
|
|
37
34
|
INT16: "INT16",
|
|
38
35
|
/**
|
|
@@ -40,7 +37,6 @@ const MetadataComponentType = {
|
|
|
40
37
|
*
|
|
41
38
|
* @type {String}
|
|
42
39
|
* @constant
|
|
43
|
-
* @private
|
|
44
40
|
*/
|
|
45
41
|
UINT16: "UINT16",
|
|
46
42
|
/**
|
|
@@ -48,7 +44,6 @@ const MetadataComponentType = {
|
|
|
48
44
|
*
|
|
49
45
|
* @type {String}
|
|
50
46
|
* @constant
|
|
51
|
-
* @private
|
|
52
47
|
*/
|
|
53
48
|
INT32: "INT32",
|
|
54
49
|
/**
|
|
@@ -56,7 +51,6 @@ const MetadataComponentType = {
|
|
|
56
51
|
*
|
|
57
52
|
* @type {String}
|
|
58
53
|
* @constant
|
|
59
|
-
* @private
|
|
60
54
|
*/
|
|
61
55
|
UINT32: "UINT32",
|
|
62
56
|
/**
|
|
@@ -66,7 +60,6 @@ const MetadataComponentType = {
|
|
|
66
60
|
*
|
|
67
61
|
* @type {String}
|
|
68
62
|
* @constant
|
|
69
|
-
* @private
|
|
70
63
|
*/
|
|
71
64
|
INT64: "INT64",
|
|
72
65
|
/**
|
|
@@ -76,7 +69,6 @@ const MetadataComponentType = {
|
|
|
76
69
|
*
|
|
77
70
|
* @type {String}
|
|
78
71
|
* @constant
|
|
79
|
-
* @private
|
|
80
72
|
*/
|
|
81
73
|
UINT64: "UINT64",
|
|
82
74
|
/**
|
|
@@ -84,7 +76,6 @@ const MetadataComponentType = {
|
|
|
84
76
|
*
|
|
85
77
|
* @type {String}
|
|
86
78
|
* @constant
|
|
87
|
-
* @private
|
|
88
79
|
*/
|
|
89
80
|
FLOAT32: "FLOAT32",
|
|
90
81
|
/**
|
|
@@ -92,7 +83,6 @@ const MetadataComponentType = {
|
|
|
92
83
|
*
|
|
93
84
|
* @type {String}
|
|
94
85
|
* @constant
|
|
95
|
-
* @private
|
|
96
86
|
*/
|
|
97
87
|
FLOAT64: "FLOAT64",
|
|
98
88
|
};
|
|
@@ -107,15 +97,11 @@ const MetadataComponentType = {
|
|
|
107
97
|
* @param {MetadataComponentType} type The type.
|
|
108
98
|
* @returns {Number|BigInt} The minimum value.
|
|
109
99
|
*
|
|
110
|
-
* @exception {DeveloperError} type must be a numeric type
|
|
111
|
-
*
|
|
112
100
|
* @private
|
|
113
101
|
*/
|
|
114
102
|
MetadataComponentType.getMinimum = function (type) {
|
|
115
103
|
//>>includeStart('debug', pragmas.debug);
|
|
116
|
-
|
|
117
|
-
throw new DeveloperError("type must be a numeric type");
|
|
118
|
-
}
|
|
104
|
+
Check.typeOf.string("type", type);
|
|
119
105
|
//>>includeEnd('debug');
|
|
120
106
|
|
|
121
107
|
switch (type) {
|
|
@@ -159,15 +145,11 @@ MetadataComponentType.getMinimum = function (type) {
|
|
|
159
145
|
* @param {MetadataComponentType} type The type.
|
|
160
146
|
* @returns {Number|BigInt} The maximum value.
|
|
161
147
|
*
|
|
162
|
-
* @exception {DeveloperError} type must be a numeric type
|
|
163
|
-
*
|
|
164
148
|
* @private
|
|
165
149
|
*/
|
|
166
150
|
MetadataComponentType.getMaximum = function (type) {
|
|
167
151
|
//>>includeStart('debug', pragmas.debug);
|
|
168
|
-
|
|
169
|
-
throw new DeveloperError("type must be a numeric type");
|
|
170
|
-
}
|
|
152
|
+
Check.typeOf.string("type", type);
|
|
171
153
|
//>>includeEnd('debug');
|
|
172
154
|
|
|
173
155
|
switch (type) {
|
|
@@ -203,36 +185,6 @@ MetadataComponentType.getMaximum = function (type) {
|
|
|
203
185
|
}
|
|
204
186
|
};
|
|
205
187
|
|
|
206
|
-
/**
|
|
207
|
-
* Returns whether the type is a numeric type.
|
|
208
|
-
*
|
|
209
|
-
* @param {MetadataComponentType} type The type.
|
|
210
|
-
* @returns {Boolean} Whether the type is a numeric type.
|
|
211
|
-
*
|
|
212
|
-
* @private
|
|
213
|
-
*/
|
|
214
|
-
MetadataComponentType.isNumericType = function (type) {
|
|
215
|
-
//>>includeStart('debug', pragmas.debug);
|
|
216
|
-
Check.typeOf.string("type", type);
|
|
217
|
-
//>>includeEnd('debug');
|
|
218
|
-
|
|
219
|
-
switch (type) {
|
|
220
|
-
case MetadataComponentType.INT8:
|
|
221
|
-
case MetadataComponentType.UINT8:
|
|
222
|
-
case MetadataComponentType.INT16:
|
|
223
|
-
case MetadataComponentType.UINT16:
|
|
224
|
-
case MetadataComponentType.INT32:
|
|
225
|
-
case MetadataComponentType.UINT32:
|
|
226
|
-
case MetadataComponentType.INT64:
|
|
227
|
-
case MetadataComponentType.UINT64:
|
|
228
|
-
case MetadataComponentType.FLOAT32:
|
|
229
|
-
case MetadataComponentType.FLOAT64:
|
|
230
|
-
return true;
|
|
231
|
-
default:
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
188
|
/**
|
|
237
189
|
* Returns whether the type is an integer type.
|
|
238
190
|
*
|
|
@@ -395,10 +347,16 @@ MetadataComponentType.unnormalize = function (value, type) {
|
|
|
395
347
|
return value;
|
|
396
348
|
};
|
|
397
349
|
|
|
350
|
+
/**
|
|
351
|
+
* @private
|
|
352
|
+
*/
|
|
398
353
|
MetadataComponentType.applyValueTransform = function (value, offset, scale) {
|
|
399
354
|
return scale * value + offset;
|
|
400
355
|
};
|
|
401
356
|
|
|
357
|
+
/**
|
|
358
|
+
* @private
|
|
359
|
+
*/
|
|
402
360
|
MetadataComponentType.unapplyValueTransform = function (value, offset, scale) {
|
|
403
361
|
// if the scale is 0, avoid a divide by zero error. The result can be any
|
|
404
362
|
// finite number, so 0.0 will do nicely.
|
|
@@ -415,16 +373,13 @@ MetadataComponentType.unapplyValueTransform = function (value, offset, scale) {
|
|
|
415
373
|
* @param {MetadataComponentType} type The type.
|
|
416
374
|
* @returns {Number} The size in bytes.
|
|
417
375
|
*
|
|
418
|
-
* @exception {DeveloperError} type must be a numeric type
|
|
419
|
-
*
|
|
420
376
|
* @private
|
|
421
377
|
*/
|
|
422
378
|
MetadataComponentType.getSizeInBytes = function (type) {
|
|
423
379
|
//>>includeStart('debug', pragmas.debug);
|
|
424
|
-
|
|
425
|
-
throw new DeveloperError("type must be a numeric type");
|
|
426
|
-
}
|
|
380
|
+
Check.typeOf.string("type", type);
|
|
427
381
|
//>>includeEnd('debug');
|
|
382
|
+
|
|
428
383
|
switch (type) {
|
|
429
384
|
case MetadataComponentType.INT8:
|
|
430
385
|
case MetadataComponentType.UINT8:
|
|
@@ -445,4 +400,70 @@ MetadataComponentType.getSizeInBytes = function (type) {
|
|
|
445
400
|
}
|
|
446
401
|
};
|
|
447
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Gets the {@link MetadataComponentType} from a {@link ComponentDatatype}.
|
|
405
|
+
*
|
|
406
|
+
* @param {ComponentDatatype} componentDatatype The component datatype.
|
|
407
|
+
* @returns {MetadataComponentType} The type.
|
|
408
|
+
*
|
|
409
|
+
* @private
|
|
410
|
+
*/
|
|
411
|
+
MetadataComponentType.fromComponentDatatype = function (componentDatatype) {
|
|
412
|
+
//>>includeStart('debug', pragmas.debug);
|
|
413
|
+
Check.typeOf.number("componentDatatype", componentDatatype);
|
|
414
|
+
//>>includeEnd('debug');
|
|
415
|
+
|
|
416
|
+
switch (componentDatatype) {
|
|
417
|
+
case ComponentDatatype.BYTE:
|
|
418
|
+
return MetadataComponentType.INT8;
|
|
419
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
420
|
+
return MetadataComponentType.UINT8;
|
|
421
|
+
case ComponentDatatype.SHORT:
|
|
422
|
+
return MetadataComponentType.INT16;
|
|
423
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
424
|
+
return MetadataComponentType.UINT16;
|
|
425
|
+
case ComponentDatatype.INT:
|
|
426
|
+
return MetadataComponentType.INT32;
|
|
427
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
428
|
+
return MetadataComponentType.UINT32;
|
|
429
|
+
case ComponentDatatype.FLOAT:
|
|
430
|
+
return MetadataComponentType.FLOAT32;
|
|
431
|
+
case ComponentDatatype.DOUBLE:
|
|
432
|
+
return MetadataComponentType.FLOAT64;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Gets the {@link ComponentDatatype} from a {@link MetadataComponentType}.
|
|
438
|
+
*
|
|
439
|
+
* @param {MetadataComponentType} type The type.
|
|
440
|
+
* @returns {ComponentDatatype} The component datatype.
|
|
441
|
+
*
|
|
442
|
+
* @private
|
|
443
|
+
*/
|
|
444
|
+
MetadataComponentType.toComponentDatatype = function (type) {
|
|
445
|
+
//>>includeStart('debug', pragmas.debug);
|
|
446
|
+
Check.typeOf.string("type", type);
|
|
447
|
+
//>>includeEnd('debug');
|
|
448
|
+
|
|
449
|
+
switch (type) {
|
|
450
|
+
case MetadataComponentType.INT8:
|
|
451
|
+
return ComponentDatatype.BYTE;
|
|
452
|
+
case MetadataComponentType.UINT8:
|
|
453
|
+
return ComponentDatatype.UNSIGNED_BYTE;
|
|
454
|
+
case MetadataComponentType.INT16:
|
|
455
|
+
return ComponentDatatype.SHORT;
|
|
456
|
+
case MetadataComponentType.UINT16:
|
|
457
|
+
return ComponentDatatype.UNSIGNED_SHORT;
|
|
458
|
+
case MetadataComponentType.INT32:
|
|
459
|
+
return ComponentDatatype.INT;
|
|
460
|
+
case MetadataComponentType.UINT32:
|
|
461
|
+
return ComponentDatatype.UNSIGNED_INT;
|
|
462
|
+
case MetadataComponentType.FLOAT32:
|
|
463
|
+
return ComponentDatatype.FLOAT;
|
|
464
|
+
case MetadataComponentType.FLOAT64:
|
|
465
|
+
return ComponentDatatype.DOUBLE;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
|
|
448
469
|
export default Object.freeze(MetadataComponentType);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Check from "../Core/Check.js";
|
|
2
|
+
import clone from "../Core/clone.js";
|
|
2
3
|
import defaultValue from "../Core/defaultValue.js";
|
|
3
4
|
import MetadataEnumValue from "./MetadataEnumValue.js";
|
|
4
5
|
import MetadataComponentType from "./MetadataComponentType.js";
|
|
@@ -6,38 +7,44 @@ import MetadataComponentType from "./MetadataComponentType.js";
|
|
|
6
7
|
/**
|
|
7
8
|
* A metadata enum.
|
|
8
9
|
* <p>
|
|
9
|
-
* See the {@link https://github.com/CesiumGS/3d-tiles/tree/main/
|
|
10
|
+
* See the {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata|3D Metadata Specification} for 3D Tiles
|
|
10
11
|
* </p>
|
|
11
12
|
*
|
|
12
13
|
* @param {Object} options Object with the following properties:
|
|
13
14
|
* @param {String} options.id The ID of the enum.
|
|
14
|
-
* @param {
|
|
15
|
+
* @param {MetadataEnumValue[]} options.values The enum values.
|
|
16
|
+
* @param {MetadataComponentType} [options.valueType=MetadataComponentType.UINT16] The enum value type.
|
|
17
|
+
* @param {String} [options.name] The name of the enum.
|
|
18
|
+
* @param {String} [options.description] The description of the enum.
|
|
19
|
+
* @param {*} [options.extras] Extra user-defined properties.
|
|
20
|
+
* @param {Object} [options.extensions] An object containing extensions.
|
|
15
21
|
*
|
|
16
22
|
* @alias MetadataEnum
|
|
17
23
|
* @constructor
|
|
18
|
-
* @private
|
|
19
24
|
* @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.
|
|
20
25
|
*/
|
|
21
26
|
function MetadataEnum(options) {
|
|
22
27
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
23
28
|
const id = options.id;
|
|
24
|
-
const
|
|
29
|
+
const values = options.values;
|
|
25
30
|
|
|
26
31
|
//>>includeStart('debug', pragmas.debug);
|
|
27
32
|
Check.typeOf.string("options.id", id);
|
|
28
|
-
Check.
|
|
33
|
+
Check.defined("options.values", values);
|
|
29
34
|
//>>includeEnd('debug');
|
|
30
35
|
|
|
31
36
|
const namesByValue = {};
|
|
32
37
|
const valuesByName = {};
|
|
33
|
-
|
|
38
|
+
|
|
39
|
+
const valuesLength = values.length;
|
|
40
|
+
for (let i = 0; i < valuesLength; ++i) {
|
|
41
|
+
const value = values[i];
|
|
34
42
|
namesByValue[value.value] = value.name;
|
|
35
43
|
valuesByName[value.name] = value.value;
|
|
36
|
-
|
|
37
|
-
});
|
|
44
|
+
}
|
|
38
45
|
|
|
39
46
|
const valueType = defaultValue(
|
|
40
|
-
|
|
47
|
+
options.valueType,
|
|
41
48
|
MetadataComponentType.UINT16
|
|
42
49
|
);
|
|
43
50
|
|
|
@@ -46,12 +53,49 @@ function MetadataEnum(options) {
|
|
|
46
53
|
this._valuesByName = valuesByName;
|
|
47
54
|
this._valueType = valueType;
|
|
48
55
|
this._id = id;
|
|
49
|
-
this._name =
|
|
50
|
-
this._description =
|
|
51
|
-
this._extras =
|
|
52
|
-
this._extensions =
|
|
56
|
+
this._name = options.name;
|
|
57
|
+
this._description = options.description;
|
|
58
|
+
this._extras = clone(options.extras, true);
|
|
59
|
+
this._extensions = clone(options.extensions, true);
|
|
53
60
|
}
|
|
54
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Creates a {@link MetadataEnum} from either 3D Tiles 1.1, 3DTILES_metadata, EXT_structural_metadata, or EXT_feature_metadata.
|
|
64
|
+
*
|
|
65
|
+
* @param {Object} options Object with the following properties:
|
|
66
|
+
* @param {String} options.id The ID of the enum.
|
|
67
|
+
* @param {Object} options.enum The enum JSON object.
|
|
68
|
+
*
|
|
69
|
+
* @returns {MetadataEnum} The newly created metadata enum.
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
* @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.
|
|
73
|
+
*/
|
|
74
|
+
MetadataEnum.fromJson = function (options) {
|
|
75
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
76
|
+
const id = options.id;
|
|
77
|
+
const enumDefinition = options.enum;
|
|
78
|
+
|
|
79
|
+
//>>includeStart('debug', pragmas.debug);
|
|
80
|
+
Check.typeOf.string("options.id", id);
|
|
81
|
+
Check.typeOf.object("options.enum", enumDefinition);
|
|
82
|
+
//>>includeEnd('debug');
|
|
83
|
+
|
|
84
|
+
const values = enumDefinition.values.map(function (value) {
|
|
85
|
+
return MetadataEnumValue.fromJson(value);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return new MetadataEnum({
|
|
89
|
+
id: id,
|
|
90
|
+
values: values,
|
|
91
|
+
valueType: MetadataComponentType[enumDefinition.valueType],
|
|
92
|
+
name: enumDefinition.name,
|
|
93
|
+
description: enumDefinition.description,
|
|
94
|
+
extras: enumDefinition.extras,
|
|
95
|
+
extensions: enumDefinition.extensions,
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
55
99
|
Object.defineProperties(MetadataEnum.prototype, {
|
|
56
100
|
/**
|
|
57
101
|
* The enum values.
|
|
@@ -59,7 +103,6 @@ Object.defineProperties(MetadataEnum.prototype, {
|
|
|
59
103
|
* @memberof MetadataEnum.prototype
|
|
60
104
|
* @type {MetadataEnumValue[]}
|
|
61
105
|
* @readonly
|
|
62
|
-
* @private
|
|
63
106
|
*/
|
|
64
107
|
values: {
|
|
65
108
|
get: function () {
|
|
@@ -103,8 +146,6 @@ Object.defineProperties(MetadataEnum.prototype, {
|
|
|
103
146
|
* @memberof MetadataEnum.prototype
|
|
104
147
|
* @type {MetadataComponentType}
|
|
105
148
|
* @readonly
|
|
106
|
-
*
|
|
107
|
-
* @private
|
|
108
149
|
*/
|
|
109
150
|
valueType: {
|
|
110
151
|
get: function () {
|
|
@@ -118,7 +159,6 @@ Object.defineProperties(MetadataEnum.prototype, {
|
|
|
118
159
|
* @memberof MetadataEnum.prototype
|
|
119
160
|
* @type {String}
|
|
120
161
|
* @readonly
|
|
121
|
-
* @private
|
|
122
162
|
*/
|
|
123
163
|
id: {
|
|
124
164
|
get: function () {
|
|
@@ -132,7 +172,6 @@ Object.defineProperties(MetadataEnum.prototype, {
|
|
|
132
172
|
* @memberof MetadataEnum.prototype
|
|
133
173
|
* @type {String}
|
|
134
174
|
* @readonly
|
|
135
|
-
* @private
|
|
136
175
|
*/
|
|
137
176
|
name: {
|
|
138
177
|
get: function () {
|
|
@@ -146,7 +185,6 @@ Object.defineProperties(MetadataEnum.prototype, {
|
|
|
146
185
|
* @memberof MetadataEnum.prototype
|
|
147
186
|
* @type {String}
|
|
148
187
|
* @readonly
|
|
149
|
-
* @private
|
|
150
188
|
*/
|
|
151
189
|
description: {
|
|
152
190
|
get: function () {
|
|
@@ -155,12 +193,11 @@ Object.defineProperties(MetadataEnum.prototype, {
|
|
|
155
193
|
},
|
|
156
194
|
|
|
157
195
|
/**
|
|
158
|
-
*
|
|
196
|
+
* Extra user-defined properties.
|
|
159
197
|
*
|
|
160
198
|
* @memberof MetadataEnum.prototype
|
|
161
199
|
* @type {*}
|
|
162
200
|
* @readonly
|
|
163
|
-
* @private
|
|
164
201
|
*/
|
|
165
202
|
extras: {
|
|
166
203
|
get: function () {
|
|
@@ -169,12 +206,11 @@ Object.defineProperties(MetadataEnum.prototype, {
|
|
|
169
206
|
},
|
|
170
207
|
|
|
171
208
|
/**
|
|
172
|
-
*
|
|
209
|
+
* An object containing extensions.
|
|
173
210
|
*
|
|
174
211
|
* @memberof MetadataEnum.prototype
|
|
175
212
|
* @type {Object}
|
|
176
213
|
* @readonly
|
|
177
|
-
* @private
|
|
178
214
|
*/
|
|
179
215
|
extensions: {
|
|
180
216
|
get: function () {
|
|
@@ -1,26 +1,65 @@
|
|
|
1
1
|
import Check from "../Core/Check.js";
|
|
2
|
+
import clone from "../Core/clone.js";
|
|
3
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* A metadata enum value.
|
|
7
|
+
* <p>
|
|
8
|
+
* See the {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata|3D Metadata Specification} for 3D Tiles
|
|
9
|
+
* </p>
|
|
5
10
|
*
|
|
6
|
-
* @param {Object}
|
|
11
|
+
* @param {Object} options Object with the following properties:
|
|
12
|
+
* @param {Number} options.value The integer value.
|
|
13
|
+
* @param {String} options.name The name of the enum value.
|
|
14
|
+
* @param {String} [options.description] The description of the enum value.
|
|
15
|
+
* @param {*} [options.extras] Extra user-defined properties.
|
|
16
|
+
* @param {Object} [options.extensions] An object containing extensions.
|
|
7
17
|
*
|
|
8
18
|
* @alias MetadataEnumValue
|
|
9
19
|
* @constructor
|
|
20
|
+
* @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.
|
|
21
|
+
*/
|
|
22
|
+
function MetadataEnumValue(options) {
|
|
23
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
24
|
+
const value = options.value;
|
|
25
|
+
const name = options.name;
|
|
26
|
+
|
|
27
|
+
//>>includeStart('debug', pragmas.debug);
|
|
28
|
+
Check.typeOf.number("options.value", value);
|
|
29
|
+
Check.typeOf.string("options.name", name);
|
|
30
|
+
|
|
31
|
+
//>>includeEnd('debug');
|
|
32
|
+
|
|
33
|
+
this._value = value;
|
|
34
|
+
this._name = name;
|
|
35
|
+
this._description = options.description;
|
|
36
|
+
this._extras = clone(options.extras, true);
|
|
37
|
+
this._extensions = clone(options.extensions, true);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a {@link MetadataEnumValue} from either 3D Tiles 1.1, 3DTILES_metadata, EXT_structural_metadata, or EXT_feature_metadata.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} value The enum value JSON object.
|
|
44
|
+
*
|
|
45
|
+
* @returns {MetadataEnumValue} The newly created metadata enum value.
|
|
46
|
+
*
|
|
10
47
|
* @private
|
|
11
48
|
* @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.
|
|
12
49
|
*/
|
|
13
|
-
function
|
|
50
|
+
MetadataEnumValue.fromJson = function (value) {
|
|
14
51
|
//>>includeStart('debug', pragmas.debug);
|
|
15
52
|
Check.typeOf.object("value", value);
|
|
16
53
|
//>>includeEnd('debug');
|
|
17
54
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
55
|
+
return new MetadataEnumValue({
|
|
56
|
+
value: value.value,
|
|
57
|
+
name: value.name,
|
|
58
|
+
description: value.description,
|
|
59
|
+
extras: value.extras,
|
|
60
|
+
extensions: value.extensions,
|
|
61
|
+
});
|
|
62
|
+
};
|
|
24
63
|
|
|
25
64
|
Object.defineProperties(MetadataEnumValue.prototype, {
|
|
26
65
|
/**
|
|
@@ -29,7 +68,6 @@ Object.defineProperties(MetadataEnumValue.prototype, {
|
|
|
29
68
|
* @memberof MetadataEnumValue.prototype
|
|
30
69
|
* @type {Number}
|
|
31
70
|
* @readonly
|
|
32
|
-
* @private
|
|
33
71
|
*/
|
|
34
72
|
value: {
|
|
35
73
|
get: function () {
|
|
@@ -43,7 +81,6 @@ Object.defineProperties(MetadataEnumValue.prototype, {
|
|
|
43
81
|
* @memberof MetadataEnumValue.prototype
|
|
44
82
|
* @type {String}
|
|
45
83
|
* @readonly
|
|
46
|
-
* @private
|
|
47
84
|
*/
|
|
48
85
|
name: {
|
|
49
86
|
get: function () {
|
|
@@ -57,7 +94,6 @@ Object.defineProperties(MetadataEnumValue.prototype, {
|
|
|
57
94
|
* @memberof MetadataEnumValue.prototype
|
|
58
95
|
* @type {String}
|
|
59
96
|
* @readonly
|
|
60
|
-
* @private
|
|
61
97
|
*/
|
|
62
98
|
description: {
|
|
63
99
|
get: function () {
|
|
@@ -66,12 +102,11 @@ Object.defineProperties(MetadataEnumValue.prototype, {
|
|
|
66
102
|
},
|
|
67
103
|
|
|
68
104
|
/**
|
|
69
|
-
*
|
|
105
|
+
* Extra user-defined properties.
|
|
70
106
|
*
|
|
71
107
|
* @memberof MetadataEnumValue.prototype
|
|
72
108
|
* @type {*}
|
|
73
109
|
* @readonly
|
|
74
|
-
* @private
|
|
75
110
|
*/
|
|
76
111
|
extras: {
|
|
77
112
|
get: function () {
|
|
@@ -80,12 +115,11 @@ Object.defineProperties(MetadataEnumValue.prototype, {
|
|
|
80
115
|
},
|
|
81
116
|
|
|
82
117
|
/**
|
|
83
|
-
*
|
|
118
|
+
* An object containing extensions.
|
|
84
119
|
*
|
|
85
120
|
* @memberof MetadataEnumValue.prototype
|
|
86
121
|
* @type {Object}
|
|
87
122
|
* @readonly
|
|
88
|
-
* @private
|
|
89
123
|
*/
|
|
90
124
|
extensions: {
|
|
91
125
|
get: function () {
|