@cesium/engine 22.3.0 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-EAAH543Q.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-EUDHHS7K.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-LWZHJWYK.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-7U5YNLF3.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-D63Z7KKL.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-D6OKR3BQ.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-BO22JHBX.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-XLIJV3YZ.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-AWELU5C6.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-T5MJDW43.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-NVL7JXAQ.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-YHPBT4I5.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-WHLGBMBC.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-VIQIKMTZ.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-TCOUGKXF.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-S2KVL7OJ.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-5PJB7ASO.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-IXL46IYV.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-KIJR26N3.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-4R6FGUFP.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-FUDC3KOT.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-K2PLKJJG.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-4BBANFU6.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-K4PGSAR5.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-OOYICVOK.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-FDOLXORR.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-7SLNBIZS.js → chunk-IFA7VHHP.js} +560 -277
- package/Build/Workers/{chunk-N66PIK46.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-ZWWN2CQH.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-4O2ARYS7.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-TY5JXMVO.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-L4OFWHNI.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-N6XBJBI7.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-FS42VX2H.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-7ATKQRBM.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-EOSX23OS.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-NO3LMU7T.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-HWGP4GVC.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-6GBGEUWR.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-E4YDCSQK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-ZGGVEGTA.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-6WDMPXQ7.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-LK7GEFGB.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-M5DVYXJJ.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-WUWPKBOZ.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-W5NV72VR.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-PJLRXIMS.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-D2PEV362.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-MASEF4OV.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-2MLJ46ZZ.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-EY5HOJFQ.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-AFGP5BXS.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-IHFAFGR2.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-TMGLPEZW.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-VRAAQ3FS.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-Y5MRBKQN.js → chunk-ZIW5FCIW.js} +18 -18
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +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/AttributeCompression.js +53 -6
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -4
- package/Source/Scene/BillboardCollection.js +64 -25
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +906 -167
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +313 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/Label.js +6 -4
- package/Source/Scene/LabelCollection.js +59 -1
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +1 -1
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +2 -2
- package/Source/Shaders/Model/ModelFS.js +2 -2
- package/Source/Shaders/Model/ModelVS.glsl +2 -2
- package/Source/Shaders/Model/ModelVS.js +2 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/index.d.ts +564 -189
- package/index.js +127 -119
- package/package.json +1 -1
- package/Build/Workers/chunk-LYBNPUEI.js +0 -1443
|
@@ -33,93 +33,88 @@ const FeatureIdAttribute = ModelComponents.FeatureIdAttribute;
|
|
|
33
33
|
* Implements the {@link ResourceLoader} interface.
|
|
34
34
|
* </p>
|
|
35
35
|
*
|
|
36
|
-
* @alias B3dmLoader
|
|
37
|
-
* @constructor
|
|
38
|
-
* @augments ResourceLoader
|
|
39
36
|
* @private
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
options.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
37
|
+
*/
|
|
38
|
+
class B3dmLoader extends ResourceLoader {
|
|
39
|
+
/**
|
|
40
|
+
* @param {object} options Object with the following properties:
|
|
41
|
+
* @param {Resource} options.b3dmResource The {@link Resource} containing the b3dm.
|
|
42
|
+
* @param {ArrayBuffer} options.arrayBuffer The array buffer of the b3dm contents.
|
|
43
|
+
* @param {number} [options.byteOffset] The byte offset to the beginning of the b3dm contents in the array buffer.
|
|
44
|
+
* @param {Resource} [options.baseResource] The {@link Resource} that paths in the glTF JSON are relative to.
|
|
45
|
+
* @param {boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
|
|
46
|
+
* @param {boolean} [options.asynchronous=true] Determines if WebGL resource creation will be spread out over several frames or block until all WebGL resources are created.
|
|
47
|
+
* @param {boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the glTF is loaded.
|
|
48
|
+
* @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
|
|
49
|
+
* @param {Axis} [options.forwardAxis=Axis.X] The forward-axis of the glTF model.
|
|
50
|
+
* @param {boolean} [options.loadAttributesAsTypedArray=false] If <code>true</code>, load all attributes as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
|
|
51
|
+
* @param {boolean} [options.loadAttributesFor2D=false] If <code>true</code>, load the positions buffer and any instanced attribute buffers as typed arrays for accurately projecting models to 2D.
|
|
52
|
+
* @param {boolean} [options.enablePick=false] If <code>true</code>, load the positions buffer, any instanced attribute buffers, and index buffer as typed arrays for CPU-enabled picking in WebGL1.
|
|
53
|
+
* @param {boolean} [options.loadIndicesForWireframe=false] If <code>true</code>, load the index buffer as a typed array. This is useful for creating wireframe indices in WebGL1.
|
|
54
|
+
* @param {boolean} [options.loadPrimitiveOutline=true] If <code>true</code>, load outlines from the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. This can be set false to avoid post-processing geometry at load time.
|
|
55
|
+
* @param {boolean} [options.loadForClassification=false] If <code>true</code> and if the model has feature IDs, load the feature IDs and indices as typed arrays. This is useful for batching features for classification.
|
|
56
|
+
*/
|
|
57
|
+
constructor(options) {
|
|
58
|
+
super();
|
|
59
|
+
|
|
60
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
61
|
+
|
|
62
|
+
const b3dmResource = options.b3dmResource;
|
|
63
|
+
let baseResource = options.baseResource;
|
|
64
|
+
const arrayBuffer = options.arrayBuffer;
|
|
65
|
+
const byteOffset = options.byteOffset ?? 0;
|
|
66
|
+
const releaseGltfJson = options.releaseGltfJson ?? false;
|
|
67
|
+
const asynchronous = options.asynchronous ?? true;
|
|
68
|
+
const incrementallyLoadTextures = options.incrementallyLoadTextures ?? true;
|
|
69
|
+
const upAxis = options.upAxis ?? Axis.Y;
|
|
70
|
+
const forwardAxis = options.forwardAxis ?? Axis.X;
|
|
71
|
+
const loadAttributesAsTypedArray =
|
|
72
|
+
options.loadAttributesAsTypedArray ?? false;
|
|
73
|
+
const loadAttributesFor2D = options.loadAttributesFor2D ?? false;
|
|
74
|
+
const enablePick = options.enablePick ?? false;
|
|
75
|
+
const loadIndicesForWireframe = options.loadIndicesForWireframe ?? false;
|
|
76
|
+
const loadPrimitiveOutline = options.loadPrimitiveOutline ?? true;
|
|
77
|
+
const loadForClassification = options.loadForClassification ?? false;
|
|
78
|
+
|
|
79
|
+
//>>includeStart('debug', pragmas.debug);
|
|
80
|
+
Check.typeOf.object("options.b3dmResource", b3dmResource);
|
|
81
|
+
Check.typeOf.object("options.arrayBuffer", arrayBuffer);
|
|
82
|
+
//>>includeEnd('debug');
|
|
83
|
+
|
|
84
|
+
baseResource = defined(baseResource) ? baseResource : b3dmResource.clone();
|
|
85
|
+
|
|
86
|
+
this._b3dmResource = b3dmResource;
|
|
87
|
+
this._baseResource = baseResource;
|
|
88
|
+
this._arrayBuffer = arrayBuffer;
|
|
89
|
+
this._byteOffset = byteOffset;
|
|
90
|
+
this._releaseGltfJson = releaseGltfJson;
|
|
91
|
+
this._asynchronous = asynchronous;
|
|
92
|
+
this._incrementallyLoadTextures = incrementallyLoadTextures;
|
|
93
|
+
this._upAxis = upAxis;
|
|
94
|
+
this._forwardAxis = forwardAxis;
|
|
95
|
+
this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
|
|
96
|
+
this._loadAttributesFor2D = loadAttributesFor2D;
|
|
97
|
+
this._enablePick = enablePick;
|
|
98
|
+
this._loadIndicesForWireframe = loadIndicesForWireframe;
|
|
99
|
+
this._loadPrimitiveOutline = loadPrimitiveOutline;
|
|
100
|
+
this._loadForClassification = loadForClassification;
|
|
101
|
+
|
|
102
|
+
this._state = B3dmLoaderState.UNLOADED;
|
|
103
|
+
|
|
104
|
+
this._promise = undefined;
|
|
105
|
+
|
|
106
|
+
this._gltfLoader = undefined;
|
|
107
|
+
|
|
108
|
+
// Loaded results.
|
|
109
|
+
this._batchLength = 0;
|
|
110
|
+
this._propertyTable = undefined;
|
|
111
|
+
|
|
112
|
+
// The batch table object contains a json and a binary component access using keys of the same name.
|
|
113
|
+
this._batchTable = undefined;
|
|
114
|
+
this._components = undefined;
|
|
115
|
+
this._transform = Matrix4.IDENTITY;
|
|
116
|
+
}
|
|
121
117
|
|
|
122
|
-
Object.defineProperties(B3dmLoader.prototype, {
|
|
123
118
|
/**
|
|
124
119
|
* true if textures are loaded, useful when incrementallyLoadTextures is true
|
|
125
120
|
*
|
|
@@ -129,11 +124,10 @@ Object.defineProperties(B3dmLoader.prototype, {
|
|
|
129
124
|
* @readonly
|
|
130
125
|
* @private
|
|
131
126
|
*/
|
|
132
|
-
texturesLoaded
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
127
|
+
get texturesLoaded() {
|
|
128
|
+
return this._gltfLoader?.texturesLoaded;
|
|
129
|
+
}
|
|
130
|
+
|
|
137
131
|
/**
|
|
138
132
|
* The cache key of the resource
|
|
139
133
|
*
|
|
@@ -143,11 +137,9 @@ Object.defineProperties(B3dmLoader.prototype, {
|
|
|
143
137
|
* @readonly
|
|
144
138
|
* @private
|
|
145
139
|
*/
|
|
146
|
-
cacheKey
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
},
|
|
140
|
+
get cacheKey() {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
151
143
|
|
|
152
144
|
/**
|
|
153
145
|
* The loaded components.
|
|
@@ -158,141 +150,150 @@ Object.defineProperties(B3dmLoader.prototype, {
|
|
|
158
150
|
* @readonly
|
|
159
151
|
* @private
|
|
160
152
|
*/
|
|
161
|
-
components
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
153
|
+
get components() {
|
|
154
|
+
return this._components;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Loads the resource.
|
|
159
|
+
* @returns {Promise<B3dmLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
load() {
|
|
163
|
+
if (defined(this._promise)) {
|
|
164
|
+
return this._promise;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const b3dm = B3dmParser.parse(this._arrayBuffer, this._byteOffset);
|
|
168
|
+
|
|
169
|
+
let batchLength = b3dm.batchLength;
|
|
170
|
+
const featureTableJson = b3dm.featureTableJson;
|
|
171
|
+
const featureTableBinary = b3dm.featureTableBinary;
|
|
172
|
+
const batchTableJson = b3dm.batchTableJson;
|
|
173
|
+
const batchTableBinary = b3dm.batchTableBinary;
|
|
174
|
+
|
|
175
|
+
const featureTable = new Cesium3DTileFeatureTable(
|
|
176
|
+
featureTableJson,
|
|
177
|
+
featureTableBinary,
|
|
178
|
+
);
|
|
179
|
+
batchLength = featureTable.getGlobalProperty("BATCH_LENGTH");
|
|
180
|
+
// Set batch length.
|
|
181
|
+
this._batchLength = batchLength;
|
|
182
|
+
// Set the RTC Center transform, if present.
|
|
183
|
+
const rtcCenter = featureTable.getGlobalProperty(
|
|
184
|
+
"RTC_CENTER",
|
|
185
|
+
ComponentDatatype.FLOAT,
|
|
186
|
+
3,
|
|
187
|
+
);
|
|
188
|
+
if (defined(rtcCenter)) {
|
|
189
|
+
this._transform = Matrix4.fromTranslation(
|
|
190
|
+
Cartesian3.fromArray(rtcCenter),
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this._batchTable = {
|
|
195
|
+
json: batchTableJson,
|
|
196
|
+
binary: batchTableBinary,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const gltfLoader = new GltfLoader({
|
|
200
|
+
typedArray: b3dm.gltf,
|
|
201
|
+
upAxis: this._upAxis,
|
|
202
|
+
forwardAxis: this._forwardAxis,
|
|
203
|
+
gltfResource: this._b3dmResource,
|
|
204
|
+
baseResource: this._baseResource,
|
|
205
|
+
releaseGltfJson: this._releaseGltfJson,
|
|
206
|
+
incrementallyLoadTextures: this._incrementallyLoadTextures,
|
|
207
|
+
loadAttributesAsTypedArray: this._loadAttributesAsTypedArray,
|
|
208
|
+
loadAttributesFor2D: this._loadAttributesFor2D,
|
|
209
|
+
enablePick: this._enablePick,
|
|
210
|
+
loadIndicesForWireframe: this._loadIndicesForWireframe,
|
|
211
|
+
loadPrimitiveOutline: this._loadPrimitiveOutline,
|
|
212
|
+
loadForClassification: this._loadForClassification,
|
|
213
|
+
renameBatchIdSemantic: true,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
this._gltfLoader = gltfLoader;
|
|
217
|
+
this._state = B3dmLoaderState.LOADING;
|
|
218
|
+
|
|
219
|
+
const that = this;
|
|
220
|
+
this._promise = gltfLoader
|
|
221
|
+
.load()
|
|
222
|
+
.then(function () {
|
|
223
|
+
if (that.isDestroyed()) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
that._state = B3dmLoaderState.PROCESSING;
|
|
228
|
+
return that;
|
|
229
|
+
})
|
|
230
|
+
.catch(function (error) {
|
|
231
|
+
if (that.isDestroyed()) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return handleError(that, error);
|
|
236
|
+
});
|
|
167
237
|
|
|
168
|
-
/**
|
|
169
|
-
* Loads the resource.
|
|
170
|
-
* @returns {Promise<B3dmLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
171
|
-
* @private
|
|
172
|
-
*/
|
|
173
|
-
B3dmLoader.prototype.load = function () {
|
|
174
|
-
if (defined(this._promise)) {
|
|
175
238
|
return this._promise;
|
|
176
239
|
}
|
|
177
240
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const featureTableBinary = b3dm.featureTableBinary;
|
|
183
|
-
const batchTableJson = b3dm.batchTableJson;
|
|
184
|
-
const batchTableBinary = b3dm.batchTableBinary;
|
|
185
|
-
|
|
186
|
-
const featureTable = new Cesium3DTileFeatureTable(
|
|
187
|
-
featureTableJson,
|
|
188
|
-
featureTableBinary,
|
|
189
|
-
);
|
|
190
|
-
batchLength = featureTable.getGlobalProperty("BATCH_LENGTH");
|
|
191
|
-
// Set batch length.
|
|
192
|
-
this._batchLength = batchLength;
|
|
193
|
-
// Set the RTC Center transform, if present.
|
|
194
|
-
const rtcCenter = featureTable.getGlobalProperty(
|
|
195
|
-
"RTC_CENTER",
|
|
196
|
-
ComponentDatatype.FLOAT,
|
|
197
|
-
3,
|
|
198
|
-
);
|
|
199
|
-
if (defined(rtcCenter)) {
|
|
200
|
-
this._transform = Matrix4.fromTranslation(Cartesian3.fromArray(rtcCenter));
|
|
201
|
-
}
|
|
241
|
+
process(frameState) {
|
|
242
|
+
//>>includeStart('debug', pragmas.debug);
|
|
243
|
+
Check.typeOf.object("frameState", frameState);
|
|
244
|
+
//>>includeEnd('debug');
|
|
202
245
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
const gltfLoader = new GltfLoader({
|
|
209
|
-
typedArray: b3dm.gltf,
|
|
210
|
-
upAxis: this._upAxis,
|
|
211
|
-
forwardAxis: this._forwardAxis,
|
|
212
|
-
gltfResource: this._b3dmResource,
|
|
213
|
-
baseResource: this._baseResource,
|
|
214
|
-
releaseGltfJson: this._releaseGltfJson,
|
|
215
|
-
incrementallyLoadTextures: this._incrementallyLoadTextures,
|
|
216
|
-
loadAttributesAsTypedArray: this._loadAttributesAsTypedArray,
|
|
217
|
-
loadAttributesFor2D: this._loadAttributesFor2D,
|
|
218
|
-
enablePick: this._enablePick,
|
|
219
|
-
loadIndicesForWireframe: this._loadIndicesForWireframe,
|
|
220
|
-
loadPrimitiveOutline: this._loadPrimitiveOutline,
|
|
221
|
-
loadForClassification: this._loadForClassification,
|
|
222
|
-
renameBatchIdSemantic: true,
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
this._gltfLoader = gltfLoader;
|
|
226
|
-
this._state = B3dmLoaderState.LOADING;
|
|
227
|
-
|
|
228
|
-
const that = this;
|
|
229
|
-
this._promise = gltfLoader
|
|
230
|
-
.load()
|
|
231
|
-
.then(function () {
|
|
232
|
-
if (that.isDestroyed()) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
that._state = B3dmLoaderState.PROCESSING;
|
|
237
|
-
return that;
|
|
238
|
-
})
|
|
239
|
-
.catch(function (error) {
|
|
240
|
-
if (that.isDestroyed()) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return handleError(that, error);
|
|
245
|
-
});
|
|
246
|
+
if (this._state === B3dmLoaderState.READY) {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
246
249
|
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
if (this._state !== B3dmLoaderState.PROCESSING) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
249
253
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
const ready = this._gltfLoader.process(frameState);
|
|
255
|
+
if (!ready) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const components = this._gltfLoader.components;
|
|
260
|
+
|
|
261
|
+
// Combine the RTC_CENTER transform from the b3dm and the CESIUM_RTC
|
|
262
|
+
// transform from the glTF. In practice usually only one or the
|
|
263
|
+
// other is supplied. If they don't exist the transforms will
|
|
264
|
+
// be identity matrices.
|
|
265
|
+
components.transform = Matrix4.multiplyTransformation(
|
|
266
|
+
this._transform,
|
|
267
|
+
components.transform,
|
|
268
|
+
components.transform,
|
|
269
|
+
);
|
|
270
|
+
createStructuralMetadata(this, components);
|
|
271
|
+
this._components = components;
|
|
257
272
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
Check.typeOf.object("frameState", frameState);
|
|
261
|
-
//>>includeEnd('debug');
|
|
273
|
+
// Now that we have the parsed components, we can release the array buffer
|
|
274
|
+
this._arrayBuffer = undefined;
|
|
262
275
|
|
|
263
|
-
|
|
276
|
+
this._state = B3dmLoaderState.READY;
|
|
264
277
|
return true;
|
|
265
278
|
}
|
|
266
279
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
280
|
+
unload() {
|
|
281
|
+
if (defined(this._gltfLoader) && !this._gltfLoader.isDestroyed()) {
|
|
282
|
+
this._gltfLoader.unload();
|
|
283
|
+
}
|
|
270
284
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return false;
|
|
285
|
+
this._components = undefined;
|
|
286
|
+
this._arrayBuffer = undefined;
|
|
274
287
|
}
|
|
288
|
+
}
|
|
275
289
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
this._transform,
|
|
284
|
-
components.transform,
|
|
285
|
-
components.transform,
|
|
286
|
-
);
|
|
287
|
-
createStructuralMetadata(this, components);
|
|
288
|
-
this._components = components;
|
|
289
|
-
|
|
290
|
-
// Now that we have the parsed components, we can release the array buffer
|
|
291
|
-
this._arrayBuffer = undefined;
|
|
292
|
-
|
|
293
|
-
this._state = B3dmLoaderState.READY;
|
|
294
|
-
return true;
|
|
295
|
-
};
|
|
290
|
+
function handleError(b3dmLoader, error) {
|
|
291
|
+
b3dmLoader.unload();
|
|
292
|
+
b3dmLoader._state = B3dmLoaderState.FAILED;
|
|
293
|
+
const errorMessage = "Failed to load b3dm";
|
|
294
|
+
error = b3dmLoader.getError(errorMessage, error);
|
|
295
|
+
return Promise.reject(error);
|
|
296
|
+
}
|
|
296
297
|
|
|
297
298
|
function createStructuralMetadata(loader, components) {
|
|
298
299
|
const batchTable = loader._batchTable;
|
|
@@ -356,13 +357,4 @@ function processNode(node) {
|
|
|
356
357
|
}
|
|
357
358
|
}
|
|
358
359
|
|
|
359
|
-
B3dmLoader.prototype.unload = function () {
|
|
360
|
-
if (defined(this._gltfLoader) && !this._gltfLoader.isDestroyed()) {
|
|
361
|
-
this._gltfLoader.unload();
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
this._components = undefined;
|
|
365
|
-
this._arrayBuffer = undefined;
|
|
366
|
-
};
|
|
367
|
-
|
|
368
360
|
export default B3dmLoader;
|
|
@@ -299,7 +299,12 @@ function getVariables(shaderText, regex, outputSet) {
|
|
|
299
299
|
function findUsedVariables(customShader) {
|
|
300
300
|
const attributeRegex = /[vf]sInput\.attributes\.(\w+)/g;
|
|
301
301
|
const featureIdRegex = /[vf]sInput\.featureIds\.(\w+)/g;
|
|
302
|
-
|
|
302
|
+
// Metadata is a little more complex. Match the first identifier after:
|
|
303
|
+
// - vsInput.metadata.<property>
|
|
304
|
+
// - vsInput.metadataClass.<property>
|
|
305
|
+
// - vsInput.metadataStatistics.<property>
|
|
306
|
+
const metadataRegex =
|
|
307
|
+
/[vf]sInput\.(?:metadata|metadataClass|metadataStatistics)\.(\w+)/g;
|
|
303
308
|
let attributeSet;
|
|
304
309
|
|
|
305
310
|
const vertexShaderText = customShader.vertexShaderText;
|