@cesium/engine 14.0.0 → 15.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-EWDGNOJE.js → chunk-25TOENEE.js} +7 -7
- package/Build/Workers/{chunk-OMXHEJTK.js → chunk-2AVIUB5H.js} +2 -2
- package/Build/Workers/{chunk-LJBJM6VI.js → chunk-3JZGPJMZ.js} +6 -6
- package/Build/Workers/{chunk-DT5NFR5C.js → chunk-3LHBH4TC.js} +7 -7
- package/Build/Workers/{chunk-3QLSKXKF.js → chunk-3LZF23RY.js} +6 -6
- package/Build/Workers/{chunk-ED6GLQTK.js → chunk-5S2B46UQ.js} +1 -1
- package/Build/Workers/{chunk-B4GSRXE3.js → chunk-67ONR44K.js} +6 -6
- package/Build/Workers/{chunk-LOZ4NKY3.js → chunk-6EDBC234.js} +11 -11
- package/Build/Workers/{chunk-7ZB2RVIQ.js → chunk-6EV4VOET.js} +10 -10
- package/Build/Workers/{chunk-KHWLAQVA.js → chunk-7ITUZTFH.js} +1 -1
- package/Build/Workers/{chunk-JHBPC4LK.js → chunk-ARVZCY6X.js} +7 -7
- package/Build/Workers/{chunk-FFBJDW4A.js → chunk-B2UQN3DH.js} +6 -6
- package/Build/Workers/{chunk-VCNOFQYH.js → chunk-B2Y4ZS6X.js} +9 -9
- package/Build/Workers/{chunk-Q4ZVWJXX.js → chunk-BD2TPFGC.js} +5 -5
- package/Build/Workers/{chunk-K4AH3TDT.js → chunk-CHX2K5AC.js} +10 -10
- package/Build/Workers/{chunk-3LYROPON.js → chunk-CJGVEABL.js} +13 -13
- package/Build/Workers/{chunk-KSYBJA4M.js → chunk-DYJHEP3B.js} +5 -5
- package/Build/Workers/{chunk-CI2HEJFC.js → chunk-E3H7AVMK.js} +13 -13
- package/Build/Workers/{chunk-F4CUH4MR.js → chunk-EZNAJPP5.js} +4 -4
- package/Build/Workers/{chunk-YJX7X577.js → chunk-F7ZI463G.js} +15 -15
- package/Build/Workers/{chunk-HEZHXDYB.js → chunk-FMZ5CX6V.js} +1 -1
- package/Build/Workers/{chunk-G3BVMPWG.js → chunk-FRAWHNSR.js} +2 -2
- package/Build/Workers/{chunk-J7IH4EYI.js → chunk-GGV2XJHE.js} +7 -7
- package/Build/Workers/{chunk-5KWRW7YL.js → chunk-GK4QU6QI.js} +2 -2
- package/Build/Workers/{chunk-77XPS7ZA.js → chunk-HYPB7FAV.js} +10 -10
- package/Build/Workers/{chunk-MVM4JV5U.js → chunk-I4HO2ED2.js} +9 -9
- package/Build/Workers/{chunk-FX4R4MTH.js → chunk-IGINOLDX.js} +6 -6
- package/Build/Workers/{chunk-PWF4EY5P.js → chunk-ISQSYLZY.js} +4 -4
- package/Build/Workers/{chunk-7UHKH6M3.js → chunk-JZAMRL5I.js} +6 -6
- package/Build/Workers/{chunk-HUFQVUMY.js → chunk-K5G2WELR.js} +7 -7
- package/Build/Workers/{chunk-5S5OOA6U.js → chunk-L5SO4Y5V.js} +1 -1
- package/Build/Workers/{chunk-LNSWJ43X.js → chunk-LCMJQVIF.js} +11 -11
- package/Build/Workers/{chunk-WVNLSTOF.js → chunk-MWJW37I7.js} +2 -2
- package/Build/Workers/{chunk-ZGFIT57T.js → chunk-NAGMYRDW.js} +27 -20
- package/Build/Workers/{chunk-SDIDRZDG.js → chunk-OYO6TKMU.js} +7 -7
- package/Build/Workers/{chunk-HKHQ3EDR.js → chunk-PUTA3AE2.js} +4 -4
- package/Build/Workers/{chunk-JPDKYBLF.js → chunk-Q5BHMNKU.js} +13 -13
- package/Build/Workers/{chunk-XK4OP6VA.js → chunk-QTEX3Y4V.js} +17 -17
- package/Build/Workers/{chunk-TVL3F7IU.js → chunk-QZKN2RXM.js} +1 -1
- package/Build/Workers/{chunk-Z3QWTHI7.js → chunk-RO2Z3LCR.js} +14 -14
- package/Build/Workers/{chunk-N2XAJBC6.js → chunk-RRN6LRDX.js} +12 -12
- package/Build/Workers/{chunk-FYGLNDKG.js → chunk-SLIA3GQP.js} +7 -7
- package/Build/Workers/{chunk-7EO56M5R.js → chunk-TFCOEX3W.js} +2 -2
- package/Build/Workers/{chunk-KM6MITPF.js → chunk-TU6ZXHVU.js} +5 -5
- package/Build/Workers/{chunk-LS3KVHYY.js → chunk-VJ2PDF64.js} +6 -6
- package/Build/Workers/{chunk-D7ZBZPHV.js → chunk-VMVPONIV.js} +5 -5
- package/Build/Workers/{chunk-3PIZQT3I.js → chunk-WPXU45PH.js} +4 -4
- package/Build/Workers/{chunk-WEHZP4SE.js → chunk-XDHM4G3P.js} +7 -7
- package/Build/Workers/{chunk-TY4DKOWR.js → chunk-XED3RXKO.js} +2 -2
- package/Build/Workers/{chunk-ZMNLEL6W.js → chunk-YNYCGTQH.js} +5 -5
- package/Build/Workers/{chunk-4CHMVQTQ.js → chunk-Z4SI54EB.js} +4 -4
- package/Build/Workers/{chunk-3JBEPBPL.js → chunk-ZVDLC3T4.js} +13 -13
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +20 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +50 -43
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PolygonGeometryLibrary.js +26 -4
- package/Source/Core/TexturePacker.js +166 -0
- package/Source/DataSources/BillboardVisualizer.js +3 -3
- package/Source/DataSources/EntityCluster.js +44 -19
- package/Source/Renderer/Context.js +0 -4
- package/Source/Renderer/Texture.js +6 -5
- package/Source/Renderer/TextureAtlas.js +802 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +86 -141
- package/Source/Scene/BillboardCollection.js +132 -202
- package/Source/Scene/BillboardLoadState.js +44 -0
- package/Source/Scene/BillboardTexture.js +348 -0
- package/Source/Scene/Camera.js +2 -2
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +380 -126
- package/Source/Scene/Cesium3DTilesetStatistics.js +0 -1
- package/Source/Scene/Expression.js +1 -0
- package/Source/Scene/GltfLoader.js +5 -7
- package/Source/Scene/ImplicitSubtree.js +2 -0
- package/Source/Scene/KeyframeNode.js +16 -2
- package/Source/Scene/LabelCollection.js +212 -182
- package/Source/Scene/Megatexture.js +145 -81
- package/Source/Scene/Model/CustomShader.js +0 -2
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/Model/ModelUtility.js +5 -1
- package/Source/Scene/Scene.js +39 -15
- package/Source/Scene/ScreenSpaceCameraController.js +0 -8
- package/Source/Scene/SpatialNode.js +4 -11
- package/Source/Scene/Vector3DTilePoints.js +2 -5
- package/Source/Scene/VoxelBoxShape.js +12 -5
- package/Source/Scene/VoxelCell.js +6 -5
- package/Source/Scene/VoxelContent.js +171 -107
- package/Source/Scene/VoxelCylinderShape.js +65 -58
- package/Source/Scene/VoxelEllipsoidShape.js +15 -5
- package/Source/Scene/VoxelMetadataOrder.js +12 -0
- package/Source/Scene/VoxelPrimitive.js +122 -54
- package/Source/Scene/VoxelProvider.js +34 -29
- package/Source/Scene/VoxelRenderResources.js +30 -7
- package/Source/Scene/VoxelShape.js +10 -3
- package/Source/Scene/VoxelTraversal.js +264 -180
- package/Source/Scene/processVoxelProperties.js +3 -0
- package/Source/Shaders/GlobeFS.glsl +10 -1
- package/Source/Shaders/GlobeFS.js +10 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +4 -16
- package/Source/Shaders/Voxels/Megatexture.js +4 -16
- package/Source/Shaders/Voxels/Octree.glsl +44 -7
- package/Source/Shaders/Voxels/Octree.js +44 -7
- package/Source/Shaders/Voxels/VoxelFS.glsl +9 -15
- package/Source/Shaders/Voxels/VoxelFS.js +9 -15
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +15 -15
- package/Source/Shaders/Voxels/convertUvToCylinder.js +15 -15
- package/index.d.ts +176 -79
- package/index.js +413 -409
- package/package.json +2 -2
- package/Source/Scene/TextureAtlas.js +0 -558
|
@@ -1,27 +1,50 @@
|
|
|
1
1
|
import Cartesian3 from "../Core/Cartesian3.js";
|
|
2
|
+
import Cesium3DTilesetMetadata from "./Cesium3DTilesetMetadata.js";
|
|
2
3
|
import Check from "../Core/Check.js";
|
|
3
4
|
import defaultValue from "../Core/defaultValue.js";
|
|
4
5
|
import defined from "../Core/defined.js";
|
|
5
6
|
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
6
|
-
import Matrix4 from "../Core/Matrix4.js";
|
|
7
|
-
import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
|
|
8
|
-
import Resource from "../Core/Resource.js";
|
|
9
|
-
import RuntimeError from "../Core/RuntimeError.js";
|
|
10
|
-
import Cesium3DTilesetMetadata from "./Cesium3DTilesetMetadata.js";
|
|
11
7
|
import hasExtension from "./hasExtension.js";
|
|
12
8
|
import ImplicitSubtree from "./ImplicitSubtree.js";
|
|
13
9
|
import ImplicitSubtreeCache from "./ImplicitSubtreeCache.js";
|
|
14
10
|
import ImplicitTileCoordinates from "./ImplicitTileCoordinates.js";
|
|
15
11
|
import ImplicitTileset from "./ImplicitTileset.js";
|
|
12
|
+
import Matrix4 from "../Core/Matrix4.js";
|
|
16
13
|
import MetadataSemantic from "./MetadataSemantic.js";
|
|
17
14
|
import MetadataType from "./MetadataType.js";
|
|
15
|
+
import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
|
|
18
16
|
import preprocess3DTileContent from "./preprocess3DTileContent.js";
|
|
17
|
+
import Resource from "../Core/Resource.js";
|
|
19
18
|
import ResourceCache from "./ResourceCache.js";
|
|
19
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
20
20
|
import VoxelBoxShape from "./VoxelBoxShape.js";
|
|
21
21
|
import VoxelContent from "./VoxelContent.js";
|
|
22
22
|
import VoxelCylinderShape from "./VoxelCylinderShape.js";
|
|
23
|
+
import VoxelMetadataOrder from "./VoxelMetadataOrder.js";
|
|
23
24
|
import VoxelShapeType from "./VoxelShapeType.js";
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} Cesium3DTilesVoxelProvider.ConstructorOptions
|
|
28
|
+
*
|
|
29
|
+
* Initialization options for the Cesium3DTilesVoxelProvider constructor
|
|
30
|
+
*
|
|
31
|
+
* @property {string} className The class in the tileset schema describing voxel metadata.
|
|
32
|
+
* @property {string[]} names The metadata names.
|
|
33
|
+
* @property {MetadataType[]} types The metadata types.
|
|
34
|
+
* @property {MetadataComponentType[]} componentTypes The metadata component types.
|
|
35
|
+
* @property {VoxelShapeType} shape The {@link VoxelShapeType}.
|
|
36
|
+
* @property {Cartesian3} dimensions The number of voxels per dimension of a tile. This is the same for all tiles in the dataset.
|
|
37
|
+
* @property {Cartesian3} [paddingBefore=Cartesian3.ZERO] The number of padding voxels before the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
|
|
38
|
+
* @property {Cartesian3} [paddingAfter=Cartesian3.ZERO] The number of padding voxels after the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
|
|
39
|
+
* @property {Matrix4} [globalTransform=Matrix4.IDENTITY] A transform from local space to global space.
|
|
40
|
+
* @property {Matrix4} [shapeTransform=Matrix4.IDENTITY] A transform from shape space to local space.
|
|
41
|
+
* @property {Cartesian3} [minBounds] The minimum bounds.
|
|
42
|
+
* @property {Cartesian3} [maxBounds] The maximum bounds.
|
|
43
|
+
* @property {number[][]} [minimumValues] The metadata minimum values.
|
|
44
|
+
* @property {number[][]} [maximumValues] The metadata maximum values.
|
|
45
|
+
* @property {number} [maximumTileCount] The maximum number of tiles that exist for this provider. This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory. If this value is not known it can be undefined.
|
|
46
|
+
*/
|
|
47
|
+
|
|
25
48
|
/**
|
|
26
49
|
* A {@link VoxelProvider} that fetches voxel data from a 3D Tiles tileset.
|
|
27
50
|
* <p>
|
|
@@ -35,7 +58,7 @@ import VoxelShapeType from "./VoxelShapeType.js";
|
|
|
35
58
|
* @constructor
|
|
36
59
|
* @augments VoxelProvider
|
|
37
60
|
*
|
|
38
|
-
* @param {
|
|
61
|
+
* @param {Cesium3DTilesVoxelProvider.ConstructorOptions} options An object describing initialization options
|
|
39
62
|
*
|
|
40
63
|
* @see Cesium3DTilesVoxelProvider.fromUrl
|
|
41
64
|
* @see VoxelProvider
|
|
@@ -47,58 +70,275 @@ import VoxelShapeType from "./VoxelShapeType.js";
|
|
|
47
70
|
function Cesium3DTilesVoxelProvider(options) {
|
|
48
71
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
49
72
|
|
|
50
|
-
|
|
51
|
-
|
|
73
|
+
const {
|
|
74
|
+
className,
|
|
75
|
+
names,
|
|
76
|
+
types,
|
|
77
|
+
componentTypes,
|
|
78
|
+
shape,
|
|
79
|
+
dimensions,
|
|
80
|
+
paddingBefore = Cartesian3.ZERO.clone(),
|
|
81
|
+
paddingAfter = Cartesian3.ZERO.clone(),
|
|
82
|
+
globalTransform = Matrix4.IDENTITY.clone(),
|
|
83
|
+
shapeTransform = Matrix4.IDENTITY.clone(),
|
|
84
|
+
minBounds,
|
|
85
|
+
maxBounds,
|
|
86
|
+
minimumValues,
|
|
87
|
+
maximumValues,
|
|
88
|
+
maximumTileCount,
|
|
89
|
+
} = options;
|
|
90
|
+
|
|
91
|
+
//>>includeStart('debug', pragmas.debug);
|
|
92
|
+
Check.typeOf.string("className", className);
|
|
93
|
+
Check.typeOf.object("names", names);
|
|
94
|
+
Check.typeOf.object("types", types);
|
|
95
|
+
Check.typeOf.object("componentTypes", componentTypes);
|
|
96
|
+
Check.typeOf.string("shape", shape);
|
|
97
|
+
Check.typeOf.object("dimensions", dimensions);
|
|
98
|
+
//>>includeEnd('debug');
|
|
99
|
+
|
|
100
|
+
this._shapeTransform = shapeTransform;
|
|
101
|
+
this._globalTransform = globalTransform;
|
|
102
|
+
this._shape = shape;
|
|
103
|
+
this._minBounds = minBounds;
|
|
104
|
+
this._maxBounds = maxBounds;
|
|
105
|
+
this._dimensions = dimensions;
|
|
106
|
+
this._paddingBefore = paddingBefore;
|
|
107
|
+
this._paddingAfter = paddingAfter;
|
|
108
|
+
this._className = className;
|
|
109
|
+
this._names = names;
|
|
110
|
+
this._types = types;
|
|
111
|
+
this._componentTypes = componentTypes;
|
|
112
|
+
this._metadataOrder = VoxelMetadataOrder.GLTF;
|
|
113
|
+
this._minimumValues = minimumValues;
|
|
114
|
+
this._maximumValues = maximumValues;
|
|
115
|
+
this._maximumTileCount = maximumTileCount;
|
|
116
|
+
this._availableLevels = undefined;
|
|
117
|
+
this._implicitTileset = undefined;
|
|
118
|
+
this._subtreeCache = new ImplicitSubtreeCache();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
122
|
+
/**
|
|
123
|
+
* A transform from local space to global space.
|
|
124
|
+
*
|
|
125
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
126
|
+
* @type {Matrix4}
|
|
127
|
+
* @default Matrix4.IDENTITY
|
|
128
|
+
* @readonly
|
|
129
|
+
*/
|
|
130
|
+
globalTransform: {
|
|
131
|
+
get: function () {
|
|
132
|
+
return this._globalTransform;
|
|
133
|
+
},
|
|
134
|
+
},
|
|
52
135
|
|
|
53
|
-
/**
|
|
54
|
-
|
|
136
|
+
/**
|
|
137
|
+
* A transform from shape space to local space.
|
|
138
|
+
*
|
|
139
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
140
|
+
* @type {Matrix4}
|
|
141
|
+
* @default Matrix4.IDENTITY
|
|
142
|
+
* @readonly
|
|
143
|
+
*/
|
|
144
|
+
shapeTransform: {
|
|
145
|
+
get: function () {
|
|
146
|
+
return this._shapeTransform;
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Gets the {@link VoxelShapeType}
|
|
152
|
+
*
|
|
153
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
154
|
+
* @type {VoxelShapeType}
|
|
155
|
+
* @readonly
|
|
156
|
+
*/
|
|
157
|
+
shape: {
|
|
158
|
+
get: function () {
|
|
159
|
+
return this._shape;
|
|
160
|
+
},
|
|
161
|
+
},
|
|
55
162
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Gets the minimum bounds.
|
|
165
|
+
* If undefined, the shape's default minimum bounds will be used instead.
|
|
166
|
+
*
|
|
167
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
168
|
+
* @type {Cartesian3|undefined}
|
|
169
|
+
* @readonly
|
|
170
|
+
*/
|
|
171
|
+
minBounds: {
|
|
172
|
+
get: function () {
|
|
173
|
+
return this._minBounds;
|
|
174
|
+
},
|
|
175
|
+
},
|
|
58
176
|
|
|
59
|
-
/**
|
|
60
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Gets the maximum bounds.
|
|
179
|
+
* If undefined, the shape's default maximum bounds will be used instead.
|
|
180
|
+
*
|
|
181
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
182
|
+
* @type {Cartesian3|undefined}
|
|
183
|
+
* @readonly
|
|
184
|
+
*/
|
|
185
|
+
maxBounds: {
|
|
186
|
+
get: function () {
|
|
187
|
+
return this._maxBounds;
|
|
188
|
+
},
|
|
189
|
+
},
|
|
61
190
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Gets the number of voxels per dimension of a tile. This is the same for all tiles in the dataset.
|
|
193
|
+
*
|
|
194
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
195
|
+
* @type {Cartesian3}
|
|
196
|
+
* @readonly
|
|
197
|
+
*/
|
|
198
|
+
dimensions: {
|
|
199
|
+
get: function () {
|
|
200
|
+
return this._dimensions;
|
|
201
|
+
},
|
|
202
|
+
},
|
|
64
203
|
|
|
65
|
-
/**
|
|
66
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Gets the number of padding voxels before the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
|
|
206
|
+
*
|
|
207
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
208
|
+
* @type {Cartesian3}
|
|
209
|
+
* @default Cartesian3.ZERO
|
|
210
|
+
* @readonly
|
|
211
|
+
*/
|
|
212
|
+
paddingBefore: {
|
|
213
|
+
get: function () {
|
|
214
|
+
return this._paddingBefore;
|
|
215
|
+
},
|
|
216
|
+
},
|
|
67
217
|
|
|
68
|
-
/**
|
|
69
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Gets the number of padding voxels after the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
|
|
220
|
+
*
|
|
221
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
222
|
+
* @type {Cartesian3}
|
|
223
|
+
* @default Cartesian3.ZERO
|
|
224
|
+
* @readonly
|
|
225
|
+
*/
|
|
226
|
+
paddingAfter: {
|
|
227
|
+
get: function () {
|
|
228
|
+
return this._paddingAfter;
|
|
229
|
+
},
|
|
230
|
+
},
|
|
70
231
|
|
|
71
|
-
/**
|
|
72
|
-
|
|
232
|
+
/**
|
|
233
|
+
* The metadata class for this tileset.
|
|
234
|
+
*
|
|
235
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
236
|
+
* @type {string}
|
|
237
|
+
* @readonly
|
|
238
|
+
*/
|
|
239
|
+
className: {
|
|
240
|
+
get: function () {
|
|
241
|
+
return this._className;
|
|
242
|
+
},
|
|
243
|
+
},
|
|
73
244
|
|
|
74
|
-
/**
|
|
75
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Gets the metadata names.
|
|
247
|
+
*
|
|
248
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
249
|
+
* @type {string[]}
|
|
250
|
+
* @readonly
|
|
251
|
+
*/
|
|
252
|
+
names: {
|
|
253
|
+
get: function () {
|
|
254
|
+
return this._names;
|
|
255
|
+
},
|
|
256
|
+
},
|
|
76
257
|
|
|
77
|
-
/**
|
|
78
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Gets the metadata types.
|
|
260
|
+
*
|
|
261
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
262
|
+
* @type {MetadataType[]}
|
|
263
|
+
* @readonly
|
|
264
|
+
*/
|
|
265
|
+
types: {
|
|
266
|
+
get: function () {
|
|
267
|
+
return this._types;
|
|
268
|
+
},
|
|
269
|
+
},
|
|
79
270
|
|
|
80
|
-
/**
|
|
81
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Gets the metadata component types.
|
|
273
|
+
*
|
|
274
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
275
|
+
* @type {MetadataComponentType[]}
|
|
276
|
+
* @readonly
|
|
277
|
+
*/
|
|
278
|
+
componentTypes: {
|
|
279
|
+
get: function () {
|
|
280
|
+
return this._componentTypes;
|
|
281
|
+
},
|
|
282
|
+
},
|
|
82
283
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Gets the ordering of the metadata in the buffers.
|
|
286
|
+
*
|
|
287
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
288
|
+
* @type {VoxelMetadataOrder}
|
|
289
|
+
* @readonly
|
|
290
|
+
*/
|
|
291
|
+
metadataOrder: {
|
|
292
|
+
get: function () {
|
|
293
|
+
return this._metadataOrder;
|
|
294
|
+
},
|
|
295
|
+
},
|
|
85
296
|
|
|
86
|
-
/**
|
|
87
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Gets the metadata minimum values.
|
|
299
|
+
*
|
|
300
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
301
|
+
* @type {number[][]|undefined}
|
|
302
|
+
* @readonly
|
|
303
|
+
*/
|
|
304
|
+
minimumValues: {
|
|
305
|
+
get: function () {
|
|
306
|
+
return this._minimumValues;
|
|
307
|
+
},
|
|
308
|
+
},
|
|
88
309
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Gets the metadata maximum values.
|
|
312
|
+
*
|
|
313
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
314
|
+
* @type {number[][]|undefined}
|
|
315
|
+
* @readonly
|
|
316
|
+
*/
|
|
317
|
+
maximumValues: {
|
|
318
|
+
get: function () {
|
|
319
|
+
return this._maximumValues;
|
|
320
|
+
},
|
|
321
|
+
},
|
|
91
322
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
323
|
+
/**
|
|
324
|
+
* The maximum number of tiles that exist for this provider.
|
|
325
|
+
* This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory.
|
|
326
|
+
* If this value is not known it can be undefined.
|
|
327
|
+
*
|
|
328
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
329
|
+
* @type {number|undefined}
|
|
330
|
+
* @readonly
|
|
331
|
+
*/
|
|
332
|
+
maximumTileCount: {
|
|
333
|
+
get: function () {
|
|
334
|
+
return this._maximumTileCount;
|
|
335
|
+
},
|
|
336
|
+
},
|
|
96
337
|
|
|
97
|
-
Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
98
338
|
/**
|
|
99
339
|
* The number of levels of detail containing available tiles in the tileset.
|
|
100
340
|
*
|
|
101
|
-
* @memberof
|
|
341
|
+
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
102
342
|
* @type {number|undefined}
|
|
103
343
|
* @readonly
|
|
104
344
|
*/
|
|
@@ -110,7 +350,7 @@ Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
|
110
350
|
});
|
|
111
351
|
|
|
112
352
|
/**
|
|
113
|
-
* Creates a {@link
|
|
353
|
+
* Creates a {@link Cesium3DTilesVoxelProvider} that fetches voxel data from a 3D Tiles tileset.
|
|
114
354
|
*
|
|
115
355
|
* @param {Resource|string} url The URL to a tileset JSON file
|
|
116
356
|
* @returns {Promise<Cesium3DTilesVoxelProvider>} The created provider
|
|
@@ -120,6 +360,22 @@ Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
|
120
360
|
* @exception {RuntimeException} Root tile must have implicit tiling
|
|
121
361
|
* @exception {RuntimeException} Tileset must have a metadata schema
|
|
122
362
|
* @exception {RuntimeException} Only box, region and 3DTILES_bounding_volume_cylinder are supported in Cesium3DTilesVoxelProvider
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* try {
|
|
366
|
+
* const voxelProvider = await Cesium3DTilesVoxelProvider.fromUrl(
|
|
367
|
+
* "http://localhost:8002/tilesets/voxel/tileset.json"
|
|
368
|
+
* );
|
|
369
|
+
* const voxelPrimitive = new VoxelPrimitive({
|
|
370
|
+
* provider: voxelProvider,
|
|
371
|
+
* customShader: customShader,
|
|
372
|
+
* });
|
|
373
|
+
* scene.primitives.add(voxelPrimitive);
|
|
374
|
+
* } catch (error) {
|
|
375
|
+
* console.error(`Error creating voxel primitive: ${error}`);
|
|
376
|
+
* }
|
|
377
|
+
*
|
|
378
|
+
* @see {@link VoxelPrimitive}
|
|
123
379
|
*/
|
|
124
380
|
Cesium3DTilesVoxelProvider.fromUrl = async function (url) {
|
|
125
381
|
//>>includeStart('debug', pragmas.debug);
|
|
@@ -134,48 +390,38 @@ Cesium3DTilesVoxelProvider.fromUrl = async function (url) {
|
|
|
134
390
|
const schemaLoader = getMetadataSchemaLoader(tilesetJson, resource);
|
|
135
391
|
await schemaLoader.load();
|
|
136
392
|
|
|
137
|
-
const root = tilesetJson
|
|
138
|
-
const voxel = root.content.extensions["3DTILES_content_voxels"];
|
|
139
|
-
const className = voxel.class;
|
|
393
|
+
const { root } = tilesetJson;
|
|
140
394
|
|
|
141
395
|
const metadataJson = hasExtension(tilesetJson, "3DTILES_metadata")
|
|
142
396
|
? tilesetJson.extensions["3DTILES_metadata"]
|
|
143
397
|
: tilesetJson;
|
|
144
398
|
|
|
145
|
-
const
|
|
146
|
-
const metadata = new Cesium3DTilesetMetadata({
|
|
399
|
+
const tilesetMetadata = new Cesium3DTilesetMetadata({
|
|
147
400
|
metadataJson: metadataJson,
|
|
148
|
-
schema:
|
|
401
|
+
schema: schemaLoader.schema,
|
|
149
402
|
});
|
|
150
403
|
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
addAttributeInfo(provider, metadata, className);
|
|
154
|
-
|
|
155
|
-
const implicitTileset = new ImplicitTileset(resource, root, metadataSchema);
|
|
156
|
-
|
|
157
|
-
const { shape, minBounds, maxBounds, shapeTransform, globalTransform } =
|
|
158
|
-
getShape(root);
|
|
404
|
+
const voxel = root.content.extensions["3DTILES_content_voxels"];
|
|
405
|
+
const className = voxel.class;
|
|
159
406
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
provider.maxBounds = maxBounds;
|
|
163
|
-
provider.dimensions = Cartesian3.unpack(voxel.dimensions);
|
|
164
|
-
provider.shapeTransform = shapeTransform;
|
|
165
|
-
provider.globalTransform = globalTransform;
|
|
166
|
-
provider.maximumTileCount = getTileCount(metadata);
|
|
407
|
+
const providerOptions = getAttributeInfo(tilesetMetadata, className);
|
|
408
|
+
Object.assign(providerOptions, getShape(root));
|
|
167
409
|
|
|
168
|
-
|
|
169
|
-
|
|
410
|
+
providerOptions.dimensions = Cartesian3.unpack(voxel.dimensions);
|
|
411
|
+
providerOptions.maximumTileCount = getTileCount(tilesetMetadata);
|
|
170
412
|
|
|
171
413
|
if (defined(voxel.padding)) {
|
|
172
|
-
paddingBefore = Cartesian3.unpack(voxel.padding.before);
|
|
173
|
-
paddingAfter = Cartesian3.unpack(voxel.padding.after);
|
|
414
|
+
providerOptions.paddingBefore = Cartesian3.unpack(voxel.padding.before);
|
|
415
|
+
providerOptions.paddingAfter = Cartesian3.unpack(voxel.padding.after);
|
|
174
416
|
}
|
|
175
417
|
|
|
176
|
-
provider
|
|
177
|
-
provider.paddingAfter = paddingAfter;
|
|
418
|
+
const provider = new Cesium3DTilesVoxelProvider(providerOptions);
|
|
178
419
|
|
|
420
|
+
const implicitTileset = new ImplicitTileset(
|
|
421
|
+
resource,
|
|
422
|
+
root,
|
|
423
|
+
schemaLoader.schema,
|
|
424
|
+
);
|
|
179
425
|
provider._implicitTileset = implicitTileset;
|
|
180
426
|
provider._availableLevels = implicitTileset.availableLevels;
|
|
181
427
|
|
|
@@ -315,7 +561,7 @@ function getMetadataSchemaLoader(tilesetJson, resource) {
|
|
|
315
561
|
});
|
|
316
562
|
}
|
|
317
563
|
|
|
318
|
-
function
|
|
564
|
+
function getAttributeInfo(metadata, className) {
|
|
319
565
|
const { schema, statistics } = metadata;
|
|
320
566
|
const classStatistics = statistics?.classes[className];
|
|
321
567
|
const properties = schema.classes[className].properties;
|
|
@@ -331,16 +577,22 @@ function addAttributeInfo(provider, metadata, className) {
|
|
|
331
577
|
return { id, type, componentType, minValue, maxValue };
|
|
332
578
|
});
|
|
333
579
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
580
|
+
const names = propertyInfo.map((info) => info.id);
|
|
581
|
+
const types = propertyInfo.map((info) => info.type);
|
|
582
|
+
const componentTypes = propertyInfo.map((info) => info.componentType);
|
|
337
583
|
|
|
338
584
|
const minimumValues = propertyInfo.map((info) => info.minValue);
|
|
339
585
|
const maximumValues = propertyInfo.map((info) => info.maxValue);
|
|
340
586
|
const hasMinimumValues = minimumValues.some(defined);
|
|
341
587
|
|
|
342
|
-
|
|
343
|
-
|
|
588
|
+
return {
|
|
589
|
+
className,
|
|
590
|
+
names,
|
|
591
|
+
types,
|
|
592
|
+
componentTypes,
|
|
593
|
+
minimumValues: hasMinimumValues ? minimumValues : undefined,
|
|
594
|
+
maximumValues: hasMinimumValues ? maximumValues : undefined,
|
|
595
|
+
};
|
|
344
596
|
}
|
|
345
597
|
|
|
346
598
|
function copyArray(values, length) {
|
|
@@ -356,29 +608,14 @@ function copyArray(values, length) {
|
|
|
356
608
|
return Array.from({ length }, (v, i) => valuesArray[i]);
|
|
357
609
|
}
|
|
358
610
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const arrayBuffer = await voxelResource.fetchArrayBuffer();
|
|
369
|
-
const preprocessed = preprocess3DTileContent(arrayBuffer);
|
|
370
|
-
|
|
371
|
-
const voxelContent = await VoxelContent.fromJson(
|
|
372
|
-
voxelResource,
|
|
373
|
-
preprocessed.jsonPayload,
|
|
374
|
-
preprocessed.binaryPayload,
|
|
375
|
-
implicitTileset.metadataSchema,
|
|
376
|
-
);
|
|
377
|
-
|
|
378
|
-
return voxelContent;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
async function getSubtreePromise(provider, subtreeCoord) {
|
|
611
|
+
/**
|
|
612
|
+
* Get the subtree at a given subtree coordinate
|
|
613
|
+
* @param {VoxelProvider} provider The voxel provider
|
|
614
|
+
* @param {ImplicitTileCoordinates} subtreeCoord The coordinate at which to retrieve the subtree
|
|
615
|
+
* @returns {Promise<ImplicitSubtree>} The subtree at the given coordinate
|
|
616
|
+
* @private
|
|
617
|
+
*/
|
|
618
|
+
async function getSubtree(provider, subtreeCoord) {
|
|
382
619
|
const implicitTileset = provider._implicitTileset;
|
|
383
620
|
const subtreeCache = provider._subtreeCache;
|
|
384
621
|
|
|
@@ -419,27 +656,38 @@ async function getSubtreePromise(provider, subtreeCoord) {
|
|
|
419
656
|
return subtree;
|
|
420
657
|
}
|
|
421
658
|
|
|
422
|
-
/**
|
|
423
|
-
|
|
659
|
+
/**
|
|
660
|
+
* Requests the data for a given tile.
|
|
661
|
+
*
|
|
662
|
+
* @param {object} [options] Object with the following properties:
|
|
663
|
+
* @param {number} [options.tileLevel=0] The tile's level.
|
|
664
|
+
* @param {number} [options.tileX=0] The tile's X coordinate.
|
|
665
|
+
* @param {number} [options.tileY=0] The tile's Y coordinate.
|
|
666
|
+
* @param {number} [options.tileZ=0] The tile's Z coordinate.
|
|
667
|
+
* @privateparam {number} [options.keyframe=0] The requested keyframe.
|
|
668
|
+
* @returns {Promise<VoxelContent>|undefined} A promise resolving to a VoxelContent containing the data for the tile, or undefined if the request could not be scheduled this frame.
|
|
669
|
+
*/
|
|
670
|
+
Cesium3DTilesVoxelProvider.prototype.requestData = async function (options) {
|
|
424
671
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
672
|
+
const {
|
|
673
|
+
tileLevel = 0,
|
|
674
|
+
tileX = 0,
|
|
675
|
+
tileY = 0,
|
|
676
|
+
tileZ = 0,
|
|
677
|
+
keyframe = 0,
|
|
678
|
+
} = options;
|
|
430
679
|
|
|
431
|
-
// 3D Tiles currently doesn't support time-dynamic data.
|
|
432
680
|
if (keyframe !== 0) {
|
|
433
|
-
return
|
|
681
|
+
return Promise.reject(
|
|
682
|
+
`3D Tiles currently doesn't support time-dynamic data.`,
|
|
683
|
+
);
|
|
434
684
|
}
|
|
435
685
|
|
|
436
686
|
// 1. Load the subtree that the tile belongs to (possibly from the subtree cache)
|
|
437
687
|
// 2. Load the voxel content if available
|
|
438
688
|
|
|
439
|
-
const implicitTileset = this._implicitTileset;
|
|
440
|
-
const names = this.names;
|
|
441
|
-
|
|
442
689
|
// Can't use a scratch variable here because the object is used inside the promise chain.
|
|
690
|
+
const implicitTileset = this._implicitTileset;
|
|
443
691
|
const tileCoordinates = new ImplicitTileCoordinates({
|
|
444
692
|
subdivisionScheme: implicitTileset.subdivisionScheme,
|
|
445
693
|
subtreeLevels: implicitTileset.subtreeLevels,
|
|
@@ -461,23 +709,29 @@ Cesium3DTilesVoxelProvider.prototype.requestData = function (options) {
|
|
|
461
709
|
|
|
462
710
|
const that = this;
|
|
463
711
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
712
|
+
const subtree = await getSubtree(that, subtreeCoord);
|
|
713
|
+
// NOTE: these two subtree methods are ONLY used by voxels!
|
|
714
|
+
const isAvailable = isSubtreeRoot
|
|
715
|
+
? subtree.childSubtreeIsAvailableAtCoordinates
|
|
716
|
+
: subtree.tileIsAvailableAtCoordinates;
|
|
717
|
+
|
|
718
|
+
const available = isAvailable.call(subtree, tileCoordinates);
|
|
719
|
+
|
|
720
|
+
if (!available) {
|
|
721
|
+
return Promise.reject(
|
|
722
|
+
`Tile is not available at level ${tileLevel}, x ${tileX}, y ${tileY}, z ${tileZ}.`,
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const { contentUriTemplates, baseResource } = implicitTileset;
|
|
727
|
+
const gltfRelative = contentUriTemplates[0].getDerivedResource({
|
|
728
|
+
templateValues: tileCoordinates.getTemplateValues(),
|
|
729
|
+
});
|
|
730
|
+
const gltfResource = baseResource.getDerivedResource({
|
|
731
|
+
url: gltfRelative.url,
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
return VoxelContent.fromGltf(gltfResource);
|
|
481
735
|
};
|
|
482
736
|
|
|
483
737
|
export default Cesium3DTilesVoxelProvider;
|
|
@@ -170,7 +170,6 @@ Cesium3DTilesetStatistics.clone = function (statistics, result) {
|
|
|
170
170
|
result.selected = statistics.selected;
|
|
171
171
|
result.visited = statistics.visited;
|
|
172
172
|
result.numberOfCommands = statistics.numberOfCommands;
|
|
173
|
-
result.selected = statistics.selected;
|
|
174
173
|
result.numberOfAttemptedRequests = statistics.numberOfAttemptedRequests;
|
|
175
174
|
result.numberOfPendingRequests = statistics.numberOfPendingRequests;
|
|
176
175
|
result.numberOfTilesProcessing = statistics.numberOfTilesProcessing;
|
|
@@ -1225,6 +1225,7 @@ Node.prototype._evaluateVariableString = function (feature) {
|
|
|
1225
1225
|
property = "";
|
|
1226
1226
|
}
|
|
1227
1227
|
result = result.replace(placeholder, property);
|
|
1228
|
+
variableRegex.lastIndex += property.length - placeholder.length;
|
|
1228
1229
|
match = variableRegex.exec(result);
|
|
1229
1230
|
}
|
|
1230
1231
|
return result;
|
|
@@ -2191,16 +2191,14 @@ function loadPrimitiveMetadata(primitive, structuralMetadataExtension) {
|
|
|
2191
2191
|
if (!defined(structuralMetadataExtension)) {
|
|
2192
2192
|
return;
|
|
2193
2193
|
}
|
|
2194
|
+
const { propertyTextures, propertyAttributes } = structuralMetadataExtension;
|
|
2194
2195
|
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
primitive.propertyTextureIds = structuralMetadataExtension.propertyTextures;
|
|
2196
|
+
if (defined(propertyTextures)) {
|
|
2197
|
+
primitive.propertyTextureIds = propertyTextures;
|
|
2198
2198
|
}
|
|
2199
2199
|
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
primitive.propertyAttributeIds =
|
|
2203
|
-
structuralMetadataExtension.propertyAttributes;
|
|
2200
|
+
if (defined(propertyAttributes)) {
|
|
2201
|
+
primitive.propertyAttributeIds = propertyAttributes;
|
|
2204
2202
|
}
|
|
2205
2203
|
}
|
|
2206
2204
|
|