@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
|
@@ -161,39 +161,43 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
const sceneMode = frameState.mode;
|
|
164
|
+
// Bitwise OR uses 32-bit integers; bits 0-31 are packed below.
|
|
165
|
+
// Flags beyond bit 31 use arithmetic to avoid silent wrap-around
|
|
166
|
+
// (x << 32 === x << 0 in JavaScript).
|
|
164
167
|
const flags =
|
|
165
|
-
sceneMode |
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
168
|
+
((sceneMode |
|
|
169
|
+
(applyBrightness << 2) |
|
|
170
|
+
(applyContrast << 3) |
|
|
171
|
+
(applyHue << 4) |
|
|
172
|
+
(applySaturation << 5) |
|
|
173
|
+
(applyGamma << 6) |
|
|
174
|
+
(applyAlpha << 7) |
|
|
175
|
+
(hasWaterMask << 8) |
|
|
176
|
+
(showReflectiveOcean << 9) |
|
|
177
|
+
(showOceanWaves << 10) |
|
|
178
|
+
(enableLighting << 11) |
|
|
179
|
+
(dynamicAtmosphereLighting << 12) |
|
|
180
|
+
(dynamicAtmosphereLightingFromSun << 13) |
|
|
181
|
+
(showGroundAtmosphere << 14) |
|
|
182
|
+
(perFragmentGroundAtmosphere << 15) |
|
|
183
|
+
(hasVertexNormals << 16) |
|
|
184
|
+
(useWebMercatorProjection << 17) |
|
|
185
|
+
(enableFog << 18) |
|
|
186
|
+
(quantization << 19) |
|
|
187
|
+
(applySplit << 20) |
|
|
188
|
+
(enableClippingPlanes << 21) |
|
|
189
|
+
(enableClippingPolygons << 22) |
|
|
190
|
+
(cartographicLimitRectangleFlag << 23) |
|
|
191
|
+
(imageryCutoutFlag << 24) |
|
|
192
|
+
(colorCorrect << 25) |
|
|
193
|
+
(highlightFillTile << 26) |
|
|
194
|
+
(colorToAlpha << 27) |
|
|
195
|
+
(hasGeodeticSurfaceNormals << 28) |
|
|
196
|
+
(hasExaggeration << 29) |
|
|
197
|
+
(showUndergroundColor << 30) |
|
|
198
|
+
(translucent << 31)) >>>
|
|
199
|
+
0) +
|
|
200
|
+
(applyDayNightAlpha ? 0x100000000 : 0);
|
|
197
201
|
|
|
198
202
|
let currentClippingShaderState = 0;
|
|
199
203
|
if (defined(clippingPlanes) && clippingPlanes.length > 0) {
|
|
@@ -12,89 +12,83 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
|
12
12
|
* Implements the {@link ResourceLoader} interface.
|
|
13
13
|
* </p>
|
|
14
14
|
*
|
|
15
|
-
* @alias GltfBufferViewLoader
|
|
16
|
-
* @constructor
|
|
17
|
-
* @augments ResourceLoader
|
|
18
|
-
*
|
|
19
|
-
* @param {object} options Object with the following properties:
|
|
20
|
-
* @param {ResourceCache} options.resourceCache The {@link ResourceCache} (to avoid circular dependencies).
|
|
21
|
-
* @param {object} options.gltf The glTF JSON.
|
|
22
|
-
* @param {number} options.bufferViewId The buffer view ID.
|
|
23
|
-
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
24
|
-
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
25
|
-
* @param {string} [options.cacheKey] The cache key of the resource.
|
|
26
|
-
*
|
|
27
15
|
* @private
|
|
28
16
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
bufferId =
|
|
60
|
-
byteOffset =
|
|
61
|
-
byteLength =
|
|
62
|
-
|
|
63
|
-
hasMeshopt =
|
|
64
|
-
meshoptByteStride
|
|
65
|
-
meshoptCount
|
|
66
|
-
meshoptMode
|
|
67
|
-
meshoptFilter
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this._buffer = buffer;
|
|
82
|
-
this._bufferId = bufferId;
|
|
83
|
-
this._byteOffset = byteOffset;
|
|
84
|
-
this._byteLength = byteLength;
|
|
85
|
-
this._cacheKey = cacheKey;
|
|
86
|
-
this._bufferLoader = undefined;
|
|
87
|
-
this._typedArray = undefined;
|
|
88
|
-
this._state = ResourceLoaderState.UNLOADED;
|
|
89
|
-
this._promise = undefined;
|
|
90
|
-
}
|
|
17
|
+
class GltfBufferViewLoader extends ResourceLoader {
|
|
18
|
+
/**
|
|
19
|
+
* @param {object} options Object with the following properties:
|
|
20
|
+
* @param {ResourceCache} options.resourceCache The {@link ResourceCache} (to avoid circular dependencies).
|
|
21
|
+
* @param {object} options.gltf The glTF JSON.
|
|
22
|
+
* @param {number} options.bufferViewId The buffer view ID.
|
|
23
|
+
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
24
|
+
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
25
|
+
* @param {string} [options.cacheKey] The cache key of the resource.
|
|
26
|
+
*/
|
|
27
|
+
constructor(options) {
|
|
28
|
+
super();
|
|
29
|
+
|
|
30
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
31
|
+
const resourceCache = options.resourceCache;
|
|
32
|
+
const gltf = options.gltf;
|
|
33
|
+
const bufferViewId = options.bufferViewId;
|
|
34
|
+
const gltfResource = options.gltfResource;
|
|
35
|
+
const baseResource = options.baseResource;
|
|
36
|
+
const cacheKey = options.cacheKey;
|
|
37
|
+
|
|
38
|
+
//>>includeStart('debug', pragmas.debug);
|
|
39
|
+
Check.typeOf.func("options.resourceCache", resourceCache);
|
|
40
|
+
Check.typeOf.object("options.gltf", gltf);
|
|
41
|
+
Check.typeOf.number("options.bufferViewId", bufferViewId);
|
|
42
|
+
Check.typeOf.object("options.gltfResource", gltfResource);
|
|
43
|
+
Check.typeOf.object("options.baseResource", baseResource);
|
|
44
|
+
//>>includeEnd('debug');
|
|
45
|
+
|
|
46
|
+
const bufferView = gltf.bufferViews[bufferViewId];
|
|
47
|
+
let bufferId = bufferView.buffer;
|
|
48
|
+
let byteOffset = bufferView.byteOffset;
|
|
49
|
+
let byteLength = bufferView.byteLength;
|
|
50
|
+
|
|
51
|
+
let hasMeshopt = false;
|
|
52
|
+
let meshoptByteStride;
|
|
53
|
+
let meshoptCount;
|
|
54
|
+
let meshoptMode;
|
|
55
|
+
let meshoptFilter;
|
|
56
|
+
|
|
57
|
+
if (hasExtension(bufferView, "EXT_meshopt_compression")) {
|
|
58
|
+
const meshopt = bufferView.extensions.EXT_meshopt_compression;
|
|
59
|
+
bufferId = meshopt.buffer;
|
|
60
|
+
byteOffset = meshopt.byteOffset ?? 0;
|
|
61
|
+
byteLength = meshopt.byteLength;
|
|
62
|
+
|
|
63
|
+
hasMeshopt = true;
|
|
64
|
+
meshoptByteStride = meshopt.byteStride;
|
|
65
|
+
meshoptCount = meshopt.count;
|
|
66
|
+
meshoptMode = meshopt.mode;
|
|
67
|
+
meshoptFilter = meshopt.filter ?? "NONE";
|
|
68
|
+
}
|
|
91
69
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
70
|
+
const buffer = gltf.buffers[bufferId];
|
|
71
|
+
|
|
72
|
+
this._hasMeshopt = hasMeshopt;
|
|
73
|
+
this._meshoptByteStride = meshoptByteStride;
|
|
74
|
+
this._meshoptCount = meshoptCount;
|
|
75
|
+
this._meshoptMode = meshoptMode;
|
|
76
|
+
this._meshoptFilter = meshoptFilter;
|
|
77
|
+
|
|
78
|
+
this._resourceCache = resourceCache;
|
|
79
|
+
this._gltfResource = gltfResource;
|
|
80
|
+
this._baseResource = baseResource;
|
|
81
|
+
this._buffer = buffer;
|
|
82
|
+
this._bufferId = bufferId;
|
|
83
|
+
this._byteOffset = byteOffset;
|
|
84
|
+
this._byteLength = byteLength;
|
|
85
|
+
this._cacheKey = cacheKey;
|
|
86
|
+
this._bufferLoader = undefined;
|
|
87
|
+
this._typedArray = undefined;
|
|
88
|
+
this._state = ResourceLoaderState.UNLOADED;
|
|
89
|
+
this._promise = undefined;
|
|
90
|
+
}
|
|
96
91
|
|
|
97
|
-
Object.defineProperties(GltfBufferViewLoader.prototype, {
|
|
98
92
|
/**
|
|
99
93
|
* The cache key of the resource.
|
|
100
94
|
*
|
|
@@ -104,11 +98,10 @@ Object.defineProperties(GltfBufferViewLoader.prototype, {
|
|
|
104
98
|
* @readonly
|
|
105
99
|
* @private
|
|
106
100
|
*/
|
|
107
|
-
cacheKey
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
101
|
+
get cacheKey() {
|
|
102
|
+
return this._cacheKey;
|
|
103
|
+
}
|
|
104
|
+
|
|
112
105
|
/**
|
|
113
106
|
* The typed array containing buffer view data.
|
|
114
107
|
*
|
|
@@ -118,12 +111,38 @@ Object.defineProperties(GltfBufferViewLoader.prototype, {
|
|
|
118
111
|
* @readonly
|
|
119
112
|
* @private
|
|
120
113
|
*/
|
|
121
|
-
typedArray
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
get typedArray() {
|
|
115
|
+
return this._typedArray;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Loads the resource.
|
|
120
|
+
* @returns {Promise<GltfBufferViewLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
async load() {
|
|
124
|
+
if (defined(this._promise)) {
|
|
125
|
+
return this._promise;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this._state = ResourceLoaderState.LOADING;
|
|
129
|
+
this._promise = loadResources(this);
|
|
130
|
+
return this._promise;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Unloads the resource.
|
|
135
|
+
* @private
|
|
136
|
+
*/
|
|
137
|
+
unload() {
|
|
138
|
+
if (defined(this._bufferLoader) && !this._bufferLoader.isDestroyed()) {
|
|
139
|
+
this._resourceCache.unload(this._bufferLoader);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
this._bufferLoader = undefined;
|
|
143
|
+
this._typedArray = undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
127
146
|
|
|
128
147
|
/**
|
|
129
148
|
* Load the resources associated with the loader.
|
|
@@ -181,21 +200,6 @@ async function loadResources(loader) {
|
|
|
181
200
|
}
|
|
182
201
|
}
|
|
183
202
|
|
|
184
|
-
/**
|
|
185
|
-
* Loads the resource.
|
|
186
|
-
* @returns {Promise<GltfBufferViewLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
187
|
-
* @private
|
|
188
|
-
*/
|
|
189
|
-
GltfBufferViewLoader.prototype.load = async function () {
|
|
190
|
-
if (defined(this._promise)) {
|
|
191
|
-
return this._promise;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
this._state = ResourceLoaderState.LOADING;
|
|
195
|
-
this._promise = loadResources(this);
|
|
196
|
-
return this._promise;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
203
|
/**
|
|
200
204
|
* Get the buffer loader for the specified buffer view loader.
|
|
201
205
|
* Attempts to retrieve from the resource cache first. If a buffer loader is
|
|
@@ -226,17 +230,4 @@ function getBufferLoader(bufferViewLoader) {
|
|
|
226
230
|
});
|
|
227
231
|
}
|
|
228
232
|
|
|
229
|
-
/**
|
|
230
|
-
* Unloads the resource.
|
|
231
|
-
* @private
|
|
232
|
-
*/
|
|
233
|
-
GltfBufferViewLoader.prototype.unload = function () {
|
|
234
|
-
if (defined(this._bufferLoader) && !this._bufferLoader.isDestroyed()) {
|
|
235
|
-
this._resourceCache.unload(this._bufferLoader);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
this._bufferLoader = undefined;
|
|
239
|
-
this._typedArray = undefined;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
233
|
export default GltfBufferViewLoader;
|