@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
|
@@ -17,79 +17,74 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
|
17
17
|
* Implements the {@link ResourceLoader} interface.
|
|
18
18
|
* </p>
|
|
19
19
|
*
|
|
20
|
-
* @alias GltfIndexBufferLoader
|
|
21
|
-
* @constructor
|
|
22
|
-
* @augments ResourceLoader
|
|
23
|
-
*
|
|
24
|
-
* @param {object} options Object with the following properties:
|
|
25
|
-
* @param {ResourceCache} options.resourceCache The {@link ResourceCache} (to avoid circular dependencies).
|
|
26
|
-
* @param {object} options.gltf The glTF JSON.
|
|
27
|
-
* @param {number} options.accessorId The accessor ID corresponding to the index buffer.
|
|
28
|
-
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
29
|
-
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
30
|
-
* @param {object} [options.primitive] The primitive containing the Draco extension.
|
|
31
|
-
* @param {object} [options.draco] The Draco extension object.
|
|
32
|
-
* @param {string} [options.cacheKey] The cache key of the resource.
|
|
33
|
-
* @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.
|
|
34
|
-
* @param {boolean} [options.loadBuffer=false] Load the index buffer as a GPU index buffer.
|
|
35
|
-
* @param {boolean} [options.loadTypedArray=false] Load the index buffer as a typed array.
|
|
36
20
|
* @private
|
|
37
21
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
22
|
+
class GltfIndexBufferLoader extends ResourceLoader {
|
|
23
|
+
/**
|
|
24
|
+
* @param {object} options Object with the following properties:
|
|
25
|
+
* @param {ResourceCache} options.resourceCache The {@link ResourceCache} (to avoid circular dependencies).
|
|
26
|
+
* @param {object} options.gltf The glTF JSON.
|
|
27
|
+
* @param {number} options.accessorId The accessor ID corresponding to the index buffer.
|
|
28
|
+
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
29
|
+
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
30
|
+
* @param {object} [options.primitive] The primitive containing the Draco extension.
|
|
31
|
+
* @param {object} [options.draco] The Draco extension object.
|
|
32
|
+
* @param {string} [options.cacheKey] The cache key of the resource.
|
|
33
|
+
* @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.
|
|
34
|
+
* @param {boolean} [options.loadBuffer=false] Load the index buffer as a GPU index buffer.
|
|
35
|
+
* @param {boolean} [options.loadTypedArray=false] Load the index buffer as a typed array.
|
|
36
|
+
*/
|
|
37
|
+
constructor(options) {
|
|
38
|
+
super();
|
|
39
|
+
|
|
40
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
41
|
+
const resourceCache = options.resourceCache;
|
|
42
|
+
const gltf = options.gltf;
|
|
43
|
+
const accessorId = options.accessorId;
|
|
44
|
+
const gltfResource = options.gltfResource;
|
|
45
|
+
const baseResource = options.baseResource;
|
|
46
|
+
const primitive = options.primitive;
|
|
47
|
+
const draco = options.draco;
|
|
48
|
+
const cacheKey = options.cacheKey;
|
|
49
|
+
const asynchronous = options.asynchronous ?? true;
|
|
50
|
+
const loadBuffer = options.loadBuffer ?? false;
|
|
51
|
+
const loadTypedArray = options.loadTypedArray ?? false;
|
|
52
|
+
|
|
53
|
+
//>>includeStart('debug', pragmas.debug);
|
|
54
|
+
Check.typeOf.func("options.resourceCache", resourceCache);
|
|
55
|
+
Check.typeOf.object("options.gltf", gltf);
|
|
56
|
+
Check.typeOf.number("options.accessorId", accessorId);
|
|
57
|
+
Check.typeOf.object("options.gltfResource", gltfResource);
|
|
58
|
+
Check.typeOf.object("options.baseResource", baseResource);
|
|
59
|
+
if (!loadBuffer && !loadTypedArray) {
|
|
60
|
+
throw new DeveloperError(
|
|
61
|
+
"At least one of loadBuffer and loadTypedArray must be true.",
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
//>>includeEnd('debug');
|
|
65
|
+
|
|
66
|
+
const indexDatatype = gltf.accessors[accessorId].componentType;
|
|
67
|
+
|
|
68
|
+
this._resourceCache = resourceCache;
|
|
69
|
+
this._gltfResource = gltfResource;
|
|
70
|
+
this._baseResource = baseResource;
|
|
71
|
+
this._gltf = gltf;
|
|
72
|
+
this._accessorId = accessorId;
|
|
73
|
+
this._indexDatatype = indexDatatype;
|
|
74
|
+
this._primitive = primitive;
|
|
75
|
+
this._draco = draco;
|
|
76
|
+
this._cacheKey = cacheKey;
|
|
77
|
+
this._asynchronous = asynchronous;
|
|
78
|
+
this._loadBuffer = loadBuffer;
|
|
79
|
+
this._loadTypedArray = loadTypedArray;
|
|
80
|
+
this._bufferViewLoader = undefined;
|
|
81
|
+
this._dracoLoader = undefined;
|
|
82
|
+
this._typedArray = undefined;
|
|
83
|
+
this._buffer = undefined;
|
|
84
|
+
this._state = ResourceLoaderState.UNLOADED;
|
|
85
|
+
this._promise = undefined;
|
|
62
86
|
}
|
|
63
|
-
//>>includeEnd('debug');
|
|
64
|
-
|
|
65
|
-
const indexDatatype = gltf.accessors[accessorId].componentType;
|
|
66
|
-
|
|
67
|
-
this._resourceCache = resourceCache;
|
|
68
|
-
this._gltfResource = gltfResource;
|
|
69
|
-
this._baseResource = baseResource;
|
|
70
|
-
this._gltf = gltf;
|
|
71
|
-
this._accessorId = accessorId;
|
|
72
|
-
this._indexDatatype = indexDatatype;
|
|
73
|
-
this._primitive = primitive;
|
|
74
|
-
this._draco = draco;
|
|
75
|
-
this._cacheKey = cacheKey;
|
|
76
|
-
this._asynchronous = asynchronous;
|
|
77
|
-
this._loadBuffer = loadBuffer;
|
|
78
|
-
this._loadTypedArray = loadTypedArray;
|
|
79
|
-
this._bufferViewLoader = undefined;
|
|
80
|
-
this._dracoLoader = undefined;
|
|
81
|
-
this._typedArray = undefined;
|
|
82
|
-
this._buffer = undefined;
|
|
83
|
-
this._state = ResourceLoaderState.UNLOADED;
|
|
84
|
-
this._promise = undefined;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (defined(Object.create)) {
|
|
88
|
-
GltfIndexBufferLoader.prototype = Object.create(ResourceLoader.prototype);
|
|
89
|
-
GltfIndexBufferLoader.prototype.constructor = GltfIndexBufferLoader;
|
|
90
|
-
}
|
|
91
87
|
|
|
92
|
-
Object.defineProperties(GltfIndexBufferLoader.prototype, {
|
|
93
88
|
/**
|
|
94
89
|
* The cache key of the resource.
|
|
95
90
|
*
|
|
@@ -99,11 +94,10 @@ Object.defineProperties(GltfIndexBufferLoader.prototype, {
|
|
|
99
94
|
* @readonly
|
|
100
95
|
* @private
|
|
101
96
|
*/
|
|
102
|
-
cacheKey
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
97
|
+
get cacheKey() {
|
|
98
|
+
return this._cacheKey;
|
|
99
|
+
}
|
|
100
|
+
|
|
107
101
|
/**
|
|
108
102
|
* The index buffer. This is only defined when <code>loadBuffer</code> is true.
|
|
109
103
|
*
|
|
@@ -113,11 +107,10 @@ Object.defineProperties(GltfIndexBufferLoader.prototype, {
|
|
|
113
107
|
* @readonly
|
|
114
108
|
* @private
|
|
115
109
|
*/
|
|
116
|
-
buffer
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
110
|
+
get buffer() {
|
|
111
|
+
return this._buffer;
|
|
112
|
+
}
|
|
113
|
+
|
|
121
114
|
/**
|
|
122
115
|
* The typed array containing indices. This is only defined when <code>loadTypedArray</code> is true.
|
|
123
116
|
*
|
|
@@ -127,11 +120,9 @@ Object.defineProperties(GltfIndexBufferLoader.prototype, {
|
|
|
127
120
|
* @readonly
|
|
128
121
|
* @private
|
|
129
122
|
*/
|
|
130
|
-
typedArray
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
},
|
|
123
|
+
get typedArray() {
|
|
124
|
+
return this._typedArray;
|
|
125
|
+
}
|
|
135
126
|
|
|
136
127
|
/**
|
|
137
128
|
* The index datatype after decode.
|
|
@@ -142,33 +133,166 @@ Object.defineProperties(GltfIndexBufferLoader.prototype, {
|
|
|
142
133
|
* @readonly
|
|
143
134
|
* @private
|
|
144
135
|
*/
|
|
145
|
-
indexDatatype
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
});
|
|
136
|
+
get indexDatatype() {
|
|
137
|
+
return this._indexDatatype;
|
|
138
|
+
}
|
|
151
139
|
|
|
152
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Loads the resource.
|
|
142
|
+
* @returns {Promise<GltfIndexBufferLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
async load() {
|
|
146
|
+
if (defined(this._promise)) {
|
|
147
|
+
return this._promise;
|
|
148
|
+
}
|
|
153
149
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (defined(this._promise)) {
|
|
150
|
+
if (defined(this._draco)) {
|
|
151
|
+
this._promise = loadFromDraco(this);
|
|
152
|
+
return this._promise;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
this._promise = loadFromBufferView(this);
|
|
161
156
|
return this._promise;
|
|
162
157
|
}
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Processes the resource until it becomes ready.
|
|
161
|
+
*
|
|
162
|
+
* @param {FrameState} frameState The frame state.
|
|
163
|
+
* @private
|
|
164
|
+
*/
|
|
165
|
+
process(frameState) {
|
|
166
|
+
//>>includeStart('debug', pragmas.debug);
|
|
167
|
+
Check.typeOf.object("frameState", frameState);
|
|
168
|
+
//>>includeEnd('debug');
|
|
169
|
+
|
|
170
|
+
if (this._state === ResourceLoaderState.READY) {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (
|
|
175
|
+
this._state !== ResourceLoaderState.LOADED &&
|
|
176
|
+
this._state !== ResourceLoaderState.PROCESSING
|
|
177
|
+
) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let typedArray = this._typedArray;
|
|
182
|
+
let indexDatatype = this._indexDatatype;
|
|
183
|
+
|
|
184
|
+
if (defined(this._dracoLoader)) {
|
|
185
|
+
try {
|
|
186
|
+
const ready = this._dracoLoader.process(frameState);
|
|
187
|
+
if (ready) {
|
|
188
|
+
const dracoLoader = this._dracoLoader;
|
|
189
|
+
typedArray = dracoLoader.decodedData.indices.typedArray;
|
|
190
|
+
this._typedArray = typedArray;
|
|
191
|
+
// The index datatype may be a smaller datatype after draco decode
|
|
192
|
+
indexDatatype = ComponentDatatype.fromTypedArray(typedArray);
|
|
193
|
+
this._indexDatatype = indexDatatype;
|
|
194
|
+
}
|
|
195
|
+
} catch (error) {
|
|
196
|
+
handleError(this, error);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (!defined(typedArray)) {
|
|
201
|
+
// Buffer view hasn't been loaded yet
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
let buffer;
|
|
206
|
+
if (this._loadBuffer && this._asynchronous) {
|
|
207
|
+
const indexBufferJob = scratchIndexBufferJob;
|
|
208
|
+
indexBufferJob.set(typedArray, indexDatatype, frameState.context);
|
|
209
|
+
const jobScheduler = frameState.jobScheduler;
|
|
210
|
+
if (!jobScheduler.execute(indexBufferJob, JobType.BUFFER)) {
|
|
211
|
+
// Job scheduler is full. Try again next frame.
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
buffer = indexBufferJob.buffer;
|
|
215
|
+
} else if (this._loadBuffer) {
|
|
216
|
+
buffer = createIndexBuffer(typedArray, indexDatatype, frameState.context);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Unload everything except the index buffer and/or typed array.
|
|
220
|
+
this.unload();
|
|
221
|
+
|
|
222
|
+
this._buffer = buffer;
|
|
223
|
+
this._typedArray = this._loadTypedArray ? typedArray : undefined;
|
|
224
|
+
this._state = ResourceLoaderState.READY;
|
|
225
|
+
|
|
226
|
+
this._resourceCache.statistics.addGeometryLoader(this);
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Unloads the resource.
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
234
|
+
unload() {
|
|
235
|
+
if (defined(this._buffer)) {
|
|
236
|
+
this._buffer.destroy();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const resourceCache = this._resourceCache;
|
|
240
|
+
|
|
241
|
+
if (
|
|
242
|
+
defined(this._bufferViewLoader) &&
|
|
243
|
+
!this._bufferViewLoader.isDestroyed()
|
|
244
|
+
) {
|
|
245
|
+
resourceCache.unload(this._bufferViewLoader);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (defined(this._dracoLoader)) {
|
|
249
|
+
resourceCache.unload(this._dracoLoader);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
this._bufferViewLoader = undefined;
|
|
253
|
+
this._dracoLoader = undefined;
|
|
254
|
+
this._typedArray = undefined;
|
|
255
|
+
this._buffer = undefined;
|
|
256
|
+
this._gltf = undefined;
|
|
257
|
+
this._primitive = undefined;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
class CreateIndexBufferJob {
|
|
262
|
+
constructor() {
|
|
263
|
+
this.typedArray = undefined;
|
|
264
|
+
this.indexDatatype = undefined;
|
|
265
|
+
this.context = undefined;
|
|
266
|
+
this.buffer = undefined;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
set(typedArray, indexDatatype, context) {
|
|
270
|
+
this.typedArray = typedArray;
|
|
271
|
+
this.indexDatatype = indexDatatype;
|
|
272
|
+
this.context = context;
|
|
167
273
|
}
|
|
168
274
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
275
|
+
execute() {
|
|
276
|
+
this.buffer = createIndexBuffer(
|
|
277
|
+
this.typedArray,
|
|
278
|
+
this.indexDatatype,
|
|
279
|
+
this.context,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function createIndexBuffer(typedArray, indexDatatype, context) {
|
|
285
|
+
const buffer = Buffer.createIndexBuffer({
|
|
286
|
+
typedArray: typedArray,
|
|
287
|
+
context: context,
|
|
288
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
289
|
+
indexDatatype: indexDatatype,
|
|
290
|
+
});
|
|
291
|
+
buffer.vertexArrayDestroyable = false;
|
|
292
|
+
return buffer;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const scratchIndexBufferJob = new CreateIndexBufferJob();
|
|
172
296
|
|
|
173
297
|
async function loadFromDraco(indexBufferLoader) {
|
|
174
298
|
indexBufferLoader._state = ResourceLoaderState.LOADING;
|
|
@@ -281,141 +405,4 @@ function handleError(indexBufferLoader, error) {
|
|
|
281
405
|
throw indexBufferLoader.getError(errorMessage, error);
|
|
282
406
|
}
|
|
283
407
|
|
|
284
|
-
function CreateIndexBufferJob() {
|
|
285
|
-
this.typedArray = undefined;
|
|
286
|
-
this.indexDatatype = undefined;
|
|
287
|
-
this.context = undefined;
|
|
288
|
-
this.buffer = undefined;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
CreateIndexBufferJob.prototype.set = function (
|
|
292
|
-
typedArray,
|
|
293
|
-
indexDatatype,
|
|
294
|
-
context,
|
|
295
|
-
) {
|
|
296
|
-
this.typedArray = typedArray;
|
|
297
|
-
this.indexDatatype = indexDatatype;
|
|
298
|
-
this.context = context;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
CreateIndexBufferJob.prototype.execute = function () {
|
|
302
|
-
this.buffer = createIndexBuffer(
|
|
303
|
-
this.typedArray,
|
|
304
|
-
this.indexDatatype,
|
|
305
|
-
this.context,
|
|
306
|
-
);
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
function createIndexBuffer(typedArray, indexDatatype, context) {
|
|
310
|
-
const buffer = Buffer.createIndexBuffer({
|
|
311
|
-
typedArray: typedArray,
|
|
312
|
-
context: context,
|
|
313
|
-
usage: BufferUsage.STATIC_DRAW,
|
|
314
|
-
indexDatatype: indexDatatype,
|
|
315
|
-
});
|
|
316
|
-
buffer.vertexArrayDestroyable = false;
|
|
317
|
-
return buffer;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Processes the resource until it becomes ready.
|
|
322
|
-
*
|
|
323
|
-
* @param {FrameState} frameState The frame state.
|
|
324
|
-
* @private
|
|
325
|
-
*/
|
|
326
|
-
GltfIndexBufferLoader.prototype.process = function (frameState) {
|
|
327
|
-
//>>includeStart('debug', pragmas.debug);
|
|
328
|
-
Check.typeOf.object("frameState", frameState);
|
|
329
|
-
//>>includeEnd('debug');
|
|
330
|
-
|
|
331
|
-
if (this._state === ResourceLoaderState.READY) {
|
|
332
|
-
return true;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
this._state !== ResourceLoaderState.LOADED &&
|
|
337
|
-
this._state !== ResourceLoaderState.PROCESSING
|
|
338
|
-
) {
|
|
339
|
-
return false;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
let typedArray = this._typedArray;
|
|
343
|
-
let indexDatatype = this._indexDatatype;
|
|
344
|
-
|
|
345
|
-
if (defined(this._dracoLoader)) {
|
|
346
|
-
try {
|
|
347
|
-
const ready = this._dracoLoader.process(frameState);
|
|
348
|
-
if (ready) {
|
|
349
|
-
const dracoLoader = this._dracoLoader;
|
|
350
|
-
typedArray = dracoLoader.decodedData.indices.typedArray;
|
|
351
|
-
this._typedArray = typedArray;
|
|
352
|
-
// The index datatype may be a smaller datatype after draco decode
|
|
353
|
-
indexDatatype = ComponentDatatype.fromTypedArray(typedArray);
|
|
354
|
-
this._indexDatatype = indexDatatype;
|
|
355
|
-
}
|
|
356
|
-
} catch (error) {
|
|
357
|
-
handleError(this, error);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (!defined(typedArray)) {
|
|
362
|
-
// Buffer view hasn't been loaded yet
|
|
363
|
-
return false;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
let buffer;
|
|
367
|
-
if (this._loadBuffer && this._asynchronous) {
|
|
368
|
-
const indexBufferJob = scratchIndexBufferJob;
|
|
369
|
-
indexBufferJob.set(typedArray, indexDatatype, frameState.context);
|
|
370
|
-
const jobScheduler = frameState.jobScheduler;
|
|
371
|
-
if (!jobScheduler.execute(indexBufferJob, JobType.BUFFER)) {
|
|
372
|
-
// Job scheduler is full. Try again next frame.
|
|
373
|
-
return false;
|
|
374
|
-
}
|
|
375
|
-
buffer = indexBufferJob.buffer;
|
|
376
|
-
} else if (this._loadBuffer) {
|
|
377
|
-
buffer = createIndexBuffer(typedArray, indexDatatype, frameState.context);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// Unload everything except the index buffer and/or typed array.
|
|
381
|
-
this.unload();
|
|
382
|
-
|
|
383
|
-
this._buffer = buffer;
|
|
384
|
-
this._typedArray = this._loadTypedArray ? typedArray : undefined;
|
|
385
|
-
this._state = ResourceLoaderState.READY;
|
|
386
|
-
|
|
387
|
-
this._resourceCache.statistics.addGeometryLoader(this);
|
|
388
|
-
return true;
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Unloads the resource.
|
|
393
|
-
* @private
|
|
394
|
-
*/
|
|
395
|
-
GltfIndexBufferLoader.prototype.unload = function () {
|
|
396
|
-
if (defined(this._buffer)) {
|
|
397
|
-
this._buffer.destroy();
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
const resourceCache = this._resourceCache;
|
|
401
|
-
|
|
402
|
-
if (
|
|
403
|
-
defined(this._bufferViewLoader) &&
|
|
404
|
-
!this._bufferViewLoader.isDestroyed()
|
|
405
|
-
) {
|
|
406
|
-
resourceCache.unload(this._bufferViewLoader);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
if (defined(this._dracoLoader)) {
|
|
410
|
-
resourceCache.unload(this._dracoLoader);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
this._bufferViewLoader = undefined;
|
|
414
|
-
this._dracoLoader = undefined;
|
|
415
|
-
this._typedArray = undefined;
|
|
416
|
-
this._buffer = undefined;
|
|
417
|
-
this._gltf = undefined;
|
|
418
|
-
this._primitive = undefined;
|
|
419
|
-
};
|
|
420
|
-
|
|
421
408
|
export default GltfIndexBufferLoader;
|